Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Sep 2011 12:28:49 +0100
From:      Hugo Silva <hugo@barafranca.com>
To:        "Ben C." <armondbc@gmail.com>
Cc:        freebsd-xen@freebsd.org
Subject:   Re: 9.0-BETA1: PV network still won't work with NetBSD dom0 [FIXED]
Message-ID:  <4E6603F1.3050509@barafranca.com>
In-Reply-To: <CAA5hfhnvrPYR=qAW-1ZErUK4OV27%2BF0y4aS2KXhC%2BV0nN1fJPA@mail.gmail.com>
References:  <4E3AE57D.3050600@barafranca.com> <CAA5hfhnvrPYR=qAW-1ZErUK4OV27%2BF0y4aS2KXhC%2BV0nN1fJPA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



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