get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 18082,
    "url": "http://patches.dpdk.org/api/patches/18082/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1481901316-48216-1-git-send-email-tomaszx.kulasek@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": "<1481901316-48216-1-git-send-email-tomaszx.kulasek@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1481901316-48216-1-git-send-email-tomaszx.kulasek@intel.com",
    "date": "2016-12-16T15:15:16",
    "name": "[dpdk-dev] performance-thread: add software packet type parsing",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "bb2e28dd5aa8fb8626b0575befab74afa7b3242d",
    "submitter": {
        "id": 155,
        "url": "http://patches.dpdk.org/api/people/155/?format=api",
        "name": "Tomasz Kulasek",
        "email": "tomaszx.kulasek@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/1481901316-48216-1-git-send-email-tomaszx.kulasek@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/18082/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/18082/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 9F726567A;\n\tFri, 16 Dec 2016 16:17:22 +0100 (CET)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 2886E5597\n\tfor <dev@dpdk.org>; Fri, 16 Dec 2016 16:17:20 +0100 (CET)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga102.fm.intel.com with ESMTP; 16 Dec 2016 07:15:43 -0800",
            "from unknown (HELO Sent) ([10.103.102.79])\n\tby orsmga002.jf.intel.com with SMTP; 16 Dec 2016 07:15:41 -0800",
            "by Sent (sSMTP sendmail emulation); Fri, 16 Dec 2016 16:15:20 +0100"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.33,358,1477983600\"; d=\"scan'208\";a=\"18997778\"",
        "From": "Tomasz Kulasek <tomaszx.kulasek@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 16 Dec 2016 16:15:16 +0100",
        "Message-Id": "<1481901316-48216-1-git-send-email-tomaszx.kulasek@intel.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "Subject": "[dpdk-dev] [PATCH] performance-thread: add software packet type\n\tparsing",
        "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": "Last changes in Niantic and Fortville NIC drivers causes that\nvector Rx path is chosen by default in l3fwd-thread application.\nThis path doesn't support propagation of hw packet type recognition\nto the packet_type field in mbuf, and packets cannot be classified\nproperly.\n\nThe approach to solve this problem is similar to the commit: 71a7e2424e07\n(\"examples/l3fwd: fix using packet type blindly\").\n\nTo use sw packet analizer, new command line option \"--parse-ptype\" is\nintroduced.\n\nSigned-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>\n---\n doc/guides/sample_app_ug/performance_thread.rst |    4 +\n examples/performance-thread/l3fwd-thread/main.c |  100 ++++++++++++++++++++++-\n 2 files changed, 101 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/doc/guides/sample_app_ug/performance_thread.rst b/doc/guides/sample_app_ug/performance_thread.rst\nindex d7d9b08..0a655af 100644\n--- a/doc/guides/sample_app_ug/performance_thread.rst\n+++ b/doc/guides/sample_app_ug/performance_thread.rst\n@@ -107,6 +107,7 @@ The application has a number of command line options::\n         --tx(lcore,thread)[,(lcore,thread)]\n         [--enable-jumbo] [--max-pkt-len PKTLEN]]  [--no-numa]\n         [--hash-entry-num] [--ipv6] [--no-lthreads] [--stat-lcore lcore]\n+        [--parse-ptype]\n \n Where:\n \n@@ -142,6 +143,9 @@ Where:\n * ``--stat-lcore``: optional, run CPU load stats collector on the specified\n   lcore.\n \n+* ``--parse-ptype:`` optional, set to use software to analyze packet type.\n+  Without this option, hardware will check the packet type.\n+\n The parameters of the ``--rx`` and ``--tx`` options are:\n \n * ``--rx`` parameters\ndiff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c\nindex fdc90b2..336f88c 100644\n--- a/examples/performance-thread/l3fwd-thread/main.c\n+++ b/examples/performance-thread/l3fwd-thread/main.c\n@@ -1,7 +1,7 @@\n /*-\n  *   BSD LICENSE\n  *\n- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n  *   All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n@@ -90,6 +90,64 @@\n #define APP_LOOKUP_METHOD             APP_LOOKUP_LPM\n #endif\n \n+static int\n+check_ptype(int portid)\n+{\n+\tint i, ret;\n+\tint ipv4 = 0, ipv6 = 0;\n+\n+\tret = rte_eth_dev_get_supported_ptypes(portid, RTE_PTYPE_L3_MASK, NULL,\n+\t\t\t0);\n+\tif (ret <= 0)\n+\t\treturn 0;\n+\n+\tuint32_t ptypes[ret];\n+\n+\tret = rte_eth_dev_get_supported_ptypes(portid, RTE_PTYPE_L3_MASK,\n+\t\t\tptypes, ret);\n+\tfor (i = 0; i < ret; ++i) {\n+\t\tif (ptypes[i] & RTE_PTYPE_L3_IPV4)\n+\t\t\tipv4 = 1;\n+\t\tif (ptypes[i] & RTE_PTYPE_L3_IPV6)\n+\t\t\tipv6 = 1;\n+\t}\n+\n+\tif (ipv4 && ipv6)\n+\t\treturn 1;\n+\n+\treturn 0;\n+}\n+\n+static inline void\n+parse_ptype(struct rte_mbuf *m)\n+{\n+\tstruct ether_hdr *eth_hdr;\n+\tuint32_t packet_type = RTE_PTYPE_UNKNOWN;\n+\tuint16_t ether_type;\n+\n+\teth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);\n+\tether_type = eth_hdr->ether_type;\n+\tif (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4))\n+\t\tpacket_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;\n+\telse if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6))\n+\t\tpacket_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;\n+\n+\tm->packet_type = packet_type;\n+}\n+\n+static uint16_t\n+cb_parse_ptype(__rte_unused uint8_t port, __rte_unused uint16_t queue,\n+\t\tstruct rte_mbuf *pkts[], uint16_t nb_pkts,\n+\t\t__rte_unused uint16_t max_pkts, __rte_unused void *user_param)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < nb_pkts; i++)\n+\t\tparse_ptype(pkts[i]);\n+\n+\treturn nb_pkts;\n+}\n+\n /*\n  *  When set to zero, simple forwaring path is eanbled.\n  *  When set to one, optimized forwarding path is enabled.\n@@ -170,8 +228,9 @@\n \n /* mask of enabled ports */\n static uint32_t enabled_port_mask;\n-static int promiscuous_on; /**< $et in promiscuous mode off by default. */\n+static int promiscuous_on; /**< Set in promiscuous mode off by default. */\n static int numa_on = 1;    /**< NUMA is enabled by default. */\n+static int parse_ptype_on;\n \n #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH)\n static int ipv6;           /**< ipv6 is false by default. */\n@@ -2610,6 +2669,7 @@ static inline __attribute__((always_inline)) uint16_t\n \t\t\"  [--rx (port,queue,lcore,thread)[,(port,queue,lcore,thread]]\"\n \t\t\"  [--tx (lcore,thread)[,(lcore,thread]]\"\n \t\t\"  [--enable-jumbo [--max-pkt-len PKTLEN]]\\n\"\n+\t\t\"  [--parse-ptype]\\n\\n\"\n \t\t\"  -p PORTMASK: hexadecimal bitmask of ports to configure\\n\"\n \t\t\"  -P : enable promiscuous mode\\n\"\n \t\t\"  --rx (port,queue,lcore,thread): rx queues configuration\\n\"\n@@ -2621,7 +2681,8 @@ static inline __attribute__((always_inline)) uint16_t\n \t\t\"  --enable-jumbo: enable jumbo frame\"\n \t\t\" which max packet len is PKTLEN in decimal (64-9600)\\n\"\n \t\t\"  --hash-entry-num: specify the hash entry number in hexadecimal to be setup\\n\"\n-\t\t\"  --no-lthreads: turn off lthread model\\n\",\n+\t\t\"  --no-lthreads: turn off lthread model\\n\"\n+\t\t\"  --parse-ptype: set to use software to analyze packet type\\n\\n\",\n \t\tprgname);\n }\n \n@@ -2840,6 +2901,7 @@ static int parse_max_pkt_len(const char *pktlen)\n #define CMD_LINE_OPT_ENABLE_JUMBO \"enable-jumbo\"\n #define CMD_LINE_OPT_HASH_ENTRY_NUM \"hash-entry-num\"\n #define CMD_LINE_OPT_NO_LTHREADS \"no-lthreads\"\n+#define CMD_LINE_OPT_PARSE_PTYPE \"parse-ptype\"\n \n /* Parse the argument given in the command line of the application */\n static int\n@@ -2859,6 +2921,7 @@ static int parse_max_pkt_len(const char *pktlen)\n \t\t{CMD_LINE_OPT_ENABLE_JUMBO, 0, 0, 0},\n \t\t{CMD_LINE_OPT_HASH_ENTRY_NUM, 1, 0, 0},\n \t\t{CMD_LINE_OPT_NO_LTHREADS, 0, 0, 0},\n+\t\t{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0},\n \t\t{NULL, 0, 0, 0}\n \t};\n \n@@ -2935,6 +2998,12 @@ static int parse_max_pkt_len(const char *pktlen)\n \t\t\t\tlthreads_on = 0;\n \t\t\t}\n \n+\t\t\tif (!strncmp(lgopts[option_index].name, CMD_LINE_OPT_PARSE_PTYPE,\n+\t\t\t\t\tsizeof(CMD_LINE_OPT_PARSE_PTYPE))) {\n+\t\t\t\tprintf(\"software packet type parsing enabled\\n\");\n+\t\t\t\tparse_ptype_on = 1;\n+\t\t\t}\n+\n \t\t\tif (!strncmp(lgopts[option_index].name, CMD_LINE_OPT_ENABLE_JUMBO,\n \t\t\t\tsizeof(CMD_LINE_OPT_ENABLE_JUMBO))) {\n \t\t\t\tstruct option lenopts = {\"max-pkt-len\", required_argument, 0,\n@@ -3623,6 +3692,31 @@ static void convert_ipv6_5tuple(struct ipv6_5tuple *key1,\n \t\t\trte_eth_promiscuous_enable(portid);\n \t}\n \n+\tfor (i = 0; i < n_rx_thread; i++) {\n+\t\tlcore_id = rx_thread[i].conf.lcore_id;\n+\t\tif (rte_lcore_is_enabled(lcore_id) == 0)\n+\t\t\tcontinue;\n+\n+\t\t/* check if hw packet type is supported */\n+\t\tfor (queue = 0; queue < rx_thread[i].n_rx_queue; ++queue) {\n+\t\t\tportid = rx_thread[i].rx_queue_list[queue].port_id;\n+\t\t\tqueueid = rx_thread[i].rx_queue_list[queue].queue_id;\n+\n+\t\t\tif (parse_ptype_on) {\n+\t\t\t\tif (!rte_eth_add_rx_callback(portid, queueid,\n+\t\t\t\t\t\tcb_parse_ptype, NULL))\n+\t\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t\t\"Failed to add rx callback: \"\n+\t\t\t\t\t\t\"port=%d\\n\", portid);\n+\t\t\t} else if (!check_ptype(portid))\n+\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t\"Port %d cannot parse packet type.\\n\\n\"\n+\t\t\t\t\t\"Please add --parse-ptype to use sw \"\n+\t\t\t\t\t\"packet type analyzer.\\n\\n\",\n+\t\t\t\t\tportid);\n+\t\t}\n+\t}\n+\n \tcheck_all_ports_link_status((uint8_t)nb_ports, enabled_port_mask);\n \n \tif (lthreads_on) {\n",
    "prefixes": [
        "dpdk-dev"
    ]
}