Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1122930/?format=api
{ "id": 1122930, "url": "http://patchwork.ozlabs.org/api/patches/1122930/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190626092027.52845-6-anthony.l.nguyen@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": "<20190626092027.52845-6-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2019-06-26T09:20:17", "name": "[S22,06/16] ice: Do not configure port with no media", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "2099cf5dc078c9765c933dbb8edbce05135036a6", "submitter": { "id": 68875, "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api", "name": "Tony Nguyen", "email": "anthony.l.nguyen@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/20190626092027.52845-6-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 116295, "url": "http://patchwork.ozlabs.org/api/series/116295/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=116295", "date": "2019-06-26T09:20:14", "name": "[S22,01/16] ice: add lp_advertising flow control support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/116295/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1122930/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1122930/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.137; helo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 45Yr8z3Rg2z9s8m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 27 Jun 2019 03:48:03 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id DF96C861F2;\n\tWed, 26 Jun 2019 17:48:01 +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 EMuR5fRcZ3Nq; Wed, 26 Jun 2019 17:47:58 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 3FEBD8618F;\n\tWed, 26 Jun 2019 17:47:58 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id B47531BF326\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 26 Jun 2019 17:47:54 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id ABBBB8618F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 26 Jun 2019 17:47:54 +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 ie1-nVlZElWj for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 26 Jun 2019 17:47:53 +0000 (UTC)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 327A886132\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 26 Jun 2019 17:47:53 +0000 (UTC)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t26 Jun 2019 10:47:52 -0700", "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby fmsmga001.fm.intel.com with ESMTP; 26 Jun 2019 10:47:52 -0700" ], "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.63,420,1557212400\"; d=\"scan'208\";a=\"183218123\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 26 Jun 2019 02:20:17 -0700", "Message-Id": "<20190626092027.52845-6-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190626092027.52845-1-anthony.l.nguyen@intel.com>", "References": "<20190626092027.52845-1-anthony.l.nguyen@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S22 06/16] ice: Do not configure port with\n\tno media", "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>", "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": "The firmware reports an error when trying to configure a port with no\nmedia. Instead of always configuring the port, check for media before\nattempting to configure it. In the absence of media, turn off link and\npoll for media to become available before re-enabling link.\n\nMove ice_force_phys_link_state() up to avoid forward declaration.\n\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice.h | 1 +\n drivers/net/ethernet/intel/ice/ice_main.c | 239 ++++++++++++++--------\n 2 files changed, 158 insertions(+), 82 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex 3639cf8c75ac..ff750c23cb75 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -349,6 +349,7 @@ enum ice_pf_flags {\n \tICE_FLAG_DCB_CAPABLE,\n \tICE_FLAG_DCB_ENA,\n \tICE_FLAG_LINK_DOWN_ON_CLOSE_ENA,\n+\tICE_FLAG_NO_MEDIA,\n \tICE_FLAG_ENABLE_FW_LLDP,\n \tICE_FLAG_ETHTOOL_CTXT,\t\t/* set when ethtool holds RTNL lock */\n \tICE_PF_FLAGS_NBITS\t\t/* must be last */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 40df672befe4..4e5a92dbbf32 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -810,6 +810,20 @@ ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up,\n \tif (!vsi || !vsi->port_info)\n \t\treturn -EINVAL;\n \n+\t/* turn off PHY if media was removed */\n+\tif (!test_bit(ICE_FLAG_NO_MEDIA, pf->flags) &&\n+\t !(pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE)) {\n+\t\tset_bit(ICE_FLAG_NO_MEDIA, pf->flags);\n+\n+\t\tresult = ice_aq_set_link_restart_an(pi, false, NULL);\n+\t\tif (result) {\n+\t\t\tdev_dbg(&pf->pdev->dev,\n+\t\t\t\t\"Failed to set link down, VSI %d error %d\\n\",\n+\t\t\t vsi->vsi_num, result);\n+\t\t\treturn result;\n+\t\t}\n+\t}\n+\n \tice_vsi_link_event(vsi, link_up);\n \tice_print_link_msg(vsi, link_up);\n \n@@ -1314,6 +1328,124 @@ static void ice_handle_mdd_event(struct ice_pf *pf)\n \t}\n }\n \n+/**\n+ * ice_force_phys_link_state - Force the physical link state\n+ * @vsi: VSI to force the physical link state to up/down\n+ * @link_up: true/false indicates to set the physical link to up/down\n+ *\n+ * Force the physical link state by getting the current PHY capabilities from\n+ * hardware and setting the PHY config based on the determined capabilities. If\n+ * link changes a link event will be triggered because both the Enable Automatic\n+ * Link Update and LESM Enable bits are set when setting the PHY capabilities.\n+ *\n+ * Returns 0 on success, negative on failure\n+ */\n+static int ice_force_phys_link_state(struct ice_vsi *vsi, bool link_up)\n+{\n+\tstruct ice_aqc_get_phy_caps_data *pcaps;\n+\tstruct ice_aqc_set_phy_cfg_data *cfg;\n+\tstruct ice_port_info *pi;\n+\tstruct device *dev;\n+\tint retcode;\n+\n+\tif (!vsi || !vsi->port_info || !vsi->back)\n+\t\treturn -EINVAL;\n+\tif (vsi->type != ICE_VSI_PF)\n+\t\treturn 0;\n+\n+\tdev = &vsi->back->pdev->dev;\n+\n+\tpi = vsi->port_info;\n+\n+\tpcaps = devm_kzalloc(dev, sizeof(*pcaps), GFP_KERNEL);\n+\tif (!pcaps)\n+\t\treturn -ENOMEM;\n+\n+\tretcode = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_SW_CFG, pcaps,\n+\t\t\t\t NULL);\n+\tif (retcode) {\n+\t\tdev_err(dev,\n+\t\t\t\"Failed to get phy capabilities, VSI %d error %d\\n\",\n+\t\t\tvsi->vsi_num, retcode);\n+\t\tretcode = -EIO;\n+\t\tgoto out;\n+\t}\n+\n+\t/* No change in link */\n+\tif (link_up == !!(pcaps->caps & ICE_AQC_PHY_EN_LINK) &&\n+\t link_up == !!(pi->phy.link_info.link_info & ICE_AQ_LINK_UP))\n+\t\tgoto out;\n+\n+\tcfg = devm_kzalloc(dev, sizeof(*cfg), GFP_KERNEL);\n+\tif (!cfg) {\n+\t\tretcode = -ENOMEM;\n+\t\tgoto out;\n+\t}\n+\n+\tcfg->phy_type_low = pcaps->phy_type_low;\n+\tcfg->phy_type_high = pcaps->phy_type_high;\n+\tcfg->caps = pcaps->caps | ICE_AQ_PHY_ENA_AUTO_LINK_UPDT;\n+\tcfg->low_power_ctrl = pcaps->low_power_ctrl;\n+\tcfg->eee_cap = pcaps->eee_cap;\n+\tcfg->eeer_value = pcaps->eeer_value;\n+\tcfg->link_fec_opt = pcaps->link_fec_options;\n+\tif (link_up)\n+\t\tcfg->caps |= ICE_AQ_PHY_ENA_LINK;\n+\telse\n+\t\tcfg->caps &= ~ICE_AQ_PHY_ENA_LINK;\n+\n+\tretcode = ice_aq_set_phy_cfg(&vsi->back->hw, pi->lport, cfg, NULL);\n+\tif (retcode) {\n+\t\tdev_err(dev, \"Failed to set phy config, VSI %d error %d\\n\",\n+\t\t\tvsi->vsi_num, retcode);\n+\t\tretcode = -EIO;\n+\t}\n+\n+\tdevm_kfree(dev, cfg);\n+out:\n+\tdevm_kfree(dev, pcaps);\n+\treturn retcode;\n+}\n+\n+/**\n+ * ice_check_media_subtask - Check for media; bring link up if detected.\n+ * @pf: pointer to PF struct\n+ */\n+static void ice_check_media_subtask(struct ice_pf *pf)\n+{\n+\tstruct ice_port_info *pi;\n+\tstruct ice_vsi *vsi;\n+\tint err;\n+\n+\tvsi = ice_find_vsi_by_type(pf, ICE_VSI_PF);\n+\tif (!vsi)\n+\t\treturn;\n+\n+\t/* No need to check for media if it's already present or the interface\n+\t * is down\n+\t */\n+\tif (!test_bit(ICE_FLAG_NO_MEDIA, pf->flags) ||\n+\t test_bit(__ICE_DOWN, vsi->state))\n+\t\treturn;\n+\n+\t/* Refresh link info and check if media is present */\n+\tpi = vsi->port_info;\n+\terr = ice_update_link_info(pi);\n+\tif (err)\n+\t\treturn;\n+\n+\tif (pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE) {\n+\t\terr = ice_force_phys_link_state(vsi, true);\n+\t\tif (err)\n+\t\t\treturn;\n+\t\tclear_bit(ICE_FLAG_NO_MEDIA, pf->flags);\n+\n+\t\t/* A Link Status Event will be generated; the event handler\n+\t\t * will complete bringing the interface up\n+\t\t */\n+\t}\n+}\n+\n /**\n * ice_service_task - manage and run subtasks\n * @work: pointer to work_struct contained by the PF struct\n@@ -1336,6 +1468,7 @@ static void ice_service_task(struct work_struct *work)\n \t\treturn;\n \t}\n \n+\tice_check_media_subtask(pf);\n \tice_check_for_hang_subtask(pf);\n \tice_sync_fltr_subtask(pf);\n \tice_handle_mdd_event(pf);\n@@ -3669,85 +3802,6 @@ static void ice_napi_disable_all(struct ice_vsi *vsi)\n \t}\n }\n \n-/**\n- * ice_force_phys_link_state - Force the physical link state\n- * @vsi: VSI to force the physical link state to up/down\n- * @link_up: true/false indicates to set the physical link to up/down\n- *\n- * Force the physical link state by getting the current PHY capabilities from\n- * hardware and setting the PHY config based on the determined capabilities. If\n- * link changes a link event will be triggered because both the Enable Automatic\n- * Link Update and LESM Enable bits are set when setting the PHY capabilities.\n- *\n- * Returns 0 on success, negative on failure\n- */\n-static int ice_force_phys_link_state(struct ice_vsi *vsi, bool link_up)\n-{\n-\tstruct ice_aqc_get_phy_caps_data *pcaps;\n-\tstruct ice_aqc_set_phy_cfg_data *cfg;\n-\tstruct ice_port_info *pi;\n-\tstruct device *dev;\n-\tint retcode;\n-\n-\tif (!vsi || !vsi->port_info || !vsi->back)\n-\t\treturn -EINVAL;\n-\tif (vsi->type != ICE_VSI_PF)\n-\t\treturn 0;\n-\n-\tdev = &vsi->back->pdev->dev;\n-\n-\tpi = vsi->port_info;\n-\n-\tpcaps = devm_kzalloc(dev, sizeof(*pcaps), GFP_KERNEL);\n-\tif (!pcaps)\n-\t\treturn -ENOMEM;\n-\n-\tretcode = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_SW_CFG, pcaps,\n-\t\t\t\t NULL);\n-\tif (retcode) {\n-\t\tdev_err(dev,\n-\t\t\t\"Failed to get phy capabilities, VSI %d error %d\\n\",\n-\t\t\tvsi->vsi_num, retcode);\n-\t\tretcode = -EIO;\n-\t\tgoto out;\n-\t}\n-\n-\t/* No change in link */\n-\tif (link_up == !!(pcaps->caps & ICE_AQC_PHY_EN_LINK) &&\n-\t link_up == !!(pi->phy.link_info.link_info & ICE_AQ_LINK_UP))\n-\t\tgoto out;\n-\n-\tcfg = devm_kzalloc(dev, sizeof(*cfg), GFP_KERNEL);\n-\tif (!cfg) {\n-\t\tretcode = -ENOMEM;\n-\t\tgoto out;\n-\t}\n-\n-\tcfg->phy_type_low = pcaps->phy_type_low;\n-\tcfg->phy_type_high = pcaps->phy_type_high;\n-\tcfg->caps = pcaps->caps | ICE_AQ_PHY_ENA_AUTO_LINK_UPDT;\n-\tcfg->low_power_ctrl = pcaps->low_power_ctrl;\n-\tcfg->eee_cap = pcaps->eee_cap;\n-\tcfg->eeer_value = pcaps->eeer_value;\n-\tcfg->link_fec_opt = pcaps->link_fec_options;\n-\tif (link_up)\n-\t\tcfg->caps |= ICE_AQ_PHY_ENA_LINK;\n-\telse\n-\t\tcfg->caps &= ~ICE_AQ_PHY_ENA_LINK;\n-\n-\tretcode = ice_aq_set_phy_cfg(&vsi->back->hw, pi->lport, cfg, NULL);\n-\tif (retcode) {\n-\t\tdev_err(dev, \"Failed to set phy config, VSI %d error %d\\n\",\n-\t\t\tvsi->vsi_num, retcode);\n-\t\tretcode = -EIO;\n-\t}\n-\n-\tdevm_kfree(dev, cfg);\n-out:\n-\tdevm_kfree(dev, pcaps);\n-\treturn retcode;\n-}\n-\n /**\n * ice_down - Shutdown the connection\n * @vsi: The VSI being stopped\n@@ -4610,6 +4664,7 @@ int ice_open(struct net_device *netdev)\n {\n \tstruct ice_netdev_priv *np = netdev_priv(netdev);\n \tstruct ice_vsi *vsi = np->vsi;\n+\tstruct ice_port_info *pi;\n \tint err;\n \n \tif (test_bit(__ICE_NEEDS_RESTART, vsi->back->state)) {\n@@ -4619,13 +4674,33 @@ int ice_open(struct net_device *netdev)\n \n \tnetif_carrier_off(netdev);\n \n-\terr = ice_force_phys_link_state(vsi, true);\n+\tpi = vsi->port_info;\n+\terr = ice_update_link_info(pi);\n \tif (err) {\n-\t\tnetdev_err(netdev,\n-\t\t\t \"Failed to set physical link up, error %d\\n\", err);\n+\t\tnetdev_err(netdev, \"Failed to get link info, error %d\\n\",\n+\t\t\t err);\n \t\treturn err;\n \t}\n \n+\t/* Set PHY if there is media, otherwise, turn off PHY */\n+\tif (pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE) {\n+\t\terr = ice_force_phys_link_state(vsi, true);\n+\t\tif (err) {\n+\t\t\tnetdev_err(netdev,\n+\t\t\t\t \"Failed to set physical link up, error %d\\n\",\n+\t\t\t\t err);\n+\t\t\treturn err;\n+\t\t}\n+\t} else {\n+\t\terr = ice_aq_set_link_restart_an(pi, false, NULL);\n+\t\tif (err) {\n+\t\t\tnetdev_err(netdev, \"Failed to set PHY state, VSI %d error %d\\n\",\n+\t\t\t\t vsi->vsi_num, err);\n+\t\t\treturn err;\n+\t\t}\n+\t\tset_bit(ICE_FLAG_NO_MEDIA, vsi->back->flags);\n+\t}\n+\n \terr = ice_vsi_open(vsi);\n \tif (err)\n \t\tnetdev_err(netdev, \"Failed to open VSI 0x%04X on switch 0x%04X\\n\",\n", "prefixes": [ "S22", "06/16" ] }