mlxsw: pci: Handle up to 64 Rx completions in tasklet
authorAmit Cohen <amcohen@nvidia.com>
Fri, 26 Apr 2024 12:42:22 +0000 (14:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Apr 2024 09:47:05 +0000 (10:47 +0100)
commite28d8aba4381a7b056baef2e8c1422a72dcde0b5
tree25e38d44d1d7a83c69aa76b29d05764cc349dd19
parentb5327b9a300e2ecec1372ed375615f39e3df0542
mlxsw: pci: Handle up to 64 Rx completions in tasklet

We can get many completions in one interrupt. Currently, the CQ tasklet
handles up to half queue size completions, and then arms the hardware to
generate additional events, which means that in case that there were
additional completions that we did not handle, we will get immediately an
additional interrupt to handle the rest.

The decision to handle up to half of the queue size is arbitrary and was
determined in 2015, when mlxsw driver was added to the kernel. One
additional fact that should be taken into account is that while WQEs
from RDQ are handled, the CPU that handles the tasklet is dedicated for
this task, which means that we might hold the CPU for a long time.

Handle WQEs in smaller chucks, then arm CQ doorbell to notify the hardware
to send additional notifications. Set the chunk size to 64 as this number
is recommended using NAPI and the driver will use NAPI in a next patch.
Note that for now we use ARM doorbell to retrigger CQ tasklet, but with
NAPI it will be more efficient as software will reschedule the poll
method and we will not involve hardware for that.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/pci.c