Commit 34d073fc authored by David S. Miller's avatar David S. Miller
Browse files


Jeff Kirsher says:

====================
This series contains updates to e100 and e1000e.

The e100 patch from Andy simply updates the netif_printk() to use
%*ph to dump small buffers.

The changes to e1000e include a fix from Dean Nelson to resolve a
issue where a pci_clear_master() was accidentally dropped during a
conflict resolution. Wei Young provides 2 patches, one removes an
assignment of the default ring size because it was a duplicate. The
second changes the packet split receive structure to use
PS_PAGE_BUFFERS macro for the length so that problems won't occur
when the length is changed.

The remaining patches for e1000e are from Bruce Allan, where he
provides a number of fixes and updates for I218.  In addition, a
fix for 82583 which can disappear off the PCIe bus, to resolve this,
disable ASPM L1.  Bruce also provides a fix to a previous commit
(commit e60b22c5 e1000e: fix accessing to suspended device) so that
devices are only taken out of runtime power management for those
ethtool operations that must access device registers.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9d4a0314 16b095a4
Loading
Loading
Loading
Loading
+6 −9
Original line number Original line Diff line number Diff line
@@ -1175,15 +1175,12 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
		config->rx_discard_short_frames = 0x0;  /* 1=discard, 0=save */
		config->rx_discard_short_frames = 0x0;  /* 1=discard, 0=save */
	}
	}


	netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
	netif_printk(nic, hw, KERN_DEBUG, nic->netdev, "[00-07]=%8ph\n",
		     "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
		     c + 0);
		     c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
	netif_printk(nic, hw, KERN_DEBUG, nic->netdev, "[08-15]=%8ph\n",
	netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
		     c + 8);
		     "[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
	netif_printk(nic, hw, KERN_DEBUG, nic->netdev, "[16-23]=%8ph\n",
		     c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]);
		     c + 16);
	netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
		     "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
		     c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]);
	return 0;
	return 0;
}
}


