aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hamradio
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/hamradio
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/hamradio')
-rw-r--r--drivers/net/hamradio/6pack.c13
-rw-r--r--drivers/net/hamradio/baycom_epp.c3
-rw-r--r--drivers/net/hamradio/bpqether.c3
-rw-r--r--drivers/net/hamradio/dmascc.c3
-rw-r--r--drivers/net/hamradio/hdlcdrv.c3
-rw-r--r--drivers/net/hamradio/mkiss.c14
-rw-r--r--drivers/net/hamradio/scc.c4
-rw-r--r--drivers/net/hamradio/yam.c3
8 files changed, 27 insertions, 19 deletions
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 0a847326a5e4..ecd156def039 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -288,7 +288,8 @@ static int sp_close(struct net_device *dev)
288 288
289/* Return the frame type ID */ 289/* Return the frame type ID */
290static int sp_header(struct sk_buff *skb, struct net_device *dev, 290static int sp_header(struct sk_buff *skb, struct net_device *dev,
291 unsigned short type, void *daddr, void *saddr, unsigned len) 291 unsigned short type, const void *daddr,
292 const void *saddr, unsigned len)
292{ 293{
293#ifdef CONFIG_INET 294#ifdef CONFIG_INET
294 if (type != htons(ETH_P_AX25)) 295 if (type != htons(ETH_P_AX25))
@@ -323,6 +324,11 @@ static int sp_rebuild_header(struct sk_buff *skb)
323#endif 324#endif
324} 325}
325 326
327static const struct header_ops sp_header_ops = {
328 .create = sp_header,
329 .rebuild = sp_rebuild_header,
330};
331
326static void sp_setup(struct net_device *dev) 332static void sp_setup(struct net_device *dev)
327{ 333{
328 /* Finish setting up the DEVICE info. */ 334 /* Finish setting up the DEVICE info. */
@@ -331,14 +337,15 @@ static void sp_setup(struct net_device *dev)
331 dev->open = sp_open_dev; 337 dev->open = sp_open_dev;
332 dev->destructor = free_netdev; 338 dev->destructor = free_netdev;
333 dev->stop = sp_close; 339 dev->stop = sp_close;
334 dev->hard_header = sp_header; 340
335 dev->get_stats = sp_get_stats; 341 dev->get_stats = sp_get_stats;
336 dev->set_mac_address = sp_set_mac_address; 342 dev->set_mac_address = sp_set_mac_address;
337 dev->hard_header_len = AX25_MAX_HEADER_LEN; 343 dev->hard_header_len = AX25_MAX_HEADER_LEN;
344 dev->header_ops = &sp_header_ops;
345
338 dev->addr_len = AX25_ADDR_LEN; 346 dev->addr_len = AX25_ADDR_LEN;
339 dev->type = ARPHRD_AX25; 347 dev->type = ARPHRD_AX25;
340 dev->tx_queue_len = 10; 348 dev->tx_queue_len = 10;
341 dev->rebuild_header = sp_rebuild_header;
342 dev->tx_timeout = NULL; 349 dev->tx_timeout = NULL;
343 350
344 /* Only activated in AX.25 mode */ 351 /* Only activated in AX.25 mode */
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 355c6cf3d112..1a5a75acf73e 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -1159,8 +1159,7 @@ static void baycom_probe(struct net_device *dev)
1159 /* Fill in the fields of the device structure */ 1159 /* Fill in the fields of the device structure */
1160 bc->skb = NULL; 1160 bc->skb = NULL;
1161 1161
1162 dev->hard_header = ax25_hard_header; 1162 dev->header_ops = &ax25_header_ops;
1163 dev->rebuild_header = ax25_rebuild_header;
1164 dev->set_mac_address = baycom_set_mac_address; 1163 dev->set_mac_address = baycom_set_mac_address;
1165 1164
1166 dev->type = ARPHRD_AX25; /* AF_AX25 device */ 1165 dev->type = ARPHRD_AX25; /* AF_AX25 device */
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 4bff23e3b970..5ddf8b0c34f9 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -483,8 +483,7 @@ static void bpq_setup(struct net_device *dev)
483 dev->flags = 0; 483 dev->flags = 0;
484 484
485#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 485#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
486 dev->hard_header = ax25_hard_header; 486 dev->header_ops = &ax25_header_ops;
487 dev->rebuild_header = ax25_rebuild_header;
488#endif 487#endif
489 488
490 dev->type = ARPHRD_AX25; 489 dev->type = ARPHRD_AX25;
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 205f09672492..bc02e4694804 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -581,8 +581,7 @@ static int __init setup_adapter(int card_base, int type, int n)
581 dev->do_ioctl = scc_ioctl; 581 dev->do_ioctl = scc_ioctl;
582 dev->hard_start_xmit = scc_send_packet; 582 dev->hard_start_xmit = scc_send_packet;
583 dev->get_stats = scc_get_stats; 583 dev->get_stats = scc_get_stats;
584 dev->hard_header = ax25_hard_header; 584 dev->header_ops = &ax25_header_ops;
585 dev->rebuild_header = ax25_rebuild_header;
586 dev->set_mac_address = scc_set_mac_address; 585 dev->set_mac_address = scc_set_mac_address;
587 } 586 }
588 if (register_netdev(info->dev[0])) { 587 if (register_netdev(info->dev[0])) {
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index b33adc6a340b..ae9629fa6882 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -682,8 +682,7 @@ static void hdlcdrv_setup(struct net_device *dev)
682 682
683 s->skb = NULL; 683 s->skb = NULL;
684 684
685 dev->hard_header = ax25_hard_header; 685 dev->header_ops = &ax25_header_ops;
686 dev->rebuild_header = ax25_rebuild_header;
687 dev->set_mac_address = hdlcdrv_set_mac_address; 686 dev->set_mac_address = hdlcdrv_set_mac_address;
688 687
689 dev->type = ARPHRD_AX25; /* AF_AX25 device */ 688 dev->type = ARPHRD_AX25; /* AF_AX25 device */
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index d08fbc396648..9e43c47691ca 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -578,8 +578,9 @@ static int ax_open_dev(struct net_device *dev)
578#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 578#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
579 579
580/* Return the frame type ID */ 580/* Return the frame type ID */
581static int ax_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 581static int ax_header(struct sk_buff *skb, struct net_device *dev,
582 void *daddr, void *saddr, unsigned len) 582 unsigned short type, const void *daddr,
583 const void *saddr, unsigned len)
583{ 584{
584#ifdef CONFIG_INET 585#ifdef CONFIG_INET
585 if (type != htons(ETH_P_AX25)) 586 if (type != htons(ETH_P_AX25))
@@ -670,6 +671,11 @@ static struct net_device_stats *ax_get_stats(struct net_device *dev)
670 return &ax->stats; 671 return &ax->stats;
671} 672}
672 673
674static const struct header_ops ax_header_ops = {
675 .create = ax_header,
676 .rebuild = ax_rebuild_header,
677};
678
673static void ax_setup(struct net_device *dev) 679static void ax_setup(struct net_device *dev)
674{ 680{
675 /* Finish setting up the DEVICE info. */ 681 /* Finish setting up the DEVICE info. */
@@ -683,8 +689,8 @@ static void ax_setup(struct net_device *dev)
683 dev->addr_len = 0; 689 dev->addr_len = 0;
684 dev->type = ARPHRD_AX25; 690 dev->type = ARPHRD_AX25;
685 dev->tx_queue_len = 10; 691 dev->tx_queue_len = 10;
686 dev->hard_header = ax_header; 692 dev->header_ops = &ax_header_ops;
687 dev->rebuild_header = ax_rebuild_header; 693
688 694
689 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); 695 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
690 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); 696 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index 39b3b82aa4a4..353d13e543ce 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1551,8 +1551,8 @@ static void scc_net_setup(struct net_device *dev)
1551 dev->stop = scc_net_close; 1551 dev->stop = scc_net_close;
1552 1552
1553 dev->hard_start_xmit = scc_net_tx; 1553 dev->hard_start_xmit = scc_net_tx;
1554 dev->hard_header = ax25_hard_header; 1554 dev->header_ops = &ax25_header_ops;
1555 dev->rebuild_header = ax25_rebuild_header; 1555
1556 dev->set_mac_address = scc_net_set_mac_address; 1556 dev->set_mac_address = scc_net_set_mac_address;
1557 dev->get_stats = scc_net_get_stats; 1557 dev->get_stats = scc_net_get_stats;
1558 dev->do_ioctl = scc_net_ioctl; 1558 dev->do_ioctl = scc_net_ioctl;
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 401724ddafcd..1c942862a3f4 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -1097,8 +1097,7 @@ static void yam_setup(struct net_device *dev)
1097 1097
1098 skb_queue_head_init(&yp->send_queue); 1098 skb_queue_head_init(&yp->send_queue);
1099 1099
1100 dev->hard_header = ax25_hard_header; 1100 dev->header_ops = &ax25_header_ops;
1101 dev->rebuild_header = ax25_rebuild_header;
1102 1101
1103 dev->set_mac_address = yam_set_mac_address; 1102 dev->set_mac_address = yam_set_mac_address;
1104 1103