* hypothetical vlan rx path question
@ 2011-07-13 20:49 Jiri Pirko
2011-07-13 21:11 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2011-07-13 20:49 UTC (permalink / raw)
To: netdev
Cc: davem, shemminger, eric.dumazet, nicolas.2p.debian, andy, greearb,
mirqus, bhutchings
Hi guys.
Consider following code taken from 8139cp.c
static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
struct cp_desc *desc)
{
skb->protocol = eth_type_trans (skb, cp->dev);
cp->dev->stats.rx_packets++;
cp->dev->stats.rx_bytes += skb->len;
#if CP_VLAN_TAG_USED
if (cp->vlgrp && (desc->opts2 & cpu_to_le32(RxVlanTagged))) {
vlan_hwaccel_receive_skb(skb, cp->vlgrp,
swab16(le32_to_cpu(desc->opts2) & 0xffff));
} else
#endif
netif_receive_skb(skb);
}
Now my question is why the check for cp->vlgrp is needed here. Because
in hypothetical case it might be possible to receive vlan packet as
non-vlan packet (vlan tag would be lost).
This is present in many drivers.
How about to kill this check entirely and let the later code to deside
what to do with the packet?
Thanks.
Jirka
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hypothetical vlan rx path question
2011-07-13 20:49 hypothetical vlan rx path question Jiri Pirko
@ 2011-07-13 21:11 ` Stephen Hemminger
2011-07-14 6:31 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2011-07-13 21:11 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, eric.dumazet, nicolas.2p.debian, andy, greearb,
mirqus, bhutchings
On Wed, 13 Jul 2011 22:49:46 +0200
Jiri Pirko <jpirko@redhat.com> wrote:
> Hi guys.
>
> Consider following code taken from 8139cp.c
>
>
> static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
> struct cp_desc *desc)
> {
> skb->protocol = eth_type_trans (skb, cp->dev);
>
> cp->dev->stats.rx_packets++;
> cp->dev->stats.rx_bytes += skb->len;
>
> #if CP_VLAN_TAG_USED
> if (cp->vlgrp && (desc->opts2 & cpu_to_le32(RxVlanTagged))) {
> vlan_hwaccel_receive_skb(skb, cp->vlgrp,
> swab16(le32_to_cpu(desc->opts2) & 0xffff));
> } else
> #endif
> netif_receive_skb(skb);
> }
>
>
> Now my question is why the check for cp->vlgrp is needed here. Because
> in hypothetical case it might be possible to receive vlan packet as
> non-vlan packet (vlan tag would be lost).
>
> This is present in many drivers.
>
> How about to kill this check entirely and let the later code to deside
> what to do with the packet?
>
> Thanks.
>
> Jirka
All this is moot with new vlan model. It should always just put
tagged packet up.
I think all drivers with .ndo_vlan_rx_register need to be still converted.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hypothetical vlan rx path question
2011-07-13 21:11 ` Stephen Hemminger
@ 2011-07-14 6:31 ` Jiri Pirko
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2011-07-14 6:31 UTC (permalink / raw)
To: Stephen Hemminger
Cc: netdev, davem, eric.dumazet, nicolas.2p.debian, andy, greearb,
mirqus, bhutchings
Wed, Jul 13, 2011 at 11:11:27PM CEST, shemminger@linux-foundation.org wrote:
>On Wed, 13 Jul 2011 22:49:46 +0200
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>> Hi guys.
>>
>> Consider following code taken from 8139cp.c
>>
>>
>> static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
>> struct cp_desc *desc)
>> {
>> skb->protocol = eth_type_trans (skb, cp->dev);
>>
>> cp->dev->stats.rx_packets++;
>> cp->dev->stats.rx_bytes += skb->len;
>>
>> #if CP_VLAN_TAG_USED
>> if (cp->vlgrp && (desc->opts2 & cpu_to_le32(RxVlanTagged))) {
>> vlan_hwaccel_receive_skb(skb, cp->vlgrp,
>> swab16(le32_to_cpu(desc->opts2) & 0xffff));
>> } else
>> #endif
>> netif_receive_skb(skb);
>> }
>>
>>
>> Now my question is why the check for cp->vlgrp is needed here. Because
>> in hypothetical case it might be possible to receive vlan packet as
>> non-vlan packet (vlan tag would be lost).
>>
>> This is present in many drivers.
>>
>> How about to kill this check entirely and let the later code to deside
>> what to do with the packet?
>>
>> Thanks.
>>
>> Jirka
>
>All this is moot with new vlan model. It should always just put
>tagged packet up.
That's what I thought.
>
>I think all drivers with .ndo_vlan_rx_register need to be still converted.
Yes, I'm kinda on the way to do that.
Thanks Stephen.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-14 6:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-13 20:49 hypothetical vlan rx path question Jiri Pirko
2011-07-13 21:11 ` Stephen Hemminger
2011-07-14 6:31 ` Jiri Pirko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).