get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 99363,
    "url": "http://patches.dpdk.org/api/patches/99363/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210921132009.3461020-12-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": "<20210921132009.3461020-12-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210921132009.3461020-12-qi.z.zhang@intel.com",
    "date": "2021-09-21T13:20:00",
    "name": "[v3,11/20] net/ice/base: add parser runtime skeleton",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "fbaef8a1763df4f90ff4911dc535da0fac8c8381",
    "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/20210921132009.3461020-12-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 19057,
            "url": "http://patches.dpdk.org/api/series/19057/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19057",
            "date": "2021-09-21T13:19:49",
            "name": "ice/base: add parser module",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/19057/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/99363/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/99363/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 EA105A0C4C;\n\tTue, 21 Sep 2021 15:18:33 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DC21741177;\n\tTue, 21 Sep 2021 15:17:26 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 208C141164\n for <dev@dpdk.org>; Tue, 21 Sep 2021 15:17:22 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Sep 2021 06:17:22 -0700",
            "from dpdk51.sh.intel.com ([10.67.111.142])\n by orsmga008.jf.intel.com with ESMTP; 21 Sep 2021 06:17:21 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10113\"; a=\"202847472\"",
            "E=Sophos;i=\"5.85,311,1624345200\"; d=\"scan'208\";a=\"202847472\"",
            "E=Sophos;i=\"5.85,311,1624345200\"; d=\"scan'208\";a=\"484173904\""
        ],
        "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": "Tue, 21 Sep 2021 21:20:00 +0800",
        "Message-Id": "<20210921132009.3461020-12-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.26.2",
        "In-Reply-To": "<20210921132009.3461020-1-qi.z.zhang@intel.com>",
        "References": "<20210921132009.3461020-1-qi.z.zhang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 11/20] net/ice/base: add parser runtime\n skeleton",
        "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 parser runtime data struct ice_parser_rt.\n\nAdd below APIs for parser runtime preparation:\nice_parser_rt_reset\nice_parser_rt_pkt_buf_set\n\nAdd below API skeleton for parser runtime execution:\nice_parser_rt_execute\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\nAcked-by: Junfeng Guo <junfeng.guo@intel.com>\n---\n drivers/net/ice/base/ice_parser.c    | 39 +++++++++++\n drivers/net/ice/base/ice_parser.h    | 24 +++++++\n drivers/net/ice/base/ice_parser_rt.c | 98 ++++++++++++++++++++++++++++\n drivers/net/ice/base/ice_parser_rt.h | 28 ++++++++\n drivers/net/ice/base/meson.build     |  1 +\n 5 files changed, 190 insertions(+)\n create mode 100644 drivers/net/ice/base/ice_parser_rt.c\n create mode 100644 drivers/net/ice/base/ice_parser_rt.h",
    "diff": "diff --git a/drivers/net/ice/base/ice_parser.c b/drivers/net/ice/base/ice_parser.c\nindex 1bce75a05c..8f423710fc 100644\n--- a/drivers/net/ice/base/ice_parser.c\n+++ b/drivers/net/ice/base/ice_parser.c\n@@ -167,6 +167,8 @@ enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr)\n \tstruct ice_parser *p;\n \n \tp = (struct ice_parser *)ice_malloc(hw, sizeof(struct ice_parser));\n+\tp->hw = hw;\n+\tp->rt.psr = p;\n \n \tif (!p)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -301,3 +303,40 @@ void ice_parser_destroy(struct ice_parser *psr)\n \n \tice_free(psr->hw, psr);\n }\n+\n+/**\n+ * ice_parser_run - parse on a packet in binary and return the result\n+ * @psr: pointer to a parser instance\n+ * @pkt_buf: packet data\n+ * @pkt_len: packet length\n+ * @rslt: input/output parameter to save parser result.\n+ */\n+enum ice_status ice_parser_run(struct ice_parser *psr, const u8 *pkt_buf,\n+\t\t\t       int pkt_len, struct ice_parser_result *rslt)\n+{\n+\tice_parser_rt_reset(&psr->rt);\n+\tice_parser_rt_pktbuf_set(&psr->rt, pkt_buf, pkt_len);\n+\n+\treturn ice_parser_rt_execute(&psr->rt, rslt);\n+}\n+\n+/**\n+ * ice_parser_result_dump - dump a parser result info\n+ * @hw: pointer to the hardware structure\n+ * @rslt: parser result info to dump\n+ */\n+void ice_parser_result_dump(struct ice_hw *hw, struct ice_parser_result *rslt)\n+{\n+\tint i;\n+\n+\tice_info(hw, \"ptype = %d\\n\", rslt->ptype);\n+\tfor (i = 0; i < rslt->po_num; i++)\n+\t\tice_info(hw, \"proto = %d, offset = %d\\n\",\n+\t\t\t rslt->po[i].proto_id, rslt->po[i].offset);\n+\n+\tice_info(hw, \"flags_psr = 0x%016\" PRIx64 \"\\n\", rslt->flags_psr);\n+\tice_info(hw, \"flags_pkt = 0x%016\" PRIx64 \"\\n\", rslt->flags_pkt);\n+\tice_info(hw, \"flags_sw = 0x%04x\\n\", rslt->flags_sw);\n+\tice_info(hw, \"flags_fd = 0x%04x\\n\", rslt->flags_fd);\n+\tice_info(hw, \"flags_rss = 0x%04x\\n\", rslt->flags_rss);\n+}\ndiff --git a/drivers/net/ice/base/ice_parser.h b/drivers/net/ice/base/ice_parser.h\nindex ba3175e60f..f71a8d8775 100644\n--- a/drivers/net/ice/base/ice_parser.h\n+++ b/drivers/net/ice/base/ice_parser.h\n@@ -14,6 +14,7 @@\n #include \"ice_proto_grp.h\"\n #include \"ice_flg_rd.h\"\n #include \"ice_xlt_kb.h\"\n+#include \"ice_parser_rt.h\"\n \n struct ice_parser {\n \tstruct ice_hw *hw; /* pointer to the hardware structure */\n@@ -50,8 +51,31 @@ struct ice_parser {\n \tstruct ice_xlt_kb *xlt_kb_fd;\n \t/* load data from section ICE_SID_XLT_KEY_BUILDER_RSS */\n \tstruct ice_xlt_kb *xlt_kb_rss;\n+\tstruct ice_parser_rt rt; /* parser runtime */\n };\n \n enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr);\n void ice_parser_destroy(struct ice_parser *psr);\n+\n+struct ice_parser_proto_off {\n+\tu8 proto_id; /* hardware protocol ID */\n+\tu16 offset;  /* offset where the  protocol header start */\n+};\n+\n+struct ice_parser_result {\n+\tu16 ptype; /* 16 bits hardware PTYPE */\n+\t/* protocol and header offset pairs */\n+\tstruct ice_parser_proto_off po[16];\n+\tint po_num; /* number of pairs must <= 16 */\n+\tu64 flags_psr; /* 64 bits parser flags */\n+\tu64 flags_pkt; /* 64 bits packet flags */\n+\tu16 flags_sw; /* 16 bits key builder flag for SW */\n+\tu16 flags_acl; /* 16 bits key builder flag for ACL */\n+\tu16 flags_fd; /* 16 bits key builder flag for FD */\n+\tu16 flags_rss; /* 16 bits key builder flag for RSS */\n+};\n+\n+enum ice_status ice_parser_run(struct ice_parser *psr, const u8 *pkt_buf,\n+\t\t\t       int pkt_len, struct ice_parser_result *rslt);\n+void ice_parser_result_dump(struct ice_hw *hw, struct ice_parser_result *rslt);\n #endif /* _ICE_PARSER_H_ */\ndiff --git a/drivers/net/ice/base/ice_parser_rt.c b/drivers/net/ice/base/ice_parser_rt.c\nnew file mode 100644\nindex 0000000000..d62d0170e5\n--- /dev/null\n+++ b/drivers/net/ice/base/ice_parser_rt.c\n@@ -0,0 +1,98 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2001-2021 Intel Corporation\n+ */\n+\n+#include \"ice_common.h\"\n+\n+#define GPR_HB_IDX\t64\n+#define GPR_ERR_IDX\t84\n+#define GPR_FLG_IDX\t104\n+#define GPR_TSR_IDX\t108\n+#define GPR_NN_IDX\t109\n+#define GPR_HO_IDX\t110\n+#define GPR_NP_IDX\t111\n+\n+static void _rt_tsr_set(struct ice_parser_rt *rt, u16 tsr)\n+{\n+\trt->gpr[GPR_TSR_IDX] = tsr;\n+}\n+\n+static void _rt_ho_set(struct ice_parser_rt *rt, u16 ho)\n+{\n+\trt->gpr[GPR_HO_IDX] = ho;\n+\tice_memcpy(&rt->gpr[GPR_HB_IDX], &rt->pkt_buf[ho], 32,\n+\t\t   ICE_NONDMA_TO_NONDMA);\n+}\n+\n+static void _rt_np_set(struct ice_parser_rt *rt, u16 pc)\n+{\n+\trt->gpr[GPR_NP_IDX] = pc;\n+}\n+\n+static void _rt_nn_set(struct ice_parser_rt *rt, u16 node)\n+{\n+\trt->gpr[GPR_NN_IDX] = node;\n+}\n+\n+static void _rt_flag_set(struct ice_parser_rt *rt, int idx)\n+{\n+\tint y = idx / 16;\n+\tint x = idx % 16;\n+\n+\trt->gpr[GPR_FLG_IDX + y] |= (u16)(1 << x);\n+}\n+\n+/**\n+ * ice_parser_rt_reset - reset the parser runtime\n+ * @rt: pointer to the parser runtime\n+ */\n+void ice_parser_rt_reset(struct ice_parser_rt *rt)\n+{\n+\tstruct ice_parser *psr = rt->psr;\n+\tstruct ice_metainit_item *mi = &psr->mi_table[0];\n+\tint i;\n+\n+\tice_memset(rt, 0, sizeof(*rt), ICE_NONDMA_MEM);\n+\n+\t_rt_tsr_set(rt, mi->tsr);\n+\t_rt_ho_set(rt, mi->ho);\n+\t_rt_np_set(rt, mi->pc);\n+\t_rt_nn_set(rt, mi->pg_rn);\n+\n+\tfor (i = 0; i < 64; i++) {\n+\t\tif ((mi->flags & (1ul << i)) != 0ul)\n+\t\t\t_rt_flag_set(rt, i);\n+\t}\n+\n+\trt->psr = psr;\n+}\n+\n+/**\n+ * ice_parser_rt_pktbuf_set - set a packet into parser runtime\n+ * @rt: pointer to the parser runtime\n+ * @pkt_buf: buffer with packet data\n+ * @pkt_len: packet buffer length\n+ */\n+void ice_parser_rt_pktbuf_set(struct ice_parser_rt *rt, const u8 *pkt_buf,\n+\t\t\t      int pkt_len)\n+{\n+\tint len = min(ICE_PARSER_MAX_PKT_LEN, pkt_len);\n+\tu16 ho = rt->gpr[GPR_HO_IDX];\n+\n+\tice_memcpy(rt->pkt_buf, pkt_buf, len, ICE_NONDMA_TO_NONDMA);\n+\trt->pkt_len = pkt_len;\n+\n+\tice_memcpy(&rt->gpr[GPR_HB_IDX], &rt->pkt_buf[ho], 32,\n+\t\t   ICE_NONDMA_TO_NONDMA);\n+}\n+\n+/**\n+ * ice_parser_rt_execute - parser execution routine\n+ * @rt: pointer to the parser runtime\n+ * @rslt: input/output parameter to save parser result\n+ */\n+enum ice_status ice_parser_rt_execute(struct ice_parser_rt *rt,\n+\t\t\t\t      struct ice_parser_result *rslt)\n+{\n+\treturn ICE_ERR_NOT_IMPL;\n+}\ndiff --git a/drivers/net/ice/base/ice_parser_rt.h b/drivers/net/ice/base/ice_parser_rt.h\nnew file mode 100644\nindex 0000000000..32fa7f6579\n--- /dev/null\n+++ b/drivers/net/ice/base/ice_parser_rt.h\n@@ -0,0 +1,28 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2001-2021 Intel Corporation\n+ */\n+\n+#ifndef _ICE_PARSER_RT_H_\n+#define _ICE_PARSER_RT_H_\n+\n+struct ice_parser_ctx;\n+\n+#define ICE_PARSER_MAX_PKT_LEN 504\n+#define ICE_PARSER_GPR_NUM 128\n+\n+struct ice_parser_rt {\n+\tstruct ice_parser *psr;\n+\tu16 gpr[ICE_PARSER_GPR_NUM];\n+\tu8 pkt_buf[ICE_PARSER_MAX_PKT_LEN + 32];\n+\tu16 pkt_len;\n+\tu16 po;\n+};\n+\n+void ice_parser_rt_reset(struct ice_parser_rt *rt);\n+void ice_parser_rt_pktbuf_set(struct ice_parser_rt *rt, const u8 *pkt_buf,\n+\t\t\t      int pkt_len);\n+\n+struct ice_parser_result;\n+enum ice_status ice_parser_rt_execute(struct ice_parser_rt *rt,\n+\t\t\t\t      struct ice_parser_result *rslt);\n+#endif /* _ICE_PARSER_RT_H_ */\ndiff --git a/drivers/net/ice/base/meson.build b/drivers/net/ice/base/meson.build\nindex 35f2ac2312..c4fd1b96c6 100644\n--- a/drivers/net/ice/base/meson.build\n+++ b/drivers/net/ice/base/meson.build\n@@ -25,6 +25,7 @@ sources = [\n \t'ice_proto_grp.c',\n \t'ice_flg_rd.c',\n \t'ice_xlt_kb.c',\n+\t'ice_parser_rt.c',\n ]\n \n error_cflags = [\n",
    "prefixes": [
        "v3",
        "11/20"
    ]
}