net: hns3: fix broadcast promisc issue for revision 0x20
For revision 0x20, vlan filter is always bypassed when enable
broadcast promisc mode. In this case, broadcast packets with
any vlan id can be accpeted. We should disable broadcast promisc
mode until user want enable it.
Fixes: 46a3df9f97
("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
47ef6deccd
commit
28673b33c7
@ -506,7 +506,7 @@ static u8 hns3_get_netdev_flags(struct net_device *netdev)
|
||||
u8 flags = 0;
|
||||
|
||||
if (netdev->flags & IFF_PROMISC) {
|
||||
flags = HNAE3_USER_UPE | HNAE3_USER_MPE;
|
||||
flags = HNAE3_USER_UPE | HNAE3_USER_MPE | HNAE3_BPE;
|
||||
} else {
|
||||
flags |= HNAE3_VLAN_FLTR;
|
||||
if (netdev->flags & IFF_ALLMULTI)
|
||||
@ -541,13 +541,13 @@ static void hns3_nic_set_rx_mode(struct net_device *netdev)
|
||||
}
|
||||
}
|
||||
|
||||
hns3_update_promisc_mode(netdev, new_flags);
|
||||
/* User mode Promisc mode enable and vlan filtering is disabled to
|
||||
* let all packets in. MAC-VLAN Table overflow Promisc enabled and
|
||||
* vlan fitering is enabled
|
||||
*/
|
||||
hns3_enable_vlan_filter(netdev, new_flags & HNAE3_VLAN_FLTR);
|
||||
h->netdev_flags = new_flags;
|
||||
hns3_update_promisc_mode(netdev, new_flags);
|
||||
}
|
||||
|
||||
int hns3_update_promisc_mode(struct net_device *netdev, u8 promisc_flags)
|
||||
|
@ -3843,8 +3843,16 @@ static int hclge_set_promisc_mode(struct hnae3_handle *handle, bool en_uc_pmc,
|
||||
struct hclge_vport *vport = hclge_get_vport(handle);
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
struct hclge_promisc_param param;
|
||||
bool en_bc_pmc = true;
|
||||
|
||||
hclge_promisc_param_init(¶m, en_uc_pmc, en_mc_pmc, true,
|
||||
/* For revision 0x20, if broadcast promisc enabled, vlan filter is
|
||||
* always bypassed. So broadcast promisc should be disabled until
|
||||
* user enable promisc mode
|
||||
*/
|
||||
if (handle->pdev->revision == 0x20)
|
||||
en_bc_pmc = handle->netdev_flags & HNAE3_BPE ? true : false;
|
||||
|
||||
hclge_promisc_param_init(¶m, en_uc_pmc, en_mc_pmc, en_bc_pmc,
|
||||
vport->vport_id);
|
||||
return hclge_cmd_set_promisc_mode(hdev, ¶m);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user