Skip to content

Commit

Permalink
net/hns3: fix flushing multicast MAC address
Browse files Browse the repository at this point in the history
[ upstream commit 49d1ab205b033b6131fb895b5e4d9ebc14081e51 ]

According rte_eth_dev_set_mc_addr_list() API definition,
support flush multicast MAC address if mc_addr_set is NULL
or nb_mc_addr is zero.

Fixes: 7d7f9f8 ("net/hns3: support MAC address related operations")

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
  • Loading branch information
Dengdui Huang authored and kevintraynor committed Oct 31, 2023
1 parent 21874e8 commit 7690a37
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/net/hns3/hns3_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,23 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
uint32_t nb_mc_addr)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
struct rte_ether_addr *addr;
int cur_addr_num;
int set_addr_num;
int num;
int ret;
int i;

if (mc_addr_set == NULL || nb_mc_addr == 0) {
rte_spinlock_lock(&hw->lock);
ret = hns3_configure_all_mc_mac_addr(hns, true);
if (ret == 0)
hw->mc_addrs_num = 0;
rte_spinlock_unlock(&hw->lock);
return ret;
}

/* Check if input parameters are valid */
ret = hns3_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr);
if (ret)
Expand Down

0 comments on commit 7690a37

Please sign in to comment.