macvlan.c (858a0d7eb5300b5f620d98ab3c4b96c9d5f19131) | macvlan.c (6fe3faf86757eb7f078ff06b23b206f17dc4fb36) |
---|---|
1/* 2 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net> 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License as 6 * published by the Free Software Foundation; either version 2 of 7 * the License, or (at your option) any later version. 8 * --- 841 unchanged lines hidden (view full) --- 850 free_percpu(vlan->pcpu_stats); 851 852 macvlan_flush_sources(port, vlan); 853 port->count -= 1; 854 if (!port->count) 855 macvlan_port_destroy(port->dev); 856} 857 | 1/* 2 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net> 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License as 6 * published by the Free Software Foundation; either version 2 of 7 * the License, or (at your option) any later version. 8 * --- 841 unchanged lines hidden (view full) --- 850 free_percpu(vlan->pcpu_stats); 851 852 macvlan_flush_sources(port, vlan); 853 port->count -= 1; 854 if (!port->count) 855 macvlan_port_destroy(port->dev); 856} 857 |
858static struct rtnl_link_stats64 *macvlan_dev_get_stats64(struct net_device *dev, 859 struct rtnl_link_stats64 *stats) | 858static void macvlan_dev_get_stats64(struct net_device *dev, 859 struct rtnl_link_stats64 *stats) |
860{ 861 struct macvlan_dev *vlan = netdev_priv(dev); 862 863 if (vlan->pcpu_stats) { 864 struct vlan_pcpu_stats *p; 865 u64 rx_packets, rx_bytes, rx_multicast, tx_packets, tx_bytes; 866 u32 rx_errors = 0, tx_dropped = 0; 867 unsigned int start; --- 20 unchanged lines hidden (view full) --- 888 */ 889 rx_errors += p->rx_errors; 890 tx_dropped += p->tx_dropped; 891 } 892 stats->rx_errors = rx_errors; 893 stats->rx_dropped = rx_errors; 894 stats->tx_dropped = tx_dropped; 895 } | 860{ 861 struct macvlan_dev *vlan = netdev_priv(dev); 862 863 if (vlan->pcpu_stats) { 864 struct vlan_pcpu_stats *p; 865 u64 rx_packets, rx_bytes, rx_multicast, tx_packets, tx_bytes; 866 u32 rx_errors = 0, tx_dropped = 0; 867 unsigned int start; --- 20 unchanged lines hidden (view full) --- 888 */ 889 rx_errors += p->rx_errors; 890 tx_dropped += p->tx_dropped; 891 } 892 stats->rx_errors = rx_errors; 893 stats->rx_dropped = rx_errors; 894 stats->tx_dropped = tx_dropped; 895 } |
896 return stats; | |
897} 898 899static int macvlan_vlan_rx_add_vid(struct net_device *dev, 900 __be16 proto, u16 vid) 901{ 902 struct macvlan_dev *vlan = netdev_priv(dev); 903 struct net_device *lowerdev = vlan->lowerdev; 904 --- 201 unchanged lines hidden (view full) --- 1106{ 1107 struct macvlan_port *port; 1108 unsigned int i; 1109 int err; 1110 1111 if (dev->type != ARPHRD_ETHER || dev->flags & IFF_LOOPBACK) 1112 return -EINVAL; 1113 | 896} 897 898static int macvlan_vlan_rx_add_vid(struct net_device *dev, 899 __be16 proto, u16 vid) 900{ 901 struct macvlan_dev *vlan = netdev_priv(dev); 902 struct net_device *lowerdev = vlan->lowerdev; 903 --- 201 unchanged lines hidden (view full) --- 1105{ 1106 struct macvlan_port *port; 1107 unsigned int i; 1108 int err; 1109 1110 if (dev->type != ARPHRD_ETHER || dev->flags & IFF_LOOPBACK) 1111 return -EINVAL; 1112 |
1114 if (netif_is_ipvlan_port(dev)) | 1113 if (netdev_is_rx_handler_busy(dev)) |
1115 return -EBUSY; 1116 1117 port = kzalloc(sizeof(*port), GFP_KERNEL); 1118 if (port == NULL) 1119 return -ENOMEM; 1120 1121 port->passthru = false; 1122 port->dev = dev; --- 398 unchanged lines hidden (view full) --- 1521 [IFLA_MACVLAN_MACADDR] = { .type = NLA_BINARY, .len = MAX_ADDR_LEN }, 1522 [IFLA_MACVLAN_MACADDR_DATA] = { .type = NLA_NESTED }, 1523 [IFLA_MACVLAN_MACADDR_COUNT] = { .type = NLA_U32 }, 1524}; 1525 1526int macvlan_link_register(struct rtnl_link_ops *ops) 1527{ 1528 /* common fields */ | 1114 return -EBUSY; 1115 1116 port = kzalloc(sizeof(*port), GFP_KERNEL); 1117 if (port == NULL) 1118 return -ENOMEM; 1119 1120 port->passthru = false; 1121 port->dev = dev; --- 398 unchanged lines hidden (view full) --- 1520 [IFLA_MACVLAN_MACADDR] = { .type = NLA_BINARY, .len = MAX_ADDR_LEN }, 1521 [IFLA_MACVLAN_MACADDR_DATA] = { .type = NLA_NESTED }, 1522 [IFLA_MACVLAN_MACADDR_COUNT] = { .type = NLA_U32 }, 1523}; 1524 1525int macvlan_link_register(struct rtnl_link_ops *ops) 1526{ 1527 /* common fields */ |
1529 ops->priv_size = sizeof(struct macvlan_dev); | |
1530 ops->validate = macvlan_validate; 1531 ops->maxtype = IFLA_MACVLAN_MAX; 1532 ops->policy = macvlan_policy; 1533 ops->changelink = macvlan_changelink; 1534 ops->get_size = macvlan_get_size; 1535 ops->fill_info = macvlan_fill_info; 1536 1537 return rtnl_link_register(ops); --- 6 unchanged lines hidden (view full) --- 1544} 1545 1546static struct rtnl_link_ops macvlan_link_ops = { 1547 .kind = "macvlan", 1548 .setup = macvlan_setup, 1549 .newlink = macvlan_newlink, 1550 .dellink = macvlan_dellink, 1551 .get_link_net = macvlan_get_link_net, | 1528 ops->validate = macvlan_validate; 1529 ops->maxtype = IFLA_MACVLAN_MAX; 1530 ops->policy = macvlan_policy; 1531 ops->changelink = macvlan_changelink; 1532 ops->get_size = macvlan_get_size; 1533 ops->fill_info = macvlan_fill_info; 1534 1535 return rtnl_link_register(ops); --- 6 unchanged lines hidden (view full) --- 1542} 1543 1544static struct rtnl_link_ops macvlan_link_ops = { 1545 .kind = "macvlan", 1546 .setup = macvlan_setup, 1547 .newlink = macvlan_newlink, 1548 .dellink = macvlan_dellink, 1549 .get_link_net = macvlan_get_link_net, |
1550 .priv_size = sizeof(struct macvlan_dev), |
|
1552}; 1553 1554static int macvlan_device_event(struct notifier_block *unused, 1555 unsigned long event, void *ptr) 1556{ 1557 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 1558 struct macvlan_dev *vlan, *next; 1559 struct macvlan_port *port; --- 95 unchanged lines hidden --- | 1551}; 1552 1553static int macvlan_device_event(struct notifier_block *unused, 1554 unsigned long event, void *ptr) 1555{ 1556 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 1557 struct macvlan_dev *vlan, *next; 1558 struct macvlan_port *port; --- 95 unchanged lines hidden --- |