[PATCH 21.11] net/nfp: fix link status interrupt

Chaoyong He chaoyong.he at corigine.com
Fri Nov 17 04:14:57 CET 2023


[ 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 at corigine.com>
Signed-off-by: Peng Zhang <peng.zhang at 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



More information about the stable mailing list