get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1421,
    "url": "https://patches.dpdk.org/api/patches/1421/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1416530816-2159-19-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-19-git-send-email-jingjing.wu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1416530816-2159-19-git-send-email-jingjing.wu@intel.com",
    "date": "2014-11-21T00:46:52",
    "name": "[dpdk-dev,v6,18/22] testpmd: display fdir info",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7cd8e3d78a339927f305eb5436a4be1547a9558e",
    "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-19-git-send-email-jingjing.wu@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1421/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1421/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 72BA97FFA;\n\tFri, 21 Nov 2014 01:37:14 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 1D51F7F9D\n\tfor <dev@dpdk.org>; Fri, 21 Nov 2014 01:37:10 +0100 (CET)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga103.jf.intel.com with ESMTP; 20 Nov 2014 16:44:55 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga002.jf.intel.com with ESMTP; 20 Nov 2014 16:47:42 -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 sAL0leKf004220;\n\tFri, 21 Nov 2014 08:47:40 +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 sAL0lc4P002321; Fri, 21 Nov 2014 08:47:40 +0800",
            "(from wujingji@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sAL0lcYD002317; \n\tFri, 21 Nov 2014 08:47:38 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.07,426,1413270000\"; d=\"scan'208\";a=\"640843740\"",
        "From": "Jingjing Wu <jingjing.wu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 21 Nov 2014 08:46:52 +0800",
        "Message-Id": "<1416530816-2159-19-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 18/22] testpmd: display fdir info",
        "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": "display flow director's information, includes\n - statistics\n - configuration\n - capability\n\nSigned-off-by: jingjing.wu <jingjing.wu@intel.com>\n---\n app/test-pmd/config.c | 141 +++++++++++++++++++++++++++++++++++++++++++++-----\n 1 file changed, 128 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex b102b72..b7e4412 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -96,6 +96,20 @@\n \n #include \"testpmd.h\"\n \n+static const char *flowtype_str[RTE_ETH_FLOW_TYPE_MAX] = {\n+\tNULL,\n+\t\"udp4\",\n+\t\"tcp4\",\n+\t\"sctp4\",\n+\t\"ip4\",\n+\t\"ip4-frag\",\n+\t\"udp6\",\n+\t\"tcp6\",\n+\t\"sctp6\",\n+\t\"ip6\",\n+\t\"ip6-frag\",\n+};\n+\n static void\n print_ethaddr(const char *name, struct ether_addr *eth_addr)\n {\n@@ -1808,29 +1822,130 @@ fdir_remove_signature_filter(portid_t port_id,\n \n }\n \n+static inline void\n+print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf)\n+{\n+\tstruct rte_eth_flex_payload_cfg *cfg;\n+\tint i, j;\n+\n+\tfor (i = 0; i < flex_conf->nb_payloads; i++) {\n+\t\tcfg = &flex_conf->flex_set[i];\n+\t\tif (cfg->type == RTE_ETH_L2_PAYLOAD)\n+\t\t\tprintf(\"\\n    L2_PAYLOAD:  \");\n+\t\telse if (cfg->type == RTE_ETH_L3_PAYLOAD)\n+\t\t\tprintf(\"\\n    L3_PAYLOAD:  \");\n+\t\telse if (cfg->type == RTE_ETH_L4_PAYLOAD)\n+\t\t\tprintf(\"\\n    L4_PAYLOAD:  \");\n+\t\telse\n+\t\t\tprintf(\"\\n    UNKNOWN PAYLOAD(%u):  \", cfg->type);\n+\t\tfor (j = 0; j < RTE_ETH_FDIR_MAX_FLEXLEN; j++)\n+\t\t\tprintf(\"  %-5u\", cfg->src_offset[j]);\n+\t}\n+\tprintf(\"\\n\");\n+}\n+\n+static inline void\n+print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf)\n+{\n+\tstruct rte_eth_fdir_flex_mask *mask;\n+\tint i, j;\n+\n+\tfor (i = 0; i < flex_conf->nb_flexmasks; i++) {\n+\t\tmask = &flex_conf->flex_mask[i];\n+\t\tprintf(\"\\n    %s:\\t\", flowtype_str[mask->flow_type]);\n+\t\tfor (j = 0; j < RTE_ETH_FDIR_MAX_FLEXLEN; j++)\n+\t\t\tprintf(\" %02x\", mask->mask[j]);\n+\t}\n+\tprintf(\"\\n\");\n+}\n+\n+static inline void\n+print_fdir_flow_type(uint32_t flow_types_mask)\n+{\n+\tint i = 0;\n+\n+\tfor (i = RTE_ETH_FLOW_TYPE_UDPV4;\n+\t     i <= RTE_ETH_FLOW_TYPE_FRAG_IPV6;\n+\t     i++) {\n+\t\tif (flow_types_mask & (1 << i))\n+\t\t\tprintf(\" %s\", flowtype_str[i]);\n+\t}\n+\tprintf(\"\\n\");\n+}\n+\n void\n fdir_get_infos(portid_t port_id)\n {\n-\tstruct rte_eth_fdir fdir_infos;\n+\tstruct rte_eth_fdir_stats fdir_stat;\n+\tstruct rte_eth_fdir_info fdir_info;\n+\tint ret;\n \n \tstatic const char *fdir_stats_border = \"########################\";\n \n \tif (port_id_is_invalid(port_id))\n \t\treturn;\n-\n-\trte_eth_dev_fdir_get_infos(port_id, &fdir_infos);\n-\n+\tret = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_FDIR);\n+\tif (ret < 0) {\n+\t\t/* use the old fdir APIs to get info */\n+\t\tstruct rte_eth_fdir fdir;\n+\t\tmemset(&fdir, 0, sizeof(fdir));\n+\t\tret = rte_eth_dev_fdir_get_infos(port_id, &fdir);\n+\t\tif (ret < 0) {\n+\t\t\tprintf(\"\\n getting fdir info fails on port %-2d\\n\",\n+\t\t\t\tport_id);\n+\t\t\treturn;\n+\t\t}\n+\t\tprintf(\"\\n  %s FDIR infos for port %-2d     %s\\n\",\n+\t\t\tfdir_stats_border, port_id, fdir_stats_border);\n+\t\tprintf(\"  collision: %-10\"PRIu64\"  free:     %\"PRIu64\"\\n\"\n+\t\t       \"  maxhash:   %-10\"PRIu64\"  maxlen:   %\"PRIu64\"\\n\"\n+\t\t       \"  add:\t     %-10\"PRIu64\"  remove:   %\"PRIu64\"\\n\"\n+\t\t       \"  f_add:     %-10\"PRIu64\"  f_remove: %\"PRIu64\"\\n\",\n+\t\t       (uint64_t)(fdir.collision), (uint64_t)(fdir.free),\n+\t\t       (uint64_t)(fdir.maxhash), (uint64_t)(fdir.maxlen),\n+\t\t       fdir.add, fdir.remove, fdir.f_add, fdir.f_remove);\n+\t\tprintf(\"  %s############################%s\\n\",\n+\t\t       fdir_stats_border, fdir_stats_border);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&fdir_info, 0, sizeof(fdir_info));\n+\trte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,\n+\t\t\t       RTE_ETH_FILTER_INFO, &fdir_info);\n+\tmemset(&fdir_stat, 0, sizeof(fdir_stat));\n+\trte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,\n+\t\t\t       RTE_ETH_FILTER_STATS, &fdir_stat);\n \tprintf(\"\\n  %s FDIR infos for port %-2d     %s\\n\",\n \t       fdir_stats_border, port_id, fdir_stats_border);\n-\n-\tprintf(\"  collision: %-10\"PRIu64\"  free:     %\"PRIu64\"\\n\"\n-\t       \"  maxhash:   %-10\"PRIu64\"  maxlen:   %\"PRIu64\"\\n\"\n-\t       \"  add:       %-10\"PRIu64\"  remove:   %\"PRIu64\"\\n\"\n-\t       \"  f_add:     %-10\"PRIu64\"  f_remove: %\"PRIu64\"\\n\",\n-\t       (uint64_t)(fdir_infos.collision), (uint64_t)(fdir_infos.free),\n-\t       (uint64_t)(fdir_infos.maxhash), (uint64_t)(fdir_infos.maxlen),\n-\t       fdir_infos.add, fdir_infos.remove,\n-\t       fdir_infos.f_add, fdir_infos.f_remove);\n+\tprintf(\"  MODE: \");\n+\tif (fdir_info.mode == RTE_FDIR_MODE_PERFECT)\n+\t\t\tprintf(\"  PERFECT\\n\");\n+\telse if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)\n+\t\t\tprintf(\"  SIGNATURE\\n\");\n+\telse\n+\t\t\tprintf(\"  DISABLE\\n\");\n+\tprintf(\"  SUPPORTED FLOW TYPE: \");\n+\tprint_fdir_flow_type(fdir_info.flow_types_mask[0]);\n+\tprintf(\"  FLEX PAYLOAD INFO:\\n\");\n+\tprintf(\"  max_len:       %-10\"PRIu32\"  payload_limit: %-10\"PRIu32\"\\n\"\n+\t       \"  payload_unit:  %-10\"PRIu32\"  payload_seg:   %-10\"PRIu32\"\\n\"\n+\t       \"  bitmask_unit:  %-10\"PRIu32\"  bitmask_num:   %-10\"PRIu32\"\\n\",\n+\t\tfdir_info.max_flexpayload, fdir_info.flex_payload_limit,\n+\t\tfdir_info.flex_payload_unit,\n+\t\tfdir_info.max_flex_payload_segment_num,\n+\t\tfdir_info.flex_bitmask_unit, fdir_info.max_flex_bitmask_num);\n+\tif (fdir_info.flex_conf.nb_payloads > 0) {\n+\t\tprintf(\"  FLEX PAYLOAD SRC OFFSET:\");\n+\t\tprint_fdir_flex_payload(&fdir_info.flex_conf);\n+\t}\n+\tif (fdir_info.flex_conf.nb_flexmasks > 0) {\n+\t\tprintf(\"  FLEX MASK CFG:\");\n+\t\tprint_fdir_flex_mask(&fdir_info.flex_conf);\n+\t}\n+\tprintf(\"  guarant_count: %-10\"PRIu32\"  best_count:    %-10\"PRIu32\"\\n\",\n+\t       fdir_stat.guarant_cnt, fdir_stat.best_cnt);\n+\tprintf(\"  guarant_space: %-10\"PRIu32\"  best_space:    %-10\"PRIu32\"\\n\",\n+\t       fdir_info.guarant_spc, fdir_info.guarant_spc);\n \tprintf(\"  %s############################%s\\n\",\n \t       fdir_stats_border, fdir_stats_border);\n }\n",
    "prefixes": [
        "dpdk-dev",
        "v6",
        "18/22"
    ]
}