diff options
author | David S. Miller <davem@davemloft.net> | 2011-12-01 22:15:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-01 22:15:47 -0500 |
commit | efa230f2c68abab817f13473077f8d0cc74f43f3 (patch) | |
tree | 239c1337852092eb56bd7aa0714fc19064b767b3 /drivers/net/ethernet/sun | |
parent | 63ec3c83e7ba6f23227d3ff69c5792911266bd75 (diff) |
niu: Add support for byte queue limits.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sun')
-rw-r--r-- | drivers/net/ethernet/sun/niu.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 56d106e58088..88e6b1501ec8 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
@@ -3598,6 +3598,7 @@ static int release_tx_packet(struct niu *np, struct tx_ring_info *rp, int idx) | |||
3598 | static void niu_tx_work(struct niu *np, struct tx_ring_info *rp) | 3598 | static void niu_tx_work(struct niu *np, struct tx_ring_info *rp) |
3599 | { | 3599 | { |
3600 | struct netdev_queue *txq; | 3600 | struct netdev_queue *txq; |
3601 | unsigned int tx_bytes; | ||
3601 | u16 pkt_cnt, tmp; | 3602 | u16 pkt_cnt, tmp; |
3602 | int cons, index; | 3603 | int cons, index; |
3603 | u64 cs; | 3604 | u64 cs; |
@@ -3620,12 +3621,18 @@ static void niu_tx_work(struct niu *np, struct tx_ring_info *rp) | |||
3620 | netif_printk(np, tx_done, KERN_DEBUG, np->dev, | 3621 | netif_printk(np, tx_done, KERN_DEBUG, np->dev, |
3621 | "%s() pkt_cnt[%u] cons[%d]\n", __func__, pkt_cnt, cons); | 3622 | "%s() pkt_cnt[%u] cons[%d]\n", __func__, pkt_cnt, cons); |
3622 | 3623 | ||
3623 | while (pkt_cnt--) | 3624 | tx_bytes = 0; |
3625 | tmp = pkt_cnt; | ||
3626 | while (tmp--) { | ||
3627 | tx_bytes += rp->tx_buffs[cons].skb->len; | ||
3624 | cons = release_tx_packet(np, rp, cons); | 3628 | cons = release_tx_packet(np, rp, cons); |
3629 | } | ||
3625 | 3630 | ||
3626 | rp->cons = cons; | 3631 | rp->cons = cons; |
3627 | smp_mb(); | 3632 | smp_mb(); |
3628 | 3633 | ||
3634 | netdev_tx_completed_queue(txq, pkt_cnt, tx_bytes); | ||
3635 | |||
3629 | out: | 3636 | out: |
3630 | if (unlikely(netif_tx_queue_stopped(txq) && | 3637 | if (unlikely(netif_tx_queue_stopped(txq) && |
3631 | (niu_tx_avail(rp) > NIU_TX_WAKEUP_THRESH(rp)))) { | 3638 | (niu_tx_avail(rp) > NIU_TX_WAKEUP_THRESH(rp)))) { |
@@ -4326,6 +4333,7 @@ static void niu_free_channels(struct niu *np) | |||
4326 | struct tx_ring_info *rp = &np->tx_rings[i]; | 4333 | struct tx_ring_info *rp = &np->tx_rings[i]; |
4327 | 4334 | ||
4328 | niu_free_tx_ring_info(np, rp); | 4335 | niu_free_tx_ring_info(np, rp); |
4336 | netdev_tx_reset_queue(netdev_get_tx_queue(np->dev, i)); | ||
4329 | } | 4337 | } |
4330 | kfree(np->tx_rings); | 4338 | kfree(np->tx_rings); |
4331 | np->tx_rings = NULL; | 4339 | np->tx_rings = NULL; |
@@ -6731,6 +6739,8 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb, | |||
6731 | prod = NEXT_TX(rp, prod); | 6739 | prod = NEXT_TX(rp, prod); |
6732 | } | 6740 | } |
6733 | 6741 | ||
6742 | netdev_tx_sent_queue(txq, skb->len); | ||
6743 | |||
6734 | if (prod < rp->prod) | 6744 | if (prod < rp->prod) |
6735 | rp->wrap_bit ^= TX_RING_KICK_WRAP; | 6745 | rp->wrap_bit ^= TX_RING_KICK_WRAP; |
6736 | rp->prod = prod; | 6746 | rp->prod = prod; |