Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Jan 2016 20:39:55 +0300
From:      Alexander V. Chernikov <melifaro@freebsd.org>
To:        Sean Bruno <sbruno@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r293334 - head/sys/dev/ixgbe
Message-ID:  <687511452188395@web3o.yandex.ru>
In-Reply-To: <201601071702.u07H2Y9J069900@repo.freebsd.org>
References:  null <201601071702.u07H2Y9J069900@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
07.01.2016, 20:02, "Sean Bruno" <sbruno@FreeBSD.org>:
> Author: sbruno
> Date: Thu Jan 7 17:02:34 2016
> New Revision: 293334
> URL: https://svnweb.freebsd.org/changeset/base/293334
>
> Log:
> ššFixup SFP module insertion on the 82599 when insertion happens after
> ššthe system is booted and running.
>
> ššAdd PHY detection logic to ixgbe_handle_mod() and add locking to
> ššixgbe_handle_msf() as well.
Thanks for checking/committing this!
I always wanted to do that but never managed to push local patches..

>
> ššPR: 150251
> ššSubmitted by: aboyer@averesystems.com
> ššMFC after: 2 weeks
> ššDifferential Revision: https://reviews.freebsd.org/D3188
>
> Modified:
> ššhead/sys/dev/ixgbe/if_ix.c
>
> Modified: head/sys/dev/ixgbe/if_ix.c
> ==============================================================================
> --- head/sys/dev/ixgbe/if_ix.c Thu Jan 7 17:00:35 2016 (r293333)
> +++ head/sys/dev/ixgbe/if_ix.c Thu Jan 7 17:02:34 2016 (r293334)
> @@ -2947,12 +2947,7 @@ ixgbe_config_link(struct adapter *adapte
> šššššššššsfp = ixgbe_is_sfp(hw);
>
> šššššššššif (sfp) {
> - if (hw->phy.multispeed_fiber) {
> - hw->mac.ops.setup_sfp(hw);
> - ixgbe_enable_tx_laser(hw);
> - taskqueue_enqueue(adapter->tq, &adapter->msf_task);
> - } else
> - taskqueue_enqueue(adapter->tq, &adapter->mod_task);
> + taskqueue_enqueue(adapter->tq, &adapter->mod_task);
> ššššššššš} else {
> šššššššššššššššššif (hw->mac.ops.check_link)
> šššššššššššššššššššššššššerr = ixgbe_check_link(hw, &adapter->link_speed,
> @@ -3758,23 +3753,66 @@ ixgbe_handle_mod(void *context, int pend
> š{
> šššššššššstruct adapter *adapter = context;
> šššššššššstruct ixgbe_hw *hw = &adapter->hw;
> + enum ixgbe_phy_type orig_type = hw->phy.type;
> šššššššššdevice_t dev = adapter->dev;
> šššššššššu32 err;
>
> + IXGBE_CORE_LOCK(adapter);
> +
> + /* Check to see if the PHY type changed */
> + if (hw->phy.ops.identify) {
> + hw->phy.type = ixgbe_phy_unknown;
> + hw->phy.ops.identify(hw);
> + }
> +
> + if (hw->phy.type != orig_type) {
> + device_printf(dev, "Detected phy_type %d\n", hw->phy.type);
> +
> + if (hw->phy.type == ixgbe_phy_none) {
> + hw->phy.sfp_type = ixgbe_sfp_type_unknown;
> + goto out;
> + }
> +
> + /* Try to do the initialization that was skipped before */
> + if (hw->phy.ops.init)
> + hw->phy.ops.init(hw);
> + if (hw->phy.ops.reset)
> + hw->phy.ops.reset(hw);
> + }
> +
> šššššššššerr = hw->phy.ops.identify_sfp(hw);
> šššššššššif (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
> šššššššššššššššššdevice_printf(dev,
> ššššššššššššššššššššš"Unsupported SFP+ module type was detected.\n");
> - return;
> + goto out;
> ššššššššš}
>
> šššššššššerr = hw->mac.ops.setup_sfp(hw);
> šššššššššif (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
> šššššššššššššššššdevice_printf(dev,
> ššššššššššššššššššššš"Setup failure - unsupported SFP+ module type.\n");
> - return;
> + goto out;
> + }
> + if (hw->phy.multispeed_fiber)
> + taskqueue_enqueue(adapter->tq, &adapter->msf_task);
> +out:
> + /* Update media type */
> + switch (hw->mac.ops.get_media_type(hw)) {
> + case ixgbe_media_type_fiber:
> + adapter->optics = IFM_10G_SR;
> + break;
> + case ixgbe_media_type_copper:
> + adapter->optics = IFM_10G_TWINAX;
> + break;
> + case ixgbe_media_type_cx4:
> + adapter->optics = IFM_10G_CX4;
> + break;
> + default:
> + adapter->optics = 0;
> + break;
> ššššššššš}
> - taskqueue_enqueue(adapter->tq, &adapter->msf_task);
> +
> + IXGBE_CORE_UNLOCK(adapter);
> šššššššššreturn;
> š}
>
> @@ -3790,6 +3828,7 @@ ixgbe_handle_msf(void *context, int pend
> šššššššššu32 autoneg;
> šššššššššbool negotiate;
>
> + IXGBE_CORE_LOCK(adapter);
> ššššššššš/* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */
> šššššššššadapter->phy_layer = ixgbe_get_supported_physical_layer(hw);
>
> @@ -3802,6 +3841,7 @@ ixgbe_handle_msf(void *context, int pend
> ššššššššš/* Adjust media types shown in ifconfig */
> šššššššššifmedia_removeall(&adapter->media);
> šššššššššixgbe_add_media_types(adapter);
> + IXGBE_CORE_UNLOCK(adapter);
> šššššššššreturn;
> š}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?687511452188395>