Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/97441/?format=api
http://patches.dpdk.org/api/patches/97441/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210827065717.1838258-22-andrew.rybchenko@oktetlabs.ru/", "project": { "id": 1, "url": "http://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": "<20210827065717.1838258-22-andrew.rybchenko@oktetlabs.ru>", "list_archive_url": "https://inbox.dpdk.org/dev/20210827065717.1838258-22-andrew.rybchenko@oktetlabs.ru", "date": "2021-08-27T06:57:00", "name": "[21/38] net/sfc: support multiple device probe", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8c955ca0cbe28cdcbe5f20450a513dfc6d688f24", "submitter": { "id": 2013, "url": "http://patches.dpdk.org/api/people/2013/?format=api", "name": "Andrew Rybchenko", "email": "Andrew.Rybchenko@oktetlabs.ru" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210827065717.1838258-22-andrew.rybchenko@oktetlabs.ru/mbox/", "series": [ { "id": 18492, "url": "http://patches.dpdk.org/api/series/18492/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18492", "date": "2021-08-27T06:56:39", "name": "net/sfc: support port representors", "version": 1, "mbox": "http://patches.dpdk.org/series/18492/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/97441/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/97441/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 E7F9CA0C43;\n\tFri, 27 Aug 2021 09:00:12 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E2877412BC;\n\tFri, 27 Aug 2021 08:58:49 +0200 (CEST)", "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id 615A8412A6\n for <dev@dpdk.org>; Fri, 27 Aug 2021 08:58:42 +0200 (CEST)", "by shelob.oktetlabs.ru (Postfix, from userid 122)\n id 26BC47F6FD; Fri, 27 Aug 2021 09:58:42 +0300 (MSK)", "from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17])\n by shelob.oktetlabs.ru (Postfix) with ESMTP id 1EA9C7F6E6;\n Fri, 27 Aug 2021 09:57:35 +0300 (MSK)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru", "X-Spam-Level": "", "X-Spam-Status": "No, score=0.8 required=5.0 tests=ALL_TRUSTED,\n DKIM_ADSP_DISCARD,\n URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2", "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 1EA9C7F6E6", "Authentication-Results": "shelob.oktetlabs.ru/1EA9C7F6E6; dkim=none;\n dkim-atps=neutral", "From": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>", "To": "dev@dpdk.org", "Cc": "Igor Romanov <igor.romanov@oktetlabs.ru>,\n Andy Moreton <amoreton@xilinx.com>, Ivan Malov <ivan.malov@oktetlabs.ru>", "Date": "Fri, 27 Aug 2021 09:57:00 +0300", "Message-Id": "<20210827065717.1838258-22-andrew.rybchenko@oktetlabs.ru>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru>", "References": "<20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH 21/38] net/sfc: support multiple device probe", "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": "From: Igor Romanov <igor.romanov@oktetlabs.ru>\n\nSupport probing the device multiple times so that additional port\nrepresentors can be created with hotplug EAL API. To hotplug a\nrepresentor, the PF must be hotplugged with different representor\ndevice argument.\n\nSigned-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\nReviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>\n---\n drivers/net/sfc/sfc_ethdev.c | 55 ++++++++++++++++++++++++------------\n drivers/net/sfc/sfc_repr.c | 35 +++++++++++++----------\n 2 files changed, 57 insertions(+), 33 deletions(-)", "diff": "diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c\nindex 8578ba0765..8f9afb2c67 100644\n--- a/drivers/net/sfc/sfc_ethdev.c\n+++ b/drivers/net/sfc/sfc_ethdev.c\n@@ -2432,31 +2432,40 @@ sfc_parse_rte_devargs(const char *args, struct rte_eth_devargs *devargs)\n }\n \n static int\n-sfc_eth_dev_create(struct rte_pci_device *pci_dev,\n-\t\t struct sfc_ethdev_init_data *init_data,\n-\t\t struct rte_eth_dev **devp)\n+sfc_eth_dev_find_or_create(struct rte_pci_device *pci_dev,\n+\t\t\t struct sfc_ethdev_init_data *init_data,\n+\t\t\t struct rte_eth_dev **devp,\n+\t\t\t bool *dev_created)\n {\n \tstruct rte_eth_dev *dev;\n+\tbool created = false;\n \tint rc;\n \n-\trc = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name,\n-\t\t\t\tsizeof(struct sfc_adapter_shared),\n-\t\t\t\teth_dev_pci_specific_init, pci_dev,\n-\t\t\t\tsfc_eth_dev_init, init_data);\n-\tif (rc != 0) {\n-\t\tSFC_GENERIC_LOG(ERR, \"Failed to create sfc ethdev '%s'\",\n-\t\t\t\tpci_dev->device.name);\n-\t\treturn rc;\n-\t}\n-\n \tdev = rte_eth_dev_allocated(pci_dev->device.name);\n \tif (dev == NULL) {\n-\t\tSFC_GENERIC_LOG(ERR, \"Failed to find allocated sfc ethdev '%s'\",\n+\t\trc = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name,\n+\t\t\t\t\tsizeof(struct sfc_adapter_shared),\n+\t\t\t\t\teth_dev_pci_specific_init, pci_dev,\n+\t\t\t\t\tsfc_eth_dev_init, init_data);\n+\t\tif (rc != 0) {\n+\t\t\tSFC_GENERIC_LOG(ERR, \"Failed to create sfc ethdev '%s'\",\n+\t\t\t\t\tpci_dev->device.name);\n+\t\t\treturn rc;\n+\t\t}\n+\n+\t\tcreated = true;\n+\n+\t\tdev = rte_eth_dev_allocated(pci_dev->device.name);\n+\t\tif (dev == NULL) {\n+\t\t\tSFC_GENERIC_LOG(ERR,\n+\t\t\t\t\"Failed to find allocated sfc ethdev '%s'\",\n \t\t\t\tpci_dev->device.name);\n-\t\treturn -ENODEV;\n+\t\t\treturn -ENODEV;\n+\t\t}\n \t}\n \n \t*devp = dev;\n+\t*dev_created = created;\n \n \treturn 0;\n }\n@@ -2517,6 +2526,7 @@ static int sfc_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \tstruct sfc_ethdev_init_data init_data;\n \tstruct rte_eth_devargs eth_da;\n \tstruct rte_eth_dev *dev;\n+\tbool dev_created;\n \tint rc;\n \n \tif (pci_dev->device.devargs != NULL) {\n@@ -2538,13 +2548,21 @@ static int sfc_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\treturn -ENOTSUP;\n \t}\n \n-\trc = sfc_eth_dev_create(pci_dev, &init_data, &dev);\n+\t/*\n+\t * Driver supports RTE_PCI_DRV_PROBE_AGAIN. Hence create device only\n+\t * if it does not already exist. Re-probing an existing device is\n+\t * expected to allow additional representors to be configured.\n+\t */\n+\trc = sfc_eth_dev_find_or_create(pci_dev, &init_data, &dev,\n+\t\t\t\t\t&dev_created);\n \tif (rc != 0)\n \t\treturn rc;\n \n \trc = sfc_eth_dev_create_representors(dev, ð_da);\n \tif (rc != 0) {\n-\t\t(void)rte_eth_dev_destroy(dev, sfc_eth_dev_uninit);\n+\t\tif (dev_created)\n+\t\t\t(void)rte_eth_dev_destroy(dev, sfc_eth_dev_uninit);\n+\n \t\treturn rc;\n \t}\n \n@@ -2560,7 +2578,8 @@ static struct rte_pci_driver sfc_efx_pmd = {\n \t.id_table = pci_id_sfc_efx_map,\n \t.drv_flags =\n \t\tRTE_PCI_DRV_INTR_LSC |\n-\t\tRTE_PCI_DRV_NEED_MAPPING,\n+\t\tRTE_PCI_DRV_NEED_MAPPING |\n+\t\tRTE_PCI_DRV_PROBE_AGAIN,\n \t.probe = sfc_eth_dev_pci_probe,\n \t.remove = sfc_eth_dev_pci_remove,\n };\ndiff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c\nindex 207e7c77a0..7a34a0a904 100644\n--- a/drivers/net/sfc/sfc_repr.c\n+++ b/drivers/net/sfc/sfc_repr.c\n@@ -930,6 +930,7 @@ sfc_repr_create(struct rte_eth_dev *parent, uint16_t representor_id,\n \tstruct sfc_repr_init_data repr_data;\n \tchar name[RTE_ETH_NAME_MAX_LEN];\n \tint ret;\n+\tstruct rte_eth_dev *dev;\n \n \tif (snprintf(name, sizeof(name), \"net_%s_representor_%u\",\n \t\t parent->device->name, representor_id) >=\n@@ -938,20 +939,24 @@ sfc_repr_create(struct rte_eth_dev *parent, uint16_t representor_id,\n \t\treturn -ENAMETOOLONG;\n \t}\n \n-\tmemset(&repr_data, 0, sizeof(repr_data));\n-\trepr_data.pf_port_id = parent->data->port_id;\n-\trepr_data.repr_id = representor_id;\n-\trepr_data.switch_domain_id = switch_domain_id;\n-\trepr_data.mport_sel = *mport_sel;\n-\n-\tret = rte_eth_dev_create(parent->device, name,\n-\t\t\t\t sizeof(struct sfc_repr_shared),\n-\t\t\t\t NULL, NULL,\n-\t\t\t\t sfc_repr_eth_dev_init, &repr_data);\n-\tif (ret != 0)\n-\t\tSFC_GENERIC_LOG(ERR, \"%s() failed to create device\", __func__);\n-\n-\tSFC_GENERIC_LOG(INFO, \"%s() done: %s\", __func__, rte_strerror(-ret));\n+\tdev = rte_eth_dev_allocated(name);\n+\tif (dev == NULL) {\n+\t\tmemset(&repr_data, 0, sizeof(repr_data));\n+\t\trepr_data.pf_port_id = parent->data->port_id;\n+\t\trepr_data.repr_id = representor_id;\n+\t\trepr_data.switch_domain_id = switch_domain_id;\n+\t\trepr_data.mport_sel = *mport_sel;\n+\n+\t\tret = rte_eth_dev_create(parent->device, name,\n+\t\t\t\t\t sizeof(struct sfc_repr_shared),\n+\t\t\t\t\t NULL, NULL,\n+\t\t\t\t\t sfc_repr_eth_dev_init, &repr_data);\n+\t\tif (ret != 0) {\n+\t\t\tSFC_GENERIC_LOG(ERR, \"%s() failed to create device\",\n+\t\t\t\t\t__func__);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n \n-\treturn ret;\n+\treturn 0;\n }\n", "prefixes": [ "21/38" ] }{ "id": 97441, "url": "