Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Feb 2011 14:48:59 -0800
From:      Jack Vogel <jfvogel@gmail.com>
To:        Karim Fodil-Lemelin <fodillemlinkarim@gmail.com>, Pyun YongHyeon <pyunyh@gmail.com>,  Michael Tuexen <tuexen@freebsd.org>, beezarliu <beezarliu@yahoo.com.cn>
Cc:        freebsd-net@freebsd.org
Subject:   Re: igb driver RX (was TX) hangs when out of mbuf clusters
Message-ID:  <AANLkTin5DZBnr_VcXRyUmpcH2Gsr3GuaW4EsBtKJ6omd@mail.gmail.com>
In-Reply-To: <AANLkTikMuFRY=W0%2BVtGKdWkJcOFVbdy=OOZNe_xFUC3R@mail.gmail.com>
References:  <AANLkTikrjkHDaBq%2Bx6MTZhzOeqWA=xtFpqQPsthFGmuf@mail.gmail.com> <D70A2DA6-23B7-442D-856C-4267359D66A5@lurchi.franken.de> <AANLkTinLg6QZz67e3Hhda-bzTX69XWNcdEkr3EZHFmSZ@mail.gmail.com> <AANLkTikMuFRY=W0%2BVtGKdWkJcOFVbdy=OOZNe_xFUC3R@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
I have been following this, and thinking about it. I still am working from a
theoretical
standpoint, but based on a patch I got quite a long time back and never
quite groked,
I believe now that I might have a solution.

The original PR and patch was kern/150516 from Beezar Liu,  I was never
quite comfortable
with the code changes, nor convinced that it was a real issue and not a
misunderstanding.
However I think now that this very report might be behind what we are seeing
today. I have
a slightly different approach to solving it, of course it remains to be seen
if it handles it
properly.

Please try the patch I've attached, I'm open to further correction or
polishing of the
changes. And thanks to Beezar for his original report and changes, this is
not for em,
but if this eliminates the problem its clearly needed in all drivers.

Jack

[-- Attachment #2 --]
ProxyChains-3.1 (http://proxychains.sf.net)
Index: if_igb.c
===================================================================
--- if_igb.c	(revision 218463)
+++ if_igb.c	(working copy)
@@ -4312,6 +4312,7 @@
 		struct mbuf		*sendmp, *mh, *mp;
 		struct igb_rx_buf	*rxbuf;
 		u16			hlen, plen, hdr, vtag;
+		int			commit;
 		bool			eop = FALSE;
  
 		cur = &rxr->rx_base[i];
@@ -4440,10 +4441,22 @@
 		bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
 		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
+		commit = i;	/* capture the old index */
+
 		/* Advance our pointers to the next descriptor. */
 		if (++i == adapter->num_rx_desc)
 			i = 0;
 		/*
+		** Sanity test for ring full, if this
+		** happens we need to refresh immediately
+		** or refresh may deadlock.
+		*/
+		if (i == rxr->next_to_refresh) {
+			igb_refresh_mbufs(rxr, commit);
+			processed = 0;
+		}
+
+		/*
 		** Send to the stack or LRO
 		*/
 		if (sendmp != NULL) {

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTin5DZBnr_VcXRyUmpcH2Gsr3GuaW4EsBtKJ6omd>