From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5149E42FDE; Sat, 5 Aug 2023 10:40:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54E0F4325D; Sat, 5 Aug 2023 10:40:03 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id D92FE410EE; Sat, 5 Aug 2023 10:39:58 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RHwwV1sDqzrS7G; Sat, 5 Aug 2023 16:38:50 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 5 Aug 2023 16:39:56 +0800 From: Dongdong Liu To: , , , CC: Subject: [PATCH 3/5] net/hns3: flush multicast MAC address if mc_addr_set is NULL Date: Sat, 5 Aug 2023 16:36:25 +0800 Message-ID: <20230805083627.8681-4-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230805083627.8681-1-liudongdong3@huawei.com> References: <20230805083627.8681-1-liudongdong3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Dengdui Huang 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: 7d7f9f80bbfb ("net/hns3: support MAC address related operations") Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index 043c7673b4..c4d47f43fe 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -444,6 +444,7 @@ 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; @@ -451,6 +452,15 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev, 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) -- 2.22.0