Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Feb 2010 22:00:04 GMT
From:      =?iso-8859-1?Q?Wei=DF=2C_J=FCrgen?= <weiss@uni-mainz.de>
To:        freebsd-xen@FreeBSD.org
Subject:   Re: kern/143340: [xen] FreeBSD 8-RELEASE XEN pvm networking doesn't work on solaris dom0's
Message-ID:  <201002282200.o1SM049T006314@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/143340; it has been noted by GNATS.

From: =?iso-8859-1?Q?Wei=DF=2C_J=FCrgen?= <weiss@uni-mainz.de>
To: "'bug-followup@FreeBSD.org'" <bug-followup@FreeBSD.org>,
	"'wonslung@gmail.com'" <wonslung@gmail.com>
Cc:  
Subject: Re: kern/143340: [xen] FreeBSD 8-RELEASE XEN pvm networking doesn't
 work on solaris dom0's
Date: Sun, 28 Feb 2010 22:43:56 +0100

 the current FreeBSD frontend of the xn network driver does not check the ca=
 pabilities
 of the backend driver.=20
 
 The following patch checks the backend features feature-sg (scatter/gather)
 and feature-gso-tcpv4 (segmentation offload) and sets the frontend driver
 capabilities accordingly.=20
 
 There is still the problem with receive and transmit checksum offload.
 I have no idea how to figure out what the backend supports. So
 for opensolaris it seems necessary to disable checksum offload manually by
 
 ifconfig xn0 -txcsum -rxcsum
 
 Maybe it would make sense to change the default for checksum offload
 if the backend does not support feature-sg and/or feature-gso-tcpv4.
 
 --- netfront.c.orig	2009-10-25 02:10:29.000000000 +0100
 +++ netfront.c	2010-02-28 18:08:20.000000000 +0100
 @@ -236,6 +236,7 @@
  	u_int irq;
  	u_int copying_receiver;
  	u_int carrier;
 +	u_int sg_allowed;
  	=09
  	/* Receive-ring batched refills. */
  #define RX_MIN_TARGET 32
 @@ -1432,7 +1433,7 @@
  		 */
  		for (m =3D m_head, nfrags =3D 0; m; m =3D m->m_next)
  			nfrags++;
 -		if (nfrags > MAX_SKB_FRAGS) {
 +		if (nfrags > (sc->sg_allowed ? MAX_SKB_FRAGS : 1)) {
  			m =3D m_defrag(m_head, M_DONTWAIT);
  			if (!m) {
  				m_freem(m_head);
 @@ -1788,6 +1789,35 @@
  	ifp->if_drv_flags &=3D ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
  }
 =20
 +static void xennet_set_features(device_t dev, struct netfront_info *np)
 +{
 +	struct ifnet *ifp;
 +	int val;
 +
 +	device_printf(dev, "backend features:");
 +
 +	if (xenbus_scanf(XBT_NIL, xenbus_get_otherend_path(np->xbdev), "feature-s=
 g", NULL, "%d", &val) < 0)
 +		val =3D 0;
 +=09
 +	np->sg_allowed =3D val;
 +
 +	if (val)
 +		printf(" feature-sg");
 +
 +	if (xenbus_scanf(XBT_NIL, xenbus_get_otherend_path(np->xbdev), "feature-g=
 so-tcpv4", NULL, "%d", &val) < 0)
 +		val =3D 0;
 +
 +	if (val =3D=3D 0) {
 +		ifp =3D np->xn_ifp;
 +		ifp->if_capabilities &=3D ~(IFCAP_TSO4|IFCAP_LRO);
 +		ifp->if_capenable &=3D ~(IFCAP_TSO4|IFCAP_LRO);
 +		ifp->if_hwassist &=3D ~(CSUM_TSO);
 +	} else
 +		printf(" feature-gso-tcp4");
 +
 +	printf("\n");
 +}
 +
  /* START of Xenolinux helper functions adapted to FreeBSD */
  int
  network_connect(struct netfront_info *np)
 @@ -1820,6 +1850,8 @@
  	if (error)=20
  		return (error);
  =09
 +	xennet_set_features(np->xbdev, np);
 +
  	/* Step 1: Reinitialise variables. */
  	netif_release_tx_bufs(np);
 
 
 
 Juergen Weiss      |Universitaet Mainz, Zentrum fuer Datenverarbeitung,
 weiss@uni-mainz.de |55099 Mainz, Tel: +49(6131)39-26361, FAX: +49(6131)39-2=
 6407
 



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