[dpdk-dev] net/ixgbe: ensure link status is updated
Checks
Commit Message
In case of link speed set to 1Gb at peer side (with autoneg or with
defined speed) and cable not plugged-in when device is configured
and started, then link status is not updated properly with new speed
as no link setup is triggered.
To avoid this issue, IXGBE_FLAG_NEED_LINK_CONFIG is set to try a link
setup each time link_update() is triggered and current link status is
down. When cable is plugged-in, link setup will be performed via
ixgbe_setup_link().
Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
drivers/net/ixgbe/ixgbe_ethdev.h | 1 +
2 files changed, 21 insertions(+)
Comments
Hello,
Is there anyone available to review this patch ?
regards,
Laurent
On 11/17/2016 06:29 PM, Laurent Hardy wrote:
> In case of link speed set to 1Gb at peer side (with autoneg or with
> defined speed) and cable not plugged-in when device is configured
> and started, then link status is not updated properly with new speed
> as no link setup is triggered.
>
> To avoid this issue, IXGBE_FLAG_NEED_LINK_CONFIG is set to try a link
> setup each time link_update() is triggered and current link status is
> down. When cable is plugged-in, link setup will be performed via
> ixgbe_setup_link().
>
> Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
> drivers/net/ixgbe/ixgbe_ethdev.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 52ebbe4..513d1d5 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -2095,6 +2095,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
>
> /* set flag to update link status after init */
> intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
> + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
>
> /*
> * Initialize to TRUE. If any of Rx queues doesn't meet the bulk
> @@ -3117,8 +3118,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
> struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> struct rte_eth_link link, old;
> ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
> + struct ixgbe_interrupt *intr =
> + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
> int link_up;
> int diag;
> + u32 speed = 0;
> + bool autoneg = false;
>
> link.link_status = ETH_LINK_DOWN;
> link.link_speed = 0;
> @@ -3128,6 +3133,19 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
>
> hw->mac.get_link_status = true;
>
> + if (intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) {
> + speed = hw->phy.autoneg_advertised;
> + if (!speed) {
> + ixgbe_get_link_capabilities(hw, &speed, &autoneg);
> + /* setup the highest link when no autoneg */
> + if (!autoneg) {
> + if (speed & IXGBE_LINK_SPEED_10GB_FULL)
> + speed = IXGBE_LINK_SPEED_10GB_FULL;
> + }
> + }
> + ixgbe_setup_link(hw, speed, true);
> + }
> +
> /* check if it needs to wait to complete, if lsc interrupt is enabled */
> if (wait_to_complete == 0 || dev->data->dev_conf.intr_conf.lsc != 0)
> diag = ixgbe_check_link(hw, &link_speed, &link_up, 0);
> @@ -3145,10 +3163,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
>
> if (link_up == 0) {
> rte_ixgbe_dev_atomic_write_link_status(dev, &link);
> + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
> if (link.link_status == old.link_status)
> return -1;
> return 0;
> }
> + intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
> link.link_status = ETH_LINK_UP;
> link.link_duplex = ETH_LINK_FULL_DUPLEX;
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
> index e060c3d..9d335ba 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -43,6 +43,7 @@
> #define IXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
> #define IXGBE_FLAG_MAILBOX (uint32_t)(1 << 1)
> #define IXGBE_FLAG_PHY_INTERRUPT (uint32_t)(1 << 2)
> +#define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << 3)
>
> /*
> * Defines that were not part of ixgbe_type.h as they are not used by the
On 11/28/2016 5:27 PM, Laurent Hardy wrote:
> Hello,
> Is there anyone available to review this patch ?
Adding more developers into cc.
>
> regards,
> Laurent
>
<...>
2016-12-08 17:10, Ferruh Yigit:
> On 11/28/2016 5:27 PM, Laurent Hardy wrote:
> > Hello,
> > Is there anyone available to review this patch ?
>
> Adding more developers into cc.
This patch is dying: more than 2 months without any review!
A tip to help ixgbe maintainers in their task, please check this regularly:
http://dpdk.org/dev/patchwork/project/dpdk/list/?state=&q=ixgbe
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Laurent Hardy
> Sent: Friday, November 18, 2016 1:30 AM
> To: Zhang, Helin <helin.zhang@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/ixgbe: ensure link status is updated
>
> In case of link speed set to 1Gb at peer side (with autoneg or with defined
> speed) and cable not plugged-in when device is configured and started, then
> link status is not updated properly with new speed as no link setup is triggered.
>
> To avoid this issue, IXGBE_FLAG_NEED_LINK_CONFIG is set to try a link setup
> each time link_update() is triggered and current link status is down. When
> cable is plugged-in, link setup will be performed via ixgbe_setup_link().
>
> Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
> drivers/net/ixgbe/ixgbe_ethdev.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 52ebbe4..513d1d5 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -2095,6 +2095,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
>
> /* set flag to update link status after init */
> intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
> + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
>
> /*
> * Initialize to TRUE. If any of Rx queues doesn't meet the bulk @@
> -3117,8 +3118,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int
> wait_to_complete)
> struct ixgbe_hw *hw =
> IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> struct rte_eth_link link, old;
> ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
> + struct ixgbe_interrupt *intr =
> + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
> int link_up;
> int diag;
> + u32 speed = 0;
> + bool autoneg = false;
>
> link.link_status = ETH_LINK_DOWN;
> link.link_speed = 0;
> @@ -3128,6 +3133,19 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev,
> int wait_to_complete)
>
> hw->mac.get_link_status = true;
>
> + if (intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) {
> + speed = hw->phy.autoneg_advertised;
> + if (!speed) {
> + ixgbe_get_link_capabilities(hw, &speed, &autoneg);
> + /* setup the highest link when no autoneg */
> + if (!autoneg) {
> + if (speed & IXGBE_LINK_SPEED_10GB_FULL)
> + speed = IXGBE_LINK_SPEED_10GB_FULL;
> + }
> + }
> + ixgbe_setup_link(hw, speed, true);
> + }
> +
> /* check if it needs to wait to complete, if lsc interrupt is enabled */
> if (wait_to_complete == 0 || dev->data->dev_conf.intr_conf.lsc != 0)
> diag = ixgbe_check_link(hw, &link_speed, &link_up, 0); @@ -3145,10
> +3163,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int
> wait_to_complete)
>
> if (link_up == 0) {
> rte_ixgbe_dev_atomic_write_link_status(dev, &link);
> + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
> if (link.link_status == old.link_status)
> return -1;
> return 0;
> }
> + intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
> link.link_status = ETH_LINK_UP;
> link.link_duplex = ETH_LINK_FULL_DUPLEX;
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> b/drivers/net/ixgbe/ixgbe_ethdev.h
> index e060c3d..9d335ba 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -43,6 +43,7 @@
> #define IXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
> #define IXGBE_FLAG_MAILBOX (uint32_t)(1 << 1)
> #define IXGBE_FLAG_PHY_INTERRUPT (uint32_t)(1 << 2)
> +#define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << 3)
Now there is following macro in DPDK 17.02-rc2.
#define IXGBE_FLAG_MACSEC (uint32_t)(1 << 3)
You can redefine it as #define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << 4)
>
> /*
> * Defines that were not part of ixgbe_type.h as they are not used by the
> --
> 1.7.10.4
Hi Wei,
On Wed, 8 Feb 2017 15:51:42 +0000, "Dai, Wei" <wei.dai@intel.com> wrote:
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Laurent Hardy
> > Sent: Friday, November 18, 2016 1:30 AM
> > To: Zhang, Helin <helin.zhang@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>
> > Cc: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH] net/ixgbe: ensure link status is updated
> >
> > In case of link speed set to 1Gb at peer side (with autoneg or with
> > defined speed) and cable not plugged-in when device is configured
> > and started, then link status is not updated properly with new
> > speed as no link setup is triggered.
> >
> > To avoid this issue, IXGBE_FLAG_NEED_LINK_CONFIG is set to try a
> > link setup each time link_update() is triggered and current link
> > status is down. When cable is plugged-in, link setup will be
> > performed via ixgbe_setup_link().
> >
> > Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
> > ---
> > drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
> > drivers/net/ixgbe/ixgbe_ethdev.h | 1 +
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 52ebbe4..513d1d5 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -2095,6 +2095,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
> >
> > /* set flag to update link status after init */
> > intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
> > + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
> >
> > /*
> > * Initialize to TRUE. If any of Rx queues doesn't meet
> > the bulk @@ -3117,8 +3118,12 @@ ixgbe_dev_link_update(struct
> > rte_eth_dev *dev, int wait_to_complete)
> > struct ixgbe_hw *hw =
> > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > struct rte_eth_link link, old;
> > ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
> > + struct ixgbe_interrupt *intr =
> > + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
> > int link_up;
> > int diag;
> > + u32 speed = 0;
> > + bool autoneg = false;
> >
> > link.link_status = ETH_LINK_DOWN;
> > link.link_speed = 0;
> > @@ -3128,6 +3133,19 @@ ixgbe_dev_link_update(struct rte_eth_dev
> > *dev, int wait_to_complete)
> >
> > hw->mac.get_link_status = true;
> >
> > + if (intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) {
> > + speed = hw->phy.autoneg_advertised;
> > + if (!speed) {
> > + ixgbe_get_link_capabilities(hw, &speed,
> > &autoneg);
> > + /* setup the highest link when no autoneg
> > */
> > + if (!autoneg) {
> > + if (speed &
> > IXGBE_LINK_SPEED_10GB_FULL)
> > + speed =
> > IXGBE_LINK_SPEED_10GB_FULL;
> > + }
> > + }
> > + ixgbe_setup_link(hw, speed, true);
> > + }
> > +
> > /* check if it needs to wait to complete, if lsc interrupt
> > is enabled */ if (wait_to_complete == 0 ||
> > dev->data->dev_conf.intr_conf.lsc != 0) diag = ixgbe_check_link(hw,
> > &link_speed, &link_up, 0); @@ -3145,10 +3163,12 @@
> > ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
> >
> > if (link_up == 0) {
> > rte_ixgbe_dev_atomic_write_link_status(dev, &link);
> > + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
> > if (link.link_status == old.link_status)
> > return -1;
> > return 0;
> > }
> > + intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
> > link.link_status = ETH_LINK_UP;
> > link.link_duplex = ETH_LINK_FULL_DUPLEX;
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> > b/drivers/net/ixgbe/ixgbe_ethdev.h
> > index e060c3d..9d335ba 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> > @@ -43,6 +43,7 @@
> > #define IXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
> > #define IXGBE_FLAG_MAILBOX (uint32_t)(1 << 1)
> > #define IXGBE_FLAG_PHY_INTERRUPT (uint32_t)(1 << 2)
> > +#define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << 3)
>
> Now there is following macro in DPDK 17.02-rc2.
> #define IXGBE_FLAG_MACSEC (uint32_t)(1 << 3)
> You can redefine it as #define IXGBE_FLAG_NEED_LINK_CONFIG
> (uint32_t)(1 << 4)
Thanks, I'll send a v2.
Do you agree with the rest of the patch?
Regards,
Olivier
> -----Original Message-----
> From: Olivier MATZ [mailto:olivier.matz@6wind.com]
> Sent: Thursday, February 9, 2017 1:03 AM
> To: Dai, Wei <wei.dai@intel.com>
> Cc: Laurent Hardy <laurent.hardy@6wind.com>; Zhang, Helin
> <helin.zhang@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: ensure link status is updated
>
> Hi Wei,
>
> On Wed, 8 Feb 2017 15:51:42 +0000, "Dai, Wei" <wei.dai@intel.com> wrote:
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Laurent Hardy
> > > Sent: Friday, November 18, 2016 1:30 AM
> > > To: Zhang, Helin <helin.zhang@intel.com>; Ananyev, Konstantin
> > > <konstantin.ananyev@intel.com>
> > > Cc: dev@dpdk.org
> > > Subject: [dpdk-dev] [PATCH] net/ixgbe: ensure link status is updated
> > >
> > > In case of link speed set to 1Gb at peer side (with autoneg or with
> > > defined speed) and cable not plugged-in when device is configured
> > > and started, then link status is not updated properly with new speed
> > > as no link setup is triggered.
> > >
> > > To avoid this issue, IXGBE_FLAG_NEED_LINK_CONFIG is set to try a
> > > link setup each time link_update() is triggered and current link
> > > status is down. When cable is plugged-in, link setup will be
> > > performed via ixgbe_setup_link().
> > >
> > > Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
> > > ---
> > > drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++
> > > drivers/net/ixgbe/ixgbe_ethdev.h | 1 +
> > > 2 files changed, 21 insertions(+)
> > >
> > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > index 52ebbe4..513d1d5 100644
> > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > @@ -2095,6 +2095,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
> > >
> > > /* set flag to update link status after init */
> > > intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
> > > + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
> > >
> > > /*
> > > * Initialize to TRUE. If any of Rx queues doesn't meet the bulk
> > > @@ -3117,8 +3118,12 @@ ixgbe_dev_link_update(struct rte_eth_dev
> > > *dev, int wait_to_complete)
> > > struct ixgbe_hw *hw =
> > > IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > > struct rte_eth_link link, old;
> > > ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
> > > + struct ixgbe_interrupt *intr =
> > > + IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
> > > int link_up;
> > > int diag;
> > > + u32 speed = 0;
> > > + bool autoneg = false;
> > >
> > > link.link_status = ETH_LINK_DOWN;
> > > link.link_speed = 0;
> > > @@ -3128,6 +3133,19 @@ ixgbe_dev_link_update(struct rte_eth_dev
> > > *dev, int wait_to_complete)
> > >
> > > hw->mac.get_link_status = true;
> > >
> > > + if (intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) {
> > > + speed = hw->phy.autoneg_advertised;
> > > + if (!speed) {
> > > + ixgbe_get_link_capabilities(hw, &speed,
> > > &autoneg);
> > > + /* setup the highest link when no autoneg
> > > */
> > > + if (!autoneg) {
> > > + if (speed &
> > > IXGBE_LINK_SPEED_10GB_FULL)
> > > + speed =
> > > IXGBE_LINK_SPEED_10GB_FULL;
> > > + }
> > > + }
> > > + ixgbe_setup_link(hw, speed, true);
> > > + }
> > > +
> > > /* check if it needs to wait to complete, if lsc interrupt is
> > > enabled */ if (wait_to_complete == 0 ||
> > > dev->data->dev_conf.intr_conf.lsc != 0) diag = ixgbe_check_link(hw,
> > > &link_speed, &link_up, 0); @@ -3145,10 +3163,12 @@
> > > ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
> > >
> > > if (link_up == 0) {
> > > rte_ixgbe_dev_atomic_write_link_status(dev, &link);
> > > + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
> > > if (link.link_status == old.link_status)
> > > return -1;
> > > return 0;
> > > }
> > > + intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
> > > link.link_status = ETH_LINK_UP;
> > > link.link_duplex = ETH_LINK_FULL_DUPLEX;
> > >
> > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> > > b/drivers/net/ixgbe/ixgbe_ethdev.h
> > > index e060c3d..9d335ba 100644
> > > --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> > > @@ -43,6 +43,7 @@
> > > #define IXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
> > > #define IXGBE_FLAG_MAILBOX (uint32_t)(1 << 1)
> > > #define IXGBE_FLAG_PHY_INTERRUPT (uint32_t)(1 << 2)
> > > +#define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << 3)
> >
> > Now there is following macro in DPDK 17.02-rc2.
> > #define IXGBE_FLAG_MACSEC (uint32_t)(1 << 3)
> > You can redefine it as #define IXGBE_FLAG_NEED_LINK_CONFIG
> > (uint32_t)(1 << 4)
>
> Thanks, I'll send a v2.
>
> Do you agree with the rest of the patch?
So far I have no disagree opinions about the reset of this patch.
>
>
> Regards,
> Olivier
@@ -2095,6 +2095,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
/* set flag to update link status after init */
intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
+ intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
/*
* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
@@ -3117,8 +3118,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_eth_link link, old;
ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
+ struct ixgbe_interrupt *intr =
+ IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
int link_up;
int diag;
+ u32 speed = 0;
+ bool autoneg = false;
link.link_status = ETH_LINK_DOWN;
link.link_speed = 0;
@@ -3128,6 +3133,19 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
hw->mac.get_link_status = true;
+ if (intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) {
+ speed = hw->phy.autoneg_advertised;
+ if (!speed) {
+ ixgbe_get_link_capabilities(hw, &speed, &autoneg);
+ /* setup the highest link when no autoneg */
+ if (!autoneg) {
+ if (speed & IXGBE_LINK_SPEED_10GB_FULL)
+ speed = IXGBE_LINK_SPEED_10GB_FULL;
+ }
+ }
+ ixgbe_setup_link(hw, speed, true);
+ }
+
/* check if it needs to wait to complete, if lsc interrupt is enabled */
if (wait_to_complete == 0 || dev->data->dev_conf.intr_conf.lsc != 0)
diag = ixgbe_check_link(hw, &link_speed, &link_up, 0);
@@ -3145,10 +3163,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
if (link_up == 0) {
rte_ixgbe_dev_atomic_write_link_status(dev, &link);
+ intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
if (link.link_status == old.link_status)
return -1;
return 0;
}
+ intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
link.link_status = ETH_LINK_UP;
link.link_duplex = ETH_LINK_FULL_DUPLEX;
@@ -43,6 +43,7 @@
#define IXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
#define IXGBE_FLAG_MAILBOX (uint32_t)(1 << 1)
#define IXGBE_FLAG_PHY_INTERRUPT (uint32_t)(1 << 2)
+#define IXGBE_FLAG_NEED_LINK_CONFIG (uint32_t)(1 << 3)
/*
* Defines that were not part of ixgbe_type.h as they are not used by the