From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4B1947D73 for ; Fri, 18 Aug 2017 12:33:23 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Aug 2017 03:33:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,392,1498546800"; d="scan'208";a="1163934845" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 18 Aug 2017 03:33:22 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 18 Aug 2017 03:33:14 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 18 Aug 2017 03:33:14 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.183]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.236]) with mapi id 14.03.0319.002; Fri, 18 Aug 2017 18:33:12 +0800 From: "Guo, Jia" To: Yuanhan Liu CC: "Xing, Beilei" , "Wu, Jingjing" , "stable@dpdk.org" Thread-Topic: [PATCH] net/i40e: fix link down and negotiation Thread-Index: AQHTF8YijyV/tnX1e0W7oEHo4ycb26KJXTAAgACNp4A= Date: Fri, 18 Aug 2017 10:33:11 +0000 Message-ID: <01BA8470C017D6468C8290E4B9C5E1E83B25852B@shsmsx102.ccr.corp.intel.com> References: <1503021828-2545-1-git-send-email-jia.guo@intel.com> <20170818100448.GL9612@yliu-home> In-Reply-To: <20170818100448.GL9612@yliu-home> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWNmZWM0MmYtYWI4MS00NTEyLWJhNGQtYzNjMmI4MWQzMGNhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlJpVGdQWmFybU01U0Z2djVZbXdRU3pxTUVrN29idDdKb0lzZjBMVFliU2c9In0= dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [PATCH] net/i40e: fix link down and negotiation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 10:33:24 -0000 Yuanhan Thanks for your reminder. V2 patch witch is base on 16.11 branch have been = fly. Please check again. Best regards, Jeff Guo -----Original Message----- From: Yuanhan Liu [mailto:yliu@fridaylinux.org]=20 Sent: Friday, August 18, 2017 6:05 PM To: Guo, Jia Cc: Xing, Beilei ; Wu, Jingjing ; stable@dpdk.org Subject: Re: [PATCH] net/i40e: fix link down and negotiation On Fri, Aug 18, 2017 at 10:03:48AM +0800, Jeff Guo wrote: > [ backported from upstream commit=20 > 1bb8f661168d942927cb65e355ec64d4ab195281 ] Thanks for the backport, but it still does't apply to 16.11 branch cleanly. FYI, you should do the backport on top of branch 16.11 of stable tree: http://dpdk.org/browse/dpdk-stable/ --yliu --- diff --cc drivers/net/i40e/i40e_ethdev.c index f65ddc7,fa0518e..0000000 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@@ -1627,10 -1850,18 +1635,24 @@@ i40e_phy_conf_link(struct i40e_hw *hw phy_conf.abilities =3D abilities; + + + /* To enable link, phy_type mask needs to include each type */ + for (cnt =3D I40E_PHY_TYPE_SGMII; cnt < I40E_PHY_TYPE_MAX; cnt++) + phy_type_mask |=3D 1 << cnt; + /* use get_phy_abilities_resp value for the rest */ ++<<<<<<< 09ae3d0c48885d20ab255922c1ca4769a32c2a12 + phy_conf.phy_type =3D phy_ab.phy_type; + phy_conf.phy_type_ext =3D phy_ab.phy_type_ext; + phy_conf.fec_config =3D phy_ab.mod_type_ext; ++=3D=3D=3D=3D=3D=3D=3D + phy_conf.phy_type =3D is_up ? cpu_to_le32(phy_type_mask) : 0; + phy_conf.phy_type_ext =3D is_up ? (I40E_AQ_PHY_TYPE_EXT_25G_KR | + I40E_AQ_PHY_TYPE_EXT_25G_CR | I40E_AQ_PHY_TYPE_EXT_25G_SR | + I40E_AQ_PHY_TYPE_EXT_25G_LR) : 0; + phy_conf.fec_config =3D phy_ab.fec_cfg_curr_mod_ext_info; ++>>>>>>> net/i40e: fix link down and negotiation phy_conf.eee_capability =3D phy_ab.eee_capability; phy_conf.eeer =3D phy_ab.eeer_val; phy_conf.low_power_ctrl =3D phy_ab.d3_lpan; >=20 > Enable the functions set link down and set link up in i40e by check=20 > phy_type, and fix the issue of auto negotiation failed in XXV710 when=20 > bind kernel driver after unbind from DPDK driver by modify the speed=20 > setting distinguish from set link up and down. With this fix, if=20 > unbind DPDK to bind kernel driver, no need to set auto negotiation and=20 > ifconfig up anymore, remove the part from doc. >=20 > Fixes: ca7e599d4506 ("net/i40e: fix link management") > Fixes: 2f1e22817420 ("i40e: skip link control as firmware workaround") > Fixes: 6e145fcc754b ("i40e: support autoneg or force link speed") >=20 > Signed-off-by: Jeff Guo > Acked-by: Jingjing Wu > --- > drivers/net/i40e/i40e_ethdev.c | 34=20 > ++++++++++++++++++++++------------ > 1 file changed, 22 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c=20 > b/drivers/net/i40e/i40e_ethdev.c index 4c49673..fa0518e 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -1806,11 +1806,15 @@ i40e_parse_link_speeds(uint16_t link_speeds) =20 > static int i40e_phy_conf_link(struct i40e_hw *hw, > uint8_t abilities, > - uint8_t force_speed) > + uint8_t force_speed, > + bool is_up) > { > enum i40e_status_code status; > struct i40e_aq_get_phy_abilities_resp phy_ab; > struct i40e_aq_set_phy_config phy_conf; > + enum i40e_aq_phy_type cnt; > + uint32_t phy_type_mask =3D 0; > + > const uint8_t mask =3D I40E_AQ_PHY_FLAG_PAUSE_TX | > I40E_AQ_PHY_FLAG_PAUSE_RX | > I40E_AQ_PHY_FLAG_PAUSE_RX | > @@ -1828,6 +1832,10 @@ i40e_phy_conf_link(struct i40e_hw *hw, > if (status) > return ret; > =20 > + /* If link already up, no need to set up again */ > + if (is_up && phy_ab.phy_type !=3D 0) > + return I40E_SUCCESS; > + > memset(&phy_conf, 0, sizeof(phy_conf)); > =20 > /* bits 0-2 use the values from get_phy_abilities_resp */ @@=20 > -1838,13 +1846,21 @@ i40e_phy_conf_link(struct i40e_hw *hw, > if (abilities & I40E_AQ_PHY_AN_ENABLED) > phy_conf.link_speed =3D advt; > else > - phy_conf.link_speed =3D force_speed; > + phy_conf.link_speed =3D is_up ? force_speed : phy_ab.link_speed; > =20 > phy_conf.abilities =3D abilities; > =20 > + > + > + /* To enable link, phy_type mask needs to include each type */ > + for (cnt =3D I40E_PHY_TYPE_SGMII; cnt < I40E_PHY_TYPE_MAX; cnt++) > + phy_type_mask |=3D 1 << cnt; > + > /* use get_phy_abilities_resp value for the rest */ > - phy_conf.phy_type =3D phy_ab.phy_type; > - phy_conf.phy_type_ext =3D phy_ab.phy_type_ext; > + phy_conf.phy_type =3D is_up ? cpu_to_le32(phy_type_mask) : 0; > + phy_conf.phy_type_ext =3D is_up ? (I40E_AQ_PHY_TYPE_EXT_25G_KR | > + I40E_AQ_PHY_TYPE_EXT_25G_CR | I40E_AQ_PHY_TYPE_EXT_25G_SR | > + I40E_AQ_PHY_TYPE_EXT_25G_LR) : 0; > phy_conf.fec_config =3D phy_ab.fec_cfg_curr_mod_ext_info; > phy_conf.eee_capability =3D phy_ab.eee_capability; > phy_conf.eeer =3D phy_ab.eeer_val; > @@ -1876,13 +1892,7 @@ i40e_apply_link_speed(struct rte_eth_dev *dev) > abilities |=3D I40E_AQ_PHY_AN_ENABLED; > abilities |=3D I40E_AQ_PHY_LINK_ENABLED; > =20 > - /* Skip changing speed on 40G interfaces, FW does not support */ > - if (I40E_PHY_TYPE_SUPPORT_40G(hw->phy.phy_types)) { > - speed =3D I40E_LINK_SPEED_UNKNOWN; > - abilities |=3D I40E_AQ_PHY_AN_ENABLED; > - } > - > - return i40e_phy_conf_link(hw, abilities, speed); > + return i40e_phy_conf_link(hw, abilities, speed, true); > } > =20 > static int > @@ -2225,7 +2235,7 @@ i40e_dev_set_link_down(struct rte_eth_dev *dev) > struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); > =20 > abilities =3D I40E_AQ_PHY_ENABLE_ATOMIC_LINK; > - return i40e_phy_conf_link(hw, abilities, speed); > + return i40e_phy_conf_link(hw, abilities, speed, false); > } > =20 > int > -- > 2.7.4