Commit af99168a authored by David S. Miller's avatar David S. Miller

Merge branch 'r8169-series-with-improvements-to-rtl_tx'

Heiner Kallweit says:

====================
r8169: series with improvements to rtl_tx

This series includes few improvements to rtl_tx().
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 206bd0a7 10143872
...@@ -3970,17 +3970,15 @@ static int rtl8169_init_ring(struct rtl8169_private *tp) ...@@ -3970,17 +3970,15 @@ static int rtl8169_init_ring(struct rtl8169_private *tp)
return rtl8169_rx_fill(tp); return rtl8169_rx_fill(tp);
} }
static void rtl8169_unmap_tx_skb(struct device *d, struct ring_info *tx_skb, static void rtl8169_unmap_tx_skb(struct rtl8169_private *tp, unsigned int entry)
struct TxDesc *desc)
{ {
unsigned int len = tx_skb->len; struct ring_info *tx_skb = tp->tx_skb + entry;
struct TxDesc *desc = tp->TxDescArray + entry;
dma_unmap_single(d, le64_to_cpu(desc->addr), len, DMA_TO_DEVICE);
desc->opts1 = 0x00; dma_unmap_single(tp_to_dev(tp), le64_to_cpu(desc->addr), tx_skb->len,
desc->opts2 = 0x00; DMA_TO_DEVICE);
desc->addr = 0x00; memset(desc, 0, sizeof(*desc));
tx_skb->len = 0; memset(tx_skb, 0, sizeof(*tx_skb));
} }
static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start, static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start,
...@@ -3996,12 +3994,9 @@ static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start, ...@@ -3996,12 +3994,9 @@ static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start,
if (len) { if (len) {
struct sk_buff *skb = tx_skb->skb; struct sk_buff *skb = tx_skb->skb;
rtl8169_unmap_tx_skb(tp_to_dev(tp), tx_skb, rtl8169_unmap_tx_skb(tp, entry);
tp->TxDescArray + entry); if (skb)
if (skb) {
dev_consume_skb_any(skb); dev_consume_skb_any(skb);
tx_skb->skb = NULL;
}
} }
} }
} }
...@@ -4308,7 +4303,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, ...@@ -4308,7 +4303,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK; return NETDEV_TX_OK;
err_dma_1: err_dma_1:
rtl8169_unmap_tx_skb(d, tp->tx_skb + entry, txd); rtl8169_unmap_tx_skb(tp, entry);
err_dma_0: err_dma_0:
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
...@@ -4392,33 +4387,24 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp, ...@@ -4392,33 +4387,24 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
dirty_tx = tp->dirty_tx; dirty_tx = tp->dirty_tx;
smp_rmb(); smp_rmb();
tx_left = tp->cur_tx - dirty_tx;
while (tx_left > 0) { for (tx_left = tp->cur_tx - dirty_tx; tx_left > 0; tx_left--) {
unsigned int entry = dirty_tx % NUM_TX_DESC; unsigned int entry = dirty_tx % NUM_TX_DESC;
struct ring_info *tx_skb = tp->tx_skb + entry; struct sk_buff *skb = tp->tx_skb[entry].skb;
u32 status; u32 status;
status = le32_to_cpu(tp->TxDescArray[entry].opts1); status = le32_to_cpu(tp->TxDescArray[entry].opts1);
if (status & DescOwn) if (status & DescOwn)
break; break;
/* This barrier is needed to keep us from reading rtl8169_unmap_tx_skb(tp, entry);
* any other fields out of the Tx descriptor until
* we know the status of DescOwn
*/
dma_rmb();
rtl8169_unmap_tx_skb(tp_to_dev(tp), tx_skb, if (skb) {
tp->TxDescArray + entry);
if (tx_skb->skb) {
pkts_compl++; pkts_compl++;
bytes_compl += tx_skb->skb->len; bytes_compl += skb->len;
napi_consume_skb(tx_skb->skb, budget); napi_consume_skb(skb, budget);
tx_skb->skb = NULL;
} }
dirty_tx++; dirty_tx++;
tx_left--;
} }
if (tp->dirty_tx != dirty_tx) { if (tp->dirty_tx != dirty_tx) {
......
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