From: Jiawei Wang Date: Thu, 14 Jan 2021 07:24:45 +0000 (+0200) Subject: app/testpmd: support RSS in sample action X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=11b1b0eddade2c78471f7cf67430e0727f727d88;p=dpdk.git app/testpmd: support RSS in sample action Support rss action in the sample sub-actions list. The examples for the sample flow use case and result as below: set sample_actions 0 mark id 0x12 / rss queues 0 1 2 3 end / end flow create 0 ingress group 1 pattern eth / end actions sample ratio 1 index 0 / jump group 2 / end This flow will result in all the matched ingress packets will be jumped to next table, and the each packet will be marked with 0x12 and duplicated to rss queues of the control application. Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko --- diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 0793a6a1fb..0618611ab1 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -582,6 +582,7 @@ struct rte_flow_action_queue sample_queue[RAW_SAMPLE_CONFS_MAX_NUM]; struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM]; struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM]; struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM]; +struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM]; static const char *const modify_field_ops[] = { "set", "add", "sub", NULL @@ -1608,6 +1609,7 @@ static const enum index action_sample[] = { static const enum index next_action_sample[] = { ACTION_QUEUE, + ACTION_RSS, ACTION_MARK, ACTION_COUNT, ACTION_PORT_ID, @@ -7846,6 +7848,7 @@ cmd_set_raw_parsed_sample(const struct buffer *in) uint32_t i = 0; struct rte_flow_action *action = NULL; struct rte_flow_action *data = NULL; + const struct rte_flow_action_rss *rss = NULL; size_t size = 0; uint16_t idx = in->port; /* We borrow port field as index */ uint32_t max_size = sizeof(struct rte_flow_action) * @@ -7877,6 +7880,29 @@ cmd_set_raw_parsed_sample(const struct buffer *in) (const void *)action->conf, size); action->conf = &sample_queue[idx]; break; + case RTE_FLOW_ACTION_TYPE_RSS: + size = sizeof(struct rte_flow_action_rss); + rss = action->conf; + rte_memcpy(&sample_rss_data[idx].conf, + (const void *)rss, size); + if (rss->key_len) { + sample_rss_data[idx].conf.key = + sample_rss_data[idx].key; + rte_memcpy((void *)((uintptr_t) + sample_rss_data[idx].conf.key), + (const void *)rss->key, + sizeof(uint8_t) * rss->key_len); + } + if (rss->queue_num) { + sample_rss_data[idx].conf.queue = + sample_rss_data[idx].queue; + rte_memcpy((void *)((uintptr_t) + sample_rss_data[idx].conf.queue), + (const void *)rss->queue, + sizeof(uint16_t) * rss->queue_num); + } + action->conf = &sample_rss_data[idx].conf; + break; case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: size = sizeof(struct rte_flow_action_raw_encap); rte_memcpy(&sample_encap[idx],