Subject: Re: [patch net-next-2.6] net: make dev->master general

From: Nicolas de Pesloüan<[email-masked]>
Date: Mon, 14 Feb 2011 15:11:14 +0100

Le 14/02/2011 10:01, Jiri Pirko a écrit :
> Mon, Feb 14, 2011 at 09:48:44AM CET, [email-masked] wrote:
>> Le 12/02/2011 17:48, Jiri Pirko a écrit :
>>> dev->master is now tightly connected to bonding driver. This patch makes
>>> this pointer more general and ready to be used by others.
>>>
>>>   - netdev_set_master() - bond specifics moved to new function
>>>     netdev_set_bond_master()
>>>   - introduced netif_is_bond_slave() to check if device is a bonding slave
>>>
>>> Signed-off-by: Jiri Pirko<[email-masked]>
>>
>> Hi Jiri,
>>
>> Even if DaveM already applied your patch, I'm not comfortable with it.
>>
>> What is the rational behind it? Do you have anything in mind to use
>> the now "more general" master field of net_device?
>>
>> Of course, I won't advocate for every fields having only a single
>> possible usage, but, using master for several different things might
>> jeopardize our ability to share an interface between several logical
>> interface systems:
>>
>> Due to the current usage of the rx_handler field in net_device, the
>> code suggest that an interface cannot be part of a bridge and of a
>> macvlan at the same time. Even if bridge provide an hook for ebtables
>> to ignore an skb and allow other to get it, macvlan cannot be
>> registered on the same lower interface as a bridge, because
>> rx_handler can only hold a single value.
>>
>> By giving master a more general meaning, I think we might face a
>> similar problem. It might disallow an interface to be enslaved to
>> bonding and part of another logical interface at the same time, if
>> such logical interface also use the master field.
>
> That is true. I think that it makes no sense to have iface enslaved in
> bond and bridge at the same time. Do you have a scenario where it makes
> sense?

Agreed for bonding/bridge, because both tend to eat all skb, even if bridge has a way to give skb to 
others, as stated above. Bonding might/should do the same.

But, for macvlan or vlan for example, it is different. They will ignore skb not matching the correct 
dst_mac (macvlan) or vlan_id (vlan) and give a chance to other to use the skb.

Many setups involving several logical ifaces sharing a physical iface make sense:

- bridge+vlan (see "2.6.37 regression: adding main interface to a bridge breaks vlan interface RX")
- bride+macvlan (In particular because bridge might no know about the other dst_macs that should be 
considered local. I didn't check that particular point in detail.)
- bonding+vlan
- bonding+macvlan

So, would master be used only for ifaces that "eat all skb"?

	Nicolas.