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 77E5AA0547; Tue, 19 Oct 2021 19:46:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64AC6410E8; Tue, 19 Oct 2021 19:46:08 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 285254003E for ; Tue, 19 Oct 2021 19:46:07 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10142"; a="227355027" X-IronPort-AV: E=Sophos;i="5.87,164,1631602800"; d="scan'208";a="227355027" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 10:46:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,164,1631602800"; d="scan'208";a="629842606" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga001.fm.intel.com with ESMTP; 19 Oct 2021 10:46:03 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 19 Oct 2021 10:46:03 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 19 Oct 2021 10:46:03 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.100) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 19 Oct 2021 10:46:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AOkH7rUYaT37Erljuf3WiIRulEPXXwBHoy+N23ruMRak0pLDMmNRzqDpId8YCbAvpL6Q+4/iGDEA5UYovnchRYUfgzktOWnRb0rh5JH7quq0gUeCPR1k4Ol2Y3iHRAJo9zS9E5WEwtTEtannRMj7Bl43xtrd2OSdBxiiQsB/LKGULlrbSP2GuX21u16TGMIrTxWohK5mgrF987mbcLEgmqTSQoGqH2/Wq/JMQ01XsMWcJ28JmYFCunZJkcDQSpMeGBejpgenp9g//iLQ3a1pi/jr1rs5sxyZx8fOzIPE/P0NB9RMidU6GmeX5Iof8/T0xB4iflj3jbNgLKcLILCnBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ORJ+NKlK9pYuibcCSsvCfrOcuCJR4ryLNdmayrhuVzE=; b=UR4qqV3y3HP2EcANtb2HFqLoGpJ4YOf6un6yI891qmfE+7lHkydXuDdcpBv/pJabFEgaxLGazU/tU2IPgmsKloC38aG9599iBvWmvlUHAsWj4j+OV3xlNzbgpdo0ytLBF3wjgGRvUyfevgLVYIJSnIG3DMY++JRSNTUuIhotz4renK2E42Uy/RJqD+fSZ9nSBrER2we4v6aagmGNy3gRAKQheTEyLi67oTzfDryVfg/kRIkdCHVs0kVHUo1DLMkBZ9RKVfsOKImMnuObunVrrIHThk1B9Cxh7hLZf+wUvCXhjby9NCJ9NyezV4F6p8dswKeE6tbbaCJkEHEvIJZ12A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ORJ+NKlK9pYuibcCSsvCfrOcuCJR4ryLNdmayrhuVzE=; b=BOH+gvtKCzAC+W3FDWomtL/d+xKogBV78A5kkrA7XPKHH6H1LNo0uL//z+bCjSCH9abIYcXZM8zhwl+Ahq/OTQHkotZyejID1RXIVdryWEsudl9IhnDwtOqUOjAqikSf66t/I5YU52JOzYPjsBgrEzAqh0lLYGz8sG1GUW01a4U= Authentication-Results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB4854.namprd11.prod.outlook.com (2603:10b6:510:35::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Tue, 19 Oct 2021 17:46:02 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c%5]) with mapi id 15.20.4608.018; Tue, 19 Oct 2021 17:46:02 +0000 Message-ID: Date: Tue, 19 Oct 2021 18:45:56 +0100 Content-Language: en-US To: "Min Hu (Connor)" , CC: References: <20210922033630.41130-1-humin29@huawei.com> <20211011092811.55172-1-humin29@huawei.com> From: Ferruh Yigit X-User: ferruhy In-Reply-To: <20211011092811.55172-1-humin29@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P123CA0069.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::33) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by LO2P123CA0069.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Tue, 19 Oct 2021 17:46:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6706a6ba-b612-4b62-8218-08d99328511c X-MS-TrafficTypeDiagnostic: PH0PR11MB4854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NuC+Yk8m8bu7aJtk1ZvdMNml3w4EXpBrhW+6rXPRf5LV2ME6s14SyjVlUtVaXeuZaq1a3TlouoqLGhu/RgocZc9XwlgVrPTjJbSKR5jH3fhNLLJ4YGt62LVV3SIvw9iawDy9hQKlSmSQT9NYliVoqnUpjhQFIh2sNyVEId45b7C3+apGMIIyHwRzBgo3A5vK7cDAh0dbjjlycgKig84xox6Q523wZqKW1n9zP1fmaV7vWha50ob8ChL9b6VL+tJQqMuj8SLUhA9HjvwhzzmSlDNtzRGtj9jCv8rOknnLukNUke9Ip61ZcyGuGq9LXQffiAdeRguJSAwHbxaOepmykUr0331Jgf1ntf8snf5fnB6mJmuUNJW74QLMkWztvsGomtxlJcgJwnhILjG4ChqwAiAi06zrbG/ItEJg6umZVnlLG8wbXBR2hA5yJKANMifCrh1szHojfL6/BFlqLBpl/pZp086k4nLBGnsOeholo9fwcRvLyuzHX8/fn1IRFoDI8y7v5AtOW/3/ZEF/hcj8yoW5FCjarxMmLk5kH/TtbJ/8NBVxaWpiW6ULge/0jDaOtfr9GcLgLtzgVFXh6DGpzdzluc/6Knk3oDbhL07bf7h1oOYh/b7TdKYjZbwGdgTxOCiQ8dFpz7cQDc3oexH6Tccq9ROH9wxGa1WLK1jLjMdDogAAXmg7dFxiMK61wBMLmdm0RWTuc5xqgi46Aujqkg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(2616005)(6486002)(86362001)(82960400001)(956004)(31686004)(66476007)(508600001)(8676002)(66556008)(66946007)(186003)(4326008)(83380400001)(26005)(316002)(16576012)(31696002)(36756003)(53546011)(6666004)(5660300002)(44832011)(38100700002)(8936002)(2906002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cTJTM1NZRDFtNjhnVHl3UkxrQVdHNjNzNFZ2SXhmUlY4WmdDaW0waUU5RFds?= =?utf-8?B?bHE1ZndvV3RFVXkxWFp3T29WVXVUMllpZzA1dGo0dG81STRWQWdIc09lOGlJ?= =?utf-8?B?SWxKWVh5VzVISVhQbzg1dUpvRWphek9lc2JRdjRlRDJCL1p5dGJSOFRWZ1ZQ?= =?utf-8?B?WGl4R0t5NjNsdEZHbWFIYzNQTTVMYVJHLzN2VDFXZlJDSzZZU05kRmdrOS9S?= =?utf-8?B?bmhxMnR6dmZNTm9QTGFCU0M0cjZlSC9HYy9Rc0lyYk5JdFZma3pEakxFcEdY?= =?utf-8?B?MWRqNmJSVGxJYUtmMWRtM3ZtejcrUHo2a3dTeXo4U1NoczNJMktXamNCQVBW?= =?utf-8?B?ZHhlTHlzTEdtbzRDZ3UxYWZ2a3NHaERQSURlSG8vamNna0d5Q2VzV1FDcVhu?= =?utf-8?B?TTh4ZFUvRGJPWVhxWk0xdHd3c2RmampycEVTckgrb2RlQ09temVlY05VQ2N0?= =?utf-8?B?dDAySWk5b3ZtVmhFTzJPZkMyK1Bidzc2eDNzUFNNNDNwcDRUYVBSakp6QTMy?= =?utf-8?B?b0d3V2ZicTRuV0NxVW0yYTFGMlA3M1d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wNkdCUVJ6YldTT0IyU3hSZVRLSS9sUUZ4V1lFVFZkSEN5Q1IwZzkz?= =?utf-8?B?cWJKZFVvbXZBNHo3czUrYys1b2QvTXdZZ015V21EanNpTU9GRk5aYkpXMnQ1?= =?utf-8?B?TWRwNXVqc1RaY3d2bThTYkU5c1VSY2hXRDRBdmN5UFZhNFk3S3ZNQkdydkhK?= =?utf-8?B?Q285bmxPVko1NFNtS29PVWRuc1RuQkNoVlFrbDFFRXBiTCtqaUdNeGtNdU9s?= =?utf-8?B?a003MG0zbFJLWDhyMUFkekNzYjhEdlpzdlZiMUhhek1KL0Z0cW1HUjJUME0r?= =?utf-8?B?M01RTzFZNmRLRy9pYU5HeHNpRkE0S1oreE01K1hzZmsxakI2a3VzWVUwcWxT?= =?utf-8?B?Wm1xTVRRSnkwZWlDcXFYVVNJSElNdkNwdjFLY1RIbDVuRlpYZ0drcktudTBO?= =?utf-8?B?MHF0TnpGeUt2cG1OaVlaRFgwQ2lBUVViczRXNFpnQ01lOVpNcC9wVEZBQVNN?= =?utf-8?B?N0o5UUpndkZzMWZZQndicldVRzQ0alc5VktzTkZJVUxQVk9zRDNMN2ZJaGFG?= =?utf-8?B?NGFtK2N4eE9VSS9zWmhWY0laZHg2eVQvazh5VzB3MjVCd0FGNkVPbkVYZzl4?= =?utf-8?B?NW9zQWpsVmttMmtEd1RQMUZsckJxSE42b052bWYrNERxV0dxdGNrVFhwUTZq?= =?utf-8?B?eUFyNFJnZndBeVAvWjBRYWI4ZitNM0ROZ2ZESk5kbG5Hbm1EZG5rd3VUbm9h?= =?utf-8?Q?cdjbd0WmsILlH0EMdmCNMVc=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6706a6ba-b612-4b62-8218-08d99328511c X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 17:46:02.1091 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MbvbaoV1H6Re6RJys8njoqWYZoLuu3igvxJx63l9vQ5B7OouIlNIGSlr+mr2x8Bj9Xe3XzGqce2Hu84QWnBApA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4854 X-OriginatorOrg: intel.com 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" On 10/11/2021 10:28 AM, Min Hu (Connor) wrote: > 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[]. > Hi Connor, I see the problem, but can you please clarify what is the impact to the end user? If application does as following: rte_eth_dev_mac_addr_add(MAC1); rte_eth_dev_mac_addr_add(MAC2); rte_eth_dev_mac_addr_add(MAC3); rte_eth_dev_default_mac_addr_set(MAC2); The 'dev->data->mac_addrs[]' will have: "MAC2,MAC2,MAC3" which has 'MAC2' duplicated. Will this cause any problem for the application to receive the packets with 'MAC2' address? Or is the only problem one extra space used in 'dev->data->mac_addrs[]' without any other impact to the application? > 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) > --- > v2: > * fixed commit log. > --- > lib/ethdev/rte_ethdev.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index 028907bc4b..7faff17d9a 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -4340,6 +4340,7 @@ int > rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) > { > struct rte_eth_dev *dev; > + int index; > int ret; > > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > @@ -4361,6 +4362,20 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) > if (ret < 0) > return ret; > > + /* > + * 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[]. > + */ > + index = eth_dev_get_mac_addr_index(port_id, addr); > + if (index > 0) { > + /* remove address in NIC data structure */ > + rte_ether_addr_copy(&null_mac_addr, > + &dev->data->mac_addrs[index]); > + /* reset pool bitmap */ > + dev->data->mac_pool_sel[index] = 0; > + } > + Here only 'dev->data->mac_addrs[]' array is updated and it assumes driver removes similar duplication itself, but I am not sure if this is valid for all drivers. If driver is not removing the duplicate in the HW configuration, the driver config and 'dev->data->mac_addrs[]' will diverge, which is not good. What about following logic to be sure HW configuration and 'dev->data->mac_addrs[]' is same: index = eth_dev_get_mac_addr_index(port_id, addr); if (index > 0) rte_eth_dev_mac_addr_remove(port_id, addr); (*dev->dev_ops->mac_addr_set)(dev, addr); > /* Update default address in NIC data structure */ > rte_ether_addr_copy(addr, &dev->data->mac_addrs[0]); > >