+1 −0
Original line number Original line Diff line number Diff line
@@ -2057,6 +2057,7 @@ const struct e1000_info e1000_82583_info = {
				  | FLAG_HAS_JUMBO_FRAMES
				  | FLAG_HAS_JUMBO_FRAMES
				  | FLAG_HAS_CTRLEXT_ON_LOAD,
				  | FLAG_HAS_CTRLEXT_ON_LOAD,
	.flags2			= FLAG2_DISABLE_ASPM_L0S
	.flags2			= FLAG2_DISABLE_ASPM_L0S
				  | FLAG2_DISABLE_ASPM_L1
				  | FLAG2_NO_DISABLE_RX,
				  | FLAG2_NO_DISABLE_RX,
	.pba			= 32,
	.pba			= 32,
	.max_hw_frame_size	= DEFAULT_JUMBO,
	.max_hw_frame_size	= DEFAULT_JUMBO,
+0 −3
Original line number Original line Diff line number Diff line
@@ -90,9 +90,6 @@ struct e1000_info;


#define E1000_MNG_VLAN_NONE		(-1)
#define E1000_MNG_VLAN_NONE		(-1)


/* Number of packet split data buffers (not including the header buffer) */
#define PS_PAGE_BUFFERS			(MAX_PS_BUFFERS - 1)

#define DEFAULT_JUMBO			9234
#define DEFAULT_JUMBO			9234


/* Time to wait before putting the device into D3 if there's no link (in ms). */
/* Time to wait before putting the device into D3 if there's no link (in ms). */
+77 −28
Original line number Original line Diff line number Diff line
@@ -173,7 +173,7 @@ static int e1000_get_settings(struct net_device *netdev,
			speed = adapter->link_speed;
			speed = adapter->link_speed;
			ecmd->duplex = adapter->link_duplex - 1;
			ecmd->duplex = adapter->link_duplex - 1;
		}
		}
	} else {
	} else if (!pm_runtime_suspended(netdev->dev.parent)) {
		u32 status = er32(STATUS);
		u32 status = er32(STATUS);
		if (status & E1000_STATUS_LU) {
		if (status & E1000_STATUS_LU) {
			if (status & E1000_STATUS_SPEED_1000)
			if (status & E1000_STATUS_SPEED_1000)
@@ -264,6 +264,9 @@ static int e1000_set_settings(struct net_device *netdev,
{
{
	struct e1000_adapter *adapter = netdev_priv(netdev);
	struct e1000_adapter *adapter = netdev_priv(netdev);
	struct e1000_hw *hw = &adapter->hw;
	struct e1000_hw *hw = &adapter->hw;
	int ret_val = 0;

	pm_runtime_get_sync(netdev->dev.parent);


	/* When SoL/IDER sessions are active, autoneg/speed/duplex
	/* When SoL/IDER sessions are active, autoneg/speed/duplex
	 * cannot be changed
	 * cannot be changed
@@ -271,7 +274,8 @@ static int e1000_set_settings(struct net_device *netdev,
	if (hw->phy.ops.check_reset_block &&
	if (hw->phy.ops.check_reset_block &&
	    hw->phy.ops.check_reset_block(hw)) {
	    hw->phy.ops.check_reset_block(hw)) {
		e_err("Cannot change link characteristics when SoL/IDER is active.\n");
		e_err("Cannot change link characteristics when SoL/IDER is active.\n");
		return -EINVAL;
		ret_val = -EINVAL;
		goto out;
	}
	}


	/* MDI setting is only allowed when autoneg enabled because
	/* MDI setting is only allowed when autoneg enabled because
@@ -279,13 +283,16 @@ static int e1000_set_settings(struct net_device *netdev,
	 * duplex is forced.
	 * duplex is forced.
	 */
	 */
	if (ecmd->eth_tp_mdix_ctrl) {
	if (ecmd->eth_tp_mdix_ctrl) {
		if (hw->phy.media_type != e1000_media_type_copper)
		if (hw->phy.media_type != e1000_media_type_copper) {
			return -EOPNOTSUPP;
			ret_val = -EOPNOTSUPP;
			goto out;
		}


		if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) &&
		if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) &&
		    (ecmd->autoneg != AUTONEG_ENABLE)) {
		    (ecmd->autoneg != AUTONEG_ENABLE)) {
			e_err("forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");
			e_err("forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");
			return -EINVAL;
			ret_val = -EINVAL;
			goto out;
		}
		}
	}
	}


@@ -307,8 +314,8 @@ static int e1000_set_settings(struct net_device *netdev,
		u32 speed = ethtool_cmd_speed(ecmd);
		u32 speed = ethtool_cmd_speed(ecmd);
		/* calling this overrides forced MDI setting */
		/* calling this overrides forced MDI setting */
		if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {
		if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {
			clear_bit(__E1000_RESETTING, &adapter->state);
			ret_val = -EINVAL;
			return -EINVAL;
			goto out;
		}
		}
	}
	}


@@ -331,8 +338,10 @@ static int e1000_set_settings(struct net_device *netdev,
		e1000e_reset(adapter);
		e1000e_reset(adapter);
	}
	}


out:
	pm_runtime_put_sync(netdev->dev.parent);
	clear_bit(__E1000_RESETTING, &adapter->state);
	clear_bit(__E1000_RESETTING, &adapter->state);
	return 0;
	return ret_val;
}
}


