Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/112195/?format=api
https://patches.dpdk.org/api/patches/112195/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220601063949.43202-2-humin29@huawei.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20220601063949.43202-2-humin29@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220601063949.43202-2-humin29@huawei.com", "date": "2022-06-01T06:39:48", "name": "[v4,1/2] ethdev: fix one address occupies two indexes in MAC addrs", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "93ca3110602d10f053bf305079dd2e0ddd891a1b", "submitter": { "id": 1944, "url": "https://patches.dpdk.org/api/people/1944/?format=api", "name": "humin (Q)", "email": "humin29@huawei.com" }, "delegate": { "id": 319, "url": "https://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220601063949.43202-2-humin29@huawei.com/mbox/", "series": [ { "id": 23280, "url": "https://patches.dpdk.org/api/series/23280/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=23280", "date": "2022-06-01T06:39:47", "name": "ethdev: fix MAC addrs list", "version": 4, "mbox": "https://patches.dpdk.org/series/23280/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/112195/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/112195/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 12CEBA054F;\n\tWed, 1 Jun 2022 08:41:21 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2704C4280B;\n\tWed, 1 Jun 2022 08:41:13 +0200 (CEST)", "from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189])\n by mails.dpdk.org (Postfix) with ESMTP id 5FB1B4069F\n for <dev@dpdk.org>; Wed, 1 Jun 2022 08:41:10 +0200 (CEST)", "from kwepemi500012.china.huawei.com (unknown [172.30.72.57])\n by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LCffw6nXczDqcy\n for <dev@dpdk.org>; Wed, 1 Jun 2022 14:40:56 +0800 (CST)", "from localhost.localdomain (10.69.192.56) by\n kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2375.24; Wed, 1 Jun 2022 14:41:07 +0800" ], "From": "\"Min Hu (Connor)\" <humin29@huawei.com>", "To": "<dev@dpdk.org>", "Subject": "[PATCH v4 1/2] ethdev: fix one address occupies two indexes in MAC\n addrs", "Date": "Wed, 1 Jun 2022 14:39:48 +0800", "Message-ID": "<20220601063949.43202-2-humin29@huawei.com>", "X-Mailer": "git-send-email 2.33.0", "In-Reply-To": "<20220601063949.43202-1-humin29@huawei.com>", "References": "<20220514020049.57294-1-humin29@huawei.com>\n <20220601063949.43202-1-humin29@huawei.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Originating-IP": "[10.69.192.56]", "X-ClientProxiedBy": "dggems702-chm.china.huawei.com (10.3.19.179) To\n kwepemi500012.china.huawei.com (7.221.188.12)", "X-CFilter-Loop": "Reflected", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "From: Huisong Li <lihuisong@huawei.com>\n\nThe dev->data->mac_addrs[0] will be changed to a new MAC address when\napplications modify the default MAC address by\nrte_eth_dev_default_mac_addr_set(). However, if the new default one has\nbeen added as a non-default MAC address by rte_eth_dev_mac_addr_add(), the\nthe rte_eth_dev_default_mac_addr_set() doesn't remove it from the mac_addrs\nlist. As a result, one MAC address occupies two indexes in the list. Like:\nadd(MAC1)\nadd(MAC2)\nadd(MAC3)\nadd(MAC4)\nset_default(MAC3)\ndefault=MAC3, filters=MAC1, MAC2, MAC3, MAC4\n\nIn addition, some PMDs, such as i40e, ice, hns3 and so on, do remove the\nold default MAC when set default MAC. If user continues to do\nset_default(MAC5), and the mac_addrs list is default=MAC5, filters=(MAC1,\nMAC2, MAC3, MAC4). At this moment, user can still view MAC3 from the list,\nbut packets with MAC3 aren't actually received by the PMD.\n\nFixes: 854d8ad4ef68 (\"ethdev: add default mac address modifier\")\nCc: stable@dpdk.org\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Min Hu <humin29@huawei.com>\n---\n lib/ethdev/rte_ethdev.c | 39 +++++++++++++++++++++++++++++++++++++--\n 1 file changed, 37 insertions(+), 2 deletions(-)", "diff": "diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex 46c088dc88..fc9ca8d6fd 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -4260,7 +4260,10 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr)\n int\n rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)\n {\n+\tuint64_t mac_pool_sel_bk = 0;\n \tstruct rte_eth_dev *dev;\n+\tuint32_t pool;\n+\tint index;\n \tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n@@ -4278,16 +4281,48 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr)\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);\n \n+\t/*\n+\t * If the address has been added as a non-default MAC address by\n+\t * rte_eth_dev_mac_addr_add API, it should be removed from\n+\t * dev->data->mac_addrs[].\n+\t */\n+\tindex = eth_dev_get_mac_addr_index(port_id, addr);\n+\tif (index > 0) {\n+\t\t/* remove address in NIC data structure */\n+\t\tmac_pool_sel_bk = dev->data->mac_pool_sel[index];\n+\t\tret = rte_eth_dev_mac_addr_remove(port_id, addr);\n+\t\tif (ret < 0) {\n+\t\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\"Delete MAC address from the MAC list of ethdev port %u.\\n\",\n+\t\t\tport_id);\n+\t\t\treturn ret;\n+\t\t}\n+\t\t/* reset pool bitmap */\n+\t\tdev->data->mac_pool_sel[index] = 0;\n+\t}\n+\n \tret = (*dev->dev_ops->mac_addr_set)(dev, addr);\n \tif (ret < 0)\n-\t\treturn ret;\n+\t\tgoto back;\n \n \t/* Update default address in NIC data structure */\n \trte_ether_addr_copy(addr, &dev->data->mac_addrs[0]);\n \n \treturn 0;\n-}\n \n+back:\n+\tif (index > 0) {\n+\t\tpool = 0;\n+\t\tdo {\n+\t\t\tif (mac_pool_sel_bk & UINT64_C(1))\n+\t\t\t\trte_eth_dev_mac_addr_add(port_id, addr, pool);\n+\t\t\tmac_pool_sel_bk >>= 1;\n+\t\t\tpool++;\n+\t\t} while (mac_pool_sel_bk);\n+\t}\n+\n+\treturn ret;\n+}\n \n /*\n * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 to find\n", "prefixes": [ "v4", "1/2" ] }{ "id": 112195, "url": "