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 EC27241B9E; Wed, 1 Feb 2023 13:26:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7FD994282D; Wed, 1 Feb 2023 13:26:20 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 436EC406A2 for ; Wed, 1 Feb 2023 13:26:19 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4P6Ld7516NzJqpG; Wed, 1 Feb 2023 20:21:47 +0800 (CST) Received: from [10.67.103.231] (10.67.103.231) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 1 Feb 2023 20:26:16 +0800 Message-ID: <1f0de0dd-443e-d1d8-b085-28f70c369994@huawei.com> Date: Wed, 1 Feb 2023 20:26:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH V6] ethdev: fix one address occupies two entries in MAC addrs To: Thomas Monjalon CC: , , , , , References: <20221020093102.20679-1-lihuisong@huawei.com> <20230131064154.10571-1-lihuisong@huawei.com> <2165957.1BCLMh4Saa@thomas> From: "lihuisong (C)" In-Reply-To: <2165957.1BCLMh4Saa@thomas> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600004.china.huawei.com (7.193.23.242) 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 在 2023/2/1 18:42, Thomas Monjalon 写道: > 31/01/2023 07:41, Huisong Li: >> The dev->data->mac_addrs[0] will be changed to a new MAC address when >> applications modify the default MAC address by .mac_addr_set(). However, >> if the new default one has been added as a non-default MAC address by >> .mac_addr_add(), the .mac_addr_set() doesn't remove it from the mac_addrs >> list. As a result, one MAC address occupies two entries in the list. Like: >> add(MAC1) >> add(MAC2) >> add(MAC3) >> add(MAC4) >> set_default(MAC3) >> default=MAC3, the rest of list=MAC1, MAC2, MAC3, MAC4 >> Note: MAC3 occupies two entries. >> >> In addition, some PMDs, such as i40e, ice, hns3 and so on, do remove the >> old default MAC when set default MAC. If user continues to do >> set_default(MAC5), and the mac_addrs list is default=MAC5, filters=(MAC1, >> MAC2, MAC3, MAC4). At this moment, user can still see MAC3 from the list, >> but packets with MAC3 aren't actually received by the PMD. >> >> So need to ensure that the new default address is removed from the rest of >> the list. >> >> Fixes: 854d8ad4ef68 ("ethdev: add default mac address modifier") >> Cc: stable@dpdk.org >> >> Signed-off-by: Huisong Li >> Acked-by: Chengwen Feng >> --- >> lib/ethdev/ethdev_driver.h | 6 +++++- >> lib/ethdev/rte_ethdev.c | 35 +++++++++++++++++++++++++++++++++-- >> 2 files changed, 38 insertions(+), 3 deletions(-) > This is a behavior change. > It must be noted in the release notes in the API section. ok. I will add an announcement. >> - /** Device Ethernet link address. @see rte_eth_dev_release_port() */ >> + /** >> + * Device Ethernet link addresses. The first entry (index zero) is the >> + * default address. The rest of list cannot be the same as the default >> + * address. >> + */ > Please split the lines after a dot. > > rest of "the" list > > Maybe better for this field: > All entries are unique. > The first entry (index zero) is the default address. It's more simpler. Thank you for your suggestion. >> struct rte_ether_addr *mac_addrs; > and for the function rte_eth_dev_default_mac_addr_set: > Set the default MAC address. > It replaces the address at index 0 of the address list. > If the address was already in the MAC address list, > it is removed from the rest of the list. Indeed, It's better to document it. > > > > .