macvlan.c (fe3015748a905e08eb0e1750aa2928f520063d59) macvlan.c (0bca3f7f9acdf755f246b4febb0da59a4cd83638)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
4 *
5 * The code this is based on carried the following copyright notice:
6 * ---
7 * (C) Copyright 2001-2006
8 * Alex Zeffertt, Cambridge Broadband Ltd, ajz@cambridgebroadband.com

--- 854 unchanged lines hidden (view full) ---

863 struct macvlan_dev *vlan = netdev_priv(dev);
864
865 if (vlan->lowerdev->mtu < new_mtu)
866 return -EINVAL;
867 dev->mtu = new_mtu;
868 return 0;
869}
870
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
4 *
5 * The code this is based on carried the following copyright notice:
6 * ---
7 * (C) Copyright 2001-2006
8 * Alex Zeffertt, Cambridge Broadband Ltd, ajz@cambridgebroadband.com

--- 854 unchanged lines hidden (view full) ---

863 struct macvlan_dev *vlan = netdev_priv(dev);
864
865 if (vlan->lowerdev->mtu < new_mtu)
866 return -EINVAL;
867 dev->mtu = new_mtu;
868 return 0;
869}
870
871static int macvlan_eth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
871static int macvlan_hwtstamp_get(struct net_device *dev,
872 struct kernel_hwtstamp_config *cfg)
872{
873 struct net_device *real_dev = macvlan_dev_real_dev(dev);
873{
874 struct net_device *real_dev = macvlan_dev_real_dev(dev);
874 const struct net_device_ops *ops = real_dev->netdev_ops;
875 struct ifreq ifrr;
876 int err = -EOPNOTSUPP;
877
875
878 strscpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ);
879 ifrr.ifr_ifru = ifr->ifr_ifru;
876 return generic_hwtstamp_get_lower(real_dev, cfg);
877}
880
878
881 switch (cmd) {
882 case SIOCSHWTSTAMP:
883 if (!net_eq(dev_net(dev), &init_net))
884 break;
885 fallthrough;
886 case SIOCGHWTSTAMP:
887 if (netif_device_present(real_dev) && ops->ndo_eth_ioctl)
888 err = ops->ndo_eth_ioctl(real_dev, &ifrr, cmd);
889 break;
890 }
879static int macvlan_hwtstamp_set(struct net_device *dev,
880 struct kernel_hwtstamp_config *cfg,
881 struct netlink_ext_ack *extack)
882{
883 struct net_device *real_dev = macvlan_dev_real_dev(dev);
891
884
892 if (!err)
893 ifr->ifr_ifru = ifrr.ifr_ifru;
885 if (!net_eq(dev_net(dev), &init_net))
886 return -EOPNOTSUPP;
894
887
895 return err;
888 return generic_hwtstamp_set_lower(real_dev, cfg, extack);
896}
897
898/*
899 * macvlan network devices have devices nesting below it and are a special
900 * "super class" of normal network devices; split their locks off into a
901 * separate class since they always nest.
902 */
903static struct lock_class_key macvlan_netdev_addr_lock_key;

--- 284 unchanged lines hidden (view full) ---

1188
1189static const struct net_device_ops macvlan_netdev_ops = {
1190 .ndo_init = macvlan_init,
1191 .ndo_uninit = macvlan_uninit,
1192 .ndo_open = macvlan_open,
1193 .ndo_stop = macvlan_stop,
1194 .ndo_start_xmit = macvlan_start_xmit,
1195 .ndo_change_mtu = macvlan_change_mtu,
889}
890
891/*
892 * macvlan network devices have devices nesting below it and are a special
893 * "super class" of normal network devices; split their locks off into a
894 * separate class since they always nest.
895 */
896static struct lock_class_key macvlan_netdev_addr_lock_key;

--- 284 unchanged lines hidden (view full) ---

