From: Yonglong Liu liuyonglong@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
----------------------------
When disable promisc mode after enable promisc mode, the non-promiscuous mode does not take effect.
The driver use the last 12 mac table for promisc mode(6 ports, each port have a mc vague mac table and a uc vague mac table). But when disabling promisc mode, the driver did not look for the last 12 vague mac table, cause this problem.
Fixes: 421ccc3859d6 ("net: hns: fix ping failed when use net bridge and send multicast") Signed-off-by: Yonglong Liu liuyonglong@huawei.com Reviewed-by: li yongxin liyongxin1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Cheng Jian cj.chengjian@huawei.com --- drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 10 +++++----- drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c index 4f02dff1a412..61f2f5896d3b 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c @@ -1482,7 +1482,7 @@ static u16 hns_dsaf_find_soft_mac_entry( u32 i;
soft_mac_entry = priv->soft_mac_tbl; - for (i = 0; i < dsaf_dev->tcam_max_num; i++) { + for (i = 0; i < DSAF_TCAM_SUM; i++) { /* invall tab entry */ if ((soft_mac_entry->index != DSAF_INVALID_ENTRY_IDX) && (soft_mac_entry->tcam_key.high.val == mac_key->high.val) && @@ -1772,7 +1772,7 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev, if (entry_index == DSAF_INVALID_ENTRY_IDX) { /*if hasnot empty, error*/ dev_err(dsaf_dev->dev, - "set_uc_entry failed, %s Mac key(%#x:%#x)\n", + "set_mc_entry failed, %s Mac key(%#x:%#x)\n", dsaf_dev->ae_dev.name, mac_key.high.val, mac_key.low.val); return -EINVAL; @@ -1801,7 +1801,7 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev, mac_data.tbl_mcast_item_vld = 1;
dev_dbg(dsaf_dev->dev, - "set_uc_entry, %s Mac key(%#x:%#x) entry_index%d\n", + "set_mc_entry, %s Mac key(%#x:%#x) entry_index%d\n", dsaf_dev->ae_dev.name, mac_key.high.val, mac_key.low.val, entry_index);
@@ -1996,7 +1996,7 @@ int hns_dsaf_clr_mac_mc_port(struct dsaf_device *dsaf_dev, u8 mac_id, if (HNS_DSAF_IS_DEBUG(dsaf_dev)) return 0;
- for (i = 0; i < DSAF_TCAM_SUM - DSAFV2_MAC_FUZZY_TCAM_NUM; i++) { + for (i = 0; i < dsaf_dev->tcam_max_num; i++) { u8 addr[ETH_ALEN]; u8 port;
@@ -2775,7 +2775,7 @@ static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) memset(&temp_key, 0x0, sizeof(temp_key)); mask_entry.addr[0] = 0x01; hns_dsaf_set_mac_key(dsaf_dev, &mask_key, mask_entry.in_vlan_id, - 0xf, mask_entry.addr); + port, mask_entry.addr); tbl_tcam_mcast.tbl_mcast_item_vld = 1; tbl_tcam_mcast.tbl_mcast_old_en = 0;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h index 47ccb6e0fcaa..b5a7d2609351 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h @@ -38,7 +38,7 @@ #define DSAF_TOTAL_QUEUE_NUM 129
/* reserved a tcam entry for each port to support promisc by fuzzy match */ -#define DSAFV2_MAC_FUZZY_TCAM_NUM DSAF_MAX_PORT_NUM +#define DSAFV2_MAC_FUZZY_TCAM_NUM (DSAF_MAX_PORT_NUM * 2)
#define DSAF_TCAM_SUM 512 #define DSAF_LINE_SUM (2048 * 14)