patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 21.11] net/nfp: fix DMA error after abnormal exit
@ 2023-11-17  3:14 Chaoyong He
  2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix link status interrupt Chaoyong He
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Chaoyong He @ 2023-11-17  3:14 UTC (permalink / raw)
  To: stable; +Cc: oss-drivers, Chaoyong He, Shihong Wang, Peng Zhang

[ upstream commit 9e442599802e788874110339901f4eeb8f0ecc3b ]

When DPDK application exit abnormally, there might have DMA error,
and which will cause the load of firmware failed.

Fix this by force the physical port down to clear the possible DMA error.

Fixes: 896c265ef954 ("net/nfp: use new CPP interface")

Signed-off-by: Shihong Wang <shihong.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5729b8a2fd..e1da0bdebe 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -810,6 +810,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)
 	int total_ports;
 	int ret = -ENODEV;
 	int err;
+	uint32_t i;
 
 	if (!pci_dev)
 		return ret;
@@ -846,6 +847,10 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)
 		goto hwinfo_cleanup;
 	}
 
+	/* Force the physical port down to clear the possible DMA error */
+	for (i = 0; i < nfp_eth_table->count; i++)
+		nfp_eth_set_configured(cpp, nfp_eth_table->ports[i].index, 0);
+
 	if (nfp_fw_setup(pci_dev, cpp, nfp_eth_table, hwinfo)) {
 		PMD_INIT_LOG(ERR, "Error when uploading firmware");
 		ret = -EIO;
-- 
2.39.1


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

* [PATCH 21.11] net/nfp: fix link status interrupt
  2023-11-17  3:14 [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Chaoyong He
@ 2023-11-17  3:14 ` Chaoyong He
  2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix reconfigure logic in PF initialization Chaoyong He
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chaoyong He @ 2023-11-17  3:14 UTC (permalink / raw)
  To: stable; +Cc: oss-drivers, Chaoyong He, Shihong Wang, Peng Zhang

[ upstream commit 94d0631a8275afa4314ee1d4f08d2fbd02325124 ]

In rare cases, when DPDK application exit, the interrupt handler was not
processed the interrupt in time, resulting in the LSC interrupt mask bit
not being cleared. So when the DPDK application start again, the newly
coming LSC interrupts cannot be received and processed properly.

Fix this problem by force clear the LSC interrupt mask on port
initialization.

Fixes: 6c53f87b3497 ("nfp: add link status interrupt")

Signed-off-by: Shihong Wang <shihong.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_common.c    | 2 +-
 drivers/net/nfp/nfp_common.h    | 1 +
 drivers/net/nfp/nfp_ethdev.c    | 2 ++
 drivers/net/nfp/nfp_ethdev_vf.c | 2 ++
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 7dce3cf9a9..f73f7dd0be 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -881,7 +881,7 @@ nfp_net_dev_link_status_print(struct rte_eth_dev *dev)
  * If MSI-X auto-masking is enabled clear the mask bit, otherwise
  * clear the ICR for the entry.
  */
-static void
+void
 nfp_net_irq_unmask(struct rte_eth_dev *dev)
 {
 	struct nfp_net_hw *hw;
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 466e5a7932..8c39b84c36 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -379,6 +379,7 @@ int nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 void nfp_net_params_setup(struct nfp_net_hw *hw);
 void nfp_net_cfg_queue_setup(struct nfp_net_hw *hw);
 void nfp_eth_copy_mac(uint8_t *dst, const uint8_t *src);
+void nfp_net_irq_unmask(struct rte_eth_dev *dev);
 void nfp_net_dev_interrupt_handler(void *param);
 void nfp_net_dev_interrupt_delayed_handler(void *param);
 int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 83232d4b73..5729b8a2fd 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -595,6 +595,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 					   (void *)eth_dev);
 		/* Telling the firmware about the LSC interrupt entry */
 		nn_cfg_writeb(hw, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX);
+		/* Unmask the LSC interrupt */
+		nfp_net_irq_unmask(eth_dev);
 		/* Recording current stats counters values */
 		nfp_net_stats_reset(eth_dev);
 	}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index ed80487acb..0dda3961ce 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -454,6 +454,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
 					   (void *)eth_dev);
 		/* Telling the firmware about the LSC interrupt entry */
 		nn_cfg_writeb(hw, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX);
+		/* Unmask the LSC interrupt */
+		nfp_net_irq_unmask(eth_dev);
 		/* Recording current stats counters values */
 		nfp_net_stats_reset(eth_dev);
 	}
-- 
2.39.1


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

* [PATCH 21.11] net/nfp: fix reconfigure logic in PF initialization
  2023-11-17  3:14 [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Chaoyong He
  2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix link status interrupt Chaoyong He
@ 2023-11-17  3:14 ` Chaoyong He
  2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix reconfigure logic in VF initialization Chaoyong He
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chaoyong He @ 2023-11-17  3:14 UTC (permalink / raw)
  To: stable; +Cc: oss-drivers, Chaoyong He

[ upstream commit 1e80c07472aeed5669c79c0430b8aeece5129a20 ]

There exists exit point between the reconfigure logic and the store
logic of the PF initialization, this may lead one situation that value
in the config bar is not same with the value stored in the data
structure.

Fix this by move up the store statement.

Fixes: b812daadad0d ("nfp: add Rx and Tx")

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

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 37593fd216..83232d4b73 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -167,6 +167,8 @@ nfp_net_start(struct rte_eth_dev *dev)
 	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
 		return -EIO;
 
+	hw->ctrl = new_ctrl;
+
 	/*
 	 * Allocating rte mbufs for configured rx queues.
 	 * This requires queues being enabled before
@@ -183,8 +185,6 @@ nfp_net_start(struct rte_eth_dev *dev)
 		nfp_eth_set_configured(dev->process_private,
 				       hw->nfp_idx, 1);
 
-	hw->ctrl = new_ctrl;
-
 	return 0;
 
 error:
-- 
2.39.1


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

* [PATCH 21.11] net/nfp: fix reconfigure logic in VF initialization
  2023-11-17  3:14 [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Chaoyong He
  2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix link status interrupt Chaoyong He
  2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix reconfigure logic in PF initialization Chaoyong He
@ 2023-11-17  3:14 ` Chaoyong He
  2023-11-17  3:15 ` [PATCH 21.11] net/nfp: fix reconfigure logic of set MAC address Chaoyong He
  2023-11-23 10:48 ` [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Kevin Traynor
  4 siblings, 0 replies; 6+ messages in thread
From: Chaoyong He @ 2023-11-17  3:14 UTC (permalink / raw)
  To: stable; +Cc: oss-drivers, Chaoyong He

[ upstream commit 61847adc98057c0e500c65110a83181b7db4ebc9 ]

There exists exit point between the reconfigure logic and the store
logic of the VF initialization, this may lead one situation that value
in the config bar is not same with the value stored in the data
structure.

Fix this by move up the store statement.

Fixes: 7f8e73201dae ("net/nfp: move VF functions into its own file")

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

diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 14d4864c1e..ed80487acb 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -122,6 +122,8 @@ nfp_netvf_start(struct rte_eth_dev *dev)
 	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
 		return -EIO;
 
+	hw->ctrl = new_ctrl;
+
 	/*
 	 * Allocating rte mbufs for configured rx queues.
 	 * This requires queues being enabled before
@@ -131,8 +133,6 @@ nfp_netvf_start(struct rte_eth_dev *dev)
 		goto error;
 	}
 
-	hw->ctrl = new_ctrl;
-
 	return 0;
 
 error:
-- 
2.39.1


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

* [PATCH 21.11] net/nfp: fix reconfigure logic of set MAC address
  2023-11-17  3:14 [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Chaoyong He
                   ` (2 preceding siblings ...)
  2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix reconfigure logic in VF initialization Chaoyong He
@ 2023-11-17  3:15 ` Chaoyong He
  2023-11-23 10:48 ` [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Kevin Traynor
  4 siblings, 0 replies; 6+ messages in thread
From: Chaoyong He @ 2023-11-17  3:15 UTC (permalink / raw)
  To: stable; +Cc: oss-drivers, Chaoyong He

[ upstream commit d67022275d3b423850c629036d33fdfadeb874a8 ]

If the reconfigure API exit abnormally, the value in the config bar
will not same with the value stored in the data structure.

Fix this by add a local variable to hold the temporary value and the
logic of store it when no error happen.

Fixes: 2fe669f4bcd2 ("net/nfp: support MAC address change")

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_common.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 279c344666..7dce3cf9a9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -277,7 +277,8 @@ int
 nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
 {
 	struct nfp_net_hw *hw;
-	uint32_t update, ctrl;
+	uint32_t update;
+	uint32_t new_ctrl;
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_ENABLE) &&
@@ -292,14 +293,17 @@ nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
 
 	/* Signal the NIC about the change */
 	update = NFP_NET_CFG_UPDATE_MACADDR;
-	ctrl = hw->ctrl;
+	new_ctrl = hw->ctrl;
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_ENABLE) &&
 	    (hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR))
