From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95291273D8D; Wed, 22 Apr 2026 16:20:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776874820; cv=none; b=Mt4NDB1SU6Ct/Mh6W0hmWSksFeGMOgUkR9I8QP7fsGIIIejjflgTmjfaYxMO5XyxK6x9JzKPt6gLNwAh/w7r8KoRYZQP/2EqGozT7H00dg3r/TYOkSw9dR7KyxyHDseVXD7cgflG0DS3jeMIsOrUV4LdW4bkAuXVtUlC8Gt3djQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776874820; c=relaxed/simple; bh=dLjvwNQGbgsihw8eMls+gO1zacDih/y1JKuhzvrV16g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZYjtd7jIL8AVcdK4nKbesI7s1xcaKfNdAosU4qVx5gLgYYqyovuN9wbiQSNYLfgEvsppho7L/czYrIgzoVlqiRxQNvL3UjYEaupY04FmaoIp/Tz2lyaW4nkJTWv6ELwFV2CnP/vFoEYTGGcwZxnHqezV7vu0CCYqYT8Gc7MN24M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EujJI9QZ; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EujJI9QZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1776874819; x=1808410819; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dLjvwNQGbgsihw8eMls+gO1zacDih/y1JKuhzvrV16g=; b=EujJI9QZ/bSplmXJzL2Z0hpKc6yBHQEWpsLfSqUImpUxWjpT9DhZ5T3x lVGLWSWFdwOGyNuMEVR5tKt357StBoBkmSPy8pOp44WDHNadgejgJOMun MuyRzpHe+pjGxQGN/xy9ObA5ELquVB7jva6zUDWsHam3g6bUYpi8RTozf 3jiHY5t0lgBvBxwKbppXVi8g/cBYXlhEOl2OQqB+njQ07pKUA9nQaxixJ fZKZGb3wVRKuNlE+17uqCyvMzjo5bdmBJOkJOCaCFZ0Hb+BKfnWyuxDVk Xb3JMNFBNr83N7aN0w2ApX93sx+DY05+5YDBDmBb8GXEmMk1BCoD6wrPr A==; X-CSE-ConnectionGUID: Yw/xIUjOR3qvXhaIL4VuKQ== X-CSE-MsgGUID: bRbx7lILRG+sNrQ9PbpoZQ== X-IronPort-AV: E=McAfee;i="6800,10657,11764"; a="88134487" X-IronPort-AV: E=Sophos;i="6.23,193,1770624000"; d="scan'208";a="88134487" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2026 09:20:19 -0700 X-CSE-ConnectionGUID: yMP4YfLNTJSVIIjF5wcA8Q== X-CSE-MsgGUID: 9rYquxjxS0KxfOb29LoFtw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,193,1770624000"; d="scan'208";a="228052453" Received: from unknown (HELO localhost.png.intel.com) ([10.107.255.61]) by fmviesa010.fm.intel.com with ESMTP; 22 Apr 2026 09:20:15 -0700 From: KhaiWenTan To: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, faizal.abdul.rahim@intel.com, hong.aun.looi@intel.com, khai.wen.tan@intel.com, Faizal Rahim , Looi, Aleksandr Loktionov , KhaiWenTan Subject: [PATCH iwl-next v3 2/3] igc: move autoneg-enabled settings into igc_handle_autoneg_enabled() Date: Wed, 22 Apr 2026 23:57:00 +0800 Message-ID: <20260422155701.7420-3-khai.wen.tan@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422155701.7420-1-khai.wen.tan@linux.intel.com> References: <20260422155701.7420-1-khai.wen.tan@linux.intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Faizal Rahim Move the advertised link modes and flow control configuration from igc_ethtool_set_link_ksettings() into igc_handle_autoneg_enabled(). No functional change. Reviewed-by: Looi, Hong Aun Reviewed-by: Aleksandr Loktionov Signed-off-by: Faizal Rahim Signed-off-by: KhaiWenTan --- drivers/net/ethernet/intel/igc/igc_ethtool.c | 72 ++++++++++++-------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 0122009bedd0..cfcbf2fdad6e 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -2000,6 +2000,49 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev, return 0; } +/** + * igc_handle_autoneg_enabled - Configure autonegotiation advertisement + * @adapter: private driver structure + * @cmd: ethtool link ksettings from user + * + * Records advertised speeds and flow control settings when autoneg + * is enabled. + */ +static void igc_handle_autoneg_enabled(struct igc_adapter *adapter, + const struct ethtool_link_ksettings *cmd) +{ + struct igc_hw *hw = &adapter->hw; + u16 advertised = 0; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 2500baseT_Full)) + advertised |= ADVERTISE_2500_FULL; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 1000baseT_Full)) + advertised |= ADVERTISE_1000_FULL; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 100baseT_Full)) + advertised |= ADVERTISE_100_FULL; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 100baseT_Half)) + advertised |= ADVERTISE_100_HALF; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 10baseT_Full)) + advertised |= ADVERTISE_10_FULL; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 10baseT_Half)) + advertised |= ADVERTISE_10_HALF; + + hw->phy.autoneg_advertised = advertised; + if (adapter->fc_autoneg) + hw->fc.requested_mode = igc_fc_default; +} + static int igc_ethtool_set_link_ksettings(struct net_device *netdev, const struct ethtool_link_ksettings *cmd) @@ -2007,7 +2050,6 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev, struct igc_adapter *adapter = netdev_priv(netdev); struct net_device *dev = adapter->netdev; struct igc_hw *hw = &adapter->hw; - u16 advertised = 0; /* When adapter in resetting mode, autoneg/speed/duplex * cannot be changed @@ -2032,34 +2074,8 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev, while (test_and_set_bit(__IGC_RESETTING, &adapter->state)) usleep_range(1000, 2000); - if (ethtool_link_ksettings_test_link_mode(cmd, advertising, - 2500baseT_Full)) - advertised |= ADVERTISE_2500_FULL; - - if (ethtool_link_ksettings_test_link_mode(cmd, advertising, - 1000baseT_Full)) - advertised |= ADVERTISE_1000_FULL; - - if (ethtool_link_ksettings_test_link_mode(cmd, advertising, - 100baseT_Full)) - advertised |= ADVERTISE_100_FULL; - - if (ethtool_link_ksettings_test_link_mode(cmd, advertising, - 100baseT_Half)) - advertised |= ADVERTISE_100_HALF; - - if (ethtool_link_ksettings_test_link_mode(cmd, advertising, - 10baseT_Full)) - advertised |= ADVERTISE_10_FULL; - - if (ethtool_link_ksettings_test_link_mode(cmd, advertising, - 10baseT_Half)) - advertised |= ADVERTISE_10_HALF; - if (cmd->base.autoneg == AUTONEG_ENABLE) { - hw->phy.autoneg_advertised = advertised; - if (adapter->fc_autoneg) - hw->fc.requested_mode = igc_fc_default; + igc_handle_autoneg_enabled(adapter, cmd); } else { netdev_info(dev, "Force mode currently not supported\n"); } -- 2.43.0