From patchwork Tue Feb 25 08:43:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Azrad X-Patchwork-Id: 66029 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4BE6A0524; Tue, 25 Feb 2020 09:43:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E9931BFAB; Tue, 25 Feb 2020 09:43:54 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 4E5E23B5 for ; Tue, 25 Feb 2020 09:43:52 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from asafp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 25 Feb 2020 10:43:51 +0200 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 01P8hpIW025015; Tue, 25 Feb 2020 10:43:51 +0200 From: Matan Azrad To: dev@dpdk.org Cc: Viacheslav Ovsiienko , Thomas Monjalon , Maxime Coquelin Date: Tue, 25 Feb 2020 08:43:48 +0000 Message-Id: <1582620228-25629-1-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] vdpa/mlx5: fix event setup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c index 16276f5..dd60150 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c @@ -237,8 +237,14 @@ 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;