Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/20284/?format=api
https://patches.dpdk.org/api/patches/20284/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1486650334-34300-1-git-send-email-yong.liu@intel.com/", "project": { "id": 1, "url": "https://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": "<1486650334-34300-1-git-send-email-yong.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1486650334-34300-1-git-send-email-yong.liu@intel.com", "date": "2017-02-09T14:25:32", "name": "[dpdk-dev,v3,1/3] examples/ip_reassembly: add parse-ptype option", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "44ea0266b9edfd97690daa9660c7ef16045e2b71", "submitter": { "id": 17, "url": "https://patches.dpdk.org/api/people/17/?format=api", "name": "Marvin Liu", "email": "yong.liu@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1486650334-34300-1-git-send-email-yong.liu@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/20284/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/20284/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 40557AB08;\n\tThu, 9 Feb 2017 07:34:14 +0100 (CET)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 5A11769C3\n\tfor <dev@dpdk.org>; Thu, 9 Feb 2017 07:34:11 +0100 (CET)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga103.jf.intel.com with ESMTP; 08 Feb 2017 22:34:11 -0800", "from marvin-s2600gz.sh.intel.com ([10.239.129.187])\n\tby fmsmga001.fm.intel.com with ESMTP; 08 Feb 2017 22:34:09 -0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.35,349,1484035200\"; d=\"scan'208\";\n\ta=\"1105001113\"", "From": "Marvin Liu <yong.liu@intel.com>", "To": "dev@dpdk.org", "Cc": "Jianfeng Tan <jianfeng.tan@intel.com>,\n\tYong Liu <yong.liu@intel.com>", "Date": "Thu, 9 Feb 2017 22:25:32 +0800", "Message-Id": "<1486650334-34300-1-git-send-email-yong.liu@intel.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1485156509-4919-1-git-send-email-yong.liu@intel.com>", "References": "<1485156509-4919-1-git-send-email-yong.liu@intel.com>", "Subject": "[dpdk-dev] [PATCH v3 1/3] examples/ip_reassembly: add parse-ptype\n\toption", "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": "Add new option parse-ptype in this sample in case of pmd driver\nnot provide packet type info. If this option enabled, packet type\nwill be analyzed in Rx callback function.\n\nSigned-off-by: Jianfeng Tan <jianfeng.tan@intel.com>\nSigned-off-by: Yong Liu <yong.liu@intel.com>", "diff": "diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c\nindex 50fe422..82b6055 100644\n--- a/examples/ip_reassembly/main.c\n+++ b/examples/ip_reassembly/main.c\n@@ -155,6 +155,9 @@\n \n static int rx_queue_per_lcore = 1;\n \n+/* Parse packet type using rx callback and disabled by default */\n+static int parse_ptype;\n+\n struct mbuf_table {\n \tuint32_t len;\n \tuint32_t head;\n@@ -541,13 +544,15 @@ struct rte_lpm6_config lpm6_config = {\n {\n \tprintf(\"%s [EAL options] -- -p PORTMASK [-q NQ]\"\n \t\t\" [--max-pkt-len PKTLEN]\"\n-\t\t\" [--maxflows=<flows>] [--flowttl=<ttl>[(s|ms)]]\\n\"\n+\t\t\" [--maxflows=<flows>] [--flowttl=<ttl>[(s|ms)]]\"\n+\t\t\" [--parse-ptype]\\n\"\n \t\t\" -p PORTMASK: hexadecimal bitmask of ports to configure\\n\"\n \t\t\" -q NQ: number of RX queues per lcore\\n\"\n \t\t\" --maxflows=<flows>: optional, maximum number of flows \"\n \t\t\"supported\\n\"\n \t\t\" --flowttl=<ttl>[(s|ms)]: optional, maximum TTL for each \"\n-\t\t\"flow\\n\",\n+\t\t\"flow\\n\"\n+\t\t\" --parse-ptype: Set to use software to analyze packet type\\n\",\n \t\tprgname);\n }\n \n@@ -636,6 +641,7 @@ struct rte_lpm6_config lpm6_config = {\n \treturn n;\n }\n \n+#define CMD_LINE_OPT_PARSE_PTYPE \"parse-ptype\"\n /* Parse the argument given in the command line of the application */\n static int\n parse_args(int argc, char **argv)\n@@ -648,6 +654,7 @@ struct rte_lpm6_config lpm6_config = {\n \t\t{\"max-pkt-len\", 1, 0, 0},\n \t\t{\"maxflows\", 1, 0, 0},\n \t\t{\"flowttl\", 1, 0, 0},\n+\t\t{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0},\n \t\t{NULL, 0, 0, 0}\n \t};\n \n@@ -706,6 +713,13 @@ struct rte_lpm6_config lpm6_config = {\n \t\t\t\t}\n \t\t\t}\n \n+\t\t\tif (!strncmp(lgopts[option_index].name,\n+\t\t\t\t\tCMD_LINE_OPT_PARSE_PTYPE,\n+\t\t\t\t\tsizeof(CMD_LINE_OPT_PARSE_PTYPE))) {\n+\t\t\t\tprintf(\"soft parse-ptype is enabled\\n\");\n+\t\t\t\tparse_ptype = 1;\n+\t\t\t}\n+\n \t\t\tbreak;\n \n \t\tdefault:\n@@ -730,6 +744,74 @@ struct rte_lpm6_config lpm6_config = {\n \tprintf(\"%s%s\", name, buf);\n }\n \n+static inline void\n+parse_ptype_one(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(uint8_t port __rte_unused, uint16_t queue __rte_unused,\n+\t\tstruct rte_mbuf *pkts[], uint16_t nb_pkts,\n+\t\tuint16_t max_pkts __rte_unused,\n+\t\tvoid *user_param __rte_unused)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < nb_pkts; ++i)\n+\t\tparse_ptype_one(pkts[i]);\n+\n+\treturn nb_pkts;\n+}\n+\n+static int\n+add_cb_parse_ptype(uint8_t portid, uint16_t queueid)\n+{\n+\tprintf(\"Port %d: softly parse packet type info\\n\", portid);\n+\tif (rte_eth_add_rx_callback(portid, queueid, cb_parse_ptype, NULL))\n+\t\treturn 0;\n+\n+\tprintf(\"Failed to add rx callback: port=%d\\n\", portid);\n+\treturn -1;\n+}\n+\n+static int check_ptype(uint8_t portid)\n+{\n+\tint i, ret;\n+\tint ptype_l3_ipv4 = 0;\n+\tint ptype_l3_ipv6 = 0;\n+\tuint32_t ptype_mask = RTE_PTYPE_L3_MASK;\n+\n+\tret = rte_eth_dev_get_supported_ptypes(portid, ptype_mask, NULL, 0);\n+\tif (ret <= 0)\n+\t\treturn 0;\n+\n+\tuint32_t ptypes[ret];\n+\tret = rte_eth_dev_get_supported_ptypes(portid, ptype_mask, ptypes, ret);\n+\tfor (i = 0; i < ret; ++i) {\n+\t\tif (ptypes[i] & RTE_PTYPE_L3_IPV4)\n+\t\t\tptype_l3_ipv4 = 1;\n+\t\tif (ptypes[i] & RTE_PTYPE_L3_IPV6)\n+\t\t\tptype_l3_ipv6 = 1;\n+\t}\n+\n+\tif (ptype_l3_ipv4 && ptype_l3_ipv6)\n+\t\treturn 1;\n+\n+\treturn 0;\n+}\n+\n /* Check the link status of all ports in up to 9s, and print them finally */\n static void\n check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)\n@@ -1117,6 +1199,14 @@ struct rte_lpm6_config lpm6_config = {\n \t\tprint_ethaddr(\" Address:\", &ports_eth_addr[portid]);\n \t\tprintf(\"\\n\");\n \n+\t\tif (parse_ptype) {\n+\t\t\tif (add_cb_parse_ptype(portid, queueid) < 0)\n+\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t\"Fail to add ptype cb\\n\");\n+\t\t} else if (!check_ptype(portid))\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"PMD can not provide needed ptypes\\n\");\n+\n \t\t/* init one TX queue per couple (lcore,port) */\n \t\tqueueid = 0;\n \t\tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n", "prefixes": [ "dpdk-dev", "v3", "1/3" ] }{ "id": 20284, "url": "