src/dpdk/drivers/net/hns3/hns3_flow.c
static const struct rte_flow_action *
hns3_find_rss_general_action(const struct rte_flow_item pattern[],
			     const struct rte_flow_action actions[])
{
	const struct rte_flow_action *act = NULL;
	const struct hns3_rss_conf *rss;
	bool have_eth = false;

	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
		if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) {
			act = actions;
			break;
		}
	}
	if (!act)
		return NULL;

	for (; pattern->type != RTE_FLOW_ITEM_TYPE_END; pattern++) {
		if (pattern->type == RTE_FLOW_ITEM_TYPE_ETH) {
			have_eth = true;
			break;
		}
	}

	rss = act->conf;
	if (have_eth && rss->conf.queue_num) {
		/*
		 * Pattern have ETH and action's queue_num > 0, indicate this is
		 * queue region configuration.
		 * Because queue region is implemented by FDIR + RSS in hns3
		 * hardware, it needs to enter FDIR process, so here return NULL
		 * to avoid enter RSS process.
		 */
		return NULL;
	}

	return act;
}
/*
 * This function is used to find rss general action.
 * 1. As we know RSS is used to spread packets among several queues, the flow
 *    API provide the struct rte_flow_action_rss, user could config its field
 *    sush as: func/level/types/key/queue to control RSS function.
 * 2. The flow API also supports queue region configuration for hns3. It was
 *    implemented by FDIR + RSS in hns3 hardware, user can create one FDIR rule
 *    which action is RSS queues region.
 * 3. When action is RSS, we use the following rule to distinguish:
 *    Case 1: pattern have ETH and action's queue_num > 0, indicate it is queue
 *            region configuration.
 *    Case other: an rss general action.
 */
This function is used to find rss general action.
1. As we know RSS is used to spread packets among several queues, the flow
API provide the struct rte_flow_action_rss, user could config its field
sush as: func/level/types/key/queue to control RSS function.
2. The flow API also supports queue region configuration for hns3. It was
implemented by FDIR + RSS in hns3 hardware, user can create one FDIR rule
which action is RSS queues region.
3. When action is RSS, we use the following rule to distinguish:
Case 1: pattern have ETH and action's queue_num > 0, indicate it is queue
region configuration.
Case other: an rss general action.
This function is used to find rss general action . 1 . As we know RSS is used to spread packets among several queues the flow API provide the struct rte_flow_action_rss user could config its field sush as : func / level / types / key / queue to control RSS function . 2 . The flow API also supports queue region configuration for hns3 . It was implemented by FDIR + RSS in hns3 hardware user can create one FDIR rule which action is RSS queues region . 3 . When action is RSS we use the following rule to distinguish : Case 1 : pattern have ETH and action ' s queue_num > 0 indicate it is queue region configuration . Case other : an rss general action .
static const struct rte_flow_action *
hns3_find_rss_general_action(const struct rte_flow_item pattern[],
			     const struct rte_flow_action actions[])
{
	const struct rte_flow_action *act = NULL;
	const struct hns3_rss_conf *rss;
	bool have_eth = false;
	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
		if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) {
			act = actions;
			break;
		}
	}
	if (!act)
		return NULL;
	for (; pattern->type != RTE_FLOW_ITEM_TYPE_END; pattern++) {
		if (pattern->type == RTE_FLOW_ITEM_TYPE_ETH) {
			have_eth = true;
			break;
		}
	}
	rss = act->conf;
	if (have_eth && rss->conf.queue_num) {
		return NULL;
	}
	return act;
}
static const struct rte_flow_action * hns3_find_rss_general_action ( const struct rte_flow_item pattern [ ] , const struct rte_flow_action actions [ ] ) { const struct rte_flow_action * act = NULL ; const struct hns3_rss_conf * rss ; bool have_eth = false ; for ( ; actions -> type != RTE_FLOW_ACTION_TYPE_END ; actions ++ ) { if ( actions -> type == RTE_FLOW_ACTION_TYPE_RSS ) { act = actions ; break ; } } if ( ! act ) return NULL ; for ( ; pattern -> type != RTE_FLOW_ITEM_TYPE_END ; pattern ++ ) { if ( pattern -> type == RTE_FLOW_ITEM_TYPE_ETH ) { have_eth = true ; break ; } } rss = act -> conf ; if ( have_eth && rss -> conf . queue_num ) { return NULL ; } return act ; }
This function is used to find rss general action.
This function is used to find rss general action .
/*
		 * Pattern have ETH and action's queue_num > 0, indicate this is
		 * queue region configuration.
		 * Because queue region is implemented by FDIR + RSS in hns3
		 * hardware, it needs to enter FDIR process, so here return NULL
		 * to avoid enter RSS process.
		 */