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 52303A034F; Mon, 11 Oct 2021 12:35:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B17BD40142; Mon, 11 Oct 2021 12:35:41 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id 3E64C4003C for ; Mon, 11 Oct 2021 12:35:40 +0200 (CEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D33B25C011A; Mon, 11 Oct 2021 06:35:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 11 Oct 2021 06:35:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= wq9y+Jwgkf3wQ61+1Ko1NrjXG+9sGynnIqaJFy15gq0=; b=J0PspAMClJXcZN0n +P2/4z4yf08FLvHB9+eVfshpZqP22qOQvc2CVP2A7OGCjTgc/oscZEivydRqP6pS w0tvKajnQlJkSZV7Tnei0kqZi12A89R+dg3jXzQdtjO9S7/AVj++fM40eyP9zbEr 1/fbRFdhowTqggtbIzUHHSajUnrPrEHuhDEj3U7hMnjzZkYmSy0u+75FkA5cnPnA PX7uoV178OBiWRecKMROu3a9uaHN8wjoKWdAMHof8YbHGiLy3DP+8oAGtLJiL0Xf 3no+JlqpIwQhT7UyIvY0Y1/x4fuq8UPFyK8B/kFwHfjN44K2H60RzomZjU77dYWI 8GOpcw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=wq9y+Jwgkf3wQ61+1Ko1NrjXG+9sGynnIqaJFy15g q0=; b=QyYRPEI2/kUSw3ZtlnuM/zwIyTJ8Koi+JAKsKKr/BIrjFzPrnHi0zqqW1 ay2SJVdmyujO59DuSH0YPuqTH3J9JTSdzws+3ROoT38fNYaqUFag70zxJxEUmPa0 F1E+V6nl6p0DyLWL0UEIPfDrec7DJ5TYBgsU676QumA8wTqBIMxY5hhi4iuBPAwy 43+lrJlKJ4tREUX3PdyUirZqWiJj4NYua8ZzzfO58Tix2BMHqxLgj59CXmxPB7jD whXO2CjkpT0V9NHxOf/coD8YZIMxYAgCu6+QugGc5zHrfWka1T+KAJdVA6D8BZeR kboVNBnu30b4B2RCjszipWlyQJvAQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtiedgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 11 Oct 2021 06:35:38 -0400 (EDT) From: Thomas Monjalon To: "Min Hu (Connor)" Cc: dev@dpdk.org, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru Date: Mon, 11 Oct 2021 12:35:36 +0200 Message-ID: <2044667.cjkjM3ByYo@thomas> In-Reply-To: <20211011092811.55172-1-humin29@huawei.com> References: <20210922033630.41130-1-humin29@huawei.com> <20211011092811.55172-1-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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" 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. Another comment, If we remove the duplicate, we may have to copy to previous default one to avoid completely deleting the previous default address. Not sure what should be the behaviour.