get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1424,
    "url": "https://patches.dpdk.org/api/patches/1424/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1416530816-2159-23-git-send-email-jingjing.wu@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": "<1416530816-2159-23-git-send-email-jingjing.wu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1416530816-2159-23-git-send-email-jingjing.wu@intel.com",
    "date": "2014-11-21T00:46:56",
    "name": "[dpdk-dev,v6,22/22] testpmd: add test command to configure flexible payload",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e513a85efd50fe65a00a9a0e424ed95336172013",
    "submitter": {
        "id": 47,
        "url": "https://patches.dpdk.org/api/people/47/?format=api",
        "name": "Jingjing Wu",
        "email": "jingjing.wu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1416530816-2159-23-git-send-email-jingjing.wu@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1424/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1424/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 6DFFA8012;\n\tFri, 21 Nov 2014 01:37:23 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id C65127FD3\n\tfor <dev@dpdk.org>; Fri, 21 Nov 2014 01:37:20 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga103.jf.intel.com with ESMTP; 20 Nov 2014 16:45:04 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 20 Nov 2014 16:47:51 -0800",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id sAL0lnca004709;\n\tFri, 21 Nov 2014 08:47:49 +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 sAL0llrs002349; Fri, 21 Nov 2014 08:47:49 +0800",
            "(from wujingji@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sAL0lkqO002345; \n\tFri, 21 Nov 2014 08:47:46 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.07,426,1413270000\"; d=\"scan'208\";a=\"611514822\"",
        "From": "Jingjing Wu <jingjing.wu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 21 Nov 2014 08:46:56 +0800",
        "Message-Id": "<1416530816-2159-23-git-send-email-jingjing.wu@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1416530816-2159-1-git-send-email-jingjing.wu@intel.com>",
        "References": "<1414654006-7472-1-git-send-email-jingjing.wu@intel.com>\n\t<1416530816-2159-1-git-send-email-jingjing.wu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v6 22/22] testpmd: add test command to configure\n\tflexible payload",
        "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": "Test command is added to configure flexible payload\n\nSigned-off-by: jingjing.wu <jingjing.wu@intel.com>\n---\n app/test-pmd/cmdline.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/config.c  |  31 +++++++++++++\n app/test-pmd/testpmd.h |   2 +\n 3 files changed, 153 insertions(+)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex bb10b9f..eed28b7 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -714,6 +714,10 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\" flow (ip4|ip4-frag|tcp4|udp4|sctp4|ip6|ip6-frag|tcp6|udp6|sctp6|all)\"\n \t\t\t\" (mask)\\n\"\n \t\t\t\"    Configure mask of flex payload.\\n\\n\"\n+\n+\t\t\t\"flow_director_flex_payload (port_id)\"\n+\t\t\t\" (l2|l3|l4) (config)\\n\"\n+\t\t\t\"    Configure flex payload selection.\\n\\n\"\n \t\t);\n \t}\n }\n@@ -8264,6 +8268,121 @@ cmdline_parse_inst_t cmd_set_flow_director_flex_mask = {\n \t},\n };\n \n+/* *** deal with flow director flexible payload configuration *** */\n+struct cmd_flow_director_flexpayload_result {\n+\tcmdline_fixed_string_t flow_director_flexpayload;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t payload_layer;\n+\tcmdline_fixed_string_t payload_cfg;\n+};\n+\n+static inline int\n+parse_offsets(const char *q_arg, uint16_t *offsets, uint16_t max_num)\n+{\n+\tchar s[256];\n+\tconst char *p, *p0 = q_arg;\n+\tchar *end;\n+\tunsigned long int_fld;\n+\tchar *str_fld[max_num];\n+\tint i;\n+\tunsigned size;\n+\tint ret = -1;\n+\n+\tp = strchr(p0, '(');\n+\tif (p == NULL)\n+\t\treturn -1;\n+\t++p;\n+\tp0 = strchr(p, ')');\n+\tif (p0 == NULL)\n+\t\treturn -1;\n+\n+\tsize = p0 - p;\n+\tif (size >= sizeof(s))\n+\t\treturn -1;\n+\n+\tsnprintf(s, sizeof(s), \"%.*s\", size, p);\n+\tret = rte_strsplit(s, sizeof(s), str_fld, max_num, ',');\n+\tif (ret < 0 || ret > max_num)\n+\t\treturn -1;\n+\tfor (i = 0; i < ret; i++) {\n+\t\terrno = 0;\n+\t\tint_fld = strtoul(str_fld[i], &end, 0);\n+\t\tif (errno != 0 || *end != '\\0' || int_fld > UINT16_MAX)\n+\t\t\treturn -1;\n+\t\toffsets[i] = (uint16_t)int_fld;\n+\t}\n+\treturn ret;\n+}\n+\n+static void\n+cmd_flow_director_flxpld_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_flow_director_flexpayload_result *res = parsed_result;\n+\tstruct rte_eth_flex_payload_cfg flex_cfg;\n+\tstruct rte_port *port;\n+\tint ret = 0;\n+\n+\tif (res->port_id > nb_ports) {\n+\t\tprintf(\"Invalid port, range is [0, %d]\\n\", nb_ports - 1);\n+\t\treturn;\n+\t}\n+\n+\tport = &ports[res->port_id];\n+\t/** Check if the port is not started **/\n+\tif (port->port_status != RTE_PORT_STOPPED) {\n+\t\tprintf(\"Please stop port %d first\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&flex_cfg, 0, sizeof(struct rte_eth_flex_payload_cfg));\n+\n+\tif (!strcmp(res->payload_layer, \"l2\"))\n+\t\tflex_cfg.type = RTE_ETH_L2_PAYLOAD;\n+\telse if (!strcmp(res->payload_layer, \"l3\"))\n+\t\tflex_cfg.type = RTE_ETH_L3_PAYLOAD;\n+\telse if (!strcmp(res->payload_layer, \"l4\"))\n+\t\tflex_cfg.type = RTE_ETH_L4_PAYLOAD;\n+\n+\tret = parse_offsets(res->payload_cfg, flex_cfg.src_offset,\n+\t\t\t    RTE_ETH_FDIR_MAX_FLEXLEN);\n+\tif (ret < 0) {\n+\t\tprintf(\"error: Cannot parse flex payload input.\\n\");\n+\t\treturn;\n+\t}\n+\n+\tfdir_set_flex_payload(res->port_id, &flex_cfg);\n+\tcmd_reconfig_device_queue(res->port_id, 1, 0);\n+}\n+\n+cmdline_parse_token_string_t cmd_flow_director_flexpayload =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result,\n+\t\t\t\t flow_director_flexpayload,\n+\t\t\t\t \"flow_director_flex_payload\");\n+cmdline_parse_token_num_t cmd_flow_director_flexpayload_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_flow_director_flexpayload_result,\n+\t\t\t      port_id, UINT8);\n+cmdline_parse_token_string_t cmd_flow_director_flexpayload_payload_layer =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result,\n+\t\t\t\t payload_layer, \"l2#l3#l4\");\n+cmdline_parse_token_string_t cmd_flow_director_flexpayload_payload_cfg =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result,\n+\t\t\t\t payload_cfg, NULL);\n+\n+cmdline_parse_inst_t cmd_set_flow_director_flex_payload = {\n+\t.f = cmd_flow_director_flxpld_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set flow director's flex payload on NIC\",\n+\t.tokens = {\n+\t\t(void *)&cmd_flow_director_flexpayload,\n+\t\t(void *)&cmd_flow_director_flexpayload_port_id,\n+\t\t(void *)&cmd_flow_director_flexpayload_payload_layer,\n+\t\t(void *)&cmd_flow_director_flexpayload_payload_cfg,\n+\t\tNULL,\n+\t},\n+};\n+\n /* ******************************************************************************** */\n \n /* list of instructions */\n@@ -8398,6 +8517,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,\n \t(cmdline_parse_inst_t *)&cmd_flush_flow_director,\n \t(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,\n+\t(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_payload,\n \tNULL,\n };\n \ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex e1ac901..694d630 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2051,6 +2051,37 @@ fdir_set_flex_mask(portid_t port_id, struct rte_eth_fdir_flex_mask *cfg)\n }\n \n void\n+fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg)\n+{\n+\tstruct rte_port *port;\n+\tstruct rte_eth_fdir_flex_conf *flex_conf;\n+\tint i, idx = 0;\n+\n+\tport = &ports[port_id];\n+\tflex_conf = &port->dev_conf.fdir_conf.flex_conf;\n+\tfor (i = 0; i < RTE_ETH_PAYLOAD_MAX; i++) {\n+\t\tif (cfg->type == flex_conf->flex_set[i].type) {\n+\t\t\tidx = i;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tif (i >= RTE_ETH_PAYLOAD_MAX) {\n+\t\tif (flex_conf->nb_payloads < RTE_DIM(flex_conf->flex_set)) {\n+\t\t\tidx = flex_conf->nb_payloads;\n+\t\t\tflex_conf->nb_payloads++;\n+\t\t} else {\n+\t\t\tprintf(\"The flex payload table is full. Can not set\"\n+\t\t\t\t\" flex payload for type(%u).\", cfg->type);\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\t(void)rte_memcpy(&flex_conf->flex_set[idx],\n+\t\t\t cfg,\n+\t\t\t sizeof(struct rte_eth_flex_payload_cfg));\n+\n+}\n+\n+void\n set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)\n {\n \tint diag;\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 05a65d4..072aa57 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -534,6 +534,8 @@ void fdir_remove_perfect_filter(portid_t port_id, uint16_t soft_id,\n void fdir_set_masks(portid_t port_id, struct rte_fdir_masks *fdir_masks);\n void fdir_set_flex_mask(portid_t port_id,\n \t\t\t   struct rte_eth_fdir_flex_mask *cfg);\n+void fdir_set_flex_payload(portid_t port_id,\n+\t\t\t   struct rte_eth_flex_payload_cfg *cfg);\n void port_rss_reta_info(portid_t port_id, struct rte_eth_rss_reta *reta_conf);\n \n void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on);\n",
    "prefixes": [
        "dpdk-dev",
        "v6",
        "22/22"
    ]
}