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 9CD75A0547; Thu, 21 Oct 2021 10:31:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E503411B7; Thu, 21 Oct 2021 10:31:11 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id E907040142 for ; Thu, 21 Oct 2021 10:31:09 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10143"; a="289820964" X-IronPort-AV: E=Sophos;i="5.87,169,1631602800"; d="scan'208";a="289820964" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2021 01:31:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,169,1631602800"; d="scan'208";a="445254144" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga003.jf.intel.com with ESMTP; 21 Oct 2021 01:31:08 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 21 Oct 2021 01:31:08 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 21 Oct 2021 01:31:08 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Thu, 21 Oct 2021 01:31:08 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.48) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Thu, 21 Oct 2021 01:31:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n9E9lgtNIqf5dqNV+vjon10W5uIz14OVpfMhXaOHrqn3GXYqr0jvCGjlNgKzewEQJy+41IzyzNae/Z71MslmXdFg6z5dypECIVve6Gzo4K7X0s7uvfvJhHTJSwNf5dkI3YC0VzUFBnZWZ3MkJ8kjhAhTtNZGB/znmME2SN4ZJTf0HzQfOVKeab/f8HajvBnBMxkiH4RC4D02zvh2DaQeKKpFo4iF2UALdrgm5eBWwiXmzx45EixxKXukDIe9Y+Fp+MN5CRIig4HZnNMgyYJv3zfqyGSeIDNuffw6np26Do37+PF0wd8+ypj90Gl/jndHXxNRDegEzxmPatEk26bc4w== 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=Vf5xIoPV6cqNuEon603UmWHRmguj3EWbrnTmkBZxJ6Q=; b=WCHrAxNJ6Yi8hzOBw7Ip5VLA43EVN28klmeOdB9Au+PQz4/KpSKlR/Jb/7F6dg7e4IikdzlacesidkZpyXaxo7iD/+a3yiaY6ruSiWGsSGcfL3PKXRNX90PtltkgjiYuWnQ7q4JtH6e4GskwxWJ/iaYPWfa4nGA4lyuV2BbSZ4nw2v+3eC5HA0eRcl8jsx+6N9O7Q4WTBVmT/5c+L6hfX5JFnRiWKRYlc+qYdbgYcIYG9Ef7f2/0M93V2+tLfckjtogEa6k3PV9x5bOh7blA9M0Tyk1R8cJ0TqM1xmDvLe6ZqOlU5iQtcNlxp1e2NAdUmNLSSHz4o82ZOHnHKp947g== 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=Vf5xIoPV6cqNuEon603UmWHRmguj3EWbrnTmkBZxJ6Q=; b=XxM2fkbthi23BTFbqk9Z5kgmBE6egnB6w+uEqe2DNpRvINhV89jmdQ1v0GhFbbjwGZojKlD++FQ5UrWa2Mj42IVK77yylM7fcW9mUrAfo8QvdNubkRfmSMYjMEe8c3go5/SAKjlKyL3kJ9lluAAQBqvxDPFJyzmouFINpdEIdjY= 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 PH0PR11MB5045.namprd11.prod.outlook.com (2603:10b6:510:3f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Thu, 21 Oct 2021 08:31:06 +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; Thu, 21 Oct 2021 08:31:06 +0000 Message-ID: <82e8ba2a-d9bb-5f73-d878-c9cf0801acef@intel.com> Date: Thu, 21 Oct 2021 09:30:59 +0100 Content-Language: en-US To: "lihuisong (C)" , Kevin Traynor , "Min Hu (Connor)" , CC: References: <20210922033630.41130-1-humin29@huawei.com> <20211011092811.55172-1-humin29@huawei.com> <8decd3d4-4370-2f89-44d5-3e0dd848a628@intel.com> <31cd92b1-d388-bd50-963a-8a85a924c0a2@redhat.com> From: Ferruh Yigit X-User: ferruhy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DU2PR04CA0019.eurprd04.prod.outlook.com (2603:10a6:10:3b::24) 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 DU2PR04CA0019.eurprd04.prod.outlook.com (2603:10a6:10:3b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Thu, 21 Oct 2021 08:31:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4600e02d-0cd5-484f-c776-08d9946d1ff8 X-MS-TrafficTypeDiagnostic: PH0PR11MB5045: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yFSSThnw/FGMjeB0hL9IaojGSJmFz7HK7x3IMhFdsKKdgGuqc1Var8jPIfwu8FcwEBC0puy/V3XKvgd8Y+IG8yFlqimgLqgd0/gqJNUsDTwGzwCJzLFdmqb3PEKHxw8XDWoCsdaULxeLWIAQsc5Z/4/PdGcS0aQpUDXVZ+2dLXJ5H4RgYADXRI4odtCZTzNPnBF4oLpqGTYd7I32y98iQ3xg1sYf+RbcupDgV4R6AsvYM76o5dscLo7H5bvO85iBtro2fdC2qiDKO/gRDfMgC7wSLSftxY3bNgMusasvul129EllIgIug74oVs49rL/zdGvVJ2XptEwWc77obUM4Id5NkCjyJkb3zXSlCMg5C3Cwa1Jj1KBdl6jjHW4jawfvlMZ8jYrlRbsEuraKQ06/mNUwg8JmEpKOPGfQNRbmY1mRaNY8avUW7xYmI7wHT8sA+wdQnUrvKvEuy+x5QjMuvwFVG4lyGcQLu4ahqFx5awVl5cVRsdVqDGcO0KocOItKs4YTJgB47jdAAQZn59tfniqOeLWuwwyvBdfXjiMabllLhLqthPhBZT9HV6pRSo+JiB5I3wl1CHhMVE5oIEfU7z4B5wdqL5GEvELRTaPmoEXUTBmhDN4HWVaPSPX9r0Abv2kALhB5kFZPQEpRx22gxRyDXxiuJD5uyZ67zvySnZzx6UmbdZOm+kzR2JWV7QgnR9Xs3y3SeViCD35wM8jKJw== 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)(508600001)(8676002)(38100700002)(26005)(6666004)(186003)(53546011)(110136005)(316002)(31696002)(16576012)(86362001)(66946007)(66476007)(66556008)(83380400001)(31686004)(4326008)(44832011)(2616005)(8936002)(82960400001)(36756003)(2906002)(956004)(5660300002)(6486002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SWRwa0pwTUhMeWFuUUZjUlhyNGl1N1ZCZWxuMGwxcmxwN0luUGtiRnpNM1dE?= =?utf-8?B?YXFnU1A2NnFtUlpiMnlwalRsNGNZQW5CM1Z1dTNuSjJiSTRUcHJWb0JNY0Q3?= =?utf-8?B?bUQxT0M5QWNxV1A4L3M2WVEyVnVBaTIyc05ONmlPeUZIVDhYRGgvUGhpTWxW?= =?utf-8?B?VU0wRkJXU2tvT2NnU2NpSjloV0tYbkdaNVEyWFpBU3FxYzBZM21tbStDQTZZ?= =?utf-8?B?c09HSG5YcndJQXRmS2czeGVzWHAxOWM5c0c5Z3ViUkJhUTUrMXBtN3FBK3Nx?= =?utf-8?B?dWpMejRPbENxY2ZEZ0VTeEI2SGdhNlQ5cnRkc1Y4amtJN2QvS2xyVmlEV1oz?= =?utf-8?B?ZTFWSTc5OVNMYUtkWlFVTE1PNldycHYwVnM0eHJBa0JEQ0lvM3JEeVBBcU1j?= =?utf-8?B?WkM0NzJOdzhVZ0ZFTjIxUXRNQjlaeXgyekE5c3JoRFpxbk4zVHF4K3BkNUJB?= =?utf-8?B?NGZNcUVBNSt2bFRLeGd4VFk1cnkrM3RNOUFLTHRteElBaVJXb3pyYXc4NXVF?= =?utf-8?B?OTFTeERKVlZSSHNsRlIyd2RqTGR2ay9wV0R3ZUszUFpoUzNoUzY3WjhMTXU3?= =?utf-8?B?SjJ6a1dEUGZ0UDI2d3NXQWZtdlRsMkFWc0doQmYvVzJUc3JISG5qcllVUVFS?= =?utf-8?B?Zjg2c1N2SVRKSHBNQzdvNnFuMEx1d2hoVFk4a2czTHQrK0M2dllhL3FScS9t?= =?utf-8?B?TVBoVm5zZUZqSUF1T2JtWXpzT1UvcW5XVDJVQ3RxaUFmcHNkdUlBMWU0TjMx?= =?utf-8?B?RDhMZ0pkRTRReGNWMlRVRkZyU3lodHpSMVA5TFhUZWRCcmpSSERVYmd6OHdh?= =?utf-8?B?ZytiazE3M2UwWHorMC9rQlVGWE5ad012ak1JZ0tyR0NJejY0VXBIQVdPZjRQ?= =?utf-8?B?ZnZ4ZW9CZDNZNE5SUGxxRUZEanhzRWQ3OHJ4MHhVdDJWUkFEUTNUamZzNFNl?= =?utf-8?B?NWdkd2ZORG8vUlBiZ1VGZDcvQ0lZK21CYXhuSjQvdk1YaFVWaGRzYWhQRjM5?= =?utf-8?B?Vit2ZTBOclpIZzl0TExYeW84WTArRHZjcHA0MnFyYzZCWm0zV3RqSmNCTEto?= =?utf-8?B?cGM5R2JkbGVlcVZmWDkzWXZYM0xiZkVjNkU4Y0gxVVI5eVliSGFuUzdaQ2t4?= =?utf-8?B?bkN4WjJNWFpEMUZYbXkzMVZkLzFjckN0bGJJQ1FzRTBQSllrZW1LOGkyN1Zl?= =?utf-8?B?TTlPc1JyYzBETkRncVVXQWRkV1I3bDl6WVlXRSt2U3lxanJHODR0ZDBveGJt?= =?utf-8?B?VEExb2pEYXZQUDgxWDVFV2xNK1B4UGtsZjhGbXVFU1hkKzcvWjgzOG9NRDQz?= =?utf-8?B?TGw4OE4rbjVxem0wK2NKblVhYjhDOGwydWZXb2NaRmRiUWs1TTBKeC9lK2NY?= =?utf-8?B?bG1kS2k3THZWS1hkSWNDTWh0K0FXNEtsTUwveDkrVGU5d1RSQmpJdlY1Sm5S?= =?utf-8?B?aXZsV1FnQWpLYk9xN21wWkptQ0hyZjZGbWZJYzVObHE1Q3lhaE9rUWpXTTJQ?= =?utf-8?B?a1JrQWt5dExaOGZWV1gvcEtXU0RVY3o4NGxoc0Z2QVo4ZHUwNnZyejNSNzlV?= =?utf-8?B?em1nakpNNExxVEdXbVJKZnBXSk1IZjlEZkxiTE8wT3NJT053bXZLaVNnMTR6?= =?utf-8?B?NWpNbXhMRVMzV29oYkIzcGgyc3h6eEMwenhHdi9JLzZCclZGTGNQWVE0S3hQ?= =?utf-8?B?YUlXbUFxRGlJMEoydGF4Z2c2VklDc052dzVxdWtyNWh4eEhWUGttSllVbTJh?= =?utf-8?B?ckNPTGh1bis2K2VvSWU2dGN5RDk3WGl3Qmwwbmg0b0t4RTYvTG5WT1ZvS3Jx?= =?utf-8?B?U1BGT2VvTTZ3SUhHRlZORkl6UEpTcDM2bWxQRHpGaURkYnJBVG96ZzVXY1BM?= =?utf-8?B?Ym9PMThQZmVmT2t5WlZpR2lBVGdBWldyUmM4RGxFVGJWSlhtai9jeDBWV1dL?= =?utf-8?Q?O7XQFPrP0wlnBCpRKXK/S6c2tD5kf10y?= X-MS-Exchange-CrossTenant-Network-Message-Id: 4600e02d-0cd5-484f-c776-08d9946d1ff8 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 08:31:06.0988 (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: ferruh.yigit@intel.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5045 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/21/2021 3:05 AM, lihuisong (C) wrote: > > 在 2021/10/21 0:32, Ferruh Yigit 写道: >> On 10/20/2021 11:15 AM, Kevin Traynor wrote: >>> On 20/10/2021 08:41, Ferruh Yigit wrote: >>>> On 10/20/2021 7:49 AM, lihuisong (C) wrote: >>>>> Hi Ferruh >>>>> >>>>> 在 2021/10/20 1:45, Ferruh Yigit 写道: >>>>>> 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? >>>>> I think it's just a waste of space. >>>> >>>> True, it is a waste. But if there is no other visible user impact, we can >>>> handle the issue with lower priority and clarifying the impact in commit log >>>> helps to others. >>>> >>>>>> >>>>>>> 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. >>>>> The same MAC address does not occupy two HW entries, which is also a >>>>> waste for HW. After all, HW entry resources are also limited. >>>>> The PMD should also take this into account. >>>>> So, I think, we don't have to think about it here. >>>> >>>> I am not sure all PMD take this into account, I briefly checked the ixgbe >>>> code and I am not sure if it handles this. >>>> >>>> Also it is possible to think that this responsibility is pushed to the >>>> application, like application should remove a MAC address before setting >>>> it as default MAC... >>>> >>> >>> Yes, the API view is more important than saving one entry in an array. From API perspective with this patch, >>> >>> set_default(MAC1) >>> add(MAC2) >>> add(MAC3) >>> add(MAC4) >>> default=MAC1, Filters=MAC2, MAC3, MAC4 >>> >>> set_default(MAC2) >>> default=MAC2, Filters= MAC3, MAC4 >>> >>> set_default(MAC3) >>> default=MAC3, Filters= MAC4 >>> >>> set_default(MAC4) >>> default=MAC4, Filters= >>> >>> set_default(MAC5) >>> default=MAC5, Filters= >>> >>> Did I get it right? If so, it seems wrong to silently remove the filters. In which case, it would be easier to just not remove them in the first place (current behaviour). >>> >> >> Yep, this is the updated behavior. And agree it looks wrong when you >> show like this. (btw, this is only ethdev record of MAC filters, what >> is updated in this patch, HW still may be keeping all filters.) > > Whether HW saves all filters depends on the implementation of the set_default() > > in the driver. According to the implementation of this API of all PMDs, some drivers > > will first remove the old default MAC in HW and then add the new one when calling > > the set_default(). I am not sure if the HW that didn't do this would remove the old > > default MAC. If not, we may need to standardize this API in the ethdev layer. > >> >>> If they really need to be removed from the filter list when they are set_default(), then perhaps they should be restored to it when there is a new set_default(). >>> >> >> I am for keeping current behavior. Application always can explicitly remove a >> MAC filter before setting it default if required. > > But application can not remove the duplicate MAC if the MAC is the current default > > MAC by rte_eth_dev_mac_addr_remove(). In this case, it will failed to remove. > But can do other-way around, first remove (the non default one), later 'rte_eth_dev_default_mac_addr_set()'. >> >> >>>>>> >>>>>> 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); >>>>> The logic above seems to be good. But if .mac_addr_set() failed to >>>>> execute, the addr has been removed from HW and 'dev->data->mac_addrs[]'. >>>>> It's not good. >>>>> >>>> >>>> Agree. So may need to get a copy of 'addr' and add it back on failure. >>>> >>>> The concern I have to call 'rte_eth_dev_mac_addr_remove()' after >>>> 'dev_ops->mac_addr_set()' is, it may result different behavior on >>>> different PMDs. >>>> For the PMDs that clean the redundant MAC address via 'dev_ops->mac_addr_set()' >>>> may try to remove (although it will fail) the new set default MAC address. >>>> That is why first remove the MAC and later add it back as default >>>> seems safer to me. >>>> >>>>> Hope for your reply.  Thanks. >>>>>>>        /* Update default address in NIC data structure */ >>>>>>>        rte_ether_addr_copy(addr, &dev->data->mac_addrs[0]); >>>>>>> >>>>>> >>>>>> . >>>> >>> >> >> .