Skip to contentSkip to conversation

e1000e: Return 1 instead of a non-zero value for link up indication

PATCH In review Jeff Kirsher 2 participants 8 messages Aug 9, 2008 – Aug 14, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 e1000e: Return 1 instead of a non-zero value for link up indication

From: Bruce Allan <[email protected]>

A number of users have mentioned they have tools that rely on a link-up indication having a return value of 1 rather than a non-zero value.

---

 drivers/net/e1000e/ethtool.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000e/ethtool.c +1 -1
index cf9679f..e21c9e0 100644
@@ -177,7 +177,7 @@ static u32 e1000_get_link(struct net_device *netdev)
 	u32 status;
 	
 	status = er32(STATUS);
-	return (status & E1000_STATUS_LU);
+	return (status & E1000_STATUS_LU) ? 1 : 0;
 }
 
 static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
#1 lore raw

PATCH 2/7 e1000e: Set InterruptThrottleRate to default when invalid value used

From: Bruce Allan <[email protected]>

During module load, seting the InterruptThrottleRate parameter to an invalid value would result in the itr/itr_setting pair being set to unexpected values which would result in poor performance.

---

 drivers/net/e1000e/param.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)
drivers/net/e1000e/param.c +19 -4
index 8effc31..b0499f2 100644
@@ -327,11 +327,26 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
 				e1000_validate_option(&adapter->itr, &opt,
 					adapter);
 				/*
-				 * save the setting, because the dynamic bits
-				 * change itr. clear the lower two bits
-				 * because they are used as control
+				 * Save the setting, because the dynamic bits
+				 * change itr.
 				 */
