r8169: reduce number of workaround doorbell rings
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 19 Nov 2020 20:57:27 +0000 (21:57 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 21 Nov 2020 02:33:55 +0000 (18:33 -0800)
commit94d8a98e6235c2ac4d188e21cab6ea4d43c98806
tree52f7741b4f75b1d2ccfa8c58a2da01d2eaebc839
parent9e8ac63fe1bc346275b27d5d8016e465402d3c34
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 <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/0a15a83c-aecf-ab51-8071-b29d9dcd529a@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/realtek/r8169_main.c