Add RSS action support in the sample sub-actions list
cover Add RSS action support in the sample sub-actions list
Currently the sample flow only supports Queue action in NIC-Rx domain. This RFC adds the RSS action support in the sample sub-actions list.
The examples for the sample flow with RSS action 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 and sent to rss queues of the control application.
Jiawei Wang (2):
app/testpmd: add RSS support in sample action
net/mlx5: handle the RSS action in the sample
app/test-pmd/cmdline_flow.c | 26 +++++ drivers/net/mlx5/mlx5_flow.c | 24 ++++- drivers/net/mlx5/mlx5_flow_dv.c | 230 ++++++++++++++++++++++++++++------------ 3 files changed, 205 insertions(+), 75 deletions(-)
Signature · 1 line
1.8.3.1
RFC 1/2 app/testpmd: add RSS support 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 and sent to rss queues of the control application.
--- app/test-pmd/cmdline_flow.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
app/test-pmd/cmdline_flow.c +26 -0
@@ -560,6 +560,7 @@ struct raw_sample_conf {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 ];/** Maximum number of subsequent tokens and arguments on the stack. */ #define CTX_STACK_SIZE 16
@@ -1548,6 +1549,7 @@ struct parse_action_priv {static const enum index next_action_sample[] = {ACTION_QUEUE , +ACTION_RSS ,ACTION_MARK ,ACTION_COUNT ,ACTION_PORT_ID ,
@@ -7515,6 +7517,7 @@ static int comp_set_sample_index(struct context *, const struct token *,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) *
@@ -7546,6 +7549,29 @@ static int comp_set_sample_index(struct context *, const struct token *, (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],
Signature · 1 line
1.8.3.1
RFC 2/2 net/mlx5: handle the RSS action in the sample
In reply to Jiawei WangPMD validates the rss action in the sample sub-actions list, then translate into rdma-core action and it will be used for sample path destination.
If the RSS action both in sample sub-actions list and original flow, the rss level and rss type in the sample sub-actions list should be consistent with the original flow list, since the expanding items for RSS should same in one flow.
--- drivers/net/mlx5/mlx5_flow.c | 24 ++++- drivers/net/mlx5/mlx5_flow_dv.c | 230 ++++++++++++++++++++++++++++------------ 2 files changed, 179 insertions(+), 75 deletions(-)
drivers/net/mlx5/mlx5_flow.c +19 -5
@@ -3149,16 +3149,28 @@ struct mlx5_flow_tunnel_info {static const struct rte_flow_action_rss *flow_get_rss_action (const struct rte_flow_action actions[]) { +const struct rte_flow_action_rss *rss =NULL ; +for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) {switch (actions->type) {case RTE_FLOW_ACTION_TYPE_RSS : -return (const struct rte_flow_action_rss *) - actions->conf; + rss = actions->conf; +break ; +case RTE_FLOW_ACTION_TYPE_SAMPLE : + { +const struct rte_flow_action_sample *sample = + actions->conf; +const struct rte_flow_action *act = sample->actions; +for (; act->type !=RTE_FLOW_ACTION_TYPE_END ; act++) +if (act->type ==RTE_FLOW_ACTION_TYPE_RSS ) + rss = act->conf; +break ; + }default :break ; } } -return NULL ; +return rss; }/**
@@ -5253,7 +5265,7 @@ struct mlx5_hlist_entry *struct mlx5_priv *priv = dev->data->dev_private;struct rte_flow *flow =NULL ;struct mlx5_flow *dev_flow; -const struct rte_flow_action_rss *rss; +const struct rte_flow_action_rss *rss =NULL ;struct mlx5_translated_shared_action shared_actions[MLX5_MAX_SHARED_ACTIONS ];int shared_actions_n =MLX5_MAX_SHARED_ACTIONS ;
@@ -5331,7 +5343,9 @@ struct mlx5_hlist_entry *MLX5_ASSERT (flow->drv_type >MLX5_FLOW_TYPE_MIN && flow->drv_type <MLX5_FLOW_TYPE_MAX );memset (rss_desc,0 , offsetof(struct mlx5_flow_rss_desc , queue)); - rss =flow_get_rss_action (p_actions_rx); +/* RSS Action only works on NIC RX domain */ +if (attr->ingress && !attr->transfer) + rss =flow_get_rss_action (p_actions_rx);if (rss) {if (flow_rss_workspace_adjust (wks, rss_desc, rss->queue_num))return 0 ;
drivers/net/mlx5/mlx5_flow_dv.c +160 -70
345 lines not on this page · raw message
Signature · 1 line
1.8.3.1