[dpdk-stable] patch 'net/iavf: fix shared data in multi-process' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:31:36 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/762161e2091ccae7c3ff637427398ac59c201e30

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 762161e2091ccae7c3ff637427398ac59c201e30 Mon Sep 17 00:00:00 2001
From: Dapeng Yu <dapengx.yu at intel.com>
Date: Wed, 27 Oct 2021 16:28:39 +0800
Subject: [PATCH] net/iavf: fix shared data in multi-process
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 627b3c5a39eb5c5461bdf0f0013817c34be98944 ]

The shared pointer is initialized to a static local array defined in the
primary process and it shall not be accessed in the secondary process.

This patch copies the local data to shared data, to avoid data access
violation.

Fixes: 040b44551f77 ("net/iavf: unify Rx packet type table")

Signed-off-by: Dapeng Yu <dapengx.yu at intel.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
---
 drivers/net/iavf/iavf.h        |  2 +-
 drivers/net/iavf/iavf_ethdev.c |  2 +-
 drivers/net/iavf/iavf_rxtx.c   | 17 ++++++++++++++---
 drivers/net/iavf/iavf_rxtx.h   |  2 +-
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index a8b0649745..09bf7f850e 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -201,7 +201,7 @@ struct iavf_adapter {
 	/* For vector PMD */
 	bool rx_vec_allowed;
 	bool tx_vec_allowed;
-	const uint32_t *ptype_tbl;
+	uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE] __rte_cache_min_aligned;
 	bool stopped;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 7d676c0279..0d026ab56f 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -2002,7 +2002,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 	}
 
 	/* set default ptype table */
-	adapter->ptype_tbl = iavf_get_default_ptype_table();
+	iavf_set_default_ptype_table(eth_dev);
 
 	/* copy mac addr */
 	eth_dev->data->mac_addrs = rte_zmalloc(
diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index b475aa0cc5..555551008b 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2680,8 +2680,8 @@ iavf_dev_tx_desc_status(void *tx_queue, uint16_t offset)
 	return RTE_ETH_TX_DESC_FULL;
 }
 
-const uint32_t *
-iavf_get_default_ptype_table(void)
+static inline uint32_t
+iavf_get_default_ptype(uint16_t ptype)
 {
 	static const uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE]
 		__rte_cache_aligned = {
@@ -3216,5 +3216,16 @@ iavf_get_default_ptype_table(void)
 		/* All others reserved */
 	};
 
-	return ptype_tbl;
+	return ptype_tbl[ptype];
+}
+
+void __rte_cold
+iavf_set_default_ptype_table(struct rte_eth_dev *dev)
+{
+	struct iavf_adapter *ad =
+		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	int i;
+
+	for (i = 0; i < IAVF_MAX_PKT_TYPE; i++)
+		ad->ptype_tbl[i] = iavf_get_default_ptype(i);
 }
diff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h
index 6bf6a44b77..2eb214373c 100644
--- a/drivers/net/iavf/iavf_rxtx.h
+++ b/drivers/net/iavf/iavf_rxtx.h
@@ -484,7 +484,7 @@ int iavf_txq_vec_setup_avx512(struct iavf_tx_queue *txq);
 
 uint8_t iavf_proto_xtr_type_to_rxdid(uint8_t xtr_type);
 
-const uint32_t *iavf_get_default_ptype_table(void);
+void iavf_set_default_ptype_table(struct rte_eth_dev *dev);
 
 static inline
 void iavf_dump_rx_descriptor(struct iavf_rx_queue *rxq,
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:11.273130913 +0800
+++ 0212-net-iavf-fix-shared-data-in-multi-process.patch	2021-11-10 14:17:02.024078169 +0800
@@ -1 +1 @@
-From 627b3c5a39eb5c5461bdf0f0013817c34be98944 Mon Sep 17 00:00:00 2001
+From 762161e2091ccae7c3ff637427398ac59c201e30 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 627b3c5a39eb5c5461bdf0f0013817c34be98944 ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org
@@ -25 +27 @@
-index 12f541f539..8f795f2bed 100644
+index a8b0649745..09bf7f850e 100644
@@ -28 +30 @@
-@@ -265,7 +265,7 @@ struct iavf_adapter {
+@@ -201,7 +201,7 @@ struct iavf_adapter {
@@ -38 +40 @@
-index f892306f18..7a151975dc 100644
+index 7d676c0279..0d026ab56f 100644
@@ -41 +43 @@
-@@ -2332,7 +2332,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
+@@ -2002,7 +2002,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
@@ -51 +53 @@
-index 52d919ca1b..a8ad7a0977 100644
+index b475aa0cc5..555551008b 100644
@@ -54 +56 @@
-@@ -2885,8 +2885,8 @@ iavf_dev_tx_desc_status(void *tx_queue, uint16_t offset)
+@@ -2680,8 +2680,8 @@ iavf_dev_tx_desc_status(void *tx_queue, uint16_t offset)
@@ -65 +67 @@
-@@ -3465,5 +3465,16 @@ iavf_get_default_ptype_table(void)
+@@ -3216,5 +3216,16 @@ iavf_get_default_ptype_table(void)
@@ -84 +86 @@
-index 84351011f1..6d1429081d 100644
+index 6bf6a44b77..2eb214373c 100644
@@ -87 +89 @@
-@@ -519,7 +519,7 @@ int iavf_txq_vec_setup_avx512(struct iavf_tx_queue *txq);
+@@ -484,7 +484,7 @@ int iavf_txq_vec_setup_avx512(struct iavf_tx_queue *txq);


More information about the stable mailing list