static void e1000_get_pauseparam(struct net_device *netdev,
static void e1000_get_pauseparam(struct net_device *netdev,
@@ -366,6 +375,8 @@ static int e1000_set_pauseparam(struct net_device *netdev,
	while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
	while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
		usleep_range(1000, 2000);
		usleep_range(1000, 2000);


	pm_runtime_get_sync(netdev->dev.parent);

	if (adapter->fc_autoneg == AUTONEG_ENABLE) {
	if (adapter->fc_autoneg == AUTONEG_ENABLE) {
		hw->fc.requested_mode = e1000_fc_default;
		hw->fc.requested_mode = e1000_fc_default;
		if (netif_running(adapter->netdev)) {
		if (netif_running(adapter->netdev)) {
@@ -398,6 +409,7 @@ static int e1000_set_pauseparam(struct net_device *netdev,
	}
	}


out:
out:
	pm_runtime_put_sync(netdev->dev.parent);
	clear_bit(__E1000_RESETTING, &adapter->state);
	clear_bit(__E1000_RESETTING, &adapter->state);
	return retval;
	return retval;
}
}
@@ -428,6 +440,8 @@ static void e1000_get_regs(struct net_device *netdev,
	u32 *regs_buff = p;
	u32 *regs_buff = p;
	u16 phy_data;
	u16 phy_data;


	pm_runtime_get_sync(netdev->dev.parent);

	memset(p, 0, E1000_REGS_LEN * sizeof(u32));
	memset(p, 0, E1000_REGS_LEN * sizeof(u32));


	regs->version = (1 << 24) | (adapter->pdev->revision << 16) |
	regs->version = (1 << 24) | (adapter->pdev->revision << 16) |
@@ -472,6 +486,8 @@ static void e1000_get_regs(struct net_device *netdev,
	e1e_rphy(hw, MII_STAT1000, &phy_data);
	e1e_rphy(hw, MII_STAT1000, &phy_data);
	regs_buff[24] = (u32)phy_data;	/* phy local receiver status */
	regs_buff[24] = (u32)phy_data;	/* phy local receiver status */
	regs_buff[25] = regs_buff[24];	/* phy remote receiver status */
	regs_buff[25] = regs_buff[24];	/* phy remote receiver status */

	pm_runtime_put_sync(netdev->dev.parent);
}
}


static int e1000_get_eeprom_len(struct net_device *netdev)
static int e1000_get_eeprom_len(struct net_device *netdev)
@@ -504,6 +520,8 @@ static int e1000_get_eeprom(struct net_device *netdev,
	if (!eeprom_buff)
	if (!eeprom_buff)
		return -ENOMEM;
		return -ENOMEM;


	pm_runtime_get_sync(netdev->dev.parent);

	if (hw->nvm.type == e1000_nvm_eeprom_spi) {
	if (hw->nvm.type == e1000_nvm_eeprom_spi) {
		ret_val = e1000_read_nvm(hw, first_word,
		ret_val = e1000_read_nvm(hw, first_word,
					 last_word - first_word + 1,
					 last_word - first_word + 1,
@@ -517,6 +535,8 @@ static int e1000_get_eeprom(struct net_device *netdev,
		}
		}
	}
	}


	pm_runtime_put_sync(netdev->dev.parent);

	if (ret_val) {
	if (ret_val) {
		/* a read error occurred, throw away the result */
		/* a read error occurred, throw away the result */
		memset(eeprom_buff, 0xff, sizeof(u16) *
		memset(eeprom_buff, 0xff, sizeof(u16) *
@@ -566,6 +586,8 @@ static int e1000_set_eeprom(struct net_device *netdev,


	ptr = (void *)eeprom_buff;
	ptr = (void *)eeprom_buff;


	pm_runtime_get_sync(netdev->dev.parent);

	if (eeprom->offset & 1) {
	if (eeprom->offset & 1) {
		/* need read/modify/write of first changed EEPROM word */
		/* need read/modify/write of first changed EEPROM word */
		/* only the second byte of the word is being modified */
		/* only the second byte of the word is being modified */
@@ -606,6 +628,7 @@ static int e1000_set_eeprom(struct net_device *netdev,
		ret_val = e1000e_update_nvm_checksum(hw);
		ret_val = e1000e_update_nvm_checksum(hw);


out:
out:
	pm_runtime_put_sync(netdev->dev.parent);
	kfree(eeprom_buff);
	kfree(eeprom_buff);
	return ret_val;
	return ret_val;
}
}
@@ -701,6 +724,8 @@ static int e1000_set_ringparam(struct net_device *netdev,
		}
		}
	}
	}


	pm_runtime_get_sync(netdev->dev.parent);

	e1000e_down(adapter);
	e1000e_down(adapter);


	/* We can't just free everything and then setup again, because the
	/* We can't just free everything and then setup again, because the
@@ -739,6 +764,7 @@ err_setup_rx:
		e1000e_free_tx_resources(temp_tx);
		e1000e_free_tx_resources(temp_tx);
err_setup:
err_setup:
	e1000e_up(adapter);
	e1000e_up(adapter);
	pm_runtime_put_sync(netdev->dev.parent);
free_temp:
free_temp:
	vfree(temp_tx);
	vfree(temp_tx);
	vfree(temp_rx);
	vfree(temp_rx);
@@ -1732,6 +1758,8 @@ static void e1000_diag_test(struct net_device *netdev,
	u8 autoneg;
	u8 autoneg;
	bool if_running = netif_running(netdev);
	bool if_running = netif_running(netdev);


	pm_runtime_get_sync(netdev->dev.parent);

	set_bit(__E1000_TESTING, &adapter->state);
	set_bit(__E1000_TESTING, &adapter->state);


	if (!if_running) {
	if (!if_running) {
@@ -1817,6 +1845,8 @@ static void e1000_diag_test(struct net_device *netdev,
	}
	}


	msleep_interruptible(4 * 1000);
	msleep_interruptible(4 * 1000);

	pm_runtime_put_sync(netdev->dev.parent);
}
}


static void e1000_get_wol(struct net_device *netdev,
static void e1000_get_wol(struct net_device *netdev,
@@ -1891,6 +1921,8 @@ static int e1000_set_phys_id(struct net_device *netdev,


	switch (state) {
	switch (state) {
	case ETHTOOL_ID_ACTIVE:
	case ETHTOOL_ID_ACTIVE:
		pm_runtime_get_sync(netdev->dev.parent);

		if (!hw->mac.ops.blink_led)
		if (!hw->mac.ops.blink_led)
			return 2;	/* cycle on/off twice per second */
			return 2;	/* cycle on/off twice per second */


@@ -1902,6 +1934,7 @@ static int e1000_set_phys_id(struct net_device *netdev,
			e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0);
			e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0);
		hw->mac.ops.led_off(hw);
		hw->mac.ops.led_off(hw);
		hw->mac.ops.cleanup_led(hw);
		hw->mac.ops.cleanup_led(hw);
		pm_runtime_put_sync(netdev->dev.parent);
		break;
		break;


	case ETHTOOL_ID_ON:
	case ETHTOOL_ID_ON:
@@ -1912,6 +1945,7 @@ static int e1000_set_phys_id(struct net_device *netdev,
		hw->mac.ops.led_off(hw);
		hw->mac.ops.led_off(hw);
		break;
		break;
	}
	}

	return 0;
	return 0;
}
}


@@ -1950,11 +1984,15 @@ static int e1000_set_coalesce(struct net_device *netdev,
		adapter->itr_setting = adapter->itr & ~3;
		adapter->itr_setting = adapter->itr & ~3;
	}
	}


	pm_runtime_get_sync(netdev->dev.parent);

	if (adapter->itr_setting != 0)
	if (adapter->itr_setting != 0)
		e1000e_write_itr(adapter, adapter->itr);
		e1000e_write_itr(adapter, adapter->itr);
	else
	else
		e1000e_write_itr(adapter, 0);
		e1000e_write_itr(adapter, 0);


	pm_runtime_put_sync(netdev->dev.parent);

	return 0;
	return 0;
}
}


@@ -1968,7 +2006,9 @@ static int e1000_nway_reset(struct net_device *netdev)
	if (!adapter->hw.mac.autoneg)
	if (!adapter->hw.mac.autoneg)
		return -EINVAL;
		return -EINVAL;


	pm_runtime_get_sync(netdev->dev.parent);
	e1000e_reinit_locked(adapter);
	e1000e_reinit_locked(adapter);
	pm_runtime_put_sync(netdev->dev.parent);


	return 0;
	return 0;
}
}
@@ -1982,7 +2022,12 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
	int i;
	int i;
	char *p = NULL;
	char *p = NULL;


	pm_runtime_get_sync(netdev->dev.parent);

	e1000e_get_stats64(netdev, &net_stats);
	e1000e_get_stats64(netdev, &net_stats);

	pm_runtime_put_sync(netdev->dev.parent);

	for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
	for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
		switch (e1000_gstrings_stats[i].type) {
		switch (e1000_gstrings_stats[i].type) {
		case NETDEV_STATS:
		case NETDEV_STATS:
@@ -2033,7 +2078,11 @@ static int e1000_get_rxnfc(struct net_device *netdev,
	case ETHTOOL_GRXFH: {
	case ETHTOOL_GRXFH: {
		struct e1000_adapter *adapter = netdev_priv(netdev);
		struct e1000_adapter *adapter = netdev_priv(netdev);
		struct e1000_hw *hw = &adapter->hw;
		struct e1000_hw *hw = &adapter->hw;
		u32 mrqc = er32(MRQC);
		u32 mrqc;

		pm_runtime_get_sync(netdev->dev.parent);
		mrqc = er32(MRQC);
		pm_runtime_put_sync(netdev->dev.parent);


		if (!(mrqc & E1000_MRQC_RSS_FIELD_MASK))
		if (!(mrqc & E1000_MRQC_RSS_FIELD_MASK))
			return 0;
			return 0;
@@ -2096,9 +2145,13 @@ static int e1000e_get_eee(struct net_device *netdev, struct ethtool_eee *edata)
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
	}
	}


	pm_runtime_get_sync(netdev->dev.parent);

	ret_val = hw->phy.ops.acquire(hw);
	ret_val = hw->phy.ops.acquire(hw);
	if (ret_val)
	if (ret_val) {
		pm_runtime_put_sync(netdev->dev.parent);
		return -EBUSY;
		return -EBUSY;
	}


	/* EEE Capability */
	/* EEE Capability */
	ret_val = e1000_read_emi_reg_locked(hw, cap_addr, &phy_data);
	ret_val = e1000_read_emi_reg_locked(hw, cap_addr, &phy_data);
@@ -2117,14 +2170,11 @@ static int e1000e_get_eee(struct net_device *netdev, struct ethtool_eee *edata)


	/* EEE PCS Status */
	/* EEE PCS Status */
	ret_val = e1000_read_emi_reg_locked(hw, pcs_stat_addr, &phy_data);
	ret_val = e1000_read_emi_reg_locked(hw, pcs_stat_addr, &phy_data);
	if (ret_val)
		goto release;
	if (hw->phy.type == e1000_phy_82579)
	if (hw->phy.type == e1000_phy_82579)
		phy_data <<= 8;
		phy_data <<= 8;


release:
	hw->phy.ops.release(hw);
	if (ret_val)
		return -ENODATA;

	/* Result of the EEE auto negotiation - there is no register that
	/* Result of the EEE auto negotiation - there is no register that
	 * has the status of the EEE negotiation so do a best-guess based
	 * has the status of the EEE negotiation so do a best-guess based
	 * on whether Tx or Rx LPI indications have been received.
	 * on whether Tx or Rx LPI indications have been received.
@@ -2136,7 +2186,14 @@ release:
	edata->tx_lpi_enabled = true;
	edata->tx_lpi_enabled = true;
	edata->tx_lpi_timer = er32(LPIC) >> E1000_LPIC_LPIET_SHIFT;
	edata->tx_lpi_timer = er32(LPIC) >> E1000_LPIC_LPIET_SHIFT;


	return 0;
release:
	hw->phy.ops.release(hw);
	if (ret_val)
		ret_val = -ENODATA;

	pm_runtime_put_sync(netdev->dev.parent);

	return ret_val;
}
}


static int e1000e_set_eee(struct net_device *netdev, struct ethtool_eee *edata)
static int e1000e_set_eee(struct net_device *netdev, struct ethtool_eee *edata)
@@ -2169,12 +2226,16 @@ static int e1000e_set_eee(struct net_device *netdev, struct ethtool_eee *edata)


	hw->dev_spec.ich8lan.eee_disable = !edata->eee_enabled;
	hw->dev_spec.ich8lan.eee_disable = !edata->eee_enabled;


	pm_runtime_get_sync(netdev->dev.parent);

	/* reset the link */
	/* reset the link */
	if (netif_running(netdev))
	if (netif_running(netdev))
		e1000e_reinit_locked(adapter);
		e1000e_reinit_locked(adapter);
	else
	else
		e1000e_reset(adapter);
		e1000e_reset(adapter);


	pm_runtime_put_sync(netdev->dev.parent);

	return 0;
	return 0;
}
}


@@ -2212,19 +2273,7 @@ static int e1000e_get_ts_info(struct net_device *netdev,
	return 0;
	return 0;
}
}


