Commit ade6fded authored by Vitaly Lifshits's avatar Vitaly Lifshits Committed by Tony Nguyen
Browse files

igc: remove autoneg parameter from igc_mac_info



Since the igc driver doesn't support forced speed configuration and
its current related hardware doesn't support it either, there is no
use of the mac.autoneg parameter. Moreover, in one case this usage
might result in a NULL pointer dereference due to an uninitialized
function pointer, phy.ops.force_speed_duplex.

Therefore, remove this parameter from the igc code.

Signed-off-by: default avatarVitaly Lifshits <vitaly.lifshits@intel.com>
Tested-by: default avatarMor Bar-Gabay <morx.bar.gabay@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 4b2c75ff
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -173,7 +173,6 @@ bool igc_link_test(struct igc_adapter *adapter, u64 *data)
	*data = 0;

	/* add delay to give enough time for autonegotioation to finish */
	if (adapter->hw.mac.autoneg)
	ssleep(5);

	link_up = igc_has_link(adapter);
+3 −10
Original line number Diff line number Diff line
@@ -1821,11 +1821,8 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
		ethtool_link_ksettings_add_link_mode(cmd, advertising, 2500baseT_Full);

	/* set autoneg settings */
	if (hw->mac.autoneg == 1) {
	ethtool_link_ksettings_add_link_mode(cmd, supported, Autoneg);
		ethtool_link_ksettings_add_link_mode(cmd, advertising,
						     Autoneg);
	}
	ethtool_link_ksettings_add_link_mode(cmd, advertising, Autoneg);

	/* Set pause flow control settings */
	ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
@@ -1878,10 +1875,7 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
		cmd->base.duplex = DUPLEX_UNKNOWN;
	}
	cmd->base.speed = speed;
	if (hw->mac.autoneg)
	cmd->base.autoneg = AUTONEG_ENABLE;
	else
		cmd->base.autoneg = AUTONEG_DISABLE;

	/* MDI-X => 2; MDI =>1; Invalid =>0 */
	if (hw->phy.media_type == igc_media_type_copper)
@@ -1955,7 +1949,6 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev,
		advertised |= ADVERTISE_10_HALF;

	if (cmd->base.autoneg == AUTONEG_ENABLE) {
		hw->mac.autoneg = 1;
		hw->phy.autoneg_advertised = advertised;
		if (adapter->fc_autoneg)
			hw->fc.requested_mode = igc_fc_default;
+0 −1
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ struct igc_mac_info {
	bool asf_firmware_present;
	bool arc_subsystem_valid;

	bool autoneg;
	bool autoneg_failed;
	bool get_link_status;
};
+153 −163
Original line number Diff line number Diff line
@@ -386,14 +386,6 @@ s32 igc_check_for_copper_link(struct igc_hw *hw)
	 */
	igc_check_downshift(hw);

	/* If we are forcing speed/duplex, then we simply return since
	 * we have already determined whether we have link or not.
	 */
	if (!mac->autoneg) {
		ret_val = -IGC_ERR_CONFIG;
		goto out;
	}

	/* Auto-Neg is enabled.  Auto Speed Detection takes care
	 * of MAC speed/duplex configuration.  So we only need to
	 * configure Collision Distance in the MAC.
@@ -468,12 +460,11 @@ s32 igc_config_fc_after_link_up(struct igc_hw *hw)
		goto out;
	}

	/* Check for the case where we have copper media and auto-neg is
	 * enabled.  In this case, we need to check and see if Auto-Neg
	 * has completed, and if so, how the PHY and link partner has
	 * flow control configured.
	/* In auto-neg, we need to check and see if Auto-Neg has completed,
	 * and if so, how the PHY and link partner has flow control
	 * configured.
	 */
	if (mac->autoneg) {

	/* Read the MII Status Register and check to see if AutoNeg
	 * has completed.  We read this twice because this reg has
	 * some "sticky" (latched) bits.
@@ -635,7 +626,6 @@ s32 igc_config_fc_after_link_up(struct igc_hw *hw)
		hw_dbg("Error forcing flow control settings\n");
		goto out;
	}
	}

out:
	return ret_val;
+0 −1
Original line number Diff line number Diff line
@@ -7108,7 +7108,6 @@ static int igc_probe(struct pci_dev *pdev,

	/* Initialize link properties that are user-changeable */
	adapter->fc_autoneg = true;
	hw->mac.autoneg = true;
	hw->phy.autoneg_advertised = 0xaf;

	hw->fc.requested_mode = igc_fc_default;
Loading