Skip to contentSkip to conversation

macvlan: Set IFF_UNICAST_FLT flag to prevent unnecessary promisc mode.

PATCH Applied Vlad Yasevich 3 participants 5 messages Mar 7, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macvlan: Set IFF_UNICAST_FLT flag to prevent unnecessary promisc mode.

Macvlan already supports hw address filters. Set the IFF_UNICAST_FLT so that it doesn't needlesly enter PROMISC mode when macvlans are stacked.

---
 drivers/net/macvlan.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/macvlan.c +1 -0
index 417b2af..73abbc1 100644
@@ -660,6 +660,7 @@ void macvlan_common_setup(struct net_device *dev)
 	ether_setup(dev);
 
 	dev->priv_flags	       &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
+	dev->priv_flags	       |= IFF_UNICAST_FLT;
 	dev->netdev_ops		= &macvlan_netdev_ops;
 	dev->destructor		= free_netdev;
 	dev->header_ops		= &macvlan_hard_header_ops,
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 3 lines · Vlad Yasevich

Macvlan already supports hw address filters. Set the IFF_UNICAST_FLT so that it doesn't needlesly enter PROMISC mode when macvlans are stacked.

Out of curiosity, how can stacking mac-vlans be useful?

(You are stacking more macvlans on a base mac-vlan?)

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#2 lore raw
Quoted 8 lines · Ben Greear
Quoted 3 lines · Vlad Yasevich

Macvlan already supports hw address filters. Set the IFF_UNICAST_FLT so that it doesn't needlesly enter PROMISC mode when macvlans are stacked.

Out of curiosity, how can stacking mac-vlans be useful?

(You are stacking more macvlans on a base mac-vlan?)

Yep, and macvlans allows, but it looks like it only tries to detect a 2 level stack. I am not sure what the reason is. Might be realated to vlan-to-vlan communication.

-vlad

Quoted 4 lines

Thanks,
Ben

#3 lore raw
Quoted 6 lines · Vlad Yasevich
Quoted 5 lines · Ben Greear
Quoted 3 lines · Vlad Yasevich

Macvlan already supports hw address filters. Set the IFF_UNICAST_FLT so that it doesn't needlesly enter PROMISC mode when macvlans are stacked.

Quoted 7 lines
Quoted 3 lines

Out of curiosity, how can stacking mac-vlans be useful?

(You are stacking more macvlans on a base mac-vlan?)

Yep, and macvlans allows, but it looks like it only tries to detect a 2 level stack. I am not sure what the reason is. Might be realated to vlan-to-vlan communication.

Aha. The reason is explained in this commit.

commit b0832a2961022a076c812384435b5f0290b3fc91

Author: Eric Biederman <[email protected]>
Date:   Fri Mar 13 13:15:37 2009 -0700

macvlan: Support creating macvlans from macvlans

When running in a network namespace whose only link to the outside world is a macvlan device, not being able to create another macvlan is a real pain.

So modify macvlan creation to allow automatically forward a creation of a macvlan on a macvlan to become a creation of a macvlan on the underlying network device.

I don't know if it's useful to support more then 2 levels.

-vlad

Quoted 8 lines

-vlad

Quoted 4 lines

Thanks,
Ben