diff options
Diffstat (limited to 'drivers/net/gianfar.c')
| -rw-r--r-- | drivers/net/gianfar.c | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 6850dc0a7b91..e0620d084644 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -357,8 +357,11 @@ static void gfar_init_mac(struct net_device *ndev) | |||
| 357 | /* Configure the coalescing support */ | 357 | /* Configure the coalescing support */ |
| 358 | gfar_configure_coalescing(priv, 0xFF, 0xFF); | 358 | gfar_configure_coalescing(priv, 0xFF, 0xFF); |
| 359 | 359 | ||
| 360 | if (priv->rx_filer_enable) | 360 | if (priv->rx_filer_enable) { |
| 361 | rctrl |= RCTRL_FILREN; | 361 | rctrl |= RCTRL_FILREN; |
| 362 | /* Program the RIR0 reg with the required distribution */ | ||
| 363 | gfar_write(®s->rir0, DEFAULT_RIR0); | ||
| 364 | } | ||
| 362 | 365 | ||
| 363 | if (priv->rx_csum_enable) | 366 | if (priv->rx_csum_enable) |
| 364 | rctrl |= RCTRL_CHECKSUMMING; | 367 | rctrl |= RCTRL_CHECKSUMMING; |
| @@ -414,6 +417,36 @@ static void gfar_init_mac(struct net_device *ndev) | |||
| 414 | gfar_write(®s->fifo_tx_starve_shutoff, priv->fifo_starve_off); | 417 | gfar_write(®s->fifo_tx_starve_shutoff, priv->fifo_starve_off); |
| 415 | } | 418 | } |
| 416 | 419 | ||
| 420 | static struct net_device_stats *gfar_get_stats(struct net_device *dev) | ||
| 421 | { | ||
| 422 | struct gfar_private *priv = netdev_priv(dev); | ||
| 423 | struct netdev_queue *txq; | ||
| 424 | unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0; | ||
| 425 | unsigned long tx_packets = 0, tx_bytes = 0; | ||
| 426 | int i = 0; | ||
| 427 | |||
| 428 | for (i = 0; i < priv->num_rx_queues; i++) { | ||
| 429 | rx_packets += priv->rx_queue[i]->stats.rx_packets; | ||
| 430 | rx_bytes += priv->rx_queue[i]->stats.rx_bytes; | ||
| 431 | rx_dropped += priv->rx_queue[i]->stats.rx_dropped; | ||
| 432 | } | ||
| 433 | |||
| 434 | dev->stats.rx_packets = rx_packets; | ||
| 435 | dev->stats.rx_bytes = rx_bytes; | ||
| 436 | dev->stats.rx_dropped = rx_dropped; | ||
| 437 | |||
| 438 | for (i = 0; i < priv->num_tx_queues; i++) { | ||
| 439 | txq = netdev_get_tx_queue(dev, i); | ||
| 440 | tx_bytes += txq->tx_bytes; | ||
| 441 | tx_packets += txq->tx_packets; | ||
| 442 | } | ||
| 443 | |||
| 444 | dev->stats.tx_bytes = tx_bytes; | ||
| 445 | dev->stats.tx_packets = tx_packets; | ||
| 446 | |||
| 447 | return &dev->stats; | ||
| 448 | } | ||
| 449 | |||
| 417 | static const struct net_device_ops gfar_netdev_ops = { | 450 | static const struct net_device_ops gfar_netdev_ops = { |
| 418 | .ndo_open = gfar_enet_open, | 451 | .ndo_open = gfar_enet_open, |
| 419 | .ndo_start_xmit = gfar_start_xmit, | 452 | .ndo_start_xmit = gfar_start_xmit, |
| @@ -423,6 +456,7 @@ static const struct net_device_ops gfar_netdev_ops = { | |||
| 423 | .ndo_tx_timeout = gfar_timeout, | 456 | .ndo_tx_timeout = gfar_timeout, |
| 424 | .ndo_do_ioctl = gfar_ioctl, | 457 | .ndo_do_ioctl = gfar_ioctl, |
| 425 | .ndo_select_queue = gfar_select_queue, | 458 | .ndo_select_queue = gfar_select_queue, |
| 459 | .ndo_get_stats = gfar_get_stats, | ||
| 426 | .ndo_vlan_rx_register = gfar_vlan_rx_register, | 460 | .ndo_vlan_rx_register = gfar_vlan_rx_register, |
| 427 | .ndo_set_mac_address = eth_mac_addr, | 461 | .ndo_set_mac_address = eth_mac_addr, |
| 428 | .ndo_validate_addr = eth_validate_addr, | 462 | .ndo_validate_addr = eth_validate_addr, |
| @@ -1022,6 +1056,9 @@ static int gfar_probe(struct of_device *ofdev, | |||
| 1022 | priv->rx_queue[i]->rxic = DEFAULT_RXIC; | 1056 | priv->rx_queue[i]->rxic = DEFAULT_RXIC; |
| 1023 | } | 1057 | } |
| 1024 | 1058 | ||
| 1059 | /* enable filer if using multiple RX queues*/ | ||
| 1060 | if(priv->num_rx_queues > 1) | ||
| 1061 | priv->rx_filer_enable = 1; | ||
| 1025 | /* Enable most messages by default */ | 1062 | /* Enable most messages by default */ |
| 1026 | priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; | 1063 | priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; |
| 1027 | 1064 | ||
| @@ -1937,7 +1974,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1937 | } | 1974 | } |
| 1938 | 1975 | ||
| 1939 | /* Update transmit stats */ | 1976 | /* Update transmit stats */ |
| 1940 | dev->stats.tx_bytes += skb->len; | 1977 | txq->tx_bytes += skb->len; |
| 1978 | txq->tx_packets ++; | ||
| 1941 | 1979 | ||
| 1942 | txbdp = txbdp_start = tx_queue->cur_tx; | 1980 | txbdp = txbdp_start = tx_queue->cur_tx; |
| 1943 | 1981 | ||
| @@ -2295,8 +2333,6 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) | |||
| 2295 | tx_queue->skb_dirtytx = skb_dirtytx; | 2333 | tx_queue->skb_dirtytx = skb_dirtytx; |
| 2296 | tx_queue->dirty_tx = bdp; | 2334 | tx_queue->dirty_tx = bdp; |
| 2297 | 2335 | ||
| 2298 | dev->stats.tx_packets += howmany; | ||
| 2299 | |||
| 2300 | return howmany; | 2336 | return howmany; |
| 2301 | } | 2337 | } |
| 2302 | 2338 | ||
| @@ -2510,14 +2546,14 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) | |||
| 2510 | } | 2546 | } |
| 2511 | } else { | 2547 | } else { |
| 2512 | /* Increment the number of packets */ | 2548 | /* Increment the number of packets */ |
| 2513 | dev->stats.rx_packets++; | 2549 | rx_queue->stats.rx_packets++; |
| 2514 | howmany++; | 2550 | howmany++; |
| 2515 | 2551 | ||
| 2516 | if (likely(skb)) { | 2552 | if (likely(skb)) { |
| 2517 | pkt_len = bdp->length - ETH_FCS_LEN; | 2553 | pkt_len = bdp->length - ETH_FCS_LEN; |
| 2518 | /* Remove the FCS from the packet length */ | 2554 | /* Remove the FCS from the packet length */ |
| 2519 | skb_put(skb, pkt_len); | 2555 | skb_put(skb, pkt_len); |
| 2520 | dev->stats.rx_bytes += pkt_len; | 2556 | rx_queue->stats.rx_bytes += pkt_len; |
| 2521 | 2557 | ||
| 2522 | gfar_process_frame(dev, skb, amount_pull); | 2558 | gfar_process_frame(dev, skb, amount_pull); |
| 2523 | 2559 | ||
| @@ -2525,7 +2561,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) | |||
| 2525 | if (netif_msg_rx_err(priv)) | 2561 | if (netif_msg_rx_err(priv)) |
| 2526 | printk(KERN_WARNING | 2562 | printk(KERN_WARNING |
| 2527 | "%s: Missing skb!\n", dev->name); | 2563 | "%s: Missing skb!\n", dev->name); |
| 2528 | dev->stats.rx_dropped++; | 2564 | rx_queue->stats.rx_dropped++; |
| 2529 | priv->extra_stats.rx_skbmissing++; | 2565 | priv->extra_stats.rx_skbmissing++; |
| 2530 | } | 2566 | } |
| 2531 | 2567 | ||
