summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2020-03-06 23:55:42 +0100
committerDavid S. Miller <davem@davemloft.net>2020-03-09 19:07:42 -0700
commit6a41f2b2f1e4ce991a9e2f91023fc6f0b10b422b (patch)
treeb33c5f40b5b3e5dcbbf98340382d351962e298d1 /drivers
parenta0e6650bdd25c93c64101c09cc842e47cadcd08c (diff)
r8169: ensure tx_skb is fully reset after calling rtl8169_unmap_tx_skb
So far tx_skb->skb is the only member of the two structs that is not reset. Make understanding the code easier by resetting both structs completely in rtl8169_unmap_tx_skb. 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.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index c0999efa0c8a..359f029a7855 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -3976,11 +3976,8 @@ static void rtl8169_unmap_tx_skb(struct device *d, struct ring_info *tx_skb,
unsigned int len = tx_skb->len;
dma_unmap_single(d, le64_to_cpu(desc->addr), len, DMA_TO_DEVICE);
-
- desc->opts1 = 0x00;
- desc->opts2 = 0x00;
- desc->addr = 0x00;
- tx_skb->len = 0;
+ memset(desc, 0, sizeof(*desc));
+ memset(tx_skb, 0, sizeof(*tx_skb));
}
static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start,
@@ -3998,10 +3995,8 @@ static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start,
rtl8169_unmap_tx_skb(tp_to_dev(tp), tx_skb,
tp->TxDescArray + entry);
- if (skb) {
+ if (skb)
dev_consume_skb_any(skb);
- tx_skb->skb = NULL;
- }
}
}
}
@@ -4396,6 +4391,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;
u32 status;
status = le32_to_cpu(tp->TxDescArray[entry].opts1);
@@ -4410,11 +4406,10 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
rtl8169_unmap_tx_skb(tp_to_dev(tp), tx_skb,
tp->TxDescArray + entry);
- if (tx_skb->skb) {
+ if (skb) {
pkts_compl++;
- bytes_compl += tx_skb->skb->len;
- napi_consume_skb(tx_skb->skb, budget);
- tx_skb->skb = NULL;
+ bytes_compl += skb->len;
+ napi_consume_skb(skb, budget);
}
dirty_tx++;
}