From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 7F3D74C70 for ; Mon, 26 Feb 2018 03:25:25 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9308920A85; Sun, 25 Feb 2018 21:25:22 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Sun, 25 Feb 2018 21:25:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=lt91a1Tgr/1INh1GA91yr8o+z42Pf6Hsc98KdRvw+To=; b=tqSfABEd d937wDnOdNgs3oZuzjtW53CepCYELbTrDlGyTeCnT9B6t7jw/G8QYmKqJMua0juG krEKBkDzCOYz6zFkaUX+FT8O5SIPHkBo/sp6lp6SG3146iCVIIQB1+XnzYrSFGHl 17FsVHX3wJXjBbZmfDfP42z0TZt8nglRWvsLjyTSboP0ANkKq3aBGRuem2wZbb4C WjaClBl2I+x+uuSv55O0OhOOXbjZ8sr3wsC6ixHZxnQrVOF2ekQaThEUize77qnd ru2PqoEwb+c8p8UOXAkSZXUxeDsaQvCGkTS4UOBaB0YpiBkkY1GgZRYr91bJLsbK OJmOEpp18lFKkA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=lt91a1Tgr/1INh1GA91yr8o+z42Pf 6Hsc98KdRvw+To=; b=duikWenRkzxLOIvL7lKVzTkhwxlKmdkOdPlTDTEJUX7ss YqvkN2KukF4O+/OwMvaY92tjGriqxFokKBKmQCpLOonFYGi9ufmW4s1OwjyPF5KY jvq2QobiQCHTyIhxF/HTQ1OV9ofB85qo3n3IYYM9H8JjvleMK+5wk5885oxUXvmI masObBVeRu+7uGbXXsbqWnQlfgc2k94JQourJwzXh5oNn8aN5WyyePcYfwN2lnHo P8heDIsdrDXaX8cYgd18p4KNR9bNpuiDDh8cifWfaoqh3XXT68v6POT/LADAVUsW JA+Goxs1vdt9oPIliOLyuoHP78sCBRaKzzkzz3Rbw== X-ME-Sender: Received: from yliu-mob (unknown [218.64.223.182]) by mail.messagingengine.com (Postfix) with ESMTPA id 836AB7E1D8; Sun, 25 Feb 2018 21:25:20 -0500 (EST) Date: Mon, 26 Feb 2018 10:25:10 +0800 From: Yuanhan Liu To: Ajit Khaparde Cc: stable@dpdk.org Message-ID: <20180226022510.GD11744@yliu-mob> References: <20180225050216.76633-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180225050216.76633-1-ajit.khaparde@broadcom.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-stable] [PATCH] net/bnxt: fix link speed setting with autoneg off 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, 26 Feb 2018 02:25:25 -0000 On Sat, Feb 24, 2018 at 09:02:16PM -0800, Ajit Khaparde wrote: > When Autoneg is turned off especially on remote side, > link does not come up. This patch fixes that. > > backported from upstream commit 90cc14d77359bb3f8e48f4ef966ee77a52703949 > ("net/bnxt: fix link speed setting with autoneg off") > > Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification") > Cc: stable@dpdk.org Applied to dpdk-stable/17.11. Thanks for the backporting! --yliu > > Signed-off-by: Ajit Khaparde > --- > drivers/net/bnxt/bnxt.h | 1 + > drivers/net/bnxt/bnxt_hwrm.c | 25 ++++++++++++++++++++++--- > 2 files changed, 23 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h > index 8ab1c7f85..3bc2b9379 100644 > --- a/drivers/net/bnxt/bnxt.h > +++ b/drivers/net/bnxt/bnxt.h > @@ -162,6 +162,7 @@ struct bnxt_link_info { > uint16_t link_speed; > uint16_t support_speeds; > uint16_t auto_link_speed; > + uint16_t force_link_speed; > uint16_t auto_link_speed_mask; > uint32_t preemphasis; > uint8_t phy_type; > diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c > index 51b0056cd..ce214d7cb 100644 > --- a/drivers/net/bnxt/bnxt_hwrm.c > +++ b/drivers/net/bnxt/bnxt_hwrm.c > @@ -738,7 +738,8 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf) > HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS; > } > /* AutoNeg - Advertise speeds specified. */ > - if (conf->auto_link_speed_mask) { > + if (conf->auto_link_speed_mask && > + !(conf->phy_flags & HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE)) { > req.auto_mode = > HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK; > req.auto_link_speed_mask = > @@ -801,12 +802,22 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp, > link_info->support_speeds = rte_le_to_cpu_16(resp->support_speeds); > link_info->auto_link_speed = rte_le_to_cpu_16(resp->auto_link_speed); > link_info->preemphasis = rte_le_to_cpu_32(resp->preemphasis); > + link_info->force_link_speed = rte_le_to_cpu_16(resp->force_link_speed); > link_info->phy_ver[0] = resp->phy_maj; > link_info->phy_ver[1] = resp->phy_min; > link_info->phy_ver[2] = resp->phy_bld; > > HWRM_UNLOCK(); > > + RTE_LOG(DEBUG, PMD, "Link Speed %d\n", link_info->link_speed); > + RTE_LOG(DEBUG, PMD, "Auto Mode %d\n", link_info->auto_mode); > + RTE_LOG(DEBUG, PMD, "Support Speeds %x\n", link_info->support_speeds); > + RTE_LOG(DEBUG, PMD, "Auto Link Speed %x\n", link_info->auto_link_speed); > + RTE_LOG(DEBUG, PMD, "Auto Link Speed Mask %x\n", > + link_info->auto_link_speed_mask); > + RTE_LOG(DEBUG, PMD, "Forced Link Speed %x\n", > + link_info->force_link_speed); > + > return rc; > } > > @@ -2124,7 +2135,9 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up) > autoneg = bnxt_check_eth_link_autoneg(dev_conf->link_speeds); > speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds); > link_req.phy_flags = HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY; > - if (autoneg == 1) { > + /* Autoneg can be done only when the FW allows */ > + if (autoneg == 1 && !(bp->link_info.auto_link_speed || > + bp->link_info.force_link_speed)) { > link_req.phy_flags |= > HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG; > link_req.auto_link_speed_mask = > @@ -2142,7 +2155,13 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up) > } > > link_req.phy_flags |= HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE; > - link_req.link_speed = speed; > + /* If user wants a particular speed try that first. */ > + if (speed) > + link_req.link_speed = speed; > + else if (bp->link_info.force_link_speed) > + link_req.link_speed = bp->link_info.force_link_speed; > + else > + link_req.link_speed = bp->link_info.auto_link_speed; > } > link_req.duplex = bnxt_parse_eth_link_duplex(dev_conf->link_speeds); > link_req.auto_pause = bp->link_info.auto_pause; > -- > 2.14.3 (Apple Git-98)