Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/95326/?format=api
http://patchwork.dpdk.org/api/patches/95326/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1625541871-61882-1-git-send-email-lihuisong@huawei.com/", "project": { "id": 1, "url": "http://patchwork.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": "<1625541871-61882-1-git-send-email-lihuisong@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1625541871-61882-1-git-send-email-lihuisong@huawei.com", "date": "2021-07-06T03:24:31", "name": "[V1] ethdev: add dev configured flag", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "372d9263198369474ddb07d040e47cbdb981916e", "submitter": { "id": 2085, "url": "http://patchwork.dpdk.org/api/people/2085/?format=api", "name": "lihuisong (C)", "email": "lihuisong@huawei.com" }, "delegate": null, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1625541871-61882-1-git-send-email-lihuisong@huawei.com/mbox/", "series": [ { "id": 17644, "url": "http://patchwork.dpdk.org/api/series/17644/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=17644", "date": "2021-07-06T03:24:31", "name": "[V1] ethdev: add dev configured flag", "version": 1, "mbox": "http://patchwork.dpdk.org/series/17644/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/95326/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/95326/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 7290FA0C47;\n\tTue, 6 Jul 2021 05:25:14 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DF98140688;\n\tTue, 6 Jul 2021 05:25:13 +0200 (CEST)", "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id BCB524067E\n for <dev@dpdk.org>; Tue, 6 Jul 2021 05:25:11 +0200 (CEST)", "from dggemv703-chm.china.huawei.com (unknown [172.30.72.56])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GJnsL5b16z785N;\n Tue, 6 Jul 2021 11:21:42 +0800 (CST)", "from dggema767-chm.china.huawei.com (10.1.198.209) by\n dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id\n 15.1.2176.2; Tue, 6 Jul 2021 11:25:09 +0800", "from localhost.localdomain (10.69.192.56) by\n dggema767-chm.china.huawei.com (10.1.198.209) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id\n 15.1.2176.2; Tue, 6 Jul 2021 11:25:08 +0800" ], "From": "Huisong Li <lihuisong@huawei.com>", "To": "<dev@dpdk.org>", "CC": "<thomas@monjalon.net>, <ferruh.yigit@intel.com>,\n <konstantin.ananyev@intel.com>, <andrew.rybchenko@oktetlabs.ru>", "Date": "Tue, 6 Jul 2021 11:24:31 +0800", "Message-ID": "<1625541871-61882-1-git-send-email-lihuisong@huawei.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1620460836-38506-1-git-send-email-lihuisong@huawei.com>", "References": "<1620460836-38506-1-git-send-email-lihuisong@huawei.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.69.192.56]", "X-ClientProxiedBy": "dggems702-chm.china.huawei.com (10.3.19.179) To\n dggema767-chm.china.huawei.com (10.1.198.209)", "X-CFilter-Loop": "Reflected", "Subject": "[dpdk-dev] [PATCH V1] ethdev: add dev configured flag", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Currently, if dev_configure is not called or fails to be called, users\ncan still call dev_start successfully. So it is necessary to have a flag\nwhich indicates whether the device is configured, to control whether\ndev_start can be called and eliminate dependency on user invocation order.\n\nThe falg stored in \"struct rte_eth_dev_data\" is more reasonable than\n \"enum rte_eth_dev_state\". \"enum rte_eth_dev_state\" is private to the\nprimary and secondary processes, and can be independently controlled.\nHowever, the secondary process does not make resource allocations and\ndoes not call dev_configure(). These are done by the primary process\nand can be obtained or used by the secondary process. So this patch\nadds a \"dev_configured\" flag in \"rte_eth_dev_data\", like \"dev_started\".\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\n---\n lib/ethdev/rte_ethdev.c | 16 ++++++++++++++++\n lib/ethdev/rte_ethdev_core.h | 6 +++++-\n 2 files changed, 21 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex c607eab..6540432 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -1356,6 +1356,13 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \t\treturn -EBUSY;\n \t}\n \n+\t/*\n+\t * Ensure that \"dev_configured\" is always 0 each time prepare to do\n+\t * dev_configure() to avoid any non-anticipated behaviour.\n+\t * And set to 1 when dev_configure() is executed successfully.\n+\t */\n+\tdev->data->dev_configured = 0;\n+\n \t /* Store original config, as rollback required on failure */\n \tmemcpy(&orig_conf, &dev->data->dev_conf, sizeof(dev->data->dev_conf));\n \n@@ -1606,6 +1613,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \t}\n \n \trte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, 0);\n+\tdev->data->dev_configured = 1;\n+\n \treturn 0;\n reset_queues:\n \teth_dev_rx_queue_config(dev, 0);\n@@ -1751,6 +1760,13 @@ rte_eth_dev_start(uint16_t port_id)\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);\n \n+\tif (dev->data->dev_configured == 0) {\n+\t\tRTE_ETHDEV_LOG(INFO,\n+\t\t\t\"Device with port_id=%\"PRIu16\" is not configured.\\n\",\n+\t\t\tport_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n \tif (dev->data->dev_started != 0) {\n \t\tRTE_ETHDEV_LOG(INFO,\n \t\t\t\"Device with port_id=%\"PRIu16\" already started\\n\",\ndiff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h\nindex 4679d94..edf96de 100644\n--- a/lib/ethdev/rte_ethdev_core.h\n+++ b/lib/ethdev/rte_ethdev_core.h\n@@ -167,7 +167,11 @@ struct rte_eth_dev_data {\n \t\tscattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */\n \t\tall_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */\n \t\tdev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */\n-\t\tlro : 1; /**< RX LRO is ON(1) / OFF(0) */\n+\t\tlro : 1, /**< RX LRO is ON(1) / OFF(0) */\n+\t\tdev_configured : 1;\n+\t\t/**< Indicates whether the device is configured.\n+\t\t * CONFIGURED(1) / NOT CONFIGURED(0).\n+\t\t */\n \tuint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];\n \t\t/**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */\n \tuint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];\n", "prefixes": [ "V1" ] }{ "id": 95326, "url": "