From patchwork Mon Oct 24 11:34:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radu Nicolau X-Patchwork-Id: 118986 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4473BA034C; Mon, 24 Oct 2022 13:34:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4CF142B83; Mon, 24 Oct 2022 13:34:54 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 6196D40A7E; Mon, 24 Oct 2022 13:34:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666611292; x=1698147292; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V1lRYQP///L1B3MBfWeiDO7e7f09NqSbdp6KnVnBsXU=; b=aVd7Gawb5btp0xWA/B9MgDRszVqy2CytKMq8L7jhcVbY4wO4hXWSnmBe iJgOlTeB9/Dg4n+pHlJC2nQvJoVf6ybk+MUZaUXXXMhprGliM8UFJaUQU UxP0cnMTVvB0pDdITnjPAjlP+Yb5XUsadHIqXl/etDKC91AFAF8TVOXqv JJZjcUnl3Ptka1U0llpP+8D2/lPKB88c1dWg6IYjetfRqpj43f0XYzHmf uWusFqJ/vg/h9PJgUTUzWV57swVtGLFOXVABeAzbTK8yhTS78kmDfS7zH MXkNlfHACayKSo8qvLXlZhER3tx/9KOFCsj9FNbYU/R9esCPKJJXKLr+V g==; X-IronPort-AV: E=McAfee;i="6500,9779,10509"; a="306125957" X-IronPort-AV: E=Sophos;i="5.95,209,1661842800"; d="scan'208";a="306125957" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2022 04:34:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10509"; a="631229413" X-IronPort-AV: E=Sophos;i="5.95,209,1661842800"; d="scan'208";a="631229413" Received: from silpixa00400884.ir.intel.com ([10.243.22.82]) by orsmga002.jf.intel.com with ESMTP; 24 Oct 2022 04:34:49 -0700 From: Radu Nicolau To: Jingjing Wu , Beilei Xing Cc: dev@dpdk.org, qi.z.zhang@intel.com, Radu Nicolau , stable@dpdk.org Subject: [PATCH v2] net/iavf: fix handling of IPsec events Date: Mon, 24 Oct 2022 12:34:47 +0100 Message-Id: <20221024113447.4077048-1-radu.nicolau@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221020092026.3852130-1-radu.nicolau@intel.com> References: <20221020092026.3852130-1-radu.nicolau@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Verify that the message length is non zero and keep processing virtual channel messages after the event is received. Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto") Cc: stable@dpdk.org Signed-off-by: Radu Nicolau Acked-by: Qi Zhang --- v2: rebased to next-net-intel drivers/net/iavf/iavf_vchnl.c | 42 ++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 654bc7edb6..f92daf97f2 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -488,22 +488,32 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev) iavf_handle_pf_event_msg(dev, info.msg_buf, info.msg_len); } else { - /* check for inline IPsec events */ - struct inline_ipsec_msg *imsg = - (struct inline_ipsec_msg *)info.msg_buf; - struct rte_eth_event_ipsec_desc desc; - if (msg_opc == - VIRTCHNL_OP_INLINE_IPSEC_CRYPTO && - imsg->ipsec_opcode == - INLINE_IPSEC_OP_EVENT) { - struct virtchnl_ipsec_event *ev = - imsg->ipsec_data.event; - desc.subtype = - RTE_ETH_EVENT_IPSEC_UNKNOWN; - desc.metadata = ev->ipsec_event_data; - iavf_dev_event_post(dev, RTE_ETH_EVENT_IPSEC, - &desc, sizeof(desc)); - return; + /* check for unsolicited messages i.e. events */ + if (info.msg_len > 0) { + switch (msg_opc) { + case VIRTCHNL_OP_INLINE_IPSEC_CRYPTO: { + struct inline_ipsec_msg *imsg = + (struct inline_ipsec_msg *)info.msg_buf; + if (imsg->ipsec_opcode + == INLINE_IPSEC_OP_EVENT) { + struct rte_eth_event_ipsec_desc desc; + struct virtchnl_ipsec_event *ev = + imsg->ipsec_data.event; + desc.subtype = + RTE_ETH_EVENT_IPSEC_UNKNOWN; + desc.metadata = + ev->ipsec_event_data; + iavf_dev_event_post(dev, + RTE_ETH_EVENT_IPSEC, + &desc, sizeof(desc)); + continue; + } + } + break; + default: + break; + } + } /* read message and it's expected one */