Subject: Re: [PATCH 1/3] vlan: Do not support clearing VLAN_FLAG_REORDER_HDR

From: [email-masked] (Eric W. Biederman)
Date: Sun, 22 May 2011 18:45:53 -0700

Changli Gao <[email-masked]> writes:

> On Mon, May 23, 2011 at 8:38 AM, Changli Gao <[email-masked]> wrote:
>> On Mon, May 23, 2011 at 6:38 AM, Eric W. Biederman
>> <[email-masked]> wrote:
>>>
>>>> Many years ago we supported the REORDER, but we suggested disabling
>>>> it for most users because it was a performance drag.  Funny that now
>>>> it seems to be the opposite!
>>>
>>> Yes it is funny.  I looked in history a while back and what I saw was
>>> that REORDER was always enabled by default and it took some serious
>>> effort to figure out how to get vconfig to disable REORDER. ip doesn't
>>> admit that REORDER can be disabled at all.
>>>
>>
>> Really?
>>
>> Quoted from the manual page of vconfig
>>       set_flag [vlan-device] 0 | 1
>>              When  1,  ethernet  header  reorders  are turned on. Dumping the
>>              device will appear as a common ethernet  device  without  vlans.
>>              When  0(default)  however,  ethernet  headers are not reordered,
>>              which results in vlan tagged packets when  dumping  the  device.
>>              Usually the default gives no problems, but some packet filtering
>>              programs might have problems with it.
>>
>> reordered is disabled by default. I also concern the performance.
>> Untag and then tag are expensive for the NICs which don't support
>> hw-accel-vlan-rx/tx.
>>
>
> For ip:
> localhost ~ # ip link add link eth0 vlan1 type vlan help
> Usage: ... vlan id VLANID [ FLAG-LIST ]
>                           [ ingress-qos-map QOS-MAP ] [ egress-qos-map QOS-MAP ]

Apparently I was blind when I looked at iproute.  I am certain I didn't
see it there but iproute clearly has the option to set or clear reorder_hdr.

> VLANID := 0-4095
> FLAG-LIST := [ FLAG-LIST ] FLAG
> FLAG := [ reorder_hdr { on | off } ] [ gvrp { on | off } ]
>         [ loose_binding { on | off } ]
> QOS-MAP := [ QOS-MAP ] QOS-MAPPING
> QOS-MAPPING := FROM:TO
>
> After checking the code, I found reorder_hdr is off by default.

In iproute reorder_hdr is not modified by default which is subtly
different.

> In another side, is there a specification which defines the
> hw-accel-vlan-rx?

I don't know.

I have just been trying to clean up the mess since some of the
hw-accel-vlan code broke my use case, by delivering packets with
priority but no vlan (aka vlan 0 packets) twice to my pf_packet sockets.

Eric