get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 96587,
    "url": "http://patches.dpdk.org/api/patches/96587/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210803083817.1243796-10-wenjun1.wu@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": "<20210803083817.1243796-10-wenjun1.wu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210803083817.1243796-10-wenjun1.wu@intel.com",
    "date": "2021-08-03T08:38:04",
    "name": "[09/22] net/ice/base: update boost TCAM for DVM",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "e35c6a10a00816f439fefb322c667ea116640733",
    "submitter": {
        "id": 2083,
        "url": "http://patches.dpdk.org/api/people/2083/?format=api",
        "name": "Wenjun Wu",
        "email": "wenjun1.wu@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/20210803083817.1243796-10-wenjun1.wu@intel.com/mbox/",
    "series": [
        {
            "id": 18158,
            "url": "http://patches.dpdk.org/api/series/18158/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18158",
            "date": "2021-08-03T08:37:55",
            "name": "backport feature support to DPDK 20.11",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/18158/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/96587/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/96587/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 50840A0C41;\n\tTue,  3 Aug 2021 10:58:03 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id CE671411EB;\n\tTue,  3 Aug 2021 10:57:22 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id 0B342411C3\n for <dev@dpdk.org>; Tue,  3 Aug 2021 10:57:13 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 03 Aug 2021 01:56:59 -0700",
            "from wuwenjun.sh.intel.com ([10.67.110.197])\n by fmsmga008.fm.intel.com with ESMTP; 03 Aug 2021 01:56:58 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10064\"; a=\"211764396\"",
            "E=Sophos;i=\"5.84,291,1620716400\"; d=\"scan'208\";a=\"211764396\"",
            "E=Sophos;i=\"5.84,291,1620716400\"; d=\"scan'208\";a=\"479396585\""
        ],
        "X-ExtLoop1": "1",
        "From": "Wenjun Wu <wenjun1.wu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue,  3 Aug 2021 16:38:04 +0800",
        "Message-Id": "<20210803083817.1243796-10-wenjun1.wu@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210803083817.1243796-1-wenjun1.wu@intel.com>",
        "References": "<20210803083817.1243796-1-wenjun1.wu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 09/22] net/ice/base: update boost TCAM for DVM",
        "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": "From: Qi Zhang <qi.z.zhang@intel.com>\n\n[ upstream commit f977165db0ba8435269a5e19e0e9239a4b22d140 ]\n\nAdd code to update boost TCAM entries to enable DVM. This requires\nenabled DVM entries, and disabling SVM entries.\n\nSigned-off-by: Dan Nowlin <dan.nowlin@intel.com>\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\nAcked-by: Qiming Yang <qiming.yang@intel.com>\n---\n drivers/net/ice/base/ice_flex_pipe.c | 223 +++++++++++++++++++++++----\n drivers/net/ice/base/ice_flex_pipe.h |   1 +\n drivers/net/ice/base/ice_flex_type.h |  13 ++\n drivers/net/ice/base/ice_type.h      |   2 +\n drivers/net/ice/base/ice_vlan_mode.c |   7 +\n 5 files changed, 213 insertions(+), 33 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c\nindex cced7b6352..058694653a 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.c\n+++ b/drivers/net/ice/base/ice_flex_pipe.c\n@@ -7,9 +7,17 @@\n #include \"ice_protocol_type.h\"\n #include \"ice_flow.h\"\n \n+/* For supporting double VLAN mode, it is necessary to enable or disable certain\n+ * boost tcam entries. The metadata labels names that match the following\n+ * prefixes will be saved to allow enabling double VLAN mode.\n+ */\n+#define ICE_DVM_PRE\t\"BOOST_MAC_VLAN_DVM\"\t/* enable these entries */\n+#define ICE_SVM_PRE\t\"BOOST_MAC_VLAN_SVM\"\t/* disable these entries */\n+\n /* To support tunneling entries by PF, the package will append the PF number to\n  * the label; for example TNL_VXLAN_PF0, TNL_VXLAN_PF1, TNL_VXLAN_PF2, etc.\n  */\n+#define ICE_TNL_PRE\t\"TNL_\"\n static const struct ice_tunnel_type_scan tnls[] = {\n \t{ TNL_VXLAN,\t\t\"TNL_VXLAN_PF\" },\n \t{ TNL_GENEVE,\t\t\"TNL_GENEVE_PF\" },\n@@ -452,6 +460,57 @@ ice_enum_labels(struct ice_seg *ice_seg, u32 type, struct ice_pkg_enum *state,\n \treturn label->name;\n }\n \n+/**\n+ * ice_add_tunnel_hint\n+ * @hw: pointer to the HW structure\n+ * @label_name: label text\n+ * @val: value of the tunnel port boost entry\n+ */\n+static void ice_add_tunnel_hint(struct ice_hw *hw, char *label_name, u16 val)\n+{\n+\tif (hw->tnl.count < ICE_TUNNEL_MAX_ENTRIES) {\n+\t\tu16 i;\n+\n+\t\tfor (i = 0; tnls[i].type != TNL_LAST; i++) {\n+\t\t\tsize_t len = strlen(tnls[i].label_prefix);\n+\n+\t\t\t/* Look for matching label start, before continuing */\n+\t\t\tif (strncmp(label_name, tnls[i].label_prefix, len))\n+\t\t\t\tcontinue;\n+\n+\t\t\t/* Make sure this label matches our PF. Note that the PF\n+\t\t\t * character ('0' - '7') will be located where our\n+\t\t\t * prefix string's null terminator is located.\n+\t\t\t */\n+\t\t\tif ((label_name[len] - '0') == hw->pf_id) {\n+\t\t\t\thw->tnl.tbl[hw->tnl.count].type = tnls[i].type;\n+\t\t\t\thw->tnl.tbl[hw->tnl.count].valid = false;\n+\t\t\t\thw->tnl.tbl[hw->tnl.count].in_use = false;\n+\t\t\t\thw->tnl.tbl[hw->tnl.count].marked = false;\n+\t\t\t\thw->tnl.tbl[hw->tnl.count].boost_addr = val;\n+\t\t\t\thw->tnl.tbl[hw->tnl.count].port = 0;\n+\t\t\t\thw->tnl.count++;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n+/**\n+ * ice_add_dvm_hint\n+ * @hw: pointer to the HW structure\n+ * @val: value of the boost entry\n+ * @enable: true if entry needs to be enabled, or false if needs to be disabled\n+ */\n+static void ice_add_dvm_hint(struct ice_hw *hw, u16 val, bool enable)\n+{\n+\tif (hw->dvm_upd.count < ICE_DVM_MAX_ENTRIES) {\n+\t\thw->dvm_upd.tbl[hw->dvm_upd.count].boost_addr = val;\n+\t\thw->dvm_upd.tbl[hw->dvm_upd.count].enable = enable;\n+\t\thw->dvm_upd.count++;\n+\t}\n+}\n+\n /**\n  * ice_init_pkg_hints\n  * @hw: pointer to the HW structure\n@@ -478,40 +537,34 @@ static void ice_init_pkg_hints(struct ice_hw *hw, struct ice_seg *ice_seg)\n \tlabel_name = ice_enum_labels(ice_seg, ICE_SID_LBL_RXPARSER_TMEM, &state,\n \t\t\t\t     &val);\n \n-\twhile (label_name && hw->tnl.count < ICE_TUNNEL_MAX_ENTRIES) {\n-\t\tfor (i = 0; tnls[i].type != TNL_LAST; i++) {\n-\t\t\tsize_t len = strlen(tnls[i].label_prefix);\n+\twhile (label_name) {\n+\t\tif (!strncmp(label_name, ICE_TNL_PRE, strlen(ICE_TNL_PRE)))\n+\t\t\t/* check for a tunnel entry */\n+\t\t\tice_add_tunnel_hint(hw, label_name, val);\n \n-\t\t\t/* Look for matching label start, before continuing */\n-\t\t\tif (strncmp(label_name, tnls[i].label_prefix, len))\n-\t\t\t\tcontinue;\n+\t\t/* check for a dvm mode entry */\n+\t\telse if (!strncmp(label_name, ICE_DVM_PRE, strlen(ICE_DVM_PRE)))\n+\t\t\tice_add_dvm_hint(hw, val, true);\n \n-\t\t\t/* Make sure this label matches our PF. Note that the PF\n-\t\t\t * character ('0' - '7') will be located where our\n-\t\t\t * prefix string's null terminator is located.\n-\t\t\t */\n-\t\t\tif ((label_name[len] - '0') == hw->pf_id) {\n-\t\t\t\thw->tnl.tbl[hw->tnl.count].type = tnls[i].type;\n-\t\t\t\thw->tnl.tbl[hw->tnl.count].valid = false;\n-\t\t\t\thw->tnl.tbl[hw->tnl.count].in_use = false;\n-\t\t\t\thw->tnl.tbl[hw->tnl.count].marked = false;\n-\t\t\t\thw->tnl.tbl[hw->tnl.count].boost_addr = val;\n-\t\t\t\thw->tnl.tbl[hw->tnl.count].port = 0;\n-\t\t\t\thw->tnl.count++;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t}\n+\t\t/* check for a svm mode entry */\n+\t\telse if (!strncmp(label_name, ICE_SVM_PRE, strlen(ICE_SVM_PRE)))\n+\t\t\tice_add_dvm_hint(hw, val, false);\n \n \t\tlabel_name = ice_enum_labels(NULL, 0, &state, &val);\n \t}\n \n-\t/* Cache the appropriate boost TCAM entry pointers */\n+\t/* Cache the appropriate boost TCAM entry pointers for tunnels */\n \tfor (i = 0; i < hw->tnl.count; i++) {\n \t\tice_find_boost_entry(ice_seg, hw->tnl.tbl[i].boost_addr,\n \t\t\t\t     &hw->tnl.tbl[i].boost_entry);\n \t\tif (hw->tnl.tbl[i].boost_entry)\n \t\t\thw->tnl.tbl[i].valid = true;\n \t}\n+\n+\t/* Cache the appropriate boost TCAM entry pointers for DVM and SVM */\n+\tfor (i = 0; i < hw->dvm_upd.count; i++)\n+\t\tice_find_boost_entry(ice_seg, hw->dvm_upd.tbl[i].boost_addr,\n+\t\t\t\t     &hw->dvm_upd.tbl[i].boost_entry);\n }\n \n /* Key creation */\n@@ -916,26 +969,21 @@ ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,\n }\n \n /**\n- * ice_update_pkg\n+ * ice_update_pkg_no_lock\n  * @hw: pointer to the hardware structure\n  * @bufs: pointer to an array of buffers\n  * @count: the number of buffers in the array\n- *\n- * Obtains change lock and updates package.\n  */\n-enum ice_status\n-ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)\n+static enum ice_status\n+ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count)\n {\n-\tenum ice_status status;\n-\tu32 offset, info, i;\n-\n-\tstatus = ice_acquire_change_lock(hw, ICE_RES_WRITE);\n-\tif (status)\n-\t\treturn status;\n+\tenum ice_status status = ICE_SUCCESS;\n+\tu32 i;\n \n \tfor (i = 0; i < count; i++) {\n \t\tstruct ice_buf_hdr *bh = (struct ice_buf_hdr *)(bufs + i);\n \t\tbool last = ((i + 1) == count);\n+\t\tu32 offset, info;\n \n \t\tstatus = ice_aq_update_pkg(hw, bh, LE16_TO_CPU(bh->data_end),\n \t\t\t\t\t   last, &offset, &info, NULL);\n@@ -947,6 +995,28 @@ ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)\n \t\t}\n \t}\n \n+\treturn status;\n+}\n+\n+/**\n+ * ice_update_pkg\n+ * @hw: pointer to the hardware structure\n+ * @bufs: pointer to an array of buffers\n+ * @count: the number of buffers in the array\n+ *\n+ * Obtains change lock and updates package.\n+ */\n+enum ice_status\n+ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)\n+{\n+\tenum ice_status status;\n+\n+\tstatus = ice_acquire_change_lock(hw, ICE_RES_WRITE);\n+\tif (status)\n+\t\treturn status;\n+\n+\tstatus = ice_update_pkg_no_lock(hw, bufs, count);\n+\n \tice_release_change_lock(hw);\n \n \treturn status;\n@@ -2122,6 +2192,93 @@ ice_get_open_tunnel_port(struct ice_hw *hw, enum ice_tunnel_type type,\n \treturn res;\n }\n \n+/**\n+ * ice_upd_dvm_boost_entry\n+ * @hw: pointer to the HW structure\n+ * @entry: pointer to double vlan boost entry info\n+ */\n+static enum ice_status\n+ice_upd_dvm_boost_entry(struct ice_hw *hw, struct ice_dvm_entry *entry)\n+{\n+\tstruct ice_boost_tcam_section *sect_rx, *sect_tx;\n+\tenum ice_status status = ICE_ERR_MAX_LIMIT;\n+\tstruct ice_buf_build *bld;\n+\tu8 val, dc, nm;\n+\n+\tbld = ice_pkg_buf_alloc(hw);\n+\tif (!bld)\n+\t\treturn ICE_ERR_NO_MEMORY;\n+\n+\t/* allocate 2 sections, one for Rx parser, one for Tx parser */\n+\tif (ice_pkg_buf_reserve_section(bld, 2))\n+\t\tgoto ice_upd_dvm_boost_entry_err;\n+\n+\tsect_rx = (struct ice_boost_tcam_section *)\n+\t\tice_pkg_buf_alloc_section(bld, ICE_SID_RXPARSER_BOOST_TCAM,\n+\t\t\t\t\t  ice_struct_size(sect_rx, tcam, 1));\n+\tif (!sect_rx)\n+\t\tgoto ice_upd_dvm_boost_entry_err;\n+\tsect_rx->count = CPU_TO_LE16(1);\n+\n+\tsect_tx = (struct ice_boost_tcam_section *)\n+\t\tice_pkg_buf_alloc_section(bld, ICE_SID_TXPARSER_BOOST_TCAM,\n+\t\t\t\t\t  ice_struct_size(sect_tx, tcam, 1));\n+\tif (!sect_tx)\n+\t\tgoto ice_upd_dvm_boost_entry_err;\n+\tsect_tx->count = CPU_TO_LE16(1);\n+\n+\t/* copy original boost entry to update package buffer */\n+\tice_memcpy(sect_rx->tcam, entry->boost_entry, sizeof(*sect_rx->tcam),\n+\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\t/* re-write the don't care and never match bits accordingly */\n+\tif (entry->enable) {\n+\t\t/* all bits are don't care */\n+\t\tval = 0x00;\n+\t\tdc = 0xFF;\n+\t\tnm = 0x00;\n+\t} else {\n+\t\t/* disable, one never match bit, the rest are don't care */\n+\t\tval = 0x00;\n+\t\tdc = 0xF7;\n+\t\tnm = 0x08;\n+\t}\n+\n+\tice_set_key((u8 *)&sect_rx->tcam[0].key, sizeof(sect_rx->tcam[0].key),\n+\t\t    &val, NULL, &dc, &nm, 0, sizeof(u8));\n+\n+\t/* exact copy of entry to Tx section entry */\n+\tice_memcpy(sect_tx->tcam, sect_rx->tcam, sizeof(*sect_tx->tcam),\n+\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\tstatus = ice_update_pkg_no_lock(hw, ice_pkg_buf(bld), 1);\n+\n+ice_upd_dvm_boost_entry_err:\n+\tice_pkg_buf_free(hw, bld);\n+\n+\treturn status;\n+}\n+\n+/**\n+ * ice_set_dvm_boost_entries\n+ * @hw: pointer to the HW structure\n+ *\n+ * Enable double vlan by updating the appropriate boost tcam entries.\n+ */\n+enum ice_status ice_set_dvm_boost_entries(struct ice_hw *hw)\n+{\n+\tenum ice_status status;\n+\tu16 i;\n+\n+\tfor (i = 0; i < hw->dvm_upd.count; i++) {\n+\t\tstatus = ice_upd_dvm_boost_entry(hw, &hw->dvm_upd.tbl[i]);\n+\t\tif (status)\n+\t\t\treturn status;\n+\t}\n+\n+\treturn ICE_SUCCESS;\n+}\n+\n /**\n  * ice_create_tunnel\n  * @hw: pointer to the HW structure\ndiff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h\nindex d4679cc940..61ce092319 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.h\n+++ b/drivers/net/ice/base/ice_flex_pipe.h\n@@ -49,6 +49,7 @@ ice_get_open_tunnel_port(struct ice_hw *hw, enum ice_tunnel_type type,\n \t\t\t u16 *port);\n enum ice_status\n ice_create_tunnel(struct ice_hw *hw, enum ice_tunnel_type type, u16 port);\n+enum ice_status ice_set_dvm_boost_entries(struct ice_hw *hw);\n enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all);\n bool ice_tunnel_port_in_use(struct ice_hw *hw, u16 port, u16 *index);\n bool\ndiff --git a/drivers/net/ice/base/ice_flex_type.h b/drivers/net/ice/base/ice_flex_type.h\nindex 169476369b..dfa3cf3020 100644\n--- a/drivers/net/ice/base/ice_flex_type.h\n+++ b/drivers/net/ice/base/ice_flex_type.h\n@@ -543,6 +543,19 @@ struct ice_tunnel_table {\n \tu16 count;\n };\n \n+struct ice_dvm_entry {\n+\tu16 boost_addr;\n+\tu16 enable;\n+\tstruct ice_boost_tcam_entry *boost_entry;\n+};\n+\n+#define ICE_DVM_MAX_ENTRIES\t48\n+\n+struct ice_dvm_table {\n+\tstruct ice_dvm_entry tbl[ICE_DVM_MAX_ENTRIES];\n+\tu16 count;\n+};\n+\n struct ice_pkg_es {\n \t__le16 count;\n \t__le16 offset;\ndiff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h\nindex a4a4427693..104f5dc101 100644\n--- a/drivers/net/ice/base/ice_type.h\n+++ b/drivers/net/ice/base/ice_type.h\n@@ -962,6 +962,8 @@ struct ice_hw {\n \t/* tunneling info */\n \tstruct ice_lock tnl_lock;\n \tstruct ice_tunnel_table tnl;\n+\t/* dvm boost update information */\n+\tstruct ice_dvm_table dvm_upd;\n \n \tstruct ice_acl_tbl *acl_tbl;\n \tstruct ice_fd_hw_prof **acl_prof;\ndiff --git a/drivers/net/ice/base/ice_vlan_mode.c b/drivers/net/ice/base/ice_vlan_mode.c\nindex 42bb108928..4a749cb9f1 100644\n--- a/drivers/net/ice/base/ice_vlan_mode.c\n+++ b/drivers/net/ice/base/ice_vlan_mode.c\n@@ -312,6 +312,13 @@ static enum ice_status ice_set_dvm(struct ice_hw *hw)\n \t\treturn status;\n \t}\n \n+\tstatus = ice_set_dvm_boost_entries(hw);\n+\tif (status) {\n+\t\tice_debug(hw, ICE_DBG_INIT, \"Failed to set boost TCAM entries for double VLAN mode, status %d\\n\",\n+\t\t\t  status);\n+\t\treturn status;\n+\t}\n+\n \treturn ICE_SUCCESS;\n }\n \n",
    "prefixes": [
        "09/22"
    ]
}