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 /drivers/net/arcnet/arcnet.c | |
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 'drivers/net/arcnet/arcnet.c')
-rw-r--r-- | drivers/net/arcnet/arcnet.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 681e20b8466f..c59c8067de99 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -102,8 +102,8 @@ static int arcnet_close(struct net_device *dev); | |||
102 | static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); | 102 | static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); |
103 | static void arcnet_timeout(struct net_device *dev); | 103 | static void arcnet_timeout(struct net_device *dev); |
104 | static int arcnet_header(struct sk_buff *skb, struct net_device *dev, | 104 | static int arcnet_header(struct sk_buff *skb, struct net_device *dev, |
105 | unsigned short type, void *daddr, void *saddr, | 105 | unsigned short type, const void *daddr, |
106 | unsigned len); | 106 | const void *saddr, unsigned len); |
107 | static int arcnet_rebuild_header(struct sk_buff *skb); | 107 | static int arcnet_rebuild_header(struct sk_buff *skb); |
108 | static struct net_device_stats *arcnet_get_stats(struct net_device *dev); | 108 | static struct net_device_stats *arcnet_get_stats(struct net_device *dev); |
109 | static int go_tx(struct net_device *dev); | 109 | static int go_tx(struct net_device *dev); |
@@ -317,11 +317,17 @@ static int choose_mtu(void) | |||
317 | return mtu == 65535 ? XMTU : mtu; | 317 | return mtu == 65535 ? XMTU : mtu; |
318 | } | 318 | } |
319 | 319 | ||
320 | static const struct header_ops arcnet_header_ops = { | ||
321 | .create = arcnet_header, | ||
322 | .rebuild = arcnet_rebuild_header, | ||
323 | }; | ||
324 | |||
320 | 325 | ||
321 | /* Setup a struct device for ARCnet. */ | 326 | /* Setup a struct device for ARCnet. */ |
322 | static void arcdev_setup(struct net_device *dev) | 327 | static void arcdev_setup(struct net_device *dev) |
323 | { | 328 | { |
324 | dev->type = ARPHRD_ARCNET; | 329 | dev->type = ARPHRD_ARCNET; |
330 | dev->header_ops = &arcnet_header_ops; | ||
325 | dev->hard_header_len = sizeof(struct archdr); | 331 | dev->hard_header_len = sizeof(struct archdr); |
326 | dev->mtu = choose_mtu(); | 332 | dev->mtu = choose_mtu(); |
327 | 333 | ||
@@ -342,8 +348,6 @@ static void arcdev_setup(struct net_device *dev) | |||
342 | dev->hard_start_xmit = arcnet_send_packet; | 348 | dev->hard_start_xmit = arcnet_send_packet; |
343 | dev->tx_timeout = arcnet_timeout; | 349 | dev->tx_timeout = arcnet_timeout; |
344 | dev->get_stats = arcnet_get_stats; | 350 | dev->get_stats = arcnet_get_stats; |
345 | dev->hard_header = arcnet_header; | ||
346 | dev->rebuild_header = arcnet_rebuild_header; | ||
347 | } | 351 | } |
348 | 352 | ||
349 | struct net_device *alloc_arcdev(char *name) | 353 | struct net_device *alloc_arcdev(char *name) |
@@ -488,10 +492,10 @@ static int arcnet_close(struct net_device *dev) | |||
488 | 492 | ||
489 | 493 | ||
490 | static int arcnet_header(struct sk_buff *skb, struct net_device *dev, | 494 | static int arcnet_header(struct sk_buff *skb, struct net_device *dev, |
491 | unsigned short type, void *daddr, void *saddr, | 495 | unsigned short type, const void *daddr, |
492 | unsigned len) | 496 | const void *saddr, unsigned len) |
493 | { | 497 | { |
494 | struct arcnet_local *lp = dev->priv; | 498 | const struct arcnet_local *lp = netdev_priv(dev); |
495 | uint8_t _daddr, proto_num; | 499 | uint8_t _daddr, proto_num; |
496 | struct ArcProto *proto; | 500 | struct ArcProto *proto; |
497 | 501 | ||