get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 40891,
    "url": "http://patches.dpdk.org/api/patches/40891/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1528477766-15788-8-git-send-email-anoob.joseph@caviumnetworks.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": "<1528477766-15788-8-git-send-email-anoob.joseph@caviumnetworks.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1528477766-15788-8-git-send-email-anoob.joseph@caviumnetworks.com",
    "date": "2018-06-08T17:09:18",
    "name": "[dpdk-dev,07/15] examples/l2fwd: move dataplane code to new file",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "045d20b424a294e9c08cfe9224d75ac62001f9bb",
    "submitter": {
        "id": 893,
        "url": "http://patches.dpdk.org/api/people/893/?format=api",
        "name": "Anoob Joseph",
        "email": "anoob.joseph@caviumnetworks.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/1528477766-15788-8-git-send-email-anoob.joseph@caviumnetworks.com/mbox/",
    "series": [
        {
            "id": 60,
            "url": "http://patches.dpdk.org/api/series/60/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=60",
            "date": "2018-06-08T17:09:11",
            "name": "preparing l2fwd for eventmode additions",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/60/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/40891/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/40891/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9B3DC1CFF1;\n\tFri,  8 Jun 2018 19:10:40 +0200 (CEST)",
            "from NAM01-BY2-obe.outbound.protection.outlook.com\n\t(mail-by2nam01on0041.outbound.protection.outlook.com [104.47.34.41])\n\tby dpdk.org (Postfix) with ESMTP id E9F271BB93\n\tfor <dev@dpdk.org>; Fri,  8 Jun 2018 19:10:38 +0200 (CEST)",
            "from ajoseph83.caveonetworks.com.caveonetworks.com (115.113.156.2)\n\tby SN6PR07MB4911.namprd07.prod.outlook.com (2603:10b6:805:3c::29)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.15;\n\tFri, 8 Jun 2018 17:10:34 +0000"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=pcUnaW/nKXCCf2j8pzi6It/1P6mvxhNgOlwdX4uYHfs=;\n\tb=B6Pb+fF5/AiHNDHw572upYLhbeLbxCbr1uR7v02GwUQr1ppcpdvKpNvzGv2khK+jPaPt7oM4hQqFJM58yMMvRGjVdV2fpAP8desa4dRw45fCw4EWRXqp5BYHCDZgWWulC510HuJUdTzvUWfUcxqy3faxMU3CzuzHs8FW1RkIqnw=",
        "Authentication-Results": "spf=none (sender IP is )\n\tsmtp.mailfrom=Anoob.Joseph@cavium.com; ",
        "From": "Anoob Joseph <anoob.joseph@caviumnetworks.com>",
        "To": "Bruce Richardson <bruce.richardson@intel.com>,\n\tPablo de Lara <pablo.de.lara.guarch@intel.com>",
        "Cc": "Anoob Joseph <anoob.joseph@caviumnetworks.com>,\n\tJerin Jacob <jerin.jacob@caviumnetworks.com>,\n\tNarayana Prasad <narayanaprasad.athreya@caviumnetworks.com>, dev@dpdk.org",
        "Date": "Fri,  8 Jun 2018 22:39:18 +0530",
        "Message-Id": "<1528477766-15788-8-git-send-email-anoob.joseph@caviumnetworks.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com>",
        "References": "<1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[115.113.156.2]",
        "X-ClientProxiedBy": "BM1PR01CA0111.INDPRD01.PROD.OUTLOOK.COM\n\t(2603:1096:b00::27)\n\tTo SN6PR07MB4911.namprd07.prod.outlook.com\n\t(2603:10b6:805:3c::29)",
        "X-MS-PublicTrafficType": "Email",
        "X-Microsoft-Antispam": "UriScan:; BCL:0; PCL:0;\n\tRULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);\n\tSRVR:SN6PR07MB4911; ",
        "X-Microsoft-Exchange-Diagnostics": [
            "1; SN6PR07MB4911;\n\t3:SHxPtwJSWbTnjgHzGTLi7iGSWNIZFM9dGveaoHpHjCdMgaZrxgjIKtfFfhKR82o2sqNZQ6Ry3CvzKhOSJsSiH804pacF+e3alPm8gO4ehFbqmoicdnjUc5z4+X+MqvLiMPZb1a7YkxsV2184Mm8JCOGfgF4sLF6+mVjGeOAY4chfP7llGMuV2haXKL7Px2EsP0PR8/8gW+816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mx+znDXy4Oatk/MMBAf5ZVOZVuF7WbXRWozlcZZTIhz/ZmU1AK/mjDATEVhLiPerlxWFbfw/zsqJHFjmG2VxqTd0IzQT9ip36cybCxhSaXGT2F1zK1s88vjApX1L3gsvpMGnQ96XBKtPbxX8yh8szM4RNcOqEh+Lc0ia22K0wtifrlBb0k7mLYTe73B3wX1VUq6/J+rUrsQqlElaPg==;\n\t5:NLxhKpf275EaU1kRJfF2h/n+EgUcoFiR54V+68Ceo4JPliRYh8MdqBpkXMMbE0qs4yE9Itd2jWB8rlKJFmMAE+b5uMuJ5jS+00EKARBLP34NZwvfFzpMd3VGSKqJ0iT3TAoniVKYeTyoMS5Edn4tupdJEIkq2jL6XsWIaDOXydQ=;\n\t24:MaaSaTIMZ9A1cSoGgIZXJehnjM81GNJ9Ca+AhNsZNb52R2MACIuQ/xTiqX//iOjzrGmiIPC1LgCyWQd9kV1yyNHpGfmcjF2BBL8WJLHXNw4=",
            "1; SN6PR07MB4911;\n\t7:BKa/dQAvbq+jX2uIBs9aVJv1ceBz8XD0M+HNdHOJhYUWHc55BaxZDrRLuB2NhPVNDKBykVxZSvTMB3G1UR07KJYk9hm1n7n36PSimPQ2OPwXQTKVx6gSakmg6wG8/ZyfSCiE/kkgcHNqQZr5gJfeqEnKKUwkcPiR0c9qkIvk0WwMVsUsUy8eWh07k9tDrkW8mgWuJPWIMIWs8RbE++qycqrkPUxqubeIOlOKEX0I+qpcXqZ1ME2iqD3SsKT2IbNZ"
        ],
        "X-MS-TrafficTypeDiagnostic": "SN6PR07MB4911:",
        "X-Microsoft-Antispam-PRVS": "<SN6PR07MB49111ED444B9500256C36E18F87B0@SN6PR07MB4911.namprd07.prod.outlook.com>",
        "X-Exchange-Antispam-Report-Test": "UriScan:;",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-Exchange-Antispam-Report-CFA-Test": "BCL:0; PCL:0;\n\tRULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);\n\tSRVR:SN6PR07MB4911; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4911; ",
        "X-Forefront-PRVS": "06973FFAD3",
        "X-Forefront-Antispam-Report": "SFV:NSPM;\n\tSFS:(10009020)(366004)(39380400002)(39860400002)(376002)(396003)(346002)(199004)(189003)(6666003)(4326008)(54906003)(76176011)(5660300001)(25786009)(48376002)(50466002)(59450400001)(446003)(386003)(186003)(11346002)(16526019)(2616005)(42882007)(44832011)(51416003)(476003)(66066001)(110136005)(36756003)(316002)(55236004)(2906002)(7736002)(81156014)(81166006)(8936002)(50226002)(106356001)(105586002)(68736007)(52116002)(26005)(956004)(8676002)(305945005)(53936002)(6512007)(47776003)(486006)(478600001)(6486002)(6116002)(72206003)(3846002)(16586007)(6506007)(97736004);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4911;\n\tH:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None;\n\tLANG:en; PTR:InfoNoRecords; A:1; MX:1; ",
        "Received-SPF": "None (protection.outlook.com: cavium.com does not designate\n\tpermitted sender hosts)",
        "X-Microsoft-Antispam-Message-Info": "EsuuzFgU6nKJNi1NCn91n62XqmfUrjsM0LMQIOVBOSTFkD13lA3iX6GssfuFyYA1wJBx3Py4OIe5v89zF9POVPriD/YlgE9fgFvT0D6GJH/X6VoAXPwsRqrZdcUM5NOCh2IO6FYMQDCS5Tq1AIYHMvSE5PmJgdyz1txmwvc0kuIg2uZOKP7zcxAhRSKXq3Hn",
        "SpamDiagnosticOutput": "1:99",
        "SpamDiagnosticMetadata": "NSPM",
        "X-MS-Office365-Filtering-Correlation-Id": "57b5bfc0-9e7f-4e79-20cd-08d5cd62c103",
        "X-OriginatorOrg": "caviumnetworks.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "08 Jun 2018 17:10:34.8984\n\t(UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "57b5bfc0-9e7f-4e79-20cd-08d5cd62c103",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted",
        "X-MS-Exchange-CrossTenant-Id": "711e4ccf-2e9b-4bcf-a551-4094005b6194",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "SN6PR07MB4911",
        "Subject": "[dpdk-dev] [PATCH 07/15] examples/l2fwd: move dataplane code to new\n\tfile",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://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": "<https://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: Anoob Joseph <anoob.joseph@caviumnetworks.com>\n---\n examples/l2fwd/Makefile       |   1 +\n examples/l2fwd/l2fwd_worker.c | 233 ++++++++++++++++++++++++++++++++++++++++++\n examples/l2fwd/l2fwd_worker.h |  10 ++\n examples/l2fwd/main.c         | 191 +---------------------------------\n 4 files changed, 245 insertions(+), 190 deletions(-)\n create mode 100644 examples/l2fwd/l2fwd_worker.c\n create mode 100644 examples/l2fwd/l2fwd_worker.h",
    "diff": "diff --git a/examples/l2fwd/Makefile b/examples/l2fwd/Makefile\nindex a8a47ad..24d1e4e 100644\n--- a/examples/l2fwd/Makefile\n+++ b/examples/l2fwd/Makefile\n@@ -6,6 +6,7 @@ APP = l2fwd\n \n # all source are stored in SRCS-y\n SRCS-y := main.c\n+SRCS-y += l2fwd_worker.c\n \n # Build using pkg-config variables if possible\n $(shell pkg-config --exists libdpdk)\ndiff --git a/examples/l2fwd/l2fwd_worker.c b/examples/l2fwd/l2fwd_worker.c\nnew file mode 100644\nindex 0000000..1f97911\n--- /dev/null\n+++ b/examples/l2fwd/l2fwd_worker.c\n@@ -0,0 +1,233 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2016 Intel Corporation\n+ * Copyright(c) 2018 Cavium, Inc\n+ */\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <string.h>\n+#include <stdint.h>\n+#include <inttypes.h>\n+#include <sys/types.h>\n+#include <sys/queue.h>\n+#include <netinet/in.h>\n+#include <setjmp.h>\n+#include <stdarg.h>\n+#include <ctype.h>\n+#include <errno.h>\n+#include <getopt.h>\n+#include <signal.h>\n+#include <stdbool.h>\n+\n+#include <rte_common.h>\n+#include <rte_log.h>\n+#include <rte_malloc.h>\n+#include <rte_memory.h>\n+#include <rte_memcpy.h>\n+#include <rte_eal.h>\n+#include <rte_launch.h>\n+#include <rte_atomic.h>\n+#include <rte_cycles.h>\n+#include <rte_prefetch.h>\n+#include <rte_lcore.h>\n+#include <rte_per_lcore.h>\n+#include <rte_branch_prediction.h>\n+#include <rte_interrupts.h>\n+#include <rte_random.h>\n+#include <rte_debug.h>\n+#include <rte_ether.h>\n+#include <rte_ethdev.h>\n+#include <rte_mempool.h>\n+#include <rte_mbuf.h>\n+\n+#include \"l2fwd_common.h\"\n+#include \"l2fwd_worker.h\"\n+\n+/* Print out statistics on packets dropped */\n+static void\n+print_stats(void)\n+{\n+\tuint64_t total_packets_dropped, total_packets_tx, total_packets_rx;\n+\tunsigned portid;\n+\n+\ttotal_packets_dropped = 0;\n+\ttotal_packets_tx = 0;\n+\ttotal_packets_rx = 0;\n+\n+\tconst char clr[] = { 27, '[', '2', 'J', '\\0' };\n+\tconst char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\\0' };\n+\n+\t\t/* Clear screen and move to top left */\n+\tprintf(\"%s%s\", clr, topLeft);\n+\n+\tprintf(\"\\nPort statistics ====================================\");\n+\n+\tfor (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {\n+\t\t/* skip disabled ports */\n+\t\tif ((l2fwd_enabled_port_mask & (1 << portid)) == 0)\n+\t\t\tcontinue;\n+\t\tprintf(\"\\nStatistics for port %u ------------------------------\"\n+\t\t\t   \"\\nPackets sent: %24\"PRIu64\n+\t\t\t   \"\\nPackets received: %20\"PRIu64\n+\t\t\t   \"\\nPackets dropped: %21\"PRIu64,\n+\t\t\t   portid,\n+\t\t\t   port_statistics[portid].tx,\n+\t\t\t   port_statistics[portid].rx,\n+\t\t\t   port_statistics[portid].dropped);\n+\n+\t\ttotal_packets_dropped += port_statistics[portid].dropped;\n+\t\ttotal_packets_tx += port_statistics[portid].tx;\n+\t\ttotal_packets_rx += port_statistics[portid].rx;\n+\t}\n+\tprintf(\"\\nAggregate statistics ===============================\"\n+\t\t   \"\\nTotal packets sent: %18\"PRIu64\n+\t\t   \"\\nTotal packets received: %14\"PRIu64\n+\t\t   \"\\nTotal packets dropped: %15\"PRIu64,\n+\t\t   total_packets_tx,\n+\t\t   total_packets_rx,\n+\t\t   total_packets_dropped);\n+\tprintf(\"\\n====================================================\\n\");\n+}\n+\n+static void\n+l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid)\n+{\n+\tstruct ether_hdr *eth;\n+\tvoid *tmp;\n+\n+\teth = rte_pktmbuf_mtod(m, struct ether_hdr *);\n+\n+\t/* 02:00:00:00:00:xx */\n+\ttmp = &eth->d_addr.addr_bytes[0];\n+\t*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40);\n+\n+\t/* src addr */\n+\tether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], &eth->s_addr);\n+}\n+\n+static void\n+l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid)\n+{\n+\tunsigned dst_port;\n+\tint sent;\n+\tstruct rte_eth_dev_tx_buffer *buffer;\n+\n+\tdst_port = l2fwd_dst_ports[portid];\n+\n+\tif (mac_updating)\n+\t\tl2fwd_mac_updating(m, dst_port);\n+\n+\tbuffer = tx_buffer[dst_port];\n+\tsent = rte_eth_tx_buffer(dst_port, 0, buffer, m);\n+\tif (sent)\n+\t\tport_statistics[dst_port].tx += sent;\n+}\n+\n+/* main processing loop */\n+static void\n+l2fwd_main_loop(void)\n+{\n+\tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n+\tstruct rte_mbuf *m;\n+\tint sent;\n+\tunsigned lcore_id;\n+\tunsigned master_core_id;\n+\tuint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc;\n+\tunsigned i, j, portid, nb_rx;\n+\tstruct lcore_queue_conf *qconf;\n+\tconst uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1)\n+\t\t\t/ US_PER_S * BURST_TX_DRAIN_US;\n+\tstruct rte_eth_dev_tx_buffer *buffer;\n+\n+\tprev_tsc = 0;\n+\ttimer_tsc = 0;\n+\n+\tlcore_id = rte_lcore_id();\n+\tqconf = &lcore_queue_conf[lcore_id];\n+\n+\tif (qconf->n_rx_port == 0) {\n+\t\tRTE_LOG(INFO, L2FWD, \"lcore %u has nothing to do\\n\", lcore_id);\n+\t\treturn;\n+\t}\n+\n+\tRTE_LOG(INFO, L2FWD, \"entering main loop on lcore %u\\n\", lcore_id);\n+\n+\tfor (i = 0; i < qconf->n_rx_port; i++) {\n+\n+\t\tportid = qconf->rx_port_list[i];\n+\t\tRTE_LOG(INFO, L2FWD, \" -- lcoreid=%u portid=%u\\n\", lcore_id,\n+\t\t\tportid);\n+\n+\t}\n+\n+\tmaster_core_id = rte_get_master_lcore();\n+\n+\twhile (!force_quit) {\n+\n+\t\tcur_tsc = rte_rdtsc();\n+\n+\t\t/*\n+\t\t * TX burst queue drain\n+\t\t */\n+\t\tdiff_tsc = cur_tsc - prev_tsc;\n+\t\tif (unlikely(diff_tsc > drain_tsc)) {\n+\n+\t\t\tfor (i = 0; i < qconf->n_rx_port; i++) {\n+\n+\t\t\t\tportid =\n+\t\t\t\t\tl2fwd_dst_ports[qconf->rx_port_list[i]];\n+\t\t\t\tbuffer = tx_buffer[portid];\n+\n+\t\t\t\tsent = rte_eth_tx_buffer_flush(portid, 0,\n+\t\t\t\t\t\tbuffer);\n+\t\t\t\tif (sent)\n+\t\t\t\t\tport_statistics[portid].tx += sent;\n+\n+\t\t\t}\n+\n+\t\t\t/* if timer is enabled */\n+\t\t\tif (timer_period > 0) {\n+\n+\t\t\t\t/* advance the timer */\n+\t\t\t\ttimer_tsc += diff_tsc;\n+\n+\t\t\t\t/* if timer has reached its timeout */\n+\t\t\t\tif (unlikely(timer_tsc >= timer_period)) {\n+\n+\t\t\t\t\t/* do this only on master core */\n+\t\t\t\t\tif (lcore_id == master_core_id) {\n+\t\t\t\t\t\tprint_stats();\n+\t\t\t\t\t\t/* reset the timer */\n+\t\t\t\t\t\ttimer_tsc = 0;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tprev_tsc = cur_tsc;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Read packet from RX queues\n+\t\t */\n+\t\tfor (i = 0; i < qconf->n_rx_port; i++) {\n+\n+\t\t\tportid = qconf->rx_port_list[i];\n+\t\t\tnb_rx = rte_eth_rx_burst(portid, 0,\n+\t\t\t\t\t\t pkts_burst, MAX_PKT_BURST);\n+\n+\t\t\tport_statistics[portid].rx += nb_rx;\n+\n+\t\t\tfor (j = 0; j < nb_rx; j++) {\n+\t\t\t\tm = pkts_burst[j];\n+\t\t\t\trte_prefetch0(rte_pktmbuf_mtod(m, void *));\n+\t\t\t\tl2fwd_simple_forward(m, portid);\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n+int\n+l2fwd_launch_one_lcore(__attribute__((unused)) void *dummy)\n+{\n+\tl2fwd_main_loop();\n+\treturn 0;\n+}\ndiff --git a/examples/l2fwd/l2fwd_worker.h b/examples/l2fwd/l2fwd_worker.h\nnew file mode 100644\nindex 0000000..8971a6a\n--- /dev/null\n+++ b/examples/l2fwd/l2fwd_worker.h\n@@ -0,0 +1,10 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Cavium, Inc\n+ */\n+#ifndef _L2FWD_WORKER_H_\n+#define _L2FWD_WORKER_H_\n+\n+int\n+l2fwd_launch_one_lcore(__attribute__((unused)) void *dummy);\n+\n+#endif /* _L2FWD_WORKER_H_ */\ndiff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c\nindex bd48295..05f9d28 100644\n--- a/examples/l2fwd/main.c\n+++ b/examples/l2fwd/main.c\n@@ -40,6 +40,7 @@\n #include <rte_mbuf.h>\n \n #include \"l2fwd_common.h\"\n+#include \"l2fwd_worker.h\"\n \n static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;\n static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;\n@@ -59,196 +60,6 @@ static struct rte_eth_conf port_conf = {\n \n struct rte_mempool * l2fwd_pktmbuf_pool = NULL;\n \n-/* Print out statistics on packets dropped */\n-static void\n-print_stats(void)\n-{\n-\tuint64_t total_packets_dropped, total_packets_tx, total_packets_rx;\n-\tunsigned portid;\n-\n-\ttotal_packets_dropped = 0;\n-\ttotal_packets_tx = 0;\n-\ttotal_packets_rx = 0;\n-\n-\tconst char clr[] = { 27, '[', '2', 'J', '\\0' };\n-\tconst char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\\0' };\n-\n-\t\t/* Clear screen and move to top left */\n-\tprintf(\"%s%s\", clr, topLeft);\n-\n-\tprintf(\"\\nPort statistics ====================================\");\n-\n-\tfor (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {\n-\t\t/* skip disabled ports */\n-\t\tif ((l2fwd_enabled_port_mask & (1 << portid)) == 0)\n-\t\t\tcontinue;\n-\t\tprintf(\"\\nStatistics for port %u ------------------------------\"\n-\t\t\t   \"\\nPackets sent: %24\"PRIu64\n-\t\t\t   \"\\nPackets received: %20\"PRIu64\n-\t\t\t   \"\\nPackets dropped: %21\"PRIu64,\n-\t\t\t   portid,\n-\t\t\t   port_statistics[portid].tx,\n-\t\t\t   port_statistics[portid].rx,\n-\t\t\t   port_statistics[portid].dropped);\n-\n-\t\ttotal_packets_dropped += port_statistics[portid].dropped;\n-\t\ttotal_packets_tx += port_statistics[portid].tx;\n-\t\ttotal_packets_rx += port_statistics[portid].rx;\n-\t}\n-\tprintf(\"\\nAggregate statistics ===============================\"\n-\t\t   \"\\nTotal packets sent: %18\"PRIu64\n-\t\t   \"\\nTotal packets received: %14\"PRIu64\n-\t\t   \"\\nTotal packets dropped: %15\"PRIu64,\n-\t\t   total_packets_tx,\n-\t\t   total_packets_rx,\n-\t\t   total_packets_dropped);\n-\tprintf(\"\\n====================================================\\n\");\n-}\n-\n-static void\n-l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid)\n-{\n-\tstruct ether_hdr *eth;\n-\tvoid *tmp;\n-\n-\teth = rte_pktmbuf_mtod(m, struct ether_hdr *);\n-\n-\t/* 02:00:00:00:00:xx */\n-\ttmp = &eth->d_addr.addr_bytes[0];\n-\t*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40);\n-\n-\t/* src addr */\n-\tether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], &eth->s_addr);\n-}\n-\n-static void\n-l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid)\n-{\n-\tunsigned dst_port;\n-\tint sent;\n-\tstruct rte_eth_dev_tx_buffer *buffer;\n-\n-\tdst_port = l2fwd_dst_ports[portid];\n-\n-\tif (mac_updating)\n-\t\tl2fwd_mac_updating(m, dst_port);\n-\n-\tbuffer = tx_buffer[dst_port];\n-\tsent = rte_eth_tx_buffer(dst_port, 0, buffer, m);\n-\tif (sent)\n-\t\tport_statistics[dst_port].tx += sent;\n-}\n-\n-/* main processing loop */\n-static void\n-l2fwd_main_loop(void)\n-{\n-\tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n-\tstruct rte_mbuf *m;\n-\tint sent;\n-\tunsigned lcore_id;\n-\tunsigned master_core_id;\n-\tuint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc;\n-\tunsigned i, j, portid, nb_rx;\n-\tstruct lcore_queue_conf *qconf;\n-\tconst uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1)\n-\t\t\t/ US_PER_S * BURST_TX_DRAIN_US;\n-\tstruct rte_eth_dev_tx_buffer *buffer;\n-\n-\tprev_tsc = 0;\n-\ttimer_tsc = 0;\n-\n-\tlcore_id = rte_lcore_id();\n-\tqconf = &lcore_queue_conf[lcore_id];\n-\n-\tif (qconf->n_rx_port == 0) {\n-\t\tRTE_LOG(INFO, L2FWD, \"lcore %u has nothing to do\\n\", lcore_id);\n-\t\treturn;\n-\t}\n-\n-\tRTE_LOG(INFO, L2FWD, \"entering main loop on lcore %u\\n\", lcore_id);\n-\n-\tfor (i = 0; i < qconf->n_rx_port; i++) {\n-\n-\t\tportid = qconf->rx_port_list[i];\n-\t\tRTE_LOG(INFO, L2FWD, \" -- lcoreid=%u portid=%u\\n\", lcore_id,\n-\t\t\tportid);\n-\n-\t}\n-\n-\tmaster_core_id = rte_get_master_lcore();\n-\n-\twhile (!force_quit) {\n-\n-\t\tcur_tsc = rte_rdtsc();\n-\n-\t\t/*\n-\t\t * TX burst queue drain\n-\t\t */\n-\t\tdiff_tsc = cur_tsc - prev_tsc;\n-\t\tif (unlikely(diff_tsc > drain_tsc)) {\n-\n-\t\t\tfor (i = 0; i < qconf->n_rx_port; i++) {\n-\n-\t\t\t\tportid =\n-\t\t\t\t\tl2fwd_dst_ports[qconf->rx_port_list[i]];\n-\t\t\t\tbuffer = tx_buffer[portid];\n-\n-\t\t\t\tsent = rte_eth_tx_buffer_flush(portid, 0,\n-\t\t\t\t\t\tbuffer);\n-\t\t\t\tif (sent)\n-\t\t\t\t\tport_statistics[portid].tx += sent;\n-\n-\t\t\t}\n-\n-\t\t\t/* if timer is enabled */\n-\t\t\tif (timer_period > 0) {\n-\n-\t\t\t\t/* advance the timer */\n-\t\t\t\ttimer_tsc += diff_tsc;\n-\n-\t\t\t\t/* if timer has reached its timeout */\n-\t\t\t\tif (unlikely(timer_tsc >= timer_period)) {\n-\n-\t\t\t\t\t/* do this only on master core */\n-\t\t\t\t\tif (lcore_id == master_core_id) {\n-\t\t\t\t\t\tprint_stats();\n-\t\t\t\t\t\t/* reset the timer */\n-\t\t\t\t\t\ttimer_tsc = 0;\n-\t\t\t\t\t}\n-\t\t\t\t}\n-\t\t\t}\n-\n-\t\t\tprev_tsc = cur_tsc;\n-\t\t}\n-\n-\t\t/*\n-\t\t * Read packet from RX queues\n-\t\t */\n-\t\tfor (i = 0; i < qconf->n_rx_port; i++) {\n-\n-\t\t\tportid = qconf->rx_port_list[i];\n-\t\t\tnb_rx = rte_eth_rx_burst(portid, 0,\n-\t\t\t\t\t\t pkts_burst, MAX_PKT_BURST);\n-\n-\t\t\tport_statistics[portid].rx += nb_rx;\n-\n-\t\t\tfor (j = 0; j < nb_rx; j++) {\n-\t\t\t\tm = pkts_burst[j];\n-\t\t\t\trte_prefetch0(rte_pktmbuf_mtod(m, void *));\n-\t\t\t\tl2fwd_simple_forward(m, portid);\n-\t\t\t}\n-\t\t}\n-\t}\n-}\n-\n-static int\n-l2fwd_launch_one_lcore(__attribute__((unused)) void *dummy)\n-{\n-\tl2fwd_main_loop();\n-\treturn 0;\n-}\n-\n /* display usage */\n static void\n l2fwd_usage(const char *prgname)\n",
    "prefixes": [
        "dpdk-dev",
        "07/15"
    ]
}