From: Alexander Duyck Date: Tue, 7 Feb 2012 08:14:33 +0000 Subject: ixgbe: add support for byte queue limits commit b2d96e0ac07cf4929c6b0eb13121672048368117 upstream. This adds support for byte queue limits (BQL). Based on patch from Eric Dumazet for igb. Signed-off-by: Alexander Duyck Tested-by: Stephen Ko --- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 5 +++++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 7 +++++++ 2 files changed, 12 insertions(+) --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -629,4 +629,9 @@ extern int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); #endif /* IXGBE_FCOE */ +static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring) +{ + return netdev_get_tx_queue(ring->netdev, ring->queue_index); +} + #endif /* _IXGBE_H_ */ --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -832,6 +832,9 @@ return true; } + netdev_tx_completed_queue(txring_txq(tx_ring), + total_packets, total_bytes); + #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) if (unlikely(total_packets && netif_carrier_ok(tx_ring->netdev) && (ixgbe_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) { @@ -2408,6 +2411,8 @@ /* enable queue */ IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl); + netdev_tx_reset_queue(txring_txq(ring)); + /* TXDCTL.EN will return 0 on 82598 if link is down, so skip it */ if (hw->mac.type == ixgbe_mac_82598EB && !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP)) @@ -6581,6 +6586,8 @@ tx_buffer_info->gso_segs = gso_segs; tx_buffer_info->skb = skb; + netdev_tx_sent_queue(txring_txq(tx_ring), tx_buffer_info->bytecount); + /* set the timestamp */ first->time_stamp = jiffies;