From patchwork Wed Dec 9 19:59:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tadeusz Struk X-Patchwork-Id: 7811951 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 53EC69F350 for ; Wed, 9 Dec 2015 20:03:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49CDB203E5 for ; Wed, 9 Dec 2015 20:03:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DD28203C4 for ; Wed, 9 Dec 2015 20:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751869AbbLIUDB (ORCPT ); Wed, 9 Dec 2015 15:03:01 -0500 Received: from mga11.intel.com ([192.55.52.93]:40133 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbbLIUC7 (ORCPT ); Wed, 9 Dec 2015 15:02:59 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 09 Dec 2015 12:02:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,405,1444719600"; d="scan'208";a="615401476" Received: from tstruk-mobl1.jf.intel.com (HELO [127.0.1.1]) ([134.134.171.63]) by FMSMGA003.fm.intel.com with ESMTP; 09 Dec 2015 12:02:59 -0800 Subject: [PATCH] crypto: qat - ring returning retry even though ring has BW From: Tadeusz Struk To: herbert@gondor.apana.org.au Cc: harvijayx.saini@intel.com, linux-crypto@vger.kernel.org, tadeusz.struk@intel.com Date: Wed, 09 Dec 2015 11:59:45 -0800 Message-ID: <20151209195945.17552.86742.stgit@tstruk-mobl1> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Harvijay Saini When many threads submit multiple requests they get blocked until all responses are processed, which prevents them from submitting more requests even though there is space on the rings. To fix this we need to decrement the inflight counter early to in the callback. Signed-off-by: Harvijay Saini Signed-off-by: Tadeusz Struk --- drivers/crypto/qat/qat_common/adf_transport.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c index eff00cd..a6f3766 100644 --- a/drivers/crypto/qat/qat_common/adf_transport.c +++ b/drivers/crypto/qat/qat_common/adf_transport.c @@ -141,6 +141,7 @@ static int adf_handle_response(struct adf_etr_ring_data *ring) while (*msg != ADF_RING_EMPTY_SIG) { ring->callback((uint32_t *)msg); + atomic_dec(ring->inflights); *msg = ADF_RING_EMPTY_SIG; ring->head = adf_modulo(ring->head + ADF_MSG_SIZE_TO_BYTES(ring->msg_size), @@ -148,12 +149,10 @@ static int adf_handle_response(struct adf_etr_ring_data *ring) msg_counter++; msg = (uint32_t *)((uintptr_t)ring->base_addr + ring->head); } - if (msg_counter > 0) { + if (msg_counter > 0) WRITE_CSR_RING_HEAD(ring->bank->csr_addr, ring->bank->bank_number, ring->ring_number, ring->head); - atomic_sub(msg_counter, ring->inflights); - } return 0; }