From owner-svn-src-head@FreeBSD.ORG Wed May 27 06:04:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CBEE106566B; Wed, 27 May 2009 06:04:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BBAF8FC13; Wed, 27 May 2009 06:04:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R64ctf085520; Wed, 27 May 2009 06:04:38 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R64cRR085519; Wed, 27 May 2009 06:04:38 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <200905270604.n4R64cRR085519@svn.freebsd.org> From: Adrian Chadd Date: Wed, 27 May 2009 06:04:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192876 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 06:04:39 -0000 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