[PATCH] : In tg3_poll(), resample status_tag after doing work.

Linux Kernel Mailing List <[email protected]> Tue, 24 May 2005 12:48:02 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1555, 2005/05/24 09:48:02-03:00, [email protected]

	[PATCH] : In tg3_poll(), resample status_tag after doing work.
	
	[TG3]: In tg3_poll(), resample status_tag after doing work.
	
	Signed-off-by: David S. Miller <[email protected]>



 tg3.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)


diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c
--- a/drivers/net/tg3.c	2005-05-24 14:06:57 -07:00
+++ b/drivers/net/tg3.c	2005-05-24 14:06:57 -07:00
@@ -2870,9 +2870,6 @@
 
 	spin_lock_irqsave(&tp->lock, flags);
 
-	if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)
-		tp->last_tag = sblk->status_tag;
-
 	/* handle link change and other phy events */
 	if (!(tp->tg3_flags &
 	      (TG3_FLAG_USE_LINKCHG_REG |
@@ -2897,7 +2894,6 @@
 	 * All RX "locking" is done by ensuring outside
 	 * code synchronizes with dev->poll()
 	 */
-	done = 1;
 	if (sblk->idx[0].rx_producer != tp->rx_rcb_ptr) {
 		int orig_budget = *budget;
 		int work_done;
@@ -2909,12 +2905,14 @@
 
 		*budget -= work_done;
 		netdev->quota -= work_done;
-
-		if (work_done >= orig_budget)
-			done = 0;
 	}
 
+	if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)
+		tp->last_tag = sblk->status_tag;
+	rmb();
+
 	/* if no more work, tell net stack and NIC we're done */
+	done = !tg3_has_work(tp);
 	if (done) {
 		spin_lock_irqsave(&tp->lock, flags);
 		__netif_rx_complete(netdev);