From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f53.google.com (mail-pg0-f53.google.com [74.125.83.53]) by dpdk.org (Postfix) with ESMTP id 13995917D for ; Mon, 21 Aug 2017 11:36:45 +0200 (CEST) Received: by mail-pg0-f53.google.com with SMTP id t3so68845685pgt.0 for ; Mon, 21 Aug 2017 02:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/vgYCPPYRUmYJBIsTqyWigLkFtvRJ7YoyGSh/d2Aw7g=; b=HG2yE46sgGmYi5M1Bic2y44oYtXtpOWeffmvENp5RDNLLPijed3SPHExICR3OwxNr0 WkL3PcyrDY/y+J766ncsTRVnNsN5iF1CqlVUWbNwlkqrcpFQp/w1hLNO27f4t7BiXCr3 vA4FZYPD2TtmdN9lpAs04AKIZDUV7UOaxCahhoWQrNVzQ2PIIx//GRkvz+pDEfFYdCct A9q0+76AGWbCJ2++oe7OMlTD05MVMNuDKzJ7921deGQzjNe7OtVj66J8VoMijSbcxefK LR23VuUhtHD9AzjnB1hJSa9oJcOEZwwuIu0H9oWaG5/87LHyr+hkGXg0dcOErpu+ZiyT FedQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/vgYCPPYRUmYJBIsTqyWigLkFtvRJ7YoyGSh/d2Aw7g=; b=eLrCWXU5og4oSXpgVdw5HbSwXZ8oK69J/z4vdOVLzOlqBvOc8WW+BrksBcgkBpRTPl AR53FXeuAKKd8HeHnGQsbR4SruDBWW+HzWpa9X4rMX9XdRFcKZUAhApIRSQ1ZpbZhMq7 ukgT/j4Fw8IDwcvDyNlZVEL5HVhJ4aG06N8xkxg2SOTtSqSv6F/3he+4UCutWeR4+PE2 ovNAq5eVXuStIer3QJu3uSw+ShRXMiZWnAkTpp7MbcTa2RqY+pV1CIZA3C70FiMIdWkg ZBlQEt0yLoDdw4AwPXGgTYVfW5Q9rjaGUGTDm9zuW6RLPVnRG2wHHQQV4QSfP1dvixLp HcQA== X-Gm-Message-State: AHYfb5jYUjiVo4m6vLbm7jGj5Scc7TcBolbO1ZimKaOZRpsrGfJhI7Fg kRCvPQf9l3nsAF9C X-Received: by 10.98.32.74 with SMTP id g71mr1168429pfg.88.1503308204387; Mon, 21 Aug 2017 02:36:44 -0700 (PDT) Received: from localhost.localdomain ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id 69sm23355087pfh.186.2017.08.21.02.36.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Aug 2017 02:36:43 -0700 (PDT) From: Yuanhan Liu To: Jeff Guo Cc: Jingjing Wu , dpdk stable , Yuanhan Liu Date: Mon, 21 Aug 2017 17:30:56 +0800 Message-Id: <1503307878-16728-42-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503307878-16728-1-git-send-email-yliu@fridaylinux.org> References: <1503307878-16728-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/i40e: fix link down and negotiation' has been queued to stable release 17.05.2 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: Mon, 21 Aug 2017 09:36:45 -0000 Hi, FYI, your patch has been queued to stable release 17.05.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/24/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 5b970ecc66bc9e29cc96dca71a921ba721335282 Mon Sep 17 00:00:00 2001 From: Jeff Guo Date: Fri, 21 Jul 2017 11:07:04 +0800 Subject: [PATCH] net/i40e: fix link down and negotiation [ upstream commit 1bb8f661168d942927cb65e355ec64d4ab195281 ] Enable the functions set link down and set link up in i40e by check phy_type, and fix the issue of auto negotiation failed in XXV710 when bind kernel driver after unbind from DPDK driver by modify the speed setting distinguish from set link up and down. With this fix, if unbind DPDK to bind kernel driver, no need to set auto negotiation and ifconfig up anymore, remove the part from doc. 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") Signed-off-by: Jeff Guo Acked-by: Jingjing Wu --- doc/guides/nics/i40e.rst | 10 ---------- drivers/net/i40e/i40e_ethdev.c | 34 ++++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst index 4d3c7ca..387a588 100644 --- a/doc/guides/nics/i40e.rst +++ b/doc/guides/nics/i40e.rst @@ -404,16 +404,6 @@ is used as the VF driver, DPDK cannot choose 16 byte receive descriptor. That is to say, user should keep ``CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n`` in config file. -Link down with i40e kernel driver after DPDK application exit -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -After DPDK application quit, and the device is bound back to Linux i40e -kernel driver, the link cannot be up after ``ifconfig up``. -To work around this issue, ``ethtool -s autoneg on`` should be -set first and then the link can be brought up through ``ifconfig up``. - -NOTE: requires Linux kernel i40e driver version >= 1.4.X - Receive packets with Ethertype 0x88A8 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 6702900..223f2d8 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) 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 = 0; + const uint8_t mask = 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; + /* If link already up, no need to set up again */ + if (is_up && phy_ab.phy_type != 0) + return I40E_SUCCESS; + memset(&phy_conf, 0, sizeof(phy_conf)); /* bits 0-2 use the values from get_phy_abilities_resp */ @@ -1838,13 +1846,21 @@ i40e_phy_conf_link(struct i40e_hw *hw, if (abilities & I40E_AQ_PHY_AN_ENABLED) phy_conf.link_speed = advt; else - phy_conf.link_speed = force_speed; + phy_conf.link_speed = is_up ? force_speed : phy_ab.link_speed; phy_conf.abilities = abilities; + + + /* To enable link, phy_type mask needs to include each type */ + for (cnt = I40E_PHY_TYPE_SGMII; cnt < I40E_PHY_TYPE_MAX; cnt++) + phy_type_mask |= 1 << cnt; + /* use get_phy_abilities_resp value for the rest */ - phy_conf.phy_type = phy_ab.phy_type; - phy_conf.phy_type_ext = phy_ab.phy_type_ext; + phy_conf.phy_type = is_up ? cpu_to_le32(phy_type_mask) : 0; + phy_conf.phy_type_ext = 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 = phy_ab.fec_cfg_curr_mod_ext_info; phy_conf.eee_capability = phy_ab.eee_capability; phy_conf.eeer = phy_ab.eeer_val; @@ -1876,13 +1892,7 @@ i40e_apply_link_speed(struct rte_eth_dev *dev) abilities |= I40E_AQ_PHY_AN_ENABLED; abilities |= I40E_AQ_PHY_LINK_ENABLED; - /* Skip changing speed on 40G interfaces, FW does not support */ - if (I40E_PHY_TYPE_SUPPORT_40G(hw->phy.phy_types)) { - speed = I40E_LINK_SPEED_UNKNOWN; - abilities |= I40E_AQ_PHY_AN_ENABLED; - } - - return i40e_phy_conf_link(hw, abilities, speed); + return i40e_phy_conf_link(hw, abilities, speed, true); } static int @@ -2225,7 +2235,7 @@ i40e_dev_set_link_down(struct rte_eth_dev *dev) struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); abilities = I40E_AQ_PHY_ENABLE_ATOMIC_LINK; - return i40e_phy_conf_link(hw, abilities, speed); + return i40e_phy_conf_link(hw, abilities, speed, false); } int -- 2.7.4