DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/cnxk: fix incorrect queue index validation
@ 2023-06-20 11:01 psatheesh
  2023-06-21  4:33 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: psatheesh @ 2023-06-20 11:01 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, Satheesh Paul, stable

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(-)

diff --git a/drivers/net/cnxk/cnxk_flow.c b/drivers/net/cnxk/cnxk_flow.c
index 1b88542dcb..3b8348ae9c 100644
--- a/drivers/net/cnxk/cnxk_flow.c
+++ b/drivers/net/cnxk/cnxk_flow.c
@@ -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;
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/cnxk: fix incorrect queue index validation
  2023-06-20 11:01 [dpdk-dev] [PATCH] net/cnxk: fix incorrect queue index validation psatheesh
@ 2023-06-21  4:33 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2023-06-21  4:33 UTC (permalink / raw)
  To: psatheesh
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	dev, stable

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-21  4:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 11:01 [dpdk-dev] [PATCH] net/cnxk: fix incorrect queue index validation psatheesh
2023-06-21  4:33 ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).