Skip to contentSkip to conversation

ixgbevf: Fix signed/unsigned int error

PATCH Applied Jeff Kirsher 3 participants 7 messages Mar 24, 2010 – Mar 26, 2010

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

PATCH 1/3 ixgbevf: Fix signed/unsigned int error

From: Greg Rose <[email protected]>

In the Tx mapping function if a DMA error occurred then the unwind of previously mapped sections would improperly check an unsigned int if it was less than zero. Changed the index variable to signed to avoid the error.

---

 drivers/net/ixgbevf/ixgbevf_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/ixgbevf/ixgbevf_main.c +2 -1
index 9aaebd3..55f74b3 100644
@@ -2921,9 +2921,10 @@ static int ixgbevf_tx_map(struct ixgbevf_adapter *adapter,
 	struct ixgbevf_tx_buffer *tx_buffer_info;
 	unsigned int len;
 	unsigned int total = skb->len;
-	unsigned int offset = 0, size, count = 0, i;
+	unsigned int offset = 0, size, count = 0;
 	unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
 	unsigned int f;
+	int i;
 
 	i = tx_ring->next_to_use;
 
#1 lore raw

PATCH 2/3 ixgbe: In SR-IOV mode insert delay before bring the adapter up

From: Greg Rose <[email protected]>

VFs running in guest VMs do not respond in as timely a manner to PF indication it is going down as they do when running in the host domain. If the adapter is in SR-IOV mode insert a two second delay to guarantee that all VFs have had time to respond to the PF reset. In any case resetting the PF while VFs are active should be discouraged but if it must be done then there will be a two second delay to help synchronize resets among the PF and all the VFs.

---

 drivers/net/ixgbe/ixgbe_main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +8 -0
index 90565d8..2f8c348 100644
@@ -3036,6 +3036,14 @@ void ixgbe_reinit_locked(struct ixgbe_adapter *adapter)
 	while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
 		msleep(1);
 	ixgbe_down(adapter);
+	/*
+	 * If SR-IOV enabled then wait a bit before bringing the adapter
+	 * back up to give the VFs time to respond to the reset.  The
+	 * two second wait is based upon the watchdog timer cycle in
+	 * the VF driver.
+	 */
+	if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
+		msleep(2000);
 	ixgbe_up(adapter);
 	clear_bit(__IXGBE_RESETTING, &adapter->state);
 }
maintainer Applied
#2 lore raw

Re: [net-2.6 PATCH 2/3] ixgbe: In SR-IOV mode insert delay before bring the adapter up

From: Jeff Kirsher <[email protected]>
Date: Wed, 24 Mar 2010 12:36:08 -0700

Quoted 11 lines

From: Greg Rose <[email protected]>

VFs running in guest VMs do not respond in as timely a manner to PF indication it is going down as they do when running in the host domain. If the adapter is in SR-IOV mode insert a two second delay to guarantee that all VFs have had time to respond to the PF reset. In any case resetting the PF while VFs are active should be discouraged but if it must be done then there will be a two second delay to help synchronize resets among the PF and all the VFs.

Quoted 2 lines

Applied, but...

I know why you might need to do this, but this is going to completely explode if someone tries to, f.e. bring up thousands of these interfaces.

Maybe that's not practical, but is, say, 30? With a 2 second delay each that's a full minute hanging at the command line or the bootup scripts.

My point is that this behavior is basically extremely undesirable.

#3 lore raw

RE: [net-2.6 PATCH 2/3] ixgbe: In SR-IOV mode insert delay before bring the adapter up

Quoted 11 lines

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Friday, March 26, 2010 11:58 AM
To: Kirsher, Jeffrey T
Cc: [email protected]; [email protected]; Rose, Gregory V
Subject: Re: [net-2.6 PATCH 2/3] ixgbe: In SR-IOV mode insert delay before bring the adapter up

My point is that this behavior is basically extremely undesirable.

No argument from me there. We've been discussing design changes to maintain a little more state in the driver so that we wouldn't have to reset the entire device every time someone makes a minor configuration change. However, I have no target date for that. I agree that at some point in systems with a large number of interfaces this behavior becomes untenable.

- Greg

#4 lore raw

PATCH 3/3 ixgbe: Change where clear_to_send_flag is reset to zero.

In reply to Jeff Kirsher

From: Greg Rose <[email protected]>

The clear_to_send flag is being cleared before the call to ping all the VFs. It should be called after pinging all the VFs.

---

 drivers/net/ixgbe/ixgbe_main.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +5 -3
index 2f8c348..315622f 100644
@@ -3224,13 +3224,15 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
 
 	/* disable receive for all VFs and wait one second */
 	if (adapter->num_vfs) {
-		for (i = 0 ; i < adapter->num_vfs; i++)
-			adapter->vfinfo[i].clear_to_send = 0;
-
 		/* ping all the active vfs to let them know we are going down */
 		ixgbe_ping_all_vfs(adapter);
+
 		/* Disable all VFTE/VFRE TX/RX */
 		ixgbe_disable_tx_rx(adapter);
+
+		/* Mark all the VFs as inactive */
+		for (i = 0 ; i < adapter->num_vfs; i++)
+			adapter->vfinfo[i].clear_to_send = 0;
 	}
 
 	/* disable receives */
maintainer Applied
#6 lore raw
In reply to Jeff Kirsher

From: Jeff Kirsher <[email protected]>
Date: Wed, 24 Mar 2010 12:35:42 -0700

Quoted 9 lines

From: Greg Rose <[email protected]>

In the Tx mapping function if a DMA error occurred then the unwind of previously mapped sections would improperly check an unsigned int if it was less than zero. Changed the index variable to signed to avoid the error.

Applied.