[PATCH v6 2/2] net/ixgbe: Fix SFP detection and linking on hotplug

Wang, Haiyue haiyue.wang at intel.com
Wed Apr 13 04:46:50 CEST 2022


> -----Original Message-----
> From: Jeff Daly <jeffd at silicom-usa.com>
> Sent: Wednesday, April 13, 2022 01:42
> To: dev at dpdk.org
> Cc: stable at dpdk.org; Stephen Douthit <stephend at silicom-usa.com>; Wang, Haiyue <haiyue.wang at intel.com>
> Subject: [PATCH v6 2/2] net/ixgbe: Fix SFP detection and linking on hotplug
> 
> Currently the ixgbe driver does not ID any SFP except for the first one
> plugged in. This can lead to no-link, or incorrect speed conditions.
> 
> For example:
> 
> * If link is initially established with a 1G SFP, and later a 1G/10G
> multispeed part is later installed, then the MAC link setup functions are
> never called to change from 1000BASE-X to 10GBASE-R mode, and the link
> stays running at the slower rate.
> 
> * If link is initially established with a 1G SFP, and later a 10G only
> module is later installed, no link is established, since we are still
> trasnsmitting in 1000BASE-X mode to a 10GBASE-R only partner.
> 
> Refactor the SFP ID/setup, and link setup code, to more closely match the
> flow of the mainline kernel driver which does not have these issues.  In
> that driver a service task runs periodically to handle these operations
> based on bit flags that have been set (usually via interrupt or userspace
> request), and then get cleared once the requested subtask has been
> completed.
> 
> Fixes: af75078fece ("first public release")
> Cc: stable at dpdk.org
> 

So BIG change for new platform, DON'T CC to stable!

> Signed-off-by: Stephen Douthit <stephend at silicom-usa.com>
> Signed-off-by: Jeff Daly <jeffd at silicom-usa.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 533 +++++++++++++++++++++++--------
>  drivers/net/ixgbe/ixgbe_ethdev.h |  14 +-
>  2 files changed, 410 insertions(+), 137 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index f31bbb7895..9e720eee47 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -236,9 +236,6 @@ static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev);
>  static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev);
>  static void ixgbe_dev_interrupt_handler(void *param);
>  static void ixgbe_dev_interrupt_delayed_handler(void *param);
> -static void *ixgbe_dev_setup_link_thread_handler(void *param);
> -static int ixgbe_dev_wait_setup_link_complete(struct rte_eth_dev *dev,
> -					      uint32_t timeout_ms);
> 


> +	/* TODO - Even for platforms where ixgbe_check_sfp_cage() gives a clear
> +	 * status result, if there's no interrupts, or no interrupt for the SFP
> +	 * cage present pin, even if other interrupts exist, then we still need
> +	 * to poll here to set the flag.
> +	 */
> +#ifndef RTE_EXEC_ENV_FREEBSD
> +	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> +	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
> +	if (rte_intr_allow_others(intr_handle)) {
> +		/* check if lsc interrupt is enabled */
> +		if (dev->data->dev_conf.intr_conf.lsc)
> +			have_int = true;


> +	/* Check for loss of SFP */
> +	/* TODO - For platforms that don't have this flag, do we need to set
> +	 *  NEED_SFP_SETUP on LSC if we're a SFP platform?
> +	 */
> +	if (hw->mac.type ==  ixgbe_mac_X550EM_a &&
> +	    (eicr & IXGBE_EICR_GPI_SDP0_X550EM_a))
> +		intr->flags |= IXGBE_FLAG_NEED_SFP_SETUP;
> +
>  	return 0;
>  }


TODO ?

> --
> 2.25.1



More information about the stable mailing list