-				adapter->itr_setting = adapter->itr & ~3;
+				if (e1000_validate_option(&adapter->itr, &opt,
+							  adapter) &&
+				    (adapter->itr == 3)) {
+					/*
+					 * In case of invalid user value,
+					 * default to conservative mode.
+					 */
+					adapter->itr_setting = adapter->itr;
+					adapter->itr = 20000;
+				} else {
+					/*
+					 * Clear the lower two bits because
+					 * they are used as control.
+					 */
+					adapter->itr_setting =
+						adapter->itr & ~3;
+				}
 				break;
 			}
 		} else {
#2 lore raw

PATCH 3/7 e1000e: Use skb_copy_to_linear_data_offset introduced in 2.6.22

In reply to Jeff Kirsher

From: Bruce Allan <[email protected]>

The e1000e driver was based on a version of e1000 prior to acme's introduction of skb_copy_to_linear_data_offset, and was submitted after acme went through and coverted all the drivers to use it.

---

 drivers/net/e1000e/netdev.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/e1000e/netdev.c +6 -3
index 05b0b2f..efa9445 100644
@@ -510,9 +510,12 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 			    netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
 			if (new_skb) {
 				skb_reserve(new_skb, NET_IP_ALIGN);
-				memcpy(new_skb->data - NET_IP_ALIGN,
-				       skb->data - NET_IP_ALIGN,
-				       length + NET_IP_ALIGN);
+				skb_copy_to_linear_data_offset(new_skb,
+							       -NET_IP_ALIGN,
+							       (skb->data -
+								NET_IP_ALIGN),
+							       (length +
+								NET_IP_ALIGN));
 				/* save the skb in buffer_info as good */
 				buffer_info->skb = skb;
 				skb = new_skb;
#3 lore raw

PATCH 4/7 e1000e: Increase Tx timeout factor for 10Mbps

In reply to Jeff Kirsher

From: Bruce Allan <[email protected]>

Prevent Tx hangs from happening on 10Mb flood ping by increasing the timeout factor.

---

 drivers/net/e1000e/netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000e/netdev.c +1 -1
index efa9445..4573c7b 100644
@@ -3058,7 +3058,7 @@ static void e1000_watchdog_task(struct work_struct *work)
 			case SPEED_10:
 				txb2b = 0;
 				netdev->tx_queue_len = 10;
-				adapter->tx_timeout_factor = 14;
+				adapter->tx_timeout_factor = 16;
 				break;
 			case SPEED_100:
 				txb2b = 0;
#4 lore raw

PATCH 5/7 e1000e: increase minimum frame size allowed

In reply to Jeff Kirsher

From: Bruce Allan <[email protected]>

Setting an MTU value below 68 was disabling the network connection and would not reconnect until the driver was reloaded. Prevent changing the MTU to anything below 68.

---

 drivers/net/e1000e/netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000e/netdev.c +1 -1
index 4573c7b..b8b26cf 100644
@@ -3724,7 +3724,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
 
-	if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
+	if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) ||
 	    (max_frame > MAX_JUMBO_FRAME_SIZE)) {
 		e_err("Invalid MTU setting\n");
 		return -EINVAL;
#5 lore raw

PATCH 6/7 e1000e: test for unusable MSI support

In reply to Jeff Kirsher

From: Bruce Allan <[email protected]>

Some systems do not like 82571/2 use of 16-bit MSI messages and some other systems claim to support MSI, but neither really works. Setup a test MSI handler to detect whether or not MSI is working properly, and if not, fallback to legacy INTx interrupts.

---

 drivers/net/e1000e/defines.h |    2 
 drivers/net/e1000e/e1000.h   |    1 
 drivers/net/e1000e/netdev.c  |  172 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 164 insertions(+), 11 deletions(-)
drivers/net/e1000e/defines.h +1 -1
index f823b8b..14b0e6c 100644
@@ -389,7 +389,7 @@
 
 /* Interrupt Cause Set */
 #define E1000_ICS_LSC       E1000_ICR_LSC       /* Link Status Change */
-#define E1000_ICS_RXDMT0    E1000_ICR_RXDMT0    /* rx desc min. threshold */
+#define E1000_ICS_RXSEQ     E1000_ICR_RXSEQ     /* Rx sequence error */
 #define E1000_ICS_RXDMT0    E1000_ICR_RXDMT0    /* Rx desc min. threshold */
 
 /* Transmit Descriptor Control */
drivers/net/e1000e/e1000.h +1 -0
index cf57050..ac4e506 100644
@@ -326,6 +326,7 @@ struct e1000_info {
 #define FLAG_RX_CSUM_ENABLED              (1 << 28)
 #define FLAG_TSO_FORCE                    (1 << 29)
 #define FLAG_RX_RESTART_NOW               (1 << 30)
+#define FLAG_MSI_TEST_FAILED              (1 << 31)
 
 #define E1000_RX_DESC_PS(R, i)	    \
 	(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
drivers/net/e1000e/netdev.c +162 -10

200 lines not on this page · raw message

#6 lore raw

PATCH 7/7 e1000e: remove unnecessary snippet missed in prior check_options update

In reply to Jeff Kirsher

From: Bruce Allan <[email protected]>

The removal of this bit of code was missed in an earlier patch submittal.

---

 drivers/net/e1000e/param.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/net/e1000e/param.c +0 -2
index b0499f2..ed912e0 100644
@@ -324,8 +324,6 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
 				adapter->itr = 20000;
 				break;
 			default:
-				e1000_validate_option(&adapter->itr, &opt,
-					adapter);
 				/*
 				 * Save the setting, because the dynamic bits
 				 * change itr.
#7 lore raw
In reply to Jeff Kirsher
Quoted 17 lines · Jeff Kirsher

From: Bruce Allan <[email protected]>

A number of users have mentioned they have tools that rely on a link-up indication having a return value of 1 rather than a non-zero value.

---

 drivers/net/e1000e/ethtool.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000e/ethtool.c +0 -0
index cf9679f..e21c9e0 100644

drivers/net/e1000e/ethtool.c static u32 e1000_get_link(struct net_device *netdev) · line 180

Quoted 5 lines
drivers/net/e1000e/ethtool.c +1 -1
@@ -177,7 +177,7 @@ static u32 e1000_get_link(struct net_device *netdev)
 	u32 status;
 
 	status = er32(STATUS);
-	return (status & E1000_STATUS_LU);
+	return (status & E1000_STATUS_LU) ? 1 : 0;

applied 1-7