[dpdk-stable] patch 'net/enic: fix crash in secondary process' has been queued to LTS release 18.11.6

Kevin Traynor ktraynor at redhat.com
Tue Dec 3 19:27:08 CET 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.6

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

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/180bbf4a7e74d5fcc53787aefa0fbee6d1ecc324

Thanks.

Kevin.

---
>From 180bbf4a7e74d5fcc53787aefa0fbee6d1ecc324 Mon Sep 17 00:00:00 2001
From: Hyong Youb Kim <hyonkim at cisco.com>
Date: Thu, 5 Sep 2019 23:50:20 -0700
Subject: [PATCH] net/enic: fix crash in secondary process

[ upstream commit c655c547f92d1cf4bfd525a690660f5b399bdceb ]

Both primary and secondary processes may call the queue start/stop,
link update handlers. These functions use the rte_eth_dev pointer
cached in the adapter private data (struct enic). But, this pointer is
valid only in the primary process, as rte_eth_dev addresses may differ
in different processes. Using that cached pointer in secondary
processes leads to a crash.

For the link update handler (enic_link_update), use the rte_eth_dev
pointer passed down from the rte layer as it is valid in the current
process. For the queue start/stop handlers (enic_start_wq and
friends), cache the rte_eth_dev_data pointer in the adapter private
data, and use that. rte_eth_dev_data is in shared memory and its
address is same across processes.

Fixes: 837e68ae94a2 ("net/enic: fix queue stop and start")
Fixes: cf8d9826b7be ("net/enic: extract code for checking link status")

Reported-by: Dirk-Holger Lenz <dirk.lenz at ng4t.com>
Signed-off-by: Hyong Youb Kim <hyonkim at cisco.com>
Tested-by: Dirk-Holger Lenz <dirk.lenz at ng4t.com>
Reviewed-by: John Daley <johndale at cisco.com>
---
 drivers/net/enic/enic.h        |  3 ++-
 drivers/net/enic/enic_ethdev.c |  5 ++---
 drivers/net/enic/enic_main.c   | 22 +++++++++++-----------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 00a208728..fc34d1012 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -113,4 +113,5 @@ struct enic {
 	bool overlay_offload;
 	struct rte_eth_dev *rte_dev;
+	struct rte_eth_dev_data *dev_data;
 	struct enic_fdir fdir;
 	char bdf_name[ENICPMD_BDF_LENGTH];
@@ -332,5 +333,5 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			uint16_t nb_pkts);
 int enic_set_mtu(struct enic *enic, uint16_t new_mtu);
-int enic_link_update(struct enic *enic);
+int enic_link_update(struct rte_eth_dev *eth_dev);
 bool enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev);
 void enic_pick_rx_handler(struct rte_eth_dev *eth_dev);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 67a96a483..ed6dd70c8 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -433,8 +433,6 @@ static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev,
 	__rte_unused int wait_to_complete)
 {
-	struct enic *enic = pmd_priv(eth_dev);
-
 	ENICPMD_FUNC_TRACE();
-	return enic_link_update(enic);
+	return enic_link_update(eth_dev);
 }
 
@@ -1055,4 +1053,5 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
 	enic->port_id = eth_dev->data->port_id;
 	enic->rte_dev = eth_dev;
+	enic->dev_data = eth_dev->data;
 
 	pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index a6c838bc2..c3dc3dee1 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -418,7 +418,7 @@ enic_free_consistent(void *priv,
 }
 
