From owner-freebsd-xen@FreeBSD.ORG Sun Feb 28 22:00:04 2010 Return-Path: Delivered-To: freebsd-xen@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B547B106564A for ; Sun, 28 Feb 2010 22:00:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 785408FC12 for ; Sun, 28 Feb 2010 22:00:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o1SM04ZO006315 for ; Sun, 28 Feb 2010 22:00:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o1SM049T006314; Sun, 28 Feb 2010 22:00:04 GMT (envelope-from gnats) Date: Sun, 28 Feb 2010 22:00:04 GMT Message-Id: <201002282200.o1SM049T006314@freefall.freebsd.org> To: freebsd-xen@FreeBSD.org From: =?iso-8859-1?Q?Wei=DF=2C_J=FCrgen?= Cc: Subject: Re: kern/143340: [xen] FreeBSD 8-RELEASE XEN pvm networking doesn't work on solaris dom0's X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: =?iso-8859-1?Q?Wei=DF=2C_J=FCrgen?= 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: Sun, 28 Feb 2010 22:00:04 -0000 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?= To: "'bug-followup@FreeBSD.org'" , "'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