net/cnxk: fix incorrect queue index validation
Checks
Commit Message
From: Satheesh Paul <psatheesh@marvell.com>
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.
Fixes: 8c009b4505e ("net/cnxk: support flow API")
Cc: stable@dpdk.org
Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
---
drivers/net/cnxk/cnxk_flow.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
Comments
On Tue, Jun 20, 2023 at 4:32 PM <psatheesh@marvell.com> wrote:
>
> From: Satheesh Paul <psatheesh@marvell.com>
>
> 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.
>
> Fixes: 8c009b4505e ("net/cnxk: support flow API")
> Cc: stable@dpdk.org
>
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
> Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks
@@ -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;