21 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23 #include <linux/capability.h>
24 #include <linux/module.h>
25 #include <linux/netdevice.h>
27 #include <linux/slab.h>
32 #include <linux/rtnetlink.h>
37 #include <asm/uaccess.h>
39 #include <linux/if_vlan.h>
43 #define DRV_VERSION "1.8"
87 grp = &vlan_info->
grp;
101 vlan_group_set_device(grp, vlan_id,
NULL);
121 pr_info(
"VLANs not supported on %s\n", name);
127 pr_info(
"Device %s has buggy VLAN hw accel\n", name);
131 if (vlan_find_dev(real_dev, vlan_id) !=
NULL)
154 grp = &vlan_info->
grp;
161 err = vlan_group_prealloc_vid(grp, vlan_id);
163 goto out_uninit_applicant;
167 goto out_uninit_applicant;
178 vlan_group_set_device(grp, vlan_id, dev);
183 out_uninit_applicant:
197 struct net *
net = dev_net(real_dev);
240 dev_net_set(new_dev, net);
244 new_dev->
mtu = real_dev->
mtu;
254 goto out_free_newdev;
287 static void vlan_transfer_features(
struct net_device *dev,
297 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
298 vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;
304 static void __vlan_device_event(
struct net_device *dev,
unsigned long event)
310 pr_warn(
"failed to change proc name for %s\n",
315 pr_warn(
"failed to add proc entry for %s\n", dev->
name);
334 if (is_vlan_dev(dev))
335 __vlan_device_event(dev, event);
339 pr_info(
"adding VLAN 0 to HW filter on device %s\n",
347 grp = &vlan_info->
grp;
357 vlandev = vlan_group_get_device(grp, i);
368 vlandev = vlan_group_get_device(grp, i);
372 flgs = vlandev->
flags;
376 vlan_sync_address(dev, vlandev);
382 vlandev = vlan_group_get_device(grp, i);
386 if (vlandev->
mtu <= dev->
mtu)
396 vlandev = vlan_group_get_device(grp, i);
400 vlan_transfer_features(dev, vlandev);
411 vlandev = vlan_group_get_device(grp, i);
415 flgs = vlandev->
flags;
429 vlandev = vlan_group_get_device(grp, i);
433 flgs = vlandev->
flags;
446 if (dev->
reg_state != NETREG_UNREGISTERING)
450 vlandev = vlan_group_get_device(grp, i);
474 vlandev = vlan_group_get_device(grp, i);
488 .notifier_call = vlan_device_event,
496 static int vlan_ioctl_handler(
struct net *net,
void __user *
arg)
506 args.device1[23] = 0;
507 args.u.device2[23] = 0;
562 if ((
args.u.name_type >= 0) &&
578 err = register_vlan_device(dev,
args.u.VID);
614 static int __net_init vlan_init_net(
struct net *net)
626 static void __net_exit vlan_exit_net(
struct net *net)
632 .init = vlan_init_net,
633 .exit = vlan_exit_net,
638 static int __init vlan_proto_init(
void)
673 static void __exit vlan_cleanup_module(
void)