9.0-BETA1: PV network still won't work with NetBSD dom0 [FIXED]

Hugo Silva hugo at barafranca.com
Tue Sep 6 11:29:29 UTC 2011


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
-------------- next part --------------
-- 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);


More information about the freebsd-xen mailing list