summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2009-05-27 06:04:38 +0000
committeradrian <adrian@FreeBSD.org>2009-05-27 06:04:38 +0000
commitb0f73e19e78a585651be0ca62936bafb513d974e (patch)
tree1819cf872d82d2963653415e8ba42c9b70d639eb /sys
parent5923b72e4e270ad6b67b102c97e1cf3e7b947a28 (diff)
downloadFreeBSD-src-b0f73e19e78a585651be0ca62936bafb513d974e.zip
FreeBSD-src-b0f73e19e78a585651be0ca62936bafb513d974e.tar.gz
Enforce that there are actually enough xenbus TX ring descriptors available
before attempting to queue the packet.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/xen/netfront/netfront.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c
index 58e0d90..3498e5d 100644
--- a/sys/dev/xen/netfront/netfront.c
+++ b/sys/dev/xen/netfront/netfront.c
@@ -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
OpenPOWER on IntegriCloud