Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/750532/?format=api
{ "id": 750532, "url": "http://patchwork.ozlabs.org/api/patches/750532/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170413084555.6962-5-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": "<20170413084555.6962-5-alice.michael@intel.com>", "list_archive_url": null, "date": "2017-04-13T08:45:48", "name": "[next,S70,05/12] i40e: fix CONFIG_BUSY checks in i40e_set_settings function", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "5a20c7b10bfe763742f2ceb316e1168848deffcf", "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/20170413084555.6962-5-alice.michael@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/750532/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/750532/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.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" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 3w3mvS2m1Jz9sDG\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 14 Apr 2017 02:48:36 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 9F2B28A682;\n\tThu, 13 Apr 2017 16:48:34 +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 0sb05RfWbtNi; Thu, 13 Apr 2017 16:48:33 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 035908A677;\n\tThu, 13 Apr 2017 16:48:33 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 59A0C1BFE90\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Apr 2017 16:48:31 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 4C43C89BF0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Apr 2017 16:48:31 +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 6VAqKkdyTVWT for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Apr 2017 16:48:30 +0000 (UTC)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 387F489C9E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Apr 2017 16:48:30 +0000 (UTC)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Apr 2017 09:48:28 -0700", "from unknown (HELO localhost.jf.intel.com) ([10.166.16.121])\n\tby orsmga002.jf.intel.com with ESMTP; 13 Apr 2017 09:48:28 -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-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.37,195,1488873600\"; d=\"scan'208\";a=\"73711321\"", "From": "Alice Michael <alice.michael@intel.com>", "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org", "Date": "Thu, 13 Apr 2017 04:45:48 -0400", "Message-Id": "<20170413084555.6962-5-alice.michael@intel.com>", "X-Mailer": "git-send-email 2.9.3", "In-Reply-To": "<20170413084555.6962-1-alice.michael@intel.com>", "References": "<20170413084555.6962-1-alice.michael@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S70 05/12] i40e: fix CONFIG_BUSY\n\tchecks in i40e_set_settings function", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "From: Jacob Keller <jacob.e.keller@intel.com>\n\nThe check for I40E_CONFIG_BUSY state bit in the i40e_set_link_ksettings\nfunction is fishy. First we can notice a few things about the check here.\n\nFirst a similar check was introduced by commit\n'c7d05ca89f8e (\"i40e: driver ethtool core\")'\n\nLater a commit introducing the link settings was added by commit\n'bf9c71417f72 (\"i40e: Implement set_settings for ethtool\")'\n\nHowever, this second check was against vsi->state instead of pf->state,\nand also failed to set the bit, it only checks. That indicates the locking\nwas not quite correct. The only other place that the state bit\nin vsi->state gets used is to protect the filter list.\n\nSince this code does not care about the mac filter list, and seems\nclear the original code should have set the pf->state bit. Fix these\nissues by using pf->state correctly, and by actually setting the bit\nso that we properly lock as expected.\n\nSince these checks occur while holding the rtnl_lock(), lets also add a\ntimeout so that we don't potentially softlock the system.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 38 ++++++++++++++++++++------\n 1 file changed, 29 insertions(+), 9 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 10325b5..08035c4 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -698,6 +698,7 @@ static int i40e_set_link_ksettings(struct net_device *netdev,\n \tstruct ethtool_link_ksettings copy_cmd;\n \ti40e_status status = 0;\n \tbool change = false;\n+\tint timeout = 50;\n \tint err = 0;\n \tu32 autoneg;\n \tu32 advertise;\n@@ -756,14 +757,20 @@ static int i40e_set_link_ksettings(struct net_device *netdev,\n \tif (memcmp(©_cmd, &safe_cmd, sizeof(struct ethtool_link_ksettings)))\n \t\treturn -EOPNOTSUPP;\n \n-\twhile (test_bit(__I40E_CONFIG_BUSY, &vsi->state))\n+\twhile (test_and_set_bit(__I40E_CONFIG_BUSY, &pf->state)) {\n+\t\ttimeout--;\n+\t\tif (!timeout)\n+\t\t\treturn -EBUSY;\n \t\tusleep_range(1000, 2000);\n+\t}\n \n \t/* Get the current phy config */\n \tstatus = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,\n \t\t\t\t\t NULL);\n-\tif (status)\n-\t\treturn -EAGAIN;\n+\tif (status) {\n+\t\terr = -EAGAIN;\n+\t\tgoto done;\n+\t}\n \n \t/* Copy abilities to config in case autoneg is not\n \t * set below\n@@ -779,7 +786,8 @@ static int i40e_set_link_ksettings(struct net_device *netdev,\n \t\t\tif (!ethtool_link_ksettings_test_link_mode(\n \t\t\t\t &safe_cmd, supported, Autoneg)) {\n \t\t\t\tnetdev_info(netdev, \"Autoneg not supported on this phy\\n\");\n-\t\t\t\treturn -EINVAL;\n+\t\t\t\terr = -EINVAL;\n+\t\t\t\tgoto done;\n \t\t\t}\n \t\t\t/* Autoneg is allowed to change */\n \t\t\tconfig.abilities = abilities.abilities |\n@@ -797,7 +805,8 @@ static int i40e_set_link_ksettings(struct net_device *netdev,\n \t\t\t hw->phy.link_info.phy_type !=\n \t\t\t I40E_PHY_TYPE_10GBASE_T) {\n \t\t\t\tnetdev_info(netdev, \"Autoneg cannot be disabled on this phy\\n\");\n-\t\t\t\treturn -EINVAL;\n+\t\t\t\terr = -EINVAL;\n+\t\t\t\tgoto done;\n \t\t\t}\n \t\t\t/* Autoneg is allowed to change */\n \t\t\tconfig.abilities = abilities.abilities &\n@@ -808,8 +817,10 @@ static int i40e_set_link_ksettings(struct net_device *netdev,\n \n \tethtool_convert_link_mode_to_legacy_u32(&tmp,\n \t\t\t\t\t\tsafe_cmd.link_modes.supported);\n-\tif (advertise & ~tmp)\n-\t\treturn -EINVAL;\n+\tif (advertise & ~tmp) {\n+\t\terr = -EINVAL;\n+\t\tgoto done;\n+\t}\n \n \tif (advertise & ADVERTISED_100baseT_Full)\n \t\tconfig.link_speed |= I40E_LINK_SPEED_100MB;\n@@ -865,7 +876,8 @@ static int i40e_set_link_ksettings(struct net_device *netdev,\n \t\t\tnetdev_info(netdev, \"Set phy config failed, err %s aq_err %s\\n\",\n \t\t\t\t i40e_stat_str(hw, status),\n \t\t\t\t i40e_aq_str(hw, hw->aq.asq_last_status));\n-\t\t\treturn -EAGAIN;\n+\t\t\terr = -EAGAIN;\n+\t\t\tgoto done;\n \t\t}\n \n \t\tstatus = i40e_update_link_info(hw);\n@@ -878,6 +890,9 @@ static int i40e_set_link_ksettings(struct net_device *netdev,\n \t\tnetdev_info(netdev, \"Nothing changed, exiting without setting anything.\\n\");\n \t}\n \n+done:\n+\tclear_bit(__I40E_CONFIG_BUSY, &pf->state);\n+\n \treturn err;\n }\n \n@@ -1292,6 +1307,7 @@ static int i40e_set_ringparam(struct net_device *netdev,\n \tstruct i40e_vsi *vsi = np->vsi;\n \tstruct i40e_pf *pf = vsi->back;\n \tu32 new_rx_count, new_tx_count;\n+\tint timeout = 50;\n \tint i, err = 0;\n \n \tif ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))\n@@ -1316,8 +1332,12 @@ static int i40e_set_ringparam(struct net_device *netdev,\n \t (new_rx_count == vsi->rx_rings[0]->count))\n \t\treturn 0;\n \n-\twhile (test_and_set_bit(__I40E_CONFIG_BUSY, &pf->state))\n+\twhile (test_and_set_bit(__I40E_CONFIG_BUSY, &pf->state)) {\n+\t\ttimeout--;\n+\t\tif (!timeout)\n+\t\t\treturn -EBUSY;\n \t\tusleep_range(1000, 2000);\n+\t}\n \n \tif (!netif_running(vsi->netdev)) {\n \t\t/* simple case - set for the next time the netdev is started */\n", "prefixes": [ "next", "S70", "05/12" ] }