Subject: Re: if_hdrlen
To: None <jonathan@dsg.stanford.edu>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-net
Date: 03/22/2005 05:43:11
--NextPart-20050322054020-0094000
Content-Type: Text/Plain; charset=us-ascii

hi,

> >can anyone explain how if_hdrlen is supposed to be?
> >
> >	1. on-wire header length
> >	2. in-core header length (ie. what if_output prepends)
> >	3. something else
> >
> >IMO, 2. is reasonable.  (and it's what agr(4) assumes.)
> >does anyone object if i change vlan(4) to use ETHER_HDR_LEN as if_hdrlen
> >instead of ETHER_HDR_LEN + sizeof(tag)?
> 
> I vaguely recall seeing two broad kinds of hardware that supports VLANs:
> 
>    1. hardware which handles VLAN-tag insertion/deletion and filtering in
>       hardware, and  can auto-insert  VLAN tags;
> 
>    2.  hardware that handles "baby-giant" packets, where software
>        has to handle VLAN tag insertion, removal, filtering of packets with
>        unwanted tags, etc.
> 
> It's not clear to me which "case" you mean by #2 above, or what it'd buy us.
> If the change is small, why not send a diff, with changes for a "dumb"
> and a "smart" vlan-aware driver, for discussion?

i'm not suggesting to change vlan-aware drivers.
i'm suggesting to change the vlan(4) driver.
how to offload vlan tagging is not relevant at all, afaik.

ok, i'll attach a diff.

> It's hard to give good feedback when you don't explain *why* you want
> to make a change.  Do you want to make life easier for agr(4)? Or to
> make the code more internally consistent?

the former.
i also think consistency is a good thing, though.

> If the latter, maybe
> changing agr(4) to follow prior art is a better path?

i'm not sure what's a prior art.  it's why i'm asking. :-)

YAMAMOTO Takashi

--NextPart-20050322054020-0094000
Content-Type: Text/Plain; charset=us-ascii
Content-Disposition: attachment; filename="a.diff"

Index: if_vlan.c
===================================================================
--- if_vlan.c	(revision 1095)
+++ if_vlan.c	(working copy)
@@ -336,7 +336,7 @@ vlan_config(struct ifvlan *ifv, struct i
 		 * We inherit the parent's Ethernet address.
 		 */
 		ether_ifattach(ifp, LLADDR(p->if_sadl));
-		ifp->if_hdrlen = sizeof(struct ether_vlan_header); /* XXX? */
+		ifp->if_hdrlen = p->if_hdrlen;
 		break;
 	    }
 

--NextPart-20050322054020-0094000--