Managing the forwarding database(FDB)
Subsystems (4)
cover Managing the forwarding database(FDB)
The following series is a submission for net-next to allow embedded switches and other stacked devices other then the Linux bridge to manage a forwarding database.
This was previously posted here (where it was deferred for more review and testing)
http://lists.openwall.net/netdev/2012/03/19/26
This series adds macvlan support per discussions with Roopa and Michael. Also ixgbe was updated to support adding multicast addresses per request from Greg Rose.
Finally cleanups in the generic dump routines were added for multicast to support ixgbe and macvlan use cases.
Thanks to everyone for the helpful review and comments. As always any comments/feedback welcome.
.John
---
Greg Rose (1):
ixgbe: UTA table incorrectly programmed
John Fastabend (6):
macvlan: add FDB bridge ops and new macvlan mode
ixgbe: allow RAR table to be updated in promisc mode
ixgbe: enable FDB netdevice ops
net: add fdb generic dump routine
net: addr_list: add exclusive dev_uc_add and dev_mc_add
net: add generic PF_BRIDGE:RTM_ FDB hooks
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 121 ++++++++++---- drivers/net/macvlan.c | 60 ++++++- include/linux/if_link.h | 1 include/linux/neighbour.h | 3 include/linux/netdevice.h | 28 +++ include/linux/rtnetlink.h | 4 net/bridge/br_device.c | 3 net/bridge/br_fdb.c | 128 ++++----------- net/bridge/br_netlink.c | 12 - net/bridge/br_private.h | 15 +- net/core/dev_addr_lists.c | 97 ++++++++++-- net/core/rtnetlink.c | 209 +++++++++++++++++++++++++ 12 files changed, 508 insertions(+), 173 deletions(-)
Signature · 1 line
Signature
PATCH 1/7 net: add generic PF_BRIDGE:RTM_ FDB hooks
This adds two new flags NTF_MASTER and NTF_SELF that can now be used to specify where PF_BRIDGE netlink commands should be sent. NTF_MASTER sends the commands to the 'dev->master' device for parsing. Typically this will be the linux net/bridge, or open-vswitch devices. Also without any flags set the command will be handled by the master device as well so that current user space tools continue to work as expected.
The NTF_SELF flag will push the PF_BRIDGE commands to the device. In the basic example below the commands are then parsed and programmed in the embedded bridge.
Note if both NTF_SELF and NTF_MASTER bits are set then the command will be sent to both 'dev->master' and 'dev' this allows user space to easily keep the embedded bridge and software bridge in sync.
To support this new net device ops were added to call into the device and the existing bridging code was refactored to use these. There should be no required changes in user space to support the current bridge behavior.
A basic setup with a SR-IOV enabled NIC looks like this,
veth0 veth2
| |
------------
| bridge0 | <---- software bridging
------------
/
/
ethx.y ethx
VF PF
\ \ <---- propagate FDB entries to HW
\ \ --------------------
| Embedded Bridge | <---- hardware offloaded switching
--------------------
In this case the embedded bridge must be managed to allow 'veth0' to communicate with 'ethx.y' correctly. At present drivers managing the embedded bridge either send frames onto the network which then get dropped by the switch OR the embedded bridge will flood these frames. With this patch we have a mechanism to manage the embedded bridge correctly from user space. This example is specific to SR-IOV but replacing the VF with another PF or dropping this into the DSA framework generates similar management issues.
Examples session using the 'br'[1] tool to add, dump and then delete a mac address with a new "embedded" option and enabled ixgbe driver:
# br fdb add 22:35:19:ac:60:59 dev eth3 # br fdb port mac addr flags veth0 22:35:19:ac:60:58 static veth0 9a:5f:81:f7:f6:ec local eth3 00:1b:21:55:23:59 local eth3 22:35:19:ac:60:59 static veth0 22:35:19:ac:60:57 static #br fdb add 22:35:19:ac:60:59 embedded dev eth3 #br fdb port mac addr flags veth0 22:35:19:ac:60:58 static veth0 9a:5f:81:f7:f6:ec local eth3 00:1b:21:55:23:59 local eth3 22:35:19:ac:60:59 static veth0 22:35:19:ac:60:57 static eth3 22:35:19:ac:60:59 local embedded #br fdb del 22:35:19:ac:60:59 embedded dev eth3
I added a couple lines to 'br' to set the flags correctly is all. It is my opinion that the merit of this patch is now embedded and SW bridges can both be modeled correctly in user space using very nearly the same message passing.
[1] 'br' tool was published as an RFC here and will be renamed 'bridge'
http://patchwork.ozlabs.org/patch/117664/
Thanks to Jamal Hadi Salim, Stephen Hemminger and Ben Hutchings for valuable feedback, suggestions, and review.
---
include/linux/neighbour.h | 3 + include/linux/netdevice.h | 26 ++++++++ include/linux/rtnetlink.h | 4 + net/bridge/br_device.c | 3 + net/bridge/br_fdb.c | 128 ++++++++++-------------------------------- net/bridge/br_netlink.c | 12 ---- net/bridge/br_private.h | 15 ++++- net/core/rtnetlink.c | 138 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 217 insertions(+), 112 deletions(-)
include/linux/neighbour.h +3 -0
@@ -33,6 +33,9 @@ enum {#define NTF_PROXY 0x08/* == ATF_PUBL */ #define NTF_ROUTER 0x80 +#define NTF_SELF 0x02 +#define NTF_MASTER 0x04 +/* * Neighbor Cache Entry States. */
include/linux/netdevice.h +26 -0
@@ -54,6 +54,7 @@#include <net/netprio_cgroup.h> #include <linux/netdev_features.h> +#include <linux/neighbour.h> struct netpoll_info ;struct device ;
@@ -905,6 +906,19 @@ struct netdev_fcoe_hbainfo {* feature set might be less than what was returned by ndo_fix_features()). * Must return >0 or -errno if it changed dev->features itself. * +* int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr, u16 flags) +* Adds an FDB entry to dev for addr. The ndmsg contains flags to indicate +* if the dev->master FDB should be updated or the devices internal FDB. +* int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr) +* Deletes the FDB entry from dev coresponding to addr. The ndmsg +* contains flags to indicate if the dev->master FDB should be +* updated or the devices internal FDB. +* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, +* struct net_device *dev, int idx) +* Used to add FDB entries to dump requests. Implementers should add +* entries to skb and update idx with the number of entries. */ struct net_device_ops {int (*ndo_init)(struct net_device *dev);
@@ -1002,6 +1016,18 @@ struct net_device_ops { netdev_features_t features);int (*ndo_neigh_construct)(struct neighbour *n);void (*ndo_neigh_destroy)(struct neighbour *n); + +int (*ndo_fdb_add)(struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr, +u16 flags); +int (*ndo_fdb_del)(struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr); +int (*ndo_fdb_dump)(struct sk_buff *skb, +struct netlink_callback *cb, +struct net_device *dev, +int idx); };/*
include/linux/rtnetlink.h +4 -0
@@ -801,6 +801,10 @@ rtattr_failure: return table; } +extern int ndo_dflt_fdb_dump (struct sk_buff *skb, +struct netlink_callback *cb, +struct net_device *dev, +int idx);#endif /* __KERNEL__ */
net/bridge/br_device.c +3 -0
@@ -317,6 +317,9 @@ static const struct net_device_ops br_netdev_ops = { .ndo_add_slave = br_add_slave, .ndo_del_slave = br_del_slave, .ndo_fix_features = br_fix_features, + .ndo_fdb_add = br_fdb_add, + .ndo_fdb_del = br_fdb_delete, + .ndo_fdb_dump = br_fdb_dump, };static void br_dev_free (struct net_device *dev)
net/bridge/br_fdb.c +31 -97
172 lines not on this page · raw message
net/bridge/br_netlink.c +0 -12
@@ -232,18 +232,6 @@ int __init br_netlink_init(void) br_rtm_setlink, NULL, NULL);if (err) goto err3; - err =__rtnl_register (PF_BRIDGE ,RTM_NEWNEIGH , - br_fdb_add,NULL ,NULL ); -if (err) - goto err3; - err =__rtnl_register (PF_BRIDGE ,RTM_DELNEIGH , - br_fdb_delete,NULL ,NULL ); -if (err) - goto err3; - err =__rtnl_register (PF_BRIDGE ,RTM_GETNEIGH , -NULL , br_fdb_dump,NULL ); -if (err) - goto err3;return 0 ;
net/bridge/br_private.h +12 -3
@@ -363,9 +363,18 @@ extern int br_fdb_insert(struct net_bridge *br,extern void br_fdb_update (struct net_bridge *br,struct net_bridge_port *source,const unsigned char *addr); -extern int br_fdb_dump (struct sk_buff *skb,struct netlink_callback *cb); -extern int br_fdb_add (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg); -extern int br_fdb_delete (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg); + +extern int br_fdb_delete (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr); +extern int br_fdb_add (struct ndmsg *nlh, +struct net_device *dev, +unsigned char *addr, +u16 nlh_flags); +extern int br_fdb_dump (struct sk_buff *skb, +struct netlink_callback *cb, +struct net_device *dev, +int idx);/* br_forward.c */ extern void br_deliver(const struct net_bridge_port *to,
net/core/rtnetlink.c +138 -0
156 lines not on this page · raw message
Re: [net-next PATCH v1 1/7] net: add generic PF_BRIDGE:RTM_ FDB hooks
On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
[...]
Quoted 4 lines
include/linux/netdevice.h +0
-0
[...]
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 912
Quoted 8 lines
include/linux/netdevice.h +4
-0@@ -905,6 +906,19 @@ struct netdev_fcoe_hbainfo {* feature set might be less than what was returned by ndo_fix_features()). * Must return >0 or -errno if it changed dev->features itself. * +* int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr, u16 flags) +* Adds an FDB entry to dev for addr. The ndmsg contains flags to indicate +* if the dev->master FDB should be updated or the devices internal FDB.
I don't think the second sentence is helpful, as rtnl_fdb_add() will take care of those flags.
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 917
Quoted 5 lines
include/linux/netdevice.h +5
-0+* int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr) +* Deletes the FDB entry from dev coresponding to addr. The ndmsg +* contains flags to indicate if the dev->master FDB should be +* updated or the devices internal FDB.
Similarly here.
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 922
Quoted 5 lines
include/linux/netdevice.h +4
-0+* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, +* struct net_device *dev, int idx) +* Used to add FDB entries to dump requests. Implementers should add +* entries to skb and update idx with the number of entries. */
[...
Quoted 2 lines
net/core/rtnetlink.c +0
-0
[...]
Quoted 2 lines
net/core/rtnetlink.c +2
-0+static int rtnl_fdb_add (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) +{
[...]
net/core/rtnetlink.c
Quoted 1 line
net/core/rtnetlink.c +1
-0+ err = -EOPNOTSUPP ;
So if NTF_MASTER and NTF_SELF are both set, we can quietly fall back to just setting one FDB? Not sure that's really desirable though
net/core/rtnetlink.c errout: · line 2027
Quoted 6 lines
net/core/rtnetlink.c +6
-0+/* Support fdb on master device the net/bridge default case */ +if ((!ndm->ndm_flags || ndm->ndm_flags &NTF_MASTER ) && + (dev->priv_flags &IFF_BRIDGE_PORT )) { +struct net_device *master = dev->master; + +if (master->netdev_ops->ndo_fdb_add)
This operation is surely going to be mandatory for bridge devices, so this check should be omitted or changed to a BUG_ON().
net/core/rtnetlink.c
Quoted 2 lines
net/core/rtnetlink.c +2
-0+ err = master->netdev_ops->ndo_fdb_add (ndm, dev, addr, + nlh->nlmsg_flags);
Shoudn't we return early on error?
net/core/rtnetlink.c errout: · line 2034
Quoted 5 lines
net/core/rtnetlink.c +5
-0+ } + +/* Embedded bridge, macvlan, and any other device support */ +if ((ndm->ndm_flags &NTF_SELF ) && + dev->netdev_ops->ndo_fdb_add)
Error if !dev->netdev_ops->ndo_fdb_add.
net/core/rtnetlink.c errout: · line 2036
Quoted 2 lines
net/core/rtnetlink.c +2
-0+ err = dev->netdev_ops->ndo_fdb_add (ndm, dev, addr, + nlh->nlmsg_flags);
Wonder what we should do on error here if we've already successfully called ndo_fdb_add on the master? Should we try to roll back the first addition?
Quoted 5 lines
net/core/rtnetlink.c +5
-0+return err; +} + +static int rtnl_fdb_del (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) +{
[...]
Quoted 7 lines
net/core/rtnetlink.c +7
-0+ err = -EOPNOTSUPP ; + +/* Support fdb on master device the net/bridge default case */ +if ((!ndm->ndm_flags || ndm->ndm_flags &NTF_MASTER ) && + (dev->priv_flags &IFF_BRIDGE_PORT )) { +struct net_device *master = dev->master; +
net/core/rtnetlink.c errout: · line 2089
Quoted 10 lines
net/core/rtnetlink.c +10
-0+if (master->netdev_ops->ndo_fdb_del) + err = master->netdev_ops->ndo_fdb_del (ndm, dev, addr); + } + +/* Embedded bridge, macvlan, and any other device support */ +if ((ndm->ndm_flags &NTF_SELF ) && + dev->netdev_ops->ndo_fdb_del) + err = dev->netdev_ops->ndo_fdb_del (ndm, dev, addr); +return err; +}
[...]
This has the same issues.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [net-next PATCH v1 1/7] net: add generic PF_BRIDGE:RTM_ FDB hooks
Quoted 19 lines · Ben Hutchings
On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
[...]Quoted 4 lines
include/linux/netdevice.h +0
-0[...]
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 912
Quoted 8 lines
include/linux/netdevice.h +4
-0@@ -905,6 +906,19 @@ struct netdev_fcoe_hbainfo {* feature set might be less than what was returned by ndo_fix_features()). * Must return >0 or -errno if it changed dev->features itself. * +* int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr, u16 flags) +* Adds an FDB entry to dev for addr. The ndmsg contains flags to indicate +* if the dev->master FDB should be updated or the devices internal FDB. I don't think the second sentence is helpful, as
rtnl_fdb_add()will take care of those flags.
Quoted 7 lines
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 917
Quoted 5 lines
include/linux/netdevice.h +5
-0+* int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr) +* Deletes the FDB entry from dev coresponding to addr. The ndmsg +* contains flags to indicate if the dev->master FDB should be +* updated or the devices internal FDB. Similarly here.
agreed neither seem particularly helpful I'll remove them.
Quoted 10 lines
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 922
Quoted 6 lines
include/linux/netdevice.h +4
-0+* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, +* struct net_device *dev, int idx) +* Used to add FDB entries to dump requests. Implementers should add +* entries to skb and update idx with the number of entries. */ [...
Quoted 2 lines
net/core/rtnetlink.c +0
-0[...]
Quoted 8 lines
Quoted 2 lines
net/core/rtnetlink.c +2
-0+static int rtnl_fdb_add (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) +{[...]
net/core/rtnetlink.c
Quoted 1 line
net/core/rtnetlink.c +1
-0+ err = -EOPNOTSUPP ;So if
NTF_MASTERandNTF_SELFare both set, we can quietly fall back to just setting one FDB? Not sure that's really desirable though
It makes it easier to keep an embedded agent and the sw bridge in sync if setting both flags adds the entry to both the SW bridge and embedded bridge. But the error case gets a bit tricky as your comments below indicate.
Quoted 9 lines
net/core/rtnetlink.c errout: · line 2027
Quoted 6 lines
net/core/rtnetlink.c +6
-0+/* Support fdb on master device the net/bridge default case */ +if ((!ndm->ndm_flags || ndm->ndm_flags &NTF_MASTER ) && + (dev->priv_flags &IFF_BRIDGE_PORT )) { +struct net_device *master = dev->master; + +if (master->netdev_ops->ndo_fdb_add)This operation is surely going to be mandatory for bridge devices, so this check should be omitted or changed to a
BUG_ON().
I'll just remove the check.
Quoted 5 lines
net/core/rtnetlink.c
Quoted 3 lines
net/core/rtnetlink.c +2
-0+ err = master->netdev_ops->ndo_fdb_add (ndm, dev, addr, + nlh->nlmsg_flags);Shoudn't we return early on error?
Agreed better to return an err here.
Quoted 9 lines
net/core/rtnetlink.c errout: · line 2034
Quoted 6 lines
net/core/rtnetlink.c +5
-0+ } + +/* Embedded bridge, macvlan, and any other device support */ +if ((ndm->ndm_flags &NTF_SELF ) && + dev->netdev_ops->ndo_fdb_add)Error if !dev->netdev_ops->ndo_fdb_add.
Quoted 7 lines
net/core/rtnetlink.c errout: · line 2036
Quoted 2 lines
net/core/rtnetlink.c +2
-0+ err = dev->netdev_ops->ndo_fdb_add (ndm, dev, addr, + nlh->nlmsg_flags);Wonder what we should do on error here if we've already successfully called
ndo_fdb_addon the master? Should we try to roll back the first addition?
The problem with rolling back is the table is likely already updated and traffic may already be being forwarded. So I think in this case the user will have to query the device to learn what failed. It seems like the simplest way to handle this. I think it is unwanted to have traffic being forwarded one way for a short period of time then rolled back.
The other idea I just had is we could clear the NTF_ bit in ndm_flags after the successful add, del command. I believe the nlmsg gets sent back to the user on error I would need to check on this.
Quoted 25 lines
Quoted 5 lines
net/core/rtnetlink.c +5
-0+return err; +} + +static int rtnl_fdb_del (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) +{[...]
Quoted 17 lines
net/core/rtnetlink.c +17
-0+ err = -EOPNOTSUPP ; + +/* Support fdb on master device the net/bridge default case */ +if ((!ndm->ndm_flags || ndm->ndm_flags &NTF_MASTER ) && + (dev->priv_flags &IFF_BRIDGE_PORT )) { +struct net_device *master = dev->master; + +if (master->netdev_ops->ndo_fdb_del) + err = master->netdev_ops->ndo_fdb_del (ndm, dev, addr); + } + +/* Embedded bridge, macvlan, and any other device support */ +if ((ndm->ndm_flags &NTF_SELF ) && + dev->netdev_ops->ndo_fdb_del) + err = dev->netdev_ops->ndo_fdb_del (ndm, dev, addr); +return err; +}[...]
Quoted 2 lines
This has the same issues.
same comment as above
Quoted 2 lines
Ben.
Re: [net-next PATCH v1 1/7] net: add generic PF_BRIDGE:RTM_ FDB hooks
Quoted 49 lines · John Fastabend
Quoted 19 lines · Ben Hutchings
On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
[...]Quoted 4 lines
include/linux/netdevice.h +0
-0[...]
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 912
Quoted 8 lines
include/linux/netdevice.h +4
-0@@ -905,6 +906,19 @@ struct netdev_fcoe_hbainfo {* feature set might be less than what was returned by ndo_fix_features()). * Must return >0 or -errno if it changed dev->features itself. * +* int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr, u16 flags) +* Adds an FDB entry to dev for addr. The ndmsg contains flags to indicate +* if the dev->master FDB should be updated or the devices internal FDB. I don't think the second sentence is helpful, as
rtnl_fdb_add()will take care of those flags.Quoted 7 lines
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 917
Quoted 5 lines
include/linux/netdevice.h +5
-0+* int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr) +* Deletes the FDB entry from dev coresponding to addr. The ndmsg +* contains flags to indicate if the dev->master FDB should be +* updated or the devices internal FDB. Similarly here.
agreed neither seem particularly helpful I'll remove them.
Quoted 10 lines
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 922
Quoted 6 lines
include/linux/netdevice.h +4
-0+* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, +* struct net_device *dev, int idx) +* Used to add FDB entries to dump requests. Implementers should add +* entries to skb and update idx with the number of entries. */ [...
Quoted 2 lines
net/core/rtnetlink.c +0
-0[...]
Quoted 8 lines
Quoted 2 lines
net/core/rtnetlink.c +2
-0+static int rtnl_fdb_add (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) +{[...]
net/core/rtnetlink.c
Quoted 1 line
net/core/rtnetlink.c +1
-0+ err = -EOPNOTSUPP ;So if
NTF_MASTERandNTF_SELFare both set, we can quietly fall back to just setting one FDB? Not sure that's really desirable though
Quoted 3 lines
It makes it easier to keep an embedded agent and the sw bridge in sync if setting both flags adds the entry to both the SW bridge and embedded bridge.
Yes, I agree with that.
[...]
Quoted 11 lines
Quoted 4 lines
Wonder what we should do on error here if we've already successfully called
ndo_fdb_addon the master? Should we try to roll back the first addition?The problem with rolling back is the table is likely already updated and traffic may already be being forwarded. So I think in this case the user will have to query the device to learn what failed. It seems like the simplest way to handle this. I think it is unwanted to have traffic being forwarded one way for a short period of time then rolled back.
Quoted 3 lines
The other idea I just had is we could clear the
NTF_bit inndm_flagsafter the successful add, del command. I believe the nlmsg gets sent back to the user on error I would need to check on this.
[...]
That sounds like a good way of doing it, assuming there's no compatibility issue.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [net-next PATCH v1 1/7] net: add generic PF_BRIDGE:RTM_ FDB hooks
Quoted 71 lines · Ben Hutchings
Quoted 49 lines · John Fastabend
Quoted 19 lines · Ben Hutchings
On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
[...]Quoted 4 lines
include/linux/netdevice.h +0
-0[...]
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 912
Quoted 8 lines
include/linux/netdevice.h +4
-0@@ -905,6 +906,19 @@ struct netdev_fcoe_hbainfo {* feature set might be less than what was returned by ndo_fix_features()). * Must return >0 or -errno if it changed dev->features itself. * +* int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr, u16 flags) +* Adds an FDB entry to dev for addr. The ndmsg contains flags to indicate +* if the dev->master FDB should be updated or the devices internal FDB. I don't think the second sentence is helpful, as
rtnl_fdb_add()will take care of those flags.Quoted 7 lines
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 917
Quoted 5 lines
include/linux/netdevice.h +5
-0+* int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, +* unsigned char *addr) +* Deletes the FDB entry from dev coresponding to addr. The ndmsg +* contains flags to indicate if the dev->master FDB should be +* updated or the devices internal FDB. Similarly here.
agreed neither seem particularly helpful I'll remove them.
Quoted 10 lines
include/linux/netdevice.h struct netdev_fcoe_hbainfo { · line 922
Quoted 6 lines
include/linux/netdevice.h +4
-0+* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, +* struct net_device *dev, int idx) +* Used to add FDB entries to dump requests. Implementers should add +* entries to skb and update idx with the number of entries. */ [...
Quoted 2 lines
net/core/rtnetlink.c +0
-0[...]
Quoted 8 lines
Quoted 2 lines
net/core/rtnetlink.c +2
-0+static int rtnl_fdb_add (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) +{[...]
net/core/rtnetlink.c
Quoted 1 line
net/core/rtnetlink.c +1
-0+ err = -EOPNOTSUPP ;So if
NTF_MASTERandNTF_SELFare both set, we can quietly fall back to just setting one FDB? Not sure that's really desirable thoughQuoted 3 lines
It makes it easier to keep an embedded agent and the sw bridge in sync if setting both flags adds the entry to both the SW bridge and embedded bridge.
Yes, I agree with that.
[...]
Quoted 11 lines
Quoted 4 lines
Wonder what we should do on error here if we've already successfully called
ndo_fdb_addon the master? Should we try to roll back the first addition?The problem with rolling back is the table is likely already updated and traffic may already be being forwarded. So I think in this case the user will have to query the device to learn what failed. It seems like the simplest way to handle this. I think it is unwanted to have traffic being forwarded one way for a short period of time then rolled back.
Quoted 3 lines
The other idea I just had is we could clear the
NTF_bit inndm_flagsafter the successful add, del command. I believe the nlmsg gets sent back to the user on error I would need to check on this.
Quoted 7 lines
[...]
That sounds like a good way of doing it, assuming there's no compatibility issue.
Ben.
I don't see any compat issues. Current applications shouldn't be setting any flags and shouldn't be expecting any flags in the ack.
Also I think I need to add some notify hooks to help management. The bridge code has fdb_notify() so I'll add a similar rtnl_fdb_notify() hook here. Caught this while implementing some user space daemon code.
Thanks! v2 coming soon.
PATCH 2/7 net: addr_list: add exclusive dev_uc_add and dev_mc_add
In reply to John FastabendThis adds a dev_uc_add_excl() and dev_mc_add_excl() calls similar to the original dev_{uc|mc}_add() except it sets the global bit and returns -EEXIST for duplicat entires.
This is useful for drivers that support SR-IOV, macvlan devices and any other devices that need to manage the unicast and multicast lists.
---
include/linux/netdevice.h | 2 + net/core/dev_addr_lists.c | 97 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 83 insertions(+), 16 deletions(-)
include/linux/netdevice.h +2 -0
@@ -2572,6 +2572,7 @@ extern int dev_addr_init(struct net_device *dev);/* Functions used for unicast addresses handling */ extern int dev_uc_add (struct net_device *dev,unsigned char *addr); +extern int dev_uc_add_excl (struct net_device *dev,unsigned char *addr);extern int dev_uc_del (struct net_device *dev,unsigned char *addr);extern int dev_uc_sync (struct net_device *to,struct net_device *from);extern void dev_uc_unsync (struct net_device *to,struct net_device *from);
@@ -2581,6 +2582,7 @@ extern void dev_uc_init(struct net_device *dev);/* Functions used for multicast addresses handling */ extern int dev_mc_add (struct net_device *dev,unsigned char *addr);extern int dev_mc_add_global (struct net_device *dev,unsigned char *addr); +extern int dev_mc_add_excl (struct net_device *dev,unsigned char *addr);extern int dev_mc_del (struct net_device *dev,unsigned char *addr);extern int dev_mc_del_global (struct net_device *dev,unsigned char *addr);extern int dev_mc_sync (struct net_device *to,struct net_device *from);
net/core/dev_addr_lists.c +81 -16
126 lines not on this page · raw message
Re: [net-next PATCH v1 2/7] net: addr_list: add exclusive dev_uc_add and dev_mc_add
Quoted 156 lines · John Fastabend
This adds a
dev_uc_add_excl()anddev_mc_add_excl()calls similar to the original dev_{uc|mc}_add() except it sets the global bit and returns-EEXISTfor duplicat entires.This is useful for drivers that support SR-IOV, macvlan devices and any other devices that need to manage the unicast and multicast lists.
Signed-off-by John Fastabend <[email protected]>---
include/linux/netdevice.h | 2 + net/core/dev_addr_lists.c | 97 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 83 insertions(+), 16 deletions(-)include/linux/netdevice.h +2
-0@@ -2572,6 +2572,7 @@ extern int dev_addr_init(struct net_device *dev);/* Functions used for unicast addresses handling */ extern int dev_uc_add (struct net_device *dev,unsigned char *addr); +extern int dev_uc_add_excl (struct net_device *dev,unsigned char *addr);extern int dev_uc_del (struct net_device *dev,unsigned char *addr);extern int dev_uc_sync (struct net_device *to,struct net_device *from);extern void dev_uc_unsync (struct net_device *to,struct net_device *from);@@ -2581,6 +2582,7 @@ extern void dev_uc_init(struct net_device *dev);/* Functions used for multicast addresses handling */ extern int dev_mc_add (struct net_device *dev,unsigned char *addr);extern int dev_mc_add_global (struct net_device *dev,unsigned char *addr); +extern int dev_mc_add_excl (struct net_device *dev,unsigned char *addr);extern int dev_mc_del (struct net_device *dev,unsigned char *addr);extern int dev_mc_del_global (struct net_device *dev,unsigned char *addr);extern int dev_mc_sync (struct net_device *to,struct net_device *from);net/core/dev_addr_lists.c +71
-16@@ -21,12 +21,35 @@* General list handling functions */ +static int __hw_addr_create_ex (struct netdev_hw_addr_list *list, +unsigned char *addr,int addr_len, +unsigned char addr_type,bool global) +{ +struct netdev_hw_addr *ha; +int alloc_size; + + alloc_size =sizeof (*ha); +if (alloc_size <L1_CACHE_BYTES ) + alloc_size =L1_CACHE_BYTES ; + ha =kmalloc (alloc_size,GFP_ATOMIC ); +if (!ha) +return -ENOMEM ; +memcpy (ha->addr, addr, addr_len); + ha->type = addr_type; + ha->refcount =1 ; + ha->global_use = global; + ha->synced = false; +list_add_tail_rcu (&ha->list, &list->list); + list->count++; + +return 0 ; +} +static int __hw_addr_add_ex (struct netdev_hw_addr_list *list,unsigned char *addr,int addr_len,unsigned char addr_type,bool global) {struct netdev_hw_addr *ha; -int alloc_size;if (addr_len >MAX_ADDR_LEN )return -EINVAL ;@@ -46,21 +69,7 @@ static int __hw_addr_add_ex(struct netdev_hw_addr_list *list, } } - - alloc_size =sizeof (*ha); -if (alloc_size <L1_CACHE_BYTES ) - alloc_size =L1_CACHE_BYTES ; - ha =kmalloc (alloc_size,GFP_ATOMIC ); -if (!ha) -return -ENOMEM ; -memcpy (ha->addr, addr, addr_len); - ha->type = addr_type; - ha->refcount =1 ; - ha->global_use = global; - ha->synced = false; -list_add_tail_rcu (&ha->list, &list->list); - list->count++; -return 0 ; +return __hw_addr_create_ex (list, addr, addr_len, addr_type, global); } static int __hw_addr_add(struct netdev_hw_addr_list *list, unsigned char *addr,@@ -377,6 +386,34 @@ EXPORT_SYMBOL(dev_addr_del_multiple);*/ /** +* dev_uc_add_excl - Add a global secondary unicast address +* @dev: device +* @addr: address to add +*/ +int dev_uc_add_excl (struct net_device *dev,unsigned char *addr) +{ +struct netdev_hw_addr *ha; +int err; + +netif_addr_lock_bh (dev); +list_for_each_entry (ha, &dev->uc.list, list) { +if (!memcmp (ha->addr, addr, dev->addr_len) && + ha->type ==NETDEV_HW_ADDR_T_UNICAST ) { + err = -EEXIST ; + goto out; + } + } + err =__hw_addr_create_ex (&dev->uc, addr, dev->addr_len, +NETDEV_HW_ADDR_T_UNICAST , true); +if (!err) +__dev_set_rx_mode (dev); +out: +netif_addr_unlock_bh (dev); +return err; +} +EXPORT_SYMBOL (dev_uc_add_excl); + +/** * dev_uc_add - Add a secondary unicast address * @dev: device * @addr: address to add @@ -501,6 +538,34 @@ EXPORT_SYMBOL(dev_uc_init);* Multicast list handling functions */ +/** +* dev_mc_add_excl - Add a global secondary multicast address +* @dev: device +* @addr: address to add +*/ +int dev_mc_add_excl (struct net_device *dev,unsigned char *addr) +{ +struct netdev_hw_addr *ha; +int err; + +netif_addr_lock_bh (dev); +list_for_each_entry (ha, &dev->mc.list, list) { +if (!memcmp (ha->addr, addr, dev->addr_len) && + ha->type ==NETDEV_HW_ADDR_T_UNICAST ) { + err = -EEXIST ; + goto out; + } + }
net/core/dev_addr_lists.c EXPORT_SYMBOL(dev_uc_init); · line 568
Quoted 10 lines
net/core/dev_addr_lists.c +10
-0+ err =__hw_addr_create_ex (&dev->mc, addr, dev->addr_len, +NETDEV_HW_ADDR_T_UNICAST , true); +if (!err) +__dev_set_rx_mode (dev); +out: +netif_addr_unlock_bh (dev); +return err; +} +EXPORT_SYMBOL (dev_mc_add_excl); +
Why is it a mistake to have duplicate multicast addresses? For example macvlan floods all multicasts so it's fine, and assuming it didn't, it might still be fine to have to macvlans get the same multicast, no?
Quoted 3 lines
net/core/dev_addr_lists.c +0
-0static int __dev_mc_add (struct net_device *dev,unsigned char *addr,bool global) {
Re: [net-next PATCH v1 2/7] net: addr_list: add exclusive dev_uc_add and dev_mc_add
In reply to John FastabendQuoted 7 lines · John Fastabend
This adds a
dev_uc_add_excl()anddev_mc_add_excl()calls similar to the original dev_{uc|mc}_add() except it sets the global bit and returns-EEXISTfor duplicat entires.This is useful for drivers that support SR-IOV, macvlan devices and any other devices that need to manage the unicast and multicast lists.
[...]
Quoted 10 lines
net/core/dev_addr_lists.c +10
-0+/** +* dev_mc_add_excl - Add a global secondary multicast address +* @dev: device +* @addr: address to add +*/ +int dev_mc_add_excl (struct net_device *dev,unsigned char *addr) +{ +struct netdev_hw_addr *ha; +int err; +
net/core/dev_addr_lists.c EXPORT_SYMBOL(dev_uc_init); · line 560
Quoted 10 lines
net/core/dev_addr_lists.c +10
-0+netif_addr_lock_bh (dev); +list_for_each_entry (ha, &dev->mc.list, list) { +if (!memcmp (ha->addr, addr, dev->addr_len) && + ha->type ==NETDEV_HW_ADDR_T_UNICAST ) { + err = -EEXIST ; + goto out; + } + } + err =__hw_addr_create_ex (&dev->mc, addr, dev->addr_len, +NETDEV_HW_ADDR_T_UNICAST , true);
[...]
The address types are wrong. But do we even need this function yet?
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [net-next PATCH v1 2/7] net: addr_list: add exclusive dev_uc_add and dev_mc_add
Quoted 31 lines · Ben Hutchings
Quoted 7 lines · John Fastabend
This adds a
dev_uc_add_excl()anddev_mc_add_excl()calls similar to the original dev_{uc|mc}_add() except it sets the global bit and returns-EEXISTfor duplicat entires.This is useful for drivers that support SR-IOV, macvlan devices and any other devices that need to manage the unicast and multicast lists.
[...]
Quoted 20 lines
net/core/dev_addr_lists.c +20
-0+/** +* dev_mc_add_excl - Add a global secondary multicast address +* @dev: device +* @addr: address to add +*/ +int dev_mc_add_excl (struct net_device *dev,unsigned char *addr) +{ +struct netdev_hw_addr *ha; +int err; + +netif_addr_lock_bh (dev); +list_for_each_entry (ha, &dev->mc.list, list) { +if (!memcmp (ha->addr, addr, dev->addr_len) && + ha->type ==NETDEV_HW_ADDR_T_UNICAST ) { + err = -EEXIST ; + goto out; + } + } + err =__hw_addr_create_ex (&dev->mc, addr, dev->addr_len, +NETDEV_HW_ADDR_T_UNICAST , true);[...]
Quoted 4 lines
The address types are wrong. But do we even need this function yet?
Ben.
macvlan wants to manage multicast addresses as well. Good catch thanks.
.John
PATCH 3/7 net: add fdb generic dump routine
In reply to John FastabendThis adds a generic dump routine drivers can call. It should be sufficient to handle any bridging model that uses the unicast address list. This should be most SR-IOV enabled NICs.
---
net/core/rtnetlink.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-)
net/core/rtnetlink.c +71 -0
@@ -2088,6 +2088,77 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)return err; } +static int nlmsg_populate_fdb (struct sk_buff *skb, +struct netlink_callback *cb, +struct net_device *dev, +int *idx, +struct netdev_hw_addr_list *list) +{ +struct netdev_hw_addr *ha; +struct ndmsg *ndm; +struct nlmsghdr *nlh; +u32 pid, seq; + + pid =NETLINK_CB (cb->skb).pid; + seq = cb->nlh->nlmsg_seq; + +list_for_each_entry (ha, &list->list, list) { +if (*idx < cb->args[0 ]) + goto skip; + + nlh =nlmsg_put (skb, pid, seq, +RTM_NEWNEIGH ,sizeof (*ndm),NLM_F_MULTI ); +if (!nlh) +break ; + + ndm =nlmsg_data (nlh); + ndm->ndm_family =AF_BRIDGE ; + ndm->ndm_pad1 =0 ; + ndm->ndm_pad2 =0 ; + ndm->ndm_flags =NTF_SELF ; + ndm->ndm_type =0 ; + ndm->ndm_ifindex = dev->ifindex; + ndm->ndm_state =NUD_PERMANENT ; + +if (nla_put (skb,NDA_LLADDR ,ETH_ALEN , ha->addr)) + goto nla_put_failure; + +nlmsg_end (skb, nlh); +skip: + *idx +=1 ; + } +return 0 ; +nla_put_failure: +nlmsg_cancel (skb, nlh); +return -ENOMEM ; +} + +/** +* ndo_dflt_fdb_dump: default netdevice operation to dump an FDB table. +* @nlh: netlink message header +* @dev: netdevice +* +* Default netdevice operation to dump the existing unicast address list. +* Returns zero on success. +*/ +int ndo_dflt_fdb_dump (struct sk_buff *skb, +struct netlink_callback *cb, +struct net_device *dev, +int idx) +{ +int err; + +netif_addr_lock_bh (dev); + err =nlmsg_populate_fdb (skb, cb, dev, &idx, &dev->uc); +if (err) + goto out; +nlmsg_populate_fdb (skb, cb, dev, &idx, &dev->mc); +out: +netif_addr_unlock_bh (dev); +return idx; +} +EXPORT_SYMBOL (ndo_dflt_fdb_dump); +static int rtnl_fdb_dump (struct sk_buff *skb,struct netlink_callback *cb) {int idx =0 ;
Re: [net-next PATCH v1 3/7] net: add fdb generic dump routine
Quoted 4 lines · John Fastabend
This adds a generic dump routine drivers can call. It should be sufficient to handle any bridging model that uses the unicast address list. This should be most SR-IOV enabled NICs.
[...]
Quoted 12 lines
net/core/rtnetlink.c +12
-0+static int nlmsg_populate_fdb (struct sk_buff *skb, +struct netlink_callback *cb, +struct net_device *dev, +int *idx, +struct netdev_hw_addr_list *list) +{ +struct netdev_hw_addr *ha; +struct ndmsg *ndm; +struct nlmsghdr *nlh; +u32 pid, seq; + + pid =NETLINK_CB (cb->skb).pid;
net/core/rtnetlink.c static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) · line 2112
Quoted 10 lines
net/core/rtnetlink.c +10
-0+ seq = cb->nlh->nlmsg_seq; + +list_for_each_entry (ha, &list->list, list) { +if (*idx < cb->args[0 ]) + goto skip; + + nlh =nlmsg_put (skb, pid, seq, +RTM_NEWNEIGH ,sizeof (*ndm),NLM_F_MULTI ); +if (!nlh) +break ;
This break is effectively return 0, but shouldn't we return an error? In practice this does no harm because any subsequent invocation of nlmsg_populate_fdb() for the same skb is also going to fail here with no change to *idx. But it would be more obviously correct to return an error.
[...]
Quoted 6 lines
net/core/rtnetlink.c +6
-0+ } +return 0 ; +nla_put_failure: +nlmsg_cancel (skb, nlh); +return -ENOMEM ; +}
[...]
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [net-next PATCH v1 3/7] net: add fdb generic dump routine
Quoted 26 lines · Ben Hutchings
Quoted 4 lines · John Fastabend
This adds a generic dump routine drivers can call. It should be sufficient to handle any bridging model that uses the unicast address list. This should be most SR-IOV enabled NICs.
[...]
Quoted 20 lines
net/core/rtnetlink.c +20
-0+static int nlmsg_populate_fdb (struct sk_buff *skb, +struct netlink_callback *cb, +struct net_device *dev, +int *idx, +struct netdev_hw_addr_list *list) +{ +struct netdev_hw_addr *ha; +struct ndmsg *ndm; +struct nlmsghdr *nlh; +u32 pid, seq; + + pid =NETLINK_CB (cb->skb).pid; + seq = cb->nlh->nlmsg_seq; + +list_for_each_entry (ha, &list->list, list) { +if (*idx < cb->args[0 ]) + goto skip; + + nlh =nlmsg_put (skb, pid, seq, +RTM_NEWNEIGH ,sizeof (*ndm),NLM_F_MULTI );
Quoted 9 lines
net/core/rtnetlink.c static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) · line 2112
Quoted 2 lines
net/core/rtnetlink.c +2
-0+if (!nlh) +break ;This break is effectively return 0, but shouldn't we return an error? In practice this does no harm because any subsequent invocation of
nlmsg_populate_fdb()for the same skb is also going to fail here with no change to *idx. But it would be more obviously correct to return an error.
sure returning -EMSGSIZE seems to be inline with rtnl_fill_ifinfo and easier to read.
Quoted 9 lines
[...]
Quoted 6 lines
net/core/rtnetlink.c +6
-0+ } +return 0 ; +nla_put_failure: +nlmsg_cancel (skb, nlh); +return -ENOMEM ; +}[...]
also might be better to return -EMSGSIZE here as well. It seems to be more inline with convention.
.John
PATCH 4/7 ixgbe: enable FDB netdevice ops
In reply to John FastabendEnable FDB ops on ixgbe when in SR-IOV mode.
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 71 +++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +71 -0
@@ -6681,6 +6681,74 @@ static int ixgbe_set_features(struct net_device *netdev,return 0 ; } +static int ixgbe_ndo_fdb_add (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr, +u16 flags) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev); +int err = -EOPNOTSUPP ; + +if (ndm->ndm_state &NUD_PERMANENT ) { +pr_info ("%s: FDB only supports static addresses\n" , + ixgbe_driver_name); +return -EINVAL ; + } + +if (adapter->flags &IXGBE_FLAG_SRIOV_ENABLED ) { +if (is_unicast_ether_addr (addr)) + err =dev_uc_add_excl (dev, addr); +else if (is_multicast_ether_addr (addr)) + err =dev_mc_add_excl (dev, addr); +else + err = -EINVAL ; + } + +/* Only return duplicate errors if NLM_F_EXCL is set */ +if (err == -EEXIST && !(flags &NLM_F_EXCL )) + err =0 ; + +return err; +} + +static int ixgbe_ndo_fdb_del (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev); +int err = -EOPNOTSUPP ; + +if (ndm->ndm_state &NUD_PERMANENT ) { +pr_info ("%s: FDB only supports static addresses\n" , + ixgbe_driver_name); +return -EINVAL ; + } + +if (adapter->flags &IXGBE_FLAG_SRIOV_ENABLED ) { +if (is_unicast_ether_addr (addr)) + err =dev_uc_del (dev, addr); +else if (is_multicast_ether_addr (addr)) + err =dev_mc_del (dev, addr); +else + err = -EINVAL ; + } + +return err; +} + +static int ixgbe_ndo_fdb_dump (struct sk_buff *skb, +struct netlink_callback *cb, +struct net_device *dev, +int idx) +{ +struct ixgbe_adapter *adapter =netdev_priv (dev); + +if (adapter->flags &IXGBE_FLAG_SRIOV_ENABLED ) + idx =ndo_dflt_fdb_dump (skb, cb, dev, idx); + +return idx; +} +static const struct net_device_ops ixgbe_netdev_ops = { .ndo_open = ixgbe_open, .ndo_stop = ixgbe_close,
@@ -6717,6 +6785,9 @@ static const struct net_device_ops ixgbe_netdev_ops = {#endif /* IXGBE_FCOE */ .ndo_set_features = ixgbe_set_features, .ndo_fix_features = ixgbe_fix_features, + .ndo_fdb_add = ixgbe_ndo_fdb_add, + .ndo_fdb_del = ixgbe_ndo_fdb_del, + .ndo_fdb_dump = ixgbe_ndo_fdb_dump, }; static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
PATCH 5/7 ixgbe: allow RAR table to be updated in promisc mode
In reply to John FastabendThis allows RAR table updates while in promiscuous. With SR-IOV enabled it is valuable to allow the RAR table to be updated even when in promisc mode to configure forwarding
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +11 -10
@@ -3462,16 +3462,17 @@ void ixgbe_set_rx_mode(struct net_device *netdev) }ixgbe_vlan_filter_enable (adapter); hw->addr_ctrl.user_set_promisc = false; -/* -* Write addresses to available RAR registers, if there is not -* sufficient space to store all the addresses then enable -* unicast promiscuous mode -*/ - count =ixgbe_write_uc_addr_list (netdev); -if (count <0 ) { - fctrl |=IXGBE_FCTRL_UPE ; - vmolr |=IXGBE_VMOLR_ROPE ; - } + } + +/* +* Write addresses to available RAR registers, if there is not +* sufficient space to store all the addresses then enable +* unicast promiscuous mode +*/ + count =ixgbe_write_uc_addr_list (netdev); +if (count <0 ) { + fctrl |=IXGBE_FCTRL_UPE ; + vmolr |=IXGBE_VMOLR_ROPE ; }if (adapter->num_vfs) {
PATCH 6/7 ixgbe: UTA table incorrectly programmed
In reply to John FastabendFrom: Greg Rose <[email protected]>
The UTA table was being set to the functional equivalent of promiscuous mode. This was resulting in traffic from the virtual function being flooded onto the wire and the PF device. This resulted in additional overhead for VF traffic sent to the network and in the case of traffic sent to the PF or another VF resulted in unwanted packets on the wire.
This was actually not the intended behavior. Now that we can program the embedded switch correctly we can remove this snippit of code. Users who want to support this should configure the FDB correctly using the FDB ops.
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 29 ------------------------- 1 files changed, 0 insertions(+), 29 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -29
@@ -2904,33 +2904,6 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter,IXGBE_WRITE_REG (hw,IXGBE_RSCCTL (reg_idx), rscctrl); } -/** -* ixgbe_set_uta - Set unicast filter table address -* @adapter: board private structure -* -* The unicast table address is a register array of 32-bit registers. -* The table is meant to be used in a way similar to how the MTA is used -* however due to certain limitations in the hardware it is necessary to -* set all the hash bits to 1 and use the VMOLR ROPE bit as a promiscuous -* enable bit to allow vlan tag stripping when promiscuous mode is enabled -**/ -static void ixgbe_set_uta (struct ixgbe_adapter *adapter) -{ -struct ixgbe_hw *hw = &adapter->hw; -int i; - -/* The UTA table only exists on 82599 hardware and newer */ -if (hw->mac.type < ixgbe_mac_82599EB) -return ; - -/* we only need to do this if VMDq is enabled */ -if (!(adapter->flags &IXGBE_FLAG_SRIOV_ENABLED )) -return ; - -for (i =0 ; i <128 ; i++) -IXGBE_WRITE_REG (hw,IXGBE_UTA (i), ~0 ); -} -#define IXGBE_MAX_RX_DESC_POLL 10static void ixgbe_rx_desc_queue_enable (struct ixgbe_adapter *adapter,struct ixgbe_ring *ring)
@@ -3224,8 +3197,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)/* Program registers for the distribution of queues */ ixgbe_setup_mrqc (adapter); -ixgbe_set_uta (adapter); -/* set_rx_buffer_len must be called before ring initialization */ ixgbe_set_rx_buffer_len (adapter);
PATCH 7/7 macvlan: add FDB bridge ops and new macvlan mode
In reply to John FastabendThis adds a new macvlan mode MACVLAN_PASSTHRU_NOPROMISC this mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
---
drivers/net/macvlan.c | 60 ++++++++++++++++++++++++++++++++++++++++++----- include/linux/if_link.h | 1 + 2 files changed, 55 insertions(+), 6 deletions(-)
drivers/net/macvlan.c +54 -6
@@ -181,6 +181,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)MACVLAN_MODE_PRIVATE |MACVLAN_MODE_VEPA |MACVLAN_MODE_PASSTHRU | +MACVLAN_MODE_PASSTHRU_NOPROMISC | MACVLAN_MODE_BRIDGE); else if (src->mode == MACVLAN_MODE_VEPA)/* flood to everyone except source */
@@ -312,7 +313,8 @@ static int macvlan_open(struct net_device *dev)int err;if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_add; }
@@ -344,12 +346,15 @@ static int macvlan_stop(struct net_device *dev)struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev; +dev_uc_unsync (lowerdev, dev); +dev_mc_unsync (lowerdev, dev); +if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,-1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_del; } -dev_mc_unsync (lowerdev, dev);if (dev->flags &IFF_ALLMULTI )dev_set_allmulti (lowerdev,-1 );
@@ -399,10 +404,11 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)dev_set_allmulti (lowerdev, dev->flags &IFF_ALLMULTI ?1 :-1 ); } -static void macvlan_set_multicast_list (struct net_device *dev) +static void macvlan_set_mac_lists (struct net_device *dev) {struct macvlan_dev *vlan =netdev_priv (dev); +dev_uc_sync (vlan->lowerdev, dev);dev_mc_sync (vlan->lowerdev, dev); }
@@ -542,6 +548,43 @@ static int macvlan_vlan_rx_kill_vid(struct net_device *dev,return 0 ; } +static int macvlan_fdb_add (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr, +u16 flags) +{ +struct macvlan_dev *vlan =netdev_priv (dev); +int err = -EINVAL ; + +if (!vlan->port->passthru) +return -EOPNOTSUPP ; + +if (is_unicast_ether_addr (addr)) + err =dev_uc_add_excl (dev, addr); +else if (is_multicast_ether_addr (addr)) + err =dev_mc_add_excl (dev, addr); + +return err; +} + +static int macvlan_fdb_del (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr) +{ +struct macvlan_dev *vlan =netdev_priv (dev); +int err = -EINVAL ; + +if (!vlan->port->passthru) +return -EOPNOTSUPP ; + +if (is_unicast_ether_addr (addr)) + err =dev_uc_del (dev, addr); +else if (is_multicast_ether_addr (addr)) + err =dev_mc_del (dev, addr); + +return err; +} +static void macvlan_ethtool_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *drvinfo) {
@@ -572,11 +615,14 @@ static const struct net_device_ops macvlan_netdev_ops = { .ndo_change_mtu = macvlan_change_mtu, .ndo_change_rx_flags = macvlan_change_rx_flags, .ndo_set_mac_address = macvlan_set_mac_address, - .ndo_set_rx_mode = macvlan_set_multicast_list, + .ndo_set_rx_mode = macvlan_set_mac_lists, .ndo_get_stats64 = macvlan_dev_get_stats64, .ndo_validate_addr = eth_validate_addr, .ndo_vlan_rx_add_vid = macvlan_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = macvlan_vlan_rx_kill_vid, + .ndo_fdb_add = macvlan_fdb_add, + .ndo_fdb_del = macvlan_fdb_del, + .ndo_fdb_dump = ndo_dflt_fdb_dump, };void macvlan_common_setup (struct net_device *dev)
@@ -648,6 +694,7 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])case MACVLAN_MODE_VEPA :case MACVLAN_MODE_BRIDGE :case MACVLAN_MODE_PASSTHRU : +case MACVLAN_MODE_PASSTHRU_NOPROMISC :break ;default :return -EINVAL ;
@@ -711,7 +758,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,if (data && data[IFLA_MACVLAN_MODE ]) vlan->mode =nla_get_u32 (data[IFLA_MACVLAN_MODE ]); -if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) { +if ((vlan->mode ==MACVLAN_MODE_PASSTHRU ) || + (vlan->mode ==MACVLAN_MODE_PASSTHRU_NOPROMISC )) {if (port->count)return -EINVAL ; port->passthru = true;
include/linux/if_link.h +1 -0
@@ -265,6 +265,7 @@ enum macvlan_mode {MACVLAN_MODE_VEPA =2 ,/* talk to other ports through ext bridge */ MACVLAN_MODE_BRIDGE =4 ,/* talk to bridge ports directly */ MACVLAN_MODE_PASSTHRU =8 ,/* take over the underlying device */ + MACVLAN_MODE_PASSTHRU_NOPROMISC = 16, /* passthru without promisc */ };/* SR-IOV virtual function management section */
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.
Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
And bridge too?
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
Quoted 152 lines
CC Roopa Prabhu <[email protected]>CC Michael S. Tsirkin <[email protected]>Signed-off-by John Fastabend <[email protected]>---
drivers/net/macvlan.c | 60 ++++++++++++++++++++++++++++++++++++++++++----- include/linux/if_link.h | 1 + 2 files changed, 55 insertions(+), 6 deletions(-)drivers/net/macvlan.c +54
-6@@ -181,6 +181,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)MACVLAN_MODE_PRIVATE |MACVLAN_MODE_VEPA |MACVLAN_MODE_PASSTHRU | +MACVLAN_MODE_PASSTHRU_NOPROMISC | MACVLAN_MODE_BRIDGE); else if (src->mode == MACVLAN_MODE_VEPA)/* flood to everyone except source */ @@ -312,7 +313,8 @@ static int macvlan_open(struct net_device *dev)int err;if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_add; }@@ -344,12 +346,15 @@ static int macvlan_stop(struct net_device *dev)struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev; +dev_uc_unsync (lowerdev, dev); +dev_mc_unsync (lowerdev, dev); +if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,-1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_del; } -dev_mc_unsync (lowerdev, dev);if (dev->flags &IFF_ALLMULTI )dev_set_allmulti (lowerdev,-1 );@@ -399,10 +404,11 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)dev_set_allmulti (lowerdev, dev->flags &IFF_ALLMULTI ?1 :-1 ); } -static void macvlan_set_multicast_list (struct net_device *dev) +static void macvlan_set_mac_lists (struct net_device *dev) {struct macvlan_dev *vlan =netdev_priv (dev); +dev_uc_sync (vlan->lowerdev, dev);dev_mc_sync (vlan->lowerdev, dev); }@@ -542,6 +548,43 @@ static int macvlan_vlan_rx_kill_vid(struct net_device *dev,return 0 ; } +static int macvlan_fdb_add (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr, +u16 flags) +{ +struct macvlan_dev *vlan =netdev_priv (dev); +int err = -EINVAL ; + +if (!vlan->port->passthru) +return -EOPNOTSUPP ; + +if (is_unicast_ether_addr (addr)) + err =dev_uc_add_excl (dev, addr); +else if (is_multicast_ether_addr (addr)) + err =dev_mc_add_excl (dev, addr); + +return err; +} + +static int macvlan_fdb_del (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr) +{ +struct macvlan_dev *vlan =netdev_priv (dev); +int err = -EINVAL ; + +if (!vlan->port->passthru) +return -EOPNOTSUPP ; + +if (is_unicast_ether_addr (addr)) + err =dev_uc_del (dev, addr); +else if (is_multicast_ether_addr (addr)) + err =dev_mc_del (dev, addr); + +return err; +} +static void macvlan_ethtool_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *drvinfo) {@@ -572,11 +615,14 @@ static const struct net_device_ops macvlan_netdev_ops = { .ndo_change_mtu = macvlan_change_mtu, .ndo_change_rx_flags = macvlan_change_rx_flags, .ndo_set_mac_address = macvlan_set_mac_address, - .ndo_set_rx_mode = macvlan_set_multicast_list, + .ndo_set_rx_mode = macvlan_set_mac_lists, .ndo_get_stats64 = macvlan_dev_get_stats64, .ndo_validate_addr = eth_validate_addr, .ndo_vlan_rx_add_vid = macvlan_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = macvlan_vlan_rx_kill_vid, + .ndo_fdb_add = macvlan_fdb_add, + .ndo_fdb_del = macvlan_fdb_del, + .ndo_fdb_dump = ndo_dflt_fdb_dump, };void macvlan_common_setup (struct net_device *dev)@@ -648,6 +694,7 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])case MACVLAN_MODE_VEPA :case MACVLAN_MODE_BRIDGE :case MACVLAN_MODE_PASSTHRU : +case MACVLAN_MODE_PASSTHRU_NOPROMISC :break ;default :return -EINVAL ;@@ -711,7 +758,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,if (data && data[IFLA_MACVLAN_MODE ]) vlan->mode =nla_get_u32 (data[IFLA_MACVLAN_MODE ]); -if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) { +if ((vlan->mode ==MACVLAN_MODE_PASSTHRU ) || + (vlan->mode ==MACVLAN_MODE_PASSTHRU_NOPROMISC )) {if (port->count)return -EINVAL ; port->passthru = true;include/linux/if_link.h +1
-0@@ -265,6 +265,7 @@ enum macvlan_mode {MACVLAN_MODE_VEPA =2 ,/* talk to other ports through ext bridge */ MACVLAN_MODE_BRIDGE =4 ,/* talk to bridge ports directly */ MACVLAN_MODE_PASSTHRU =8 ,/* take over the underlying device */ + MACVLAN_MODE_PASSTHRU_NOPROMISC = 16, /* passthru without promisc */ };/* SR-IOV virtual function management section */
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 24 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
And bridge too?
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
Quoted 5 lines
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
One other question I forgot:
Quoted 45 lines
Quoted 45 lines
CC Roopa Prabhu <[email protected]>CC Michael S. Tsirkin <[email protected]>Signed-off-by John Fastabend <[email protected]>---
drivers/net/macvlan.c | 60 ++++++++++++++++++++++++++++++++++++++++++----- include/linux/if_link.h | 1 + 2 files changed, 55 insertions(+), 6 deletions(-)drivers/net/macvlan.c +8
-2@@ -181,6 +181,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)MACVLAN_MODE_PRIVATE |MACVLAN_MODE_VEPA |MACVLAN_MODE_PASSTHRU | +MACVLAN_MODE_PASSTHRU_NOPROMISC | MACVLAN_MODE_BRIDGE); else if (src->mode == MACVLAN_MODE_VEPA)/* flood to everyone except source */ @@ -312,7 +313,8 @@ static int macvlan_open(struct net_device *dev)int err;if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_add; }@@ -344,12 +346,15 @@ static int macvlan_stop(struct net_device *dev)struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev; +dev_uc_unsync (lowerdev, dev); +dev_mc_unsync (lowerdev, dev); +if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,-1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_del; }
Quoted 6 lines
drivers/net/macvlan.c static void macvlan_change_rx_flags(struct net_device *dev, int change) · line 404
Quoted 6 lines
drivers/net/macvlan.c +0
-1-dev_mc_unsync (lowerdev, dev);if (dev->flags &IFF_ALLMULTI )dev_set_allmulti (lowerdev,-1 );@@ -399,10 +404,11 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)dev_set_allmulti (lowerdev, dev->flags &IFF_ALLMULTI ?1 :-1 );
In the new mode, do we want to have promisc on lowerdev follow whatever is set on the macvlan, like we do for allmulti?
I'm not sure at this point - what do others think?
Quoted 101 lines
Quoted 101 lines
drivers/net/macvlan.c +46
-3} -static void macvlan_set_multicast_list (struct net_device *dev) +static void macvlan_set_mac_lists (struct net_device *dev) {struct macvlan_dev *vlan =netdev_priv (dev); +dev_uc_sync (vlan->lowerdev, dev);dev_mc_sync (vlan->lowerdev, dev); }@@ -542,6 +548,43 @@ static int macvlan_vlan_rx_kill_vid(struct net_device *dev,return 0 ; } +static int macvlan_fdb_add (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr, +u16 flags) +{ +struct macvlan_dev *vlan =netdev_priv (dev); +int err = -EINVAL ; + +if (!vlan->port->passthru) +return -EOPNOTSUPP ; + +if (is_unicast_ether_addr (addr)) + err =dev_uc_add_excl (dev, addr); +else if (is_multicast_ether_addr (addr)) + err =dev_mc_add_excl (dev, addr); + +return err; +} + +static int macvlan_fdb_del (struct ndmsg *ndm, +struct net_device *dev, +unsigned char *addr) +{ +struct macvlan_dev *vlan =netdev_priv (dev); +int err = -EINVAL ; + +if (!vlan->port->passthru) +return -EOPNOTSUPP ; + +if (is_unicast_ether_addr (addr)) + err =dev_uc_del (dev, addr); +else if (is_multicast_ether_addr (addr)) + err =dev_mc_del (dev, addr); + +return err; +} +static void macvlan_ethtool_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *drvinfo) {@@ -572,11 +615,14 @@ static const struct net_device_ops macvlan_netdev_ops = { .ndo_change_mtu = macvlan_change_mtu, .ndo_change_rx_flags = macvlan_change_rx_flags, .ndo_set_mac_address = macvlan_set_mac_address, - .ndo_set_rx_mode = macvlan_set_multicast_list, + .ndo_set_rx_mode = macvlan_set_mac_lists, .ndo_get_stats64 = macvlan_dev_get_stats64, .ndo_validate_addr = eth_validate_addr, .ndo_vlan_rx_add_vid = macvlan_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = macvlan_vlan_rx_kill_vid, + .ndo_fdb_add = macvlan_fdb_add, + .ndo_fdb_del = macvlan_fdb_del, + .ndo_fdb_dump = ndo_dflt_fdb_dump, };void macvlan_common_setup (struct net_device *dev)@@ -648,6 +694,7 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])case MACVLAN_MODE_VEPA :case MACVLAN_MODE_BRIDGE :case MACVLAN_MODE_PASSTHRU : +case MACVLAN_MODE_PASSTHRU_NOPROMISC :break ;default :return -EINVAL ;@@ -711,7 +758,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,if (data && data[IFLA_MACVLAN_MODE ]) vlan->mode =nla_get_u32 (data[IFLA_MACVLAN_MODE ]); -if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) { +if ((vlan->mode ==MACVLAN_MODE_PASSTHRU ) || + (vlan->mode ==MACVLAN_MODE_PASSTHRU_NOPROMISC )) {if (port->count)return -EINVAL ; port->passthru = true;include/linux/if_link.h +1
-0@@ -265,6 +265,7 @@ enum macvlan_mode {MACVLAN_MODE_VEPA =2 ,/* talk to other ports through ext bridge */ MACVLAN_MODE_BRIDGE =4 ,/* talk to bridge ports directly */ MACVLAN_MODE_PASSTHRU =8 ,/* take over the underlying device */ + MACVLAN_MODE_PASSTHRU_NOPROMISC = 16, /* passthru without promisc */ };/* SR-IOV virtual function management section */
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 33 lines · Michael S. Tsirkin
Quoted 24 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
And bridge too?
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
Quoted 5 lines
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
One other question I forgot:
[...]
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/net/macvlan.c +5
-2@@ -344,12 +346,15 @@ static int macvlan_stop(struct net_device *dev)struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev; +dev_uc_unsync (lowerdev, dev); +dev_mc_unsync (lowerdev, dev); +if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,-1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_del; } -dev_mc_unsync (lowerdev, dev);if (dev->flags &IFF_ALLMULTI )dev_set_allmulti (lowerdev,-1 );
Quoted 7 lines
Quoted 2 lines
drivers/net/macvlan.c static void macvlan_change_rx_flags(struct net_device *dev, int change) · line 404
Quoted 2 lines
drivers/net/macvlan.c +0
-0@@ -399,10 +404,11 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)dev_set_allmulti (lowerdev, dev->flags &IFF_ALLMULTI ?1 :-1 );In the new mode, do we want to have promisc on lowerdev follow whatever is set on the macvlan, like we do for allmulti?
I'm not sure at this point - what do others think?
Just to enumerate why you would need this: (1) socket set with PACKET_MR_MULTICAST and (2) something like mrouted is running on the macvlan (3) maybe some case I missed?
Don't you need CAP_NET_RAW to set these though anyways? So I wouldn't think it would be a problem. I assume if a user has CAP_NET_RAW or UUID 0 they really should be able to set this up.
.John
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 68 lines · John Fastabend
Quoted 33 lines · Michael S. Tsirkin
Quoted 24 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
And bridge too?
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
Quoted 5 lines
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
One other question I forgot:
[...]
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/net/macvlan.c +5
-2@@ -344,12 +346,15 @@ static int macvlan_stop(struct net_device *dev)struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev; +dev_uc_unsync (lowerdev, dev); +dev_mc_unsync (lowerdev, dev); +if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,-1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_del; } -dev_mc_unsync (lowerdev, dev);if (dev->flags &IFF_ALLMULTI )dev_set_allmulti (lowerdev,-1 );Quoted 7 lines
Quoted 2 lines
drivers/net/macvlan.c static void macvlan_change_rx_flags(struct net_device *dev, int change) · line 404
Quoted 2 lines
drivers/net/macvlan.c +0
-0@@ -399,10 +404,11 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)dev_set_allmulti (lowerdev, dev->flags &IFF_ALLMULTI ?1 :-1 );In the new mode, do we want to have promisc on lowerdev follow whatever is set on the macvlan, like we do for allmulti?
I'm not sure at this point - what do others think?Just to enumerate why you would need this: (1) socket set with
PACKET_MR_MULTICASTand (2) something like mrouted is running on the macvlan (3) maybe some case I missed?
Quoted 6 lines
Don't you need
CAP_NET_RAWto set these though anyways? So I wouldn't think it would be a problem. I assume if a user hasCAP_NET_RAWor UUID 0 they really should be able to set this up..John
I am not sure, really.
But I note that with a security mechanism such as selinux, CAP_NET_RAW might be insufficient to change the underlying device.
So there might be value in being able to change it in
a controlled manner through macvlan.
There's also something to be said for being able to let management deal with macvlan devices (and there are some very complex tools for that around) while keeping a simple script around for the physical one and knowing that they won't disrupt each other.
Signature · 1 line
MST
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 82 lines · Michael S. Tsirkin
Quoted 68 lines · John Fastabend
Quoted 33 lines · Michael S. Tsirkin
Quoted 24 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
And bridge too?
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
Quoted 5 lines
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
One other question I forgot:
[...]
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/net/macvlan.c +5
-2@@ -344,12 +346,15 @@ static int macvlan_stop(struct net_device *dev)struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev; +dev_uc_unsync (lowerdev, dev); +dev_mc_unsync (lowerdev, dev); +if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,-1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_del; } -dev_mc_unsync (lowerdev, dev);if (dev->flags &IFF_ALLMULTI )dev_set_allmulti (lowerdev,-1 );Quoted 7 lines
Quoted 2 lines
drivers/net/macvlan.c static void macvlan_change_rx_flags(struct net_device *dev, int change) · line 404
Quoted 2 lines
drivers/net/macvlan.c +0
-0@@ -399,10 +404,11 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)dev_set_allmulti (lowerdev, dev->flags &IFF_ALLMULTI ?1 :-1 );In the new mode, do we want to have promisc on lowerdev follow whatever is set on the macvlan, like we do for allmulti?
I'm not sure at this point - what do others think?Just to enumerate why you would need this: (1) socket set with
PACKET_MR_MULTICASTand (2) something like mrouted is running on the macvlan (3) maybe some case I missed?Quoted 6 lines
Don't you need
CAP_NET_RAWto set these though anyways? So I wouldn't think it would be a problem. I assume if a user hasCAP_NET_RAWor UUID 0 they really should be able to set this up..John
I am not sure, really.
But I note that with a security mechanism such as selinux,CAP_NET_RAWmight be insufficient to change the underlying device.
So there might be value in being able to change it in
a controlled manner through macvlan.
Quoted 6 lines
There's also something to be said for being able to let management deal with macvlan devices (and there are some very complex tools for that around) while keeping a simple script around for the physical one and knowing that they won't disrupt each other.
If people really _need_/_want_ this then I guess we can add another flag. I don't think we should to tie this into the FDB bits creating an interface with strange side effects is probably a poor design. Much better IMHO to have an explicit bit if and when this is needed.
.John
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 90 lines · John Fastabend
Quoted 82 lines · Michael S. Tsirkin
Quoted 68 lines · John Fastabend
Quoted 33 lines · Michael S. Tsirkin
Quoted 24 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
And bridge too?
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
Quoted 5 lines
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
One other question I forgot:
[...]
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/net/macvlan.c +5
-2@@ -344,12 +346,15 @@ static int macvlan_stop(struct net_device *dev)struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev; +dev_uc_unsync (lowerdev, dev); +dev_mc_unsync (lowerdev, dev); +if (vlan->port->passthru) { -dev_set_promiscuity (lowerdev,-1 ); +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) +dev_set_promiscuity (lowerdev,1 ); goto hash_del; } -dev_mc_unsync (lowerdev, dev);if (dev->flags &IFF_ALLMULTI )dev_set_allmulti (lowerdev,-1 );Quoted 7 lines
Quoted 2 lines
drivers/net/macvlan.c static void macvlan_change_rx_flags(struct net_device *dev, int change) · line 404
Quoted 2 lines
drivers/net/macvlan.c +0
-0@@ -399,10 +404,11 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)dev_set_allmulti (lowerdev, dev->flags &IFF_ALLMULTI ?1 :-1 );In the new mode, do we want to have promisc on lowerdev follow whatever is set on the macvlan, like we do for allmulti?
I'm not sure at this point - what do others think?Just to enumerate why you would need this: (1) socket set with
PACKET_MR_MULTICASTand (2) something like mrouted is running on the macvlan (3) maybe some case I missed?Quoted 6 lines
Don't you need
CAP_NET_RAWto set these though anyways? So I wouldn't think it would be a problem. I assume if a user hasCAP_NET_RAWor UUID 0 they really should be able to set this up..John
I am not sure, really.
But I note that with a security mechanism such as selinux,CAP_NET_RAWmight be insufficient to change the underlying device.
So there might be value in being able to change it in
a controlled manner through macvlan.Quoted 6 lines
There's also something to be said for being able to let management deal with macvlan devices (and there are some very complex tools for that around) while keeping a simple script around for the physical one and knowing that they won't disrupt each other.
Quoted 7 lines
If people really _need_/_want_ this then I guess we can add another flag. I don't think we should to tie this into the FDB bits creating an interface with strange side effects is probably a poor design. Much better IMHO to have an explicit bit if and when this is needed.
.John
OK so with the new flag, you will also disable the forwarding of ALLMULTI from macvlan to lowerdev? Fair enough.
Signature · 1 line
MST
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
In reply to Michael S. TsirkinQuoted 12 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.
Quoted 7 lines
Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
And bridge too?
Yes I called this mode VEB here but this is defined in if_link.h as IFLA_MACVLAN_MODE_BRIDGE. From a IEEE point of view I think the macvlan bridge mode acts more like a 802.1Q VEB then a 802.1d bridge.
Quoted 5 lines
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
correct. But requires extra work to the hash table so the forwarding works correctly.
Quoted 6 lines
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
For VEPA and bridge modes this makes sense to me. If you want the flood behavior you can create it by adding the addr to all the devices or just to a subset of them to get the non-flooding capabilities.
.John
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 18 lines · John Fastabend
Quoted 17 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
Quoted 7 lines
Quoted 2 lines
And bridge too?
Yes I called this mode VEB here but this is defined in
if_link.hasIFLA_MACVLAN_MODE_BRIDGE. From a IEEE point of view I think the macvlan bridge mode acts more like a 802.1Q VEB then a 802.1d bridge.
grep didn't find IFLA_MACVLAN_MODE_BRIDGE - which kernel are you looking at?
Quoted 9 lines
Quoted 5 lines
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
correct. But requires extra work to the hash table so the forwarding works correctly.
Quoted 8 lines
Quoted 6 lines
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
For VEPA and bridge modes this makes sense to me.
Hmm okay, but this would mean we should convertMACVLAN_MODE_PASSTHRU_NOPROMISC to something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE | MACVLAN_MODE_FLAG_XXXXX
and document that it does not promise to flood
multicast.
Quoted 6 lines
If you want
the flood behavior you can create it by adding the addr to all the devices or just to a subset of them to get the non-flooding capabilities..John
BTW we seem to try to flood in pass-through too, not sure why.
Signature · 1 line
MST
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 22 lines · Michael S. Tsirkin
Quoted 21 lines · John Fastabend
Quoted 19 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
This adds a new macvlan mode
MACVLAN_PASSTHRU_NOPROMISCthis mode acts the same as the original passthru mode _except_ it does not set promiscuous mode on the lowerdev. Because the lowerdev is not put in promiscuous mode any unicast or multicast addresses the device should receive must be explicitely added with the FDB bridge ops. In many use cases the management stack will know the mac addresses needed (maybe negotiated via EVB/VDP) or may require only receiving known "good" mac addresses. This mode with the FDB ops supports this usage model.Looks good to me. Some questions below:
Quoted 2 lines
This patch is a result of Roopa Prabhu's work. Follow up patches are needed for VEPA and VEB macvlan modes.
And bridge too?
Quoted 7 lines
Quoted 4 lines
Yes I called this mode VEB here but this is defined in
if_link.hasIFLA_MACVLAN_MODE_BRIDGE. From a IEEE point of view I think the macvlan bridge mode acts more like a 802.1Q VEB then a 802.1d bridge.grep didn't find
IFLA_MACVLAN_MODE_BRIDGE- which kernel are you looking at?
grr sorry typo MACVLAN_MODE_BRIDGE in if_link.h
Quoted 19 lines
Quoted 10 lines
Quoted 6 lines
Also, my understanding is that other modes won't need a flag like this since they don't put the device in promisc mode initially, so no assumptions are broken if we require all addresses to be declared, right?
correct. But requires extra work to the hash table so the forwarding works correctly.
Quoted 8 lines
Quoted 6 lines
A final question: I think we'll later add a macvlan mode that does not flood all multicasts. This would change behaviour in an incompatible way so we'll probably need yet another flag. Would it make sense to combine this functionality with nopromisc so we have less modes to support?
For VEPA and bridge modes this makes sense to me.
Quoted 8 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXXand document that it does not promise to flood
multicast.
How about changing MACVLAN_MODE_PASSTHRU_NOPROMISC -> MACVLAN_MODE_NOPORMISC for this patch. Then a follow on series can rework bridge
and VEPA to use it as well.
Quoted 9 lines
Quoted 6 lines
If you want
the flood behavior you can create it by adding the addr to all the devices or just to a subset of them to get the non-flooding capabilities..John
BTW we seem to try to flood in pass-through too, not sure why.
Suppose your looking at macvlan_handle_frame()? It does seem unneeded.
.John
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 5 lines · John Fastabend
Quoted 5 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXX
Quoted 7 lines
Quoted 3 lines
and document that it does not promise to flood
multicast.How about changing
MACVLAN_MODE_PASSTHRU_NOPROMISC->MACVLAN_MODE_NOPORMISCfor this patch. Then a follow on series can rework bridge
and VEPA to use it as well.
Right. We probably need a better name if it's going to affect other things besides promisc though.
Quoted 14 lines
Quoted 9 lines
Quoted 6 lines
If you want
the flood behavior you can create it by adding the addr to all the devices or just to a subset of them to get the non-flooding capabilities..John
BTW we seem to try to flood in pass-through too, not sure why.
Suppose your looking at
macvlan_handle_frame()? It does seem unneeded..John
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · John Fastabend
Quoted 8 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXXand document that it does not promise to flood
multicast.
Quoted 7 lines
Quoted 3 lines
How about changing
MACVLAN_MODE_PASSTHRU_NOPROMISC->MACVLAN_MODE_NOPORMISCfor this patch. Then a follow on series can rework bridge
and VEPA to use it as well.Right. We probably need a better name if it's going to affect other things besides promisc though.
how about MACVLAN_MODE_FDBFLAG?
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 15 lines · John Fastabend
Quoted 14 lines · Michael S. Tsirkin
Quoted 12 lines · John Fastabend
Quoted 8 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXXand document that it does not promise to flood
multicast.How about changing
MACVLAN_MODE_PASSTHRU_NOPROMISC->MACVLAN_MODE_NOPORMISCfor this patch. Then a follow on series can rework bridge
and VEPA to use it as well.
Quoted 5 lines
Quoted 3 lines
Right. We probably need a better name if it's going to affect other things besides promisc though.
how about
MACVLAN_MODE_FDBFLAG?
The idea being that no one figures out what this means so no one will make any wrong assumptions? ;)
Signature · 1 line
MST
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 16 lines · Michael S. Tsirkin
Quoted 15 lines · John Fastabend
Quoted 14 lines · Michael S. Tsirkin
Quoted 12 lines · John Fastabend
Quoted 8 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXXand document that it does not promise to flood
multicast.How about changing
MACVLAN_MODE_PASSTHRU_NOPROMISC->MACVLAN_MODE_NOPORMISCfor this patch. Then a follow on series can rework bridge
and VEPA to use it as well.
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Right. We probably need a better name if it's going to affect other things besides promisc though.
how about
MACVLAN_MODE_FDBFLAG?The idea being that no one figures out what this means so no one will make any wrong assumptions? ;)
Well its a flag to enable the FDB (forwarding database) ops and skip dev_set_promisc() on passthru mode. Any better ideas? Maybe MACVLAN_MODE_FDBENABLE or MACVLAN_MODE_MANAGE_FDB?
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 18 lines · John Fastabend
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · John Fastabend
Quoted 15 lines · Michael S. Tsirkin
Quoted 11 lines · John Fastabend
Quoted 8 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXXand document that it does not promise to flood
multicast.How about changing
MACVLAN_MODE_PASSTHRU_NOPROMISC->MACVLAN_MODE_NOPORMISCfor this patch. Then a follow on series can rework bridge
and VEPA to use it as well.Right. We probably need a better name if it's going to affect other things besides promisc though.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
how about
MACVLAN_MODE_FDBFLAG?The idea being that no one figures out what this means so no one will make any wrong assumptions? ;)
Well its a flag to enable the FDB (forwarding database) ops and skip
dev_set_promisc()on passthru mode. Any better ideas? MaybeMACVLAN_MODE_FDBENABLEorMACVLAN_MODE_MANAGE_FDB?
Do we need to introduce another mode? I think this patch is enabling passthru mode without the need to put the underlying device in promiscuous mode. So basically we can consider this patch as an optimization.
Thanks
Sridhar
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 26 lines · Sridhar Samudrala
Quoted 18 lines · John Fastabend
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · John Fastabend
Quoted 15 lines · Michael S. Tsirkin
Quoted 11 lines · John Fastabend
Quoted 8 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXXand document that it does not promise to flood
multicast.How about changing
MACVLAN_MODE_PASSTHRU_NOPROMISC->MACVLAN_MODE_NOPORMISCfor this patch. Then a follow on series can rework bridge
and VEPA to use it as well.Right. We probably need a better name if it's going to affect other things besides promisc though.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
how about
MACVLAN_MODE_FDBFLAG?The idea being that no one figures out what this means so no one will make any wrong assumptions? ;)
Well its a flag to enable the FDB (forwarding database) ops and skip
dev_set_promisc()on passthru mode. Any better ideas? MaybeMACVLAN_MODE_FDBENABLEorMACVLAN_MODE_MANAGE_FDB?
Quoted 7 lines
Do we need to introduce another mode? I think this patch is enabling passthru mode without the need to put the underlying device in promiscuous mode. So basically we can consider this patch as an optimization.
Thanks
Sridhar
Sridhar, Michael,
After thinking about this a bit I would propose keeping this patch as is. Or if we prefer I can make this a flag but I don't think that helps much. passthru mode is the only macvlan mode that calls dev_set_promiscuity(). Either way I think this mode or flag should _only_ toggle the call to dev_set_promiscuity().
Setting multicast dev->flag IFF_ALLMULTI seems to be a completely separate optimization that we can work with a follow up patch.
Any thoughts?
Thanks for the feedback,
John
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 43 lines · John Fastabend
Quoted 26 lines · Sridhar Samudrala
Quoted 18 lines · John Fastabend
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · John Fastabend
Quoted 15 lines · Michael S. Tsirkin
Quoted 11 lines · John Fastabend
Quoted 8 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXXand document that it does not promise to flood
multicast.How about changing
MACVLAN_MODE_PASSTHRU_NOPROMISC->MACVLAN_MODE_NOPORMISCfor this patch. Then a follow on series can rework bridge
and VEPA to use it as well.Right. We probably need a better name if it's going to affect other things besides promisc though.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
how about
MACVLAN_MODE_FDBFLAG?The idea being that no one figures out what this means so no one will make any wrong assumptions? ;)
Well its a flag to enable the FDB (forwarding database) ops and skip
dev_set_promisc()on passthru mode. Any better ideas? MaybeMACVLAN_MODE_FDBENABLEorMACVLAN_MODE_MANAGE_FDB?Quoted 7 lines
Do we need to introduce another mode? I think this patch is enabling passthru mode without the need to put the underlying device in promiscuous mode. So basically we can consider this patch as an optimization.
Thanks
SridharSridhar, Michael,
After thinking about this a bit I would propose keeping this patch as is. Or if we prefer I can make this a flag but I don't think that helps much. passthru mode is the only macvlan mode that calls
dev_set_promiscuity(). Either way I think this mode or flag should _only_ toggle the call todev_set_promiscuity().
Quoted 7 lines
Setting multicast
dev->flagIFF_ALLMULTIseems to be a completely separate optimization that we can work with a follow up patch.Any thoughts?
Thanks for the feedback,
John
I agree it's a separate optimization. But if we let the
number of supported modes explode (MACVLAN_MODE_PASSTHRU_NOPROMISC MACVLAN_MODE_PASSTHRU_NOALLMULTI ....) supporting them all and combinations thereof might become a problem.
I'm looking for an interface solution that will limit this overhead without breaking existing setups.
One idea was to have a flag that says basically "really obey device configuration". Yes if we do this we can then split the support to multiple patches and consider each individual one a bugfix, though if we put a known broken solution in 3.5 there's a danger that someone will come to depend on the broken behaviour. Other ideas?
Signature · 1 line
MST
Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
Quoted 52 lines · Michael S. Tsirkin
Quoted 43 lines · John Fastabend
Quoted 26 lines · Sridhar Samudrala
Quoted 18 lines · John Fastabend
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · John Fastabend
Quoted 15 lines · Michael S. Tsirkin
Quoted 11 lines · John Fastabend
Quoted 8 lines
Hmm okay, but this would mean we should convert
MACVLAN_MODE_PASSTHRU_NOPROMISCto something
that can combined with all modes. E.g.MACVLAN_MODE_BRIDGE|MACVLAN_MODE_FLAG_XXXXXand document that it does not promise to flood
multicast.How about changing
MACVLAN_MODE_PASSTHRU_NOPROMISC->MACVLAN_MODE_NOPORMISCfor this patch. Then a follow on series can rework bridge
and VEPA to use it as well.Right. We probably need a better name if it's going to affect other things besides promisc though.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
how about
MACVLAN_MODE_FDBFLAG?The idea being that no one figures out what this means so no one will make any wrong assumptions? ;)
Well its a flag to enable the FDB (forwarding database) ops and skip
dev_set_promisc()on passthru mode. Any better ideas? MaybeMACVLAN_MODE_FDBENABLEorMACVLAN_MODE_MANAGE_FDB?Quoted 7 lines
Do we need to introduce another mode? I think this patch is enabling passthru mode without the need to put the underlying device in promiscuous mode. So basically we can consider this patch as an optimization.
Thanks
SridharSridhar, Michael,
After thinking about this a bit I would propose keeping this patch as is. Or if we prefer I can make this a flag but I don't think that helps much. passthru mode is the only macvlan mode that calls
dev_set_promiscuity(). Either way I think this mode or flag should _only_ toggle the call todev_set_promiscuity().Quoted 7 lines
Setting multicast
dev->flagIFF_ALLMULTIseems to be a completely separate optimization that we can work with a follow up patch.Any thoughts?
Thanks for the feedback,
John
Quoted 8 lines
I agree it's a separate optimization. But if we let the
number of supported modes explode (MACVLAN_MODE_PASSTHRU_NOPROMISCMACVLAN_MODE_PASSTHRU_NOALLMULTI....) supporting them all and combinations thereof might become a problem.I'm looking for an interface solution that will limit this overhead without breaking existing setups.
I'm going to respin this series today. I'll try to rework this with a flags field so that we can set nopromisc and noallmutli using flags and not have the supported mode space explode.
Quoted 8 lines
One idea was to have a flag that says basically "really obey device configuration". Yes if we do this we can then split the support to multiple patches and consider each individual one a bugfix, though if we put a known broken solution in 3.5 there's a danger that someone will come to depend on the broken behaviour. Other ideas?
This sound reasonable.
Thanks,
John
Quoted 35 lines · On Mon, 09 Apr 2012 15:00:11 -0700 John Fastabend <[email protected]>…
The following series is a submission for net-next to allow embedded switches and other stacked devices other then the Linux bridge to manage a forwarding database.
This was previously posted here (where it was deferred for more review and testing)
http://lists.openwall.net/netdev/2012/03/19/26
This series adds macvlan support per discussions with Roopa and Michael. Also ixgbe was updated to support adding multicast addresses per request from Greg Rose.
Finally cleanups in the generic dump routines were added for multicast to support ixgbe and macvlan use cases.
Thanks to everyone for the helpful review and comments. As always any comments/feedback welcome.
.John
---
Greg Rose (1):
ixgbe: UTA table incorrectly programmedJohn Fastabend (6):
macvlan: add FDB bridge ops and new macvlan mode
ixgbe: allow RAR table to be updated in promisc mode
ixgbe: enable FDB netdevice ops
net: add fdb generic dump routine
net:addr_list: add exclusivedev_uc_addanddev_mc_add
net: add generic PF_BRIDGE:RTM_ FDB hooks
Quoted 14 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 121 ++++++++++---- drivers/net/macvlan.c | 60 ++++++- include/linux/if_link.h | 1 include/linux/neighbour.h | 3 include/linux/netdevice.h | 28 +++ include/linux/rtnetlink.h | 4 net/bridge/br_device.c | 3 net/bridge/br_fdb.c | 128 ++++----------- net/bridge/br_netlink.c | 12 - net/bridge/br_private.h | 15 +- net/core/dev_addr_lists.c | 97 ++++++++++-- net/core/rtnetlink.c | 209 +++++++++++++++++++++++++ 12 files changed, 508 insertions(+), 173 deletions(-)
How do statistics work in this case? What if you wanted to do BRIDGE MIB?
Quoted 53 lines · Stephen Hemminger
Quoted 35 lines · On Mon, 09 Apr 2012 15:00:11 -0700 John Fastabend <[email protected]>…
The following series is a submission for net-next to allow embedded switches and other stacked devices other then the Linux bridge to manage a forwarding database.
This was previously posted here (where it was deferred for more review and testing)
http://lists.openwall.net/netdev/2012/03/19/26
This series adds macvlan support per discussions with Roopa and Michael. Also ixgbe was updated to support adding multicast addresses per request from Greg Rose.
Finally cleanups in the generic dump routines were added for multicast to support ixgbe and macvlan use cases.
Thanks to everyone for the helpful review and comments. As always any comments/feedback welcome.
.John
---
Greg Rose (1):
ixgbe: UTA table incorrectly programmedJohn Fastabend (6):
macvlan: add FDB bridge ops and new macvlan mode
ixgbe: allow RAR table to be updated in promisc mode
ixgbe: enable FDB netdevice ops
net: add fdb generic dump routine
net:addr_list: add exclusivedev_uc_addanddev_mc_add
net: add generic PF_BRIDGE:RTM_ FDB hooksQuoted 14 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 121 ++++++++++---- drivers/net/macvlan.c | 60 ++++++- include/linux/if_link.h | 1 include/linux/neighbour.h | 3 include/linux/netdevice.h | 28 +++ include/linux/rtnetlink.h | 4 net/bridge/br_device.c | 3 net/bridge/br_fdb.c | 128 ++++----------- net/bridge/br_netlink.c | 12 - net/bridge/br_private.h | 15 +- net/core/dev_addr_lists.c | 97 ++++++++++-- net/core/rtnetlink.c | 209 +++++++++++++++++++++++++ 12 files changed, 508 insertions(+), 173 deletions(-)
Quoted 1 line
How do statistics work in this case? What if you wanted to do BRIDGE MIB?
I expect we will need to do the same sort of thing for PF_BRIDGE:RTM_GETLINK to dump the statistics for an embedded or stacked bridge. This series only gets the forwarding database setup. All the other entries in the MIB still need to be populated. What I would like is to be able to write a BRIDGE MIB implementation and have it work with any of the bridging components in the linux kernel. But I don't think that should block this series.
Make sense?
Based on a quick scan I'm not sure the existing net/bridge code has one place to pull all the stats from anyways looks like you might have to read some sysfs entries AND do some netlink commands. I would have to check that though. It is on my todo list to create a bridge mib for some of the EVB cases. Of course if someone else got to it that would be great.
.John