diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2009-01-09 08:01:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 17:02:35 -0500 |
commit | 13c0582d91ab63087a30addcfe42874541ca2689 (patch) | |
tree | 0e0edfeffde6035c49f7584f8bede3e6f06d17f6 /drivers | |
parent | 283767e70501a02e676c99964e5a3f09ec993469 (diff) |
dmascc: convert to internal network device stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/hamradio/dmascc.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c index e67103396ed7..b0817ea56bb9 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); |
@@ -961,14 +960,6 @@ static int scc_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
961 | } | 960 | } |
962 | 961 | ||
963 | 962 | ||
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) | 963 | static int scc_set_mac_address(struct net_device *dev, void *sa) |
973 | { | 964 | { |
974 | memcpy(dev->dev_addr, ((struct sockaddr *) sa)->sa_data, | 965 | memcpy(dev->dev_addr, ((struct sockaddr *) sa)->sa_data, |
@@ -1216,17 +1207,17 @@ static void special_condition(struct scc_priv *priv, int rc) | |||
1216 | } | 1207 | } |
1217 | if (priv->rx_over) { | 1208 | if (priv->rx_over) { |
1218 | /* We had an overrun */ | 1209 | /* We had an overrun */ |
1219 | priv->stats.rx_errors++; | 1210 | priv->dev->stats.rx_errors++; |
1220 | if (priv->rx_over == 2) | 1211 | if (priv->rx_over == 2) |
1221 | priv->stats.rx_length_errors++; | 1212 | priv->dev->stats.rx_length_errors++; |
1222 | else | 1213 | else |
1223 | priv->stats.rx_fifo_errors++; | 1214 | priv->dev->stats.rx_fifo_errors++; |
1224 | priv->rx_over = 0; | 1215 | priv->rx_over = 0; |
1225 | } else if (rc & CRC_ERR) { | 1216 | } else if (rc & CRC_ERR) { |
1226 | /* Count invalid CRC only if packet length >= minimum */ | 1217 | /* Count invalid CRC only if packet length >= minimum */ |
1227 | if (cb >= 15) { | 1218 | if (cb >= 15) { |
1228 | priv->stats.rx_errors++; | 1219 | priv->dev->stats.rx_errors++; |
1229 | priv->stats.rx_crc_errors++; | 1220 | priv->dev->stats.rx_crc_errors++; |
1230 | } | 1221 | } |
1231 | } else { | 1222 | } else { |
1232 | if (cb >= 15) { | 1223 | if (cb >= 15) { |
@@ -1239,8 +1230,8 @@ static void special_condition(struct scc_priv *priv, int rc) | |||
1239 | priv->rx_count++; | 1230 | priv->rx_count++; |
1240 | schedule_work(&priv->rx_work); | 1231 | schedule_work(&priv->rx_work); |
1241 | } else { | 1232 | } else { |
1242 | priv->stats.rx_errors++; | 1233 | priv->dev->stats.rx_errors++; |
1243 | priv->stats.rx_over_errors++; | 1234 | priv->dev->stats.rx_over_errors++; |
1244 | } | 1235 | } |
1245 | } | 1236 | } |
1246 | } | 1237 | } |
@@ -1275,7 +1266,7 @@ static void rx_bh(struct work_struct *ugli_api) | |||
1275 | skb = dev_alloc_skb(cb + 1); | 1266 | skb = dev_alloc_skb(cb + 1); |
1276 | if (skb == NULL) { | 1267 | if (skb == NULL) { |
1277 | /* Drop packet */ | 1268 | /* Drop packet */ |
1278 | priv->stats.rx_dropped++; | 1269 | priv->dev->stats.rx_dropped++; |
1279 | } else { | 1270 | } else { |
1280 | /* Fill buffer */ | 1271 | /* Fill buffer */ |
1281 | data = skb_put(skb, cb + 1); | 1272 | data = skb_put(skb, cb + 1); |
@@ -1283,8 +1274,8 @@ static void rx_bh(struct work_struct *ugli_api) | |||
1283 | memcpy(&data[1], priv->rx_buf[i], cb); | 1274 | memcpy(&data[1], priv->rx_buf[i], cb); |
1284 | skb->protocol = ax25_type_trans(skb, priv->dev); | 1275 | skb->protocol = ax25_type_trans(skb, priv->dev); |
1285 | netif_rx(skb); | 1276 | netif_rx(skb); |
1286 | priv->stats.rx_packets++; | 1277 | priv->dev->stats.rx_packets++; |
1287 | priv->stats.rx_bytes += cb; | 1278 | priv->dev->stats.rx_bytes += cb; |
1288 | } | 1279 | } |
1289 | spin_lock_irqsave(&priv->ring_lock, flags); | 1280 | spin_lock_irqsave(&priv->ring_lock, flags); |
1290 | /* Move tail */ | 1281 | /* Move tail */ |
@@ -1351,15 +1342,15 @@ static void es_isr(struct scc_priv *priv) | |||
1351 | write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN); | 1342 | write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN); |
1352 | if (res) { | 1343 | if (res) { |
1353 | /* Update packet statistics */ | 1344 | /* Update packet statistics */ |
1354 | priv->stats.tx_errors++; | 1345 | priv->dev->stats.tx_errors++; |
1355 | priv->stats.tx_fifo_errors++; | 1346 | priv->dev->stats.tx_fifo_errors++; |
1356 | /* Other underrun interrupts may already be waiting */ | 1347 | /* Other underrun interrupts may already be waiting */ |
1357 | write_scc(priv, R0, RES_EXT_INT); | 1348 | write_scc(priv, R0, RES_EXT_INT); |
1358 | write_scc(priv, R0, RES_EXT_INT); | 1349 | write_scc(priv, R0, RES_EXT_INT); |
1359 | } else { | 1350 | } else { |
1360 | /* Update packet statistics */ | 1351 | /* Update packet statistics */ |
1361 | priv->stats.tx_packets++; | 1352 | priv->dev->stats.tx_packets++; |
1362 | priv->stats.tx_bytes += priv->tx_len[i]; | 1353 | priv->dev->stats.tx_bytes += priv->tx_len[i]; |
1363 | /* Remove frame from FIFO */ | 1354 | /* Remove frame from FIFO */ |
1364 | priv->tx_tail = (i + 1) % NUM_TX_BUF; | 1355 | priv->tx_tail = (i + 1) % NUM_TX_BUF; |
1365 | priv->tx_count--; | 1356 | priv->tx_count--; |
@@ -1425,7 +1416,7 @@ static void tm_isr(struct scc_priv *priv) | |||
1425 | write_scc(priv, R15, DCDIE); | 1416 | write_scc(priv, R15, DCDIE); |
1426 | priv->rr0 = read_scc(priv, R0); | 1417 | priv->rr0 = read_scc(priv, R0); |
1427 | if (priv->rr0 & DCD) { | 1418 | if (priv->rr0 & DCD) { |
1428 | priv->stats.collisions++; | 1419 | priv->dev->stats.collisions++; |
1429 | rx_on(priv); | 1420 | rx_on(priv); |
1430 | priv->state = RX_ON; | 1421 | priv->state = RX_ON; |
1431 | } else { | 1422 | } else { |