diff mbox series

net/ixgbe: stop link setup alarm handler before device start

Message ID 20181108102401.23599-1-i.maximets@samsung.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers show
Series net/ixgbe: stop link setup alarm handler before device start | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Ilya Maximets Nov. 8, 2018, 10:24 a.m. UTC
We should stop alarm handler before resetting the HW to
avoid concurrent device reconfiguration.

Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link update")
CC: stable@dpdk.org

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

Comments

Burakov, Anatoly Nov. 8, 2018, 11:16 a.m. UTC | #1
On 08-Nov-18 10:24 AM, Ilya Maximets wrote:
> We should stop alarm handler before resetting the HW to
> avoid concurrent device reconfiguration.
> 
> Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link update")
> CC: stable@dpdk.org
> 
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---

Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>

I can confirm that this fixes issue with pktgen where init was failing 
if the link wasn't up.
Zhang, Qi Z Nov. 8, 2018, 8:52 p.m. UTC | #2
> -----Original Message-----
> From: Burakov, Anatoly
> Sent: Thursday, November 8, 2018 4:16 AM
> To: Ilya Maximets <i.maximets@samsung.com>; dev@dpdk.org; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Laurent Hardy
> <laurent.hardy@6wind.com>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: stop link setup alarm handler
> before device start
> 
> On 08-Nov-18 10:24 AM, Ilya Maximets wrote:
> > We should stop alarm handler before resetting the HW to avoid
> > concurrent device reconfiguration.
> >
> > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link
> > update")
> > CC: stable@dpdk.org
> >
> > Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> > ---
> 
> Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> I can confirm that this fixes issue with pktgen where init was failing if the link
> wasn't up.

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks for fix and testing.
Qi
> 
> --
> Thanks,
> Anatoly
diff mbox series

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index c9e82d515..8148577f5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2549,6 +2549,9 @@  ixgbe_dev_start(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
+	/* Stop the link setup handler before resetting the HW. */
+	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);
+
 	/* disable uio/vfio intr/eventfd mapping */
 	rte_intr_disable(intr_handle);
 
@@ -2731,8 +2734,6 @@  ixgbe_dev_start(struct rte_eth_dev *dev)
 	if (err)
 		goto error;
 
-	ixgbe_dev_link_update(dev, 0);
-
 skip_link_setup:
 
 	if (rte_intr_allow_others(intr_handle)) {
@@ -2768,6 +2769,12 @@  ixgbe_dev_start(struct rte_eth_dev *dev)
 			    "please call hierarchy_commit() "
 			    "before starting the port");
 
+	/*
+	 * Update link status right before return, because it may
+	 * start link configuration process in a separate thread.
+	 */
+	ixgbe_dev_link_update(dev, 0);
+
 	return 0;
 
 error:
@@ -5061,6 +5068,9 @@  ixgbevf_dev_start(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
+	/* Stop the link setup handler before resetting the HW. */
+	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);
+
 	err = hw->mac.ops.reset_hw(hw);
 	if (err) {
 		PMD_INIT_LOG(ERR, "Unable to reset vf hardware (%d)", err);
@@ -5096,8 +5106,6 @@  ixgbevf_dev_start(struct rte_eth_dev *dev)
 
 	ixgbevf_dev_rxtx_start(dev);
 
-	ixgbevf_dev_link_update(dev, 0);
-
 	/* check and configure queue intr-vector mapping */
 	if (rte_intr_cap_multiple(intr_handle) &&
 	    dev->data->dev_conf.intr_conf.rxq) {
@@ -5135,6 +5143,12 @@  ixgbevf_dev_start(struct rte_eth_dev *dev)
 	/* Re-enable interrupt for VF */
 	ixgbevf_intr_enable(dev);
 
+	/*
+	 * Update link status right before return, because it may
+	 * start link configuration process in a separate thread.
+	 */
+	ixgbevf_dev_link_update(dev, 0);
+
 	return 0;
 }