Commit d92060bc authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

r8169: add support for Byte Queue Limits

This patch is basically a resubmit of 1e918876 ("r8169: add support
for Byte Queue Limits") which was reverted later. The problems causing
the revert seem to have been fixed in the meantime.
Only change to the original patch is that the call to
netdev_reset_queue was moved to rtl8169_tx_clear.

The Tested-by refers to a system using the RTL8168evl chip version.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Tested-by: default avatarHolger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 38caff5a
...@@ -5851,6 +5851,7 @@ static void rtl8169_tx_clear(struct rtl8169_private *tp) ...@@ -5851,6 +5851,7 @@ static void rtl8169_tx_clear(struct rtl8169_private *tp)
{ {
rtl8169_tx_clear_range(tp, tp->dirty_tx, NUM_TX_DESC); rtl8169_tx_clear_range(tp, tp->dirty_tx, NUM_TX_DESC);
tp->cur_tx = tp->dirty_tx = 0; tp->cur_tx = tp->dirty_tx = 0;
netdev_reset_queue(tp->dev);
} }
static void rtl_reset_work(struct rtl8169_private *tp) static void rtl_reset_work(struct rtl8169_private *tp)
...@@ -6153,6 +6154,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, ...@@ -6153,6 +6154,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
txd->opts2 = cpu_to_le32(opts[1]); txd->opts2 = cpu_to_le32(opts[1]);
netdev_sent_queue(dev, skb->len);
skb_tx_timestamp(skb); skb_tx_timestamp(skb);
/* Force memory writes to complete before releasing descriptor */ /* Force memory writes to complete before releasing descriptor */
...@@ -6251,7 +6254,7 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev) ...@@ -6251,7 +6254,7 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev)
static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
{ {
unsigned int dirty_tx, tx_left; unsigned int dirty_tx, tx_left, bytes_compl = 0, pkts_compl = 0;
dirty_tx = tp->dirty_tx; dirty_tx = tp->dirty_tx;
smp_rmb(); smp_rmb();
...@@ -6275,10 +6278,8 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) ...@@ -6275,10 +6278,8 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
rtl8169_unmap_tx_skb(tp_to_dev(tp), tx_skb, rtl8169_unmap_tx_skb(tp_to_dev(tp), tx_skb,
tp->TxDescArray + entry); tp->TxDescArray + entry);
if (status & LastFrag) { if (status & LastFrag) {
u64_stats_update_begin(&tp->tx_stats.syncp); pkts_compl++;
tp->tx_stats.packets++; bytes_compl += tx_skb->skb->len;
tp->tx_stats.bytes += tx_skb->skb->len;
u64_stats_update_end(&tp->tx_stats.syncp);
dev_consume_skb_any(tx_skb->skb); dev_consume_skb_any(tx_skb->skb);
tx_skb->skb = NULL; tx_skb->skb = NULL;
} }
...@@ -6287,6 +6288,13 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) ...@@ -6287,6 +6288,13 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
} }
if (tp->dirty_tx != dirty_tx) { if (tp->dirty_tx != dirty_tx) {
netdev_completed_queue(dev, pkts_compl, bytes_compl);
u64_stats_update_begin(&tp->tx_stats.syncp);
tp->tx_stats.packets += pkts_compl;
tp->tx_stats.bytes += bytes_compl;
u64_stats_update_end(&tp->tx_stats.syncp);
tp->dirty_tx = dirty_tx; tp->dirty_tx = dirty_tx;
/* Sync with rtl8169_start_xmit: /* Sync with rtl8169_start_xmit:
* - publish dirty_tx ring index (write barrier) * - publish dirty_tx ring index (write barrier)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment