net/cnxk: fix incorrect queue index validation
PATCH 1/1 net/cnxk: fix incorrect queue index validation
From: Satheesh Paul <[email protected]>
When creating a flow rule directing traffic from PF to VF, current validation is incorrectly checking the RQ index in flow action with the PF's maximum configured RQs. This validation is applicable only when action target is an RQ of the PF. The validation has been modified accordingly.
--- drivers/net/cnxk/cnxk_flow.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/net/cnxk/cnxk_flow.c +12 -8
@@ -117,13 +117,14 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, uint32_t *flowkey_cfg, uint16_t *dst_pf_func) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); +const struct rte_flow_action_queue *act_q =NULL ;const struct rte_flow_action_ethdev *act_ethdev;const struct rte_flow_action_port_id *port_act; -const struct rte_flow_action_queue *act_q;struct rte_eth_dev *portid_eth_dev;char if_name[RTE_ETH_NAME_MAX_LEN ];struct cnxk_eth_dev *hw_dst;struct roc_npc *roc_npc_dst; +bool is_vf_action = false;int i =0 , rc =0 ;int rq;
@@ -157,6 +158,7 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,case RTE_FLOW_ACTION_TYPE_VF : in_actions[i].type =ROC_NPC_ACTION_TYPE_VF ; in_actions[i].conf = actions->conf; + is_vf_action = true;break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT :
@@ -189,13 +191,7 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,break ;case RTE_FLOW_ACTION_TYPE_QUEUE : - act_q = (const struct rte_flow_action_queue *) - actions->conf; - rq = act_q->index; -if (rq >= eth_dev->data->nb_rx_queues) { -plt_npc_dbg ("Invalid queue index" ); - goto err_exit; - } + act_q = (const struct rte_flow_action_queue *)actions->conf; in_actions[i].type =ROC_NPC_ACTION_TYPE_QUEUE ; in_actions[i].conf = actions->conf;break ;
@@ -241,6 +237,14 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, } i++; } + +if (!is_vf_action && act_q) { + rq = act_q->index; +if (rq >= eth_dev->data->nb_rx_queues) { +plt_npc_dbg ("Invalid queue index" ); + goto err_exit; + } + } in_actions[i].type =ROC_NPC_ACTION_TYPE_END ;return 0 ;
Signature · 1 line
2.39.2
Jerin Jacob
AppliedQuoted 10 lines · On Tue, Jun 20, 2023 at 4:32 PM <[email protected]> wrote:
From: Satheesh Paul <[email protected]>
When creating a flow rule directing traffic from PF to VF, current validation is incorrectly checking the RQ index in flow action with the PF's maximum configured RQs. This validation is applicable only when action target is an RQ of the PF. The validation has been modified accordingly.
Quoted 5 lines
Fixes 8c009b4505e ("net/cnxk: support flow API")Signed-off-by Satheesh Paul <[email protected]>Reviewed-by Kiran Kumar K <[email protected]>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks