[gPXE git] mainline commit to master: [jme] Fix refill behavior

git at etherboot.org git at etherboot.org
Sun Jun 13 12:27:24 EDT 2010


In the Main gPXE repository, branch master has been updated.
      adds  af585ca [jme] Fix refill behavior
      from  9a4bf25 [eepro100] Add PCI ID for Intel Pro/100 VE

Summary of changes:
 src/drivers/net/jme.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
------
commit af585cadc75e1bd06861af96013f43d14bb11e3c
Author: Guo-Fu Tseng <cooldavid at cooldavid.org>
Date: Fri Jun 4 22:23:15 2010 +0800
Committer: Stefan Hajnoczi <stefanha at gmail.com>

[jme] Fix refill behavior

After changing the driver to refill after feed, if any error occurs a
non-contiguous empty buffer will be introduced in the ring due to my
reuse-buffer-when-error implementation.

Reported-by: Marty Connor <mdc at etherboot.org>
Signed-off-by: Guo-Fu Tseng <cooldavid at cooldavid.org>
Signed-off-by: Stefan Hajnoczi <stefanha at gmail.com>

diff --git a/src/drivers/net/jme.c b/src/drivers/net/jme.c
index 441eb8a..197a91d 100644
--- a/src/drivers/net/jme.c
+++ b/src/drivers/net/jme.c
@@ -590,17 +590,22 @@ jme_disable_rx_engine(struct jme_adapter *jme)
 }
 
 static void
-jme_refill_rx_ring(struct jme_adapter *jme)
+jme_refill_rx_ring(struct jme_adapter *jme, int curhole)
 {
 	struct jme_ring *rxring = &jme->rxring;
 	int i = rxring->next_to_fill;
 	struct io_buffer **bufinf = rxring->bufinf;
 	int mask = jme->rx_ring_mask;
+	int limit = jme->rx_ring_size;
 
-	while (!bufinf[i]) {
-		if (jme_make_new_rx_buf(bufinf + i))
-			break;
-		jme_set_clean_rxdesc(jme, i);
+	while (limit--) {
+		if (!bufinf[i]) {
+			if (jme_make_new_rx_buf(bufinf + i))
+				break;
+			jme_set_clean_rxdesc(jme, i);
+		}
+		if (i == curhole)
+			limit = 0;
 		i = (i + 1) & mask;
 	}
 	rxring->next_to_fill = i;
@@ -622,7 +627,7 @@ jme_alloc_and_feed_iob(struct jme_adapter *jme, int idx)
 	netdev_rx(netdev, rxbi);
 
 	rxring->bufinf[idx] = NULL;
-	jme_refill_rx_ring(jme);
+	jme_refill_rx_ring(jme, idx);
 }
 
 static void
@@ -636,7 +641,8 @@ jme_process_receive(struct jme_adapter *jme)
 
 	i = rxring->next_to_clean;
 	rxdesc += i;
-	while (!(rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_OWN)) &&
+	while (rxring->bufinf[i] &&
+		!(rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_OWN)) &&
 		(rxdesc->descwb.desccnt & RXWBDCNT_WBCPL) &&
 		limit--) {
 
-----------------------------------------------------------------------


-- 
Main gPXE repository


More information about the gPXE-commits mailing list