get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 675,
    "url": "http://patchwork.dpdk.org/api/patches/675/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/7F861DC0615E0C47A872E6F3C5FCDDBD02AE2629@BPXM14GP.gisp.nec.co.jp/",
    "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": "<7F861DC0615E0C47A872E6F3C5FCDDBD02AE2629@BPXM14GP.gisp.nec.co.jp>",
    "list_archive_url": "https://inbox.dpdk.org/dev/7F861DC0615E0C47A872E6F3C5FCDDBD02AE2629@BPXM14GP.gisp.nec.co.jp",
    "date": "2014-09-30T11:11:56",
    "name": "[dpdk-dev,memnic,v2,1/7] guest: memnic-tester: PMD benchmark in guest",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "07483bea2620f4f9cbb69359c472fe240cae2344",
    "submitter": {
        "id": 38,
        "url": "http://patchwork.dpdk.org/api/people/38/?format=api",
        "name": "Hiroshi Shimamoto",
        "email": "h-shimamoto@ct.jp.nec.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/7F861DC0615E0C47A872E6F3C5FCDDBD02AE2629@BPXM14GP.gisp.nec.co.jp/mbox/",
    "series": [],
    "comments": "http://patchwork.dpdk.org/api/patches/675/comments/",
    "check": "pending",
    "checks": "http://patchwork.dpdk.org/api/patches/675/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 4FC6D68FD;\n\tTue, 30 Sep 2014 13:09:37 +0200 (CEST)",
            "from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [210.143.35.51])\n\tby dpdk.org (Postfix) with ESMTP id B80535902\n\tfor <dev@dpdk.org>; Tue, 30 Sep 2014 13:09:35 +0200 (CEST)",
            "from mailgate3.nec.co.jp ([10.7.69.197])\n\tby tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id s8UBGE3Y026314\n\tfor <dev@dpdk.org>; Tue, 30 Sep 2014 20:16:14 +0900 (JST)",
            "from mailsv3.nec.co.jp (imss61.nec.co.jp [10.7.69.156]) by\n\tmailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) with ESMTP\n\tid s8UBGER11156 for <dev@dpdk.org>;\n\tTue, 30 Sep 2014 20:16:14 +0900 (JST)",
            "from mail02.kamome.nec.co.jp (mail02.kamome.nec.co.jp [10.25.43.5])\n\tby mailsv3.nec.co.jp (8.13.8/8.13.4) with ESMTP id s8UBGEwK009540\n\tfor <dev@dpdk.org>; Tue, 30 Sep 2014 20:16:14 +0900 (JST)",
            "from bpxc99gp.gisp.nec.co.jp ([10.38.151.143] [10.38.151.143]) by\n\tmail01b.kamome.nec.co.jp with ESMTP id BT-MMP-2225085;\n\tTue, 30 Sep 2014 20:11:57 +0900",
            "from BPXM14GP.gisp.nec.co.jp ([169.254.1.136]) by\n\tBPXC15GP.gisp.nec.co.jp ([10.38.151.143]) with mapi id 14.03.0174.002;\n\tTue, 30 Sep 2014 20:11:57 +0900"
        ],
        "From": "Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>",
        "To": "\"dev@dpdk.org\" <dev@dpdk.org>",
        "Thread-Topic": "[memnic PATCH v2 1/7] guest: memnic-tester: PMD benchmark in\n\tguest",
        "Thread-Index": "Ac/cn1GaJK4M6E+ETjyl6SzagP1LNw==",
        "Date": "Tue, 30 Sep 2014 11:11:56 +0000",
        "Message-ID": "<7F861DC0615E0C47A872E6F3C5FCDDBD02AE2629@BPXM14GP.gisp.nec.co.jp>",
        "Accept-Language": "ja-JP, en-US",
        "Content-Language": "ja-JP",
        "X-MS-Has-Attach": "",
        "X-MS-TNEF-Correlator": "",
        "x-originating-ip": "[10.205.5.123]",
        "Content-Type": "text/plain; charset=\"iso-2022-jp\"",
        "Content-Transfer-Encoding": "quoted-printable",
        "MIME-Version": "1.0",
        "Cc": "Hayato Momma <h-momma@ce.jp.nec.com>",
        "Subject": "[dpdk-dev] [memnic PATCH v2 1/7] guest: memnic-tester: PMD\n\tbenchmark in guest",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>\n\nIntroduce memnic-tester which benchmarks MEMNIC PMD performance in guest.\n\nIt starts with two threads, one thread produces and consumes packets,\nother thread receives packets and directly transmits the received\npackets. This evaluates MEMNIC PMD running cost.\n\nmemnic-tester is a benchmark tool to measure performance of MEMNIC PMD itself.\nThe master thread forward packets with Rx and Tx bursts.\nThe slave thread fills and clears packets in the lightest way. It doesn't get\npacket out of VM because it would increase jitter and hide PMD performance.\nThroughput (number of forwarded packets per second) is given for each frame size.\n\nThe master thread does rx_burst and tx_burst through MEMNIC PMD.\n        +---------+\n        | master  |\n        +---------+\n rx_burst ^     | tx_burst\n          |     V\n      +------+------+\n      |  up  | down | MEMNIC shared memory\n      +------+------+\n set flag ^     | unset flag\n          |     V\n        +---------+\n        |  slave  |\n        +---------+\nThe slave thread emulates packet-in/out by setting flag on/off.\n\nIt shows that throughputs in different frame size.\n  64, 128, 256, 512, 1024, 1280, 1518\n\nSigned-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>\nReviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>\n---\n guest/Makefile        |  20 ++++\n guest/README.rst      |  93 +++++++++++++++++\n guest/memnic-tester.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 394 insertions(+)\n create mode 100644 guest/Makefile\n create mode 100644 guest/README.rst\n create mode 100644 guest/memnic-tester.c",
    "diff": "diff --git a/guest/Makefile b/guest/Makefile\nnew file mode 100644\nindex 0000000..3c90350\n--- /dev/null\n+++ b/guest/Makefile\n@@ -0,0 +1,20 @@\n+ifeq ($(RTE_SDK),)\n+$(error \"Please define RTE_SDK environment variable\")\n+endif\n+\n+# Default target, can be overriden by command line or environment\n+ifeq ($(RTE_TARGET),)\n+$(error \"Please define RTE_TARGET environment variable\")\n+endif\n+\n+include $(RTE_SDK)/mk/rte.vars.mk\n+\n+COMMON_INC_OPT = -I $(PWD)/../common\n+\n+APP = memnic-tester\n+\n+CFLAGS += -Wall -g -O3 $(COMMON_INC_OPT)\n+\n+SRCS-y := memnic-tester.c\n+\n+include $(RTE_SDK)/mk/rte.extapp.mk\ndiff --git a/guest/README.rst b/guest/README.rst\nnew file mode 100644\nindex 0000000..eb230b0\n--- /dev/null\n+++ b/guest/README.rst\n@@ -0,0 +1,93 @@\n+.. Copyright 2014 NEC\n+   Redistribution and use in source and binary forms, with or without\n+   modification, are permitted provided that the following conditions\n+   are met:\n+   - Redistributions of source code must retain the above copyright\n+     notice, this list of conditions and the following disclaimer.\n+   - Redistributions in binary form must reproduce the above copyright\n+     notice, this list of conditions and the following disclaimer in\n+     the documentation and/or other materials provided with the\n+     distribution.\n+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n+   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n+   COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n+   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n+   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n+   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n+   OF THE POSSIBILITY OF SUCH DAMAGE.\n+\n+MEMNIC TESTER\n+=============\n+\n+DESCRIPTION\n+-----------\n+\n+It is a simple benchmark test of MEMNIC PMD in guest.\n+\n+It have two threads, one thread produces and consumes packets,\n+other thread receives packets and directly transmits the received\n+packets back in MEMNIC interface. This evaluates MEMNIC PMD running cost.\n+\n+memnic-tester is a benchmark tool to measure performance of MEMNIC PMD itself.\n+The master thread forward packets with Rx and Tx bursts.\n+The slave thread fills and clears packets in the lightest way. It doesn't get\n+packet out of VM because it would increase jitter and hide PMD performance.\n+Throughput (number of forwarded packets per second) is given for each frame size.\n+\n+The master thread does rx_burst and tx_burst through MEMNIC PMD.\n+            +---------+\n+            | master  |\n+            +---------+\n+     rx_burst ^     | tx_burst\n+              |     V\n+          +------+------+\n+          |  up  | down | MEMNIC shared memory\n+          +------+------+\n+     set flag ^     | unset flag\n+              |     V\n+            +---------+\n+            |  slave  |\n+            +---------+\n+The slave thread emulates packet-in/out by setting flag on/off.\n+\n+Like RFC2544, evaluations are performed the below frame size packets.\n+  64, 128, 256, 512, 1024, 1280, 1518\n+\n+It shows the result as packets per second number of each frame size.\n+\n+HOW TO BUILD\n+------------\n+\n+DPDK and DPDK MEMNIC PMD must be built first like below::\n+\n+  cd /path/to/dpdk\n+  make install T=x86_64-native-linuxapp-gcc\n+  cd /path/to/memnic/pmd\n+  make RTE_INCLUDE=/path/to/dpdk/x86_64-native-linuxapp-gcc/include\n+  cd /path/to/memnic/guest\n+  make RTE_SDK=/path/to/dpdk RTE_TARGET=x86_64-native-linuxapp-gcc\n+\n+The file ``memnic-tester`` is generated under ``build`` directory.\n+\n+HOW TO RUN\n+----------\n+\n+On host the MEMNIC device must be initialized with proper program.\n+``memnic-host-sim`` should take care about it::\n+\n+  [host]# ./memnic-host-sim /dev/shm/ivshm\n+\n+Then stop the ``memnic-host-sim`` by CTRL-C.\n+\n+Run ``memnic-tester`` in guest::\n+\n+  [guest]# echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages\n+  [guest]# mount -t hugetlbfs nodev /mnt/huge\n+  [guest]# ./build/memnic-tester -c 0x6 -n 4 -d /path/to/librte_pmd_memnic_copy.so\n+\n+The result shows how much packets are handled by MEMNIC PMD per second.\ndiff --git a/guest/memnic-tester.c b/guest/memnic-tester.c\nnew file mode 100644\nindex 0000000..10e304b\n--- /dev/null\n+++ b/guest/memnic-tester.c\n@@ -0,0 +1,281 @@\n+/*\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2014 NEC All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ *\n+ */\n+\n+#include <rte_eal.h>\n+#include <rte_ethdev.h>\n+#include <rte_pci.h>\n+#include <rte_mempool.h>\n+#include <rte_mbuf.h>\n+#include <rte_malloc.h>\n+#include <rte_cycles.h>\n+#include <rte_byteorder.h>\n+#include <rte_ether.h>\n+#include <rte_ring.h>\n+\n+#include \"memnic.h\"\n+\n+#define PKTS_BURST_SIZE\t(32)\n+#define TEST_DURATION\t(10)\n+\n+static const struct rte_eth_conf port_conf = {\n+\t.rxmode = {\n+\t\t.jumbo_frame = 0,\n+\t},\n+\t.txmode = {\n+\t\t.mq_mode = ETH_MQ_TX_NONE,\n+\t},\n+};\n+\n+static const struct rte_eth_rxconf rx_conf = {\n+\t.rx_thresh = {\n+\t\t.pthresh = 8,\n+\t\t.hthresh = 8,\n+\t\t.wthresh = 4,\n+\t},\n+};\n+\n+static const struct rte_eth_txconf tx_conf = {\n+\t.tx_thresh = {\n+\t\t.pthresh = 36,\n+\t\t.hthresh = 0,\n+\t\t.wthresh = 0,\n+\t},\n+};\n+\n+static const unsigned nr_rxdesc = 128;\n+static const unsigned nr_txdesc = 512;\n+\n+static struct rte_mempool *mempool;\n+\n+static struct memnic_area *memnic;\n+\n+static void init_port(unsigned portid)\n+{\n+\tif (rte_eth_dev_configure(portid, 1, 1, &port_conf) < 0) {\n+\t\trte_exit(EXIT_FAILURE, \"failed to configure port %u\\n\",\n+\t\t\tportid);\n+\t}\n+\tif (rte_eth_rx_queue_setup(portid, 0, nr_rxdesc,\n+\t\t\trte_eth_dev_socket_id(portid), &rx_conf,\n+\t\t\tmempool) < 0) {\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\"failed to configure rx queue port %u\\n\",\n+\t\t\tportid);\n+\t}\n+\tif (rte_eth_tx_queue_setup(portid, 0, nr_txdesc,\n+\t\t\trte_eth_dev_socket_id(portid), &tx_conf) < 0) {\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\"failed to configure tx queue port %u\\n\",\n+\t\t\tportid);\n+\t}\n+\n+\trte_eth_promiscuous_enable(portid);\n+}\n+\n+static void reset_memnic(void)\n+{\n+\tstruct memnic_header *hdr = &memnic->hdr;\n+\tstruct memnic_data *up = &memnic->up;\n+\tstruct memnic_data *down = &memnic->down;\n+\tint i;\n+\n+\t/* prepare packet data */\n+\tfor (i = 0; i < MEMNIC_NR_PACKET; i++) {\n+\t\tstruct memnic_packet *p = &up->packets[i];\n+\n+\t\tp->status = MEMNIC_PKT_ST_FREE;\n+\t\tp->len = 60; /* short packet */\n+\n+\t\t/* don't care about content */\n+\t}\n+\n+\t/* clear packet data */\n+\tfor (i = 0; i < MEMNIC_NR_PACKET; i++) {\n+\t\tstruct memnic_packet *p = &down->packets[i];\n+\n+\t\tp->status = MEMNIC_PKT_ST_FREE;\n+\t}\n+\n+\t/* use default framesz */\n+\thdr->framesz = MEMNIC_MAX_FRAME_LEN;\n+\n+\trte_compiler_barrier();\n+\n+\thdr->reset = 0;\n+\thdr->valid = 1;\n+}\n+\n+static void slave(void)\n+{\n+\tstruct memnic_header *hdr = &memnic->hdr;\n+\tint up_idx, down_idx;\n+\tuint64_t hz = rte_get_tsc_hz(), next;\n+\tuint64_t count;\n+\t/* RFC2544 like */\n+\tuint32_t testset[] = {64, 128, 256, 512, 1024, 1280, 1518};\n+\tint n, nr_tests = sizeof(testset) / sizeof(uint32_t);\n+\n+\t/* wait to turn reset flag on */\n+\twhile (hdr->reset == 0)\n+\t\trte_pause();\n+\n+\t/* wait a sec to confirm no one handles this MEMNIC in host side */\n+\tnext = rte_rdtsc() + hz;\n+\twhile (next < rte_rdtsc()) {\n+\t\tif (ACCESS_ONCE(hdr->valid))\n+\t\t\trte_exit(EXIT_FAILURE, \"MEMNIC is active\\n\");\n+\t}\n+\n+\treset_memnic();\n+\n+\tup_idx = down_idx = 0;\n+\n+\tfor (n = 0; n < nr_tests; n++) {\n+\t\tstruct memnic_data *up = &memnic->up;\n+\t\tstruct memnic_data *down = &memnic->down;\n+\t\tstruct memnic_packet *p;\n+\t\tint i;\n+\n+\t\t/* prepare incoming packet */\n+\t\tfor (i = 0; i < MEMNIC_NR_PACKET; i++) {\n+\t\t\tp = &up->packets[i];\n+\t\t\tp->len = testset[n] - 4; /* remove FCS */\n+\t\t}\n+\n+\t\tcount = 0;\n+\t\tnext = rte_rdtsc() + hz * TEST_DURATION;\n+\t\twhile (next > rte_rdtsc()) {\n+\t\t\t/* put packets */\n+\t\t\tfor (i = 0; i < PKTS_BURST_SIZE; i++) {\n+xmit_retry:\n+\t\t\t\tp = &up->packets[up_idx];\n+\t\t\t\tif (ACCESS_ONCE(p->status) != MEMNIC_PKT_ST_FREE)\n+\t\t\t\t\tgoto xmit_retry;\n+\t\t\t\tif (++up_idx >= MEMNIC_NR_PACKET)\n+\t\t\t\t\tup_idx = 0;\n+\t\t\t\tp->status = MEMNIC_PKT_ST_FILLED;\n+\t\t\t}\n+\t\t\t/* get packets */\n+\t\t\tfor (i = 0; i < PKTS_BURST_SIZE; i++) {\n+recv_retry:\n+\t\t\t\tp = &down->packets[down_idx];\n+\t\t\t\tif (ACCESS_ONCE(p->status) != MEMNIC_PKT_ST_FILLED)\n+\t\t\t\t\tgoto recv_retry;\n+\t\t\t\tif (++down_idx >= MEMNIC_NR_PACKET)\n+\t\t\t\t\tdown_idx = 0;\n+\t\t\t\tp->status = MEMNIC_PKT_ST_FREE;\n+\t\t\t}\n+\t\t\t++count;\n+\t\t}\n+\t\tprintf(\"frame size %u throughput %lu pps\\n\",\n+\t\t\ttestset[n], (count * PKTS_BURST_SIZE) / TEST_DURATION);\n+\t}\n+\n+\t/* finish the test */\n+\trte_exit(EXIT_SUCCESS, \"Test done\\n\");\n+}\n+\n+static void master(void)\n+{\n+\tif (rte_eth_dev_start(0) < 0)\n+\t\trte_exit(EXIT_FAILURE, \"failed to start device\\n\");\n+\n+\t/* infinity loop back */\n+\tfor (;;) {\n+\t\tstruct rte_mbuf *bufs[PKTS_BURST_SIZE];\n+\t\tint rx, tx;\n+\n+\t\trx = rte_eth_rx_burst(0, 0, bufs, PKTS_BURST_SIZE);\n+\t\ttx = 0;\n+\t\twhile (rx != tx)\n+\t\t\ttx += rte_eth_tx_burst(0, 0, &bufs[tx], rx - tx);\n+\t}\n+}\n+\n+static int lcore_main(void *p)\n+{\n+\tif (rte_lcore_id() == rte_get_master_lcore())\n+\t\tmaster();\n+\telse\n+\t\tslave();\n+\n+\t/* never reach here */\n+\treturn 0;\n+}\n+\n+int main(int argc, char **argv)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tstruct memnic_adapter {\n+\t\tstruct memnic_area *nic;\n+\t} *adapter;\n+\tint ret;\n+\tunsigned lcore_id;\n+\n+\tret = rte_eal_init(argc, argv);\n+\tif (ret < 0)\n+\t\texit(1);\n+\n+\targc -= ret;\n+\targv += ret;\n+\n+\tif (rte_lcore_count() != 2)\n+\t\trte_exit(EXIT_FAILURE, \"Need just 2 lcores\\n\");\n+\n+\t/* alloc mempool */\n+\tmempool = rte_mempool_create(\"pkt_mempool\", 8192, 2048, 32,\n+\t\t\t\tsizeof(struct rte_pktmbuf_pool_private),\n+\t\t\t\trte_pktmbuf_pool_init, NULL,\n+\t\t\t\trte_pktmbuf_init, NULL,\n+\t\t\t\trte_socket_id(), 0);\n+\n+\tif (rte_eal_pci_probe() < 0)\n+\t\trte_exit(EXIT_FAILURE, \"failed to probe PCI\\n\");\n+\n+\t/* get MEMNIC data from ether device */\n+\tdev = &rte_eth_devices[0];\n+\tadapter = (struct memnic_adapter *)(dev->data->dev_private);\n+\n+\tmemnic = adapter->nic;\n+\n+\tif (memnic->hdr.magic != MEMNIC_MAGIC)\n+\t\trte_exit(EXIT_FAILURE, \"Not a MEMNIC device\\n\");\n+\n+\t/* port 0 must initialize MEMNIC */\n+\tinit_port(0);\n+\n+\trte_eal_mp_remote_launch(lcore_main, NULL, CALL_MASTER);\n+\tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n+\t\tif (rte_eal_wait_lcore(lcore_id) < 0)\n+\t\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n",
    "prefixes": [
        "dpdk-dev",
        "memnic",
        "v2",
        "1/7"
    ]
}