Skip to content

Commit c71c4e4

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix VF anti-spoof filter setup.
Fix the logic that sets the enable/disable flag for the source MAC filter according to firmware spec 1.7.1. In the original firmware spec. before 1.7.1, the VF spoof check flags were not latched after making the HWRM_FUNC_CFG call, so there was a need to keep the func_flags so that subsequent calls would perserve the VF spoof check setting. A change was made in the 1.7.1 spec so that the flags became latched. So we now set or clear the anti- spoof setting directly without retrieving the old settings in the stored vf->func_flags which are no longer valid. We also remove the unneeded vf->func_flags. Fixes: 8eb992e ("bnxt_en: Update firmware interface spec to 1.7.6.2.") Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c3e302e commit c71c4e4

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,6 @@ struct bnxt_vf_info {
10661066
#define BNXT_VF_LINK_FORCED 0x4
10671067
#define BNXT_VF_LINK_UP 0x8
10681068
#define BNXT_VF_TRUST 0x10
1069-
u32 func_flags; /* func cfg flags */
10701069
u32 min_tx_rate;
10711070
u32 max_tx_rate;
10721071
void *hwrm_cmd_req_addr;

drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,10 @@ int bnxt_set_vf_spoofchk(struct net_device *dev, int vf_id, bool setting)
8585
if (old_setting == setting)
8686
return 0;
8787

88-
func_flags = vf->func_flags;
8988
if (setting)
90-
func_flags |= FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE;
89+
func_flags = FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE;
9190
else
92-
func_flags |= FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE;
91+
func_flags = FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE;
9392
/*TODO: if the driver supports VLAN filter on guest VLAN,
9493
* the spoof check should also include vlan anti-spoofing
9594
*/
@@ -98,7 +97,6 @@ int bnxt_set_vf_spoofchk(struct net_device *dev, int vf_id, bool setting)
9897
req.flags = cpu_to_le32(func_flags);
9998
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
10099
if (!rc) {
101-
vf->func_flags = func_flags;
102100
if (setting)
103101
vf->flags |= BNXT_VF_SPOOFCHK;
104102
else
@@ -228,7 +226,6 @@ int bnxt_set_vf_mac(struct net_device *dev, int vf_id, u8 *mac)
228226
memcpy(vf->mac_addr, mac, ETH_ALEN);
229227
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
230228
req.fid = cpu_to_le16(vf->fw_fid);
231-
req.flags = cpu_to_le32(vf->func_flags);
232229
req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_MAC_ADDR);
233230
memcpy(req.dflt_mac_addr, mac, ETH_ALEN);
234231
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
@@ -266,7 +263,6 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos,
266263

267264
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
268265
req.fid = cpu_to_le16(vf->fw_fid);
269-
req.flags = cpu_to_le32(vf->func_flags);
270266
req.dflt_vlan = cpu_to_le16(vlan_tag);
271267
req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_VLAN);
272268
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
@@ -305,7 +301,6 @@ int bnxt_set_vf_bw(struct net_device *dev, int vf_id, int min_tx_rate,
305301
return 0;
306302
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
307303
req.fid = cpu_to_le16(vf->fw_fid);
308-
req.flags = cpu_to_le32(vf->func_flags);
309304
req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_MAX_BW);
310305
req.max_bw = cpu_to_le32(max_tx_rate);
311306
req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_MIN_BW);
@@ -477,7 +472,6 @@ static void __bnxt_set_vf_params(struct bnxt *bp, int vf_id)
477472
vf = &bp->pf.vf[vf_id];
478473
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
479474
req.fid = cpu_to_le16(vf->fw_fid);
480-
req.flags = cpu_to_le32(vf->func_flags);
481475

482476
if (is_valid_ether_addr(vf->mac_addr)) {
483477
req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_MAC_ADDR);

0 commit comments

Comments
 (0)