From owner-freebsd-bugs@FreeBSD.ORG Wed Oct 30 21:00:02 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EEFE77C8 for ; Wed, 30 Oct 2013 21:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C2290231C for ; Wed, 30 Oct 2013 21:00:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r9UL0289004075 for ; Wed, 30 Oct 2013 21:00:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r9UL02uN004072; Wed, 30 Oct 2013 21:00:02 GMT (envelope-from gnats) Date: Wed, 30 Oct 2013 21:00:02 GMT Message-Id: <201310302100.r9UL02uN004072@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Adam McDougall Subject: Re: kern/183139: ifconfig options on xn0 lost after xen vm migration to another server X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Adam McDougall List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2013 21:00:03 -0000 The following reply was made to PR kern/183139; it has been noted by GNATS. From: Adam McDougall To: Roger Pau =?iso-8859-1?Q?Monn=E9?= Cc: bug-followup@FreeBSD.org Subject: Re: kern/183139: ifconfig options on xn0 lost after xen vm migration to another server Date: Wed, 30 Oct 2013 16:58:28 -0400 Thanks, this works! On Tue, Oct 29, 2013 at 10:42:55AM +0100, Roger Pau Monné wrote: On 28/10/13 22:28, Adam McDougall wrote: > So far, it almost works as I expect. It seems to work as long as at > least one option is left (example: options=400) but if I have none, > they all come back on migrate. Thanks. Yes, the "resume" condition is not triggered if there isn't any feature enabled. I've updated the patch, now it should work as expected: --- diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index f9c72e6..52d8c11 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -287,6 +287,8 @@ struct netfront_info { multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1]; mmu_update_t rx_mmu[NET_RX_RING_SIZE]; struct ifmedia sc_media; + + bool xn_resume; }; #define rx_mbufs xn_cdata.xn_rx_chain @@ -502,6 +504,7 @@ netfront_resume(device_t dev) { struct netfront_info *info = device_get_softc(dev); + info->xn_resume = true; netif_disconnect_backend(info); return (0); } @@ -2024,13 +2027,28 @@ xn_configure_features(struct netfront_info *np) int err; err = 0; + + if (!np->xn_resume || + ((np->xn_ifp->if_capenable & np->xn_ifp->if_capabilities) + != np->xn_ifp->if_capenable)) { + /* + * Check if current enabled capabilities are available, + * if not switch to default capabilities. + */ #if __FreeBSD_version >= 700000 - if ((np->xn_ifp->if_capenable & IFCAP_LRO) != 0) - tcp_lro_free(&np->xn_lro); + if ((np->xn_ifp->if_capenable & IFCAP_LRO) != 0) + tcp_lro_free(&np->xn_lro); #endif - np->xn_ifp->if_capenable = - np->xn_ifp->if_capabilities & ~(IFCAP_LRO|IFCAP_TSO4); - np->xn_ifp->if_hwassist &= ~CSUM_TSO; + np->xn_ifp->if_capenable = + np->xn_ifp->if_capabilities & ~(IFCAP_LRO|IFCAP_TSO4); + np->xn_ifp->if_hwassist &= ~CSUM_TSO; + } else { + /* + * What we have currently enabled is supported by the + * new host, no need to change anything. + */ + return 0; + } #if __FreeBSD_version >= 700000 if (xn_enable_lro && (np->xn_ifp->if_capabilities & IFCAP_LRO) != 0) { err = tcp_lro_init(&np->xn_lro);