Commit ef927a9c authored by Aviad Yehezkel's avatar Aviad Yehezkel Committed by Saeed Mahameed

net/mlx5e: Wait for FPGA command responses with a timeout

Generally, FPGA IPSec commands must always complete.
We want to wait for one minute for them to complete gracefully also
when killing a process.
Signed-off-by: default avatarAviad Yehezkel <aviadye@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 46f3ee4f
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "fpga/core.h" #include "fpga/core.h"
#define SBU_QP_QUEUE_SIZE 8 #define SBU_QP_QUEUE_SIZE 8
#define MLX5_FPGA_IPSEC_CMD_TIMEOUT_MSEC (60 * 1000)
enum mlx5_ipsec_response_syndrome { enum mlx5_ipsec_response_syndrome {
MLX5_IPSEC_RESPONSE_SUCCESS = 0, MLX5_IPSEC_RESPONSE_SUCCESS = 0,
...@@ -217,12 +218,14 @@ void *mlx5_fpga_ipsec_sa_cmd_exec(struct mlx5_core_dev *mdev, ...@@ -217,12 +218,14 @@ void *mlx5_fpga_ipsec_sa_cmd_exec(struct mlx5_core_dev *mdev,
int mlx5_fpga_ipsec_sa_cmd_wait(void *ctx) int mlx5_fpga_ipsec_sa_cmd_wait(void *ctx)
{ {
struct mlx5_ipsec_command_context *context = ctx; struct mlx5_ipsec_command_context *context = ctx;
unsigned long timeout =
msecs_to_jiffies(MLX5_FPGA_IPSEC_CMD_TIMEOUT_MSEC);
int res; int res;
res = wait_for_completion_killable(&context->complete); res = wait_for_completion_timeout(&context->complete, timeout);
if (res) { if (!res) {
mlx5_fpga_warn(context->dev, "Failure waiting for IPSec command response\n"); mlx5_fpga_warn(context->dev, "Failure waiting for IPSec command response\n");
return -EINTR; return -ETIMEDOUT;
} }
if (context->status == MLX5_FPGA_IPSEC_SACMD_COMPLETE) if (context->status == MLX5_FPGA_IPSEC_SACMD_COMPLETE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment