get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 224,
    "url": "http://patches.dpdk.org/api/patches/224/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1409038294-21693-3-git-send-email-jijiang.liu@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": "<1409038294-21693-3-git-send-email-jijiang.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1409038294-21693-3-git-send-email-jijiang.liu@intel.com",
    "date": "2014-08-26T07:31:29",
    "name": "[dpdk-dev,v2,2/7] ]app/test-pmd:test VxLAN packet identification",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "caebc7a5a5e3149bf66b7728ddf6636e621e4b21",
    "submitter": {
        "id": 52,
        "url": "http://patches.dpdk.org/api/people/52/?format=api",
        "name": "Jijiang Liu",
        "email": "jijiang.liu@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1409038294-21693-3-git-send-email-jijiang.liu@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/224/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/224/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<jijiangl@shecgisg004.sh.intel.com>",
        "Received": [
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 87F5638EB\n\tfor <dev@dpdk.org>; Tue, 26 Aug 2014 09:28:06 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP; 26 Aug 2014 00:31:47 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 26 Aug 2014 00:31:46 -0700",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id s7Q7Vihk027261;\n\tTue, 26 Aug 2014 15:31:44 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s7Q7Ve19021819; Tue, 26 Aug 2014 15:31:42 +0800",
            "(from jijiangl@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s7Q7Ve2O021815; \n\tTue, 26 Aug 2014 15:31:40 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,402,1406617200\"; d=\"scan'208\";a=\"563466030\"",
        "From": "Jijiang Liu <jijiang.liu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 26 Aug 2014 15:31:29 +0800",
        "Message-Id": "<1409038294-21693-3-git-send-email-jijiang.liu@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": "<1409038294-21693-1-git-send-email-jijiang.liu@intel.com>",
        "References": "<1409038294-21693-1-git-send-email-jijiang.liu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 2/7]]app/test-pmd:test VxLAN packet\n\tidentification",
        "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>",
        "X-List-Received-Date": "Tue, 26 Aug 2014 07:28:08 -0000"
    },
    "content": "Add commands to test VxLAN packet identification, which include\n - use commands to add/delete VxLAN UDP port.\n - use rxonly mode to check VxLAN packet.\n\nSigned-off-by: jijiangl <jijiang.liu@intel.com>\nAcked-by: Helin Zhang <helin.zhang@intel.com>\nAcked-by: Jingjing Wu <jingjing.wu@intel.com>\nAcked-by: Jing Chen <jing.d.chen@intel.com>\n\n---\n app/test-pmd/cmdline.c    |   78 ++++++++++++++++++++++++++++++++++++++++++--\n app/test-pmd/parameters.c |   13 +++++++\n app/test-pmd/rxonly.c     |   49 ++++++++++++++++++++++++++++\n app/test-pmd/testpmd.c    |    8 +++++\n app/test-pmd/testpmd.h    |    5 +++\n 5 files changed, 149 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex b04a4e8..de910db 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -285,6 +285,12 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"    Set the outer VLAN TPID for Packet Filtering on\"\n \t\t\t\" a port\\n\\n\"\n \n+\t\t\t\"rx_vxlan_port add (udp_port) (port_id)\\n\"\n+\t\t\t\"    Add an UDP port for VxLAN packet filter on a port\\n\\n\"\n+\n+\t\t\t\"rx_vxlan_port rm (udp_port) (port_id)\\n\"\n+\t\t\t\"    Remove an UDP port for VxLAN packet filter on a port\\n\\n\"\n+\n \t\t\t\"tx_vlan set vlan_id (port_id)\\n\"\n \t\t\t\"    Set hardware insertion of VLAN ID in packets sent\"\n \t\t\t\" on a port.\\n\\n\"\n@@ -296,13 +302,17 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"    Disable hardware insertion of a VLAN header in\"\n \t\t\t\" packets sent on a port.\\n\\n\"\n \n-\t\t\t\"tx_checksum set mask (port_id)\\n\"\n+\t\t\t\"tx_checksum set (mask) (port_id)\\n\"\n \t\t\t\"    Enable hardware insertion of checksum offload with\"\n-\t\t\t\" the 4-bit mask, 0~0xf, in packets sent on a port.\\n\"\n+\t\t\t\" the 8-bit mask, 0~0xff, in packets sent on a port.\\n\"\n \t\t\t\"        bit 0 - insert ip   checksum offload if set\\n\"\n \t\t\t\"        bit 1 - insert udp  checksum offload if set\\n\"\n \t\t\t\"        bit 2 - insert tcp  checksum offload if set\\n\"\n \t\t\t\"        bit 3 - insert sctp checksum offload if set\\n\"\n+\t\t\t\"        bit 4 - insert inner ip  checksum offload if set\\n\"\n+\t\t\t\"        bit 5 - insert inner udp checksum offload if set\\n\"\n+\t\t\t\"        bit 6 - insert inner tcp checksum offload if set\\n\"\n+\t\t\t\"        bit 7 - insert inner sctp checksum offload if set\\n\"\n \t\t\t\"    Please check the NIC datasheet for HW limits.\\n\\n\"\n \n \t\t\t\"set fwd (%s)\\n\"\n@@ -2745,8 +2755,9 @@ cmdline_parse_inst_t cmd_tx_cksum_set = {\n \t.f = cmd_tx_cksum_set_parsed,\n \t.data = NULL,\n \t.help_str = \"enable hardware insertion of L3/L4checksum with a given \"\n-\t\"mask in packets sent on a port, the bit mapping is given as, Bit 0 for ip\"\n-\t\"Bit 1 for UDP, Bit 2 for TCP, Bit 3 for SCTP\",\n+\t\"mask in packets sent on a port, the bit mapping is given as, Bit 0 for ip \"\n+\t\"Bit 1 for UDP, Bit 2 for TCP, Bit 3 for SCTP, Bit 4 for inner ip \"\n+\t\"Bit 5 for inner UDP, Bit 6 for inner TCP, Bit 7 for inner SCTP\",\n \t.tokens = {\n \t\t(void *)&cmd_tx_cksum_set_tx_cksum,\n \t\t(void *)&cmd_tx_cksum_set_set,\n@@ -6211,6 +6222,64 @@ cmdline_parse_inst_t cmd_vf_rate_limit = {\n \t},\n };\n \n+/* *** CONFIGURE TUNNEL UDP PORT *** */\n+struct cmd_tunnel_udp_config {\n+\tcmdline_fixed_string_t cmd;\n+\tcmdline_fixed_string_t what;\n+\tuint16_t udp_port;\n+\tuint8_t port_id;\n+};\n+\n+static void\n+cmd_tunnel_udp_config_parsed(void *parsed_result,\n+\t\t\t  __attribute__((unused)) struct cmdline *cl,\n+\t\t\t  __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_tunnel_udp_config *res = parsed_result;\n+\tstruct rte_eth_udp_tunnel tunnel_udp;\n+\tint ret;\n+\n+\ttunnel_udp.udp_port = res->udp_port;\n+\n+\tif (!strcmp(res->cmd, \"rx_vxlan_port\"))\n+\t\ttunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN;\n+\n+\tif (!strcmp(res->what, \"add\"))\n+\t\tret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp, 1);\n+\telse\n+\t\tret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp, 1);\n+\n+\tif (ret < 0)\n+\t\tprintf(\"udp tunneling add error: (%s)\\n\", strerror(-ret));\n+}\n+\n+cmdline_parse_token_string_t cmd_tunnel_udp_config_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config,\n+\t\t\t\tcmd, \"rx_vxlan_port\");\n+cmdline_parse_token_string_t cmd_tunnel_udp_config_what =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config,\n+\t\t\t\twhat, \"add#rm\");\n+cmdline_parse_token_num_t cmd_tunnel_udp_config_udp_port =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_tunnel_udp_config,\n+\t\t\t\tudp_port, UINT16);\n+cmdline_parse_token_num_t cmd_tunnel_udp_config_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_tunnel_udp_config,\n+\t\t\t\tport_id, UINT8);\n+\n+cmdline_parse_inst_t cmd_tunnel_udp_config = {\n+\t.f = cmd_tunnel_udp_config_parsed,\n+\t.data = (void *)0,\n+\t.help_str = \"add/rm an tunneling UDP port filter: \"\n+\t\t\t\"rx_vxlan_port add udp_port port_id\",\n+\t.tokens = {\n+\t\t(void *)&cmd_tunnel_udp_config_cmd,\n+\t\t(void *)&cmd_tunnel_udp_config_what,\n+\t\t(void *)&cmd_tunnel_udp_config_udp_port,\n+\t\t(void *)&cmd_tunnel_udp_config_port_id,\n+\t\tNULL,\n+\t},\n+};\n+\n /* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */\n struct cmd_set_mirror_mask_result {\n \tcmdline_fixed_string_t set;\n@@ -7506,6 +7575,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,\n \t(cmdline_parse_inst_t *)&cmd_queue_rate_limit,\n \t(cmdline_parse_inst_t *)&cmd_vf_rate_limit,\n+\t(cmdline_parse_inst_t *)&cmd_tunnel_udp_config,\n \t(cmdline_parse_inst_t *)&cmd_set_mirror_mask,\n \t(cmdline_parse_inst_t *)&cmd_set_mirror_link,\n \t(cmdline_parse_inst_t *)&cmd_reset_mirror_rule,\ndiff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex 9573a43..fda8c1d 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -202,6 +202,10 @@ usage(char* progname)\n \tprintf(\"  --txpkts=X[,Y]*: set TX segment sizes.\\n\");\n \tprintf(\"  --disable-link-check: disable check on link status when \"\n \t       \"starting/stopping ports.\\n\");\n+\tprintf(\"  --tunnel-type=N: set tunneling packet type \"\n+\t       \"(0 <= N <= 4).(0:non-tunneling packet;1:VxLAN; \"\n+\t       \"2:GENEVE;3: TEREDO;4: NVGRE)\\n\");\n+\n }\n \n #ifdef RTE_LIBRTE_CMDLINE\n@@ -600,6 +604,7 @@ launch_args_parse(int argc, char** argv)\n \t\t{ \"no-flush-rx\",\t0, 0, 0 },\n \t\t{ \"txpkts\",\t\t\t1, 0, 0 },\n \t\t{ \"disable-link-check\",\t\t0, 0, 0 },\n+\t\t{ \"tunnel-type\",                1, 0, 0 },\n \t\t{ 0, 0, 0, 0 },\n \t};\n \n@@ -1032,6 +1037,14 @@ launch_args_parse(int argc, char** argv)\n \t\t\t\telse\n \t\t\t\t\trte_exit(EXIT_FAILURE, \"rxfreet must be >= 0\\n\");\n \t\t\t}\n+\t\t\tif (!strcmp(lgopts[opt_idx].name, \"tunnel-type\")) {\n+\t\t\t\tn = atoi(optarg);\n+\t\t\t\tif ((n >= 0) && (n < RTE_TUNNEL_TYPE_MAX))\n+\t\t\t\t\trx_tunnel_type = (uint16_t)n;\n+\t\t\t\telse\n+\t\t\t\t\trte_exit(EXIT_FAILURE, \"tunnel-type must be 0-%d\\n\",\n+\t\t\t\t\t\tRTE_TUNNEL_TYPE_MAX);\n+\t\t\t}\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"tx-queue-stats-mapping\")) {\n \t\t\t\tif (parse_queue_stats_mapping_config(optarg, TX)) {\n \t\t\t\t\trte_exit(EXIT_FAILURE,\ndiff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c\nindex 5f21a3e..4f529f6 100644\n--- a/app/test-pmd/rxonly.c\n+++ b/app/test-pmd/rxonly.c\n@@ -66,6 +66,8 @@\n #include <rte_ether.h>\n #include <rte_ethdev.h>\n #include <rte_string_fns.h>\n+#include <rte_ip.h>\n+#include <rte_udp.h>\n \n #include \"testpmd.h\"\n \n@@ -112,6 +114,9 @@ pkt_burst_receive(struct fwd_stream *fs)\n \tuint16_t ol_flags;\n \tuint16_t nb_rx;\n \tuint16_t i;\n+\tuint8_t ptype;\n+\tuint8_t is_encapsulation;\n+\n #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES\n \tuint64_t start_tsc;\n \tuint64_t end_tsc;\n@@ -152,6 +157,11 @@ pkt_burst_receive(struct fwd_stream *fs)\n \t\teth_hdr = (struct ether_hdr *) mb->pkt.data;\n \t\teth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type);\n \t\tol_flags = mb->ol_flags;\n+\t\tptype = mb->reserved;\n+\n+\t\tis_encapsulation = IS_ETH_IPV4_TUNNEL(ptype) |\n+\t\t\t\t\tIS_ETH_IPV6_TUNNEL(ptype);\n+\n \t\tprint_ether_addr(\"  src=\", &eth_hdr->s_addr);\n \t\tprint_ether_addr(\" - dst=\", &eth_hdr->d_addr);\n \t\tprintf(\" - type=0x%04x - length=%u - nb_segs=%d\",\n@@ -167,6 +177,45 @@ pkt_burst_receive(struct fwd_stream *fs)\n \t\tif (ol_flags & PKT_RX_VLAN_PKT)\n \t\t\tprintf(\" - VLAN tci=0x%x\",\n \t\t\t\tmb->pkt.vlan_macip.f.vlan_tci);\n+\t\tif (is_encapsulation) {\n+\t\t\tstruct ipv4_hdr *ipv4_hdr;\n+\t\t\tstruct ipv6_hdr *ipv6_hdr;\n+\t\t\tstruct udp_hdr *udp_hdr;\n+\t\t\tuint8_t l2_len;\n+\t\t\tuint8_t l3_len;\n+\t\t\tuint8_t l4_len;\n+\t\t\tuint8_t l4_proto;\n+\t\t\tstruct  vxlan_hdr *vxlan_hdr;\n+\n+\t\t\tl2_len  = sizeof(struct ether_hdr);\n+\n+\t\t\t /* Do not support ipv4 option field */\n+\t\t\tif (IS_ETH_IPV4_TUNNEL(ptype)) {\n+\t\t\t\tl3_len = sizeof(struct ipv4_hdr);\n+\t\t\t\tipv4_hdr = (struct ipv4_hdr *) (rte_pktmbuf_mtod(mb,\n+\t\t\t\t\t\tunsigned char *) + l2_len);\n+\t\t\t\tl4_proto = ipv4_hdr->next_proto_id;\n+\t\t\t} else {\n+\t\t\t\tl3_len = sizeof(struct ipv6_hdr);\n+\t\t\t\tipv6_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(mb,\n+\t\t\t\t\t\tunsigned char *) + l2_len);\n+\t\t\t\tl4_proto = ipv6_hdr->proto;\n+\t\t\t}\n+\t\t\tif (l4_proto == IPPROTO_UDP) {\n+\t\t\t\tudp_hdr = (struct udp_hdr *) (rte_pktmbuf_mtod(mb,\n+\t\t\t\t\t\tunsigned char *) + l2_len + l3_len);\n+\t\t\t\tl4_len = sizeof(struct udp_hdr);\n+\t\t\t\tvxlan_hdr = (struct vxlan_hdr *) (rte_pktmbuf_mtod(mb,\n+\t\t\t\t\t\tunsigned char *) + l2_len + l3_len\n+\t\t\t\t\t\t + l4_len);\n+\n+\t\t\t\tprintf(\" - VxLAN packet: packet type =%d, \"\n+\t\t\t\t\t\"Destination UDP port =%d, VNI = %d\",\n+\t\t\t\t\tptype, RTE_BE_TO_CPU_16(udp_hdr->dst_port),\n+\t\t\t\t\trte_be_to_cpu_32(vxlan_hdr->vx_vni) >> 8);\n+\t\t\t}\n+\t\t}\n+\t\tprintf(\" - Receive queue=0x%x\", (unsigned) fs->rx_queue);\n \t\tprintf(\"\\n\");\n \t\tif (ol_flags != 0) {\n \t\t\tint rxf;\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex a112559..3d09817 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -243,6 +243,12 @@ uint16_t tx_free_thresh = 0; /* Use default values. */\n uint16_t tx_rs_thresh = 0; /* Use default values. */\n \n /*\n+ * Configurable value of tunnel type.\n+ */\n+\n+uint8_t rx_tunnel_type = 0; /* Use default values. */\n+\n+/*\n  * Configurable value of TX queue flags.\n  */\n uint32_t txq_flags = 0; /* No flags set. */\n@@ -1688,6 +1694,8 @@ init_port_config(void)\n \t\tport = &ports[pid];\n \t\tport->dev_conf.rxmode = rx_mode;\n \t\tport->dev_conf.fdir_conf = fdir_conf;\n+\t\tif (rx_tunnel_type == 1)\n+\t\t\tport->dev_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN;\n \t\tif (nb_rxq > 1) {\n \t\t\tport->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL;\n \t\t\tport->dev_conf.rx_adv_conf.rss_conf.rss_hf = rss_hf;\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex b8322a2..2d656fc 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -80,6 +80,10 @@ typedef uint16_t streamid_t;\n \n #define MAX_QUEUE_ID ((1 << (sizeof(queueid_t) * 8)) - 1)\n \n+/* For FVL NIC */\n+#define IS_ETH_IPV4_TUNNEL(ptype) ((ptype > 58) && (ptype < 87))\n+#define IS_ETH_IPV6_TUNNEL(ptype) ((ptype > 124) && (ptype < 153))\n+\n enum {\n \tPORT_TOPOLOGY_PAIRED,\n \tPORT_TOPOLOGY_CHAINED,\n@@ -342,6 +346,7 @@ extern uint8_t rx_drop_en;\n extern uint16_t tx_free_thresh;\n extern uint16_t tx_rs_thresh;\n extern uint32_t txq_flags;\n+extern uint8_t rx_tunnel_type;\n \n extern uint8_t dcb_config;\n extern uint8_t dcb_test;\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "2/7"
    ]
}