get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1423,
    "url": "https://patches.dpdk.org/api/patches/1423/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1416530816-2159-22-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-22-git-send-email-jingjing.wu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1416530816-2159-22-git-send-email-jingjing.wu@intel.com",
    "date": "2014-11-21T00:46:55",
    "name": "[dpdk-dev,v6,21/22] testpmd: add test command to configure flexible mask",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "16103ca27093311f627d9d601d0746e78f2ab555",
    "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-22-git-send-email-jingjing.wu@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1423/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1423/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 C39888006;\n\tFri, 21 Nov 2014 01:37:22 +0100 (CET)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id E54EE7FB1\n\tfor <dev@dpdk.org>; Fri, 21 Nov 2014 01:37:18 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP; 20 Nov 2014 16:40:56 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 20 Nov 2014 16:47:49 -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 sAL0lkIT004610;\n\tFri, 21 Nov 2014 08:47:46 +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 sAL0lilo002342; Fri, 21 Nov 2014 08:47:46 +0800",
            "(from wujingji@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sAL0li67002338; \n\tFri, 21 Nov 2014 08:47:44 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.07,426,1413270000\"; d=\"scan'208\";a=\"625914025\"",
        "From": "Jingjing Wu <jingjing.wu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 21 Nov 2014 08:46:55 +0800",
        "Message-Id": "<1416530816-2159-22-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 21/22] testpmd: add test command to configure\n\tflexible mask",
        "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 added to configure flexible mask\n\nSigned-off-by: jingjing.wu <jingjing.wu@intel.com>\n---\n app/test-pmd/cmdline.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/config.c  | 30 ++++++++++++++++\n app/test-pmd/testpmd.h |  3 +-\n 3 files changed, 126 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 066769f..bb10b9f 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -709,6 +709,11 @@ static void cmd_help_long_parsed(void *parsed_result,\n \n \t\t\t\"flush_flow_director (port_id)\\n\"\n \t\t\t\"    Flush all flow director entries of a device.\\n\\n\"\n+\n+\t\t\t\"flow_director_flex_mask (port_id)\"\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 \t\t);\n \t}\n }\n@@ -8171,6 +8176,94 @@ cmdline_parse_inst_t cmd_flush_flow_director = {\n \t},\n };\n \n+/* *** deal with flow director mask on flexible payload *** */\n+struct cmd_flow_director_flex_mask_result {\n+\tcmdline_fixed_string_t flow_director_flexmask;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t flow;\n+\tcmdline_fixed_string_t flow_type;\n+\tcmdline_fixed_string_t mask;\n+};\n+\n+static void\n+cmd_flow_director_flex_mask_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_flex_mask_result *res = parsed_result;\n+\tstruct rte_eth_fdir_flex_mask flex_mask;\n+\tstruct rte_port *port;\n+\tenum rte_eth_flow_type i;\n+\tint ret;\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_mask, 0, sizeof(struct rte_eth_fdir_flex_mask));\n+\tret = parse_flexbytes(res->mask,\n+\t\t\tflex_mask.mask,\n+\t\t\tRTE_ETH_FDIR_MAX_FLEXLEN);\n+\tif (ret < 0) {\n+\t\tprintf(\"error: Cannot parse mask input.\\n\");\n+\t\treturn;\n+\t}\n+\tif (!strcmp(res->flow_type, \"all\")) {\n+\t\tfor (i = RTE_ETH_FLOW_TYPE_UDPV4;\n+\t\t     i <= RTE_ETH_FLOW_TYPE_FRAG_IPV6;\n+\t\t     i++) {\n+\t\t\tflex_mask.flow_type = i;\n+\t\t\tfdir_set_flex_mask(res->port_id, &flex_mask);\n+\t\t}\n+\t\tcmd_reconfig_device_queue(res->port_id, 1, 0);\n+\t\treturn;\n+\t}\n+\tflex_mask.flow_type = str2flowtype(res->flow_type);\n+\tfdir_set_flex_mask(res->port_id, &flex_mask);\n+\tcmd_reconfig_device_queue(res->port_id, 1, 0);\n+}\n+\n+cmdline_parse_token_string_t cmd_flow_director_flexmask =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,\n+\t\t\t\t flow_director_flexmask,\n+\t\t\t\t \"flow_director_flex_mask\");\n+cmdline_parse_token_num_t cmd_flow_director_flexmask_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_flow_director_flex_mask_result,\n+\t\t\t      port_id, UINT8);\n+cmdline_parse_token_string_t cmd_flow_director_flexmask_flow =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,\n+\t\t\t\t flow, \"flow\");\n+cmdline_parse_token_string_t cmd_flow_director_flexmask_flow_type =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,\n+\t\t\t\t flow_type,\n+\t\t\t\t\"ip4#ip4-frag#tcp4#udp4#sctp4#\"\n+\t\t\t\t\"ip6#ip6-frag#tcp6#udp6#sctp6#all\");\n+cmdline_parse_token_string_t cmd_flow_director_flexmask_mask =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,\n+\t\t\t\t mask, NULL);\n+\n+cmdline_parse_inst_t cmd_set_flow_director_flex_mask = {\n+\t.f = cmd_flow_director_flex_mask_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set flow director's flex mask on NIC\",\n+\t.tokens = {\n+\t\t(void *)&cmd_flow_director_flexmask,\n+\t\t(void *)&cmd_flow_director_flexmask_port_id,\n+\t\t(void *)&cmd_flow_director_flexmask_flow,\n+\t\t(void *)&cmd_flow_director_flexmask_flow_type,\n+\t\t(void *)&cmd_flow_director_flexmask_mask,\n+\t\tNULL,\n+\t},\n+};\n+\n /* ******************************************************************************** */\n \n /* list of instructions */\n@@ -8304,6 +8397,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,\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 \tNULL,\n };\n \ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex b7e4412..e1ac901 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2021,6 +2021,36 @@ fdir_set_masks(portid_t port_id, struct rte_fdir_masks *fdir_masks)\n }\n \n void\n+fdir_set_flex_mask(portid_t port_id, struct rte_eth_fdir_flex_mask *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_FLOW_TYPE_MAX; i++) {\n+\t\tif (cfg->flow_type == flex_conf->flex_mask[i].flow_type) {\n+\t\t\tidx = i;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tif (i >= RTE_ETH_FLOW_TYPE_MAX) {\n+\t\tif (flex_conf->nb_flexmasks < RTE_DIM(flex_conf->flex_mask)) {\n+\t\t\tidx = flex_conf->nb_flexmasks;\n+\t\t\tflex_conf->nb_flexmasks++;\n+\t\t} else {\n+\t\t\tprintf(\"The flex mask table is full. Can not set flex\"\n+\t\t\t\t\" mask for flow_type(%u).\", cfg->flow_type);\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\t(void)rte_memcpy(&flex_conf->flex_mask[idx],\n+\t\t\t cfg,\n+\t\t\t sizeof(struct rte_eth_fdir_flex_mask));\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 9cbfeac..05a65d4 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -532,7 +532,8 @@ void fdir_update_perfect_filter(portid_t port_id, uint16_t soft_id,\n void fdir_remove_perfect_filter(portid_t port_id, uint16_t soft_id,\n \t\t\t\tstruct rte_fdir_filter *fdir_filter);\n void fdir_set_masks(portid_t port_id, struct rte_fdir_masks *fdir_masks);\n-\n+void fdir_set_flex_mask(portid_t port_id,\n+\t\t\t   struct rte_eth_fdir_flex_mask *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",
        "21/22"
    ]
}