diff options
author | John Fastabend <john.r.fastabend@intel.com> | 2011-06-06 00:27:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-06 19:43:43 -0400 |
commit | 8d13e670d3fb83f4668c9e37196c3bbf5b9f094c (patch) | |
tree | c921e3e49d089fe315ff356a354b2f7c6558ecbe /drivers/net | |
parent | 5d0c90cf4d417ccafcd1af4ec32945c3f80e98e2 (diff) |
macvlan: add VLAN filters to lowerdev
Stacking VLANs on top of the macvlan device does not
work if the lowerdev device is using vlan filters set
by NETIF_F_HW_VLAN_FILTER. Add ndo ops to pass vlan
calls to lowerdev.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/macvlan.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index d6aeaa5f25ea..cc67cbe670cb 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -414,7 +414,8 @@ static struct lock_class_key macvlan_netdev_addr_lock_key; | |||
414 | #define MACVLAN_FEATURES \ | 414 | #define MACVLAN_FEATURES \ |
415 | (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ | 415 | (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ |
416 | NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ | 416 | NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ |
417 | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM) | 417 | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \ |
418 | NETIF_F_HW_VLAN_FILTER) | ||
418 | 419 | ||
419 | #define MACVLAN_STATE_MASK \ | 420 | #define MACVLAN_STATE_MASK \ |
420 | ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT)) | 421 | ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT)) |
@@ -509,6 +510,39 @@ static struct rtnl_link_stats64 *macvlan_dev_get_stats64(struct net_device *dev, | |||
509 | return stats; | 510 | return stats; |
510 | } | 511 | } |
511 | 512 | ||
513 | static void macvlan_vlan_rx_register(struct net_device *dev, | ||
514 | struct vlan_group *grp) | ||
515 | { | ||
516 | struct macvlan_dev *vlan = netdev_priv(dev); | ||
517 | struct net_device *lowerdev = vlan->lowerdev; | ||
518 | const struct net_device_ops *ops = lowerdev->netdev_ops; | ||
519 | |||
520 | if (ops->ndo_vlan_rx_register) | ||
521 | ops->ndo_vlan_rx_register(lowerdev, grp); | ||
522 | } | ||
523 | |||
524 | static void macvlan_vlan_rx_add_vid(struct net_device *dev, | ||
525 | unsigned short vid) | ||
526 | { | ||
527 | struct macvlan_dev *vlan = netdev_priv(dev); | ||
528 | struct net_device *lowerdev = vlan->lowerdev; | ||
529 | const struct net_device_ops *ops = lowerdev->netdev_ops; | ||
530 | |||
531 | if (ops->ndo_vlan_rx_add_vid) | ||
532 | ops->ndo_vlan_rx_add_vid(lowerdev, vid); | ||
533 | } | ||
534 | |||
535 | static void macvlan_vlan_rx_kill_vid(struct net_device *dev, | ||
536 | unsigned short vid) | ||
537 | { | ||
538 | struct macvlan_dev *vlan = netdev_priv(dev); | ||
539 | struct net_device *lowerdev = vlan->lowerdev; | ||
540 | const struct net_device_ops *ops = lowerdev->netdev_ops; | ||
541 | |||
542 | if (ops->ndo_vlan_rx_kill_vid) | ||
543 | ops->ndo_vlan_rx_kill_vid(lowerdev, vid); | ||
544 | } | ||
545 | |||
512 | static void macvlan_ethtool_get_drvinfo(struct net_device *dev, | 546 | static void macvlan_ethtool_get_drvinfo(struct net_device *dev, |
513 | struct ethtool_drvinfo *drvinfo) | 547 | struct ethtool_drvinfo *drvinfo) |
514 | { | 548 | { |
@@ -541,6 +575,9 @@ static const struct net_device_ops macvlan_netdev_ops = { | |||
541 | .ndo_set_multicast_list = macvlan_set_multicast_list, | 575 | .ndo_set_multicast_list = macvlan_set_multicast_list, |
542 | .ndo_get_stats64 = macvlan_dev_get_stats64, | 576 | .ndo_get_stats64 = macvlan_dev_get_stats64, |
543 | .ndo_validate_addr = eth_validate_addr, | 577 | .ndo_validate_addr = eth_validate_addr, |
578 | .ndo_vlan_rx_register = macvlan_vlan_rx_register, | ||
579 | .ndo_vlan_rx_add_vid = macvlan_vlan_rx_add_vid, | ||
580 | .ndo_vlan_rx_kill_vid = macvlan_vlan_rx_kill_vid, | ||
544 | }; | 581 | }; |
545 | 582 | ||
546 | void macvlan_common_setup(struct net_device *dev) | 583 | void macvlan_common_setup(struct net_device *dev) |