get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/105138/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 105138,
    "url": "http://patches.dpdk.org/api/patches/105138/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211214141242.3383831-9-ronan.randles@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": "<20211214141242.3383831-9-ronan.randles@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211214141242.3383831-9-ronan.randles@intel.com",
    "date": "2021-12-14T14:12:38",
    "name": "[08/12] examples/generator: import code from basicfwd.c",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "90ea4a8ab9fcf0d8a6cd2a34973de9b985b5e1fc",
    "submitter": {
        "id": 2439,
        "url": "http://patches.dpdk.org/api/people/2439/?format=api",
        "name": "Ronan Randles",
        "email": "ronan.randles@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/20211214141242.3383831-9-ronan.randles@intel.com/mbox/",
    "series": [
        {
            "id": 20944,
            "url": "http://patches.dpdk.org/api/series/20944/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=20944",
            "date": "2021-12-14T14:12:30",
            "name": "add packet generator library and example app",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/20944/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/105138/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/105138/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 5F27DA00C3;\n\tTue, 14 Dec 2021 15:13:44 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DD9E04116A;\n\tTue, 14 Dec 2021 15:13:01 +0100 (CET)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by mails.dpdk.org (Postfix) with ESMTP id 7380541178\n for <dev@dpdk.org>; Tue, 14 Dec 2021 15:12:59 +0100 (CET)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Dec 2021 06:12:59 -0800",
            "from silpixa00401120.ir.intel.com ([10.55.129.95])\n by orsmga006.jf.intel.com with ESMTP; 14 Dec 2021 06:12:57 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1639491179; x=1671027179;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=IIKYW+Z+43Ib9qY+rOCVzyISxAjcRPtzp3o2kDYSWf4=;\n b=NCxqnqFAas8c/7SdHeyyiWUWmw/3OjYC3Lsit3E1QnxPCodBeEZk+eVP\n QPP/g7HVTbSoSV40SXw7iXTUTjnrr7aa/t3m1qtX6d30D8CsWTSjLDkK7\n rsq3xcRvdSUtK4HyJxvSyB4+FdfBIryQcnmeUMGgOG8PsEeTi17vmyslc\n am1oYPWDDpQKtE6qk9jv+X99ddNlEum0cXYgxaBwQJoQrOpewI7C8hXIu\n 8CRqNkUKEUDAj1bQLarGfZ7P8OAxEMfedsSDu4NohwXxhPb4cnxxrpzTr\n bJkz7gyDxLW2vgB//Qqz/yxUrMmmaMWi37itn24gFOzbcVfmppiGpeRL4 A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10197\"; a=\"302362335\"",
            "E=Sophos;i=\"5.88,205,1635231600\"; d=\"scan'208\";a=\"302362335\"",
            "E=Sophos;i=\"5.88,205,1635231600\"; d=\"scan'208\";a=\"465104155\""
        ],
        "X-ExtLoop1": "1",
        "From": "Ronan Randles <ronan.randles@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "harry.van.haaren@intel.com,\n\tRonan Randles <ronan.randles@intel.com>",
        "Subject": "[PATCH 08/12] examples/generator: import code from basicfwd.c",
        "Date": "Tue, 14 Dec 2021 14:12:38 +0000",
        "Message-Id": "<20211214141242.3383831-9-ronan.randles@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211214141242.3383831-1-ronan.randles@intel.com>",
        "References": "<20211214141242.3383831-1-ronan.randles@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": "From: Harry van Haaren <harry.van.haaren@intel.com>\n\nImport files from basicfwd.c to act as starting point for\ngen library sample app\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\nSigned-off-by: Ronan Randles <ronan.randles@intel.com>\n---\n examples/generator/main.c      | 226 +++++++++++++++++++++++++++++++++\n examples/generator/meson.build |  12 ++\n 2 files changed, 238 insertions(+)\n create mode 100644 examples/generator/main.c\n create mode 100644 examples/generator/meson.build",
    "diff": "diff --git a/examples/generator/main.c b/examples/generator/main.c\nnew file mode 100644\nindex 0000000000..0082f588b4\n--- /dev/null\n+++ b/examples/generator/main.c\n@@ -0,0 +1,226 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2015 Intel Corporation\n+ */\n+\n+#include <stdint.h>\n+#include <inttypes.h>\n+#include <rte_eal.h>\n+#include <rte_ethdev.h>\n+#include <rte_cycles.h>\n+#include <rte_lcore.h>\n+#include <rte_mbuf.h>\n+\n+#define RX_RING_SIZE 1024\n+#define TX_RING_SIZE 1024\n+\n+#define NUM_MBUFS 8191\n+#define MBUF_CACHE_SIZE 256\n+#define BURST_SIZE 32\n+\n+/* Configuration of ethernet ports. 8<  */\n+static const struct rte_eth_conf port_conf_default = {\n+\t.rxmode = {\n+\t\t.max_lro_pkt_size = RTE_ETHER_MAX_LEN,\n+\t},\n+};\n+/* >8 End of configuration of ethernet ports. */\n+\n+/* basicfwd.c: Basic DPDK skeleton forwarding example. */\n+\n+/*\n+ * Initializes a given port using global settings and with the RX buffers\n+ * coming from the mbuf_pool passed as a parameter.\n+ */\n+\n+/* Main functional part of port initialization. 8< */\n+static inline int\n+port_init(uint16_t port, struct rte_mempool *mbuf_pool)\n+{\n+\tstruct rte_eth_conf port_conf = port_conf_default;\n+\tconst uint16_t rx_rings = 1, tx_rings = 1;\n+\tuint16_t nb_rxd = RX_RING_SIZE;\n+\tuint16_t nb_txd = TX_RING_SIZE;\n+\tint retval;\n+\tuint16_t q;\n+\tstruct rte_eth_dev_info dev_info;\n+\tstruct rte_eth_txconf txconf;\n+\n+\tif (!rte_eth_dev_is_valid_port(port))\n+\t\treturn -1;\n+\n+\tretval = rte_eth_dev_info_get(port, &dev_info);\n+\tif (retval != 0) {\n+\t\tprintf(\"Error during getting device (port %u) info: %s\\n\",\n+\t\t\t\tport, strerror(-retval));\n+\t\treturn retval;\n+\t}\n+\n+\tif (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)\n+\t\tport_conf.txmode.offloads |=\n+\t\t\tDEV_TX_OFFLOAD_MBUF_FAST_FREE;\n+\n+\t/* Configure the Ethernet device. */\n+\tretval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);\n+\tif (retval != 0)\n+\t\treturn retval;\n+\n+\tretval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);\n+\tif (retval != 0)\n+\t\treturn retval;\n+\n+\t/* Allocate and set up 1 RX queue per Ethernet port. */\n+\tfor (q = 0; q < rx_rings; q++) {\n+\t\tretval = rte_eth_rx_queue_setup(port, q, nb_rxd,\n+\t\t\t\trte_eth_dev_socket_id(port), NULL, mbuf_pool);\n+\t\tif (retval < 0)\n+\t\t\treturn retval;\n+\t}\n+\n+\ttxconf = dev_info.default_txconf;\n+\ttxconf.offloads = port_conf.txmode.offloads;\n+\t/* Allocate and set up 1 TX queue per Ethernet port. */\n+\tfor (q = 0; q < tx_rings; q++) {\n+\t\tretval = rte_eth_tx_queue_setup(port, q, nb_txd,\n+\t\t\t\trte_eth_dev_socket_id(port), &txconf);\n+\t\tif (retval < 0)\n+\t\t\treturn retval;\n+\t}\n+\n+\t/* Starting Ethernet port. 8< */\n+\tretval = rte_eth_dev_start(port);\n+\t/* >8 End of starting of ethernet port. */\n+\tif (retval < 0)\n+\t\treturn retval;\n+\n+\t/* Display the port MAC address. */\n+\tstruct rte_ether_addr addr;\n+\tretval = rte_eth_macaddr_get(port, &addr);\n+\tif (retval != 0)\n+\t\treturn retval;\n+\n+\tprintf(\"Port %u MAC: %02\" PRIx8 \" %02\" PRIx8 \" %02\" PRIx8\n+\t\t\t   \" %02\" PRIx8 \" %02\" PRIx8 \" %02\" PRIx8 \"\\n\",\n+\t\t\tport, RTE_ETHER_ADDR_BYTES(&addr));\n+\n+\t/* Enable RX in promiscuous mode for the Ethernet device. */\n+\tretval = rte_eth_promiscuous_enable(port);\n+\t/* End of setting RX port in promiscuous mode. */\n+\tif (retval != 0)\n+\t\treturn retval;\n+\n+\treturn 0;\n+}\n+/* >8 End of main functional part of port initialization. */\n+\n+/*\n+ * The lcore main. This is the main thread that does the work, reading from\n+ * an input port and writing to an output port.\n+ */\n+\n+ /* Basic forwarding application lcore. 8< */\n+static __rte_noreturn void\n+lcore_main(void)\n+{\n+\tuint16_t port;\n+\n+\t/*\n+\t * Check that the port is on the same NUMA node as the polling thread\n+\t * for best performance.\n+\t */\n+\tRTE_ETH_FOREACH_DEV(port)\n+\t\tif (rte_eth_dev_socket_id(port) >= 0 &&\n+\t\t\t\trte_eth_dev_socket_id(port) !=\n+\t\t\t\t\t\t(int)rte_socket_id())\n+\t\t\tprintf(\"WARNING, port %u is on remote NUMA node to \"\n+\t\t\t\t\t\"polling thread.\\n\\tPerformance will \"\n+\t\t\t\t\t\"not be optimal.\\n\", port);\n+\n+\tprintf(\"\\nCore %u forwarding packets. [Ctrl+C to quit]\\n\",\n+\t\t\trte_lcore_id());\n+\n+\t/* Main work of application loop. 8< */\n+\tfor (;;) {\n+\t\t/*\n+\t\t * Receive packets on a port and forward them on the paired\n+\t\t * port. The mapping is 0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2, etc.\n+\t\t */\n+\t\tRTE_ETH_FOREACH_DEV(port) {\n+\n+\t\t\t/* Get burst of RX packets, from first port of pair. */\n+\t\t\tstruct rte_mbuf *bufs[BURST_SIZE];\n+\t\t\tconst uint16_t nb_rx = rte_eth_rx_burst(port, 0,\n+\t\t\t\t\tbufs, BURST_SIZE);\n+\n+\t\t\tif (unlikely(nb_rx == 0))\n+\t\t\t\tcontinue;\n+\n+\t\t\t/* Send burst of TX packets, to second port of pair. */\n+\t\t\tconst uint16_t nb_tx = rte_eth_tx_burst(port ^ 1, 0,\n+\t\t\t\t\tbufs, nb_rx);\n+\n+\t\t\t/* Free any unsent packets. */\n+\t\t\tif (unlikely(nb_tx < nb_rx)) {\n+\t\t\t\tuint16_t buf;\n+\t\t\t\tfor (buf = nb_tx; buf < nb_rx; buf++)\n+\t\t\t\t\trte_pktmbuf_free(bufs[buf]);\n+\t\t\t}\n+\t\t}\n+\t}\n+\t/* >8 End of loop. */\n+}\n+/* >8 End Basic forwarding application lcore. */\n+\n+/*\n+ * The main function, which does initialization and calls the per-lcore\n+ * functions.\n+ */\n+int\n+main(int argc, char *argv[])\n+{\n+\tstruct rte_mempool *mbuf_pool;\n+\tunsigned int nb_ports;\n+\tuint16_t portid;\n+\n+\t/* Initializion the Environment Abstraction Layer (EAL). 8< */\n+\tint ret = rte_eal_init(argc, argv);\n+\tif (ret < 0)\n+\t\trte_exit(EXIT_FAILURE, \"Error with EAL initialization\\n\");\n+\t/* >8 End of initializion the Environment Abstraction Layer (EAL). */\n+\n+\targc -= ret;\n+\targv += ret;\n+\n+\t/* Check that there is an even number of ports to send/receive on. */\n+\tnb_ports = rte_eth_dev_count_avail();\n+\tif (nb_ports < 2 || (nb_ports & 1))\n+\t\trte_exit(EXIT_FAILURE, \"Error: number of ports must be even\\n\");\n+\n+\t/* Creates a new mempool in memory to hold the mbufs. */\n+\n+\t/* Allocates mempool to hold the mbufs. 8< */\n+\tmbuf_pool = rte_pktmbuf_pool_create(\"MBUF_POOL\", NUM_MBUFS * nb_ports,\n+\t\tMBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());\n+\t/* >8 End of allocating mempool to hold mbuf. */\n+\n+\tif (mbuf_pool == NULL)\n+\t\trte_exit(EXIT_FAILURE, \"Cannot create mbuf pool\\n\");\n+\n+\t/* Initializing all ports. 8< */\n+\tRTE_ETH_FOREACH_DEV(portid)\n+\t\tif (port_init(portid, mbuf_pool) != 0)\n+\t\t\trte_exit(EXIT_FAILURE, \"Cannot init port %\"PRIu16 \"\\n\",\n+\t\t\t\t\tportid);\n+\t/* >8 End of initializing all ports. */\n+\n+\tif (rte_lcore_count() > 1)\n+\t\tprintf(\"\\nWARNING: Too many lcores enabled. Only 1 used.\\n\");\n+\n+\t/* Call lcore_main on the main core only. Called on single lcore. 8< */\n+\tlcore_main();\n+\t/* >8 End of called on single lcore. */\n+\n+\t/* clean up the EAL */\n+\trte_eal_cleanup();\n+\n+\treturn 0;\n+}\ndiff --git a/examples/generator/meson.build b/examples/generator/meson.build\nnew file mode 100644\nindex 0000000000..441678bbe5\n--- /dev/null\n+++ b/examples/generator/meson.build\n@@ -0,0 +1,12 @@\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2017 Intel Corporation\n+\n+# meson file, for building this example as part of a main DPDK build.\n+#\n+# To build this example as a standalone application with an already-installed\n+# DPDK instance, use 'make'\n+\n+allow_experimental_apis = true\n+sources = files(\n+        'main.c',\n+)\n",
    "prefixes": [
        "08/12"
    ]
}