Skip to content

Commit 94d8a98

Browse files
hkallweitkuba-moo
authored andcommitted
r8169: reduce number of workaround doorbell rings
Some chip versions have a hw bug resulting in lost door bell rings. To work around this the doorbell is also rung whenever we still have tx descriptors in flight after having cleaned up tx descriptors. These PCI(e) writes come at a cost, therefore let's reduce the number of extra doorbell rings. If skb is NULL then this means: - last cleaned-up descriptor belongs to a skb with at least one fragment and last fragment isn't marked as sent yet - hw is in progress sending the skb, therefore no extra doorbell ring is needed for this skb - once last fragment is marked as transmitted hw will trigger a tx done interrupt and we come here again (with skb != NULL) and ring the doorbell if needed Therefore skip the workaround doorbell ring if skb is NULL. Signed-off-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9e8ac63 commit 94d8a98

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4356,18 +4356,19 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
43564356
int budget)
43574357
{
43584358
unsigned int dirty_tx, bytes_compl = 0, pkts_compl = 0;
4359+
struct sk_buff *skb;
43594360

43604361
dirty_tx = tp->dirty_tx;
43614362

43624363
while (READ_ONCE(tp->cur_tx) != dirty_tx) {
43634364
unsigned int entry = dirty_tx % NUM_TX_DESC;
4364-
struct sk_buff *skb = tp->tx_skb[entry].skb;
43654365
u32 status;
43664366

43674367
status = le32_to_cpu(tp->TxDescArray[entry].opts1);
43684368
if (status & DescOwn)
43694369
break;
43704370

4371+
skb = tp->tx_skb[entry].skb;
43714372
rtl8169_unmap_tx_skb(tp, entry);
43724373

43734374
if (skb) {
@@ -4397,8 +4398,10 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
43974398
* too close. Let's kick an extra TxPoll request when a burst
43984399
* of start_xmit activity is detected (if it is not detected,
43994400
* it is slow enough). -- FR
4401+
* If skb is NULL then we come here again once a tx irq is
4402+
* triggered after the last fragment is marked transmitted.
44004403
*/
4401-
if (tp->cur_tx != dirty_tx)
4404+
if (tp->cur_tx != dirty_tx && skb)
44024405
rtl8169_doorbell(tp);
44034406
}
44044407
}

0 commit comments

Comments
 (0)