Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/23542/?format=api
https://patches.dpdk.org/api/patches/23542/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/ba01f5b46a132c6f4bea72454616d0b0c59aa4a7.1491924900.git.gaetan.rivet@6wind.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": "<ba01f5b46a132c6f4bea72454616d0b0c59aa4a7.1491924900.git.gaetan.rivet@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/ba01f5b46a132c6f4bea72454616d0b0c59aa4a7.1491924900.git.gaetan.rivet@6wind.com", "date": "2017-04-11T15:44:22", "name": "[dpdk-dev,v2,15/42] net/pcap: use ethdev allocation helper for virtual devices", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "afe6f30e322d3680f61a0e211b129803768ed870", "submitter": { "id": 269, "url": "https://patches.dpdk.org/api/people/269/?format=api", "name": "Gaëtan Rivet", "email": "gaetan.rivet@6wind.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/ba01f5b46a132c6f4bea72454616d0b0c59aa4a7.1491924900.git.gaetan.rivet@6wind.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/23542/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/23542/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 829ABD448;\n\tTue, 11 Apr 2017 17:45:45 +0200 (CEST)", "from mail-wr0-f175.google.com (mail-wr0-f175.google.com\n\t[209.85.128.175]) by dpdk.org (Postfix) with ESMTP id 65877D29E\n\tfor <dev@dpdk.org>; Tue, 11 Apr 2017 17:45:19 +0200 (CEST)", "by mail-wr0-f175.google.com with SMTP id z109so710669wrb.1\n\tfor <dev@dpdk.org>; Tue, 11 Apr 2017 08:45:19 -0700 (PDT)", "from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com.\n\t[62.23.145.78]) by smtp.gmail.com with ESMTPSA id\n\tu63sm2933738wmu.22.2017.04.11.08.45.18\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 11 Apr 2017 08:45:18 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:in-reply-to:references;\n\tbh=UNhL4BT9V1cVrNbZ2qEvtZC/fnoOFSENxWAzjh2res4=;\n\tb=hDZ8laXw/V9iio6FTAKniQj0GdYfevnjVEOFV0qKdDvis+hCmYI7O0kHQ6DdlsB5eU\n\tZIzGoqcKQvj+GggnzqbVqzwFqS5bN2RqzDsvAbOEkoAgOHerKTMlqx+sAEF2XLctYspK\n\t18rsmfPRCes8ktASeaLBcoC/oQxuEej+3ixL32ULDvKSflGMWfjlhb+QYsUr1/6F1jQs\n\t8tO2OQq20+DMOsR4u4pnK7vOhPKkHInEdVF2rnoonQhOMxOqpyE+vbgbU4UovFG1HG7z\n\tGI+5XaJxQIfgb2t4UYLFTL/VesSriABTbuyPtNj0bbqT1D5tZZMfXXgA9wDG+Pxk/UgV\n\tyxLw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:in-reply-to:references;\n\tbh=UNhL4BT9V1cVrNbZ2qEvtZC/fnoOFSENxWAzjh2res4=;\n\tb=C/8Vc4ZiJ78HLb5ZA+6MpGVpmvpuBFgUybn863QvbzP8p10OY9lAzBMDi9f+RK464G\n\txXO8kN5QjSZJ2gEOzNoV0A4YgR+ikiIftEGTaLp7z5PnBBKa1839xSOvIEuHkrC6vRu1\n\tyJ0dqGRY5eDZ/aKoECkEsAe1Z71T1ysXzbmD5GSWT67IFPA3rhGMZhYAFPn1ee/I2fIA\n\tvXun5N8cJ0LUl63mBGEg5qrlnYK9eJgn6rltauc5tcTlMPEjT5Hn6hg1QzvBlN+lq2S3\n\t8aFzyDbfbJBwBFmVoc3dIihkIhiMpkYKpHX9/Nn/rC2FEtaUKU6MS9OTXD8HqR77RXrD\n\tZKYg==", "X-Gm-Message-State": "AFeK/H3uQ8HJoJzOq+hVETD+EP6VOHxpBB9hqjQlAiUlHv/1f8gvBGnOp4H2PCZdPBZ5dfdd", "X-Received": "by 10.223.175.23 with SMTP id z23mr33579731wrc.84.1491925518998; \n\tTue, 11 Apr 2017 08:45:18 -0700 (PDT)", "From": "Gaetan Rivet <gaetan.rivet@6wind.com>", "To": "dev@dpdk.org", "Cc": "Jan Blunck <jblunck@infradead.org>", "Date": "Tue, 11 Apr 2017 17:44:22 +0200", "Message-Id": "<ba01f5b46a132c6f4bea72454616d0b0c59aa4a7.1491924900.git.gaetan.rivet@6wind.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": [ "<cover.1491924900.git.gaetan.rivet@6wind.com>", "<cover.1491924900.git.gaetan.rivet@6wind.com>" ], "References": [ "<1488794430-25179-1-git-send-email-jblunck@infradead.org>\n\t<cover.1491924900.git.gaetan.rivet@6wind.com>", "<cover.1491924900.git.gaetan.rivet@6wind.com>" ], "Subject": "[dpdk-dev] [PATCH v2 15/42] net/pcap: use ethdev allocation helper\n\tfor virtual devices", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>\n---\n drivers/net/pcap/rte_eth_pcap.c | 62 ++++++++++++++++++-----------------------\n 1 file changed, 27 insertions(+), 35 deletions(-)", "diff": "diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c\nindex 05cbd47..defb3b4 100644\n--- a/drivers/net/pcap/rte_eth_pcap.c\n+++ b/drivers/net/pcap/rte_eth_pcap.c\n@@ -40,6 +40,7 @@\n \n #include <rte_cycles.h>\n #include <rte_ethdev.h>\n+#include <rte_ethdev_vdev.h>\n #include <rte_kvargs.h>\n #include <rte_malloc.h>\n #include <rte_mbuf.h>\n@@ -790,14 +791,17 @@ open_tx_iface(const char *key, const char *value, void *extra_args)\n static struct rte_vdev_driver pmd_pcap_drv;\n \n static int\n-pmd_init_internals(const char *name, const unsigned int nb_rx_queues,\n+pmd_init_internals(struct rte_vdev_device *vdev,\n+\t\tconst unsigned int nb_rx_queues,\n \t\tconst unsigned int nb_tx_queues,\n \t\tstruct pmd_internals **internals,\n \t\tstruct rte_eth_dev **eth_dev)\n {\n \tstruct rte_eth_dev_data *data = NULL;\n-\tunsigned int numa_node = rte_socket_id();\n+\tunsigned int numa_node = vdev->device.numa_node;\n+\tconst char *name;\n \n+\tname = rte_vdev_device_name(vdev);\n \tRTE_LOG(INFO, PMD, \"Creating pcap-backed ethdev on numa socket %u\\n\",\n \t\tnuma_node);\n \n@@ -806,17 +810,14 @@ pmd_init_internals(const char *name, const unsigned int nb_rx_queues,\n \t */\n \tdata = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);\n \tif (data == NULL)\n-\t\tgoto error;\n-\n-\t*internals = rte_zmalloc_socket(name, sizeof(**internals), 0,\n-\t\t\tnuma_node);\n-\tif (*internals == NULL)\n-\t\tgoto error;\n+\t\treturn -1;\n \n \t/* reserve an ethdev entry */\n-\t*eth_dev = rte_eth_dev_allocate(name);\n-\tif (*eth_dev == NULL)\n-\t\tgoto error;\n+\t*eth_dev = rte_eth_vdev_allocate(vdev, sizeof(**internals));\n+\tif (*eth_dev == NULL) {\n+\t\trte_free(data);\n+\t\treturn -1;\n+\t}\n \n \t/* now put it all together\n \t * - store queue data in internals,\n@@ -824,9 +825,8 @@ pmd_init_internals(const char *name, const unsigned int nb_rx_queues,\n \t * - point eth_dev_data to internals\n \t * - and point eth_dev structure to new eth_dev_data structure\n \t */\n-\tdata->dev_private = *internals;\n-\tdata->port_id = (*eth_dev)->data->port_id;\n-\tsnprintf(data->name, sizeof(data->name), \"%s\", (*eth_dev)->data->name);\n+\t*internals = (*eth_dev)->data->dev_private;\n+\trte_memcpy(data, (*eth_dev)->data, sizeof(*data));\n \tdata->nb_rx_queues = (uint16_t)nb_rx_queues;\n \tdata->nb_tx_queues = (uint16_t)nb_tx_queues;\n \tdata->dev_link = pmd_link;\n@@ -838,26 +838,17 @@ pmd_init_internals(const char *name, const unsigned int nb_rx_queues,\n \t */\n \t(*eth_dev)->data = data;\n \t(*eth_dev)->dev_ops = &ops;\n-\t(*eth_dev)->driver = NULL;\n \tdata->dev_flags = RTE_ETH_DEV_DETACHABLE;\n-\tdata->kdrv = RTE_KDRV_NONE;\n-\tdata->drv_name = pmd_pcap_drv.driver.name;\n-\tdata->numa_node = numa_node;\n \n \treturn 0;\n-\n-error:\n-\trte_free(data);\n-\trte_free(*internals);\n-\n-\treturn -1;\n }\n \n static int\n-eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues,\n-\t\tconst unsigned int nb_rx_queues, struct pmd_devargs *tx_queues,\n-\t\tconst unsigned int nb_tx_queues, struct rte_kvargs *kvlist,\n-\t\tstruct pmd_internals **internals, struct rte_eth_dev **eth_dev)\n+eth_from_pcaps_common(struct rte_vdev_device *vdev,\n+\t\tstruct pmd_devargs *rx_queues, const unsigned int nb_rx_queues,\n+\t\tstruct pmd_devargs *tx_queues, const unsigned int nb_tx_queues,\n+\t\tstruct rte_kvargs *kvlist, struct pmd_internals **internals,\n+\t\tstruct rte_eth_dev **eth_dev)\n {\n \tstruct rte_kvargs_pair *pair = NULL;\n \tunsigned int k_idx;\n@@ -869,7 +860,7 @@ eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues,\n \tif (tx_queues == NULL && nb_tx_queues > 0)\n \t\treturn -1;\n \n-\tif (pmd_init_internals(name, nb_rx_queues, nb_tx_queues, internals,\n+\tif (pmd_init_internals(vdev, nb_rx_queues, nb_tx_queues, internals,\n \t\t\teth_dev) < 0)\n \t\treturn -1;\n \n@@ -907,16 +898,17 @@ eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues,\n }\n \n static int\n-eth_from_pcaps(const char *name, struct pmd_devargs *rx_queues,\n-\t\tconst unsigned int nb_rx_queues, struct pmd_devargs *tx_queues,\n-\t\tconst unsigned int nb_tx_queues, struct rte_kvargs *kvlist,\n-\t\tint single_iface, unsigned int using_dumpers)\n+eth_from_pcaps(struct rte_vdev_device *vdev,\n+\t\tstruct pmd_devargs *rx_queues, const unsigned int nb_rx_queues,\n+\t\tstruct pmd_devargs *tx_queues, const unsigned int nb_tx_queues,\n+\t\tstruct rte_kvargs *kvlist, int single_iface,\n+\t\tunsigned int using_dumpers)\n {\n \tstruct pmd_internals *internals = NULL;\n \tstruct rte_eth_dev *eth_dev = NULL;\n \tint ret;\n \n-\tret = eth_from_pcaps_common(name, rx_queues, nb_rx_queues,\n+\tret = eth_from_pcaps_common(vdev, rx_queues, nb_rx_queues,\n \t\ttx_queues, nb_tx_queues, kvlist, &internals, ð_dev);\n \n \tif (ret < 0)\n@@ -1027,7 +1019,7 @@ pmd_pcap_probe(struct rte_vdev_device *dev)\n \t\tgoto free_kvlist;\n \n create_eth:\n-\tret = eth_from_pcaps(name, &pcaps, pcaps.num_of_queue, &dumpers,\n+\tret = eth_from_pcaps(dev, &pcaps, pcaps.num_of_queue, &dumpers,\n \t\tdumpers.num_of_queue, kvlist, single_iface, is_tx_pcap);\n \n free_kvlist:\n", "prefixes": [ "dpdk-dev", "v2", "15/42" ] }{ "id": 23542, "url": "