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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to