Date: Wed, 27 Nov 2013 10:59:08 -0700 From: "Justin T. Gibbs" <gibbs@scsiguy.com> To: net@FreeBSD.org Cc: =?iso-8859-1?Q?Roger_Pau_Monn=E9?= <royger@FreeBSD.org> Subject: Defaults for if_capenable and detecting user initiated changes Message-ID: <0E13D481-9D6D-4B52-A5AD-B671BF3A85AF@scsiguy.com>
next in thread | raw e-mail | index | archive | help
--Apple-Mail=_BF798988-D40B-4431-80BE-5CDB6B3ADE57 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Hi net, I=92m reviewing a patch from Roger Pau Monn=E9 for the Xen netfront = driver. The goal of the change is to avoid disturbing the user=92s = settings for the interface just because the backend device has changed = or the connection to the backend was reset. I=92ve attached the latest = version of the patch. The current patch leaves the interface settings alone if they can be = supported by the newly attached backend. What would be ideal is to = enable capabilities that default to being enabled if they were not = explicitly disabled by the user and can be supported by the new backend. = Unfortunately, I don=92t think the if_capenable and if_capabilities = fields are descriptive enough to deal with an interface whose = capabilities can change at runtime. Just as can be done with link = speed, some of these settings need to allow an =93auto/default=94 = setting in addition to on or off. This would allow the user to = explicitly disable a capability if needed, but generally allow the = system to chose the most optimal settings when they are supported. = Would this be difficult to add? Thanks, Justin --Apple-Mail=_BF798988-D40B-4431-80BE-5CDB6B3ADE57 Content-Disposition: attachment; filename=0001-xen-netfront-keep-xn-options-on-suspend-resume.patch Content-Type: application/octet-stream; name="0001-xen-netfront-keep-xn-options-on-suspend-resume.patch" Content-Transfer-Encoding: quoted-printable =46rom=20a660c9e9a3903d72c351e0fb7a890132efff6b7d=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Roger=20Pau=20Monne=20<roger.pau@citrix.com>=0A= Date:=20Mon,=2021=20Oct=202013=2016:00:15=20+0100=0ASubject:=20[PATCH]=20= xen-netfront:=20keep=20xn=20options=20on=20suspend/resume=0A=0ASpecific=20= xn=20features=20should=20be=20preserved=20across=20migrations=20when=0A= possible=20(if=20the=20destination=20host=20also=20supports=20them).=20= Previously=20if=0Athe=20user=20disabled=20a=20feature,=20it=20would=20be=20= automatically=20re-enabled=0Aafter=20resume=20if=20the=20destination=20= host=20supports=20it.=0A---=0A=20sys/dev/xen/netfront/netfront.c=20|=20=20= =2032=20++++++++++++++++++++++++++------=0A=201=20files=20changed,=2026=20= insertions(+),=206=20deletions(-)=0A=0Adiff=20--git=20= a/sys/dev/xen/netfront/netfront.c=20b/sys/dev/xen/netfront/netfront.c=0A= index=20c0ad393..f5bce33=20100644=0A---=20= a/sys/dev/xen/netfront/netfront.c=0A+++=20= b/sys/dev/xen/netfront/netfront.c=0A@@=20-287,6=20+287,8=20@@=20struct=20= netfront_info=20{=0A=20=09multicall_entry_t=09= rx_mcl[NET_RX_RING_SIZE+1];=0A=20=09mmu_update_t=09=09= rx_mmu[NET_RX_RING_SIZE];=0A=20=09struct=20ifmedia=09=09sc_media;=0A+=0A= +=09bool=09=09=09xn_cold;=0A=20};=0A=20=0A=20#define=20rx_mbufs=20= xn_cdata.xn_rx_chain=0A@@=20-1963,6=20+1965,7=20@@=20= network_connect(struct=20netfront_info=20*np)=0A=20=09xn_txeof(np);=0A=20= =09XN_TX_UNLOCK(np);=0A=20=09network_alloc_rx_buffers(np);=0A+=09= np->xn_cold=20=3D=20false;=0A=20=0A=20=09return=20(0);=0A=20}=0A@@=20= -2003,13=20+2006,28=20@@=20xn_configure_features(struct=20netfront_info=20= *np)=0A=20=09int=20err;=0A=20=0A=20=09err=20=3D=200;=0A-#if=20= __FreeBSD_version=20>=3D=2070000=20&&=20(defined(INET)=20||=20= defined(INET6))=0A-=09if=20((np->xn_ifp->if_capenable=20&=20IFCAP_LRO)=20= !=3D=200)=0A-=09=09tcp_lro_free(&np->xn_lro);=0A+=0A+=09if=20= (np->xn_cold=20||=0A+=09=20=20=20=20((np->xn_ifp->if_capenable=20&=20= np->xn_ifp->if_capabilities)=0A+=09=20=20=20=20!=3D=20= np->xn_ifp->if_capenable))=20{=0A+=09=09/*=0A+=09=09=20*=20Check=20if=20= current=20enabled=20capabilities=20are=20available,=0A+=09=09=20*=20if=20= not=20switch=20to=20default=20capabilities.=0A+=09=09=20*/=0A+#if=20= __FreeBSD_version=20>=3D=20700000=20&&=20(defined(INET)=20||=20= defined(INET6))=0A+=09=09if=20((np->xn_ifp->if_capenable=20&=20= IFCAP_LRO)=20!=3D=200)=0A+=09=09=09tcp_lro_free(&np->xn_lro);=0A=20= #endif=0A-=20=20=20=20=09np->xn_ifp->if_capenable=20=3D=0A-=09=20=20=20=20= np->xn_ifp->if_capabilities=20&=20~(IFCAP_LRO|IFCAP_TSO4);=0A-=09= np->xn_ifp->if_hwassist=20&=3D=20~CSUM_TSO;=0A+=09=09= np->xn_ifp->if_capenable=20=3D=0A+=09=09=09np->xn_ifp->if_capabilities=20= &=20~(IFCAP_LRO|IFCAP_TSO4);=0A+=09=09np->xn_ifp->if_hwassist=20&=3D=20= ~CSUM_TSO;=0A+=09}=20else=20{=0A+=09=09/*=0A+=09=09=20*=20What=20we=20= have=20currently=20enabled=20is=20supported=20by=20the=0A+=09=09=20*=20= new=20host,=20no=20need=20to=20change=20anything.=0A+=09=09=20*/=0A+=09=09= return=200;=0A+=09}=0A=20#if=20__FreeBSD_version=20>=3D=20700000=20&&=20= (defined(INET)=20||=20defined(INET6))=0A=20=09if=20(xn_enable_lro=20&&=20= (np->xn_ifp->if_capabilities=20&=20IFCAP_LRO)=20!=3D=200)=20{=0A=20=09=09= err=20=3D=20tcp_lro_init(&np->xn_lro);=0A@@=20-2054,6=20+2072,8=20@@=20= create_netdev(device_t=20dev)=0A=20=09np->rx_min_target=20=3D=20= RX_MIN_TARGET;=0A=20=09np->rx_max_target=20=3D=20RX_MAX_TARGET;=0A=20=0A= +=09np->xn_cold=20=3D=20true;=0A+=0A=20=09/*=20Initialise=20{tx,rx}_skbs=20= to=20be=20a=20free=20chain=20containing=20every=20entry.=20*/=0A=20=09= for=20(i=20=3D=200;=20i=20<=3D=20NET_TX_RING_SIZE;=20i++)=20{=0A=20=09=09= np->tx_mbufs[i]=20=3D=20(void=20*)=20((u_long)=20i+1);=0A--=20=0A1.7.7.5=20= (Apple=20Git-26)=0A=0A= --Apple-Mail=_BF798988-D40B-4431-80BE-5CDB6B3ADE57--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0E13D481-9D6D-4B52-A5AD-B671BF3A85AF>