aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-21 03:22:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:08:26 -0500
commitef3eb3e59bd5723895b2349edec98998198ef5bb (patch)
tree586fdbc09660ae47ad863c00e061973687f7ab23 /net/8021q/vlan.c
parent7bd38d778e3f2250e96fc277040879d66c30ecb4 (diff)
[VLAN]: Move device setup to vlan_dev.c
Move device setup to vlan_dev.c and make all the VLAN device methods static. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r--net/8021q/vlan.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 54f234696411..8bc6385a06ee 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -307,87 +307,6 @@ int unregister_vlan_device(struct net_device *dev)
307 return ret; 307 return ret;
308} 308}
309 309
310/*
311 * vlan network devices have devices nesting below it, and are a special
312 * "super class" of normal network devices; split their locks off into a
313 * separate class since they always nest.
314 */
315static struct lock_class_key vlan_netdev_xmit_lock_key;
316
317static const struct header_ops vlan_header_ops = {
318 .create = vlan_dev_hard_header,
319 .rebuild = vlan_dev_rebuild_header,
320 .parse = eth_header_parse,
321};
322
323static int vlan_dev_init(struct net_device *dev)
324{
325 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
326 int subclass = 0;
327
328 /* IFF_BROADCAST|IFF_MULTICAST; ??? */
329 dev->flags = real_dev->flags & ~IFF_UP;
330 dev->iflink = real_dev->ifindex;
331 dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) |
332 (1<<__LINK_STATE_DORMANT))) |
333 (1<<__LINK_STATE_PRESENT);
334
335 /* ipv6 shared card related stuff */
336 dev->dev_id = real_dev->dev_id;
337
338 if (is_zero_ether_addr(dev->dev_addr))
339 memcpy(dev->dev_addr, real_dev->dev_addr, dev->addr_len);
340 if (is_zero_ether_addr(dev->broadcast))
341 memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len);
342
343 if (real_dev->features & NETIF_F_HW_VLAN_TX) {
344 dev->header_ops = real_dev->header_ops;
345 dev->hard_header_len = real_dev->hard_header_len;
346 dev->hard_start_xmit = vlan_dev_hwaccel_hard_start_xmit;
347 } else {
348 dev->header_ops = &vlan_header_ops;
349 dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN;
350 dev->hard_start_xmit = vlan_dev_hard_start_xmit;
351 }
352
353 if (real_dev->priv_flags & IFF_802_1Q_VLAN)
354 subclass = 1;
355
356 lockdep_set_class_and_subclass(&dev->_xmit_lock,
357 &vlan_netdev_xmit_lock_key, subclass);
358 return 0;
359}
360
361void vlan_setup(struct net_device *new_dev)
362{
363 ether_setup(new_dev);
364
365 /* new_dev->ifindex = 0; it will be set when added to
366 * the global list.
367 * iflink is set as well.
368 */
369 /* Make this thing known as a VLAN device */
370 new_dev->priv_flags |= IFF_802_1Q_VLAN;
371
372 /* Set us up to have no queue, as the underlying Hardware device
373 * can do all the queueing we could want.
374 */
375 new_dev->tx_queue_len = 0;
376
377 /* set up method calls */
378 new_dev->change_mtu = vlan_dev_change_mtu;
379 new_dev->init = vlan_dev_init;
380 new_dev->open = vlan_dev_open;
381 new_dev->stop = vlan_dev_stop;
382 new_dev->set_mac_address = vlan_set_mac_address;
383 new_dev->set_multicast_list = vlan_dev_set_multicast_list;
384 new_dev->change_rx_flags = vlan_change_rx_flags;
385 new_dev->destructor = free_netdev;
386 new_dev->do_ioctl = vlan_dev_ioctl;
387
388 memset(new_dev->broadcast, 0, ETH_ALEN);
389}
390
391static void vlan_transfer_operstate(const struct net_device *dev, struct net_device *vlandev) 310static void vlan_transfer_operstate(const struct net_device *dev, struct net_device *vlandev)
392{ 311{
393 /* Have to respect userspace enforced dormant state 312 /* Have to respect userspace enforced dormant state