1181
1182static const struct net_device_ops macvlan_netdev_ops = {
1183 .ndo_init = macvlan_init,
1184 .ndo_uninit = macvlan_uninit,
1185 .ndo_open = macvlan_open,
1186 .ndo_stop = macvlan_stop,
1187 .ndo_start_xmit = macvlan_start_xmit,
1188 .ndo_change_mtu = macvlan_change_mtu,
1196 .ndo_eth_ioctl = macvlan_eth_ioctl,
1197 .ndo_fix_features = macvlan_fix_features,
1198 .ndo_change_rx_flags = macvlan_change_rx_flags,
1199 .ndo_set_mac_address = macvlan_set_mac_address,
1200 .ndo_set_rx_mode = macvlan_set_mac_lists,
1201 .ndo_get_stats64 = macvlan_dev_get_stats64,
1202 .ndo_validate_addr = eth_validate_addr,
1203 .ndo_vlan_rx_add_vid = macvlan_vlan_rx_add_vid,
1204 .ndo_vlan_rx_kill_vid = macvlan_vlan_rx_kill_vid,
1205 .ndo_fdb_add = macvlan_fdb_add,
1206 .ndo_fdb_del = macvlan_fdb_del,
1207 .ndo_fdb_dump = ndo_dflt_fdb_dump,
1208#ifdef CONFIG_NET_POLL_CONTROLLER
1209 .ndo_poll_controller = macvlan_dev_poll_controller,
1210 .ndo_netpoll_setup = macvlan_dev_netpoll_setup,
1211 .ndo_netpoll_cleanup = macvlan_dev_netpoll_cleanup,
1212#endif
1213 .ndo_get_iflink = macvlan_dev_get_iflink,
1214 .ndo_features_check = passthru_features_check,
1189 .ndo_fix_features = macvlan_fix_features,
1190 .ndo_change_rx_flags = macvlan_change_rx_flags,
1191 .ndo_set_mac_address = macvlan_set_mac_address,
1192 .ndo_set_rx_mode = macvlan_set_mac_lists,
1193 .ndo_get_stats64 = macvlan_dev_get_stats64,
1194 .ndo_validate_addr = eth_validate_addr,
1195 .ndo_vlan_rx_add_vid = macvlan_vlan_rx_add_vid,
1196 .ndo_vlan_rx_kill_vid = macvlan_vlan_rx_kill_vid,
1197 .ndo_fdb_add = macvlan_fdb_add,
1198 .ndo_fdb_del = macvlan_fdb_del,
1199 .ndo_fdb_dump = ndo_dflt_fdb_dump,
1200#ifdef CONFIG_NET_POLL_CONTROLLER
1201 .ndo_poll_controller = macvlan_dev_poll_controller,
1202 .ndo_netpoll_setup = macvlan_dev_netpoll_setup,
1203 .ndo_netpoll_cleanup = macvlan_dev_netpoll_cleanup,
1204#endif
1205 .ndo_get_iflink = macvlan_dev_get_iflink,
1206 .ndo_features_check = passthru_features_check,
1207 .ndo_hwtstamp_get = macvlan_hwtstamp_get,
1208 .ndo_hwtstamp_set = macvlan_hwtstamp_set,
1215};
1216
1217static void macvlan_dev_free(struct net_device *dev)
1218{
1219 struct macvlan_dev *vlan = netdev_priv(dev);
1220
1221 /* Get rid of the macvlan's reference to lowerdev */
1222 netdev_put(vlan->lowerdev, &vlan->dev_tracker);

--- 670 unchanged lines hidden ---
1209};
1210
1211static void macvlan_dev_free(struct net_device *dev)
1212{
1213 struct macvlan_dev *vlan = netdev_priv(dev);
1214
1215 /* Get rid of the macvlan's reference to lowerdev */
1216 netdev_put(vlan->lowerdev, &vlan->dev_tracker);

--- 670 unchanged lines hidden ---