diff options
Diffstat (limited to 'drivers/net/hamradio')
-rw-r--r-- | drivers/net/hamradio/6pack.c | 16 | ||||
-rw-r--r-- | drivers/net/hamradio/baycom_epp.c | 43 | ||||
-rw-r--r-- | drivers/net/hamradio/bpqether.c | 40 | ||||
-rw-r--r-- | drivers/net/hamradio/dmascc.c | 54 | ||||
-rw-r--r-- | drivers/net/hamradio/hdlcdrv.c | 45 | ||||
-rw-r--r-- | drivers/net/hamradio/mkiss.c | 46 | ||||
-rw-r--r-- | drivers/net/hamradio/scc.c | 21 | ||||
-rw-r--r-- | drivers/net/hamradio/yam.c | 61 |
8 files changed, 130 insertions, 196 deletions
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 2d4089894ec7..3da9f394b4c6 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -322,23 +322,25 @@ static const struct header_ops sp_header_ops = { | |||
322 | .rebuild = sp_rebuild_header, | 322 | .rebuild = sp_rebuild_header, |
323 | }; | 323 | }; |
324 | 324 | ||
325 | static const struct net_device_ops sp_netdev_ops = { | ||
326 | .ndo_open = sp_open_dev, | ||
327 | .ndo_stop = sp_close, | ||
328 | .ndo_start_xmit = sp_xmit, | ||
329 | .ndo_set_mac_address = sp_set_mac_address, | ||
330 | }; | ||
331 | |||
325 | static void sp_setup(struct net_device *dev) | 332 | static void sp_setup(struct net_device *dev) |
326 | { | 333 | { |
327 | /* Finish setting up the DEVICE info. */ | 334 | /* Finish setting up the DEVICE info. */ |
328 | dev->mtu = SIXP_MTU; | 335 | dev->netdev_ops = &sp_netdev_ops; |
329 | dev->hard_start_xmit = sp_xmit; | ||
330 | dev->open = sp_open_dev; | ||
331 | dev->destructor = free_netdev; | 336 | dev->destructor = free_netdev; |
332 | dev->stop = sp_close; | 337 | dev->mtu = SIXP_MTU; |
333 | |||
334 | dev->set_mac_address = sp_set_mac_address; | ||
335 | dev->hard_header_len = AX25_MAX_HEADER_LEN; | 338 | dev->hard_header_len = AX25_MAX_HEADER_LEN; |
336 | dev->header_ops = &sp_header_ops; | 339 | dev->header_ops = &sp_header_ops; |
337 | 340 | ||
338 | dev->addr_len = AX25_ADDR_LEN; | 341 | dev->addr_len = AX25_ADDR_LEN; |
339 | dev->type = ARPHRD_AX25; | 342 | dev->type = ARPHRD_AX25; |
340 | dev->tx_queue_len = 10; | 343 | dev->tx_queue_len = 10; |
341 | dev->tx_timeout = NULL; | ||
342 | 344 | ||
343 | /* Only activated in AX.25 mode */ | 345 | /* Only activated in AX.25 mode */ |
344 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); | 346 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); |
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 81a65e3a1c05..bb78c11559cd 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c | |||
@@ -203,7 +203,6 @@ struct baycom_state { | |||
203 | unsigned char buf[TXBUFFER_SIZE]; | 203 | unsigned char buf[TXBUFFER_SIZE]; |
204 | } hdlctx; | 204 | } hdlctx; |
205 | 205 | ||
206 | struct net_device_stats stats; | ||
207 | unsigned int ptt_keyed; | 206 | unsigned int ptt_keyed; |
208 | struct sk_buff *skb; /* next transmit packet */ | 207 | struct sk_buff *skb; /* next transmit packet */ |
209 | 208 | ||
@@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_state *bc) | |||
423 | bc->hdlctx.bufptr = bc->hdlctx.buf; | 422 | bc->hdlctx.bufptr = bc->hdlctx.buf; |
424 | bc->hdlctx.bufcnt = wp - bc->hdlctx.buf; | 423 | bc->hdlctx.bufcnt = wp - bc->hdlctx.buf; |
425 | dev_kfree_skb(skb); | 424 | dev_kfree_skb(skb); |
426 | bc->stats.tx_packets++; | 425 | bc->dev->stats.tx_packets++; |
427 | } | 426 | } |
428 | 427 | ||
429 | /* ---------------------------------------------------------------------- */ | 428 | /* ---------------------------------------------------------------------- */ |
@@ -547,7 +546,7 @@ static void do_rxpacket(struct net_device *dev) | |||
547 | pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */ | 546 | pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */ |
548 | if (!(skb = dev_alloc_skb(pktlen))) { | 547 | if (!(skb = dev_alloc_skb(pktlen))) { |
549 | printk("%s: memory squeeze, dropping packet\n", dev->name); | 548 | printk("%s: memory squeeze, dropping packet\n", dev->name); |
550 | bc->stats.rx_dropped++; | 549 | dev->stats.rx_dropped++; |
551 | return; | 550 | return; |
552 | } | 551 | } |
553 | cp = skb_put(skb, pktlen); | 552 | cp = skb_put(skb, pktlen); |
@@ -555,7 +554,7 @@ static void do_rxpacket(struct net_device *dev) | |||
555 | memcpy(cp, bc->hdlcrx.buf, pktlen - 1); | 554 | memcpy(cp, bc->hdlcrx.buf, pktlen - 1); |
556 | skb->protocol = ax25_type_trans(skb, dev); | 555 | skb->protocol = ax25_type_trans(skb, dev); |
557 | netif_rx(skb); | 556 | netif_rx(skb); |
558 | bc->stats.rx_packets++; | 557 | dev->stats.rx_packets++; |
559 | } | 558 | } |
560 | 559 | ||
561 | static int receive(struct net_device *dev, int cnt) | 560 | static int receive(struct net_device *dev, int cnt) |
@@ -802,19 +801,6 @@ static int baycom_set_mac_address(struct net_device *dev, void *addr) | |||
802 | 801 | ||
803 | /* --------------------------------------------------------------------- */ | 802 | /* --------------------------------------------------------------------- */ |
804 | 803 | ||
805 | static struct net_device_stats *baycom_get_stats(struct net_device *dev) | ||
806 | { | ||
807 | struct baycom_state *bc = netdev_priv(dev); | ||
808 | |||
809 | /* | ||
810 | * Get the current statistics. This may be called with the | ||
811 | * card open or closed. | ||
812 | */ | ||
813 | return &bc->stats; | ||
814 | } | ||
815 | |||
816 | /* --------------------------------------------------------------------- */ | ||
817 | |||
818 | static void epp_wakeup(void *handle) | 804 | static void epp_wakeup(void *handle) |
819 | { | 805 | { |
820 | struct net_device *dev = (struct net_device *)handle; | 806 | struct net_device *dev = (struct net_device *)handle; |
@@ -1065,10 +1051,10 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1065 | hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT); | 1051 | hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT); |
1066 | hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT); | 1052 | hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT); |
1067 | hi.data.cs.ptt_keyed = bc->ptt_keyed; | 1053 | hi.data.cs.ptt_keyed = bc->ptt_keyed; |
1068 | hi.data.cs.tx_packets = bc->stats.tx_packets; | 1054 | hi.data.cs.tx_packets = dev->stats.tx_packets; |
1069 | hi.data.cs.tx_errors = bc->stats.tx_errors; | 1055 | hi.data.cs.tx_errors = dev->stats.tx_errors; |
1070 | hi.data.cs.rx_packets = bc->stats.rx_packets; | 1056 | hi.data.cs.rx_packets = dev->stats.rx_packets; |
1071 | hi.data.cs.rx_errors = bc->stats.rx_errors; | 1057 | hi.data.cs.rx_errors = dev->stats.rx_errors; |
1072 | break; | 1058 | break; |
1073 | 1059 | ||
1074 | case HDLCDRVCTL_OLDGETSTAT: | 1060 | case HDLCDRVCTL_OLDGETSTAT: |
@@ -1116,6 +1102,14 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1116 | 1102 | ||
1117 | /* --------------------------------------------------------------------- */ | 1103 | /* --------------------------------------------------------------------- */ |
1118 | 1104 | ||
1105 | static const struct net_device_ops baycom_netdev_ops = { | ||
1106 | .ndo_open = epp_open, | ||
1107 | .ndo_stop = epp_close, | ||
1108 | .ndo_do_ioctl = baycom_ioctl, | ||
1109 | .ndo_start_xmit = baycom_send_packet, | ||
1110 | .ndo_set_mac_address = baycom_set_mac_address, | ||
1111 | }; | ||
1112 | |||
1119 | /* | 1113 | /* |
1120 | * Check for a network adaptor of this type, and return '0' if one exists. | 1114 | * Check for a network adaptor of this type, and return '0' if one exists. |
1121 | * If dev->base_addr == 0, probe all likely locations. | 1115 | * If dev->base_addr == 0, probe all likely locations. |
@@ -1143,17 +1137,12 @@ static void baycom_probe(struct net_device *dev) | |||
1143 | /* | 1137 | /* |
1144 | * initialize the device struct | 1138 | * initialize the device struct |
1145 | */ | 1139 | */ |
1146 | dev->open = epp_open; | ||
1147 | dev->stop = epp_close; | ||
1148 | dev->do_ioctl = baycom_ioctl; | ||
1149 | dev->hard_start_xmit = baycom_send_packet; | ||
1150 | dev->get_stats = baycom_get_stats; | ||
1151 | 1140 | ||
1152 | /* Fill in the fields of the device structure */ | 1141 | /* Fill in the fields of the device structure */ |
1153 | bc->skb = NULL; | 1142 | bc->skb = NULL; |
1154 | 1143 | ||
1144 | dev->netdev_ops = &baycom_netdev_ops; | ||
1155 | dev->header_ops = &ax25_header_ops; | 1145 | dev->header_ops = &ax25_header_ops; |
1156 | dev->set_mac_address = baycom_set_mac_address; | ||
1157 | 1146 | ||
1158 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ | 1147 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ |
1159 | dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN; | 1148 | dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN; |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 46f8f3390e7d..2c619bc99ae7 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -97,7 +97,7 @@ static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, | |||
97 | static int bpq_device_event(struct notifier_block *, unsigned long, void *); | 97 | static int bpq_device_event(struct notifier_block *, unsigned long, void *); |
98 | 98 | ||
99 | static struct packet_type bpq_packet_type = { | 99 | static struct packet_type bpq_packet_type = { |
100 | .type = __constant_htons(ETH_P_BPQ), | 100 | .type = cpu_to_be16(ETH_P_BPQ), |
101 | .func = bpq_rcv, | 101 | .func = bpq_rcv, |
102 | }; | 102 | }; |
103 | 103 | ||
@@ -110,7 +110,6 @@ struct bpqdev { | |||
110 | struct list_head bpq_list; /* list of bpq devices chain */ | 110 | struct list_head bpq_list; /* list of bpq devices chain */ |
111 | struct net_device *ethdev; /* link to ethernet device */ | 111 | struct net_device *ethdev; /* link to ethernet device */ |
112 | struct net_device *axdev; /* bpq device (bpq#) */ | 112 | struct net_device *axdev; /* bpq device (bpq#) */ |
113 | struct net_device_stats stats; /* some statistics */ | ||
114 | char dest_addr[6]; /* ether destination address */ | 113 | char dest_addr[6]; /* ether destination address */ |
115 | char acpt_addr[6]; /* accept ether frames from this address only */ | 114 | char acpt_addr[6]; /* accept ether frames from this address only */ |
116 | }; | 115 | }; |
@@ -222,8 +221,8 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty | |||
222 | skb_pull(skb, 2); /* Remove the length bytes */ | 221 | skb_pull(skb, 2); /* Remove the length bytes */ |
223 | skb_trim(skb, len); /* Set the length of the data */ | 222 | skb_trim(skb, len); /* Set the length of the data */ |
224 | 223 | ||
225 | bpq->stats.rx_packets++; | 224 | dev->stats.rx_packets++; |
226 | bpq->stats.rx_bytes += len; | 225 | dev->stats.rx_bytes += len; |
227 | 226 | ||
228 | ptr = skb_push(skb, 1); | 227 | ptr = skb_push(skb, 1); |
229 | *ptr = 0; | 228 | *ptr = 0; |
@@ -292,7 +291,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev) | |||
292 | bpq = netdev_priv(dev); | 291 | bpq = netdev_priv(dev); |
293 | 292 | ||
294 | if ((dev = bpq_get_ether_dev(dev)) == NULL) { | 293 | if ((dev = bpq_get_ether_dev(dev)) == NULL) { |
295 | bpq->stats.tx_dropped++; | 294 | dev->stats.tx_dropped++; |
296 | kfree_skb(skb); | 295 | kfree_skb(skb); |
297 | return -ENODEV; | 296 | return -ENODEV; |
298 | } | 297 | } |
@@ -300,8 +299,8 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev) | |||
300 | skb->protocol = ax25_type_trans(skb, dev); | 299 | skb->protocol = ax25_type_trans(skb, dev); |
301 | skb_reset_network_header(skb); | 300 | skb_reset_network_header(skb); |
302 | dev_hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0); | 301 | dev_hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0); |
303 | bpq->stats.tx_packets++; | 302 | dev->stats.tx_packets++; |
304 | bpq->stats.tx_bytes+=skb->len; | 303 | dev->stats.tx_bytes+=skb->len; |
305 | 304 | ||
306 | dev_queue_xmit(skb); | 305 | dev_queue_xmit(skb); |
307 | netif_wake_queue(dev); | 306 | netif_wake_queue(dev); |
@@ -309,16 +308,6 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev) | |||
309 | } | 308 | } |
310 | 309 | ||
311 | /* | 310 | /* |
312 | * Statistics | ||
313 | */ | ||
314 | static struct net_device_stats *bpq_get_stats(struct net_device *dev) | ||
315 | { | ||
316 | struct bpqdev *bpq = netdev_priv(dev); | ||
317 | |||
318 | return &bpq->stats; | ||
319 | } | ||
320 | |||
321 | /* | ||
322 | * Set AX.25 callsign | 311 | * Set AX.25 callsign |
323 | */ | 312 | */ |
324 | static int bpq_set_mac_address(struct net_device *dev, void *addr) | 313 | static int bpq_set_mac_address(struct net_device *dev, void *addr) |
@@ -454,7 +443,7 @@ static int bpq_seq_show(struct seq_file *seq, void *v) | |||
454 | return 0; | 443 | return 0; |
455 | } | 444 | } |
456 | 445 | ||
457 | static struct seq_operations bpq_seqops = { | 446 | static const struct seq_operations bpq_seqops = { |
458 | .start = bpq_seq_start, | 447 | .start = bpq_seq_start, |
459 | .next = bpq_seq_next, | 448 | .next = bpq_seq_next, |
460 | .stop = bpq_seq_stop, | 449 | .stop = bpq_seq_stop, |
@@ -477,16 +466,17 @@ static const struct file_operations bpq_info_fops = { | |||
477 | 466 | ||
478 | /* ------------------------------------------------------------------------ */ | 467 | /* ------------------------------------------------------------------------ */ |
479 | 468 | ||
469 | static const struct net_device_ops bpq_netdev_ops = { | ||
470 | .ndo_open = bpq_open, | ||
471 | .ndo_stop = bpq_close, | ||
472 | .ndo_start_xmit = bpq_xmit, | ||
473 | .ndo_set_mac_address = bpq_set_mac_address, | ||
474 | .ndo_do_ioctl = bpq_ioctl, | ||
475 | }; | ||
480 | 476 | ||
481 | static void bpq_setup(struct net_device *dev) | 477 | static void bpq_setup(struct net_device *dev) |
482 | { | 478 | { |
483 | 479 | dev->netdev_ops = &bpq_netdev_ops; | |
484 | dev->hard_start_xmit = bpq_xmit; | ||
485 | dev->open = bpq_open; | ||
486 | dev->stop = bpq_close; | ||
487 | dev->set_mac_address = bpq_set_mac_address; | ||
488 | dev->get_stats = bpq_get_stats; | ||
489 | dev->do_ioctl = bpq_ioctl; | ||
490 | dev->destructor = free_netdev; | 480 | dev->destructor = free_netdev; |
491 | 481 | ||
492 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); | 482 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); |
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c index e67103396ed7..881bf818bb48 100644 --- a/drivers/net/hamradio/dmascc.c +++ b/drivers/net/hamradio/dmascc.c | |||
@@ -195,7 +195,7 @@ struct scc_priv { | |||
195 | int chip; | 195 | int chip; |
196 | struct net_device *dev; | 196 | struct net_device *dev; |
197 | struct scc_info *info; | 197 | struct scc_info *info; |
198 | struct net_device_stats stats; | 198 | |
199 | int channel; | 199 | int channel; |
200 | int card_base, scc_cmd, scc_data; | 200 | int card_base, scc_cmd, scc_data; |
201 | int tmr_cnt, tmr_ctrl, tmr_mode; | 201 | int tmr_cnt, tmr_ctrl, tmr_mode; |
@@ -239,7 +239,6 @@ static int scc_open(struct net_device *dev); | |||
239 | static int scc_close(struct net_device *dev); | 239 | static int scc_close(struct net_device *dev); |
240 | static int scc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | 240 | static int scc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); |
241 | static int scc_send_packet(struct sk_buff *skb, struct net_device *dev); | 241 | static int scc_send_packet(struct sk_buff *skb, struct net_device *dev); |
242 | static struct net_device_stats *scc_get_stats(struct net_device *dev); | ||
243 | static int scc_set_mac_address(struct net_device *dev, void *sa); | 242 | static int scc_set_mac_address(struct net_device *dev, void *sa); |
244 | 243 | ||
245 | static inline void tx_on(struct scc_priv *priv); | 244 | static inline void tx_on(struct scc_priv *priv); |
@@ -441,6 +440,13 @@ static void __init dev_setup(struct net_device *dev) | |||
441 | memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); | 440 | memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); |
442 | } | 441 | } |
443 | 442 | ||
443 | static const struct net_device_ops scc_netdev_ops = { | ||
444 | .ndo_open = scc_open, | ||
445 | .ndo_stop = scc_close, | ||
446 | .ndo_start_xmit = scc_send_packet, | ||
447 | .ndo_do_ioctl = scc_ioctl, | ||
448 | }; | ||
449 | |||
444 | static int __init setup_adapter(int card_base, int type, int n) | 450 | static int __init setup_adapter(int card_base, int type, int n) |
445 | { | 451 | { |
446 | int i, irq, chip; | 452 | int i, irq, chip; |
@@ -576,11 +582,7 @@ static int __init setup_adapter(int card_base, int type, int n) | |||
576 | sprintf(dev->name, "dmascc%i", 2 * n + i); | 582 | sprintf(dev->name, "dmascc%i", 2 * n + i); |
577 | dev->base_addr = card_base; | 583 | dev->base_addr = card_base; |
578 | dev->irq = irq; | 584 | dev->irq = irq; |
579 | dev->open = scc_open; | 585 | dev->netdev_ops = &scc_netdev_ops; |
580 | dev->stop = scc_close; | ||
581 | dev->do_ioctl = scc_ioctl; | ||
582 | dev->hard_start_xmit = scc_send_packet; | ||
583 | dev->get_stats = scc_get_stats; | ||
584 | dev->header_ops = &ax25_header_ops; | 586 | dev->header_ops = &ax25_header_ops; |
585 | dev->set_mac_address = scc_set_mac_address; | 587 | dev->set_mac_address = scc_set_mac_address; |
586 | } | 588 | } |
@@ -961,14 +963,6 @@ static int scc_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
961 | } | 963 | } |
962 | 964 | ||
963 | 965 | ||
964 | static struct net_device_stats *scc_get_stats(struct net_device *dev) | ||
965 | { | ||
966 | struct scc_priv *priv = dev->ml_priv; | ||
967 | |||
968 | return &priv->stats; | ||
969 | } | ||
970 | |||
971 | |||
972 | static int scc_set_mac_address(struct net_device *dev, void *sa) | 966 | static int scc_set_mac_address(struct net_device *dev, void *sa) |
973 | { | 967 | { |
974 | memcpy(dev->dev_addr, ((struct sockaddr *) sa)->sa_data, | 968 | memcpy(dev->dev_addr, ((struct sockaddr *) sa)->sa_data, |
@@ -1216,17 +1210,17 @@ static void special_condition(struct scc_priv *priv, int rc) | |||
1216 | } | 1210 | } |
1217 | if (priv->rx_over) { | 1211 | if (priv->rx_over) { |
1218 | /* We had an overrun */ | 1212 | /* We had an overrun */ |
1219 | priv->stats.rx_errors++; | 1213 | priv->dev->stats.rx_errors++; |
1220 | if (priv->rx_over == 2) | 1214 | if (priv->rx_over == 2) |
1221 | priv->stats.rx_length_errors++; | 1215 | priv->dev->stats.rx_length_errors++; |
1222 | else | 1216 | else |
1223 | priv->stats.rx_fifo_errors++; | 1217 | priv->dev->stats.rx_fifo_errors++; |
1224 | priv->rx_over = 0; | 1218 | priv->rx_over = 0; |
1225 | } else if (rc & CRC_ERR) { | 1219 | } else if (rc & CRC_ERR) { |
1226 | /* Count invalid CRC only if packet length >= minimum */ | 1220 | /* Count invalid CRC only if packet length >= minimum */ |
1227 | if (cb >= 15) { | 1221 | if (cb >= 15) { |
1228 | priv->stats.rx_errors++; | 1222 | priv->dev->stats.rx_errors++; |
1229 | priv->stats.rx_crc_errors++; | 1223 | priv->dev->stats.rx_crc_errors++; |
1230 | } | 1224 | } |
1231 | } else { | 1225 | } else { |
1232 | if (cb >= 15) { | 1226 | if (cb >= 15) { |
@@ -1239,8 +1233,8 @@ static void special_condition(struct scc_priv *priv, int rc) | |||
1239 | priv->rx_count++; | 1233 | priv->rx_count++; |
1240 | schedule_work(&priv->rx_work); | 1234 | schedule_work(&priv->rx_work); |
1241 | } else { | 1235 | } else { |
1242 | priv->stats.rx_errors++; | 1236 | priv->dev->stats.rx_errors++; |
1243 | priv->stats.rx_over_errors++; | 1237 | priv->dev->stats.rx_over_errors++; |
1244 | } | 1238 | } |
1245 | } | 1239 | } |
1246 | } | 1240 | } |
@@ -1275,7 +1269,7 @@ static void rx_bh(struct work_struct *ugli_api) | |||
1275 | skb = dev_alloc_skb(cb + 1); | 1269 | skb = dev_alloc_skb(cb + 1); |
1276 | if (skb == NULL) { | 1270 | if (skb == NULL) { |
1277 | /* Drop packet */ | 1271 | /* Drop packet */ |
1278 | priv->stats.rx_dropped++; | 1272 | priv->dev->stats.rx_dropped++; |
1279 | } else { | 1273 | } else { |
1280 | /* Fill buffer */ | 1274 | /* Fill buffer */ |
1281 | data = skb_put(skb, cb + 1); | 1275 | data = skb_put(skb, cb + 1); |
@@ -1283,8 +1277,8 @@ static void rx_bh(struct work_struct *ugli_api) | |||
1283 | memcpy(&data[1], priv->rx_buf[i], cb); | 1277 | memcpy(&data[1], priv->rx_buf[i], cb); |
1284 | skb->protocol = ax25_type_trans(skb, priv->dev); | 1278 | skb->protocol = ax25_type_trans(skb, priv->dev); |
1285 | netif_rx(skb); | 1279 | netif_rx(skb); |
1286 | priv->stats.rx_packets++; | 1280 | priv->dev->stats.rx_packets++; |
1287 | priv->stats.rx_bytes += cb; | 1281 | priv->dev->stats.rx_bytes += cb; |
1288 | } | 1282 | } |
1289 | spin_lock_irqsave(&priv->ring_lock, flags); | 1283 | spin_lock_irqsave(&priv->ring_lock, flags); |
1290 | /* Move tail */ | 1284 | /* Move tail */ |
@@ -1351,15 +1345,15 @@ static void es_isr(struct scc_priv *priv) | |||
1351 | write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN); | 1345 | write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN); |
1352 | if (res) { | 1346 | if (res) { |
1353 | /* Update packet statistics */ | 1347 | /* Update packet statistics */ |
1354 | priv->stats.tx_errors++; | 1348 | priv->dev->stats.tx_errors++; |
1355 | priv->stats.tx_fifo_errors++; | 1349 | priv->dev->stats.tx_fifo_errors++; |
1356 | /* Other underrun interrupts may already be waiting */ | 1350 | /* Other underrun interrupts may already be waiting */ |
1357 | write_scc(priv, R0, RES_EXT_INT); | 1351 | write_scc(priv, R0, RES_EXT_INT); |
1358 | write_scc(priv, R0, RES_EXT_INT); | 1352 | write_scc(priv, R0, RES_EXT_INT); |
1359 | } else { | 1353 | } else { |
1360 | /* Update packet statistics */ | 1354 | /* Update packet statistics */ |
1361 | priv->stats.tx_packets++; | 1355 | priv->dev->stats.tx_packets++; |
1362 | priv->stats.tx_bytes += priv->tx_len[i]; | 1356 | priv->dev->stats.tx_bytes += priv->tx_len[i]; |
1363 | /* Remove frame from FIFO */ | 1357 | /* Remove frame from FIFO */ |
1364 | priv->tx_tail = (i + 1) % NUM_TX_BUF; | 1358 | priv->tx_tail = (i + 1) % NUM_TX_BUF; |
1365 | priv->tx_count--; | 1359 | priv->tx_count--; |
@@ -1425,7 +1419,7 @@ static void tm_isr(struct scc_priv *priv) | |||
1425 | write_scc(priv, R15, DCDIE); | 1419 | write_scc(priv, R15, DCDIE); |
1426 | priv->rr0 = read_scc(priv, R0); | 1420 | priv->rr0 = read_scc(priv, R0); |
1427 | if (priv->rr0 & DCD) { | 1421 | if (priv->rr0 & DCD) { |
1428 | priv->stats.collisions++; | 1422 | priv->dev->stats.collisions++; |
1429 | rx_on(priv); | 1423 | rx_on(priv); |
1430 | priv->state = RX_ON; | 1424 | priv->state = RX_ON; |
1431 | } else { | 1425 | } else { |
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c index 8eba61a1d4ab..61de56e45eed 100644 --- a/drivers/net/hamradio/hdlcdrv.c +++ b/drivers/net/hamradio/hdlcdrv.c | |||
@@ -154,7 +154,7 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s) | |||
154 | pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */ | 154 | pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */ |
155 | if (!(skb = dev_alloc_skb(pkt_len))) { | 155 | if (!(skb = dev_alloc_skb(pkt_len))) { |
156 | printk("%s: memory squeeze, dropping packet\n", dev->name); | 156 | printk("%s: memory squeeze, dropping packet\n", dev->name); |
157 | s->stats.rx_dropped++; | 157 | dev->stats.rx_dropped++; |
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | cp = skb_put(skb, pkt_len); | 160 | cp = skb_put(skb, pkt_len); |
@@ -162,7 +162,7 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s) | |||
162 | memcpy(cp, s->hdlcrx.buffer, pkt_len - 1); | 162 | memcpy(cp, s->hdlcrx.buffer, pkt_len - 1); |
163 | skb->protocol = ax25_type_trans(skb, dev); | 163 | skb->protocol = ax25_type_trans(skb, dev); |
164 | netif_rx(skb); | 164 | netif_rx(skb); |
165 | s->stats.rx_packets++; | 165 | dev->stats.rx_packets++; |
166 | } | 166 | } |
167 | 167 | ||
168 | void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s) | 168 | void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s) |
@@ -326,7 +326,7 @@ void hdlcdrv_transmitter(struct net_device *dev, struct hdlcdrv_state *s) | |||
326 | s->hdlctx.len = pkt_len+2; /* the appended CRC */ | 326 | s->hdlctx.len = pkt_len+2; /* the appended CRC */ |
327 | s->hdlctx.tx_state = 2; | 327 | s->hdlctx.tx_state = 2; |
328 | s->hdlctx.bitstream = 0; | 328 | s->hdlctx.bitstream = 0; |
329 | s->stats.tx_packets++; | 329 | dev->stats.tx_packets++; |
330 | break; | 330 | break; |
331 | case 2: | 331 | case 2: |
332 | if (!s->hdlctx.len) { | 332 | if (!s->hdlctx.len) { |
@@ -427,19 +427,6 @@ static int hdlcdrv_set_mac_address(struct net_device *dev, void *addr) | |||
427 | } | 427 | } |
428 | 428 | ||
429 | /* --------------------------------------------------------------------- */ | 429 | /* --------------------------------------------------------------------- */ |
430 | |||
431 | static struct net_device_stats *hdlcdrv_get_stats(struct net_device *dev) | ||
432 | { | ||
433 | struct hdlcdrv_state *sm = netdev_priv(dev); | ||
434 | |||
435 | /* | ||
436 | * Get the current statistics. This may be called with the | ||
437 | * card open or closed. | ||
438 | */ | ||
439 | return &sm->stats; | ||
440 | } | ||
441 | |||
442 | /* --------------------------------------------------------------------- */ | ||
443 | /* | 430 | /* |
444 | * Open/initialize the board. This is called (in the current kernel) | 431 | * Open/initialize the board. This is called (in the current kernel) |
445 | * sometime after booting when the 'ifconfig' program is run. | 432 | * sometime after booting when the 'ifconfig' program is run. |
@@ -568,10 +555,10 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
568 | bi.data.cs.ptt = hdlcdrv_ptt(s); | 555 | bi.data.cs.ptt = hdlcdrv_ptt(s); |
569 | bi.data.cs.dcd = s->hdlcrx.dcd; | 556 | bi.data.cs.dcd = s->hdlcrx.dcd; |
570 | bi.data.cs.ptt_keyed = s->ptt_keyed; | 557 | bi.data.cs.ptt_keyed = s->ptt_keyed; |
571 | bi.data.cs.tx_packets = s->stats.tx_packets; | 558 | bi.data.cs.tx_packets = dev->stats.tx_packets; |
572 | bi.data.cs.tx_errors = s->stats.tx_errors; | 559 | bi.data.cs.tx_errors = dev->stats.tx_errors; |
573 | bi.data.cs.rx_packets = s->stats.rx_packets; | 560 | bi.data.cs.rx_packets = dev->stats.rx_packets; |
574 | bi.data.cs.rx_errors = s->stats.rx_errors; | 561 | bi.data.cs.rx_errors = dev->stats.rx_errors; |
575 | break; | 562 | break; |
576 | 563 | ||
577 | case HDLCDRVCTL_OLDGETSTAT: | 564 | case HDLCDRVCTL_OLDGETSTAT: |
@@ -630,6 +617,14 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
630 | 617 | ||
631 | /* --------------------------------------------------------------------- */ | 618 | /* --------------------------------------------------------------------- */ |
632 | 619 | ||
620 | static const struct net_device_ops hdlcdrv_netdev = { | ||
621 | .ndo_open = hdlcdrv_open, | ||
622 | .ndo_stop = hdlcdrv_close, | ||
623 | .ndo_start_xmit = hdlcdrv_send_packet, | ||
624 | .ndo_do_ioctl = hdlcdrv_ioctl, | ||
625 | .ndo_set_mac_address = hdlcdrv_set_mac_address, | ||
626 | }; | ||
627 | |||
633 | /* | 628 | /* |
634 | * Initialize fields in hdlcdrv | 629 | * Initialize fields in hdlcdrv |
635 | */ | 630 | */ |
@@ -669,21 +664,13 @@ static void hdlcdrv_setup(struct net_device *dev) | |||
669 | s->bitbuf_hdlc.shreg = 0x80; | 664 | s->bitbuf_hdlc.shreg = 0x80; |
670 | #endif /* HDLCDRV_DEBUG */ | 665 | #endif /* HDLCDRV_DEBUG */ |
671 | 666 | ||
672 | /* | ||
673 | * initialize the device struct | ||
674 | */ | ||
675 | dev->open = hdlcdrv_open; | ||
676 | dev->stop = hdlcdrv_close; | ||
677 | dev->do_ioctl = hdlcdrv_ioctl; | ||
678 | dev->hard_start_xmit = hdlcdrv_send_packet; | ||
679 | dev->get_stats = hdlcdrv_get_stats; | ||
680 | 667 | ||
681 | /* Fill in the fields of the device structure */ | 668 | /* Fill in the fields of the device structure */ |
682 | 669 | ||
683 | s->skb = NULL; | 670 | s->skb = NULL; |
684 | 671 | ||
672 | dev->netdev_ops = &hdlcdrv_netdev; | ||
685 | dev->header_ops = &ax25_header_ops; | 673 | dev->header_ops = &ax25_header_ops; |
686 | dev->set_mac_address = hdlcdrv_set_mac_address; | ||
687 | 674 | ||
688 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ | 675 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ |
689 | dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN; | 676 | dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN; |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index bbdb311b8420..ed5b37d43334 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -59,8 +59,6 @@ struct mkiss { | |||
59 | unsigned char *xhead; /* pointer to next byte to XMIT */ | 59 | unsigned char *xhead; /* pointer to next byte to XMIT */ |
60 | int xleft; /* bytes left in XMIT queue */ | 60 | int xleft; /* bytes left in XMIT queue */ |
61 | 61 | ||
62 | struct net_device_stats stats; | ||
63 | |||
64 | /* Detailed SLIP statistics. */ | 62 | /* Detailed SLIP statistics. */ |
65 | int mtu; /* Our mtu (to spot changes!) */ | 63 | int mtu; /* Our mtu (to spot changes!) */ |
66 | int buffsize; /* Max buffers sizes */ | 64 | int buffsize; /* Max buffers sizes */ |
@@ -253,7 +251,7 @@ static void ax_bump(struct mkiss *ax) | |||
253 | if (ax->rbuff[0] > 0x0f) { | 251 | if (ax->rbuff[0] > 0x0f) { |
254 | if (ax->rbuff[0] & 0x80) { | 252 | if (ax->rbuff[0] & 0x80) { |
255 | if (check_crc_16(ax->rbuff, ax->rcount) < 0) { | 253 | if (check_crc_16(ax->rbuff, ax->rcount) < 0) { |
256 | ax->stats.rx_errors++; | 254 | ax->dev->stats.rx_errors++; |
257 | spin_unlock_bh(&ax->buflock); | 255 | spin_unlock_bh(&ax->buflock); |
258 | 256 | ||
259 | return; | 257 | return; |
@@ -268,7 +266,7 @@ static void ax_bump(struct mkiss *ax) | |||
268 | *ax->rbuff &= ~0x80; | 266 | *ax->rbuff &= ~0x80; |
269 | } else if (ax->rbuff[0] & 0x20) { | 267 | } else if (ax->rbuff[0] & 0x20) { |
270 | if (check_crc_flex(ax->rbuff, ax->rcount) < 0) { | 268 | if (check_crc_flex(ax->rbuff, ax->rcount) < 0) { |
271 | ax->stats.rx_errors++; | 269 | ax->dev->stats.rx_errors++; |
272 | spin_unlock_bh(&ax->buflock); | 270 | spin_unlock_bh(&ax->buflock); |
273 | return; | 271 | return; |
274 | } | 272 | } |
@@ -295,7 +293,7 @@ static void ax_bump(struct mkiss *ax) | |||
295 | if ((skb = dev_alloc_skb(count)) == NULL) { | 293 | if ((skb = dev_alloc_skb(count)) == NULL) { |
296 | printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", | 294 | printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", |
297 | ax->dev->name); | 295 | ax->dev->name); |
298 | ax->stats.rx_dropped++; | 296 | ax->dev->stats.rx_dropped++; |
299 | spin_unlock_bh(&ax->buflock); | 297 | spin_unlock_bh(&ax->buflock); |
300 | return; | 298 | return; |
301 | } | 299 | } |
@@ -303,8 +301,8 @@ static void ax_bump(struct mkiss *ax) | |||
303 | memcpy(skb_put(skb,count), ax->rbuff, count); | 301 | memcpy(skb_put(skb,count), ax->rbuff, count); |
304 | skb->protocol = ax25_type_trans(skb, ax->dev); | 302 | skb->protocol = ax25_type_trans(skb, ax->dev); |
305 | netif_rx(skb); | 303 | netif_rx(skb); |
306 | ax->stats.rx_packets++; | 304 | ax->dev->stats.rx_packets++; |
307 | ax->stats.rx_bytes += count; | 305 | ax->dev->stats.rx_bytes += count; |
308 | spin_unlock_bh(&ax->buflock); | 306 | spin_unlock_bh(&ax->buflock); |
309 | } | 307 | } |
310 | 308 | ||
@@ -344,7 +342,7 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s) | |||
344 | return; | 342 | return; |
345 | } | 343 | } |
346 | 344 | ||
347 | ax->stats.rx_over_errors++; | 345 | ax->dev->stats.rx_over_errors++; |
348 | set_bit(AXF_ERROR, &ax->flags); | 346 | set_bit(AXF_ERROR, &ax->flags); |
349 | } | 347 | } |
350 | spin_unlock_bh(&ax->buflock); | 348 | spin_unlock_bh(&ax->buflock); |
@@ -406,7 +404,7 @@ static void ax_changedmtu(struct mkiss *ax) | |||
406 | memcpy(ax->xbuff, ax->xhead, ax->xleft); | 404 | memcpy(ax->xbuff, ax->xhead, ax->xleft); |
407 | } else { | 405 | } else { |
408 | ax->xleft = 0; | 406 | ax->xleft = 0; |
409 | ax->stats.tx_dropped++; | 407 | dev->stats.tx_dropped++; |
410 | } | 408 | } |
411 | } | 409 | } |
412 | 410 | ||
@@ -417,7 +415,7 @@ static void ax_changedmtu(struct mkiss *ax) | |||
417 | memcpy(ax->rbuff, orbuff, ax->rcount); | 415 | memcpy(ax->rbuff, orbuff, ax->rcount); |
418 | } else { | 416 | } else { |
419 | ax->rcount = 0; | 417 | ax->rcount = 0; |
420 | ax->stats.rx_over_errors++; | 418 | dev->stats.rx_over_errors++; |
421 | set_bit(AXF_ERROR, &ax->flags); | 419 | set_bit(AXF_ERROR, &ax->flags); |
422 | } | 420 | } |
423 | } | 421 | } |
@@ -444,7 +442,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) | |||
444 | if (len > ax->mtu) { /* Sigh, shouldn't occur BUT ... */ | 442 | if (len > ax->mtu) { /* Sigh, shouldn't occur BUT ... */ |
445 | len = ax->mtu; | 443 | len = ax->mtu; |
446 | printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name); | 444 | printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name); |
447 | ax->stats.tx_dropped++; | 445 | dev->stats.tx_dropped++; |
448 | netif_start_queue(dev); | 446 | netif_start_queue(dev); |
449 | return; | 447 | return; |
450 | } | 448 | } |
@@ -518,8 +516,8 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) | |||
518 | 516 | ||
519 | set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); | 517 | set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); |
520 | actual = ax->tty->ops->write(ax->tty, ax->xbuff, count); | 518 | actual = ax->tty->ops->write(ax->tty, ax->xbuff, count); |
521 | ax->stats.tx_packets++; | 519 | dev->stats.tx_packets++; |
522 | ax->stats.tx_bytes += actual; | 520 | dev->stats.tx_bytes += actual; |
523 | 521 | ||
524 | ax->dev->trans_start = jiffies; | 522 | ax->dev->trans_start = jiffies; |
525 | ax->xleft = count - actual; | 523 | ax->xleft = count - actual; |
@@ -664,32 +662,28 @@ static int ax_close(struct net_device *dev) | |||
664 | return 0; | 662 | return 0; |
665 | } | 663 | } |
666 | 664 | ||
667 | static struct net_device_stats *ax_get_stats(struct net_device *dev) | ||
668 | { | ||
669 | struct mkiss *ax = netdev_priv(dev); | ||
670 | |||
671 | return &ax->stats; | ||
672 | } | ||
673 | |||
674 | static const struct header_ops ax_header_ops = { | 665 | static const struct header_ops ax_header_ops = { |
675 | .create = ax_header, | 666 | .create = ax_header, |
676 | .rebuild = ax_rebuild_header, | 667 | .rebuild = ax_rebuild_header, |
677 | }; | 668 | }; |
678 | 669 | ||
670 | static const struct net_device_ops ax_netdev_ops = { | ||
671 | .ndo_open = ax_open_dev, | ||
672 | .ndo_stop = ax_close, | ||
673 | .ndo_start_xmit = ax_xmit, | ||
674 | .ndo_set_mac_address = ax_set_mac_address, | ||
675 | }; | ||
676 | |||
679 | static void ax_setup(struct net_device *dev) | 677 | static void ax_setup(struct net_device *dev) |
680 | { | 678 | { |
681 | /* Finish setting up the DEVICE info. */ | 679 | /* Finish setting up the DEVICE info. */ |
682 | dev->mtu = AX_MTU; | 680 | dev->mtu = AX_MTU; |
683 | dev->hard_start_xmit = ax_xmit; | ||
684 | dev->open = ax_open_dev; | ||
685 | dev->stop = ax_close; | ||
686 | dev->get_stats = ax_get_stats; | ||
687 | dev->set_mac_address = ax_set_mac_address; | ||
688 | dev->hard_header_len = 0; | 681 | dev->hard_header_len = 0; |
689 | dev->addr_len = 0; | 682 | dev->addr_len = 0; |
690 | dev->type = ARPHRD_AX25; | 683 | dev->type = ARPHRD_AX25; |
691 | dev->tx_queue_len = 10; | 684 | dev->tx_queue_len = 10; |
692 | dev->header_ops = &ax_header_ops; | 685 | dev->header_ops = &ax_header_ops; |
686 | dev->netdev_ops = &ax_netdev_ops; | ||
693 | 687 | ||
694 | 688 | ||
695 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); | 689 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); |
@@ -929,7 +923,7 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
929 | while (count--) { | 923 | while (count--) { |
930 | if (fp != NULL && *fp++) { | 924 | if (fp != NULL && *fp++) { |
931 | if (!test_and_set_bit(AXF_ERROR, &ax->flags)) | 925 | if (!test_and_set_bit(AXF_ERROR, &ax->flags)) |
932 | ax->stats.rx_errors++; | 926 | ax->dev->stats.rx_errors++; |
933 | cp++; | 927 | cp++; |
934 | continue; | 928 | continue; |
935 | } | 929 | } |
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index c011af7088ea..2acb18f06972 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c | |||
@@ -1542,23 +1542,24 @@ static int scc_net_alloc(const char *name, struct scc_channel *scc) | |||
1542 | /* * Network driver methods * */ | 1542 | /* * Network driver methods * */ |
1543 | /* ******************************************************************** */ | 1543 | /* ******************************************************************** */ |
1544 | 1544 | ||
1545 | static const struct net_device_ops scc_netdev_ops = { | ||
1546 | .ndo_open = scc_net_open, | ||
1547 | .ndo_stop = scc_net_close, | ||
1548 | .ndo_start_xmit = scc_net_tx, | ||
1549 | .ndo_set_mac_address = scc_net_set_mac_address, | ||
1550 | .ndo_get_stats = scc_net_get_stats, | ||
1551 | .ndo_do_ioctl = scc_net_ioctl, | ||
1552 | }; | ||
1553 | |||
1545 | /* ----> Initialize device <----- */ | 1554 | /* ----> Initialize device <----- */ |
1546 | 1555 | ||
1547 | static void scc_net_setup(struct net_device *dev) | 1556 | static void scc_net_setup(struct net_device *dev) |
1548 | { | 1557 | { |
1549 | dev->tx_queue_len = 16; /* should be enough... */ | 1558 | dev->tx_queue_len = 16; /* should be enough... */ |
1550 | 1559 | ||
1551 | dev->open = scc_net_open; | 1560 | dev->netdev_ops = &scc_netdev_ops; |
1552 | dev->stop = scc_net_close; | ||
1553 | |||
1554 | dev->hard_start_xmit = scc_net_tx; | ||
1555 | dev->header_ops = &ax25_header_ops; | 1561 | dev->header_ops = &ax25_header_ops; |
1556 | 1562 | ||
1557 | dev->set_mac_address = scc_net_set_mac_address; | ||
1558 | dev->get_stats = scc_net_get_stats; | ||
1559 | dev->do_ioctl = scc_net_ioctl; | ||
1560 | dev->tx_timeout = NULL; | ||
1561 | |||
1562 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); | 1563 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); |
1563 | memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); | 1564 | memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); |
1564 | 1565 | ||
@@ -2073,7 +2074,7 @@ static int scc_net_seq_show(struct seq_file *seq, void *v) | |||
2073 | return 0; | 2074 | return 0; |
2074 | } | 2075 | } |
2075 | 2076 | ||
2076 | static struct seq_operations scc_net_seq_ops = { | 2077 | static const struct seq_operations scc_net_seq_ops = { |
2077 | .start = scc_net_seq_start, | 2078 | .start = scc_net_seq_start, |
2078 | .next = scc_net_seq_next, | 2079 | .next = scc_net_seq_next, |
2079 | .stop = scc_net_seq_stop, | 2080 | .stop = scc_net_seq_stop, |
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index 5407f7486c9c..82a8be7613d6 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c | |||
@@ -115,10 +115,6 @@ struct yam_port { | |||
115 | 115 | ||
116 | struct net_device *dev; | 116 | struct net_device *dev; |
117 | 117 | ||
118 | /* Stats section */ | ||
119 | |||
120 | struct net_device_stats stats; | ||
121 | |||
122 | int nb_rxint; | 118 | int nb_rxint; |
123 | int nb_mdint; | 119 | int nb_mdint; |
124 | 120 | ||
@@ -507,7 +503,7 @@ static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp) | |||
507 | } else { | 503 | } else { |
508 | if (!(skb = dev_alloc_skb(pkt_len))) { | 504 | if (!(skb = dev_alloc_skb(pkt_len))) { |
509 | printk(KERN_WARNING "%s: memory squeeze, dropping packet\n", dev->name); | 505 | printk(KERN_WARNING "%s: memory squeeze, dropping packet\n", dev->name); |
510 | ++yp->stats.rx_dropped; | 506 | ++dev->stats.rx_dropped; |
511 | } else { | 507 | } else { |
512 | unsigned char *cp; | 508 | unsigned char *cp; |
513 | cp = skb_put(skb, pkt_len); | 509 | cp = skb_put(skb, pkt_len); |
@@ -515,7 +511,7 @@ static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp) | |||
515 | memcpy(cp, yp->rx_buf, pkt_len - 1); | 511 | memcpy(cp, yp->rx_buf, pkt_len - 1); |
516 | skb->protocol = ax25_type_trans(skb, dev); | 512 | skb->protocol = ax25_type_trans(skb, dev); |
517 | netif_rx(skb); | 513 | netif_rx(skb); |
518 | ++yp->stats.rx_packets; | 514 | ++dev->stats.rx_packets; |
519 | } | 515 | } |
520 | } | 516 | } |
521 | } | 517 | } |
@@ -677,7 +673,7 @@ static void yam_tx_byte(struct net_device *dev, struct yam_port *yp) | |||
677 | yp->tx_count = 1; | 673 | yp->tx_count = 1; |
678 | yp->tx_state = TX_HEAD; | 674 | yp->tx_state = TX_HEAD; |
679 | } | 675 | } |
680 | ++yp->stats.tx_packets; | 676 | ++dev->stats.tx_packets; |
681 | break; | 677 | break; |
682 | case TX_TAIL: | 678 | case TX_TAIL: |
683 | if (--yp->tx_count <= 0) { | 679 | if (--yp->tx_count <= 0) { |
@@ -716,7 +712,7 @@ static irqreturn_t yam_interrupt(int irq, void *dev_id) | |||
716 | handled = 1; | 712 | handled = 1; |
717 | 713 | ||
718 | if (lsr & LSR_OE) | 714 | if (lsr & LSR_OE) |
719 | ++yp->stats.rx_fifo_errors; | 715 | ++dev->stats.rx_fifo_errors; |
720 | 716 | ||
721 | yp->dcd = (msr & RX_DCD) ? 1 : 0; | 717 | yp->dcd = (msr & RX_DCD) ? 1 : 0; |
722 | 718 | ||
@@ -778,16 +774,16 @@ static int yam_seq_show(struct seq_file *seq, void *v) | |||
778 | seq_printf(seq, " TxTail %u\n", yp->txtail); | 774 | seq_printf(seq, " TxTail %u\n", yp->txtail); |
779 | seq_printf(seq, " SlotTime %u\n", yp->slot); | 775 | seq_printf(seq, " SlotTime %u\n", yp->slot); |
780 | seq_printf(seq, " Persist %u\n", yp->pers); | 776 | seq_printf(seq, " Persist %u\n", yp->pers); |
781 | seq_printf(seq, " TxFrames %lu\n", yp->stats.tx_packets); | 777 | seq_printf(seq, " TxFrames %lu\n", dev->stats.tx_packets); |
782 | seq_printf(seq, " RxFrames %lu\n", yp->stats.rx_packets); | 778 | seq_printf(seq, " RxFrames %lu\n", dev->stats.rx_packets); |
783 | seq_printf(seq, " TxInt %u\n", yp->nb_mdint); | 779 | seq_printf(seq, " TxInt %u\n", yp->nb_mdint); |
784 | seq_printf(seq, " RxInt %u\n", yp->nb_rxint); | 780 | seq_printf(seq, " RxInt %u\n", yp->nb_rxint); |
785 | seq_printf(seq, " RxOver %lu\n", yp->stats.rx_fifo_errors); | 781 | seq_printf(seq, " RxOver %lu\n", dev->stats.rx_fifo_errors); |
786 | seq_printf(seq, "\n"); | 782 | seq_printf(seq, "\n"); |
787 | return 0; | 783 | return 0; |
788 | } | 784 | } |
789 | 785 | ||
790 | static struct seq_operations yam_seqops = { | 786 | static const struct seq_operations yam_seqops = { |
791 | .start = yam_seq_start, | 787 | .start = yam_seq_start, |
792 | .next = yam_seq_next, | 788 | .next = yam_seq_next, |
793 | .stop = yam_seq_stop, | 789 | .stop = yam_seq_stop, |
@@ -812,26 +808,6 @@ static const struct file_operations yam_info_fops = { | |||
812 | 808 | ||
813 | /* --------------------------------------------------------------------- */ | 809 | /* --------------------------------------------------------------------- */ |
814 | 810 | ||
815 | static struct net_device_stats *yam_get_stats(struct net_device *dev) | ||
816 | { | ||
817 | struct yam_port *yp; | ||
818 | |||
819 | if (!dev) | ||
820 | return NULL; | ||
821 | |||
822 | yp = netdev_priv(dev); | ||
823 | if (yp->magic != YAM_MAGIC) | ||
824 | return NULL; | ||
825 | |||
826 | /* | ||
827 | * Get the current statistics. This may be called with the | ||
828 | * card open or closed. | ||
829 | */ | ||
830 | return &yp->stats; | ||
831 | } | ||
832 | |||
833 | /* --------------------------------------------------------------------- */ | ||
834 | |||
835 | static int yam_open(struct net_device *dev) | 811 | static int yam_open(struct net_device *dev) |
836 | { | 812 | { |
837 | struct yam_port *yp = netdev_priv(dev); | 813 | struct yam_port *yp = netdev_priv(dev); |
@@ -878,9 +854,9 @@ static int yam_open(struct net_device *dev) | |||
878 | /* Reset overruns for all ports - FPGA programming makes overruns */ | 854 | /* Reset overruns for all ports - FPGA programming makes overruns */ |
879 | for (i = 0; i < NR_PORTS; i++) { | 855 | for (i = 0; i < NR_PORTS; i++) { |
880 | struct net_device *dev = yam_devs[i]; | 856 | struct net_device *dev = yam_devs[i]; |
881 | struct yam_port *yp = netdev_priv(dev); | 857 | |
882 | inb(LSR(dev->base_addr)); | 858 | inb(LSR(dev->base_addr)); |
883 | yp->stats.rx_fifo_errors = 0; | 859 | dev->stats.rx_fifo_errors = 0; |
884 | } | 860 | } |
885 | 861 | ||
886 | printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq, | 862 | printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq, |
@@ -1068,6 +1044,14 @@ static int yam_set_mac_address(struct net_device *dev, void *addr) | |||
1068 | 1044 | ||
1069 | /* --------------------------------------------------------------------- */ | 1045 | /* --------------------------------------------------------------------- */ |
1070 | 1046 | ||
1047 | static const struct net_device_ops yam_netdev_ops = { | ||
1048 | .ndo_open = yam_open, | ||
1049 | .ndo_stop = yam_close, | ||
1050 | .ndo_start_xmit = yam_send_packet, | ||
1051 | .ndo_do_ioctl = yam_ioctl, | ||
1052 | .ndo_set_mac_address = yam_set_mac_address, | ||
1053 | }; | ||
1054 | |||
1071 | static void yam_setup(struct net_device *dev) | 1055 | static void yam_setup(struct net_device *dev) |
1072 | { | 1056 | { |
1073 | struct yam_port *yp = netdev_priv(dev); | 1057 | struct yam_port *yp = netdev_priv(dev); |
@@ -1088,18 +1072,11 @@ static void yam_setup(struct net_device *dev) | |||
1088 | dev->base_addr = yp->iobase; | 1072 | dev->base_addr = yp->iobase; |
1089 | dev->irq = yp->irq; | 1073 | dev->irq = yp->irq; |
1090 | 1074 | ||
1091 | dev->open = yam_open; | ||
1092 | dev->stop = yam_close; | ||
1093 | dev->do_ioctl = yam_ioctl; | ||
1094 | dev->hard_start_xmit = yam_send_packet; | ||
1095 | dev->get_stats = yam_get_stats; | ||
1096 | |||
1097 | skb_queue_head_init(&yp->send_queue); | 1075 | skb_queue_head_init(&yp->send_queue); |
1098 | 1076 | ||
1077 | dev->netdev_ops = &yam_netdev_ops; | ||
1099 | dev->header_ops = &ax25_header_ops; | 1078 | dev->header_ops = &ax25_header_ops; |
1100 | 1079 | ||
1101 | dev->set_mac_address = yam_set_mac_address; | ||
1102 | |||
1103 | dev->type = ARPHRD_AX25; | 1080 | dev->type = ARPHRD_AX25; |
1104 | dev->hard_header_len = AX25_MAX_HEADER_LEN; | 1081 | dev->hard_header_len = AX25_MAX_HEADER_LEN; |
1105 | dev->mtu = AX25_MTU; | 1082 | dev->mtu = AX25_MTU; |