Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4683107ybl; Wed, 22 Jan 2020 02:46:59 -0800 (PST) X-Google-Smtp-Source: APXvYqwq6L8nY1w0JomdG+1JyeFtsOPM8cupx6yNBuKtiM9GgNi7iKfq0obeS1+KWwG00sJjJhS1 X-Received: by 2002:aca:4a08:: with SMTP id x8mr6413463oia.39.1579690019833; Wed, 22 Jan 2020 02:46:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579690019; cv=none; d=google.com; s=arc-20160816; b=L0G+0lrqhwS6qvOpLTKLtgTLN5NGsbzQ2WxhhPWNu8/LH6pGeTSn29IcNb7tYLTu05 pfOqHy4OIcBoF2W6+mrOCVqZSJN0FHl7msiP1HRtiBDjXc7VS6pc7z0g+6orVPx8pwix Yt5TgTK9tU07yJUrOSrF7xnLkMVxy7Yw6y/Kvie21GOzB9vfv/dSPeUy+d9yyIeH5A2H eQVD50u9TjSp3OSS9QSRJWqYNj4D6mr8+TCYm/Xpo6+oMBFchQUHHorYf+6nQKQXfEDP OWQaEzm6bcjxl+8NlCFTWfqqV2mK4r2/AoVYi7nhNod22LiqFI2o7fRqz9uf6BdGAJKG aMuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XyFi4QUbF6No7tCrbJhCVZ5TjcE02iPJvNCt7IcZqnw=; b=Vha03XCl3cyLKh2rGEzgHGM+C0HYTC10cXm1L7JHqo7tYahrza6ixo5LQJjiapuUg2 s7DiKKAiA+ZYRp/fOBIjViT9t7lSlDFxTncu5s+iToEzjkBfe9/20+ouAbGXfoTa2yhc v2LFYyL5AVQ24nv0EQN8AEViNlKEYK/tMMThNLag0zYKwaJnJ1Cb2NV4A7dym7HMVB+9 A7T2Hb9k7BIqdMOYHaaMk8pCZ1PjDZWMiyL9Mt+9rF0F7A4Ej/+bvmE4ruV/E08xnx6K V/XVlzJMSXz9FF+9L6KAUpQ6j8GW861dzDIFgNKzAs3W0gZFUx9P3xHo/BAXdBFdmTup kLhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="atOCu/d8"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11si23907869otm.312.2020.01.22.02.46.48; Wed, 22 Jan 2020 02:46:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="atOCu/d8"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729191AbgAVKqS (ORCPT + 99 others); Wed, 22 Jan 2020 05:46:18 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54947 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729624AbgAVKpp (ORCPT ); Wed, 22 Jan 2020 05:45:45 -0500 Received: by mail-wm1-f67.google.com with SMTP id b19so6279438wmj.4; Wed, 22 Jan 2020 02:45:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XyFi4QUbF6No7tCrbJhCVZ5TjcE02iPJvNCt7IcZqnw=; b=atOCu/d8xHcTs6Q9DCR4yOoCncsmGvFRwn3VBq48XEuBvYixBWtSdK1x3JaE3OU9OC ODxVylq8Tytjegvo1QsONKr8O8Ky3aMD+tJg0xp4PCXlYb+KbzMgFeN6dhsHfp1BGMI/ 4KEEm8ebnJg+6uaVjvk0lQLz3vgTZOc456xdXU8EFacdblCYBkAQVFPUgp24ytbh5qoC vGvFem36xG4b5EgtG3QDmFGRl527x+c3sU0mbL5FukG1lZ4tFDZrvzvsPCaqj14Z+fUe Xgz9D6mrp1jW5sywBLwKC5lO+RWFgtOKK2j2T3VaF4fadactNW6r2jTZT6qd15pEjdmL vMQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XyFi4QUbF6No7tCrbJhCVZ5TjcE02iPJvNCt7IcZqnw=; b=iWprySoo+im6AuWHxiFCupWd+/88tWwh6BrH169B/AJNgopOPZU+B8OwpZc1+cFaOF stoeoHu2Wk5FGBuYDd0iABZbDZ6cj7go2eNinsvucguPq4IbEaKiV3YVs1nTmygGszkG kZrfiwRgijMbL1leQ0NiWGtUlSbWR/9HMlnFR9YDCid/4VyAFiELqHi4R+gV5V3rbWFX xf03H5YevxxKlMNKX5BvmL9cT9D1I9q3JHJcWhxYR4YKQdehMkOPWRU5tM6aYi4Gbowo 08K0cQGynq44NWvsHBgrP+NBePKEOGDTkeZGzDuEbqIaL6hrvznqnO5LntXRKCDVH+hT gaug== X-Gm-Message-State: APjAAAW/xZn2cWhnb932deWRzsp4npDqaum17UvQxVFIgQpI5WJ+DYuE BhrCRAvCAWDsx2Zxu1twOeQ= X-Received: by 2002:a7b:ce8b:: with SMTP id q11mr2385910wmj.100.1579689943589; Wed, 22 Jan 2020 02:45:43 -0800 (PST) Received: from Red.localdomain ([2a01:cb1d:3d5:a100:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id n3sm3443953wmc.27.2020.01.22.02.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 02:45:42 -0800 (PST) From: Corentin Labbe To: davem@davemloft.net, herbert@gondor.apana.org.au, mripard@kernel.org, wens@csie.org, iuliana.prodan@nxp.com Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH 3/9] crypto: engine: get rid of cur_req Date: Wed, 22 Jan 2020 11:45:22 +0100 Message-Id: <20200122104528.30084-4-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200122104528.30084-1-clabbe.montjoie@gmail.com> References: <20200122104528.30084-1-clabbe.montjoie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org cur_req was used as a sign of usage of the crypto_engine, now this behaviour has gone, its usage remains for detecting if we finalize the cur_req. But testing if we finalize the cur_req prevent to do more request at a time and is unnecessary. It is unnecessary since crypto_finalize_request() is only used for cryptoengine and so the request finalized will be always the current request. Signed-off-by: Corentin Labbe --- crypto/crypto_engine.c | 25 ++++++------------------- include/crypto/engine.h | 2 -- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c index dfcb00e92e09..c21867106aa4 100644 --- a/crypto/crypto_engine.c +++ b/crypto/crypto_engine.c @@ -24,27 +24,15 @@ static void crypto_finalize_request(struct crypto_engine *engine, struct crypto_async_request *req, int err) { - unsigned long flags; - bool finalize_cur_req = false; int ret; struct crypto_engine_ctx *enginectx; - spin_lock_irqsave(&engine->queue_lock, flags); - if (engine->cur_req == req) - finalize_cur_req = true; - spin_unlock_irqrestore(&engine->queue_lock, flags); - - if (finalize_cur_req) { - enginectx = crypto_tfm_ctx(req->tfm); - if (enginectx->op.prepare_request && - enginectx->op.unprepare_request) { - ret = enginectx->op.unprepare_request(engine, req); - if (ret) - dev_err(engine->dev, "failed to unprepare request\n"); - } - spin_lock_irqsave(&engine->queue_lock, flags); - engine->cur_req = NULL; - spin_unlock_irqrestore(&engine->queue_lock, flags); + enginectx = crypto_tfm_ctx(req->tfm); + if (enginectx->op.prepare_request && + enginectx->op.unprepare_request) { + ret = enginectx->op.unprepare_request(engine, req); + if (ret) + dev_err(engine->dev, "failed to unprepare request\n"); } req->complete(req, err); @@ -101,7 +89,6 @@ static void crypto_pump_requests(struct crypto_engine *engine, if (!async_req) goto out; - engine->cur_req = async_req; if (backlog) backlog->complete(backlog, -EINPROGRESS); diff --git a/include/crypto/engine.h b/include/crypto/engine.h index 4d8a2602c9ed..d77080227beb 100644 --- a/include/crypto/engine.h +++ b/include/crypto/engine.h @@ -36,7 +36,6 @@ * @kworker: kthread worker struct for request pump * @pump_requests: work struct for scheduling work to the request pump * @priv_data: the engine private data - * @cur_req: the current request which is on processing */ struct crypto_engine { char name[ENGINE_NAME_LEN]; @@ -57,7 +56,6 @@ struct crypto_engine { struct kthread_work pump_requests; void *priv_data; - struct crypto_async_request *cur_req; }; /* -- 2.24.1