-		ctrl |= NFP_NET_CFG_CTRL_LIVE_ADDR;
-	if (nfp_net_reconfig(hw, ctrl, update) < 0) {
+		new_ctrl |= NFP_NET_CFG_CTRL_LIVE_ADDR;
+	if (nfp_net_reconfig(hw, new_ctrl, update) < 0) {
 		PMD_INIT_LOG(INFO, "MAC address update failed");
 		return -EIO;
 	}
+
+	hw->ctrl = new_ctrl;
+
 	return 0;
 }
 
-- 
2.39.1


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

* Re: [PATCH 21.11] net/nfp: fix DMA error after abnormal exit
  2023-11-17  3:14 [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Chaoyong He
                   ` (3 preceding siblings ...)
  2023-11-17  3:15 ` [PATCH 21.11] net/nfp: fix reconfigure logic of set MAC address Chaoyong He
@ 2023-11-23 10:48 ` Kevin Traynor
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Traynor @ 2023-11-23 10:48 UTC (permalink / raw)
  To: Chaoyong He, stable; +Cc: oss-drivers, Shihong Wang, Peng Zhang

On 17/11/2023 03:14, Chaoyong He wrote:
> [ upstream commit 9e442599802e788874110339901f4eeb8f0ecc3b ]
> 
> When DPDK application exit abnormally, there might have DMA error,
> and which will cause the load of firmware failed.
> 
> Fix this by force the physical port down to clear the possible DMA error.
> 
> Fixes: 896c265ef954 ("net/nfp: use new CPP interface")
> 
> Signed-off-by: Shihong Wang<shihong.wang@corigine.com>
> Signed-off-by: Peng Zhang<peng.zhang@corigine.com>
> ---
>   drivers/net/nfp/nfp_ethdev.c | 5 +++++
>   1 file changed, 5 insertions(+)

Thanks for backporting. I applied this and the other patches in the 
series to the 21.11 branch.


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

end of thread, other threads:[~2023-11-23 10:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17  3:14 [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Chaoyong He
2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix link status interrupt Chaoyong He
2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix reconfigure logic in PF initialization Chaoyong He
2023-11-17  3:14 ` [PATCH 21.11] net/nfp: fix reconfigure logic in VF initialization Chaoyong He
2023-11-17  3:15 ` [PATCH 21.11] net/nfp: fix reconfigure logic of set MAC address Chaoyong He
2023-11-23 10:48 ` [PATCH 21.11] net/nfp: fix DMA error after abnormal exit Kevin Traynor

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