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.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 590039cbb146..7e24b5048686 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -87,7 +87,6 @@ static void macvlan_broadcast(struct sk_buff *skb,
87 dev->stats.rx_bytes += skb->len + ETH_HLEN; 87 dev->stats.rx_bytes += skb->len + ETH_HLEN;
88 dev->stats.rx_packets++; 88 dev->stats.rx_packets++;
89 dev->stats.multicast++; 89 dev->stats.multicast++;
90 dev->last_rx = jiffies;
91 90
92 nskb->dev = dev; 91 nskb->dev = dev;
93 if (!compare_ether_addr(eth->h_dest, dev->broadcast)) 92 if (!compare_ether_addr(eth->h_dest, dev->broadcast))
@@ -136,7 +135,6 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
136 135
137 dev->stats.rx_bytes += skb->len + ETH_HLEN; 136 dev->stats.rx_bytes += skb->len + ETH_HLEN;
138 dev->stats.rx_packets++; 137 dev->stats.rx_packets++;
139 dev->last_rx = jiffies;
140 138
141 skb->dev = dev; 139 skb->dev = dev;
142 skb->pkt_type = PACKET_HOST; 140 skb->pkt_type = PACKET_HOST;
@@ -145,7 +143,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
145 return NULL; 143 return NULL;
146} 144}
147 145
148static int macvlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 146static int macvlan_start_xmit(struct sk_buff *skb, struct net_device *dev)
149{ 147{
150 const struct macvlan_dev *vlan = netdev_priv(dev); 148 const struct macvlan_dev *vlan = netdev_priv(dev);
151 unsigned int len = skb->len; 149 unsigned int len = skb->len;
@@ -336,24 +334,53 @@ static u32 macvlan_ethtool_get_rx_csum(struct net_device *dev)
336 return lowerdev->ethtool_ops->get_rx_csum(lowerdev); 334 return lowerdev->ethtool_ops->get_rx_csum(lowerdev);
337} 335}
338 336
337static int macvlan_ethtool_get_settings(struct net_device *dev,
338 struct ethtool_cmd *cmd)
339{
340 const struct macvlan_dev *vlan = netdev_priv(dev);
341 struct net_device *lowerdev = vlan->lowerdev;
342
343 if (!lowerdev->ethtool_ops->get_settings)
344 return -EOPNOTSUPP;
345
346 return lowerdev->ethtool_ops->get_settings(lowerdev, cmd);
347}
348
349static u32 macvlan_ethtool_get_flags(struct net_device *dev)
350{
351 const struct macvlan_dev *vlan = netdev_priv(dev);
352 struct net_device *lowerdev = vlan->lowerdev;
353
354 if (!lowerdev->ethtool_ops->get_flags)
355 return 0;
356 return lowerdev->ethtool_ops->get_flags(lowerdev);
357}
358
339static const struct ethtool_ops macvlan_ethtool_ops = { 359static const struct ethtool_ops macvlan_ethtool_ops = {
340 .get_link = ethtool_op_get_link, 360 .get_link = ethtool_op_get_link,
361 .get_settings = macvlan_ethtool_get_settings,
341 .get_rx_csum = macvlan_ethtool_get_rx_csum, 362 .get_rx_csum = macvlan_ethtool_get_rx_csum,
342 .get_drvinfo = macvlan_ethtool_get_drvinfo, 363 .get_drvinfo = macvlan_ethtool_get_drvinfo,
364 .get_flags = macvlan_ethtool_get_flags,
365};
366
367static const struct net_device_ops macvlan_netdev_ops = {
368 .ndo_init = macvlan_init,
369 .ndo_open = macvlan_open,
370 .ndo_stop = macvlan_stop,
371 .ndo_start_xmit = macvlan_start_xmit,
372 .ndo_change_mtu = macvlan_change_mtu,
373 .ndo_change_rx_flags = macvlan_change_rx_flags,
374 .ndo_set_mac_address = macvlan_set_mac_address,
375 .ndo_set_multicast_list = macvlan_set_multicast_list,
376 .ndo_validate_addr = eth_validate_addr,
343}; 377};
344 378
345static void macvlan_setup(struct net_device *dev) 379static void macvlan_setup(struct net_device *dev)
346{ 380{
347 ether_setup(dev); 381 ether_setup(dev);
348 382
349 dev->init = macvlan_init; 383 dev->netdev_ops = &macvlan_netdev_ops;
350 dev->open = macvlan_open;
351 dev->stop = macvlan_stop;
352 dev->change_mtu = macvlan_change_mtu;
353 dev->change_rx_flags = macvlan_change_rx_flags;
354 dev->set_mac_address = macvlan_set_mac_address;
355 dev->set_multicast_list = macvlan_set_multicast_list;
356 dev->hard_start_xmit = macvlan_hard_start_xmit;
357 dev->destructor = free_netdev; 384 dev->destructor = free_netdev;
358 dev->header_ops = &macvlan_hard_header_ops, 385 dev->header_ops = &macvlan_hard_header_ops,
359 dev->ethtool_ops = &macvlan_ethtool_ops; 386 dev->ethtool_ops = &macvlan_ethtool_ops;