From owner-svn-src-all@freebsd.org Thu Jan 7 17:40:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22605A65C74; Thu, 7 Jan 2016 17:40:02 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward8o.cmail.yandex.net (forward8o.cmail.yandex.net [IPv6:2a02:6b8:0:1a72::293]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A8BA1162; Thu, 7 Jan 2016 17:40:01 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from web3o.yandex.ru (web3o.yandex.ru [IPv6:2a02:6b8:0:1a2d::5:103]) by forward8o.cmail.yandex.net (Yandex) with ESMTP id AFB4B218B6; Thu, 7 Jan 2016 20:39:57 +0300 (MSK) Received: from 127.0.0.1 (localhost [127.0.0.1]) by web3o.yandex.ru (Yandex) with ESMTP id D145F2400DB6; Thu, 7 Jan 2016 20:39:56 +0300 (MSK) Received: by web3o.yandex.ru with HTTP; Thu, 07 Jan 2016 20:39:55 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Sean Bruno , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" In-Reply-To: <201601071702.u07H2Y9J069900@repo.freebsd.org> References: null <201601071702.u07H2Y9J069900@repo.freebsd.org> Subject: Re: svn commit: r293334 - head/sys/dev/ixgbe MIME-Version: 1.0 Message-Id: <687511452188395@web3o.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Thu, 07 Jan 2016 20:39:55 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2016 17:40:02 -0000 07.01.2016, 20:02, "Sean Bruno" : > 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; > š}