Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2009 06:04:38 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192876 - head/sys/dev/xen/netfront
Message-ID:  <200905270604.n4R64cRR085519@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Wed May 27 06:04:38 2009
New Revision: 192876
URL: http://svn.freebsd.org/changeset/base/192876

Log:
  Enforce that there are actually enough xenbus TX ring descriptors available
  before attempting to queue the packet.

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- head/sys/dev/xen/netfront/netfront.c	Wed May 27 05:37:04 2009	(r192875)
+++ head/sys/dev/xen/netfront/netfront.c	Wed May 27 06:04:38 2009	(r192876)
@@ -1478,10 +1478,20 @@ xn_start_locked(struct ifnet *ifp) 
 		}
 
 		/*
-		 * XXX TODO - make sure there's actually space available
-		 *  in the Xen TX ring for this rather than the hacky way
-		 * its currently done.
+		 * Make sure there's actually space available in the
+		 * Xen TX ring for this. Overcompensate for the possibility
+		 * of having a TCP offload fragment just in case for now
+		 * (the +1) rather than adding logic to accurately calculate
+		 * the required size.
 		 */
+		if (RING_FREE_REQUESTS(&sc->tx) < (nfrags + 1)) {
+			printf("xn_start_locked: free ring slots (%d) < (nfrags + 1) (%d); must be full!\n",
+			    (int) RING_FREE_REQUESTS(&sc->tx),
+			    (int) (nfrags + 1));
+			IF_PREPEND(&ifp->if_snd, m_head);
+			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+			break;
+		}
 
 		/*
 		 * Start packing the mbufs in this chain into



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