get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 99122,
    "url": "http://patches.dpdk.org/api/patches/99122/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210917110242.3127658-13-qi.z.zhang@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": "<20210917110242.3127658-13-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210917110242.3127658-13-qi.z.zhang@intel.com",
    "date": "2021-09-17T11:02:34",
    "name": "[12/20] net/ice/base: add helper function for boost TCAM match",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "07cfa9ac006fa8029e257f657739d03e023a8ac4",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210917110242.3127658-13-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 19007,
            "url": "http://patches.dpdk.org/api/series/19007/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19007",
            "date": "2021-09-17T11:02:22",
            "name": "ice/base: add parser module",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/19007/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/99122/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/99122/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 3A65EA0C47;\n\tFri, 17 Sep 2021 13:01:16 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 18DFE41156;\n\tFri, 17 Sep 2021 13:00:00 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by mails.dpdk.org (Postfix) with ESMTP id 5AE8141145\n for <dev@dpdk.org>; Fri, 17 Sep 2021 12:59:56 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Sep 2021 03:59:55 -0700",
            "from dpdk51.sh.intel.com ([10.67.111.142])\n by fmsmga006.fm.intel.com with ESMTP; 17 Sep 2021 03:59:54 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10109\"; a=\"286458723\"",
            "E=Sophos;i=\"5.85,301,1624345200\"; d=\"scan'208\";a=\"286458723\"",
            "E=Sophos;i=\"5.85,301,1624345200\"; d=\"scan'208\";a=\"699440727\""
        ],
        "X-ExtLoop1": "1",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "qiming.yang@intel.com",
        "Cc": "junfeng.guo@intel.com,\n\tdev@dpdk.org,\n\tQi Zhang <qi.z.zhang@intel.com>",
        "Date": "Fri, 17 Sep 2021 19:02:34 +0800",
        "Message-Id": "<20210917110242.3127658-13-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.26.2",
        "In-Reply-To": "<20210917110242.3127658-1-qi.z.zhang@intel.com>",
        "References": "<20210917110242.3127658-1-qi.z.zhang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 12/20] net/ice/base: add helper function for\n boost TCAM match",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add internal helper function ice_bst_tcam_match to perform ternary\nmatch on boost TCAM.\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n drivers/net/ice/base/ice_bst_tcam.c | 22 +++++++++++++++\n drivers/net/ice/base/ice_bst_tcam.h |  3 ++\n drivers/net/ice/base/ice_parser.h   |  1 +\n drivers/net/ice/base/ice_tmatch.h   | 44 +++++++++++++++++++++++++++++\n 4 files changed, 70 insertions(+)\n create mode 100644 drivers/net/ice/base/ice_tmatch.h",
    "diff": "diff --git a/drivers/net/ice/base/ice_bst_tcam.c b/drivers/net/ice/base/ice_bst_tcam.c\nindex 1c82359681..76b3a5c551 100644\n--- a/drivers/net/ice/base/ice_bst_tcam.c\n+++ b/drivers/net/ice/base/ice_bst_tcam.c\n@@ -239,3 +239,25 @@ struct ice_lbl_item *ice_bst_lbl_table_get(struct ice_hw *hw)\n \t\t\t\t\tice_parser_sect_item_get,\n \t\t\t\t\t_parse_lbl_item, true);\n }\n+\n+/**\n+ * ice_bst_tcam_match - match a pattern on the boost tcam table\n+ * @tcam_table: boost tcam table to search\n+ * @pat: pattern to match\n+ */\n+struct ice_bst_tcam_item *\n+ice_bst_tcam_match(struct ice_bst_tcam_item *tcam_table, u8 *pat)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < ICE_BST_TCAM_TABLE_SIZE; i++) {\n+\t\tstruct ice_bst_tcam_item *item = &tcam_table[i];\n+\n+\t\tif (item->hit_idx_grp == 0)\n+\t\t\tcontinue;\n+\t\tif (ice_ternary_match(item->key, item->key_inv, pat, 20))\n+\t\t\treturn item;\n+\t}\n+\n+\treturn NULL;\n+}\ndiff --git a/drivers/net/ice/base/ice_bst_tcam.h b/drivers/net/ice/base/ice_bst_tcam.h\nindex a4ab40721f..3cba0bbf55 100644\n--- a/drivers/net/ice/base/ice_bst_tcam.h\n+++ b/drivers/net/ice/base/ice_bst_tcam.h\n@@ -25,4 +25,7 @@ void ice_bst_tcam_dump(struct ice_hw *hw, struct ice_bst_tcam_item *item);\n struct ice_bst_tcam_item *ice_bst_tcam_table_get(struct ice_hw *hw);\n \n struct ice_lbl_item *ice_bst_lbl_table_get(struct ice_hw *hw);\n+\n+struct ice_bst_tcam_item *\n+ice_bst_tcam_match(struct ice_bst_tcam_item *tcam_table, u8 *pat);\n #endif /*_ICE_BST_TCAM_H_ */\ndiff --git a/drivers/net/ice/base/ice_parser.h b/drivers/net/ice/base/ice_parser.h\nindex 3a307e0344..b2ab21728e 100644\n--- a/drivers/net/ice/base/ice_parser.h\n+++ b/drivers/net/ice/base/ice_parser.h\n@@ -15,6 +15,7 @@\n #include \"ice_flg_rd.h\"\n #include \"ice_xlt_kb.h\"\n #include \"ice_parser_rt.h\"\n+#include \"ice_tmatch.h\"\n \n struct ice_parser {\n \tstruct ice_hw *hw; /* pointer to the hardware structure */\ndiff --git a/drivers/net/ice/base/ice_tmatch.h b/drivers/net/ice/base/ice_tmatch.h\nnew file mode 100644\nindex 0000000000..178a084639\n--- /dev/null\n+++ b/drivers/net/ice/base/ice_tmatch.h\n@@ -0,0 +1,44 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2001-2021 Intel Corporation\n+ */\n+\n+#ifndef _ICE_TMATCH_H_\n+#define _ICE_TMATCH_H_\n+\n+static inline\n+bool ice_ternary_match_byte(u8 key, u8 key_inv, u8 pat)\n+{\n+\tu8 k1, k2, v;\n+\tint i;\n+\n+\tfor (i = 0; i < 8; i++) {\n+\t\tk1 = (u8)(key & (1 << i));\n+\t\tk2 = (u8)(key_inv & (1 << i));\n+\t\tv = (u8)(pat & (1 << i));\n+\n+\t\tif (k1 != 0 && k2 != 0)\n+\t\t\tcontinue;\n+\t\tif (k1 == 0 && k2 == 0)\n+\t\t\treturn false;\n+\n+\t\tif (k1 == v)\n+\t\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n+static inline\n+bool ice_ternary_match(const u8 *key, const u8 *key_inv,\n+\t\t       const u8 *pat, int len)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < len; i++)\n+\t\tif (!ice_ternary_match_byte(key[i], key_inv[i], pat[i]))\n+\t\t\treturn false;\n+\n+\treturn true;\n+}\n+\n+#endif /* _ICE_TMATCH_H_ */\n",
    "prefixes": [
        "12/20"
    ]
}