get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 109652,
    "url": "https://patches.dpdk.org/api/patches/109652/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220413160932.2074781-21-kevinx.liu@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": "<20220413160932.2074781-21-kevinx.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220413160932.2074781-21-kevinx.liu@intel.com",
    "date": "2022-04-13T16:09:19",
    "name": "[v2,20/33] net/ice/base: support IPv4 GRE tunnel",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a84820e81ffa6f46377008a2349aea7dad2b9fee",
    "submitter": {
        "id": 2440,
        "url": "https://patches.dpdk.org/api/people/2440/?format=api",
        "name": "Kevin Liu",
        "email": "kevinx.liu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220413160932.2074781-21-kevinx.liu@intel.com/mbox/",
    "series": [
        {
            "id": 22497,
            "url": "https://patches.dpdk.org/api/series/22497/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=22497",
            "date": "2022-04-13T16:08:59",
            "name": "support full function of DCF",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/22497/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/109652/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/109652/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 D80BFA0508;\n\tWed, 13 Apr 2022 10:12:53 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1346C42835;\n\tWed, 13 Apr 2022 10:11:39 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 7958042802\n for <dev@dpdk.org>; Wed, 13 Apr 2022 10:11:36 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Apr 2022 01:11:35 -0700",
            "from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195])\n by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Apr 2022 01:11:32 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1649837496; x=1681373496;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=e3DAAmQzR/BbODjS4ihK3J3G75SEspdVFZqp2V/eqf4=;\n b=Q38llHzxnMaW8sX9t6WtgpQxq4lp4ynrZKBLSG7+ENZpgknR/+6wNDLQ\n 8VMNR6PVcNPTQXzIT8pYEVEP6ftvmSiN566HrRbnxx4VsDO9cDCm+RL45\n rSEvYSF5ZN8DxHelZO1vvmz1PcGg4E5+9bFYC/H4luDc1fKq3G5I7Ynq/\n EVe0CPF/FkNaAnaQ33ryMpU0v8WtG+gzfmneKxKx4AFY/sjSUFSB1tGfz\n Rc8XiU7wHesGhbgtUgXJt2N365tteoslBxHvwKmV+x62SvP9j8fOy8LAD\n 9+KwH3kBukQETJJVeT3RLjcNFv/6Rrh3gWPVzH8v0Zv3ftuuTkWmfz3wr g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10315\"; a=\"287630064\"",
            "E=Sophos;i=\"5.90,256,1643702400\"; d=\"scan'208\";a=\"287630064\"",
            "E=Sophos;i=\"5.90,256,1643702400\"; d=\"scan'208\";a=\"526847758\""
        ],
        "From": "Kevin Liu <kevinx.liu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com,\n Alvin Zhang <alvinx.zhang@intel.com>, Junfeng Guo <junfeng.guo@intel.com>,\n Kevin Liu <kevinx.liu@intel.com>",
        "Subject": "[PATCH v2 20/33] net/ice/base: support IPv4 GRE tunnel",
        "Date": "Wed, 13 Apr 2022 16:09:19 +0000",
        "Message-Id": "<20220413160932.2074781-21-kevinx.liu@intel.com>",
        "X-Mailer": "git-send-email 2.33.1",
        "In-Reply-To": "<20220413160932.2074781-1-kevinx.liu@intel.com>",
        "References": "<20220407105706.18889-1-kevinx.liu@intel.com>\n <20220413160932.2074781-1-kevinx.liu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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"
    },
    "content": "From: Alvin Zhang <alvinx.zhang@intel.com>\n\nAdd definitions, trainer packets and routine path for IPv4 GRE tunnel.\nRef:\nhttps://www.ietf.org/rfc/rfc1701.html\n\nSigned-off-by: Junfeng Guo <junfeng.guo@intel.com>\nSigned-off-by: Alvin Zhang <alvinx.zhang@intel.com>\nSigned-off-by: Kevin Liu <kevinx.liu@intel.com>\n---\n drivers/net/ice/base/ice_flex_pipe.c     |  37 ++-\n drivers/net/ice/base/ice_flex_pipe.h     |   3 +-\n drivers/net/ice/base/ice_protocol_type.h |  15 ++\n drivers/net/ice/base/ice_switch.c        | 304 ++++++++++++++++++++++-\n 4 files changed, 332 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c\nindex f6a29f87c5..8672c41c69 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.c\n+++ b/drivers/net/ice/base/ice_flex_pipe.c\n@@ -1851,6 +1851,7 @@ ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type req_profs,\n  * @ids_cnt: lookup/protocol count\n  * @bm: bitmap of field vectors to consider\n  * @fv_list: Head of a list\n+ * @lkup_exts: lookup elements\n  *\n  * Finds all the field vector entries from switch block that contain\n  * a given protocol ID and returns a list of structures of type\n@@ -1861,7 +1862,8 @@ ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type req_profs,\n  */\n enum ice_status\n ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt,\n-\t\t   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list)\n+\t\t   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list,\n+\t\t   struct ice_prot_lkup_ext *lkup_exts)\n {\n \tstruct ice_sw_fv_list_entry *fvl;\n \tstruct ice_sw_fv_list_entry *tmp;\n@@ -1892,29 +1894,26 @@ ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt,\n \t\tif (!ice_is_bit_set(bm, (u16)offset))\n \t\t\tcontinue;\n \n-\t\tfor (i = 0; i < ids_cnt; i++) {\n+\t\tint found = 1;\n+\t\tfor (i = 0; i < lkup_exts->n_val_words; i++) {\n \t\t\tint j;\n \n-\t\t\t/* This code assumes that if a switch field vector line\n-\t\t\t * has a matching protocol, then this line will contain\n-\t\t\t * the entries necessary to represent every field in\n-\t\t\t * that protocol header.\n-\t\t\t */\n \t\t\tfor (j = 0; j < hw->blk[ICE_BLK_SW].es.fvw; j++)\n-\t\t\t\tif (fv->ew[j].prot_id == prot_ids[i])\n+\t\t\t\tif (fv->ew[j].prot_id ==\n+\t\t\t\t    lkup_exts->fv_words[i].prot_id &&\n+\t\t\t\t    fv->ew[j].off == lkup_exts->fv_words[i].off)\n \t\t\t\t\tbreak;\n \t\t\tif (j >= hw->blk[ICE_BLK_SW].es.fvw)\n-\t\t\t\tbreak;\n-\t\t\tif (i + 1 == ids_cnt) {\n-\t\t\t\tfvl = (struct ice_sw_fv_list_entry *)\n-\t\t\t\t\tice_malloc(hw, sizeof(*fvl));\n-\t\t\t\tif (!fvl)\n-\t\t\t\t\tgoto err;\n-\t\t\t\tfvl->fv_ptr = fv;\n-\t\t\t\tfvl->profile_id = offset;\n-\t\t\t\tLIST_ADD(&fvl->list_entry, fv_list);\n-\t\t\t\tbreak;\n-\t\t\t}\n+\t\t\t\tfound = 0;\n+\t\t}\n+\t\tif (found) {\n+\t\t\tfvl = (struct ice_sw_fv_list_entry *)\n+\t\t\t\tice_malloc(hw, sizeof(*fvl));\n+\t\t\tif (!fvl)\n+\t\t\t\tgoto err;\n+\t\t\tfvl->fv_ptr = fv;\n+\t\t\tfvl->profile_id = offset;\n+\t\t\tLIST_ADD(&fvl->list_entry, fv_list);\n \t\t}\n \t} while (fv);\n \tif (LIST_EMPTY(fv_list))\ndiff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h\nindex 23ba45564a..a22d66f3cf 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.h\n+++ b/drivers/net/ice/base/ice_flex_pipe.h\n@@ -37,7 +37,8 @@ void\n ice_init_prof_result_bm(struct ice_hw *hw);\n enum ice_status\n ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt,\n-\t\t   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list);\n+\t\t   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list,\n+\t\t   struct ice_prot_lkup_ext *lkup_exts);\n enum ice_status\n ice_pkg_buf_unreserve_section(struct ice_buf_build *bld, u16 count);\n u16 ice_pkg_buf_get_free_space(struct ice_buf_build *bld);\ndiff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h\nindex eec9f27823..ffd34606e0 100644\n--- a/drivers/net/ice/base/ice_protocol_type.h\n+++ b/drivers/net/ice/base/ice_protocol_type.h\n@@ -67,6 +67,7 @@ enum ice_sw_tunnel_type {\n \tICE_SW_TUN_VXLAN,\t/* VXLAN matches only non-VLAN pkts */\n \tICE_SW_TUN_VXLAN_VLAN,  /* VXLAN matches both VLAN and non-VLAN pkts */\n \tICE_SW_TUN_NVGRE,\n+\tICE_SW_TUN_GRE,\n \tICE_SW_TUN_UDP, /* This means all \"UDP\" tunnel types: VXLAN-GPE, VXLAN\n \t\t\t * and GENEVE\n \t\t\t */\n@@ -231,6 +232,10 @@ enum ice_prot_id {\n #define ICE_TUN_FLAG_VLAN_MASK 0x01\n #define ICE_TUN_FLAG_FV_IND 2\n \n+#define ICE_GRE_FLAG_MDID 22\n+#define ICE_GRE_FLAG_MDID_OFF (ICE_MDID_SIZE * ICE_GRE_FLAG_MDID)\n+#define ICE_GRE_FLAG_MASK 0x01C0\n+\n #define ICE_PROTOCOL_MAX_ENTRIES 16\n \n /* Mapping of software defined protocol ID to hardware defined protocol ID */\n@@ -371,6 +376,15 @@ struct ice_nvgre {\n \t__be32 tni_flow;\n };\n \n+struct ice_gre {\n+\t__be16 flags;\n+\t__be16 protocol;\n+\t__be16 chksum;\n+\t__be16 offset;\n+\t__be32 key;\n+\t__be32 seqnum;\n+};\n+\n union ice_prot_hdr {\n \tstruct ice_ether_hdr eth_hdr;\n \tstruct ice_ethtype_hdr ethertype;\n@@ -381,6 +395,7 @@ union ice_prot_hdr {\n \tstruct ice_sctp_hdr sctp_hdr;\n \tstruct ice_udp_tnl_hdr tnl_hdr;\n \tstruct ice_nvgre nvgre_hdr;\n+\tstruct ice_gre gre_hdr;\n \tstruct ice_udp_gtp_hdr gtp_hdr;\n \tstruct ice_pppoe_hdr pppoe_hdr;\n \tstruct ice_pfcp_hdr pfcp_hdr;\ndiff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c\nindex c742dba138..1b51cd4321 100644\n--- a/drivers/net/ice/base/ice_switch.c\n+++ b/drivers/net/ice/base/ice_switch.c\n@@ -12,6 +12,7 @@\n #define ICE_MAX_VLAN_ID\t\t\t0xFFF\n #define ICE_IPV6_ETHER_ID\t\t0x86DD\n #define ICE_IPV4_NVGRE_PROTO_ID\t\t0x002F\n+#define ICE_IPV4_GRE_PROTO_ID\t\t0x002F\n #define ICE_IPV6_GRE_PROTO_ID\t\t0x002F\n #define ICE_PPP_IPV6_PROTO_ID\t\t0x0057\n #define ICE_TCP_PROTO_ID\t\t0x06\n@@ -158,6 +159,188 @@ static const u8 dummy_ipv6_gre_udp_packet[] = {\n \t0xff, 0xd8, 0x00, 0x00,\n };\n \n+static const struct ice_dummy_pkt_offsets\n+dummy_gre_rfc1701_c1k1_tcp_packet_offsets[] = {\n+\t{ ICE_MAC_OFOS,         0 },\n+\t{ ICE_ETYPE_OL,         12 },\n+\t{ ICE_IPV4_OFOS,        14 },\n+\t{ ICE_GRE,              34 },\n+\t{ ICE_IPV4_IL,          50 },\n+\t{ ICE_TCP_IL,           70 },\n+\t{ ICE_PROTOCOL_LAST,    0 },\n+};\n+\n+static const u8 dummy_gre_rfc1701_c1k1_tcp_packet[] = {\n+\t0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */\n+\t0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00,\n+\n+\t0x08, 0x00,             /* ICE_ETYPE_OL 12 */\n+\n+\t0x45, 0x00, 0x00, 0x4e, /* ICE_IPV4_OFOS 14 */\n+\t0x00, 0x01, 0x00, 0x00,\n+\t0x40, 0x2f, 0x7c, 0x7e,\n+\t0x7f, 0x00, 0x00, 0x01,\n+\t0x7f, 0x00, 0x00, 0x01,\n+\n+\t0xb0, 0x00, 0x08, 0x00, /* ICE_GRE 34 */\n+\t0x46, 0x1e, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00,\n+\n+\t0x45, 0x00, 0x00, 0x2a, /* ICE_IPV4_IL 50 */\n+\t0x00, 0x01, 0x00, 0x00,\n+\t0x40, 0x06, 0x7c, 0xcb,\n+\t0x7f, 0x00, 0x00, 0x01,\n+\t0x7f, 0x00, 0x00, 0x01,\n+\n+\t0x00, 0x14, 0x00, 0x50, /* ICE_TCP_IL 70 */\n+\t0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00,\n+\t0x50, 0x02, 0x20, 0x00,\n+\t0x91, 0x7a, 0x00, 0x00,\n+\n+\t0x00, 0x00,\n+};\n+\n+static const struct ice_dummy_pkt_offsets\n+dummy_gre_rfc1701_c1k1_udp_packet_offsets[] = {\n+\t{ ICE_MAC_OFOS,         0 },\n+\t{ ICE_ETYPE_OL,         12 },\n+\t{ ICE_IPV4_OFOS,        14 },\n+\t{ ICE_GRE,              34 },\n+\t{ ICE_IPV4_IL,          50 },\n+\t{ ICE_UDP_ILOS,         70 },\n+\t{ ICE_PROTOCOL_LAST,    0 },\n+};\n+\n+static const u8 dummy_gre_rfc1701_c1k1_udp_packet[] = {\n+\t0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */\n+\t0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00,\n+\n+\t0x08, 0x00,             /* ICE_ETYPE_OL 12 */\n+\n+\t0x45, 0x00, 0x00, 0x42, /* ICE_IPV4_OFOS 14 */\n+\t0x00, 0x01, 0x00, 0x00,\n+\t0x40, 0x2f, 0x7c, 0x8a,\n+\t0x7f, 0x00, 0x00, 0x01,\n+\t0x7f, 0x00, 0x00, 0x01,\n+\n+\t0xb0, 0x00, 0x08, 0x00, /* ICE_GRE 34 */\n+\t0x46, 0x1d, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00,\n+\n+\t0x45, 0x00, 0x00, 0x1e, /* ICE_IPV4_IL 50 */\n+\t0x00, 0x01, 0x00, 0x00,\n+\t0x40, 0x11, 0x7c, 0xcc,\n+\t0x7f, 0x00, 0x00, 0x01,\n+\t0x7f, 0x00, 0x00, 0x01,\n+\n+\t0x00, 0x35, 0x00, 0x35, /* ICE_UDP_ILOS 70 */\n+\t0x00, 0x0a, 0x01, 0x6e,\n+\n+\t0x00, 0x00,\n+};\n+\n+static const struct ice_dummy_pkt_offsets\n+dummy_gre_rfc1701_c0k1_tcp_packet_offsets[] = {\n+\t{ ICE_MAC_OFOS,         0 },\n+\t{ ICE_ETYPE_OL,         12 },\n+\t{ ICE_IPV4_OFOS,        14 },\n+\t{ ICE_GRE,              34 },\n+\t{ ICE_IPV4_IL,          46 },\n+\t{ ICE_TCP_IL,           66 },\n+\t{ ICE_PROTOCOL_LAST,    0 },\n+};\n+\n+static const u8 dummy_gre_rfc1701_c0k1_tcp_packet[] = {\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,\n+\t0x00, 0x4a, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,\n+\t0x7c, 0x82, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x30, 0x00, 0x08, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,\n+\t0x00, 0x2a, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06,\n+\t0x7c, 0xcb, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x00, 0x14, 0x00, 0x50, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02,\n+\t0x20, 0x00, 0x91, 0x7a, 0x00, 0x00, 0x00, 0x00,\n+};\n+\n+static const struct ice_dummy_pkt_offsets\n+dummy_gre_rfc1701_c0k1_udp_packet_offsets[] = {\n+\t{ ICE_MAC_OFOS,         0 },\n+\t{ ICE_ETYPE_OL,         12 },\n+\t{ ICE_IPV4_OFOS,        14 },\n+\t{ ICE_GRE,              34 },\n+\t{ ICE_IPV4_IL,          46 },\n+\t{ ICE_UDP_ILOS,         66 },\n+\t{ ICE_PROTOCOL_LAST,    0 },\n+};\n+\n+static const u8 dummy_gre_rfc1701_c0k1_udp_packet[] = {\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,\n+\t0x00, 0x3e, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,\n+\t0x7c, 0x8e, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x30, 0x00, 0x08, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,\n+\t0x00, 0x1e, 0x00, 0x01, 0x00, 0x00, 0x40, 0x11,\n+\t0x7c, 0xcc, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x00, 0x35, 0x00, 0x35, 0x00, 0x0a,\n+\t0x01, 0x6e, 0x00, 0x00,\n+};\n+\n+static const struct ice_dummy_pkt_offsets\n+dummy_gre_rfc1701_c0k0_tcp_packet_offsets[] = {\n+\t{ ICE_MAC_OFOS,         0 },\n+\t{ ICE_ETYPE_OL,         12 },\n+\t{ ICE_IPV4_OFOS,        14 },\n+\t{ ICE_GRE,              34 },\n+\t{ ICE_IPV4_IL,          42 },\n+\t{ ICE_TCP_IL,           62 },\n+\t{ ICE_PROTOCOL_LAST,    0 },\n+};\n+\n+static const u8 dummy_gre_rfc1701_c0k0_tcp_packet[] = {\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,\n+\t0x00, 0x46, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,\n+\t0x7c, 0x86, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x45, 0x00, 0x00, 0x2a, 0x00, 0x01,\n+\t0x00, 0x00, 0x40, 0x06, 0x7c, 0xcb, 0x7f, 0x00,\n+\t0x00, 0x01, 0x7f, 0x00, 0x00, 0x01, 0x00, 0x14,\n+\t0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x50, 0x02, 0x20, 0x00, 0x91, 0x7a,\n+\t0x00, 0x00, 0x00, 0x00,\n+};\n+\n+static const struct ice_dummy_pkt_offsets\n+dummy_gre_rfc1701_c0k0_udp_packet_offsets[] = {\n+\t{ ICE_MAC_OFOS,         0 },\n+\t{ ICE_ETYPE_OL,         12 },\n+\t{ ICE_IPV4_OFOS,        14 },\n+\t{ ICE_GRE,              34 },\n+\t{ ICE_IPV4_IL,          42 },\n+\t{ ICE_UDP_ILOS,         62 },\n+\t{ ICE_PROTOCOL_LAST,    0 },\n+};\n+\n+static const u8 dummy_gre_rfc1701_c0k0_udp_packet[] = {\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,\n+\t0x00, 0x3a, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,\n+\t0x7c, 0x92, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x45, 0x00, 0x00, 0x1e, 0x00, 0x01,\n+\t0x00, 0x00, 0x40, 0x11, 0x7c, 0xcc, 0x7f, 0x00,\n+\t0x00, 0x01, 0x7f, 0x00, 0x00, 0x01, 0x00, 0x35,\n+\t0x00, 0x35, 0x00, 0x0a, 0x01, 0x6e, 0x00, 0x00,\n+};\n+\n static const struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {\n \t{ ICE_MAC_OFOS,\t\t0 },\n \t{ ICE_ETYPE_OL,\t\t12 },\n@@ -173,7 +356,7 @@ static const struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {\n };\n \n static const u8 dummy_udp_tun_tcp_packet[] = {\n-\t0x00, 0x00, 0x00, 0x00,  /* ICE_MAC_OFOS 0 */\n+\t0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */\n \t0x00, 0x00, 0x00, 0x00,\n \t0x00, 0x00, 0x00, 0x00,\n \n@@ -224,7 +407,7 @@ static const struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {\n };\n \n static const u8 dummy_udp_tun_udp_packet[] = {\n-\t0x00, 0x00, 0x00, 0x00,  /* ICE_MAC_OFOS 0 */\n+\t0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */\n \t0x00, 0x00, 0x00, 0x00,\n \t0x00, 0x00, 0x00, 0x00,\n \n@@ -6892,6 +7075,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {\n \t{ ICE_GENEVE,\t\t{ 8, 10, 12, 14 } },\n \t{ ICE_VXLAN_GPE,\t{ 8, 10, 12, 14 } },\n \t{ ICE_NVGRE,\t\t{ 0, 2, 4, 6 } },\n+\t{ ICE_GRE,              { 0, 2, 4, 6, 8, 10, 12, 14 } },\n \t{ ICE_GTP,\t\t{ 8, 10, 12, 14, 16, 18, 20, 22 } },\n \t{ ICE_PPPOE,\t\t{ 0, 2, 4, 6 } },\n \t{ ICE_PFCP,\t\t{ 8, 10, 12, 14, 16, 18, 20, 22 } },\n@@ -6927,6 +7111,7 @@ static struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {\n \t{ ICE_GENEVE,\t\tICE_UDP_OF_HW },\n \t{ ICE_VXLAN_GPE,\tICE_UDP_OF_HW },\n \t{ ICE_NVGRE,\t\tICE_GRE_OF_HW },\n+\t{ ICE_GRE,              ICE_GRE_OF_HW },\n \t{ ICE_GTP,\t\tICE_UDP_OF_HW },\n \t{ ICE_PPPOE,\t\tICE_PPPOE_HW },\n \t{ ICE_PFCP,\t\tICE_UDP_ILOS_HW },\n@@ -7065,6 +7250,7 @@ ice_fill_valid_words(struct ice_adv_lkup_elem *rule,\n \t\t     struct ice_prot_lkup_ext *lkup_exts)\n {\n \tu8 j, word, prot_id, ret_val;\n+\tu8 extra_byte = 0;\n \n \tif (!ice_prot_type_to_id(rule->type, &prot_id))\n \t\treturn 0;\n@@ -7077,8 +7263,15 @@ ice_fill_valid_words(struct ice_adv_lkup_elem *rule,\n \t\t\t/* No more space to accommodate */\n \t\t\tif (word >= ICE_MAX_CHAIN_WORDS)\n \t\t\t\treturn 0;\n+\t\t\tif (rule->type == ICE_GRE) {\n+\t\t\t\tif (ice_prot_ext[rule->type].offs[j] == 0) {\n+\t\t\t\t\tif (((u16 *)&rule->h_u)[j] == 0x20)\n+\t\t\t\t\t\textra_byte = 4;\n+\t\t\t\t\tcontinue;\n+\t\t\t\t}\n+\t\t\t}\n \t\t\tlkup_exts->fv_words[word].off =\n-\t\t\t\tice_prot_ext[rule->type].offs[j];\n+\t\t\t\tice_prot_ext[rule->type].offs[j] - extra_byte;\n \t\t\tlkup_exts->fv_words[word].prot_id =\n \t\t\t\tice_prot_id_tbl[rule->type].protocol_id;\n \t\t\tlkup_exts->field_mask[word] =\n@@ -7622,10 +7815,12 @@ ice_create_recipe_group(struct ice_hw *hw, struct ice_sw_recipe *rm,\n  * @lkups_cnt: number of protocols\n  * @bm: bitmap of field vectors to consider\n  * @fv_list: pointer to a list that holds the returned field vectors\n+ * @lkup_exts: lookup elements\n  */\n static enum ice_status\n ice_get_fv(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,\n-\t   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list)\n+\t   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list,\n+\t   struct ice_prot_lkup_ext *lkup_exts)\n {\n \tenum ice_status status;\n \tu8 *prot_ids;\n@@ -7645,7 +7840,8 @@ ice_get_fv(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,\n \t\t}\n \n \t/* Find field vectors that include all specified protocol types */\n-\tstatus = ice_get_sw_fv_list(hw, prot_ids, lkups_cnt, bm, fv_list);\n+\tstatus = ice_get_sw_fv_list(hw, prot_ids, lkups_cnt, bm, fv_list,\n+\t\t\t\t    lkup_exts);\n \n free_mem:\n \tice_free(hw, prot_ids);\n@@ -7681,6 +7877,10 @@ static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *mask)\n \t\t*mask = ICE_TUN_FLAG_MASK;\n \t\treturn true;\n \n+\tcase ICE_SW_TUN_GRE:\n+\t\t*mask = ICE_GRE_FLAG_MASK;\n+\t\treturn true;\n+\n \tcase ICE_SW_TUN_GENEVE_VLAN:\n \tcase ICE_SW_TUN_VXLAN_VLAN:\n \t\t*mask = ICE_TUN_FLAG_MASK & ~ICE_TUN_FLAG_VLAN_MASK;\n@@ -7702,6 +7902,12 @@ ice_add_special_words(struct ice_adv_rule_info *rinfo,\n \t\t      struct ice_prot_lkup_ext *lkup_exts)\n {\n \tu16 mask;\n+\tu8 has_gre_key = 0;\n+\tu8 i;\n+\n+\tfor (i = 0; i < lkup_exts->n_val_words; i++)\n+\t\tif (lkup_exts->fv_words[i].prot_id == 0x40)\n+\t\t\thas_gre_key = 1;\n \n \t/* If this is a tunneled packet, then add recipe index to match the\n \t * tunnel bit in the packet metadata flags.\n@@ -7713,6 +7919,13 @@ ice_add_special_words(struct ice_adv_rule_info *rinfo,\n \t\t\tlkup_exts->fv_words[word].prot_id = ICE_META_DATA_ID_HW;\n \t\t\tlkup_exts->fv_words[word].off = ICE_TUN_FLAG_MDID_OFF;\n \t\t\tlkup_exts->field_mask[word] = mask;\n+\n+\t\t\tif (rinfo->tun_type == ICE_SW_TUN_GRE)\n+\t\t\t\tlkup_exts->fv_words[word].off =\n+\t\t\t\t\t\tICE_GRE_FLAG_MDID_OFF;\n+\n+\t\t\tif (!has_gre_key)\n+\t\t\t\tlkup_exts->field_mask[word] = 0x0140;\n \t\t} else {\n \t\t\treturn ICE_ERR_MAX_LIMIT;\n \t\t}\n@@ -7754,6 +7967,9 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,\n \tcase ICE_SW_TUN_NVGRE:\n \t\tprof_type = ICE_PROF_TUN_GRE;\n \t\tbreak;\n+\tcase ICE_SW_TUN_GRE:\n+\t\tprof_type = ICE_PROF_TUN_GRE;\n+\t\tbreak;\n \tcase ICE_SW_TUN_PPPOE:\n \tcase ICE_SW_TUN_PPPOE_QINQ:\n \t\tprof_type = ICE_PROF_TUN_PPPOE;\n@@ -8079,7 +8295,8 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,\n \t */\n \tice_get_compat_fv_bitmap(hw, rinfo, fv_bitmap);\n \n-\tstatus = ice_get_fv(hw, lkups, lkups_cnt, fv_bitmap, &rm->fv_list);\n+\tstatus = ice_get_fv(hw, lkups, lkups_cnt, fv_bitmap, &rm->fv_list,\n+\t\t\t    lkup_exts);\n \tif (status)\n \t\tgoto err_unroll;\n \n@@ -8228,6 +8445,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,\n \t\t      const struct ice_dummy_pkt_offsets **offsets)\n {\n \tbool tcp = false, udp = false, ipv6 = false, vlan = false;\n+\tbool gre_c_bit = false;\n+\tbool gre_k_bit = false;\n \tbool gre = false, mpls = false;\n \tu16 i;\n \n@@ -8245,6 +8464,17 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,\n \t\t}\n \t\telse if (lkups[i].type == ICE_VLAN_OFOS)\n \t\t\tvlan = true;\n+\t\telse if (lkups[i].type == ICE_GRE) {\n+\t\t\tif (lkups[i].h_u.gre_hdr.flags & 0x20)\n+\t\t\t\tgre_k_bit = true;\n+\t\t\tif (lkups[i].h_u.gre_hdr.flags & 0x80)\n+\t\t\t\tgre_c_bit = true;\n+\t\t} else if (lkups[i].type == ICE_IPV4_OFOS &&\n+\t\t\t lkups[i].h_u.ipv4_hdr.protocol ==\n+\t\t\t\tICE_IPV4_GRE_PROTO_ID &&\n+\t\t\t lkups[i].m_u.ipv4_hdr.protocol ==\n+\t\t\t\t0xFF)\n+\t\t\tgre = true;\n \t\telse if (lkups[i].type == ICE_ETYPE_OL &&\n \t\t\t lkups[i].h_u.ethertype.ethtype_id ==\n \t\t\t\tCPU_TO_BE16(ICE_IPV6_ETHER_ID) &&\n@@ -8650,6 +8880,46 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,\n \t\treturn;\n \t}\n \n+\tif (tun_type == ICE_SW_TUN_GRE && tcp) {\n+\t\tif (gre_c_bit && gre_k_bit) {\n+\t\t\t*pkt = dummy_gre_rfc1701_c1k1_tcp_packet;\n+\t\t\t*pkt_len = sizeof(dummy_gre_rfc1701_c1k1_tcp_packet);\n+\t\t\t*offsets = dummy_gre_rfc1701_c1k1_tcp_packet_offsets;\n+\t\t\treturn;\n+\t\t}\n+\t\tif (!gre_c_bit && gre_k_bit) {\n+\t\t\t*pkt = dummy_gre_rfc1701_c0k1_tcp_packet;\n+\t\t\t*pkt_len = sizeof(dummy_gre_rfc1701_c0k1_tcp_packet);\n+\t\t\t*offsets = dummy_gre_rfc1701_c0k1_tcp_packet_offsets;\n+\t\t\treturn;\n+\t\t}\n+\n+\t\t*pkt = dummy_gre_rfc1701_c0k0_tcp_packet;\n+\t\t*pkt_len = sizeof(dummy_gre_rfc1701_c0k0_tcp_packet);\n+\t\t*offsets = dummy_gre_rfc1701_c0k0_tcp_packet_offsets;\n+\t\treturn;\n+\t}\n+\n+\tif (tun_type == ICE_SW_TUN_GRE) {\n+\t\tif (gre_c_bit && gre_k_bit) {\n+\t\t\t*pkt = dummy_gre_rfc1701_c1k1_udp_packet;\n+\t\t\t*pkt_len = sizeof(dummy_gre_rfc1701_c1k1_udp_packet);\n+\t\t\t*offsets = dummy_gre_rfc1701_c1k1_udp_packet_offsets;\n+\t\t\treturn;\n+\t\t}\n+\t\tif (!gre_c_bit && gre_k_bit) {\n+\t\t\t*pkt = dummy_gre_rfc1701_c0k1_udp_packet;\n+\t\t\t*pkt_len = sizeof(dummy_gre_rfc1701_c0k1_udp_packet);\n+\t\t\t*offsets = dummy_gre_rfc1701_c0k1_udp_packet_offsets;\n+\t\t\treturn;\n+\t\t}\n+\n+\t\t*pkt = dummy_gre_rfc1701_c0k0_udp_packet;\n+\t\t*pkt_len = sizeof(dummy_gre_rfc1701_c0k0_udp_packet);\n+\t\t*offsets = dummy_gre_rfc1701_c0k0_udp_packet_offsets;\n+\t\treturn;\n+\t}\n+\n \tif (tun_type == ICE_SW_TUN_VXLAN || tun_type == ICE_SW_TUN_GENEVE ||\n \t    tun_type == ICE_SW_TUN_VXLAN_GPE || tun_type == ICE_SW_TUN_UDP ||\n \t    tun_type == ICE_SW_TUN_PROFID_IPV4_VXLAN ||\n@@ -8800,6 +9070,9 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,\n \t\tcase ICE_NVGRE:\n \t\t\tlen = sizeof(struct ice_nvgre);\n \t\t\tbreak;\n+\t\tcase ICE_GRE:\n+\t\t\tlen = sizeof(struct ice_gre);\n+\t\t\tbreak;\n \t\tcase ICE_VXLAN:\n \t\tcase ICE_GENEVE:\n \t\tcase ICE_VXLAN_GPE:\n@@ -8833,6 +9106,20 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,\n \t\tif (len % ICE_BYTES_PER_WORD)\n \t\t\treturn ICE_ERR_CFG;\n \n+\t\tif (lkups[i].type == ICE_GRE) {\n+\t\t\tif (lkups[i].h_u.gre_hdr.flags == 0x20)\n+\t\t\t\toffset -= 4;\n+\n+\t\t\tfor (j = 1; j < len / sizeof(u16); j++)\n+\t\t\t\tif (((u16 *)&lkups[i].m_u)[j])\n+\t\t\t\t\t((u16 *)(pkt + offset))[j] =\n+\t\t\t\t\t\t(((u16 *)(pkt + offset))[j] &\n+\t\t\t\t\t\t ~((u16 *)&lkups[i].m_u)[j]) |\n+\t\t\t\t\t\t(((u16 *)&lkups[i].h_u)[j] &\n+\t\t\t\t\t\t ((u16 *)&lkups[i].m_u)[j]);\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\t/* We have the offset to the header start, the length, the\n \t\t * caller's header values and mask. Use this information to\n \t\t * copy the data into the dummy packet appropriately based on\n@@ -9420,8 +9707,11 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,\n \t\t\treturn ICE_ERR_CFG;\n \n \t\tcount = ice_fill_valid_words(&lkups[i], &lkup_exts);\n-\t\tif (!count)\n+\t\tif (!count) {\n+\t\t\tif (lkups[i].type == ICE_GRE)\n+\t\t\t\tcontinue;\n \t\t\treturn ICE_ERR_CFG;\n+\t\t}\n \t}\n \n \t/* Create any special protocol/offset pairs, such as looking at tunnel\n",
    "prefixes": [
        "v2",
        "20/33"
    ]
}