Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4593517pja; Thu, 21 Nov 2019 22:29:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzgfJvR+ApUjKitsygLc6Yn2zJi/kdFnf3xbflghEJiv4Hz8FdHomUVg1Xyrpgh+ze/nGhH X-Received: by 2002:a17:906:2f09:: with SMTP id v9mr19704513eji.91.1574404177710; Thu, 21 Nov 2019 22:29:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574404177; cv=none; d=google.com; s=arc-20160816; b=k+E4EJjCSrX2M3pDK1+LynyhFlu3R88xrHdVGqNOuQl+jE/x7dnZGTicucYGp6Wp+o EEWUXAurqfFxpwSYYkigThzf8X+8UFhKwILFC8sfkP+6aD8gztfpCGT+cSAbWweHWDl+ RYoKGx2gwfuywqHNrTjzikINIGz7T+xRqOjRYApFeUfu4pkzJWwMI6E9RdUxjZ5AEejC hznrAa0qKSSnG7sNU6+o4UKlsykgVoYwNxmoxprUTPukxjQj272QGhR6ftkEgYqjxnVR 47wyV5i7O5xoLsHHXYYqiAsiQrWjkELJW2MT/yC3oBeCubEtNnIRX7NFjPDNVLPirNYW 6yrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Dm40pP2w9c3xKbhGWM4zbAlJ0PhDIQrr4LZDVDlzceM=; b=WyBpzrIDUV8DnUuRW5VOo/QblAY3/TolbMp3Kh/+kjUyTleZQjIC2btnQgoDFMk9iL hv/mylYwm6hSHDmMjg5cxL6BAYhtE1+AG83USgcEFqLRzcs7jQRIVH3HNMrimHusLqyv Y7ktRtlTv0mBq7RzlzOZKEbF8Ty+RQbUHmQhV+7of9baaYohBmyicXFX4XCHuqDGz3HT k1e/5ylUof3NHefaiILlGByRZxQWyiKFkxuQAosJGiXKn9XBuGJgjiKerirpJZfEjSV9 we6Ls2qdnUoiyPWDKMi6VfPrGcRrsoMI6/iW3CIltdryhVOFUP6erUm5/dUwSK5uovSL E1Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=czumd0SX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5si3602910ejn.123.2019.11.21.22.29.14; Thu, 21 Nov 2019 22:29:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=czumd0SX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729367AbfKVG0B (ORCPT + 99 others); Fri, 22 Nov 2019 01:26:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:55768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727928AbfKVFuz (ORCPT ); Fri, 22 Nov 2019 00:50:55 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6419C20726; Fri, 22 Nov 2019 05:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574401855; bh=CNp5Bv0TclL9MKLcrB14tMvBBV+oreR/zTbo2XPb6NA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czumd0SXfJ9x8p7jSNq7kF9kz28/5VDinW9tcUkh8q2nM3XNw7Hw26OUNVUq+gfJ8 YnytlRFUURkieZdOJzTnbX0NzqFekr2CXV9pyv2Fuq9lY+roYN2X35UOD8xLqMjvpd 0CakeFoGIL/Vfi5j5RS41i0WwFn5ujaGp6IqxCtA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vasundhara Volam , Michael Chan , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 092/219] bnxt_en: query force speeds before disabling autoneg mode. Date: Fri, 22 Nov 2019 00:47:04 -0500 Message-Id: <20191122054911.1750-85-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122054911.1750-1-sashal@kernel.org> References: <20191122054911.1750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasundhara Volam [ Upstream commit 56d374624778652d2a999e18c87a25338b127b41 ] With autoneg enabled, PHY loopback test fails. To disable autoneg, driver needs to send a valid forced speed to FW. FW is not sending async event for invalid speeds. To fix this, query forced speeds and send the correct speed when disabling autoneg mode. Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index eaa285bf908b9..2240c23b0a4c9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2390,17 +2390,37 @@ static int bnxt_hwrm_mac_loopback(struct bnxt *bp, bool enable) return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); } +static int bnxt_query_force_speeds(struct bnxt *bp, u16 *force_speeds) +{ + struct hwrm_port_phy_qcaps_output *resp = bp->hwrm_cmd_resp_addr; + struct hwrm_port_phy_qcaps_input req = {0}; + int rc; + + bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_PORT_PHY_QCAPS, -1, -1); + mutex_lock(&bp->hwrm_cmd_lock); + rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); + if (!rc) + *force_speeds = le16_to_cpu(resp->supported_speeds_force_mode); + + mutex_unlock(&bp->hwrm_cmd_lock); + return rc; +} + static int bnxt_disable_an_for_lpbk(struct bnxt *bp, struct hwrm_port_phy_cfg_input *req) { struct bnxt_link_info *link_info = &bp->link_info; - u16 fw_advertising = link_info->advertising; + u16 fw_advertising; u16 fw_speed; int rc; if (!link_info->autoneg) return 0; + rc = bnxt_query_force_speeds(bp, &fw_advertising); + if (rc) + return rc; + fw_speed = PORT_PHY_CFG_REQ_FORCE_LINK_SPEED_1GB; if (netif_carrier_ok(bp->dev)) fw_speed = bp->link_info.link_speed; -- 2.20.1