From: Matan Azrad Date: Tue, 25 Feb 2020 08:43:48 +0000 (+0000) Subject: vdpa/mlx5: fix event setup X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=06da8cccb6155b7d11e279a859c760bd4163e316;p=dpdk.git vdpa/mlx5: fix event setup The completion event mechanism should work only if at least one of the virtqs has valid callfd to be notified on. When all the virtqs works with poll mode, the event mechanism should not be configured. The driver didn't take it into account and crashed in the above case. Do not configure event interrupt when all the virtqs are in poll mode. Fixes: 8395927cdfaf ("vdpa/mlx5: prepare HW queues") Signed-off-by: Matan Azrad Acked-by: Viacheslav Ovsiienko --- diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c index 17fd9dd4fc..677b56acdf 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c @@ -241,8 +241,14 @@ mlx5_vdpa_interrupt_handler(void *cb_arg) int mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) { - int flags = fcntl(priv->eventc->fd, F_GETFL); - int ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK); + int flags; + int ret; + + if (!priv->eventc) + /* All virtqs are in poll mode. */ + return 0; + flags = fcntl(priv->eventc->fd, F_GETFL); + ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK); if (ret) { DRV_LOG(ERR, "Failed to change event channel FD."); rte_errno = errno;