Re: bond interface arp, vlan and trunk / network question

From: Jay Vosburgh
Date: Thu Apr 23 2009 - 14:34:32 EST


Jiri Pirko <jpirko@xxxxxxxxxx> wrote:
>Thu, Apr 23, 2009 at 04:59:41PM CEST, fubar@xxxxxxxxxx wrote:
>>Jiri Pirko <jpirko@xxxxxxxxxx> wrote:
[...]
>>>>+{
>>>>+ struct net_device *dev = skb->dev;
>>>>+ struct net_device *master = dev->master;
>>>>+
>>>>+ if (master)
>>>>+ return bond_handle_frame_hook(skb);
>>>
>>>Maybe this hook can be called from netif_receive_skb() directly. You would safe
>>>at least 2 dereferences, 1 if check. You would also need to add
>>>"skb->dev->master &&" to if in __vlan_hwaccel_rx() and vlan_gro_common().
>>
>> This won't work, because the VLAN code reassigns skb->dev to the
>>VLAN device before calling netif_receive_skb.
>
>Sure, but bond_should_drop is called before it actually reassigns that. So the
>check in bond_should_drop tests "original_dev->master".
>
>I had on mind something like following:
>
>Signed-off-by: Jiri Pirko <jpirko@xxxxxxxxxx>
>
>diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
>index c67fe6f..87a7334 100644
>--- a/net/8021q/vlan_core.c
>+++ b/net/8021q/vlan_core.c
>@@ -11,7 +11,7 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
> if (netpoll_rx(skb))
> return NET_RX_DROP;
>
>- if (skb_bond_should_drop(skb))
>+ if (skb->dev->master && bond_handle_frame_hook(skb))
[...]

Yah, ok, I see what you mean. The same could be accomplished by
turning skb_bond_should_drop back into an inline in the header file, and
hiding the fiddly bits from the calling context.

It's pretty grotty no matter how it's done; I'd prefer to avoid
the whole hook business, but I haven't thought of a less bad way.

-J

---
-Jay Vosburgh, IBM Linux Technology Center, fubar@xxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/