static int e1000e_ethtool_begin(struct net_device *netdev)
{
	return pm_runtime_get_sync(netdev->dev.parent);
}

static void e1000e_ethtool_complete(struct net_device *netdev)
{
	pm_runtime_put_sync(netdev->dev.parent);
}

static const struct ethtool_ops e1000_ethtool_ops = {
static const struct ethtool_ops e1000_ethtool_ops = {
	.begin			= e1000e_ethtool_begin,
	.complete		= e1000e_ethtool_complete,
	.get_settings		= e1000_get_settings,
	.get_settings		= e1000_get_settings,
	.set_settings		= e1000_set_settings,
	.set_settings		= e1000_set_settings,
	.get_drvinfo		= e1000_get_drvinfo,
	.get_drvinfo		= e1000_get_drvinfo,
+9 −1
Original line number Original line Diff line number Diff line
@@ -90,6 +90,10 @@ struct e1000_hw;
#define E1000_DEV_ID_PCH_LPT_I217_V		0x153B
#define E1000_DEV_ID_PCH_LPT_I217_V		0x153B
#define E1000_DEV_ID_PCH_LPTLP_I218_LM		0x155A
#define E1000_DEV_ID_PCH_LPTLP_I218_LM		0x155A
#define E1000_DEV_ID_PCH_LPTLP_I218_V		0x1559
#define E1000_DEV_ID_PCH_LPTLP_I218_V		0x1559
#define E1000_DEV_ID_PCH_I218_LM2		0x15A0
#define E1000_DEV_ID_PCH_I218_V2		0x15A1
#define E1000_DEV_ID_PCH_I218_LM3		0x15A2	/* Wildcat Point PCH */
#define E1000_DEV_ID_PCH_I218_V3		0x15A3	/* Wildcat Point PCH */


#define E1000_REVISION_4	4
#define E1000_REVISION_4	4


@@ -227,6 +231,9 @@ union e1000_rx_desc_extended {
};
};


#define MAX_PS_BUFFERS 4
#define MAX_PS_BUFFERS 4

/* Number of packet split data buffers (not including the header buffer) */
#define PS_PAGE_BUFFERS			(MAX_PS_BUFFERS - 1)
/* Receive Descriptor - Packet Split */
/* Receive Descriptor - Packet Split */
union e1000_rx_desc_packet_split {
union e1000_rx_desc_packet_split {
	struct {
	struct {
@@ -251,7 +258,8 @@ union e1000_rx_desc_packet_split {
		} middle;
		} middle;
		struct {
		struct {
			__le16 header_status;
			__le16 header_status;
			__le16 length[3];	/* length of buffers 1-3 */
			/* length of buffers 1-3 */
			__le16 length[PS_PAGE_BUFFERS];
		} upper;
		} upper;
		__le64 reserved;
		__le64 reserved;
	} wb; /* writeback */
	} wb; /* writeback */
Loading