DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] fix problems about flow steering
@ 2024-03-12  8:02 Chaoyong He
  2024-03-12  8:02 ` [PATCH 1/2] net/nfp: fix IP flow rule failed Chaoyong He
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chaoyong He @ 2024-03-12  8:02 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

This patch series fix some problems exist in the flow steering logic.

Long Wu (2):
  net/nfp: fix IP flow rule failed
  net/nfp: fix incorrect queue index

 drivers/net/nfp/nfp_net_flow.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

-- 
2.39.1


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

* [PATCH 1/2] net/nfp: fix IP flow rule failed
  2024-03-12  8:02 [PATCH 0/2] fix problems about flow steering Chaoyong He
@ 2024-03-12  8:02 ` Chaoyong He
  2024-03-12  8:02 ` [PATCH 2/2] net/nfp: fix incorrect queue index Chaoyong He
  2024-03-13 18:10 ` [PATCH 0/2] fix problems about flow steering Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2024-03-12  8:02 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Chaoyong He, stable

From: Long Wu <long.wu@corigine.com>

If the flow rule dose not have 'spec' in IP layer, NFP will
set all IP flow control message type to 0.

Move up the IP flow control message setting code to fix it.

Fixes: 42eabda06b0f ("net/nfp: support IPv4 flow item")
Fixes: 9f27cb889246 ("net/nfp: support IPv6 flow item")
Cc: Chaoyong He <chaoyong.he@corigine.com>
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_net_flow.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/nfp_net_flow.c b/drivers/net/nfp/nfp_net_flow.c
index 3b33f3b6e9..bd983aaf6a 100644
--- a/drivers/net/nfp/nfp_net_flow.c
+++ b/drivers/net/nfp/nfp_net_flow.c
@@ -237,6 +237,8 @@ nfp_net_flow_merge_ipv4(struct rte_flow *nfp_flow,
 	const struct rte_flow_item_ipv4 *mask;
 	const struct rte_flow_item_ipv4 *spec;
 
+	nfp_flow->payload.cmsg_type = NFP_NET_CFG_MBOX_CMD_FS_ADD_V4;
+
 	spec = item->spec;
 	if (spec == NULL) {
 		PMD_DRV_LOG(DEBUG, "NFP flow merge ipv4: no item->spec!");
@@ -245,7 +247,6 @@ nfp_net_flow_merge_ipv4(struct rte_flow *nfp_flow,
 
 	mask = (item->mask != NULL) ? item->mask : proc->mask_default;
 
-	nfp_flow->payload.cmsg_type = NFP_NET_CFG_MBOX_CMD_FS_ADD_V4;
 	ipv4 = (struct nfp_net_cmsg_match_v4 *)nfp_flow->payload.match_data;
 
 	ipv4->l4_protocol_mask = mask->hdr.next_proto_id;
@@ -269,6 +270,8 @@ nfp_net_flow_merge_ipv6(struct rte_flow *nfp_flow,
 	const struct rte_flow_item_ipv6 *mask;
 	const struct rte_flow_item_ipv6 *spec;
 
+	nfp_flow->payload.cmsg_type = NFP_NET_CFG_MBOX_CMD_FS_ADD_V6;
+
 	spec = item->spec;
 	if (spec == NULL) {
 		PMD_DRV_LOG(DEBUG, "NFP flow merge ipv6: no item->spec!");
@@ -277,7 +280,6 @@ nfp_net_flow_merge_ipv6(struct rte_flow *nfp_flow,
 
 	mask = (item->mask != NULL) ? item->mask : proc->mask_default;
 
-	nfp_flow->payload.cmsg_type = NFP_NET_CFG_MBOX_CMD_FS_ADD_V6;
 	ipv6 = (struct nfp_net_cmsg_match_v6 *)nfp_flow->payload.match_data;
 
 	ipv6->l4_protocol_mask = mask->hdr.proto;
-- 
2.39.1


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

* [PATCH 2/2] net/nfp: fix incorrect queue index
  2024-03-12  8:02 [PATCH 0/2] fix problems about flow steering Chaoyong He
  2024-03-12  8:02 ` [PATCH 1/2] net/nfp: fix IP flow rule failed Chaoyong He
@ 2024-03-12  8:02 ` Chaoyong He
  2024-03-13 18:10 ` [PATCH 0/2] fix problems about flow steering Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2024-03-12  8:02 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Chaoyong He, stable

From: Long Wu <long.wu@corigine.com>

When user adds a queue flow rule with incorrect queue index,
the rule can be added successfully but the packets are not
directed to the queue. The reason is that queue action does
not check validity of queue index in driver.

Add code to check queue index in queue action.

Fixes: 7493f8a527cc ("net/nfp: support queue flow action")
Cc: Chaoyong He <chaoyong.he@corigine.com>
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_net_flow.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/net/nfp/nfp_net_flow.c b/drivers/net/nfp/nfp_net_flow.c
index bd983aaf6a..ff6ce3ee45 100644
--- a/drivers/net/nfp/nfp_net_flow.c
+++ b/drivers/net/nfp/nfp_net_flow.c
@@ -564,8 +564,9 @@ nfp_net_flow_action_mark(struct rte_flow *nfp_flow,
 	action_data->mark_id = mark->id;
 }
 
-static void
-nfp_net_flow_action_queue(struct rte_flow *nfp_flow,
+static int
+nfp_net_flow_action_queue(struct rte_eth_dev *dev,
+		struct rte_flow *nfp_flow,
 		const struct rte_flow_action *action)
 {
 	struct nfp_net_cmsg_action *action_data;
@@ -573,15 +574,24 @@ nfp_net_flow_action_queue(struct rte_flow *nfp_flow,
 
 	action_data = (struct nfp_net_cmsg_action *)nfp_flow->payload.action_data;
 	queue = action->conf;
+	if (queue->index >= dev->data->nb_rx_queues ||
+			dev->data->rx_queues[queue->index] == NULL) {
+		PMD_DRV_LOG(ERR, "Queue index is illegal");
+		return -EINVAL;
+	}
 
 	action_data->action |= NFP_NET_CMSG_ACTION_QUEUE;
 	action_data->queue = queue->index;
+
+	return 0;
 }
 
 static int
-nfp_net_flow_compile_actions(const struct rte_flow_action actions[],
+nfp_net_flow_compile_actions(struct rte_eth_dev *dev,
+		const struct rte_flow_action actions[],
 		struct rte_flow *nfp_flow)
 {
+	int ret = 0;
 	const struct rte_flow_action *action;
 
 	for (action = actions; action->type != RTE_FLOW_ACTION_TYPE_END; ++action) {
@@ -596,7 +606,7 @@ nfp_net_flow_compile_actions(const struct rte_flow_action actions[],
 			break;
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 			PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_QUEUE");
-			nfp_net_flow_action_queue(nfp_flow, action);
+			ret = nfp_net_flow_action_queue(dev, nfp_flow, action);
 			break;
 		default:
 			PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type);
@@ -604,7 +614,7 @@ nfp_net_flow_compile_actions(const struct rte_flow_action actions[],
 		}
 	}
 
-	return 0;
+	return ret;
 }
 
 static void
@@ -670,7 +680,7 @@ nfp_net_flow_setup(struct rte_eth_dev *dev,
 		goto free_flow;
 	}
 
-	ret = nfp_net_flow_compile_actions(actions, nfp_flow);
+	ret = nfp_net_flow_compile_actions(dev, actions, nfp_flow);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "NFP flow action process failed.");
 		goto free_flow;
-- 
2.39.1


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

* Re: [PATCH 0/2] fix problems about flow steering
  2024-03-12  8:02 [PATCH 0/2] fix problems about flow steering Chaoyong He
  2024-03-12  8:02 ` [PATCH 1/2] net/nfp: fix IP flow rule failed Chaoyong He
  2024-03-12  8:02 ` [PATCH 2/2] net/nfp: fix incorrect queue index Chaoyong He
@ 2024-03-13 18:10 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2024-03-13 18:10 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers

On 3/12/2024 8:02 AM, Chaoyong He wrote:
> This patch series fix some problems exist in the flow steering logic.
> 
> Long Wu (2):
>   net/nfp: fix IP flow rule failed
>   net/nfp: fix incorrect queue index
>

Series applied to dpdk-next-net/main, thanks.

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

end of thread, other threads:[~2024-03-13 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12  8:02 [PATCH 0/2] fix problems about flow steering Chaoyong He
2024-03-12  8:02 ` [PATCH 1/2] net/nfp: fix IP flow rule failed Chaoyong He
2024-03-12  8:02 ` [PATCH 2/2] net/nfp: fix incorrect queue index Chaoyong He
2024-03-13 18:10 ` [PATCH 0/2] fix problems about flow steering Ferruh Yigit

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