summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2020-03-06 23:56:38 +0100
committerDavid S. Miller <davem@davemloft.net>2020-03-09 19:07:42 -0700
commit22d352c51e742af281bcbb0d6e67892e9922b7f4 (patch)
tree23df4bf91575bd0bb70a93908f9809fd3214f0bd /drivers
parent6a41f2b2f1e4ce991a9e2f91023fc6f0b10b422b (diff)
r8169: simplify usage of rtl8169_unmap_tx_skb
Simplify the parameters taken by rtl8169_unmap_tx_skb, this makes usage of this function easier to read and understand. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/realtek/r8169_main.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 359f029a7855..8a707d67c8d8 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -3970,12 +3970,13 @@ static int rtl8169_init_ring(struct rtl8169_private *tp)
return rtl8169_rx_fill(tp);
}
-static void rtl8169_unmap_tx_skb(struct device *d, struct ring_info *tx_skb,
- struct TxDesc *desc)
+static void rtl8169_unmap_tx_skb(struct rtl8169_private *tp, unsigned int entry)
{
- 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);
+ dma_unmap_single(tp_to_dev(tp), le64_to_cpu(desc->addr), tx_skb->len,
+ DMA_TO_DEVICE);
memset(desc, 0, sizeof(*desc));
memset(tx_skb, 0, sizeof(*tx_skb));
}
@@ -3993,8 +3994,7 @@ static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start,
if (len) {
struct sk_buff *skb = tx_skb->skb;
- rtl8169_unmap_tx_skb(tp_to_dev(tp), tx_skb,
- tp->TxDescArray + entry);
+ rtl8169_unmap_tx_skb(tp, entry);
if (skb)
dev_consume_skb_any(skb);
}
@@ -4303,7 +4303,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
err_dma_1:
- rtl8169_unmap_tx_skb(d, tp->tx_skb + entry, txd);
+ rtl8169_unmap_tx_skb(tp, entry);
err_dma_0:
dev_kfree_skb_any(skb);
dev->stats.tx_dropped++;
@@ -4390,8 +4390,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
for (tx_left = tp->cur_tx - dirty_tx; tx_left > 0; tx_left--) {
unsigned int entry = dirty_tx % NUM_TX_DESC;
- struct ring_info *tx_skb = tp->tx_skb + entry;
- struct sk_buff *skb = tx_skb->skb;
+ struct sk_buff *skb = tp->tx_skb[entry].skb;
u32 status;
status = le32_to_cpu(tp->TxDescArray[entry].opts1);
@@ -4404,8 +4403,8 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
*/
dma_rmb();
- rtl8169_unmap_tx_skb(tp_to_dev(tp), tx_skb,
- tp->TxDescArray + entry);
+ rtl8169_unmap_tx_skb(tp, entry);
+
if (skb) {
pkts_compl++;
bytes_compl += skb->len;