get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 85171,
    "url": "http://patches.dpdk.org/api/patches/85171/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201215060519.302145-15-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": "<20201215060519.302145-15-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201215060519.302145-15-qi.z.zhang@intel.com",
    "date": "2020-12-15T06:05:06",
    "name": "[14/27] net/ice/base: add interface to support configuring VLAN mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "06743d1fdfec1482b6986d607b324612089a5533",
    "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/20201215060519.302145-15-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 14300,
            "url": "http://patches.dpdk.org/api/series/14300/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=14300",
            "date": "2020-12-15T06:04:52",
            "name": "ice base code update",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/14300/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/85171/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/85171/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 147C7A09E9;\n\tTue, 15 Dec 2020 07:06:36 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 105EBCA3A;\n\tTue, 15 Dec 2020 07:01:53 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id D81ADCA26\n for <dev@dpdk.org>; Tue, 15 Dec 2020 07:01:48 +0100 (CET)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Dec 2020 22:01:48 -0800",
            "from dpdk51.sh.intel.com ([10.67.111.142])\n by orsmga002.jf.intel.com with ESMTP; 14 Dec 2020 22:01:46 -0800"
        ],
        "IronPort-SDR": [
            "\n gclv9xV+1GJJxzd0AMVCHRdpxRJp849vAxvgvrt3j3l3jQ02luu+qGz2BPr4RWmwvWmaTaUrmm\n kWHJ2DRF1d2g==",
            "\n fmxT2mpC2WsNQqRERU/AxlPAmjMhbms472HkTef61zWE+8fy1lTCYzfvMQuYdpGcOcCv5xawEe\n 2m5OtXfEREqA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9835\"; a=\"193200275\"",
            "E=Sophos;i=\"5.78,420,1599548400\"; d=\"scan'208\";a=\"193200275\"",
            "E=Sophos;i=\"5.78,420,1599548400\"; d=\"scan'208\";a=\"351723547\""
        ],
        "X-ExtLoop1": "1",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "qiming.yang@intel.com",
        "Cc": "dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,\n Brett Creeley <brett.creeley@intel.com>",
        "Date": "Tue, 15 Dec 2020 14:05:06 +0800",
        "Message-Id": "<20201215060519.302145-15-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.26.2",
        "In-Reply-To": "<20201215060519.302145-1-qi.z.zhang@intel.com>",
        "References": "<20201215060519.302145-1-qi.z.zhang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 14/27] net/ice/base: add interface to support\n\tconfiguring VLAN mode",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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": "The VLAN mode of the device has to be configured while the global\nconfiguration lock is held while downloading the DDP, specifically after\nthe DDP has been downloaded. In order to support this a VLAN mode\ninterface was added. By default the device will stay in single VLAN\nmode (SVM), which is the current implementation. However, this can be\nchanged by implementing the .set_dvm op.\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n drivers/net/ice/base/ice_adminq_cmd.h | 23 ++++++++++++++\n drivers/net/ice/base/ice_common.c     | 40 ++++++++++++++++++++++++\n drivers/net/ice/base/ice_common.h     |  4 +++\n drivers/net/ice/base/ice_flex_pipe.c  |  7 +++++\n drivers/net/ice/base/ice_type.h       |  2 ++\n drivers/net/ice/base/ice_vlan_mode.c  | 44 +++++++++++++++++++++++++++\n drivers/net/ice/base/ice_vlan_mode.h  | 32 +++++++++++++++++++\n drivers/net/ice/base/meson.build      |  1 +\n 8 files changed, 153 insertions(+)\n create mode 100644 drivers/net/ice/base/ice_vlan_mode.c\n create mode 100644 drivers/net/ice/base/ice_vlan_mode.h",
    "diff": "diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h\nindex e69691427a..ff0e712d7a 100644\n--- a/drivers/net/ice/base/ice_adminq_cmd.h\n+++ b/drivers/net/ice/base/ice_adminq_cmd.h\n@@ -227,6 +227,27 @@ struct ice_aqc_get_sw_cfg_resp_elem {\n #define ICE_AQC_GET_SW_CONF_RESP_IS_VF\t\tBIT(15)\n };\n \n+/* Set Port parameters, (direct, 0x0203) */\n+struct ice_aqc_set_port_params {\n+\t__le16 cmd_flags;\n+#define ICE_AQC_SET_P_PARAMS_SAVE_BAD_PACKETS\tBIT(0)\n+#define ICE_AQC_SET_P_PARAMS_PAD_SHORT_PACKETS\tBIT(1)\n+#define ICE_AQC_SET_P_PARAMS_DOUBLE_VLAN_ENA\tBIT(2)\n+\t__le16 bad_frame_vsi;\n+#define ICE_AQC_SET_P_PARAMS_VSI_S\t0\n+#define ICE_AQC_SET_P_PARAMS_VSI_M\t(0x3FF << ICE_AQC_SET_P_PARAMS_VSI_S)\n+#define ICE_AQC_SET_P_PARAMS_VSI_VALID\tBIT(15)\n+\t__le16 swid;\n+#define ICE_AQC_SET_P_PARAMS_SWID_S\t0\n+#define ICE_AQC_SET_P_PARAMS_SWID_M\t(0xFF << ICE_AQC_SET_P_PARAMS_SWID_S)\n+#define ICE_AQC_SET_P_PARAMS_LOGI_PORT_ID_S\t8\n+#define ICE_AQC_SET_P_PARAMS_LOGI_PORT_ID_M\t\\\n+\t\t\t\t(0x3F << ICE_AQC_SET_P_PARAMS_LOGI_PORT_ID_S)\n+#define ICE_AQC_SET_P_PARAMS_IS_LOGI_PORT\tBIT(14)\n+#define ICE_AQC_SET_P_PARAMS_SWID_VALID\t\tBIT(15)\n+\tu8 reserved[10];\n+};\n+\n /* These resource type defines are used for all switch resource\n  * commands where a resource type is required, such as:\n  * Get Resource Allocation command (indirect 0x0204)\n@@ -2709,6 +2730,7 @@ struct ice_aq_desc {\n \t\tstruct ice_aqc_sff_eeprom read_write_sff_param;\n \t\tstruct ice_aqc_set_port_id_led set_port_id_led;\n \t\tstruct ice_aqc_get_sw_cfg get_sw_conf;\n+\t\tstruct ice_aqc_set_port_params set_port_params;\n \t\tstruct ice_aqc_sw_rules sw_rules;\n \t\tstruct ice_aqc_storm_cfg storm_conf;\n \t\tstruct ice_aqc_add_get_recipe add_get_recipe;\n@@ -2872,6 +2894,7 @@ enum ice_adminq_opc {\n \n \t/* internal switch commands */\n \tice_aqc_opc_get_sw_cfg\t\t\t\t= 0x0200,\n+\tice_aqc_opc_set_port_params\t\t\t= 0x0203,\n \n \t/* Alloc/Free/Get Resources */\n \tice_aqc_opc_get_res_alloc\t\t\t= 0x0204,\ndiff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c\nindex ca764b2566..16dc474425 100644\n--- a/drivers/net/ice/base/ice_common.c\n+++ b/drivers/net/ice/base/ice_common.c\n@@ -830,6 +830,9 @@ enum ice_status ice_init_hw(struct ice_hw *hw)\n \tif (status)\n \t\tgoto err_unroll_fltr_mgmt_struct;\n \tice_init_lock(&hw->tnl_lock);\n+\n+\tice_init_vlan_mode_ops(hw);\n+\n \treturn ICE_SUCCESS;\n \n err_unroll_fltr_mgmt_struct:\n@@ -2387,6 +2390,43 @@ void ice_clear_pxe_mode(struct ice_hw *hw)\n \t\tice_aq_clear_pxe_mode(hw);\n }\n \n+/**\n+ * ice_aq_set_port_params - set physical port parameters.\n+ * @pi: pointer to the port info struct\n+ * @bad_frame_vsi: defines the VSI to which bad frames are forwarded\n+ * @save_bad_pac: if set packets with errors are forwarded to the bad frames VSI\n+ * @pad_short_pac: if set transmit packets smaller than 60 bytes are padded\n+ * @double_vlan: if set double VLAN is enabled\n+ * @cd: pointer to command details structure or NULL\n+ *\n+ * Set Physical port parameters (0x0203)\n+ */\n+enum ice_status\n+ice_aq_set_port_params(struct ice_port_info *pi, u16 bad_frame_vsi,\n+\t\t       bool save_bad_pac, bool pad_short_pac, bool double_vlan,\n+\t\t       struct ice_sq_cd *cd)\n+\n+{\n+\tstruct ice_aqc_set_port_params *cmd;\n+\tstruct ice_hw *hw = pi->hw;\n+\tstruct ice_aq_desc desc;\n+\tu16 cmd_flags = 0;\n+\n+\tcmd = &desc.params.set_port_params;\n+\n+\tice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_port_params);\n+\tcmd->bad_frame_vsi = CPU_TO_LE16(bad_frame_vsi);\n+\tif (save_bad_pac)\n+\t\tcmd_flags |= ICE_AQC_SET_P_PARAMS_SAVE_BAD_PACKETS;\n+\tif (pad_short_pac)\n+\t\tcmd_flags |= ICE_AQC_SET_P_PARAMS_PAD_SHORT_PACKETS;\n+\tif (double_vlan)\n+\t\tcmd_flags |= ICE_AQC_SET_P_PARAMS_DOUBLE_VLAN_ENA;\n+\tcmd->cmd_flags = CPU_TO_LE16(cmd_flags);\n+\n+\treturn ice_aq_send_cmd(hw, &desc, NULL, 0, cd);\n+}\n+\n /**\n  * ice_get_link_speed_based_on_phy_type - returns link speed\n  * @phy_type_low: lower part of phy_type\ndiff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h\nindex 8c16c7a024..765dc3054f 100644\n--- a/drivers/net/ice/base/ice_common.h\n+++ b/drivers/net/ice/base/ice_common.h\n@@ -123,6 +123,10 @@ enum ice_status\n ice_aq_send_driver_ver(struct ice_hw *hw, struct ice_driver_ver *dv,\n \t\t       struct ice_sq_cd *cd);\n enum ice_status\n+ice_aq_set_port_params(struct ice_port_info *pi, u16 bad_frame_vsi,\n+\t\t       bool save_bad_pac, bool pad_short_pac, bool double_vlan,\n+\t\t       struct ice_sq_cd *cd);\n+enum ice_status\n ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,\n \t\t    struct ice_aqc_get_phy_caps_data *caps,\n \t\t    struct ice_sq_cd *cd);\ndiff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c\nindex 7594df1696..0812135cf5 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.c\n+++ b/drivers/net/ice/base/ice_flex_pipe.c\n@@ -1006,6 +1006,13 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count)\n \t\t\tbreak;\n \t}\n \n+\tif (!status) {\n+\t\tstatus = ice_set_vlan_mode(hw);\n+\t\tif (status)\n+\t\t\tice_debug(hw, ICE_DBG_PKG, \"Failed to set VLAN mode: err %d\\n\",\n+\t\t\t\t  status);\n+\t}\n+\n \tice_release_global_cfg_lock(hw);\n \n \treturn status;\ndiff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h\nindex 984dca6358..7790ee2e54 100644\n--- a/drivers/net/ice/base/ice_type.h\n+++ b/drivers/net/ice/base/ice_type.h\n@@ -57,6 +57,7 @@\n #include \"ice_lan_tx_rx.h\"\n #include \"ice_flex_type.h\"\n #include \"ice_protocol_type.h\"\n+#include \"ice_vlan_mode.h\"\n \n /**\n  * ice_is_pow2 - check if integer value is a power of 2\n@@ -990,6 +991,7 @@ struct ice_hw {\n \tice_declare_bitmap(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);\n \tstruct ice_lock rss_locks;\t/* protect RSS configuration */\n \tstruct LIST_HEAD_TYPE rss_list_head;\n+\tstruct ice_vlan_mode_ops vlan_mode_ops;\n };\n \n /* Statistics collected by each port, VSI, VEB, and S-channel */\ndiff --git a/drivers/net/ice/base/ice_vlan_mode.c b/drivers/net/ice/base/ice_vlan_mode.c\nnew file mode 100644\nindex 0000000000..603de74e25\n--- /dev/null\n+++ b/drivers/net/ice/base/ice_vlan_mode.c\n@@ -0,0 +1,44 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2001-2020 Intel Corporation\n+ */\n+\n+#include \"ice_vlan_mode.h\"\n+#include \"ice_common.h\"\n+\n+/**\n+ * ice_set_svm - set single VLAN mode\n+ * @hw: pointer to the HW structure\n+ */\n+static enum ice_status ice_set_svm_dflt(struct ice_hw *hw)\n+{\n+\tice_debug(hw, ICE_DBG_TRACE, \"%s\\n\", __func__);\n+\n+\treturn ice_aq_set_port_params(hw->port_info, 0, false, false, false, NULL);\n+}\n+\n+/**\n+ * ice_init_vlan_mode_ops - initialize VLAN mode configuration ops\n+ * @hw: pointer to the HW structure\n+ */\n+void ice_init_vlan_mode_ops(struct ice_hw *hw)\n+{\n+\thw->vlan_mode_ops.set_dvm = NULL;\n+\thw->vlan_mode_ops.set_svm = ice_set_svm_dflt;\n+}\n+\n+/**\n+ * ice_set_vlan_mode\n+ * @hw: pointer to the HW structure\n+ */\n+enum ice_status ice_set_vlan_mode(struct ice_hw *hw)\n+{\n+\tenum ice_status status = ICE_ERR_NOT_IMPL;\n+\n+\tif (hw->vlan_mode_ops.set_dvm)\n+\t\tstatus = hw->vlan_mode_ops.set_dvm(hw);\n+\n+\tif (status)\n+\t\treturn hw->vlan_mode_ops.set_svm(hw);\n+\n+\treturn ICE_SUCCESS;\n+}\ndiff --git a/drivers/net/ice/base/ice_vlan_mode.h b/drivers/net/ice/base/ice_vlan_mode.h\nnew file mode 100644\nindex 0000000000..1b9db4d36f\n--- /dev/null\n+++ b/drivers/net/ice/base/ice_vlan_mode.h\n@@ -0,0 +1,32 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2001-2020 Intel Corporation\n+ */\n+\n+#ifndef _ICE_VLAN_MODE_H_\n+#define _ICE_VLAN_MODE_H_\n+\n+struct ice_hw;\n+\n+enum ice_status ice_set_vlan_mode(struct ice_hw *hw);\n+void ice_init_vlan_mode_ops(struct ice_hw *hw);\n+\n+/* This structure defines the VLAN mode configuration interface. It is used to set the VLAN mode.\n+ *\n+ * Note: These operations will be called while the global configuration lock is held.\n+ *\n+ * enum ice_status (*set_svm)(struct ice_hw *hw);\n+ *\tThis function is called when the DDP and/or Firmware don't support double VLAN mode (DVM) or\n+ *\tif the set_dvm op is not implemented and/or returns failure. It will set the device in\n+ *\tsingle VLAN mode (SVM).\n+ *\n+ * enum ice_status (*set_dvm)(struct ice_hw *hw);\n+ *\tThis function is called when the DDP and Firmware support double VLAN mode (DVM). It should\n+ *\tbe implemented to set double VLAN mode. If it fails or remains unimplemented, set_svm will\n+ *\tbe called as a fallback plan.\n+ */\n+struct ice_vlan_mode_ops {\n+\tenum ice_status (*set_svm)(struct ice_hw *hw);\n+\tenum ice_status (*set_dvm)(struct ice_hw *hw);\n+};\n+\n+#endif /* _ICE_VLAN_MODE_H */\ndiff --git a/drivers/net/ice/base/meson.build b/drivers/net/ice/base/meson.build\nindex 22963ce31d..ad5e5da25b 100644\n--- a/drivers/net/ice/base/meson.build\n+++ b/drivers/net/ice/base/meson.build\n@@ -13,6 +13,7 @@ sources = [\n \t'ice_fdir.c',\n \t'ice_acl.c',\n \t'ice_acl_ctrl.c',\n+\t'ice_vlan_mode.c',\n ]\n \n error_cflags = ['-Wno-unused-value',\n",
    "prefixes": [
        "14/27"
    ]
}