From owner-freebsd-xen@FreeBSD.ORG Tue Sep 6 11:29:28 2011 Return-Path: Delivered-To: freebsd-xen@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3C74106564A for ; Tue, 6 Sep 2011 11:29:28 +0000 (UTC) (envelope-from hugo@barafranca.com) Received: from mail.barafranca.com (mail.barafranca.com [67.213.67.47]) by mx1.freebsd.org (Postfix) with ESMTP id 9E2BB8FC08 for ; Tue, 6 Sep 2011 11:29:28 +0000 (UTC) Received: from localhost (unknown [172.16.100.24]) by mail.barafranca.com (Postfix) with ESMTP id A263F45B; Tue, 6 Sep 2011 11:29:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at barafranca.com Received: from mail.barafranca.com ([172.16.100.24]) by localhost (mail.barafranca.com [172.16.100.24]) (amavisd-new, port 10024) with ESMTP id dZI-vt7u8uKj; Tue, 6 Sep 2011 11:28:46 +0000 (UTC) Received: from [192.168.1.1] (static-b4-252-232.telepac.pt [81.193.252.232]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.barafranca.com (Postfix) with ESMTPSA id 9F22A454; Tue, 6 Sep 2011 11:28:45 +0000 (UTC) Message-ID: <4E6603F1.3050509@barafranca.com> Date: Tue, 06 Sep 2011 12:28:49 +0100 From: Hugo Silva User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: "Ben C." References: <4E3AE57D.3050600@barafranca.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------060606000700070501080209" Cc: freebsd-xen@freebsd.org Subject: Re: 9.0-BETA1: PV network still won't work with NetBSD dom0 [FIXED] X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 11:29:29 -0000 This is a multi-part message in MIME format. --------------060606000700070501080209 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 08/27/11 18:46, Ben C. wrote: > Hello, > > Yes indeed. I've verified on 8.2 and BETA1. Seemingly exact same > issue. Running a NetBSD(-CURRENT) dom0. Happy to see progress but > it's not quite there yet I guess. > > I've tried changing the model= line around and some other random, > brute-force like tweaks but nothing seems to work. I can ping > internal and external hosts, but just can't seem to carry on a regular > TCP/IP conversation. > > I also found this : > http://www.mail-archive.com/freebsd-xen@freebsd.org/msg00516.html > > Where someone running a Debian Lenny dom0 was experiencing almost the > exact same issues I have. > > FreeBSD (or, any OS) has pretty poor performance running under full > HVM .. PV drivers only work for i386 and I wouldn't be surprised if I > experienced the same issues. (No time to test really..) > > Does anyone else have any input on this? > > Thanks, Ben C. Hello Ben, Someone (I don't recall who, cleared my INBOX and then read this mail..) sent me a patch about 2 weeks ago which solved the issue for me. If you [reader]'re the one who wrote the patch, once again my thanks, you made it possible for me to complete the project I was working on. I'm not sure if this has been committed in the mean time, so here's the reminder to do so before 9.0-RELEASE, in case this one got lost! Keep up the good work! Regards, Hugo --------------060606000700070501080209 Content-Type: text/plain; name="netfront.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="netfront.diff" -- sys/dev/xen/netfront/netfront.c.orig 2011-08-09 17:48:50.188600897 +0400 +++ sys/dev/xen/netfront/netfront.c 2011-08-09 17:52:47.289424716 +0400 @@ -261,6 +261,7 @@ u_int irq; u_int copying_receiver; u_int carrier; + u_int sg_allowed; /* Receive-ring batched refills. */ #define RX_MIN_TARGET 32 @@ -1494,7 +1495,7 @@ * deal with nfrags > MAX_TX_REQ_FRAGS, which is a quirk of * the Linux network stack. */ - if (nfrags > MAX_TX_REQ_FRAGS) { + if (nfrags > (sc->sg_allowed? MAX_TX_REQ_FRAGS : 1)) { m = m_defrag(m_head, M_DONTWAIT); if (!m) { /* @@ -1879,6 +1880,39 @@ if_link_state_change(ifp, LINK_STATE_DOWN); } +static void +xennet_set_features(device_t dev, struct netfront_info *np) +{ + struct ifnet *ifp; + int val; + + device_printf(dev, "backend features:"); + + if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev), + "feature-sg", NULL, "%d", &val) < 0) + val = 0; + + np->sg_allowed = val; + + if (val) + printf(" feature-sg"); + + if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev), + "feature-gso-tcpv4", NULL, "%d", &val) < 0) + val = 0; + + if (val == 0) { + ifp = np->xn_ifp; + ifp->if_capabilities &= ~(IFCAP_TSO4|IFCAP_LRO); + ifp->if_capenable &= ~(IFCAP_TSO4|IFCAP_LRO); + ifp->if_hwassist &= ~(CSUM_TSO); + xn_enable_lro = 0; + } else + printf(" feature-gso-tcp4"); + + printf("\n"); +} + /* START of Xenolinux helper functions adapted to FreeBSD */ int network_connect(struct netfront_info *np) @@ -1910,6 +1944,8 @@ if (error) return (error); + xennet_set_features(np->xbdev, np); + /* Step 1: Reinitialise variables. */ netif_release_tx_bufs(np); --------------060606000700070501080209--