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 8E636A0C43; Fri, 22 Oct 2021 11:23:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8FD1E411E0; Fri, 22 Oct 2021 11:22:14 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 0AE4441189 for ; Fri, 22 Oct 2021 11:22:00 +0200 (CEST) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HbJdv5XdrzbnMv; Fri, 22 Oct 2021 17:17:23 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.15; Fri, 22 Oct 2021 17:21:58 +0800 From: "Min Hu (Connor)" To: CC: , Date: Fri, 22 Oct 2021 17:20:05 +0800 Message-ID: <20211022092006.60959-15-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211022092006.60959-1-humin29@huawei.com> References: <20211022092006.60959-1-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 14/14] net/hns3: replace set MC MAC addr list API in VF 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 Sender: "dev" From: Huisong Li This patch removes hns3vf_set_mc_mac_addr_list() and uses hns3_set_mc_mac_addr_list() to do this. Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev.c | 4 +-- drivers/net/hns3/hns3_ethdev.h | 7 ++--- drivers/net/hns3/hns3_ethdev_vf.c | 50 +------------------------------ 3 files changed, 6 insertions(+), 55 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index f627f494b6..96b559fc1f 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -1947,7 +1947,7 @@ hns3_remove_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) return ret; } -int +static int hns3_set_mc_addr_chk_param(struct hns3_hw *hw, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) @@ -2015,7 +2015,7 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw, return 0; } -static int +int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 762f03124f..d3b97bfe28 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -1061,15 +1061,14 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status, uint32_t link_speed, uint8_t link_duplex); void hns3_parse_devargs(struct rte_eth_dev *dev); void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported); -int hns3_set_mc_addr_chk_param(struct hns3_hw *hw, - struct rte_ether_addr *mc_addr_set, - uint32_t nb_mc_addr); int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del); int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del); int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t idx, __rte_unused uint32_t pool); void hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx); - +int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev, + struct rte_ether_addr *mc_addr_set, + uint32_t nb_mc_addr); int hns3_restore_ptp(struct hns3_adapter *hns); int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev, struct rte_eth_conf *conf); diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 484ff24145..ab92c4f88f 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -299,54 +299,6 @@ hns3vf_remove_mc_mac_addr(struct hns3_hw *hw, return ret; } -static int -hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev, - struct rte_ether_addr *mc_addr_set, - uint32_t nb_mc_addr) -{ - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_ether_addr *addr; - int cur_addr_num; - int set_addr_num; - int num; - int ret; - int i; - - ret = hns3_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr); - if (ret) - return ret; - - rte_spinlock_lock(&hw->lock); - cur_addr_num = hw->mc_addrs_num; - for (i = 0; i < cur_addr_num; i++) { - num = cur_addr_num - i - 1; - addr = &hw->mc_addrs[num]; - ret = hw->ops.del_mc_mac_addr(hw, addr); - if (ret) { - rte_spinlock_unlock(&hw->lock); - return ret; - } - - hw->mc_addrs_num--; - } - - set_addr_num = (int)nb_mc_addr; - for (i = 0; i < set_addr_num; i++) { - addr = &mc_addr_set[i]; - ret = hw->ops.add_mc_mac_addr(hw, addr); - if (ret) { - rte_spinlock_unlock(&hw->lock); - return ret; - } - - rte_ether_addr_copy(addr, &hw->mc_addrs[hw->mc_addrs_num]); - hw->mc_addrs_num++; - } - rte_spinlock_unlock(&hw->lock); - - return 0; -} - static int hns3vf_set_promisc_mode(struct hns3_hw *hw, bool en_bc_pmc, bool en_uc_pmc, bool en_mc_pmc) @@ -2678,7 +2630,7 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = { .mac_addr_add = hns3_add_mac_addr, .mac_addr_remove = hns3_remove_mac_addr, .mac_addr_set = hns3vf_set_default_mac_addr, - .set_mc_addr_list = hns3vf_set_mc_mac_addr_list, + .set_mc_addr_list = hns3_set_mc_mac_addr_list, .link_update = hns3vf_dev_link_update, .rss_hash_update = hns3_dev_rss_hash_update, .rss_hash_conf_get = hns3_dev_rss_hash_conf_get, -- 2.33.0