diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-09 04:40:57 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:52:52 -0400 |
commit | 3b04ddde02cf1b6f14f2697da5c20eca5715017f (patch) | |
tree | 9da1341a5a399a507b5ea6bf5a3047506b8d8f8f /net/8021q | |
parent | b95cce3576813ac3f86bafa6b5daaaaf7574b0fe (diff) |
[NET]: Move hardware header operations out of netdevice.
Since hardware header operations are part of the protocol class
not the device instance, make them into a separate object and
save memory.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r-- | net/8021q/vlan.c | 14 | ||||
-rw-r--r-- | net/8021q/vlan.h | 4 | ||||
-rw-r--r-- | net/8021q/vlan_dev.c | 4 |
3 files changed, 12 insertions, 10 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 4d003e391754..f2bee234d361 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -314,6 +314,12 @@ int unregister_vlan_device(struct net_device *dev) | |||
314 | */ | 314 | */ |
315 | static struct lock_class_key vlan_netdev_xmit_lock_key; | 315 | static struct lock_class_key vlan_netdev_xmit_lock_key; |
316 | 316 | ||
317 | static 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 | |||
317 | static int vlan_dev_init(struct net_device *dev) | 323 | static int vlan_dev_init(struct net_device *dev) |
318 | { | 324 | { |
319 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | 325 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; |
@@ -331,18 +337,14 @@ static int vlan_dev_init(struct net_device *dev) | |||
331 | memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len); | 337 | memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len); |
332 | 338 | ||
333 | if (real_dev->features & NETIF_F_HW_VLAN_TX) { | 339 | if (real_dev->features & NETIF_F_HW_VLAN_TX) { |
334 | dev->hard_header = real_dev->hard_header; | 340 | dev->header_ops = real_dev->header_ops; |
335 | dev->hard_header_len = real_dev->hard_header_len; | 341 | dev->hard_header_len = real_dev->hard_header_len; |
336 | dev->hard_start_xmit = vlan_dev_hwaccel_hard_start_xmit; | 342 | dev->hard_start_xmit = vlan_dev_hwaccel_hard_start_xmit; |
337 | dev->rebuild_header = real_dev->rebuild_header; | ||
338 | } else { | 343 | } else { |
339 | dev->hard_header = vlan_dev_hard_header; | 344 | dev->header_ops = &vlan_header_ops; |
340 | dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN; | 345 | dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN; |
341 | dev->hard_start_xmit = vlan_dev_hard_start_xmit; | 346 | dev->hard_start_xmit = vlan_dev_hard_start_xmit; |
342 | dev->rebuild_header = vlan_dev_rebuild_header; | ||
343 | } | 347 | } |
344 | dev->hard_header_parse = real_dev->hard_header_parse; | ||
345 | dev->hard_header_cache = NULL; | ||
346 | 348 | ||
347 | lockdep_set_class(&dev->_xmit_lock, &vlan_netdev_xmit_lock_key); | 349 | lockdep_set_class(&dev->_xmit_lock, &vlan_netdev_xmit_lock_key); |
348 | return 0; | 350 | return 0; |
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 7df5b2935579..cf4a80d06b35 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -53,8 +53,8 @@ int vlan_dev_rebuild_header(struct sk_buff *skb); | |||
53 | int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | 53 | int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, |
54 | struct packet_type *ptype, struct net_device *orig_dev); | 54 | struct packet_type *ptype, struct net_device *orig_dev); |
55 | int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 55 | int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
56 | unsigned short type, void *daddr, void *saddr, | 56 | unsigned short type, const void *daddr, |
57 | unsigned len); | 57 | const void *saddr, unsigned len); |
58 | int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); | 58 | int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); |
59 | int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); | 59 | int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); |
60 | int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); | 60 | int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index ca8090fdabbb..1a1740aa9a8b 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -343,8 +343,8 @@ static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev | |||
343 | * physical devices. | 343 | * physical devices. |
344 | */ | 344 | */ |
345 | int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 345 | int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
346 | unsigned short type, void *daddr, void *saddr, | 346 | unsigned short type, |
347 | unsigned len) | 347 | const void *daddr, const void *saddr, unsigned len) |
348 | { | 348 | { |
349 | struct vlan_hdr *vhdr; | 349 | struct vlan_hdr *vhdr; |
350 | unsigned short veth_TCI = 0; | 350 | unsigned short veth_TCI = 0; |