From patchwork Thu Aug 3 08:32:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapati Kundapura X-Patchwork-Id: 129900 X-Patchwork-Delegate: jerinj@marvell.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 625FC42FC4; Thu, 3 Aug 2023 10:33:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBD544282D; Thu, 3 Aug 2023 10:33:09 +0200 (CEST) Received: from mgamail.intel.com (unknown [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 214514161A for ; Thu, 3 Aug 2023 10:33:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691051588; x=1722587588; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=rVp74P+OIdfqdWNpNwOSErUDA32LbkKiPnK/hJeLrm4=; b=Izc31dbnsM/zJQlxHfAe7TbqA3PG0ow8PjHO/dWNoWRcUjh1D3gi1ppN uCXmUsrtWR747wnZNSfQBe9V02cMxc9c+qSaCl6pdm+ZcROuQnij5f6nc T9ZCFBh0yPy/jJxO/FCrIStAvDqxKg/riZIymrLPrhfE5Fel6B7Leg82Y 7llI/j4eqlAyiQ7yAPtX4ItsInrhVeZlm3OfF0P2vNqpeK8dCwWUAcA27 rsyshfwkqwHssoXgLxNr/iAuBvO6vCoGVCbraimjkOCU2BIhvKOzYi7Df sePQd6qOmL0tLWWA3+NeyqjAVA7/xnV8vvHwhPEw1FrgdFcoQYzy44W5/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="368710430" X-IronPort-AV: E=Sophos;i="6.01,251,1684825200"; d="scan'208";a="368710430" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2023 01:32:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="729491256" X-IronPort-AV: E=Sophos;i="6.01,251,1684825200"; d="scan'208";a="729491256" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by orsmga002.jf.intel.com with ESMTP; 03 Aug 2023 01:32:31 -0700 From: Ganapati Kundapura To: jerinj@marvell.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com, abhinandan.gujjar@intel.com, dev@dpdk.org Subject: [PATCH v2] eventdev/crypto: fix circular buffer full case Date: Thu, 3 Aug 2023 03:32:29 -0500 Message-Id: <20230803083229.2340918-1-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20230801054457.1184208-1-ganapati.kundapura@intel.com> References: <20230801054457.1184208-1-ganapati.kundapura@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 crypto ops from the circular buffer are not getting flushed to crypto dev when crypto dev becomes busy and circular buffer gets full. Fix it by flushing ops from circular buffer when circ buffer is full instead of returning without flushing. Fixes: 2ae84b39ae7b ("eventdev/crypto: store operations in circular buffer") Signed-off-by: Ganapati Kundapura diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c index 52a28e5..1b435c9 100644 --- a/lib/eventdev/rte_event_crypto_adapter.c +++ b/lib/eventdev/rte_event_crypto_adapter.c @@ -248,9 +248,18 @@ eca_circular_buffer_flush_to_cdev(struct crypto_ops_circular_buffer *bufp, n = *tailp - *headp; else if (*tailp < *headp) n = bufp->size - *headp; - else { - *nb_ops_flushed = 0; - return 0; /* buffer empty */ + else { /* head == tail case */ + /* when head == tail, + * circ buff is either full(tail pointer roll over) or empty + */ + if (bufp->count != 0) { + /* circ buffer is full */ + n = bufp->count; + } else { + /* circ buffer is empty */ + *nb_ops_flushed = 0; + return 0; /* buffer empty */ + } } *nb_ops_flushed = rte_cryptodev_enqueue_burst(cdev_id, qp_id,