]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.18.11/bnxt_en-fix-vf-mac-address-regression.patch
Drop watchdog patch
[thirdparty/kernel/stable-queue.git] / releases / 4.18.11 / bnxt_en-fix-vf-mac-address-regression.patch
CommitLineData
a81a45e9
GKH
1From foo@baz Wed Sep 26 11:27:32 CEST 2018
2From: Michael Chan <michael.chan@broadcom.com>
3Date: Fri, 14 Sep 2018 15:41:29 -0400
4Subject: bnxt_en: Fix VF mac address regression.
5
6From: Michael Chan <michael.chan@broadcom.com>
7
8[ Upstream commit 28ea334bd1657f3c43485b4a8592672fc6835fac ]
9
10The recent commit to always forward the VF MAC address to the PF for
11approval may not work if the PF driver or the firmware is older. This
12will cause the VF driver to fail during probe:
13
14 bnxt_en 0000:00:03.0 (unnamed net_device) (uninitialized): hwrm req_type 0xf seq id 0x5 error 0xffff
15 bnxt_en 0000:00:03.0 (unnamed net_device) (uninitialized): VF MAC address 00:00:17:02:05:d0 not approved by the PF
16 bnxt_en 0000:00:03.0: Unable to initialize mac address.
17 bnxt_en: probe of 0000:00:03.0 failed with error -99
18
19We fix it by treating the error as fatal only if the VF MAC address is
20locally generated by the VF.
21
22Fixes: 707e7e966026 ("bnxt_en: Always forward VF MAC address to the PF.")
23Reported-by: Seth Forshee <seth.forshee@canonical.com>
24Reported-by: Siwei Liu <loseweigh@gmail.com>
25Signed-off-by: Michael Chan <michael.chan@broadcom.com>
26Signed-off-by: David S. Miller <davem@davemloft.net>
27Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28---
29 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++++++--
30 drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 9 +++++----
31 drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h | 2 +-
32 3 files changed, 13 insertions(+), 7 deletions(-)
33
34--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
35+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
36@@ -7888,7 +7888,7 @@ static int bnxt_change_mac_addr(struct n
37 if (ether_addr_equal(addr->sa_data, dev->dev_addr))
38 return 0;
39
40- rc = bnxt_approve_mac(bp, addr->sa_data);
41+ rc = bnxt_approve_mac(bp, addr->sa_data, true);
42 if (rc)
43 return rc;
44
45@@ -8683,14 +8683,19 @@ static int bnxt_init_mac_addr(struct bnx
46 } else {
47 #ifdef CONFIG_BNXT_SRIOV
48 struct bnxt_vf_info *vf = &bp->vf;
49+ bool strict_approval = true;
50
51 if (is_valid_ether_addr(vf->mac_addr)) {
52 /* overwrite netdev dev_addr with admin VF MAC */
53 memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
54+ /* Older PF driver or firmware may not approve this
55+ * correctly.
56+ */
57+ strict_approval = false;
58 } else {
59 eth_hw_addr_random(bp->dev);
60 }
61- rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
62+ rc = bnxt_approve_mac(bp, bp->dev->dev_addr, strict_approval);
63 #endif
64 }
65 return rc;
66--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
67+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
68@@ -1095,7 +1095,7 @@ update_vf_mac_exit:
69 mutex_unlock(&bp->hwrm_cmd_lock);
70 }
71
72-int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
73+int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
74 {
75 struct hwrm_func_vf_cfg_input req = {0};
76 int rc = 0;
77@@ -1113,12 +1113,13 @@ int bnxt_approve_mac(struct bnxt *bp, u8
78 memcpy(req.dflt_mac_addr, mac, ETH_ALEN);
79 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
80 mac_done:
81- if (rc) {
82+ if (rc && strict) {
83 rc = -EADDRNOTAVAIL;
84 netdev_warn(bp->dev, "VF MAC address %pM not approved by the PF\n",
85 mac);
86+ return rc;
87 }
88- return rc;
89+ return 0;
90 }
91 #else
92
93@@ -1135,7 +1136,7 @@ void bnxt_update_vf_mac(struct bnxt *bp)
94 {
95 }
96
97-int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
98+int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
99 {
100 return 0;
101 }
102--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
103+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
104@@ -39,5 +39,5 @@ int bnxt_sriov_configure(struct pci_dev
105 void bnxt_sriov_disable(struct bnxt *);
106 void bnxt_hwrm_exec_fwd_req(struct bnxt *);
107 void bnxt_update_vf_mac(struct bnxt *);
108-int bnxt_approve_mac(struct bnxt *, u8 *);
109+int bnxt_approve_mac(struct bnxt *, u8 *, bool);
110 #endif