Commit 28673b33 authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

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: 46a3df9f ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 47ef6dec
...@@ -506,7 +506,7 @@ static u8 hns3_get_netdev_flags(struct net_device *netdev) ...@@ -506,7 +506,7 @@ static u8 hns3_get_netdev_flags(struct net_device *netdev)
u8 flags = 0; u8 flags = 0;
if (netdev->flags & IFF_PROMISC) { if (netdev->flags & IFF_PROMISC) {
flags = HNAE3_USER_UPE | HNAE3_USER_MPE; flags = HNAE3_USER_UPE | HNAE3_USER_MPE | HNAE3_BPE;
} else { } else {
flags |= HNAE3_VLAN_FLTR; flags |= HNAE3_VLAN_FLTR;
if (netdev->flags & IFF_ALLMULTI) if (netdev->flags & IFF_ALLMULTI)
...@@ -541,13 +541,13 @@ static void hns3_nic_set_rx_mode(struct net_device *netdev) ...@@ -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 /* User mode Promisc mode enable and vlan filtering is disabled to
* let all packets in. MAC-VLAN Table overflow Promisc enabled and * let all packets in. MAC-VLAN Table overflow Promisc enabled and
* vlan fitering is enabled * vlan fitering is enabled
*/ */
hns3_enable_vlan_filter(netdev, new_flags & HNAE3_VLAN_FLTR); hns3_enable_vlan_filter(netdev, new_flags & HNAE3_VLAN_FLTR);
h->netdev_flags = new_flags; h->netdev_flags = new_flags;
hns3_update_promisc_mode(netdev, new_flags);
} }
int hns3_update_promisc_mode(struct net_device *netdev, u8 promisc_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, ...@@ -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_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct hclge_promisc_param param; struct hclge_promisc_param param;
bool en_bc_pmc = true;
hclge_promisc_param_init(&param, 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(&param, en_uc_pmc, en_mc_pmc, en_bc_pmc,
vport->vport_id); vport->vport_id);
return hclge_cmd_set_promisc_mode(hdev, &param); return hclge_cmd_set_promisc_mode(hdev, &param);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment