aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macvlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r--drivers/net/macvlan.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index bc8faaec33f5..8433de4509c7 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -120,7 +120,7 @@ static int macvlan_broadcast_one(struct sk_buff *skb,
120 struct net_device *dev = vlan->dev; 120 struct net_device *dev = vlan->dev;
121 121
122 if (local) 122 if (local)
123 return vlan->forward(dev, skb); 123 return dev_forward_skb(dev, skb);
124 124
125 skb->dev = dev; 125 skb->dev = dev;
126 if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast)) 126 if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
@@ -128,7 +128,7 @@ static int macvlan_broadcast_one(struct sk_buff *skb,
128 else 128 else
129 skb->pkt_type = PACKET_MULTICAST; 129 skb->pkt_type = PACKET_MULTICAST;
130 130
131 return vlan->receive(skb); 131 return netif_rx(skb);
132} 132}
133 133
134static u32 macvlan_hash_mix(const struct macvlan_dev *vlan) 134static u32 macvlan_hash_mix(const struct macvlan_dev *vlan)
@@ -251,7 +251,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
251 skb->dev = dev; 251 skb->dev = dev;
252 skb->pkt_type = PACKET_HOST; 252 skb->pkt_type = PACKET_HOST;
253 253
254 ret = vlan->receive(skb); 254 ret = netif_rx(skb);
255 255
256out: 256out:
257 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0); 257 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0);
@@ -290,8 +290,8 @@ xmit_world:
290 return dev_queue_xmit(skb); 290 return dev_queue_xmit(skb);
291} 291}
292 292
293netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, 293static netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
294 struct net_device *dev) 294 struct net_device *dev)
295{ 295{
296 unsigned int len = skb->len; 296 unsigned int len = skb->len;
297 int ret; 297 int ret;
@@ -305,7 +305,7 @@ netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
305 } 305 }
306 306
307 if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) { 307 if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
308 struct macvlan_pcpu_stats *pcpu_stats; 308 struct vlan_pcpu_stats *pcpu_stats;
309 309
310 pcpu_stats = this_cpu_ptr(vlan->pcpu_stats); 310 pcpu_stats = this_cpu_ptr(vlan->pcpu_stats);
311 u64_stats_update_begin(&pcpu_stats->syncp); 311 u64_stats_update_begin(&pcpu_stats->syncp);
@@ -317,7 +317,6 @@ netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
317 } 317 }
318 return ret; 318 return ret;
319} 319}
320EXPORT_SYMBOL_GPL(macvlan_start_xmit);
321 320
322static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev, 321static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev,
323 unsigned short type, const void *daddr, 322 unsigned short type, const void *daddr,
@@ -547,12 +546,12 @@ static int macvlan_init(struct net_device *dev)
547 546
548 macvlan_set_lockdep_class(dev); 547 macvlan_set_lockdep_class(dev);
549 548
550 vlan->pcpu_stats = alloc_percpu(struct macvlan_pcpu_stats); 549 vlan->pcpu_stats = alloc_percpu(struct vlan_pcpu_stats);
551 if (!vlan->pcpu_stats) 550 if (!vlan->pcpu_stats)
552 return -ENOMEM; 551 return -ENOMEM;
553 552
554 for_each_possible_cpu(i) { 553 for_each_possible_cpu(i) {
555 struct macvlan_pcpu_stats *mvlstats; 554 struct vlan_pcpu_stats *mvlstats;
556 mvlstats = per_cpu_ptr(vlan->pcpu_stats, i); 555 mvlstats = per_cpu_ptr(vlan->pcpu_stats, i);
557 u64_stats_init(&mvlstats->syncp); 556 u64_stats_init(&mvlstats->syncp);
558 } 557 }
@@ -578,7 +577,7 @@ static struct rtnl_link_stats64 *macvlan_dev_get_stats64(struct net_device *dev,
578 struct macvlan_dev *vlan = netdev_priv(dev); 577 struct macvlan_dev *vlan = netdev_priv(dev);
579 578
580 if (vlan->pcpu_stats) { 579 if (vlan->pcpu_stats) {
581 struct macvlan_pcpu_stats *p; 580 struct vlan_pcpu_stats *p;
582 u64 rx_packets, rx_bytes, rx_multicast, tx_packets, tx_bytes; 581 u64 rx_packets, rx_bytes, rx_multicast, tx_packets, tx_bytes;
583 u32 rx_errors = 0, tx_dropped = 0; 582 u32 rx_errors = 0, tx_dropped = 0;
584 unsigned int start; 583 unsigned int start;
@@ -814,10 +813,7 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])
814} 813}
815 814
816int macvlan_common_newlink(struct net *src_net, struct net_device *dev, 815int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
817 struct nlattr *tb[], struct nlattr *data[], 816 struct nlattr *tb[], struct nlattr *data[])
818 int (*receive)(struct sk_buff *skb),
819 int (*forward)(struct net_device *dev,
820 struct sk_buff *skb))
821{ 817{
822 struct macvlan_dev *vlan = netdev_priv(dev); 818 struct macvlan_dev *vlan = netdev_priv(dev);
823 struct macvlan_port *port; 819 struct macvlan_port *port;
@@ -831,13 +827,11 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
831 if (lowerdev == NULL) 827 if (lowerdev == NULL)
832 return -ENODEV; 828 return -ENODEV;
833 829
834 /* When creating macvlans on top of other macvlans - use 830 /* When creating macvlans or macvtaps on top of other macvlans - use
835 * the real device as the lowerdev. 831 * the real device as the lowerdev.
836 */ 832 */
837 if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) { 833 if (netif_is_macvlan(lowerdev))
838 struct macvlan_dev *lowervlan = netdev_priv(lowerdev); 834 lowerdev = macvlan_dev_real_dev(lowerdev);
839 lowerdev = lowervlan->lowerdev;
840 }
841 835
842 if (!tb[IFLA_MTU]) 836 if (!tb[IFLA_MTU])
843 dev->mtu = lowerdev->mtu; 837 dev->mtu = lowerdev->mtu;
@@ -861,8 +855,6 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
861 vlan->lowerdev = lowerdev; 855 vlan->lowerdev = lowerdev;
862 vlan->dev = dev; 856 vlan->dev = dev;
863 vlan->port = port; 857 vlan->port = port;
864 vlan->receive = receive;
865 vlan->forward = forward;
866 vlan->set_features = MACVLAN_FEATURES; 858 vlan->set_features = MACVLAN_FEATURES;
867 859
868 vlan->mode = MACVLAN_MODE_VEPA; 860 vlan->mode = MACVLAN_MODE_VEPA;
@@ -907,9 +899,7 @@ EXPORT_SYMBOL_GPL(macvlan_common_newlink);
907static int macvlan_newlink(struct net *src_net, struct net_device *dev, 899static int macvlan_newlink(struct net *src_net, struct net_device *dev,
908 struct nlattr *tb[], struct nlattr *data[]) 900 struct nlattr *tb[], struct nlattr *data[])
909{ 901{
910 return macvlan_common_newlink(src_net, dev, tb, data, 902 return macvlan_common_newlink(src_net, dev, tb, data);
911 netif_rx,
912 dev_forward_skb);
913} 903}
914 904
915void macvlan_dellink(struct net_device *dev, struct list_head *head) 905void macvlan_dellink(struct net_device *dev, struct list_head *head)