tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RFC: vlan(4) use pkthdr instead of mtag



On Fri, Sep 15, 2017 at 04:24:48PM +0900, Shoichi Yamaguchi wrote:
> Currently, FreeBSD, DragonFly BSD, and OpenBSD use pkthdr structure
> to store VLAN id in each packet. On the other hand, NetBSD uses mtag.

Yeah, historic design mistake. Exists for a couple of other items as
well.

> Here is the patch.
> https://gist.githubusercontent.com/s-ymgch228/6597cfc4b6f79c6c62fcdf25003acb55/raw/adaf793dfc56f71438bc68e67530f9e68a884f4d/vlan_mtag.patch

Without double checking all driver changes, a few minor remarks:

sys/mbuf.h:
/* Packet tag types */
Keep a line with a comment like /* 1: Used to be VLAN ID */ or so to
annotate the hole.

M_COPYFLAGS could take a line break, not your fault though.

pkthdr:
Am I miscounting? The move of pattr_af doesn't reduce the internal
padding, it actually adds some as you fill a padding hole on LP64.
Please update the comment for that too.

if_vlan.c and possibly other places: If one branch of an if/else has {},
it is better to have them for all branches.

if_ether.h:
VLAN_TAG_VALUE should likely be named to match vlan_set_tag. Maybe also
introduce vlan_has_tag() instead of direct checks for symmetry.

Beyond those small remarks, good for merging. Thanks for working on
this.

Joerg


Home | Main Index | Thread Index | Old Index