aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/8021q/vlan_dev.c')
-rw-r--r--net/8021q/vlan_dev.c47
1 files changed, 10 insertions, 37 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 118956448cf6..01d7ba840df8 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -37,39 +37,6 @@
37#include <linux/netpoll.h> 37#include <linux/netpoll.h>
38 38
39/* 39/*
40 * Rebuild the Ethernet MAC header. This is called after an ARP
41 * (or in future other address resolution) has completed on this
42 * sk_buff. We now let ARP fill in the other fields.
43 *
44 * This routine CANNOT use cached dst->neigh!
45 * Really, it is used only when dst->neigh is wrong.
46 *
47 * TODO: This needs a checkup, I'm ignorant here. --BLG
48 */
49static int vlan_dev_rebuild_header(struct sk_buff *skb)
50{
51 struct net_device *dev = skb->dev;
52 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
53
54 switch (veth->h_vlan_encapsulated_proto) {
55#ifdef CONFIG_INET
56 case htons(ETH_P_IP):
57
58 /* TODO: Confirm this will work with VLAN headers... */
59 return arp_find(veth->h_dest, skb);
60#endif
61 default:
62 pr_debug("%s: unable to resolve type %X addresses\n",
63 dev->name, ntohs(veth->h_vlan_encapsulated_proto));
64
65 ether_addr_copy(veth->h_source, dev->dev_addr);
66 break;
67 }
68
69 return 0;
70}
71
72/*
73 * Create the VLAN header for an arbitrary protocol layer 40 * Create the VLAN header for an arbitrary protocol layer
74 * 41 *
75 * saddr=NULL means use device source address 42 * saddr=NULL means use device source address
@@ -534,7 +501,6 @@ static int vlan_dev_get_lock_subclass(struct net_device *dev)
534 501
535static const struct header_ops vlan_header_ops = { 502static const struct header_ops vlan_header_ops = {
536 .create = vlan_dev_hard_header, 503 .create = vlan_dev_hard_header,
537 .rebuild = vlan_dev_rebuild_header,
538 .parse = eth_header_parse, 504 .parse = eth_header_parse,
539}; 505};
540 506
@@ -554,7 +520,6 @@ static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev
554 520
555static const struct header_ops vlan_passthru_header_ops = { 521static const struct header_ops vlan_passthru_header_ops = {
556 .create = vlan_passthru_hard_header, 522 .create = vlan_passthru_hard_header,
557 .rebuild = dev_rebuild_header,
558 .parse = eth_header_parse, 523 .parse = eth_header_parse,
559}; 524};
560 525
@@ -573,7 +538,6 @@ static int vlan_dev_init(struct net_device *dev)
573 /* IFF_BROADCAST|IFF_MULTICAST; ??? */ 538 /* IFF_BROADCAST|IFF_MULTICAST; ??? */
574 dev->flags = real_dev->flags & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | 539 dev->flags = real_dev->flags & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI |
575 IFF_MASTER | IFF_SLAVE); 540 IFF_MASTER | IFF_SLAVE);
576 dev->iflink = real_dev->ifindex;
577 dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) | 541 dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) |
578 (1<<__LINK_STATE_DORMANT))) | 542 (1<<__LINK_STATE_DORMANT))) |
579 (1<<__LINK_STATE_PRESENT); 543 (1<<__LINK_STATE_PRESENT);
@@ -589,6 +553,7 @@ static int vlan_dev_init(struct net_device *dev)
589 if (dev->features & NETIF_F_VLAN_FEATURES) 553 if (dev->features & NETIF_F_VLAN_FEATURES)
590 netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n"); 554 netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n");
591 555
556 dev->vlan_features = real_dev->vlan_features & ~NETIF_F_ALL_FCOE;
592 557
593 /* ipv6 shared card related stuff */ 558 /* ipv6 shared card related stuff */
594 dev->dev_id = real_dev->dev_id; 559 dev->dev_id = real_dev->dev_id;
@@ -767,6 +732,13 @@ static void vlan_dev_netpoll_cleanup(struct net_device *dev)
767} 732}
768#endif /* CONFIG_NET_POLL_CONTROLLER */ 733#endif /* CONFIG_NET_POLL_CONTROLLER */
769 734
735static int vlan_dev_get_iflink(const struct net_device *dev)
736{
737 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
738
739 return real_dev->ifindex;
740}
741
770static const struct ethtool_ops vlan_ethtool_ops = { 742static const struct ethtool_ops vlan_ethtool_ops = {
771 .get_settings = vlan_ethtool_get_settings, 743 .get_settings = vlan_ethtool_get_settings,
772 .get_drvinfo = vlan_ethtool_get_drvinfo, 744 .get_drvinfo = vlan_ethtool_get_drvinfo,
@@ -803,6 +775,7 @@ static const struct net_device_ops vlan_netdev_ops = {
803#endif 775#endif
804 .ndo_fix_features = vlan_dev_fix_features, 776 .ndo_fix_features = vlan_dev_fix_features,
805 .ndo_get_lock_subclass = vlan_dev_get_lock_subclass, 777 .ndo_get_lock_subclass = vlan_dev_get_lock_subclass,
778 .ndo_get_iflink = vlan_dev_get_iflink,
806}; 779};
807 780
808static void vlan_dev_free(struct net_device *dev) 781static void vlan_dev_free(struct net_device *dev)
@@ -827,5 +800,5 @@ void vlan_setup(struct net_device *dev)
827 dev->destructor = vlan_dev_free; 800 dev->destructor = vlan_dev_free;
828 dev->ethtool_ops = &vlan_ethtool_ops; 801 dev->ethtool_ops = &vlan_ethtool_ops;
829 802
830 memset(dev->broadcast, 0, ETH_ALEN); 803 eth_zero_addr(dev->broadcast);
831} 804}