aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/hd6457x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wan/hd6457x.c')
-rw-r--r--drivers/net/wan/hd6457x.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c
index 8d0a1f2f00e5..591fb45a7c68 100644
--- a/drivers/net/wan/hd6457x.c
+++ b/drivers/net/wan/hd6457x.c
@@ -271,9 +271,9 @@ static inline void sca_msci_intr(port_t *port)
271 sca_out(stat & (ST1_UDRN | ST1_CDCD), msci + ST1, card); 271 sca_out(stat & (ST1_UDRN | ST1_CDCD), msci + ST1, card);
272 272
273 if (stat & ST1_UDRN) { 273 if (stat & ST1_UDRN) {
274 struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); 274 /* TX Underrun error detected */
275 stats->tx_errors++; /* TX Underrun error detected */ 275 port_to_dev(port)->stats.tx_errors++;
276 stats->tx_fifo_errors++; 276 port_to_dev(port)->stats.tx_fifo_errors++;
277 } 277 }
278 278
279 if (stat & ST1_CDCD) 279 if (stat & ST1_CDCD)
@@ -286,7 +286,6 @@ static inline void sca_msci_intr(port_t *port)
286static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u16 rxin) 286static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u16 rxin)
287{ 287{
288 struct net_device *dev = port_to_dev(port); 288 struct net_device *dev = port_to_dev(port);
289 struct net_device_stats *stats = hdlc_stats(dev);
290 struct sk_buff *skb; 289 struct sk_buff *skb;
291 u16 len; 290 u16 len;
292 u32 buff; 291 u32 buff;
@@ -298,7 +297,7 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1
298 len = readw(&desc->len); 297 len = readw(&desc->len);
299 skb = dev_alloc_skb(len); 298 skb = dev_alloc_skb(len);
300 if (!skb) { 299 if (!skb) {
301 stats->rx_dropped++; 300 dev->stats.rx_dropped++;
302 return; 301 return;
303 } 302 }
304 303
@@ -327,8 +326,8 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1
327 printk(KERN_DEBUG "%s RX(%i):", dev->name, skb->len); 326 printk(KERN_DEBUG "%s RX(%i):", dev->name, skb->len);
328 debug_frame(skb); 327 debug_frame(skb);
329#endif 328#endif
330 stats->rx_packets++; 329 dev->stats.rx_packets++;
331 stats->rx_bytes += skb->len; 330 dev->stats.rx_bytes += skb->len;
332 dev->last_rx = jiffies; 331 dev->last_rx = jiffies;
333 skb->protocol = hdlc_type_trans(skb, dev); 332 skb->protocol = hdlc_type_trans(skb, dev);
334 netif_rx(skb); 333 netif_rx(skb);
@@ -339,17 +338,18 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1
339/* Receive DMA interrupt service */ 338/* Receive DMA interrupt service */
340static inline void sca_rx_intr(port_t *port) 339static inline void sca_rx_intr(port_t *port)
341{ 340{
341 struct net_device *dev = port_to_dev(port);
342 u16 dmac = get_dmac_rx(port); 342 u16 dmac = get_dmac_rx(port);
343 card_t *card = port_to_card(port); 343 card_t *card = port_to_card(port);
344 u8 stat = sca_in(DSR_RX(phy_node(port)), card); /* read DMA Status */ 344 u8 stat = sca_in(DSR_RX(phy_node(port)), card); /* read DMA Status */
345 struct net_device_stats *stats = hdlc_stats(port_to_dev(port));
346 345
347 /* Reset DSR status bits */ 346 /* Reset DSR status bits */
348 sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE, 347 sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE,
349 DSR_RX(phy_node(port)), card); 348 DSR_RX(phy_node(port)), card);
350 349
351 if (stat & DSR_BOF) 350 if (stat & DSR_BOF)
352 stats->rx_over_errors++; /* Dropped one or more frames */ 351 /* Dropped one or more frames */
352 dev->stats.rx_over_errors++;
353 353
354 while (1) { 354 while (1) {
355 u32 desc_off = desc_offset(port, port->rxin, 0); 355 u32 desc_off = desc_offset(port, port->rxin, 0);
@@ -364,12 +364,14 @@ static inline void sca_rx_intr(port_t *port)
364 if (!(stat & ST_RX_EOM)) 364 if (!(stat & ST_RX_EOM))
365 port->rxpart = 1; /* partial frame received */ 365 port->rxpart = 1; /* partial frame received */
366 else if ((stat & ST_ERROR_MASK) || port->rxpart) { 366 else if ((stat & ST_ERROR_MASK) || port->rxpart) {
367 stats->rx_errors++; 367 dev->stats.rx_errors++;
368 if (stat & ST_RX_OVERRUN) stats->rx_fifo_errors++; 368 if (stat & ST_RX_OVERRUN)
369 dev->stats.rx_fifo_errors++;
369 else if ((stat & (ST_RX_SHORT | ST_RX_ABORT | 370 else if ((stat & (ST_RX_SHORT | ST_RX_ABORT |
370 ST_RX_RESBIT)) || port->rxpart) 371 ST_RX_RESBIT)) || port->rxpart)
371 stats->rx_frame_errors++; 372 dev->stats.rx_frame_errors++;
372 else if (stat & ST_RX_CRC) stats->rx_crc_errors++; 373 else if (stat & ST_RX_CRC)
374 dev->stats.rx_crc_errors++;
373 if (stat & ST_RX_EOM) 375 if (stat & ST_RX_EOM)
374 port->rxpart = 0; /* received last fragment */ 376 port->rxpart = 0; /* received last fragment */
375 } else 377 } else
@@ -390,7 +392,6 @@ static inline void sca_rx_intr(port_t *port)
390static inline void sca_tx_intr(port_t *port) 392static inline void sca_tx_intr(port_t *port)
391{ 393{
392 struct net_device *dev = port_to_dev(port); 394 struct net_device *dev = port_to_dev(port);
393 struct net_device_stats *stats = hdlc_stats(dev);
394 u16 dmac = get_dmac_tx(port); 395 u16 dmac = get_dmac_tx(port);
395 card_t* card = port_to_card(port); 396 card_t* card = port_to_card(port);
396 u8 stat; 397 u8 stat;
@@ -412,8 +413,8 @@ static inline void sca_tx_intr(port_t *port)
412 break; /* Transmitter is/will_be sending this frame */ 413 break; /* Transmitter is/will_be sending this frame */
413 414
414 desc = desc_address(port, port->txlast, 1); 415 desc = desc_address(port, port->txlast, 1);
415 stats->tx_packets++; 416 dev->stats.tx_packets++;
416 stats->tx_bytes += readw(&desc->len); 417 dev->stats.tx_bytes += readw(&desc->len);
417 writeb(0, &desc->stat); /* Free descriptor */ 418 writeb(0, &desc->stat); /* Free descriptor */
418 port->txlast = next_desc(port, port->txlast, 1); 419 port->txlast = next_desc(port, port->txlast, 1);
419 } 420 }