patch 'net/bnxt: restore RSS configuration after reset recovery' has been queued to stable release 20.11.5

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 18 13:37:55 CET 2022


Hi,

FYI, your patch has been queued to stable release 20.11.5

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/20/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/7275db81e80e36759e092cdf368833dcc6d3c4e0

Thanks.

Luca Boccassi

---
>From 7275db81e80e36759e092cdf368833dcc6d3c4e0 Mon Sep 17 00:00:00 2001
From: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
Date: Tue, 4 Jan 2022 14:08:10 +0530
Subject: [PATCH] net/bnxt: restore RSS configuration after reset recovery

[ upstream commit 9b4353bec3d17d241e511f7d6917417fd395c462 ]

During reset recovery, driver is not restoring the VNIC rss hash key.
It's generating a new random hash key which results in unexpected
RSS behavior after recovery. Fixed this by storing the VNIC RSS
configuration to a local struct and then applying the cached value
during the recovery.

Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur at broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  2 ++
 drivers/net/bnxt/bnxt_ethdev.c | 36 ++++++++++++++++++++++++++++++----
 drivers/net/bnxt/bnxt_rxq.c    |  2 +-
 drivers/net/bnxt/bnxt_vnic.c   |  9 +++++++--
 drivers/net/bnxt/bnxt_vnic.h   |  2 +-
 5 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 823a764191..b37b338349 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -859,6 +859,8 @@ struct bnxt {
 	struct rte_ether_addr	*mcast_addr_list;
 	rte_iova_t		mc_list_dma_addr;
 	uint32_t		nb_mc_addr;
+
+	struct rte_eth_rss_conf	rss_conf; /* RSS configuration. */
 };
 
 static
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 6c224583c6..0c00f25f5b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -379,7 +379,7 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
 	if (rc)
 		goto alloc_mem_err;
 
-	rc = bnxt_alloc_vnic_attributes(bp);
+	rc = bnxt_alloc_vnic_attributes(bp, reconfig);
 	if (rc)
 		goto alloc_mem_err;
 
@@ -1074,6 +1074,7 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
+	struct rte_eth_rss_conf *rss_conf = &eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
 	int rc;
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
@@ -1155,6 +1156,18 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 			BNXT_NUM_VLANS;
 		bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
 	}
+
+	/* application provides the hash key to program */
+	if (rss_conf->rss_key != NULL) {
+		if (rss_conf->rss_key_len != HW_HASH_KEY_SIZE)
+			PMD_DRV_LOG(WARNING, "port %u RSS key len must be %d bytes long",
+				    eth_dev->data->port_id, HW_HASH_KEY_SIZE);
+		else
+			memcpy(bp->rss_conf.rss_key, rss_conf->rss_key, HW_HASH_KEY_SIZE);
+	}
+	bp->rss_conf.rss_key_len = HW_HASH_KEY_SIZE;
+	bp->rss_conf.rss_hf = rss_conf->rss_hf;
+
 	return 0;
 
 resource_error:
@@ -2066,9 +2079,6 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 	}
 
 	bp->flags |= BNXT_FLAG_UPDATE_HASH;
-	memcpy(&eth_dev->data->dev_conf.rx_adv_conf.rss_conf,
-	       rss_conf,
-	       sizeof(*rss_conf));
 
 	/* Update the default RSS VNIC(s) */
 	vnic = BNXT_GET_DEFAULT_VNIC(bp);
@@ -2077,6 +2087,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 		bnxt_rte_to_hwrm_hash_level(bp, rss_conf->rss_hf,
 					    ETH_RSS_LEVEL(rss_conf->rss_hf));
 
+	/* Cache the hash function */
+	bp->rss_conf.rss_hf = rss_conf->rss_hf;
+
 	/*
 	 * If hashkey is not specified, use the previously configured
 	 * hashkey
@@ -2092,6 +2105,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 	}
 	memcpy(vnic->rss_hash_key, rss_conf->rss_key, rss_conf->rss_key_len);
 
+	/* Cache the hash key */
+	memcpy(bp->rss_conf.rss_key, rss_conf->rss_key, HW_HASH_KEY_SIZE);
+
 rss_config:
 	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
 	return rc;
@@ -5201,6 +5217,16 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev)
 		}
 	}
 
+	if (!reconfig_dev) {
+		bp->rss_conf.rss_key = rte_zmalloc("bnxt_rss_key",
+						   HW_HASH_KEY_SIZE, 0);
+		if (bp->rss_conf.rss_key == NULL) {
+			PMD_DRV_LOG(ERR, "port %u cannot allocate RSS hash key memory",
+				    bp->eth_dev->data->port_id);
+			return -ENOMEM;
+		}
+	}
+
 	rc = bnxt_alloc_mem(bp, reconfig_dev);
 	if (rc)
 		return rc;
@@ -5852,6 +5878,8 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 		bnxt_free_error_recovery_info(bp);
 		rte_free(bp->mcast_addr_list);
 		bp->mcast_addr_list = NULL;
