OSDN Git Service

net/mlx5e: Optimize RQ page deallocation
authorMaxim Mikityanskiy <maximmi@nvidia.com>
Fri, 30 Sep 2022 16:29:00 +0000 (09:29 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 1 Oct 2022 20:30:21 +0000 (13:30 -0700)
commitddb7afeee28bc37b4815470d00f0c8db3fcabd2e
tree1b81ba3b8dbe0dfe952bfd92618d3b2315c72b48
parent96d37d861a09ba4b6ea08b87fa1c173c1af522b1
net/mlx5e: Optimize RQ page deallocation

mlx5e_free_rx_mpwqe loops over all pages of a MPWQE, calling
mlx5e_page_release for ones that are not scheduled for XDP_TX or
XDP_REDIRECT; and mlx5e_page_release checks whether it's an XSK RQ or a
regular one for each page/XSK frame. This check can be moved outside the
loop to reduce the number of branches.

mlx5e_free_rx_wqe loops over all fragments, calling mlx5e_page_release
for the ones that are last in a page; and mlx5e_page_release checks
whether it's an XSK RQ or a regular one for each fragment. Using the
fact that XSK doesn't support multiple fragments, it can be optimized
for both XSK and regular usages:

1. Make an early check for XSK and call its deallocator directly, saving
3 branches (loop condition, frag->last_in_page and selection of
deallocator).

2. Call the regular deallocator directly in the non-XSK case, saving a
branch per fragment, except the first one.

After the changes, mlx5e_page_release is removed, as there are no
callers left.

Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c