patches for DPDK stable branches
 help / color / mirror / Atom feed
From: <psatheesh@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, Satheesh Paul <psatheesh@marvell.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/cnxk: fix incorrect queue index validation
Date: Tue, 20 Jun 2023 16:31:37 +0530	[thread overview]
Message-ID: <20230620110137.1416830-1-psatheesh@marvell.com> (raw)

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


             reply	other threads:[~2023-06-20 11:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 11:01 psatheesh [this message]
2023-06-21  4:33 ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230620110137.1416830-1-psatheesh@marvell.com \
    --to=psatheesh@marvell.com \
    --cc=dev@dpdk.org \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).