+		rte_free(bp->rss_conf.rss_key);
+		bp->rss_conf.rss_key = NULL;
 	}
 
 	bnxt_uninit_ctx_mem(bp);
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index aa73bd25e1..e057393b2b 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -137,7 +137,7 @@ skip_filter_allocation:
 	bp->rx_num_qs_per_vnic = nb_q_per_grp;
 
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
-		struct rte_eth_rss_conf *rss = &dev_conf->rx_adv_conf.rss_conf;
+		struct rte_eth_rss_conf *rss = &bp->rss_conf;
 
 		if (bp->flags & BNXT_FLAG_UPDATE_HASH)
 			bp->flags &= ~BNXT_FLAG_UPDATE_HASH;
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index 53db277ead..f18e672dca 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -114,7 +114,7 @@ void bnxt_free_vnic_attributes(struct bnxt *bp)
 	}
 }
 
-int bnxt_alloc_vnic_attributes(struct bnxt *bp)
+int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig)
 {
 	struct bnxt_vnic_info *vnic;
 	struct rte_pci_device *pdev = bp->pdev;
@@ -168,7 +168,12 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 
 		vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr +
 					      rss_table_size;
-		bnxt_prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE);
+		if (!reconfig) {
+			bnxt_prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE);
+			memcpy(bp->rss_conf.rss_key, vnic->rss_hash_key, HW_HASH_KEY_SIZE);
+		} else {
+			memcpy(vnic->rss_hash_key, bp->rss_conf.rss_key, HW_HASH_KEY_SIZE);
+		}
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h
index b5bba81fcf..785db8f0cd 100644
--- a/drivers/net/bnxt/bnxt_vnic.h
+++ b/drivers/net/bnxt/bnxt_vnic.h
@@ -60,7 +60,7 @@ int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
 struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp);
 void bnxt_free_all_vnics(struct bnxt *bp);
 void bnxt_free_vnic_attributes(struct bnxt *bp);
-int bnxt_alloc_vnic_attributes(struct bnxt *bp);
+int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig);
 void bnxt_free_vnic_mem(struct bnxt *bp);
 int bnxt_alloc_vnic_mem(struct bnxt *bp);
 int bnxt_vnic_grp_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
-- 
2.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-18 12:37:39.155907409 +0000
+++ 0026-net-bnxt-restore-RSS-configuration-after-reset-recov.patch	2022-02-18 12:37:37.586789597 +0000
@@ -1 +1 @@
-From 9b4353bec3d17d241e511f7d6917417fd395c462 Mon Sep 17 00:00:00 2001
+From 7275db81e80e36759e092cdf368833dcc6d3c4e0 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 9b4353bec3d17d241e511f7d6917417fd395c462 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
- drivers/net/bnxt/bnxt_ethdev.c | 35 ++++++++++++++++++++++++++++++----
+ drivers/net/bnxt/bnxt_ethdev.c | 36 ++++++++++++++++++++++++++++++----
@@ -24 +25 @@
- 5 files changed, 42 insertions(+), 8 deletions(-)
+ 5 files changed, 43 insertions(+), 8 deletions(-)
@@ -27 +28 @@
-index 521fcb7af3..614ea57d87 100644
+index 823a764191..b37b338349 100644
@@ -30 +31 @@
-@@ -896,6 +896,8 @@ struct bnxt {
+@@ -859,6 +859,8 @@ struct bnxt {
@@ -40 +41 @@
-index bac96001a4..dcf2839215 100644
+index 6c224583c6..0c00f25f5b 100644
@@ -43 +44 @@
-@@ -368,7 +368,7 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
+@@ -379,7 +379,7 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
@@ -52 +53 @@
-@@ -1067,6 +1067,7 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
+@@ -1074,6 +1074,7 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
@@ -60,4 +61,5 @@
-@@ -1141,6 +1142,17 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
- 		rx_offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
- 	eth_dev->data->dev_conf.rxmode.offloads = rx_offloads;
- 
+@@ -1155,6 +1156,18 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
+ 			BNXT_NUM_VLANS;
+ 		bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
+ 	}
++
@@ -75,2 +76,0 @@
- 	bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
- 
@@ -78 +78,3 @@
-@@ -2126,9 +2138,6 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
+ 
+ resource_error:
+@@ -2066,9 +2079,6 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
@@ -88 +90 @@
-@@ -2137,6 +2146,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
+@@ -2077,6 +2087,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
@@ -90 +92 @@
- 					    RTE_ETH_RSS_LEVEL(rss_conf->rss_hf));
+ 					    ETH_RSS_LEVEL(rss_conf->rss_hf));
@@ -98 +100 @@
-@@ -2152,6 +2164,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
+@@ -2092,6 +2105,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
@@ -108 +110 @@
-@@ -5304,6 +5319,16 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev)
+@@ -5201,6 +5217,16 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev)
@@ -125 +127 @@
-@@ -5950,6 +5975,8 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
+@@ -5852,6 +5878,8 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
@@ -135 +137 @@
-index c9d99039ad..9f1d1d4dba 100644
+index aa73bd25e1..e057393b2b 100644
@@ -138 +140 @@
-@@ -148,7 +148,7 @@ skip_filter_allocation:
+@@ -137,7 +137,7 @@ skip_filter_allocation:
@@ -141 +143 @@
- 	if (dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
+ 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
@@ -148 +150 @@
-index e05dc241dc..09d67ef885 100644
+index 53db277ead..f18e672dca 100644
@@ -175 +177 @@
-index af3a2dd779..25481fcbdd 100644
+index b5bba81fcf..785db8f0cd 100644


More information about the stable mailing list