re(4) driver dropping packets when reading NFS files

Pyun YongHyeon pyunyh at gmail.com
Sat Nov 6 02:40:56 UTC 2010


On Fri, Nov 05, 2010 at 07:33:45PM -0700, Pyun YongHyeon wrote:

[...]

> 
> If this theory is correct, the attached patch may mitigate the
> issue.
> 

Oops, I incorrectly used old code.
Please use this one.
-------------- next part --------------
Index: sys/pci/if_rlreg.h
===================================================================
--- sys/pci/if_rlreg.h	(revision 214844)
+++ sys/pci/if_rlreg.h	(working copy)
@@ -873,9 +873,7 @@
 	int			rl_twist_row;
 	int			rl_twist_col;
 	int			suspended;	/* 0 = normal  1 = suspended */
-#ifdef DEVICE_POLLING
 	int			rxcycles;
-#endif
 
 	struct task		rl_txtask;
 	struct task		rl_inttask;
Index: sys/dev/re/if_re.c
===================================================================
--- sys/dev/re/if_re.c	(revision 214844)
+++ sys/dev/re/if_re.c	(working copy)
@@ -1860,7 +1860,7 @@
 	int			i, total_len;
 	struct rl_desc		*cur_rx;
 	u_int32_t		rxstat, rxvlan;
-	int			maxpkt = 16, rx_npkts = 0;
+	int			rx_npkts = 0;
 
 	RL_LOCK_ASSERT(sc);
 
@@ -1872,7 +1872,7 @@
 	    sc->rl_ldata.rl_rx_list_map,
 	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
-	for (i = sc->rl_ldata.rl_rx_prodidx; maxpkt > 0;
+	for (i = sc->rl_ldata.rl_rx_prodidx; sc->rxcycles > 0;
 	    i = RL_RX_DESC_NXT(sc, i)) {
 		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 			break;
@@ -2036,7 +2036,7 @@
 				}
 			}
 		}
-		maxpkt--;
+		sc->rxcycles--;
 		if (rxvlan & RL_RDESC_VLANCTL_TAG) {
 			m->m_pkthdr.ether_vtag =
 			    bswap16((rxvlan & RL_RDESC_VLANCTL_DATA));
@@ -2058,10 +2058,10 @@
 
 	if (rx_npktsp != NULL)
 		*rx_npktsp = rx_npkts;
-	if (maxpkt)
-		return (EAGAIN);
+	if (sc->rxcycles)
+		return (0);
 
-	return (0);
+	return (EAGAIN);
 }
 
 static void
@@ -2258,8 +2258,11 @@
 	}
 #endif
 
-	if (status & (RL_ISR_RX_OK|RL_ISR_RX_ERR|RL_ISR_FIFO_OFLOW))
+	if (status & (RL_ISR_RX_OK | RL_ISR_RX_ERR | RL_ISR_FIFO_OFLOW |
+	    RL_ISR_RX_OVERRUN)) {
+		sc->rxcycles = sc->rl_ldata.rl_rx_desc_cnt / 2;
 		rval = re_rxeof(sc, NULL);
+	}
 
 	/*
 	 * Some chips will ignore a second TX request issued


More information about the freebsd-current mailing list