-int enic_link_update(struct enic *enic)
+int enic_link_update(struct rte_eth_dev *eth_dev)
 {
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
+	struct enic *enic = pmd_priv(eth_dev);
 	struct rte_eth_link link;
 
@@ -439,5 +439,5 @@ enic_intr_handler(void *arg)
 	vnic_intr_return_all_credits(&enic->intr[ENICPMD_LSC_INTR_OFFSET]);
 
-	enic_link_update(enic);
+	enic_link_update(dev);
 	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	enic_log_q_error(enic);
@@ -732,12 +732,12 @@ void enic_free_rq(void *rxq)
 void enic_start_wq(struct enic *enic, uint16_t queue_idx)
 {
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
+	struct rte_eth_dev_data *data = enic->dev_data;
 	vnic_wq_enable(&enic->wq[queue_idx]);
-	eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
+	data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
 }
 
 int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
 {
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
+	struct rte_eth_dev_data *data = enic->dev_data;
 	int ret;
 
@@ -746,5 +746,5 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
 		return ret;
 
-	eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
+	data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	return 0;
 }
@@ -752,9 +752,9 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
 void enic_start_rq(struct enic *enic, uint16_t queue_idx)
 {
+	struct rte_eth_dev_data *data = enic->dev_data;
 	struct vnic_rq *rq_sop;
 	struct vnic_rq *rq_data;
 	rq_sop = &enic->rq[enic_rte_rq_idx_to_sop_idx(queue_idx)];
 	rq_data = &enic->rq[rq_sop->data_queue_idx];
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
 
 	if (rq_data->in_use) {
@@ -765,11 +765,11 @@ void enic_start_rq(struct enic *enic, uint16_t queue_idx)
 	vnic_rq_enable(rq_sop);
 	enic_initial_post_rx(enic, rq_sop);
-	eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
+	data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
 }
 
 int enic_stop_rq(struct enic *enic, uint16_t queue_idx)
 {
+	struct rte_eth_dev_data *data = enic->dev_data;
 	int ret1 = 0, ret2 = 0;
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
 	struct vnic_rq *rq_sop;
 	struct vnic_rq *rq_data;
@@ -787,5 +787,5 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx)
 		return ret1;
 
-	eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
+	data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	return 0;
 }
-- 
2.21.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-03 17:29:55.166482602 +0000
+++ 0059-net-enic-fix-crash-in-secondary-process.patch	2019-12-03 17:29:51.791749099 +0000
@@ -1 +1 @@
-From c655c547f92d1cf4bfd525a690660f5b399bdceb Mon Sep 17 00:00:00 2001
+From 180bbf4a7e74d5fcc53787aefa0fbee6d1ecc324 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit c655c547f92d1cf4bfd525a690660f5b399bdceb ]
+
@@ -22 +23,0 @@
-Cc: stable at dpdk.org
@@ -35 +36 @@
-index 681109ba9..fac8d57fa 100644
+index 00a208728..fc34d1012 100644
@@ -44 +45 @@
-@@ -336,5 +337,5 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+@@ -332,5 +333,5 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
@@ -52 +53 @@
-index fe18cf3a9..562401ae7 100644
+index 67a96a483..ed6dd70c8 100644
@@ -55 +56 @@
-@@ -461,8 +461,6 @@ static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev,
+@@ -433,8 +433,6 @@ static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev,
@@ -65 +66 @@
-@@ -1240,4 +1238,5 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
+@@ -1055,4 +1053,5 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
@@ -69,2 +70,2 @@
- 	/* Let rte_eth_dev_close() release the port resources */
- 	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+ 
+ 	pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
@@ -72 +73 @@
-index 30c7b1c86..ce89b8154 100644
+index a6c838bc2..c3dc3dee1 100644
@@ -75 +76 @@
-@@ -425,7 +425,7 @@ enic_free_consistent(void *priv,
+@@ -418,7 +418,7 @@ enic_free_consistent(void *priv,
@@ -85 +86 @@
-@@ -446,5 +446,5 @@ enic_intr_handler(void *arg)
+@@ -439,5 +439,5 @@ enic_intr_handler(void *arg)
@@ -92 +93 @@
-@@ -739,12 +739,12 @@ void enic_free_rq(void *rxq)
+@@ -732,12 +732,12 @@ void enic_free_rq(void *rxq)
@@ -108 +109 @@
-@@ -753,5 +753,5 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
+@@ -746,5 +746,5 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
@@ -115 +116 @@
-@@ -759,9 +759,9 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
+@@ -752,9 +752,9 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
@@ -126 +127 @@
-@@ -772,11 +772,11 @@ void enic_start_rq(struct enic *enic, uint16_t queue_idx)
+@@ -765,11 +765,11 @@ void enic_start_rq(struct enic *enic, uint16_t queue_idx)
@@ -140 +141 @@
-@@ -794,5 +794,5 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx)
+@@ -787,5 +787,5 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx)



More information about the stable mailing list