{"id":2234730,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2234730/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260508031226.3601800-7-aleksandr.loktionov@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/1.2/projects/46/?format=json","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":"<20260508031226.3601800-7-aleksandr.loktionov@intel.com>","list_archive_url":null,"date":"2026-05-08T03:12:24","name":"[iwl-next,6/8] ixgbe: extract ixgbe_restart_auto_neg() to avoid code duplication","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"5a771bc10ac0685162ac0d144d03821eecf42cf5","submitter":{"id":75597,"url":"http://patchwork.ozlabs.org/api/1.2/people/75597/?format=json","name":"Loktionov, Aleksandr","email":"aleksandr.loktionov@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260508031226.3601800-7-aleksandr.loktionov@intel.com/mbox/","series":[{"id":503311,"url":"http://patchwork.ozlabs.org/api/1.2/series/503311/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=503311","date":"2026-05-08T03:12:18","name":"ixgbe: small cleanups and improvements","version":1,"mbox":"http://patchwork.ozlabs.org/series/503311/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2234730/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2234730/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@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=CZAP4pqk;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBZ1R2xg0z1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 13:12:43 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 0F6DC6123F;\n\tFri,  8 May 2026 03:12:42 +0000 (UTC)","from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id TZOWBpdB96yu; Fri,  8 May 2026 03:12:41 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 4020C61238;\n\tFri,  8 May 2026 03:12:41 +0000 (UTC)","from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by lists1.osuosl.org (Postfix) with ESMTP id 4F4D9317\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 03:12:39 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id 34DB6409B3\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 03:12:39 +0000 (UTC)","from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id Oyg_YCY0vEHz for <intel-wired-lan@lists.osuosl.org>;\n Fri,  8 May 2026 03:12:38 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [192.198.163.17])\n by smtp2.osuosl.org (Postfix) with ESMTPS id 37BF84030E\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 03:12:38 +0000 (UTC)","from fmviesa005.fm.intel.com ([10.60.135.145])\n by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 May 2026 20:12:38 -0700","from amlin-019-225.igk.intel.com ([10.102.19.225])\n by fmviesa005.fm.intel.com with ESMTP; 07 May 2026 20:12:37 -0700"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4020C61238","OpenDKIM Filter v2.11.0 smtp2.osuosl.org 37BF84030E"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1778209961;\n\tbh=SAOYT0OoA1NaaPxM6Nxp+tb5sC47gUPUICbsr2lxfGM=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=CZAP4pqkwGnphBTjRdA5b9tRk5ID4mFW4Q6S1q/wx5IMFZZe2vg1r1UrjkxYik6YN\n\t KRCAbFRTkAdUSzNiyoHH3EiJ/P9OMlUPblvAypUrE3oA13+DUUHZsux1gDpqMTFWdb\n\t r3jhUoCzKGT5KzaAALw/3jQTCeLS74ssW7FgmgIMhrBIkCXLfXLPhNtIbH07cXxuRm\n\t EF1BDhGCz77AycT38am3bppmG5UULv2b6i4HEOsEbpZh9sH929xIMgj4tl7GFny4mm\n\t TW/70FSRRoGjn5AncmtijYE0FDRuEU3GHqBvGLcg/u4Vw6GGW//hcWFGHmEn9tMDNp\n\t mFdTWiq901jRQ==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.17;\n helo=mgamail.intel.com; envelope-from=aleksandr.loktionov@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp2.osuosl.org 37BF84030E","X-CSE-ConnectionGUID":["Q6UezhgQTWO5+c8KCUanaA==","nofhen9zRsOgobpEuWrsaA=="],"X-CSE-MsgGUID":["mb7U+6/gT4yZeWg+7PiS5Q==","3ivrJew4TH2fPViGhX0S6g=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11779\"; a=\"79027513\"","E=Sophos;i=\"6.23,222,1770624000\"; d=\"scan'208\";a=\"79027513\"","E=Sophos;i=\"6.23,222,1770624000\"; d=\"scan'208\";a=\"241623210\""],"X-ExtLoop1":"1","From":"Aleksandr Loktionov <aleksandr.loktionov@intel.com>","To":"intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,\n aleksandr.loktionov@intel.com","Cc":"netdev@vger.kernel.org","Date":"Fri,  8 May 2026 05:12:24 +0200","Message-ID":"<20260508031226.3601800-7-aleksandr.loktionov@intel.com>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260508031226.3601800-1-aleksandr.loktionov@intel.com>","References":"<20260508031226.3601800-1-aleksandr.loktionov@intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1778209958; x=1809745958;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=CBKMlV60ZbulVgXwKgQt5VEkfWvqAFPvIP4/ufqNnDs=;\n b=evlOix4mZg6gHUbKPjnct0qj0QT6mjo+3gexqkFR3tMgbt0sJRCXb2dL\n ww7bOkRuiiJu704MdCCKnCYILpfvbZN0BjQEgnnUU0pe1UooxW1yQf7vo\n Sr7GbrZryBGugoga0HLX5nHEZa8wG2i6DIQhoYMGVrDOnTOfojBQ8CmI6\n r37qEf+BFnqNC4JLxMrYV4AWB04t3pH7XjixwzZSKCW489qhvqZknHP5x\n bEyX2nZRqpdGh6sHIJaDNsOcN0hLtHkeaVP9L07Z63+mi226vmaDOtlW7\n 4XMafA0qoKdTxHFjsWulw0HtTLXCnGrSPtIeygWFUd8j5GjJO+7r7OYz3\n g==;","X-Mailman-Original-Authentication-Results":["smtp2.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp2.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=evlOix4m"],"Subject":"[Intel-wired-lan] [PATCH iwl-next 6/8] ixgbe: extract\n ixgbe_restart_auto_neg() to avoid code duplication","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <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 <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"},"content":"From: Jakub Chylkowski <jakubx.chylkowski@intel.com>\n\nBoth ixgbe_setup_phy_link_generic() and ixgbe_setup_phy_link_tnx()\nend with the same three-line sequence that reads MDIO_CTRL1, sets\nthe MDIO_AN_CTRL1_RESTART bit, and writes MDIO_CTRL1 back.\n\nFactor it out into a static helper ixgbe_restart_auto_neg() and call\nit from both sites.\n\nWhile at it, also check the return value of phy.ops.read_reg() in the\nhelper and skip the write on failure.  The original inlined code\nignored the read result and would OR MDIO_AN_CTRL1_RESTART into a\nstale autoneg_reg value (left over from the prior MDIO_AN_ADVERTISE\nwrite) and unconditionally write it back to MDIO_CTRL1 if the read\nfailed.  This is a small behavioral change: on read_reg() failure the\nrestart write is now skipped instead of being issued with a\npotentially garbage value.\n\nSigned-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>\nSigned-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 36 ++++++++++++--------\n 1 file changed, 22 insertions(+), 14 deletions(-)","diff":"diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c\nindex de8f6c6..c7387a4 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c\n@@ -1089,6 +1089,26 @@ int ixgbe_mii_bus_init(struct ixgbe_hw *hw)\n \treturn mdiobus_register(bus);\n }\n \n+/**\n+ * ixgbe_restart_auto_neg - restart PHY autonegotiation\n+ * @hw: pointer to hardware structure\n+ *\n+ * Sets the restart autoneg bit in MDIO_CTRL1 to trigger a new\n+ * autonegotiation cycle.\n+ **/\n+static void ixgbe_restart_auto_neg(struct ixgbe_hw *hw)\n+{\n+\tu16 autoneg_reg;\n+\tint status;\n+\n+\tstatus = hw->phy.ops.read_reg(hw, MDIO_CTRL1, MDIO_MMD_AN,\n+\t\t\t\t      &autoneg_reg);\n+\tif (status)\n+\t\treturn;\n+\tautoneg_reg |= MDIO_AN_CTRL1_RESTART;\n+\thw->phy.ops.write_reg(hw, MDIO_CTRL1, MDIO_MMD_AN, autoneg_reg);\n+}\n+\n /**\n  *  ixgbe_setup_phy_link_generic - Set and restart autoneg\n  *  @hw: pointer to hardware structure\n@@ -1156,13 +1176,7 @@ int ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)\n \t\treturn 0;\n \n \t/* Restart PHY autonegotiation and wait for completion */\n-\thw->phy.ops.read_reg(hw, MDIO_CTRL1,\n-\t\t\t     MDIO_MMD_AN, &autoneg_reg);\n-\n-\tautoneg_reg |= MDIO_AN_CTRL1_RESTART;\n-\n-\thw->phy.ops.write_reg(hw, MDIO_CTRL1,\n-\t\t\t      MDIO_MMD_AN, autoneg_reg);\n+\tixgbe_restart_auto_neg(hw);\n \n \treturn status;\n }\n@@ -1386,13 +1400,7 @@ int ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw)\n \t\treturn 0;\n \n \t/* Restart PHY autonegotiation and wait for completion */\n-\thw->phy.ops.read_reg(hw, MDIO_CTRL1,\n-\t\t\t     MDIO_MMD_AN, &autoneg_reg);\n-\n-\tautoneg_reg |= MDIO_AN_CTRL1_RESTART;\n-\n-\thw->phy.ops.write_reg(hw, MDIO_CTRL1,\n-\t\t\t      MDIO_MMD_AN, autoneg_reg);\n+\tixgbe_restart_auto_neg(hw);\n \treturn 0;\n }\n \n","prefixes":["iwl-next","6/8"]}