From: Dave Johnson <djohnson+linux-kernel@sw.starentnetworks.com>
To: Ben Greear <greearb@candelatech.com>
Cc: David Miller <davem@davemloft.net>,
Stephen Hemminger <shemminger@linux-foundation.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bguo@sw.starentnetworks.com
Subject: Re: expected behavior of PF_PACKET on NETIF_F_HW_VLAN_RX device?
Date: Thu, 1 Nov 2007 17:36:22 -0400 [thread overview]
Message-ID: <18218.18134.353553.189622@zeus.sw.starentnetworks.com> (raw)
In-Reply-To: <4729EAFF.9050606@candelatech.com>
Ben Greear writes:
> We should also define what a NIC should do with VLANs it doesn't
> explicitly know about. I think it should pass them up the stack
> with VLAN tag intact, but again, perhaps there are reasons not to do
> that?
Unless the device also supports NETIF_F_HW_VLAN_FILTER, it has no idea
which vlans the kernel cares about, it's up to __vlan_hwaccel_rx().
Stephen Hemminger writes:
> The code in AF_PACKET should fix the skb before passing to user
> space so that there is no difference between accel and non-accel
> hardware. Internal choices shouldn't leak to user space. Ditto,
> the receive checksum offload should be fixed up as well.
yep. bad csum on tx packets as reported by tcpdump is also an issue.
Ben Greear writes:
> Currently, VLAN devices offer the ability to 'reorder' the header
> and explicitly remove the VLAN header. I assume we keep this
> feature and have the AF_PACKET logic check the device flags to see
> if it should insert the VLAN header for hw-accel vlans?
>
> Either way, if we sniff the underlying device, we should always get
> the VLAN header.
Yes, but it's more than just a packet socket issue.
A quick look through the hwaccel capable drivers (in 2.6.23) and most
are doing something like:
if (foo->vlgrp && packet_is_tagged)
vlan_hwaccel_receive_skb(skb, foo->vlgrp, vlan_tag);
else
netif_receive_skb(skb);
The important thing here is if the vlan group is NULL, the MAC must
be configured to NOT strip the tag.
users of NETIF_F_HW_VLAN_RX:
---------------------------
./drivers/net/8139cp.c: looks ok
./drivers/net/acenic.c: *1
./drivers/net/amd8111e.c: unsure, probably *1
./drivers/net/atl1/atl1_main.c: looks ok
./drivers/net/bnx2.c: *2
./drivers/net/bonding/bond_main.c: unsure, probably ok
./drivers/net/chelsio/cxgb2.c: looks ok
./drivers/net/cxgb3/cxgb3_main.c: looks ok
./drivers/net/e1000/e1000_main.c: looks ok
./drivers/net/ehea/ehea_main.c: unsure, probably ok
./drivers/net/forcedeth.c: looks ok
./drivers/net/gianfar.c: looks ok
./drivers/net/ixgb/ixgb_main.c: looks ok
./drivers/net/ns83820.c: unsure, probably ok
./drivers/net/r8169.c: looks ok
./drivers/net/s2io.c: *1
./drivers/net/sky2.c: looks ok
./drivers/net/starfire.c: unsure, probably ok
./drivers/net/tg3.c: *2
./drivers/net/typhoon.c: unsure, probably ok
./drivers/s390/net/qeth_main.c: unsure, probably ok
*1: Driver configures the MAC to strip TAGs even if vlan group is
NULL. MAC strips the tag, but driver calls netif_rx() or
netif_receive_skb() with the packet as untagged. Kernel
processes tagged packet as if it was received untagged. Possible
security issue.
*2: If chip supports 'ASF', tag is always stripped (see *1 above).
Looks ok if ASF is not supported.
Ben Greear writes:
> Do the NICs not save the QoS bits in the VLAN header anywhere that
> we could use to reconstitute the header?
Most likely, __vlan_hwaccel_rx() gets the whole 16bit tag and sets
skb->priority from on it.
Besides the accidental removal with the drivers listed above when
there is no vlan group registerd, we're still back to the original
issue.
Having __vlan_hwaccel_rx() send to the base device would likely
require a copy of the skb (at least the head). That completely defeats
the point of hwaccel.
At a minimum, __vlan_hwaccel_rx() should probably add the vlan header
back on if doesn't find a vlan device. This way no copy is needed,
just shove the header back on (we already have the full 16bits). Once
re-added, send to the base device instead of dropping.
That would fix the unknown vlan issue, but known vlans would only go
to the vlan device not the base device. Not sure of an easy fix for
this as af_packet can specifically bind to a specified base device. I
don't this this would be much of an issue and probably doesn't need
fixing.
--
Dave Johnson
Starent Networks
next prev parent reply other threads:[~2007-11-01 21:38 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-31 18:43 Dave Johnson
2007-10-31 19:33 ` Stephen Hemminger
2007-11-01 1:06 ` Ben Greear
2007-11-01 1:10 ` David Miller
2007-11-01 1:23 ` Stephen Hemminger
2007-11-01 1:31 ` Ben Greear
2007-11-01 4:50 ` David Miller
2007-11-01 15:04 ` Ben Greear
2007-11-01 21:35 ` David Miller
2007-11-01 21:36 ` Dave Johnson [this message]
2007-11-01 21:48 ` Rick Jones
2007-11-01 21:59 ` David Miller
2007-11-01 22:04 ` Rick Jones
2007-11-01 22:07 ` David Miller
2007-11-01 23:26 ` Rick Jones
2007-11-05 17:46 ` [PATCH 1/2] NET: Re-add VLAN tag for devices incapable of keeping it Dave Johnson
2007-11-05 18:00 ` Patrick McHardy
2007-11-05 23:15 ` David Miller
2007-11-06 0:21 ` Patrick McHardy
2007-11-06 0:35 ` David Miller
2007-11-06 18:03 ` Krzysztof Halasa
2007-11-06 18:56 ` Ben Greear
2007-11-06 20:08 ` Krzysztof Halasa
2007-11-06 23:55 ` Patrick McHardy
2007-11-05 17:47 ` [PATCH 2/2] " Dave Johnson
2007-11-06 2:39 ` Ramkrishna Vepa
2007-11-06 18:28 ` Ramkrishna Vepa
2007-11-06 18:34 ` Dave Johnson
2007-11-01 21:58 ` expected behavior of PF_PACKET on NETIF_F_HW_VLAN_RX device? David Miller
2007-11-02 18:08 ` Dave Johnson
2007-11-02 21:20 ` David Miller
2007-11-02 21:52 ` Michael Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18218.18134.353553.189622@zeus.sw.starentnetworks.com \
--to=djohnson+linux-kernel@sw.starentnetworks.com \
--cc=bguo@sw.starentnetworks.com \
--cc=davem@davemloft.net \
--cc=greearb@candelatech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®