diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-12-08 08:11:17 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-09 04:52:42 +0400 |
commit | 87002b03baabd2b8f6281ab6411ed88d24958de1 (patch) | |
tree | 0e5730c0d1ba887488ba420d4ea89a230f272c51 /net/8021q/vlan_core.c | |
parent | 8e586137e6b63af1e881b328466ab5ffbe562510 (diff) | |
download | linux-87002b03baabd2b8f6281ab6411ed88d24958de1.tar.xz |
net: introduce vlan_vid_[add/del] and use them instead of direct [add/kill]_vid ndo calls
This patch adds wrapper for ndo_vlan_rx_add_vid/ndo_vlan_rx_kill_vid
functions. Check for NETIF_F_HW_VLAN_FILTER feature is done in this
wrapper.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan_core.c')
-rw-r--r-- | net/8021q/vlan_core.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 85241f044294..544f9cb9678c 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -146,3 +146,26 @@ err_free: kfree_skb(skb); return NULL; } + +int vlan_vid_add(struct net_device *dev, unsigned short vid) +{ + const struct net_device_ops *ops = dev->netdev_ops; + + if ((dev->features & NETIF_F_HW_VLAN_FILTER) && + ops->ndo_vlan_rx_add_vid) { + return ops->ndo_vlan_rx_add_vid(dev, vid); + } + return 0; +} +EXPORT_SYMBOL(vlan_vid_add); + +void vlan_vid_del(struct net_device *dev, unsigned short vid) +{ + const struct net_device_ops *ops = dev->netdev_ops; + + if ((dev->features & NETIF_F_HW_VLAN_FILTER) && + ops->ndo_vlan_rx_kill_vid) { + ops->ndo_vlan_rx_kill_vid(dev, vid); + } +} +EXPORT_SYMBOL(vlan_vid_del); |