Date: Wed, 16 Feb 2005 01:38:42 +0200 From: Ruslan Ermilov <ru@FreeBSD.org> To: Sam Leffler <sam@errno.com> Cc: Joerg Wunsch <joerg@FreeBSD.org> Subject: Re: cvs commit: src/sys/net if_ethersubr.c Message-ID: <20050215233842.GA24447@ip.net.ua> In-Reply-To: <20050215183744.GA17554@ip.net.ua> References: <200502140829.j1E8TgDs086634@repoman.freebsd.org> <4210D210.3080700@errno.com> <20050214181431.GA69635@ip.net.ua> <4210F849.8060005@errno.com> <20050214195558.GD69635@ip.net.ua> <421104C7.4070709@errno.com> <20050215074226.GA6781@ip.net.ua> <42123604.9070002@errno.com> <20050215183744.GA17554@ip.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
--yEPQxsgoJgBvi8ip Content-Type: multipart/mixed; boundary="dDRMvlgZJXvWKvBx" Content-Disposition: inline --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [ Redirected to -net ] On Tue, Feb 15, 2005 at 08:37:44PM +0200, Ruslan Ermilov wrote: > On Tue, Feb 15, 2005 at 09:48:52AM -0800, Sam Leffler wrote: [...] > > As to your other suggestion of allocating an mbuf flag bit that'd be=20 > > fine with me. I didn't offer that because I thought we were out of fre= e=20 > > bits but I see m_flags got changed to an int a while back and only=20 > > 16-bits are assigned. > >=20 > OK, I'll post the patches soon then. >=20 The patch is attached. It's rather small, and it has been tested on the IFCAP_VLAN_HWTAGGING hardware. It should now be faster than ever. The first argument to VLAN_OUTPUT_TAG() is now unused, but I don't think it would be a good idea (though I'm not opposed to it either) to trim it. I also embellished a fix in rev. 1.174 of if_ethersubr.c -- it now properly checks for mbufs with VLAN tags, making it possible to bridge(4) on vlan(4)'s whose parent interfaces support VLAN decapsulation in hardware. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Index: sys/mbuf.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/sys/mbuf.h,v retrieving revision 1.165 diff -u -p -r1.165 mbuf.h --- sys/mbuf.h 10 Feb 2005 22:23:02 -0000 1.165 +++ sys/mbuf.h 15 Feb 2005 22:00:02 -0000 @@ -178,6 +178,7 @@ struct mbuf { #define M_FRAG 0x0800 /* packet is a fragment of a larger packet */ #define M_FIRSTFRAG 0x1000 /* packet is first fragment */ #define M_LASTFRAG 0x2000 /* packet is last fragment */ +#define M_VLANTAG 0x10000 /* packet has VLAN tag attached */ =20 /* * External buffer types: identify ext_buf type. @@ -195,7 +196,8 @@ struct mbuf { */ #define M_COPYFLAGS (M_PKTHDR|M_EOR|M_RDONLY|M_PROTO1|M_PROTO1|M_PROTO2|\ M_PROTO3|M_PROTO4|M_PROTO5|M_SKIP_FIREWALL|\ - M_BCAST|M_MCAST|M_FRAG|M_FIRSTFRAG|M_LASTFRAG) + M_BCAST|M_MCAST|M_FRAG|M_FIRSTFRAG|M_LASTFRAG|\ + M_VLANTAG) =20 /* * Flags indicating hw checksum support and sw checksum requirements. Index: net/if_ethersubr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.184 diff -u -p -r1.184 if_ethersubr.c --- net/if_ethersubr.c 14 Feb 2005 11:58:54 -0000 1.184 +++ net/if_ethersubr.c 15 Feb 2005 23:16:13 -0000 @@ -604,7 +604,8 @@ ether_demux(struct ifnet *ifp, struct mb #endif =20 if (!(BDG_ACTIVE(ifp)) && - !(ether_type =3D=3D ETHERTYPE_VLAN && ifp->if_nvlans > 0)) { + !((ether_type =3D=3D ETHERTYPE_VLAN || m->m_flags & M_VLANTAG) && + ifp->if_nvlans > 0)) { /* * Discard packet if upper layers shouldn't see it because it * was unicast to a different Ethernet address. If the driver @@ -618,7 +619,7 @@ ether_demux(struct ifnet *ifp, struct mb * it's undesired. */ if ((ifp->if_flags & IFF_PROMISC) !=3D 0 - && (eh->ether_dhost[0] & 1) =3D=3D 0 + && !ETHER_IS_MULTICAST(eh->ether_dhost) && bcmp(eh->ether_dhost, IFP2AC(ifp)->ac_enaddr, ETHER_ADDR_LEN) !=3D 0 && (ifp->if_flags & IFF_PPROMISC) =3D=3D 0) { @@ -657,8 +658,7 @@ post_stats: * Check to see if the device performed the VLAN decapsulation and * provided us with the tag. */ - if (m_tag_first(m) !=3D NULL && - m_tag_locate(m, MTAG_VLAN, MTAG_VLAN_TAG, NULL) !=3D NULL) { + if (m->m_flags & M_VLANTAG) { /* * If no VLANs are configured, drop. */ Index: net/if_vlan_var.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/net/if_vlan_var.h,v retrieving revision 1.20 diff -u -p -r1.20 if_vlan_var.h --- net/if_vlan_var.h 7 Jan 2005 01:45:34 -0000 1.20 +++ net/if_vlan_var.h 15 Feb 2005 21:57:31 -0000 @@ -80,8 +80,8 @@ struct vlanreq { * * to mark the packet m with the specified VLAN tag. The last * parameter provides code to execute in case of an error. On - * output the driver should check ifnet to see if any VLANs are - * in use and only then check for a packet tag; this is done with: + * output the driver should check mbuf to see if a VLAN tag is + * present and only then check for a tag; this is done with: * * struct m_tag *mtag; * mtag =3D VLAN_OUTPUT_TAG(ifp, m); @@ -107,10 +107,11 @@ struct vlanreq { } \ *(u_int *)(mtag+1) =3D (_t); \ m_tag_prepend((_m), mtag); \ + (_m)->m_flags |=3D M_VLANTAG; \ } while (0) =20 #define VLAN_OUTPUT_TAG(_ifp, _m) \ - ((_ifp)->if_nvlans !=3D 0 ? \ + ((_m)->m_flags & M_VLANTAG ? \ m_tag_locate((_m), MTAG_VLAN, MTAG_VLAN_TAG, NULL) : NULL) #define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt)+1)) #endif /* _KERNEL */ --dDRMvlgZJXvWKvBx-- --yEPQxsgoJgBvi8ip Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFCEogCqRfpzJluFF4RAnnKAJwLRdZD59Ml8XxqSLGG2zA0JQuhXQCfd/XX c/cwUJCTt2r/HqETXiLp0oU= =DJg7 -----END PGP SIGNATURE----- --yEPQxsgoJgBvi8ip--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050215233842.GA24447>