aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/arcnet
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-10-09 04:40:57 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:52 -0400
commit3b04ddde02cf1b6f14f2697da5c20eca5715017f (patch)
tree9da1341a5a399a507b5ea6bf5a3047506b8d8f8f /drivers/net/arcnet
parentb95cce3576813ac3f86bafa6b5daaaaf7574b0fe (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')
-rw-r--r--drivers/net/arcnet/arcnet.c18
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);
102static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); 102static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev);
103static void arcnet_timeout(struct net_device *dev); 103static void arcnet_timeout(struct net_device *dev);
104static int arcnet_header(struct sk_buff *skb, struct net_device *dev, 104static 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);
107static int arcnet_rebuild_header(struct sk_buff *skb); 107static int arcnet_rebuild_header(struct sk_buff *skb);
108static struct net_device_stats *arcnet_get_stats(struct net_device *dev); 108static struct net_device_stats *arcnet_get_stats(struct net_device *dev);
109static int go_tx(struct net_device *dev); 109static 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
320static 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. */
322static void arcdev_setup(struct net_device *dev) 327static 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
349struct net_device *alloc_arcdev(char *name) 353struct net_device *alloc_arcdev(char *name)
@@ -488,10 +492,10 @@ static int arcnet_close(struct net_device *dev)
488 492
489 493
490static int arcnet_header(struct sk_buff *skb, struct net_device *dev, 494static 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