Commit 2f6a1b6607fd6b0eb9501843a40e0c7555f37b4a

Authored by Vlad Yasevich
Committed by David S. Miller
1 parent 6acf54f1cf

macvlan: Remove custom recieve and forward handlers

Since now macvlan and macvtap use the same receive and
forward handlers, we can remove them completely and use
netif_rx and dev_forward_skb() directly.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 7 additions and 20 deletions Side-by-side Diff

drivers/net/macvlan.c
... ... @@ -120,7 +120,7 @@
120 120 struct net_device *dev = vlan->dev;
121 121  
122 122 if (local)
123   - return vlan->forward(dev, skb);
  123 + return dev_forward_skb(dev, skb);
124 124  
125 125 skb->dev = dev;
126 126 if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
... ... @@ -128,7 +128,7 @@
128 128 else
129 129 skb->pkt_type = PACKET_MULTICAST;
130 130  
131   - return vlan->receive(skb);
  131 + return netif_rx(skb);
132 132 }
133 133  
134 134 static u32 macvlan_hash_mix(const struct macvlan_dev *vlan)
... ... @@ -251,7 +251,7 @@
251 251 skb->dev = dev;
252 252 skb->pkt_type = PACKET_HOST;
253 253  
254   - ret = vlan->receive(skb);
  254 + ret = netif_rx(skb);
255 255  
256 256 out:
257 257 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0);
... ... @@ -803,10 +803,7 @@
803 803 }
804 804  
805 805 int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
806   - struct nlattr *tb[], struct nlattr *data[],
807   - int (*receive)(struct sk_buff *skb),
808   - int (*forward)(struct net_device *dev,
809   - struct sk_buff *skb))
  806 + struct nlattr *tb[], struct nlattr *data[])
810 807 {
811 808 struct macvlan_dev *vlan = netdev_priv(dev);
812 809 struct macvlan_port *port;
... ... @@ -848,8 +845,6 @@
848 845 vlan->lowerdev = lowerdev;
849 846 vlan->dev = dev;
850 847 vlan->port = port;
851   - vlan->receive = receive;
852   - vlan->forward = forward;
853 848 vlan->set_features = MACVLAN_FEATURES;
854 849  
855 850 vlan->mode = MACVLAN_MODE_VEPA;
... ... @@ -894,9 +889,7 @@
894 889 static int macvlan_newlink(struct net *src_net, struct net_device *dev,
895 890 struct nlattr *tb[], struct nlattr *data[])
896 891 {
897   - return macvlan_common_newlink(src_net, dev, tb, data,
898   - netif_rx,
899   - dev_forward_skb);
  892 + return macvlan_common_newlink(src_net, dev, tb, data);
900 893 }
901 894  
902 895 void macvlan_dellink(struct net_device *dev, struct list_head *head)
drivers/net/macvtap.c
... ... @@ -400,8 +400,7 @@
400 400 /* Don't put anything that may fail after macvlan_common_newlink
401 401 * because we can't undo what it does.
402 402 */
403   - return macvlan_common_newlink(src_net, dev, tb, data,
404   - netif_rx, dev_forward_skb);
  403 + return macvlan_common_newlink(src_net, dev, tb, data);
405 404 }
406 405  
407 406 static void macvtap_dellink(struct net_device *dev,
include/linux/if_macvlan.h
... ... @@ -69,8 +69,6 @@
69 69 netdev_features_t set_features;
70 70 enum macvlan_mode mode;
71 71 u16 flags;
72   - int (*receive)(struct sk_buff *skb);
73   - int (*forward)(struct net_device *dev, struct sk_buff *skb);
74 72 /* This array tracks active taps. */
75 73 struct macvtap_queue __rcu *taps[MAX_MACVTAP_QUEUES];
76 74 /* This list tracks all taps (both enabled and disabled) */
... ... @@ -103,10 +101,7 @@
103 101 extern void macvlan_common_setup(struct net_device *dev);
104 102  
105 103 extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
106   - struct nlattr *tb[], struct nlattr *data[],
107   - int (*receive)(struct sk_buff *skb),
108   - int (*forward)(struct net_device *dev,
109   - struct sk_buff *skb));
  104 + struct nlattr *tb[], struct nlattr *data[]);
110 105  
111 106 extern void macvlan_count_rx(const struct macvlan_dev *vlan,
112 107 unsigned int len, bool success,