DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/nfp: only flush specified port flow table
@ 2023-02-16  6:36 Chaoyong He
  2023-02-16 17:08 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Chaoyong He @ 2023-02-16  6:36 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Jin Liu, stable, Chaoyong He

From: Jin Liu <jin.liu@corigine.com>

The flow flush function will destroy all the flow table on all the
port of NFP nic rather than the provide port. Modify logic, only
destroy the flow table on the corresponding port.

Fixes: 30ecce522732 ("net/nfp: support flow API")
Cc: stable@dpdk.org

Signed-off-by: Jin Liu <jin.liu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_flow.c | 18 +++++++++++++-----
 drivers/net/nfp/nfp_flow.h |  1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 4d4d21d997..bc28edee4c 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -339,7 +339,7 @@ nfp_flow_table_search(struct nfp_flow_priv *priv,
 }
 
 static struct rte_flow *
-nfp_flow_alloc(struct nfp_fl_key_ls *key_layer)
+nfp_flow_alloc(struct nfp_fl_key_ls *key_layer, uint32_t port_id)
 {
 	char *tmp;
 	size_t len;
@@ -357,6 +357,7 @@ nfp_flow_alloc(struct nfp_fl_key_ls *key_layer)
 
 	nfp_flow->length = len;
 	nfp_flow->mtr_id       = NFP_MAX_MTR_CNT;
+	nfp_flow->port_id      = port_id;
 	payload                = &nfp_flow->payload;
 	payload->meta          = (struct nfp_fl_rule_metadata *)tmp;
 	payload->unmasked_data = tmp + sizeof(struct nfp_fl_rule_metadata);
@@ -3549,7 +3550,7 @@ nfp_flow_process(struct nfp_flower_representor *representor,
 		return NULL;
 	}
 
-	nfp_flow = nfp_flow_alloc(&key_layer);
+	nfp_flow = nfp_flow_alloc(&key_layer, representor->port_id);
 	if (nfp_flow == NULL) {
 		PMD_DRV_LOG(ERR, "Alloc nfp flow failed.");
 		goto free_stats;
@@ -3880,14 +3881,21 @@ nfp_flow_flush(struct rte_eth_dev *dev,
 	void *next_data;
 	uint32_t iter = 0;
 	const void *next_key;
+	struct rte_flow *nfp_flow;
 	struct nfp_flow_priv *priv;
+	struct nfp_flower_representor *representor;
+
+	representor = dev->data->dev_private;
 
 	priv = nfp_flow_dev_to_priv(dev);
 
 	while (rte_hash_iterate(priv->flow_table, &next_key, &next_data, &iter) >= 0) {
-		ret = nfp_flow_destroy(dev, (struct rte_flow *)next_data, error);
-		if (ret != 0)
-			break;
+		nfp_flow = next_data;
+		if (nfp_flow->port_id == representor->port_id) {
+			ret = nfp_flow_destroy(dev, nfp_flow, error);
+			if (ret != 0)
+				break;
+		}
 	}
 
 	return ret;
diff --git a/drivers/net/nfp/nfp_flow.h b/drivers/net/nfp/nfp_flow.h
index b8da752a9d..d352671c2c 100644
--- a/drivers/net/nfp/nfp_flow.h
+++ b/drivers/net/nfp/nfp_flow.h
@@ -223,6 +223,7 @@ struct rte_flow {
 	size_t length;
 	uint32_t hash_key;
 	uint32_t mtr_id;
+	uint32_t port_id;
 	bool install_flag;
 	enum nfp_flow_type type;
 };
-- 
2.29.3


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

* Re: [PATCH] net/nfp: only flush specified port flow table
  2023-02-16  6:36 [PATCH] net/nfp: only flush specified port flow table Chaoyong He
@ 2023-02-16 17:08 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2023-02-16 17:08 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, niklas.soderlund, Jin Liu, stable

On 2/16/2023 6:36 AM, Chaoyong He wrote:
> From: Jin Liu <jin.liu@corigine.com>
> 
> The flow flush function will destroy all the flow table on all the
> port of NFP nic rather than the provide port. Modify logic, only
> destroy the flow table on the corresponding port.
> 
> Fixes: 30ecce522732 ("net/nfp: support flow API")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>

Applied to dpdk-next-net/main, thanks.

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

end of thread, other threads:[~2023-02-16 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16  6:36 [PATCH] net/nfp: only flush specified port flow table Chaoyong He
2023-02-16 17:08 ` 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).