Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1267331/?format=api
{ "id": 1267331, "url": "http://patchwork.ozlabs.org/api/patches/1267331/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200407101359.14064-1-arkadiusz.kubalewski@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20200407101359.14064-1-arkadiusz.kubalewski@intel.com>", "list_archive_url": null, "date": "2020-04-07T10:13:59", "name": "i40e: Add support for a new feature: Total Port Shutdown", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "c2c294d04d760fab3c3113f24d0874e5c6b130ff", "submitter": { "id": 78857, "url": "http://patchwork.ozlabs.org/api/people/78857/?format=api", "name": "Arkadiusz Kubalewski", "email": "arkadiusz.kubalewski@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200407101359.14064-1-arkadiusz.kubalewski@intel.com/mbox/", "series": [ { "id": 168978, "url": "http://patchwork.ozlabs.org/api/series/168978/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=168978", "date": "2020-04-07T10:13:59", "name": "i40e: Add support for a new feature: Total Port Shutdown", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/168978/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1267331/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1267331/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": [ "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.133;\n\thelo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 48xNbY1KJRz9sSq\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 7 Apr 2020 20:16:08 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id B349C87E6E;\n\tTue, 7 Apr 2020 10:16:06 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 9Cc9H2ycj1vY; Tue, 7 Apr 2020 10:16:04 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id C315287DF3;\n\tTue, 7 Apr 2020 10:16:04 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id C57BB1BF303\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 7 Apr 2020 10:16:03 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id BFDA985C9F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 7 Apr 2020 10:16:03 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id DxIskIJ8VTzB for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 7 Apr 2020 10:16:02 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 8DA3C85C4C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 7 Apr 2020 10:16:02 +0000 (UTC)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t07 Apr 2020 03:16:03 -0700", "from amlin-018-053.igk.intel.com ([10.102.18.53])\n\tby fmsmga005.fm.intel.com with ESMTP; 07 Apr 2020 03:15:59 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "IronPort-SDR": [ "7gd/AYeN+q2TngIgamfsd58pSfymZaMiCLQI67WiJW2tZbJV3JOj1rCU0VI1OTGYROeyHNg2Ok\n\tuPY4QX/sP//A==", "XMnODOFYKjjldPMUlQubV6kTBDDb9Ope1FbVLj+O2xNzuE7/t2HU3etT4DlfHDvh+XgxN8QmMu\n\tuSZbsb2Z2oAw==" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.72,353,1580803200\"; d=\"scan'208\";a=\"451172857\"", "From": "arkadiusz.kubalewski@intel.com", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Tue, 7 Apr 2020 10:13:59 +0000", "Message-Id": "<20200407101359.14064-1-arkadiusz.kubalewski@intel.com>", "X-Mailer": "git-send-email 2.26.0", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH] i40e: Add support for a new feature:\n\tTotal Port Shutdown", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "Cc": "Piotr Kwapulinski <piotr.kwapulinski@intel.com>,\n\tAleksandr Loktionov <aleksandr.loktionov@intel.com>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "From: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>\n\nCurrently after requesting to down a link on a physical network port,\nthe traffic is no longer being processed but the physical link\nwith a link partner is still established.\n\nTotal Port Shutdown allows to completely shutdown the port on the\nlink-down procedure by physically removing the link from the port.\n\nIntroduced changes:\n- probe NVM if the feature was enabled at initialization of the port\n- special handling on link-down procedure to let FW physically\nshutdown the port if the feature was enabled\n\nTesting Hints (required if no HSD):\nLink up/down, link-down-on-close\n\nSigned-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>\nSigned-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>\nSigned-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> \n---\n drivers/net/ethernet/intel/i40e/i40e.h | 1 +\n .../net/ethernet/intel/i40e/i40e_ethtool.c | 8 ++\n drivers/net/ethernet/intel/i40e/i40e_main.c | 125 +++++++++++++++---\n 3 files changed, 113 insertions(+), 21 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 4833187..8a1cbeb 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -567,6 +567,7 @@ struct i40e_pf {\n #define I40E_FLAG_DISABLE_FW_LLDP\t\tBIT(24)\n #define I40E_FLAG_RS_FEC\t\t\tBIT(25)\n #define I40E_FLAG_BASE_R_FEC\t\t\tBIT(26)\n+#define I40E_FLAG_TOTAL_PORT_SHUTDOWN\t\tBIT(27)\n \n \tstruct i40e_client_instance *cinst;\n \tbool stat_offsets_loaded;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 317f3f1..4fdb6ef 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -428,6 +428,7 @@ struct i40e_priv_flags {\n static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = {\n \t/* NOTE: MFP setting cannot be changed */\n \tI40E_PRIV_FLAG(\"MFP\", I40E_FLAG_MFP_ENABLED, 1),\n+\tI40E_PRIV_FLAG(\"total-port-shutdown\", I40E_FLAG_TOTAL_PORT_SHUTDOWN, 1),\n \tI40E_PRIV_FLAG(\"LinkPolling\", I40E_FLAG_LINK_POLLING_ENABLED, 0),\n \tI40E_PRIV_FLAG(\"flow-director-atr\", I40E_FLAG_FD_ATR_ENABLED, 0),\n \tI40E_PRIV_FLAG(\"veb-stats\", I40E_FLAG_VEB_STATS_ENABLED, 0),\n@@ -5006,6 +5007,13 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)\n \t\t\tdev_warn(&pf->pdev->dev, \"Cannot change FEC config\\n\");\n \t}\n \n+\tif ((changed_flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED) &&\n+\t (orig_flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN)) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"Setting link-down-on-close not supported on this port\\n\");\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n \tif ((changed_flags & new_flags &\n \t I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED) &&\n \t (new_flags & I40E_FLAG_MFP_ENABLED))\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 8c3e753..62a2074 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -54,7 +54,7 @@ static void i40e_fdir_sb_setup(struct i40e_pf *pf);\n static int i40e_veb_get_bw_info(struct i40e_veb *veb);\n static int i40e_get_capabilities(struct i40e_pf *pf,\n \t\t\t\t enum i40e_admin_queue_opc list_type);\n-\n+static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf);\n \n /* i40e_pci_tbl - PCI Device ID Table\n *\n@@ -6672,21 +6672,6 @@ static void i40e_vsi_reinit_locked(struct i40e_vsi *vsi)\n \tclear_bit(__I40E_CONFIG_BUSY, pf->state);\n }\n \n-/**\n- * i40e_up - Bring the connection back up after being down\n- * @vsi: the VSI being configured\n- **/\n-int i40e_up(struct i40e_vsi *vsi)\n-{\n-\tint err;\n-\n-\terr = i40e_vsi_configure(vsi);\n-\tif (!err)\n-\t\terr = i40e_up_complete(vsi);\n-\n-\treturn err;\n-}\n-\n /**\n * i40e_force_link_state - Force the link status\n * @pf: board private structure\n@@ -6697,10 +6682,12 @@ static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n \tstruct i40e_aq_get_phy_abilities_resp abilities;\n \tstruct i40e_aq_set_phy_config config = {0};\n \tstruct i40e_hw *hw = &pf->hw;\n+\tbool non_zero_phy_type;\n \ti40e_status err;\n \tu64 mask;\n \tu8 speed;\n \n+\tnon_zero_phy_type = is_up;\n \t/* Card might've been put in an unstable state by other drivers\n \t * and applications, which causes incorrect speed values being\n \t * set on startup. In order to clear speed registers, we call\n@@ -6731,8 +6718,11 @@ static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n \n \t/* If link needs to go up, but was not forced to go down,\n \t * and its speed values are OK, no need for a flap\n+\t * if non_zero_phy_type was set, still need to force up\n \t */\n-\tif (is_up && abilities.phy_type != 0 && abilities.link_speed != 0)\n+\tif (pf->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN)\n+\t\tnon_zero_phy_type = true;\n+\telse if (is_up && abilities.phy_type != 0 && abilities.link_speed != 0)\n \t\treturn I40E_SUCCESS;\n \n \t/* To force link we need to set bits for all supported PHY types,\n@@ -6740,10 +6730,18 @@ static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n \t * across two fields.\n \t */\n \tmask = I40E_PHY_TYPES_BITMASK;\n-\tconfig.phy_type = is_up ? cpu_to_le32((u32)(mask & 0xffffffff)) : 0;\n-\tconfig.phy_type_ext = is_up ? (u8)((mask >> 32) & 0xff) : 0;\n+\tconfig.phy_type =\n+\t\tnon_zero_phy_type ? cpu_to_le32((u32)(mask & 0xffffffff)) : 0;\n+\tconfig.phy_type_ext =\n+\t\tnon_zero_phy_type ? (u8)((mask >> 32) & 0xff) : 0;\n \t/* Copy the old settings, except of phy_type */\n \tconfig.abilities = abilities.abilities;\n+\tif (pf->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN) {\n+\t\tif (is_up)\n+\t\t\tconfig.abilities |= I40E_AQ_PHY_ENABLE_LINK;\n+\t\telse\n+\t\t\tconfig.abilities &= ~(I40E_AQ_PHY_ENABLE_LINK);\n+\t}\n \tif (abilities.link_speed != 0)\n \t\tconfig.link_speed = abilities.link_speed;\n \telse\n@@ -6774,11 +6772,31 @@ static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n \t\ti40e_update_link_info(hw);\n \t}\n \n-\ti40e_aq_set_link_restart_an(hw, true, NULL);\n+\ti40e_aq_set_link_restart_an(hw, is_up, NULL);\n \n \treturn I40E_SUCCESS;\n }\n \n+/**\n+ * i40e_up - Bring the connection back up after being down\n+ * @vsi: the VSI being configured\n+ **/\n+int i40e_up(struct i40e_vsi *vsi)\n+{\n+\tint err;\n+\n+\tif (vsi->type == I40E_VSI_MAIN &&\n+\t (vsi->back->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED ||\n+\t vsi->back->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN))\n+\t\ti40e_force_link_state(vsi->back, true);\n+\n+\terr = i40e_vsi_configure(vsi);\n+\tif (!err)\n+\t\terr = i40e_up_complete(vsi);\n+\n+\treturn err;\n+}\n+\n /**\n * i40e_down - Shutdown the connection processing\n * @vsi: the VSI being stopped\n@@ -6797,7 +6815,8 @@ void i40e_down(struct i40e_vsi *vsi)\n \ti40e_vsi_disable_irq(vsi);\n \ti40e_vsi_stop_rings(vsi);\n \tif (vsi->type == I40E_VSI_MAIN &&\n-\t vsi->back->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED)\n+\t (vsi->back->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED ||\n+\t vsi->back->flags & I40E_FLAG_TOTAL_PORT_SHUTDOWN))\n \t\ti40e_force_link_state(vsi->back, false);\n \ti40e_napi_disable_all(vsi);\n \n@@ -11837,6 +11856,60 @@ i40e_status i40e_commit_partition_bw_setting(struct i40e_pf *pf)\n \treturn ret;\n }\n \n+/**\n+ * i40e_is_total_port_shutdown_enabled - read nvm and return value\n+ * if total port shutdown feature is enabled for this pf\n+ * @pf: board private structure\n+ **/\n+static bool i40e_is_total_port_shutdown_enabled(struct i40e_pf *pf)\n+{\n+#define I40E_TOTAL_PORT_SHUTDOWN_ENABLED\tBIT(4)\n+#define I40E_FEATURES_ENABLE_PTR\t\t0x2A\n+#define I40E_CURRENT_SETTING_PTR\t\t0x2B\n+#define I40E_LINK_BEHAVIOR_WORD_OFFSET\t\t0x2D\n+#define I40E_LINK_BEHAVIOR_WORD_LENGTH\t\t0x1\n+#define I40E_LINK_BEHAVIOR_OS_FORCED_ENABLED\tBIT(0)\n+#define I40E_LINK_BEHAVIOR_PORT_BIT_LENGTH\t4\n+\ti40e_status read_status = I40E_SUCCESS;\n+\tu16 sr_emp_sr_settings_ptr = 0;\n+\tu16 features_enable = 0;\n+\tu16 link_behavior = 0;\n+\tbool ret = false;\n+\n+\tread_status = i40e_read_nvm_word(&pf->hw,\n+\t\t\t\t\t I40E_SR_EMP_SR_SETTINGS_PTR,\n+\t\t\t\t\t &sr_emp_sr_settings_ptr);\n+\tif (read_status)\n+\t\tgoto err_nvm;\n+\tread_status = i40e_read_nvm_word(&pf->hw,\n+\t\t\t\t\t sr_emp_sr_settings_ptr +\n+\t\t\t\t\t I40E_FEATURES_ENABLE_PTR,\n+\t\t\t\t\t &features_enable);\n+\tif (read_status)\n+\t\tgoto err_nvm;\n+\tif (I40E_TOTAL_PORT_SHUTDOWN_ENABLED & features_enable) {\n+\t\tread_status =\n+\t\ti40e_read_nvm_module_data(&pf->hw,\n+\t\t\t\t\t I40E_SR_EMP_SR_SETTINGS_PTR,\n+\t\t\t\t\t I40E_CURRENT_SETTING_PTR,\n+\t\t\t\t\t I40E_LINK_BEHAVIOR_WORD_OFFSET,\n+\t\t\t\t\t I40E_LINK_BEHAVIOR_WORD_LENGTH,\n+\t\t\t\t\t &link_behavior);\n+\t\tif (read_status)\n+\t\t\tgoto err_nvm;\n+\t\tlink_behavior >>=\n+\t\t(pf->hw.port * I40E_LINK_BEHAVIOR_PORT_BIT_LENGTH);\n+\t\tret = I40E_LINK_BEHAVIOR_OS_FORCED_ENABLED & link_behavior;\n+\t}\n+\treturn ret;\n+\n+err_nvm:\n+\tdev_warn(&pf->pdev->dev,\n+\t\t \"Total Port Shutdown feature is off due to read nvm error:%d\\n\",\n+\t\t read_status);\n+\treturn ret;\n+}\n+\n /**\n * i40e_sw_init - Initialize general software structures (struct i40e_pf)\n * @pf: board private structure to initialize\n@@ -12012,6 +12085,16 @@ static int i40e_sw_init(struct i40e_pf *pf)\n \n \tpf->tx_timeout_recovery_level = 1;\n \n+\tif (pf->hw.mac.type != I40E_MAC_X722 &&\n+\t i40e_is_total_port_shutdown_enabled(pf)) {\n+\t\t/* Link down on close must be on when total port shutdown\n+\t\t * is enabled for a given port\n+\t\t */\n+\t\tpf->flags |= (I40E_FLAG_TOTAL_PORT_SHUTDOWN\n+\t\t\t | I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED);\n+\t\tdev_info(&pf->pdev->dev,\n+\t\t\t \"Total Port Shutdown is enabled, link-down-on-close forced on\\n\");\n+\t}\n \tmutex_init(&pf->switch_mutex);\n \n sw_init_done:\n", "prefixes": [] }