Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/111984/?format=api
http://patches.dpdk.org/api/patches/111984/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220527162659.129022-2-bruce.richardson@intel.com/", "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": "<20220527162659.129022-2-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220527162659.129022-2-bruce.richardson@intel.com", "date": "2022-05-27T16:26:59", "name": "[2/2] doc/howto: add code example to virtio-user exception path doc", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8c9d62e51cbd82febc437d1157419b0026887366", "submitter": { "id": 20, "url": "http://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220527162659.129022-2-bruce.richardson@intel.com/mbox/", "series": [ { "id": 23217, "url": "http://patches.dpdk.org/api/series/23217/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=23217", "date": "2022-05-27T16:26:58", "name": "[1/2] doc/howto: rework section on virtio-user as exception path", "version": 1, "mbox": "http://patches.dpdk.org/series/23217/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/111984/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/111984/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 DE583A0545;\n\tFri, 27 May 2022 18:27:29 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 355A14282A;\n\tFri, 27 May 2022 18:27:24 +0200 (CEST)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by mails.dpdk.org (Postfix) with ESMTP id E24D140E78\n for <dev@dpdk.org>; Fri, 27 May 2022 18:27:20 +0200 (CEST)", "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 May 2022 09:27:16 -0700", "from silpixa00401385.ir.intel.com (HELO\n silpixa00401385.ger.corp.intel.com) ([10.237.222.171])\n by orsmga004.jf.intel.com with ESMTP; 27 May 2022 09:27:15 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1653668841; x=1685204841;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=zX4uj8IGsM/mMGH7s39KFkLVPV+vOetK1nqRMTZDP6I=;\n b=Oi0GwyUQE15r+SZ/KlEb6pwoBxo0f19N+iem9m9ILLFtbFbPza1Y/i+f\n Rck/xjQONw2gZzeSuTjzuU7UWBoFhwLlXKmVm4plHD9LZdXur5fADGA56\n DJqu6YntZ6vsSODo8uWgVp222sjcEvJbF7G2RL14HdvnCRzftSabyNmv2\n MMGTUBoLbyQO5IQs/DYmOPZo1pUnxwznbaIgqL2t0ayA/rDENC4PPzL8t\n IFZyHYzttzCMNoUn4OeTUPfPsSlYcwk1i73F1YXez44M/JOQL8OQT0DHe\n sIE0VAFRv4uxENZEIYgA+HFODqj2BttZp4/j8Tcz51kpsQTq7RGJdId/7 g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6400,9594,10360\"; a=\"272091276\"", "E=Sophos;i=\"5.91,256,1647327600\"; d=\"scan'208\";a=\"272091276\"", "E=Sophos;i=\"5.91,256,1647327600\"; d=\"scan'208\";a=\"705192878\"" ], "X-ExtLoop1": "1", "From": "Bruce Richardson <bruce.richardson@intel.com>", "To": "dev@dpdk.org", "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n Chenbo Xia <chenbo.xia@intel.com>,\n Bruce Richardson <bruce.richardson@intel.com>", "Subject": "[PATCH 2/2] doc/howto: add code example to virtio-user exception path\n doc", "Date": "Fri, 27 May 2022 17:26:59 +0100", "Message-Id": "<20220527162659.129022-2-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220527162659.129022-1-bruce.richardson@intel.com>", "References": "<20220527162659.129022-1-bruce.richardson@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "The HOWTO guide for using virtio-user as an exception path to the kernel\nonly provided an example of how testpmd may be used for that purpose.\nHowever, a real application wanting to use virtio-user as exception path\nwould likely want to create such devices from code within the app\nitself. Therefore, we update the doc with instructions and a code\nsnippet showing how this may be done.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n .../howto/virtio_user_as_exceptional_path.rst | 55 +++++++++++++++++++\n 1 file changed, 55 insertions(+)", "diff": "diff --git a/doc/guides/howto/virtio_user_as_exceptional_path.rst b/doc/guides/howto/virtio_user_as_exceptional_path.rst\nindex 0709eeff10..f4bd909458 100644\n--- a/doc/guides/howto/virtio_user_as_exceptional_path.rst\n+++ b/doc/guides/howto/virtio_user_as_exceptional_path.rst\n@@ -157,3 +157,58 @@ For example:\n /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 -- \\\n -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --txd=1024 --rxd=1024\n \n+\n+Creating Virtio-User Ports within an Application\n+------------------------------------------------\n+\n+To use virtio-user ports within an application,\n+it is not necessary to explicitly initialize those ports using EAL arguments at startup.\n+Instead, one can use the generic EAL API\n+`rte_eal_hotplug_add <http://doc.dpdk.org/api/rte__dev_8h.html#ad32e8eebf1f81ef9f290cb296b0c90bb>`_\n+function to create a new instance at startup.\n+For example, to create a basic virtio-user port, the following code could be used:\n+\n+.. code-block:: C\n+\n+ rte_eal_hotplug_add(\"vdev\", \"virtio_user0\", \"path=/dev/vhost-net\");\n+\n+A fuller code example is shown below, where a virtio-user port, and hence kernel netdev,\n+is created for each NIC port discovered by DPDK.\n+Each virtio-user port is given the MAC address of its matching physical port\n+(assuming app was run without vdev args on commandline, so all ports auto-discovered are HW ones).\n+These new virtio-user netdevs will appear in the kernel port listings as ``virtio_user0``,\n+``virtio_user1``, etc.,\n+based on the names passed in as ``iface=`` via the ``portargs`` parameter.\n+\n+.. code-block:: C\n+\n+ nb_ports = rte_eth_dev_count_avail();\n+\n+ /* Create a vhost_user port for each physical port */\n+ unsigned port_count = 0;\n+ RTE_ETH_FOREACH_DEV(portid) {\n+ char portname[32];\n+ char portargs[256];\n+ struct rte_ether_addr addr = {0};\n+\n+ /* don't create virtio_user ports for other virtio_user ports */\n+ if (++port_count > nb_ports)\n+ break;\n+\n+ /* get mac address of physical port to use as mac of virtio_user port */\n+ rte_eth_macaddr_get(portid, &addr);\n+\n+ /* set the name and arguments */\n+ snprintf(portname, sizeof(portname), \"virtio_user%u\", portid);\n+ snprintf(portargs, sizeof(portargs),\n+ \"path=/dev/vhost-net,queues=1,queue_size=%u,iface=%s,mac=\" RTE_ETHER_ADDR_PRT_FMT,\n+ RX_RING_SIZE, portname, RTE_ETHER_ADDR_BYTES(&addr));\n+\n+ /* add the vdev for virtio_user */\n+ if (rte_eal_hotplug_add(\"vdev\", portname, portargs) < 0)\n+ rte_exit(EXIT_FAILURE, \"Cannot create paired port for port %u\\n\", portid);\n+\n+ }\n+\n+Once these virtio-user ports have been created in the loop, all ports, both physical and virtual,\n+may be initialized and used as normal in the application.\n", "prefixes": [ "2/2" ] }{ "id": 111984, "url": "