net/mlx5: Support throttled commands from async API
authorDragos Tatulea <dtatulea@nvidia.com>
Fri, 16 Aug 2024 09:01:50 +0000 (12:01 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 25 Sep 2024 11:07:41 +0000 (07:07 -0400)
commit7d627137dc1062aba6276a7d2ebe7f5ff8d542c5
treec1a4c2e6822a70ac222ef56c733dcada79defe84
parent6d17035a74028f0b0e77affefbfb5d71e6d32713
net/mlx5: Support throttled commands from async API

Currently, commands that qualify as throttled can't be used via the
async API. That's due to the fact that the throttle semaphore can sleep
but the async API can't.

This patch allows throttling in the async API by using the tentative
variant of the semaphore and upon failure (semaphore at 0) returns EBUSY
to signal to the caller that they need to wait for the completion of
previously issued commands.

Furthermore, make sure that the semaphore is released in the callback.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Cc: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Message-Id: <20240816090159.1967650-2-dtatulea@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c