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 08297A034F; Tue, 12 Oct 2021 04:58:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF8C8410E4; Tue, 12 Oct 2021 04:58:09 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id C0D9A410E1 for ; Tue, 12 Oct 2021 04:58:07 +0200 (CEST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4HT0g20lvRz1DHK6; Tue, 12 Oct 2021 10:56:30 +0800 (CST) Received: from dggema767-chm.china.huawei.com (10.1.198.209) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.8; Tue, 12 Oct 2021 10:58:05 +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; Tue, 12 Oct 2021 10:58:04 +0800 Message-ID: Date: Tue, 12 Oct 2021 10:58:04 +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 , "Min Hu (Connor)" CC: , , References: <20210922033630.41130-1-humin29@huawei.com> <20211011092811.55172-1-humin29@huawei.com> <2044667.cjkjM3ByYo@thomas> From: "lihuisong (C)" In-Reply-To: <2044667.cjkjM3ByYo@thomas> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) 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/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? Should we accept this scenario? > > 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. > Not sure what should be the behaviour. > > > .