From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C08F2A09E1; Thu, 20 Oct 2022 11:20:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B556D42CFF; Thu, 20 Oct 2022 11:20:33 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id B693C42CF6; Thu, 20 Oct 2022 11:20:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666257632; x=1697793632; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=aKLZqu0stMQN0uKbm3/l+clgZElQ9LF+r6Sg/OXzyUc=; b=mx5i1vGZ2tT1gB3wpJTUp/5KvEE/AXR6tX5jdncUfNpxdqgXmU7Z77gr r2boF9fbaJJ3KuamOL/jiam3pFMieyqHfqYmwXkkuYqvcrb3cdJjF6pXT DbIU2PgWrjJTMF41pBpGn8XocFVRSrGSsG5/H6wp8UwfBqiJxFldSf3s2 QTrd5FtF8x19rdggrWSrLCb/Fx8y7IBbTn8Z6j/u7Re089d95GQETmo8Y 8RMvve00V9Bsg+BelaBwpuwSp8sH/3MxgkIxEUQWcm7b+n1BsSpbUIMaY N5GHTk2NqRJh3ncGQhl4AO2SAlH8xu0PG8UczuHbVT8yIbekLGTMLnPbV w==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="304273479" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="304273479" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 02:20:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="624576474" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="624576474" Received: from silpixa00400884.ir.intel.com ([10.243.22.82]) by orsmga007.jf.intel.com with ESMTP; 20 Oct 2022 02:20:28 -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] net/iavf: fix handling of IPsec events Date: Thu, 20 Oct 2022 10:20:26 +0100 Message-Id: <20221020092026.3852130-1-radu.nicolau@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- drivers/net/iavf/iavf_vchnl.c | 43 +++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 4327c5a786..7fc239ee98 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -346,23 +346,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; - rte_eth_dev_callback_process(dev, - RTE_ETH_EVENT_IPSEC, - &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; + rte_eth_dev_callback_process(dev, + RTE_ETH_EVENT_IPSEC, + &desc); + continue; + } + } + break; + default: + break; + } + } /* read message and it's expected one */ -- 2.25.1