Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/868770/?format=api
{ "id": 868770, "url": "http://patchwork.ozlabs.org/api/patches/868770/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180202111047.64740-1-alice.michael@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": "<20180202111047.64740-1-alice.michael@intel.com>", "list_archive_url": null, "date": "2018-02-02T11:10:47", "name": "[V2] i40e: i40e_open() should fail if forcing link state returned error", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8746798143ee118690b98a74298703954159de97", "submitter": { "id": 71123, "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api", "name": "Michael, Alice", "email": "alice.michael@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/20180202111047.64740-1-alice.michael@intel.com/mbox/", "series": [ { "id": 26742, "url": "http://patchwork.ozlabs.org/api/series/26742/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=26742", "date": "2018-02-02T11:10:47", "name": "[V2] i40e: i40e_open() should fail if forcing link state returned error", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/26742/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/868770/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/868770/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;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3zY6G75r9Rz9t2l\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 3 Feb 2018 06:18:23 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 18B30896CF;\n\tFri, 2 Feb 2018 19:18:22 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id rqOnJGbJ8sxX; Fri, 2 Feb 2018 19:18:21 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id F07ED896C2;\n\tFri, 2 Feb 2018 19:18:20 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 9F6341C28CD\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 2 Feb 2018 19:18:20 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 9924888AF5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 2 Feb 2018 19:18:20 +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 hWr3K1fMZoLe for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 2 Feb 2018 19:18:20 +0000 (UTC)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id E59C48562C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 2 Feb 2018 19:18:19 +0000 (UTC)", "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Feb 2018 11:18:18 -0800", "from alicemic-2.jf.intel.com ([10.166.16.121])\n\tby orsmga008.jf.intel.com with ESMTP; 02 Feb 2018 11:18:18 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.46,450,1511856000\"; d=\"scan'208\";a=\"15038156\"", "From": "Alice Michael <alice.michael@intel.com>", "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org", "Date": "Fri, 2 Feb 2018 06:10:47 -0500", "Message-Id": "<20180202111047.64740-1-alice.michael@intel.com>", "X-Mailer": "git-send-email 2.9.5", "Subject": "[Intel-wired-lan] [PATCH V2] i40e: i40e_open() should fail if\n\tforcing link state returned error", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.24", "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": "Mariusz Stachura <mariusz.stachura@intel.com>", "MIME-Version": "1.0", "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: Mariusz Stachura <mariusz.stachura@intel.com>\n\nBased on upstream review comments, ndo_open function should not succeed\nif there were issues with forcing link state to be UP.\nThis patch also fixes an issue with looping through enum values.\n\nAdded I40E_PHY_TYPES_BITMASK define with all phy types OR-ed together in\none bitmask. Added after phy type definition, so it will be hard to\nforget to include new phy types to the bitmask.\n\nSigned-off-by: Mariusz Stachura <mariusz.stachura@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 37 +++++++++++++++++++++++\n drivers/net/ethernet/intel/i40e/i40e_main.c | 28 +++++++++--------\n 2 files changed, 53 insertions(+), 12 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h\nindex a852775..0dfc527 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h\n@@ -1914,6 +1914,43 @@ enum i40e_aq_phy_type {\n \tI40E_PHY_TYPE_DEFAULT\t\t\t= 0xFF,\n };\n \n+#define I40E_PHY_TYPES_BITMASK (BIT_ULL(I40E_PHY_TYPE_SGMII) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_1000BASE_KX) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_KX4) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_KR) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_40GBASE_KR4) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_XAUI) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_XFI) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_SFI) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_XLAUI) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_XLPPI) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_40GBASE_CR4_CU) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_CR1_CU) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_AOC) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_40GBASE_AOC) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_UNRECOGNIZED) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_UNSUPPORTED) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_100BASE_TX) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_1000BASE_T) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_T) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_SR) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_LR) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_SFPP_CU) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_10GBASE_CR1) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_40GBASE_CR4) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_40GBASE_SR4) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_40GBASE_LR4) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_1000BASE_SX) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_1000BASE_LX) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_1000BASE_T_OPTICAL) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_20GBASE_KR2) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_25GBASE_KR) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_25GBASE_CR) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_25GBASE_SR) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_25GBASE_LR) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_25GBASE_AOC) | \\\n+\t\t\t\tBIT_ULL(I40E_PHY_TYPE_25GBASE_ACC))\n+\n #define I40E_LINK_SPEED_100MB_SHIFT\t0x1\n #define I40E_LINK_SPEED_1000MB_SHIFT\t0x2\n #define I40E_LINK_SPEED_10GB_SHIFT\t0x3\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex fd90ae5..be9a146 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -6551,37 +6551,36 @@ int i40e_up(struct i40e_vsi *vsi)\n * @pf: board private structure\n * @is_up: whether the link state should be forced up or down\n **/\n-static void i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n+static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n {\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-\tenum i40e_aq_phy_type cnt;\n-\tu64 mask = 0;\n \ti40e_status err;\n+\tu64 mask;\n \n \t/* Get the current phy config */\n \terr = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,\n \t\t\t\t\t NULL);\n-\tif (err)\n-\t\tdev_dbg(&pf->pdev->dev,\n+\tif (err) {\n+\t\tdev_err(&pf->pdev->dev,\n \t\t\t\"failed to get phy cap., ret = %s last_status = %s\\n\",\n \t\t\ti40e_stat_str(hw, err),\n \t\t\ti40e_aq_str(hw, hw->aq.asq_last_status));\n+\t\treturn err;\n+\t}\n \n \t/* If link needs to go up, but was not forced to go down,\n \t * no need for a flap\n \t */\n \tif (is_up && abilities.phy_type != 0)\n-\t\treturn;\n+\t\treturn I40E_SUCCESS;\n \n \t/* To force link we need to set bits for all supported PHY types,\n \t * but there are now more than 32, so we need to split the bitmap\n \t * across two fields.\n \t */\n-\tfor (cnt = I40E_PHY_TYPE_SGMII; cnt < I40E_PHY_TYPE_MAX; cnt++)\n-\t\tmask |= (1ULL << cnt);\n-\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 \t/* Copy the old settings, except of phy_type */\n@@ -6592,11 +6591,13 @@ static void i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n \tconfig.low_power_ctrl = abilities.d3_lpan;\n \terr = i40e_aq_set_phy_config(hw, &config, NULL);\n \n-\tif (err)\n-\t\tdev_dbg(&pf->pdev->dev,\n+\tif (err) {\n+\t\tdev_err(&pf->pdev->dev,\n \t\t\t\"set phy config ret = %s last_status = %s\\n\",\n \t\t\ti40e_stat_str(&pf->hw, err),\n \t\t\ti40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));\n+\t\treturn err;\n+\t}\n \n \t/* Update the link info */\n \terr = i40e_update_link_info(hw);\n@@ -6610,6 +6611,8 @@ static void i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n \t}\n \n \ti40e_aq_set_link_restart_an(hw, true, NULL);\n+\n+\treturn I40E_SUCCESS;\n }\n \n /**\n@@ -7593,7 +7596,8 @@ int i40e_open(struct net_device *netdev)\n \n \tnetif_carrier_off(netdev);\n \n-\ti40e_force_link_state(pf, true);\n+\tif (i40e_force_link_state(pf, true))\n+\t\treturn -EAGAIN;\n \n \terr = i40e_vsi_open(vsi);\n \tif (err)\n", "prefixes": [ "V2" ] }