aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-03-20 15:36:07 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-21 22:55:39 -0400
commit6394d7c9a2c4c5d729c1cdb69f96f9fff16ec232 (patch)
treeecfe45bff3383a0d1d918ee9926d4f0c8c450957 /drivers/net/pcmcia
parent23169a402d6a2d55992e6b7f6157ae04b636545a (diff)
xir2cps: convert to internal net_device stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index fef7e1861d6a..f8fdf8997e0d 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -335,7 +335,7 @@ typedef struct local_info_t {
335 struct net_device *dev; 335 struct net_device *dev;
336 struct pcmcia_device *p_dev; 336 struct pcmcia_device *p_dev;
337 dev_node_t node; 337 dev_node_t node;
338 struct net_device_stats stats; 338
339 int card_type; 339 int card_type;
340 int probe_port; 340 int probe_port;
341 int silicon; /* silicon revision. 0=old CE2, 1=Scipper, 4=Mohawk */ 341 int silicon; /* silicon revision. 0=old CE2, 1=Scipper, 4=Mohawk */
@@ -355,7 +355,6 @@ typedef struct local_info_t {
355static int do_start_xmit(struct sk_buff *skb, struct net_device *dev); 355static int do_start_xmit(struct sk_buff *skb, struct net_device *dev);
356static void xirc_tx_timeout(struct net_device *dev); 356static void xirc_tx_timeout(struct net_device *dev);
357static void xirc2ps_tx_timeout_task(struct work_struct *work); 357static void xirc2ps_tx_timeout_task(struct work_struct *work);
358static struct net_device_stats *do_get_stats(struct net_device *dev);
359static void set_addresses(struct net_device *dev); 358static void set_addresses(struct net_device *dev);
360static void set_multicast_list(struct net_device *dev); 359static void set_multicast_list(struct net_device *dev);
361static int set_card_type(struct pcmcia_device *link, const void *s); 360static int set_card_type(struct pcmcia_device *link, const void *s);
@@ -583,7 +582,6 @@ xirc2ps_probe(struct pcmcia_device *link)
583 /* Fill in card specific entries */ 582 /* Fill in card specific entries */
584 dev->hard_start_xmit = &do_start_xmit; 583 dev->hard_start_xmit = &do_start_xmit;
585 dev->set_config = &do_config; 584 dev->set_config = &do_config;
586 dev->get_stats = &do_get_stats;
587 dev->do_ioctl = &do_ioctl; 585 dev->do_ioctl = &do_ioctl;
588 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 586 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
589 dev->set_multicast_list = &set_multicast_list; 587 dev->set_multicast_list = &set_multicast_list;
@@ -1172,7 +1170,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1172 if (bytes_rcvd > maxrx_bytes && (rsr & PktRxOk)) { 1170 if (bytes_rcvd > maxrx_bytes && (rsr & PktRxOk)) {
1173 /* too many bytes received during this int, drop the rest of the 1171 /* too many bytes received during this int, drop the rest of the
1174 * packets */ 1172 * packets */
1175 lp->stats.rx_dropped++; 1173 dev->stats.rx_dropped++;
1176 DEBUG(2, "%s: RX drop, too much done\n", dev->name); 1174 DEBUG(2, "%s: RX drop, too much done\n", dev->name);
1177 } else if (rsr & PktRxOk) { 1175 } else if (rsr & PktRxOk) {
1178 struct sk_buff *skb; 1176 struct sk_buff *skb;
@@ -1186,7 +1184,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1186 if (!skb) { 1184 if (!skb) {
1187 printk(KNOT_XIRC "low memory, packet dropped (size=%u)\n", 1185 printk(KNOT_XIRC "low memory, packet dropped (size=%u)\n",
1188 pktlen); 1186 pktlen);
1189 lp->stats.rx_dropped++; 1187 dev->stats.rx_dropped++;
1190 } else { /* okay get the packet */ 1188 } else { /* okay get the packet */
1191 skb_reserve(skb, 2); 1189 skb_reserve(skb, 2);
1192 if (lp->silicon == 0 ) { /* work around a hardware bug */ 1190 if (lp->silicon == 0 ) { /* work around a hardware bug */
@@ -1242,24 +1240,24 @@ xirc2ps_interrupt(int irq, void *dev_id)
1242 } 1240 }
1243 skb->protocol = eth_type_trans(skb, dev); 1241 skb->protocol = eth_type_trans(skb, dev);
1244 netif_rx(skb); 1242 netif_rx(skb);
1245 lp->stats.rx_packets++; 1243 dev->stats.rx_packets++;
1246 lp->stats.rx_bytes += pktlen; 1244 dev->stats.rx_bytes += pktlen;
1247 if (!(rsr & PhyPkt)) 1245 if (!(rsr & PhyPkt))
1248 lp->stats.multicast++; 1246 dev->stats.multicast++;
1249 } 1247 }
1250 } else { /* bad packet */ 1248 } else { /* bad packet */
1251 DEBUG(5, "rsr=%#02x\n", rsr); 1249 DEBUG(5, "rsr=%#02x\n", rsr);
1252 } 1250 }
1253 if (rsr & PktTooLong) { 1251 if (rsr & PktTooLong) {
1254 lp->stats.rx_frame_errors++; 1252 dev->stats.rx_frame_errors++;
1255 DEBUG(3, "%s: Packet too long\n", dev->name); 1253 DEBUG(3, "%s: Packet too long\n", dev->name);
1256 } 1254 }
1257 if (rsr & CRCErr) { 1255 if (rsr & CRCErr) {
1258 lp->stats.rx_crc_errors++; 1256 dev->stats.rx_crc_errors++;
1259 DEBUG(3, "%s: CRC error\n", dev->name); 1257 DEBUG(3, "%s: CRC error\n", dev->name);
1260 } 1258 }
1261 if (rsr & AlignErr) { 1259 if (rsr & AlignErr) {
1262 lp->stats.rx_fifo_errors++; /* okay ? */ 1260 dev->stats.rx_fifo_errors++; /* okay ? */
1263 DEBUG(3, "%s: Alignment error\n", dev->name); 1261 DEBUG(3, "%s: Alignment error\n", dev->name);
1264 } 1262 }
1265 1263
@@ -1270,7 +1268,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1270 eth_status = GetByte(XIRCREG_ESR); 1268 eth_status = GetByte(XIRCREG_ESR);
1271 } 1269 }
1272 if (rx_status & 0x10) { /* Receive overrun */ 1270 if (rx_status & 0x10) { /* Receive overrun */
1273 lp->stats.rx_over_errors++; 1271 dev->stats.rx_over_errors++;
1274 PutByte(XIRCREG_CR, ClearRxOvrun); 1272 PutByte(XIRCREG_CR, ClearRxOvrun);
1275 DEBUG(3, "receive overrun cleared\n"); 1273 DEBUG(3, "receive overrun cleared\n");
1276 } 1274 }
@@ -1283,11 +1281,11 @@ xirc2ps_interrupt(int irq, void *dev_id)
1283 nn = GetByte(XIRCREG0_PTR); 1281 nn = GetByte(XIRCREG0_PTR);
1284 lp->last_ptr_value = nn; 1282 lp->last_ptr_value = nn;
1285 if (nn < n) /* rollover */ 1283 if (nn < n) /* rollover */
1286 lp->stats.tx_packets += 256 - n; 1284 dev->stats.tx_packets += 256 - n;
1287 else if (n == nn) { /* happens sometimes - don't know why */ 1285 else if (n == nn) { /* happens sometimes - don't know why */
1288 DEBUG(0, "PTR not changed?\n"); 1286 DEBUG(0, "PTR not changed?\n");
1289 } else 1287 } else
1290 lp->stats.tx_packets += lp->last_ptr_value - n; 1288 dev->stats.tx_packets += lp->last_ptr_value - n;
1291 netif_wake_queue(dev); 1289 netif_wake_queue(dev);
1292 } 1290 }
1293 if (tx_status & 0x0002) { /* Execessive collissions */ 1291 if (tx_status & 0x0002) { /* Execessive collissions */
@@ -1295,7 +1293,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1295 PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */ 1293 PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */
1296 } 1294 }
1297 if (tx_status & 0x0040) 1295 if (tx_status & 0x0040)
1298 lp->stats.tx_aborted_errors++; 1296 dev->stats.tx_aborted_errors++;
1299 1297
1300 /* recalculate our work chunk so that we limit the duration of this 1298 /* recalculate our work chunk so that we limit the duration of this
1301 * ISR to about 1/10 of a second. 1299 * ISR to about 1/10 of a second.
@@ -1353,7 +1351,7 @@ static void
1353xirc_tx_timeout(struct net_device *dev) 1351xirc_tx_timeout(struct net_device *dev)
1354{ 1352{
1355 local_info_t *lp = netdev_priv(dev); 1353 local_info_t *lp = netdev_priv(dev);
1356 lp->stats.tx_errors++; 1354 dev->stats.tx_errors++;
1357 printk(KERN_NOTICE "%s: transmit timed out\n", dev->name); 1355 printk(KERN_NOTICE "%s: transmit timed out\n", dev->name);
1358 schedule_work(&lp->tx_timeout_task); 1356 schedule_work(&lp->tx_timeout_task);
1359} 1357}
@@ -1409,20 +1407,11 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev)
1409 1407
1410 dev_kfree_skb (skb); 1408 dev_kfree_skb (skb);
1411 dev->trans_start = jiffies; 1409 dev->trans_start = jiffies;
1412 lp->stats.tx_bytes += pktlen; 1410 dev->stats.tx_bytes += pktlen;
1413 netif_start_queue(dev); 1411 netif_start_queue(dev);
1414 return 0; 1412 return 0;
1415} 1413}
1416 1414
1417static struct net_device_stats *
1418do_get_stats(struct net_device *dev)
1419{
1420 local_info_t *lp = netdev_priv(dev);
1421
1422 /* lp->stats.rx_missed_errors = GetByte(?) */
1423 return &lp->stats;
1424}
1425
1426/**************** 1415/****************
1427 * Set all addresses: This first one is the individual address, 1416 * Set all addresses: This first one is the individual address,
1428 * the next 9 addresses are taken from the multicast list and 1417 * the next 9 addresses are taken from the multicast list and