Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2390

kernel-2.6.18-238.el5.src.rpm

From: Andy Gospodarek <gospo@redhat.com>
Date: Wed, 27 Oct 2010 19:34:09 -0400
Subject: [net] bnx2: fixup broken NAPI accounting
Message-id: <1288208050-18882-2-git-send-email-gospo@redhat.com>
Patchwork-id: 28957
O-Subject: [RHEL5.6 PATCH 1/2] bnx2: fixup broken NAPI accounting
Bugzilla: 640026
RH-Acked-by: David S. Miller <davem@redhat.com>
RH-Acked-by: Neil Horman <nhorman@redhat.com>
RH-Acked-by: Stefan Assmann <sassmann@redhat.com>

During a backport of the bnx2 driver for RHEL5.3 the NAPI accounting
code was dropped.  This was unintentional and should be added back.


diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 8e99b53..865b525 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3423,11 +3423,17 @@ static int bnx2_poll_msix(struct net_device *dev, int *budget)
 	struct bnx2_napi *bnapi = dev->priv;
 	struct bnx2 *bp = bnapi->bp;
 	int work_done = 0;
+	int work_to_do = min(dev->quota, *budget);
+
 	struct status_block_msix *sblk = bnapi->status_blk.msix;
 
 	while (1) {
-		work_done = bnx2_poll_work(bp, bnapi, work_done, *budget);
-		if (unlikely(work_done >= *budget))
+		work_done = bnx2_poll_work(bp, bnapi, work_done, work_to_do);
+
+		*budget -= work_done;
+		dev->quota -= work_done;
+
+		if (unlikely(work_done >= work_to_do))
 			return 1;
 
 		bnapi->last_status_idx = sblk->status_idx;
@@ -3450,16 +3456,19 @@ static int bnx2_poll(struct net_device *dev, int *budget)
 	struct bnx2_napi *bnapi = dev->priv;
 	struct bnx2 *bp = bnapi->bp;
 	int work_done = 0;
+	int work_to_do = min(dev->quota, *budget);
 	struct status_block *sblk = bnapi->status_blk.msi;
 
 	while (1) {
 		bnx2_poll_link(bp, bnapi);
 
-		work_done = bnx2_poll_work(bp, bnapi, work_done, *budget);
+		work_done = bnx2_poll_work(bp, bnapi, work_done, work_to_do);
 
 #ifdef BCM_CNIC
 		bnx2_poll_cnic(bp, bnapi);
 #endif
+		*budget -= work_done;
+		dev->quota -= work_done;
 
 		/* bnapi->last_status_idx is used below to tell the hw how
 		 * much work has been processed, so we must read it before
@@ -3467,7 +3476,7 @@ static int bnx2_poll(struct net_device *dev, int *budget)
 		 */
 		bnapi->last_status_idx = sblk->status_idx;
 
-		if (unlikely(work_done >= *budget))
+		if (unlikely(work_done >= work_to_do))
 			break;
 
 		rmb();