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 57216A0C4C; Fri, 15 Oct 2021 04:00:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E000440041; Fri, 15 Oct 2021 04:00:32 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 57BC44003C for ; Fri, 15 Oct 2021 04:00:30 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HVq9p41hfzYk6k; Fri, 15 Oct 2021 09:55:58 +0800 (CST) Received: from dggema767-chm.china.huawei.com (10.1.198.209) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.8; Fri, 15 Oct 2021 10:00:25 +0800 Received: from [10.67.103.231] (10.67.103.231) by dggema767-chm.china.huawei.com (10.1.198.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Fri, 15 Oct 2021 10:00:25 +0800 Message-ID: <12327092-f335-7c86-ed49-a6716cbf63da@huawei.com> Date: Fri, 15 Oct 2021 10:00:25 +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 To: Thomas Monjalon CC: , , , "Min Hu (Connor)" References: <20210922033630.41130-1-humin29@huawei.com> <2044667.cjkjM3ByYo@thomas> <2863918.lGjFY7q0R8@thomas> From: "lihuisong (C)" In-Reply-To: <2863918.lGjFY7q0R8@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 dggema767-chm.china.huawei.com (10.1.198.209) X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix one MAC address occupies two index in mac addrs 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" 在 2021/10/12 15:14, Thomas Monjalon 写道: > 12/10/2021 04:58, lihuisong (C): >> 在 2021/10/11 18:35, Thomas Monjalon 写道: >>> 11/10/2021 11:28, Min Hu (Connor): >>>> From: Huisong Li >>>> >>>> The dev->data->mac_addrs[0] will be changed to a new MAC address when >>>> applications modify the default MAC address by >>>> rte_eth_dev_default_mac_addr_set() API. However, If the new default >>>> MAC address has been added as a non-default MAC address by >>>> rte_eth_dev_mac_addr_add() API, the rte_eth_dev_default_mac_addr_set() >>>> API doesn't remove it from dev->data->mac_addrs[]. As a result, one MAC >>>> address occupies two index capacities in dev->data->mac_addrs[]. >>>> >>>> This patch adds the logic of removing MAC addresses for this scenario. >>>> >>>> Fixes: 854d8ad4ef68 ("ethdev: add default mac address modifier") >>>> Cc: stable@dpdk.org >>>> >>>> Signed-off-by: Huisong Li >>>> Signed-off-by: Min Hu (Connor) >>>> --- >>>> + /* >>>> + * If the address has been added as a non-default MAC address by >>>> + * rte_eth_dev_mac_addr_add API, it should be removed from >>>> + * dev->data->mac_addrs[]. >>>> + */ >>> This is the definition of mac_addrs: >>> >>> struct rte_ether_addr *mac_addrs; >>> /**< Device Ethernet link address. >>> * @see rte_eth_dev_release_port() >>> */ >>> >>> I feel we need to explain there can be multiple addresses, >>> the first one being the default. >> Do you mean that the problem mentioned in this patch is not a problem? > It is not a problem if it is expected, > but nothing is defined. > >> Should we accept this scenario? > We need to decide what is the correct behaviour. > I see pros and cons on both sides. Where's the bright side of this behavior? >>> Another comment, >>> If we remove the duplicate, we may have to copy to previous default one >>> to avoid completely deleting the previous default address. >> That's not necessary. >> >> Because the previous default address has been removed from hardware. >> >> After the default MAC address is modified, the previous default one is >> invalid. > No you don't get it. > With the current behaviour, the app could keep all the MAC addresses, > and copy one as the default while keeping it in the rest of the list. > You are suggesting a different behaviour where there is no duplicate. This behavior seems to be contrary to the rte_eth_dev_mac_addr_add() API. If the pmd does not support the dev_ops->mac_addr_set, the rte_eth_dev_mac_addr_add() is used to set default MAC in ethdev layer. Namely, the rte_eth_dev_mac_addr_add() can be used to set default MAC in the special scenario and add MAC address. But the API does not allow the rest of the list to be the same as the default MAC which occupies idx 0. If the app uses the MAC address in dev->data->mac_addrs[] to set the default MAC, the PMD actually has only one entry.  As far as I know, the dev->data->mac_addrs[] in ethdev layer should be consistent with the hardware entry of the PMD. So I think the behavior referred to in this patch is inappropriate. > >>> Not sure what should be the behaviour. > > > .