From b95e6d4e75be250629b69e18290f866b1a737a41 Mon Sep 17 00:00:00 2001 From: Ting Xu Date: Fri, 25 Mar 2022 03:45:07 +0000 Subject: flow: enable RSS queue group action for 5G enhancement Enable the flow action for RSS queue group. Packets can be distributed among queues in group based on specific fields. Queues must be continous in the group. This feature is to support 5G enhancement requirement. Type: feature Signed-off-by: Ting Xu Change-Id: I74fdc617659bcb61f00b3b1934c95ab1c73bb8f3 --- src/plugins/dpdk/device/flow.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/plugins/dpdk/device/flow.c') diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c index 91541f40163..9f765a6f845 100644 --- a/src/plugins/dpdk/device/flow.c +++ b/src/plugins/dpdk/device/flow.c @@ -103,6 +103,25 @@ dpdk_flow_convert_rss_types (u64 type, u64 * dpdk_rss_type) return; } +/** Maximum number of queue indices in struct rte_flow_action_rss. */ +#define ACTION_RSS_QUEUE_NUM 128 + +static inline void +dpdk_flow_convert_rss_queues (u32 queue_index, u32 queue_num, + struct rte_flow_action_rss *rss) +{ + u16 *queues = clib_mem_alloc (sizeof (*queues) * ACTION_RSS_QUEUE_NUM); + int i; + + for (i = 0; i < queue_num; i++) + queues[i] = queue_index++; + + rss->queue_num = queue_num; + rss->queue = queues; + + return; +} + static inline enum rte_eth_hash_function dpdk_flow_convert_rss_func (vnet_rss_function_t func) { @@ -505,6 +524,10 @@ pattern_end: /* convert types to DPDK rss bitmask */ dpdk_flow_convert_rss_types (f->rss_types, &rss_type); + if (f->queue_num) + /* convert rss queues to array */ + dpdk_flow_convert_rss_queues (f->queue_index, f->queue_num, &rss); + rss.types = rss_type; if ((rss.func = dpdk_flow_convert_rss_func (f->rss_fun)) == RTE_ETH_HASH_FUNCTION_MAX) -- cgit 1.2.3-korg