Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1773064imm; Thu, 27 Sep 2018 02:12:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV62S6kgIJEWwPw2AQHytYqgC2x96Ij1mTiqFGC837+rNHRuruV3aFfBa+DVJtri5m624iXXE X-Received: by 2002:a17:902:bd04:: with SMTP id p4-v6mr10062425pls.265.1538039565195; Thu, 27 Sep 2018 02:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039565; cv=none; d=google.com; s=arc-20160816; b=WmMbrZb9MpvJIfwKDwhxC5+R0MAb0jtUI9eVdXDC+sSHQs+4HEUT+qL9XrWc8+2zYX 7t5rRvX19Ra1z5jDp1nmVzpFRbsK5u4WkygWbOE/Fzz37NU9lcYjk1sescxE26Qs6dVv 9besTMuysqJ2k1oSqa5Y/rS8PECmCC8DAqdeolU5R8Jj9cNFkcPUDc7LpzKERSBPu4eM Vpi/wGf8Rkdt7jAzRHK3HatzNvU3fx/pUHOOoDZCuggof/jhVoxf3Sy51hwSUNs+Paee pLbEopQrnMhmUlV4qwNzHESQDbsAlXowqCv540vZw9Qnk1jH3nEV5AJgahrfW0Tt4/rI xshA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=2CaPFoSZfnrWmak6nmXx42AoP6l7HY+2IhQsJv+jXnA=; b=zr55GAVGnHSyTHKpUG5va2jjpeZ/t2xxvqGsR5nnuSk1Z74TmLGZIJG7rGyuWiJnEm xSxmRx9nS6zGxN069BQA4TTU93RyzetrNOLxdYy/RzvcAJtN/JmvGDYJe0iZqgWRPl9W Urja1rZTtkZ4wX2u/0/L1COsXMI7wtWgq5Wt9DwyXDr6Tu9JK4ANrLmLCvcqWx0tzj9i HwGWoyrYMI0F5LaM+s6u0dEmHoRksyvgQwt0IBcz/MjdBOcO+6yiywAnTN2zeCODBxyf mRJ0QrmBNUT1HIwA6oL5nV2khH0IvRae+LSrfX9kZiPfd7XFq6ssWPDJ+JB+3fiMsKWR 8i7w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si1543569pls.431.2018.09.27.02.12.30; Thu, 27 Sep 2018 02:12:45 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728401AbeI0P1h (ORCPT + 99 others); Thu, 27 Sep 2018 11:27:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55138 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727084AbeI0P1h (ORCPT ); Thu, 27 Sep 2018 11:27:37 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1909C1117; Thu, 27 Sep 2018 09:10:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Seth Forshee , Siwei Liu , Michael Chan , "David S. Miller" Subject: [PATCH 4.18 18/88] bnxt_en: Fix VF mac address regression. Date: Thu, 27 Sep 2018 11:02:59 +0200 Message-Id: <20180927090302.671630720@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Chan [ Upstream commit 28ea334bd1657f3c43485b4a8592672fc6835fac ] The recent commit to always forward the VF MAC address to the PF for approval may not work if the PF driver or the firmware is older. This will cause the VF driver to fail during probe: bnxt_en 0000:00:03.0 (unnamed net_device) (uninitialized): hwrm req_type 0xf seq id 0x5 error 0xffff bnxt_en 0000:00:03.0 (unnamed net_device) (uninitialized): VF MAC address 00:00:17:02:05:d0 not approved by the PF bnxt_en 0000:00:03.0: Unable to initialize mac address. bnxt_en: probe of 0000:00:03.0 failed with error -99 We fix it by treating the error as fatal only if the VF MAC address is locally generated by the VF. Fixes: 707e7e966026 ("bnxt_en: Always forward VF MAC address to the PF.") Reported-by: Seth Forshee Reported-by: Siwei Liu Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 9 +++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7888,7 +7888,7 @@ static int bnxt_change_mac_addr(struct n if (ether_addr_equal(addr->sa_data, dev->dev_addr)) return 0; - rc = bnxt_approve_mac(bp, addr->sa_data); + rc = bnxt_approve_mac(bp, addr->sa_data, true); if (rc) return rc; @@ -8683,14 +8683,19 @@ static int bnxt_init_mac_addr(struct bnx } else { #ifdef CONFIG_BNXT_SRIOV struct bnxt_vf_info *vf = &bp->vf; + bool strict_approval = true; if (is_valid_ether_addr(vf->mac_addr)) { /* overwrite netdev dev_addr with admin VF MAC */ memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN); + /* Older PF driver or firmware may not approve this + * correctly. + */ + strict_approval = false; } else { eth_hw_addr_random(bp->dev); } - rc = bnxt_approve_mac(bp, bp->dev->dev_addr); + rc = bnxt_approve_mac(bp, bp->dev->dev_addr, strict_approval); #endif } return rc; --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c @@ -1095,7 +1095,7 @@ update_vf_mac_exit: mutex_unlock(&bp->hwrm_cmd_lock); } -int bnxt_approve_mac(struct bnxt *bp, u8 *mac) +int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict) { struct hwrm_func_vf_cfg_input req = {0}; int rc = 0; @@ -1113,12 +1113,13 @@ int bnxt_approve_mac(struct bnxt *bp, u8 memcpy(req.dflt_mac_addr, mac, ETH_ALEN); rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); mac_done: - if (rc) { + if (rc && strict) { rc = -EADDRNOTAVAIL; netdev_warn(bp->dev, "VF MAC address %pM not approved by the PF\n", mac); + return rc; } - return rc; + return 0; } #else @@ -1135,7 +1136,7 @@ void bnxt_update_vf_mac(struct bnxt *bp) { } -int bnxt_approve_mac(struct bnxt *bp, u8 *mac) +int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict) { return 0; } --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h @@ -39,5 +39,5 @@ int bnxt_sriov_configure(struct pci_dev void bnxt_sriov_disable(struct bnxt *); void bnxt_hwrm_exec_fwd_req(struct bnxt *); void bnxt_update_vf_mac(struct bnxt *); -int bnxt_approve_mac(struct bnxt *, u8 *); +int bnxt_approve_mac(struct bnxt *, u8 *, bool); #endif