From patchwork Tue Apr 1 19:23:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 14035256 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 814D39461; Tue, 1 Apr 2025 19:23:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535440; cv=none; b=cLi212o/0K7+M9fhwsdtcJJ53Rcusf1h7B/xqMOqFVBmZOOx7zeFwDpsoKTneRvU8WKEBJdJNgc4ESeBqUX58nBMPGWlBUZSJEZsnxUimADJ2gEZkTyc/L4bWHqr+rMk0fn9k7qMLOMZ8z99UY1WfNUn6Dnp/IM71qqOK9g0VV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535440; c=relaxed/simple; bh=/4EojNlyd9dMoLRzf5Mm/q8bty3ZBw5BXSWBsU/clpE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EjPTIaDbfXs9I+h4GoANZS/A8yjY4Y1t+fccMmFP5DHqMFvTEWm1gNeP43Yw4MyIgLazRlGhPUws3O6aVAoukuZcCusXQz14xUOinzGHr7uaHl1eQ10I4sSi/phymQ5s6BBeGyeuJH8Zrg+t5Vipt1FHAOI/EVUtu9kmmrS6z74= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kPyZlSXQ; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kPyZlSXQ" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-39c13fa05ebso1526126f8f.0; Tue, 01 Apr 2025 12:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535437; x=1744140237; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nierB4LEgce+4kZQOSa3FNbylwS0gDWPVPBM7TYut2U=; b=kPyZlSXQySqPe1HXt8TcwuvhImhTQXkbyb2RbRs5BhKaABFU1Ov7iScWpgwFYe5uOU EZaP0QSahsbD533kxLHVdoSGpcl+Hio1VwOlh+vN9Is31GImUKvnfzxIr60ryEwgIrQX cTd7DRvltGdPceD5vSkF05Has+lBhdW4yjR1QaIFemnfVEFy7dmAV9pMP3j99m8qCISL ua6wbHpgTLrYkiScr1Xnfb/dwGMdP//9S1w5mb9WK2sPeHXivYjcSZZTVOq+S8+nXLGu o8oGuy96Tlz0oOKWXFdzWCLhUX966PzUp8vckSAnog1XnrrtGc3JasUqm8bLetfOeTN4 x09w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535437; x=1744140237; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nierB4LEgce+4kZQOSa3FNbylwS0gDWPVPBM7TYut2U=; b=Uo6pfKbM462hr6oO4f4CSCEybQHA0hD9GmGfQj0CiOvSKTDyROISkNrpYtilmIGd0e qkknPDYNdgoZIEIL9M2tP3lXT1pg9WMXNGGVYbAY1wH1Y3VswgdRUaNklR7uEk7xsh7w Sy1wQOBknSnqFaR6QH55u7dOkS/vDMsXtBvQ8cIPJjPfl3csMdITjVb9XQ+y/kX8tqkO XWdBNJnl9kmGHeCogk4LPe3fdn02Lh12w/bVda4D939OTkt3dGx8MIm1RvijRWLyGJFn SHoamJIZtd2e2y7wrZaxzKSlZYGWFTjcVuj3iDe86zyHrVeonz2+CjHJwhrJNmw+Ghyz pLWQ== X-Forwarded-Encrypted: i=1; AJvYcCVVYAF1JxRyRXf/rzkPyCfSrvAcG12OaBVmbW6uhHkkAsat76o5MKEE6Y+8dW4as8b8WttotB2XIZcMK/s=@vger.kernel.org, AJvYcCXg10/koam8ude2oZi+lSy2XGfviqQj0DvXpBplerqlzg5a2jfZKbdJEgtu/1mZxfIpBwm0Yky92ViJFr9F@vger.kernel.org X-Gm-Message-State: AOJu0Yym6Tsi3VnwB3MQx+YiAkzO/SuU6w3Ye3UwPItACwgFqTrud0p2 RGFGNPp5lDx6THuNUsxttowSDglN5N8I1t0K9gOIASHaiywZ6GCu X-Gm-Gg: ASbGncuGDzMwuQDcPw4BSdqFisstPviHD2QA/1UJZ+bYgIa/9ZxRgN7jGlaYCGCWqxd Sv/kf66tiU4RGI5BWarlyBIqDRhy/yHTTHcxsnPo6u8e/ZxdgQsmzSMzuicwGYM0D1zYXxBmeiQ LuQD4VQB3Q6+YhwNTTv6nFJfePAkoJvgzqWErCEbAbQcuTtn82Z2NhZuNDBKOqagW/thUAVcwlE fGWy79QGBQLhHsP8KLKEto9z9gAHP0Jea0UcFtjy6NgGL9SfCRj3Zfm8CwwGFHUsxY9dMBX4LAu mj4olnr52NM5TVodwbUHwjD2y17Oqq7+BFDi2i1FGJgpPgM/icGQtOvCLVoN0XfvL9l+VI1G X-Google-Smtp-Source: AGHT+IGHyzi31e3692ONFiGCVRk0AOakCuPS3Q8lpPUYekXyBseRhASvcdujfWAcxWGfSdab5h7ydg== X-Received: by 2002:a5d:64c7:0:b0:391:4bfd:6d5 with SMTP id ffacd0b85a97d-39c1211d5c8mr11428784f8f.52.1743535436607; Tue, 01 Apr 2025 12:23:56 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:23:56 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 1/6] crypto: sun8i-ce-hash - fix error handling in sun8i_ce_hash_run() Date: Tue, 1 Apr 2025 22:23:16 +0300 Message-ID: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rework error handling in sun8i_ce_hash_run() to unmap the dma buffers in case of failure. Currently, the dma unmap functions are not called if the function errors out at various points. Fixes: 56f6d5aee88d1 ("crypto: sun8i-ce - support hash algorithms") Signed-off-by: Ovidiu Panait --- .../crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index 6072dd9f390b..3f9d79ea01aa 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -343,9 +343,8 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) u32 common; u64 byte_count; __le32 *bf; - void *buf = NULL; + void *buf, *result; int j, i, todo; - void *result = NULL; u64 bs; int digestsize; dma_addr_t addr_res, addr_pad; @@ -365,14 +364,14 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) buf = kcalloc(2, bs, GFP_KERNEL | GFP_DMA); if (!buf) { err = -ENOMEM; - goto theend; + goto err_out; } bf = (__le32 *)buf; result = kzalloc(digestsize, GFP_KERNEL | GFP_DMA); if (!result) { err = -ENOMEM; - goto theend; + goto err_free_buf; } flow = rctx->flow; @@ -398,7 +397,7 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) if (nr_sgs <= 0 || nr_sgs > MAX_SG) { dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs); err = -EINVAL; - goto theend; + goto err_free_result; } len = areq->nbytes; @@ -411,7 +410,7 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) if (len > 0) { dev_err(ce->dev, "remaining len %d\n", len); err = -EINVAL; - goto theend; + goto err_unmap_src; } addr_res = dma_map_single(ce->dev, result, digestsize, DMA_FROM_DEVICE); cet->t_dst[0].addr = desc_addr_val_le32(ce, addr_res); @@ -419,7 +418,7 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) if (dma_mapping_error(ce->dev, addr_res)) { dev_err(ce->dev, "DMA map dest\n"); err = -EINVAL; - goto theend; + goto err_unmap_src; } byte_count = areq->nbytes; @@ -441,7 +440,7 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) } if (!j) { err = -EINVAL; - goto theend; + goto err_unmap_result; } addr_pad = dma_map_single(ce->dev, buf, j * 4, DMA_TO_DEVICE); @@ -450,7 +449,7 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) if (dma_mapping_error(ce->dev, addr_pad)) { dev_err(ce->dev, "DMA error on padding SG\n"); err = -EINVAL; - goto theend; + goto err_unmap_result; } if (ce->variant->hash_t_dlen_in_bits) @@ -463,16 +462,25 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) err = sun8i_ce_run_task(ce, flow, crypto_ahash_alg_name(tfm)); dma_unmap_single(ce->dev, addr_pad, j * 4, DMA_TO_DEVICE); - dma_unmap_sg(ce->dev, areq->src, ns, DMA_TO_DEVICE); + +err_unmap_result: dma_unmap_single(ce->dev, addr_res, digestsize, DMA_FROM_DEVICE); + if (!err) + memcpy(areq->result, result, algt->alg.hash.base.halg.digestsize); +err_unmap_src: + dma_unmap_sg(ce->dev, areq->src, ns, DMA_TO_DEVICE); - memcpy(areq->result, result, algt->alg.hash.base.halg.digestsize); -theend: - kfree(buf); +err_free_result: kfree(result); + +err_free_buf: + kfree(buf); + +err_out: local_bh_disable(); crypto_finalize_hash_request(engine, breq, err); local_bh_enable(); + return 0; } From patchwork Tue Apr 1 19:23:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 14035257 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9404A1E51E7; Tue, 1 Apr 2025 19:23:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535441; cv=none; b=LWCwf2nmFKekHvxjsuD1cV2CbLgTTlRe0mZUIk40bJ2WGwNIx54QVBlb27NJ6Mb3ioxJRbXhpBNcY7F8asRD7SO+6yO4RFGwCx/knOOz0kzbgMDar9Q/ih1msbxtMFlncOE/4qL4P2QWmSy3MKbxZRzP4ozey6lho8ZbUCOa5Ck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535441; c=relaxed/simple; bh=C4U1jwV2UTE3RqFfFsVaxqmVcfNk30K3AoLQSuFxdSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ra3+JFpKlRP/YeIwYGCOwMPekgfjIpqoqiZqCmNgKi4nLca5+Eq6C84gzu/lTXnhGROIoSdY3xiCpxkJ713JGLa6YSXNOQlT8DVJSll2XzYaYqUqxjfYPf9Ffop4otc62LXLG0OSw07bvuzad6QpOLNggRmY2MZxFHjUSPvhGSA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y5Tkqe4L; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y5Tkqe4L" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3914a5def6bso3391734f8f.1; Tue, 01 Apr 2025 12:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535438; x=1744140238; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bH5VLtP+seSAMs8ZXZEEtVjeNgw0O+SRzuS1o+Cett4=; b=Y5Tkqe4LskI2G6HaXGp6C6DSViqitcSv5WTIB9umKTN97oy0qa3RF5P9bwCevC68kB 2ZSDeoaw1NHJ7XcBHrgB/3z7aHbDETmh5rhTgBUgxpMUq8GCpylsXbcQTmxDYGUhSopP JG9Z6+Z7I2sPatYxEOPGDdP6dfCqC1z9foeLmW9S0POYUR7XT951/Qp8e1UuhgF0lI/2 pBkTZdWkdC5sNzcD8/rUO96qkIROFy4ItrtFWfhDZns6gy8LvpNYUCHqgeodD3myACh1 q2UsnTPxfhILrZoC8uVJzanzo6MXkHa3ALx/MKFXrgWyt+JPxchQKwIVKxZxerV3dz48 Vs5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535438; x=1744140238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bH5VLtP+seSAMs8ZXZEEtVjeNgw0O+SRzuS1o+Cett4=; b=mKvb8v+d+mt6oaRF3y7KEEXAoZCjJ5xuiro88vI1VtOX/9b/UN3GIPwfRpLDoS4KV/ JirUoAH7qy3BHPeFCknp998+PnC1fc6qJaumngWNDDjj2vO92q9t7rKYXw8+9UEa+7AS 6ky11dFqU1BVOEB0mpxzbpvzuqC7pqjMyt/xSaB+F6LtkTYvE+VH6m2TcrI6IvyrYIUj rtz6wYKWYwig0aOhdxJxiNUz2Bl54L00pXszSaGHZ2hENVNUZyzoC83sTY+HjUvtRsRH on6B4cK2aZGajgPcoSPZ6NWKXjiwvOf0UYsL6WBwWCDcPFqpe4w5LByxENFhGQGvP56z JmTw== X-Forwarded-Encrypted: i=1; AJvYcCUlxTAXiDzzb6cXk8lebTpbOePW619RRKK5SaxYB3KvpXusNJOGQC+z+yWdw2+RJDMJtV5wjZw1MyavXsKr@vger.kernel.org, AJvYcCX0SEhyFsrkMo2wEiS5rFR5itEbyPxPNh57mtMxXyZOaXMsm0DDv+nvE1Szr+4ebO/g2R8ikbrUYBAkqhM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1NtydY5+4ZnNjGwfPfUHcOqEBn3QPCyOdppsj+d+EAr9RFvWH PGfy/vEWvbBD4cDxuVgmPmDmZxrcgDI8eOho+DP3USMePIW3PWTe X-Gm-Gg: ASbGncviEgzAMC8Ru3zP6ULWl6tz4K/Fo5jziuei/9+IjqTX6eF4Ztc/RItD4weeMTi 9asYnCwJAhZdjJJVC8vkIJ9wqAgmRUY7nbrW3YhS4SfIr728dxRAZcovt66DPhSJ9g+0aWtknWo NudvhfbuRgMZpZN2gr6yp6ntKacXhC1u3Ik5yWH9/6qVQwrA+1jkJsrqOpRSLSpHPCvRk4SvO2R PJxzDayvcG23t7Vtoqtt5+EsfMJ8PJ9A6wq+9pal8OlIBV4/OEVO2dAChnqX/rR1ROhCrSVnwqQ ke1ieycjGv3q3ey2Nyg2a1565BmKIP6C5URQZnuYBIkmhApau/A9UZ9GcwzA20+mbbMA5nB1FsR JYzfPHe8= X-Google-Smtp-Source: AGHT+IEeNatuio+GXvnz6jtis2Ifu8CXZWb0U2xpbF/9zUj/YkR/FHukm5fxlTJZb1XZQEdPrISlBQ== X-Received: by 2002:a05:6000:40cf:b0:391:2e6a:30fe with SMTP id ffacd0b85a97d-39c121188b9mr9767506f8f.39.1743535437739; Tue, 01 Apr 2025 12:23:57 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:23:57 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 2/6] crypto: sun8i-ce-hash - remove duplicated fallback checks Date: Tue, 1 Apr 2025 22:23:17 +0300 Message-ID: <20250401192321.3370188-2-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> References: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove duplicated fallback checks in sun8i_ce_hash_digest(). The same checks are already done previously in sun8i_ce_hash_need_fallback(). Signed-off-by: Ovidiu Panait --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index 3f9d79ea01aa..2c2d285de154 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -244,21 +244,11 @@ int sun8i_ce_hash_digest(struct ahash_request *areq) struct sun8i_ce_alg_template *algt; struct sun8i_ce_dev *ce; struct crypto_engine *engine; - struct scatterlist *sg; - int nr_sgs, e, i; + int e; if (sun8i_ce_hash_need_fallback(areq)) return sun8i_ce_hash_digest_fb(areq); - nr_sgs = sg_nents_for_len(areq->src, areq->nbytes); - if (nr_sgs > MAX_SG - 1) - return sun8i_ce_hash_digest_fb(areq); - - for_each_sg(areq->src, sg, nr_sgs, i) { - if (sg->length % 4 || !IS_ALIGNED(sg->offset, sizeof(u32))) - return sun8i_ce_hash_digest_fb(areq); - } - algt = container_of(alg, struct sun8i_ce_alg_template, alg.hash.base); ce = algt->ce; From patchwork Tue Apr 1 19:23:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 14035258 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E948C2C6; Tue, 1 Apr 2025 19:24:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535442; cv=none; b=MJnUsCeL9/GGBbzdr+GlvOxUHI4LMgxvj3Cte2Cz4gcDC5SlxZ+gyJSxEKRDC0D5mPqV5IheM0Yzi9d+jJVg5b3VE/rWJSrtAO9yDyARVFoU61kRyZi85FNEhvYC+/ewg6z7lrBzrHxr6G7HsxfEAPuUBNR24SBMfVLwX9XaK40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535442; c=relaxed/simple; bh=ijYhgMFPW0GwZbvTlvUWZO6qB0iZ1PV0+yjxL+ZbDOw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WvOpf6/8C1uNMitnoAg25YdFznSicuqBVwFMS8hkJxjCO8V1WVvq46ARJIJ6rswHhVHjtwiNTb2WhBJUkNrkXzYerPUfPK//Qoyqv2ITPoNWzBN2UV9cb2/B1ri/VKKGH6NqHc4Pov48Ydg67PCs0tbFZDmZTMSqTeTePiqg3KM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Yxd0jHH8; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Yxd0jHH8" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3913b539aabso3487540f8f.2; Tue, 01 Apr 2025 12:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535439; x=1744140239; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZzBkugdw4gdptdF8hF2WvHzloU2qygLTygvgXH5F5js=; b=Yxd0jHH8O+aA5NKjLNG3TMdSfko2KdGFqtwgGc6HlWQsuw3Ju0kMy2qB+1pz8qb/CI jMbqmowt0lYq881KEUzWGG5VMeXMgvr7boqAkxjluojQdoR5rKFD/4R91u4+L69V+7s/ rCe1f+TjPJzgBOmP7T87z+h7arf6mmen+cWSBsvDd0WQM3cyGNkb6z8HdlWQQ79WM2N4 twjjKMYD8JUBPgwKUSo1K0q5mi1Jv08LIalU6gTaTYTzu35nfnV/DwAsRmSQc2ZQUSfR jZmf80X2bxxJNt9k4/UoTeNBwD1K0HUfWfwdYxSGabU3qQI6d1DvJ0fsqGWitMuBICY1 4YJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535439; x=1744140239; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZzBkugdw4gdptdF8hF2WvHzloU2qygLTygvgXH5F5js=; b=B1MtJvm3w/fMxAtnk83tjaIKDZli0mQcrcS0X1V1L5Ga0QG1vNj1XFoDCnDXzhM2S5 CTHSyZfCVtFUWYTxPh0RDChijULgpsEfpBFhA104JGvgoh54ZYZMdnFu4sFn1KkN4VAZ 2MYdbh1eCPXBhqJT+OzzEZ9Ia2hT5IvZ3aQLV043sCg11zLOIrXD3fBuzRnkL8oJsu4L uF2B+H19ld8YLcNKBQsaHPXIebI7uURtoV3lc4QS/njdLxs2REt8Mmu1xN1pb416p9fM K7vQvozBKLpby/TuAle7RmqhwHHHoTtfFZtR62+MjfMcPKWoUQyltaR8amB9P79CZFSs fwLw== X-Forwarded-Encrypted: i=1; AJvYcCWe4F43MhFwVPV/raMAXlEEU24BKBCrAUKLn87191paG0TMEh8RfzKbw0WPJreBJrpcfFOJhDfbir7W0Bk=@vger.kernel.org, AJvYcCXZMVNZz5qGh6eOJ6sFSY2l6KMISRVvV//JJvahHsLwYEXvYK9dgAZ58LJGZhiA3XAbU9c3zj+9Ujcqd1f0@vger.kernel.org X-Gm-Message-State: AOJu0YxvTf4oZnkpnp7xy+atIVlJ5hg83cB+UX4OCZTHBLerrobcI9uX mt9Izt8oWSwxEuY2TfYGscN82QSMWyMXQOG/yThIEcrhlChz5xKW X-Gm-Gg: ASbGncueY1GUOj7SwNd1zHa4ubL3EucVexGmH7EFVlSnB/OcUxt51OZZcXf0aC6/LIL JDJ0fIXWC7HGkleuq01Z+aM5vA48i3YdjIa5ZkanhaZiPpmi+x3MOjzcMMHIah3Kl75jcp46NAa V/ASesfHpXITvr19TBM36S3f2pJ8b+gzt8VrIU2hhMLVp/mT751z3B93jI5917IalPfYW1srTDh BLPKWbHJoGjKfJ/a+i8WOxbA8/Ikk4quHTUmCvxGwP8HU4M2OvZkFOUMiYBATMWirN8oRDe7NpC r0Kg5x+TlxIKfKsKvlBSRNydrKjmOc4Vx8xxQriPYxLQfZTdetvDEJL/m2V56IEskSyHQ0O/ X-Google-Smtp-Source: AGHT+IHdVEsoyIGdrpYCryCmSoxbMMM8oYYvuj+OQEED1lz5k318eW2R/hcBuIk9AkMR8eZjNXUkHQ== X-Received: by 2002:a05:6000:381:b0:39c:1f0a:ee0 with SMTP id ffacd0b85a97d-39c1f0a0f69mr5763858f8f.2.1743535438907; Tue, 01 Apr 2025 12:23:58 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:23:58 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 3/6] crypto: sun8i-ce-hash - factor out debugfs fallback statistics Date: Tue, 1 Apr 2025 22:23:18 +0300 Message-ID: <20250401192321.3370188-3-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> References: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In order to reduce code duplication, factor out to a separate function the codepath that increments debugfs fallback stats. Signed-off-by: Ovidiu Panait --- .../crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 53 +++++++------------ 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index 2c2d285de154..b0959d8218cb 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -23,6 +23,20 @@ #include #include "sun8i-ce.h" +static void sun8i_ce_hash_stat_fb_inc(struct crypto_ahash *tfm) +{ + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) { + struct sun8i_ce_alg_template *algt __maybe_unused; + struct ahash_alg *alg = crypto_ahash_alg(tfm); + + algt = container_of(alg, struct sun8i_ce_alg_template, + alg.hash.base); +#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG + algt->stat_fb++; +#endif + } +} + int sun8i_ce_hash_init_tfm(struct crypto_ahash *tfm) { struct sun8i_ce_hash_tfm_ctx *op = crypto_ahash_ctx(tfm); @@ -113,22 +127,13 @@ int sun8i_ce_hash_final(struct ahash_request *areq) struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); + sun8i_ce_hash_stat_fb_inc(tfm); + ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; rctx->fallback_req.result = areq->result; - if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) { - struct sun8i_ce_alg_template *algt __maybe_unused; - struct ahash_alg *alg = crypto_ahash_alg(tfm); - - algt = container_of(alg, struct sun8i_ce_alg_template, - alg.hash.base); -#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG - algt->stat_fb++; -#endif - } - return crypto_ahash_final(&rctx->fallback_req); } @@ -153,6 +158,8 @@ int sun8i_ce_hash_finup(struct ahash_request *areq) struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); + sun8i_ce_hash_stat_fb_inc(tfm); + ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; @@ -161,17 +168,6 @@ int sun8i_ce_hash_finup(struct ahash_request *areq) rctx->fallback_req.src = areq->src; rctx->fallback_req.result = areq->result; - if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) { - struct sun8i_ce_alg_template *algt __maybe_unused; - struct ahash_alg *alg = crypto_ahash_alg(tfm); - - algt = container_of(alg, struct sun8i_ce_alg_template, - alg.hash.base); -#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG - algt->stat_fb++; -#endif - } - return crypto_ahash_finup(&rctx->fallback_req); } @@ -181,6 +177,8 @@ static int sun8i_ce_hash_digest_fb(struct ahash_request *areq) struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); + sun8i_ce_hash_stat_fb_inc(tfm); + ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; @@ -189,17 +187,6 @@ static int sun8i_ce_hash_digest_fb(struct ahash_request *areq) rctx->fallback_req.src = areq->src; rctx->fallback_req.result = areq->result; - if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) { - struct sun8i_ce_alg_template *algt __maybe_unused; - struct ahash_alg *alg = crypto_ahash_alg(tfm); - - algt = container_of(alg, struct sun8i_ce_alg_template, - alg.hash.base); -#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG - algt->stat_fb++; -#endif - } - return crypto_ahash_digest(&rctx->fallback_req); } From patchwork Tue Apr 1 19:23:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 14035259 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5F3B20E711; Tue, 1 Apr 2025 19:24:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535443; cv=none; b=UWqJu+BVx7XRHmw3pMpXlxNSopt8nmY8qAgWNZu5+ikUy84c3CfiAQ30Y5PGAZqYbbcUaX3TN8RY1IffBl6VBi7nScOegmfsiAke0MUzUYh2PNHP0vuVCrZmmn+ngEjkUpnlIWMevQSPMr2FJ0J6rUPsEjy1/cz+FANBvPSRyyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535443; c=relaxed/simple; bh=ujIPapzlL7mjHgW3aviWBgtecWjNM0nt1PjVn8npb/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ua7pw6aqAw10CdmKPtRfDDA+3xHJTC7POc5NqKZ0IXgwHw5ikxx5jnRoCGRzVk99/DWxUyQZu7tKg/aus1qJRAeMCxCDaWLpWFmqAInkyLCHbPbEt4tw+kAV3uQZaMOrMxqzUzK4WyiQgZ75HvIno6eGsh1wwNnCNzrLGTHBBD0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QoJa2WbX; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QoJa2WbX" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-39141ffa9fcso5689341f8f.0; Tue, 01 Apr 2025 12:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535440; x=1744140240; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I/+iZ7oXBPhE3cNOeJn0BX2fJsfTTe1JAGSbvb0XfLY=; b=QoJa2WbXDqIAoHWrux+LY1Tl1WDbLQKigpeYP5fqAwR4rU8D4HgZQInkHiOLWIMLh5 moAd31EO/a+Ixx01EsJBfbRfyjkgIimR6nVzuxaDGe+uti8vfzr7yEG6Oz36JcZGYhgR GcVYzHnVlzLoszC4KKawPVPhWocItuxXotUM0WuiIYBEg+jrVOBov2mNh2nZLwnPMdFD lZzv/Eo1E6GIdcjb38TN3VGMVtWLhSddIn5wA0pmnSvcDIcBWzICZItM81xSgaSqMgHd IUV0DzmVs89bRWSKHcLsK8DtbcDYNrPhivlO8/qS6A7KUAaPp+j2jKt0D6bCHDNpQ9F5 UM0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535440; x=1744140240; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I/+iZ7oXBPhE3cNOeJn0BX2fJsfTTe1JAGSbvb0XfLY=; b=NnPF9XtdtSdgJYHUdvD+VdTskUVfvCEz/2vdYyieMpOOYndh3dZsFIuqhV+FCYjo25 psMhc/aZgCqDP8JjJS547U0IRgiowF0RHOp5ybrbKjFby/0M3CESOcyi90JdqbHgEF0p NupSS4EypDOOupK53x282P8jbje7W8B3RsQV5NkutNo5b9tYBrT4wlebDMU+vVvSz//Y qsHyMcDmUVIOgiEPz+jxIN+ehh1Oz/DF6/5JafOGBf3J+S5u4weYLQ4UoRIAqfH9E3ok 1xXP9WFpZ+ISwGs7oE0pxBqibvSOO9/RkZg1WlCgGM6Yz1wpF93dRKNskjWY0S9HI0r1 RSnQ== X-Forwarded-Encrypted: i=1; AJvYcCUkb8YkIzhC9bikM6S7mXHnVsa+EMvx62+hD2wlO+i9+j5ylmTK5aRFZ5etQIRCec/nOnnrxHdxVQinJCeM@vger.kernel.org, AJvYcCVD9RA25rH/EVnNWBbUCsN2nfVBspM8wPMTrdV/ntzsxG1hO8BEj5A9xzBq5DVXmnyUAOqLXwiGAOehCvY=@vger.kernel.org X-Gm-Message-State: AOJu0YxtMtU3PtqwV8gKnG39UqDXlcCCJKtYcAU6VR+oj4gne6KL0GEs TjLw3iJzLi33MbuSpT9tGW8HPCyxF9J3y1ZPohJtQjRvlettPek2 X-Gm-Gg: ASbGncutRJJLRzQCF+myWwOnMWpM25fYRHKr7fCUVaw0cTs8/Qqbj3UTa2I/UFm/o5K CCL27v2EKtlmzkOd3DVoEn3OPIgtgXI/R+m5MlBQEKeJ5nWLYi3xY6GYh3/MiGZmjPYfeLfPSTX /aNqQDNjrz0Ali4ylkKlJxfRKc/0Go7fxjtub1Ni7FyDT61VZM7cpC6LjCv/fKYryGey2SIp7k8 bktFmMHeimZ3AMecdErXKyTpPNAG7f2jF2Op2HlOxFQ+Gl1jIv0C+u8dqDji9fo7XEkzRPoiyHm Ngi5fzvbIul13bNX9Fsm3c0Z/+eThrj9+AxDXZ4y/JgMjoXLHjoO11p8shMtLzsiRn5JGI1V X-Google-Smtp-Source: AGHT+IEroLhlH55Nn0a2Cu0BMYw27BSdC4OLp0dlkWXs82H+dhWwczs/WCChC+qm41GDorZgNFvJwA== X-Received: by 2002:a05:6000:40ce:b0:399:6ad6:34 with SMTP id ffacd0b85a97d-39c12118e33mr11160301f8f.35.1743535440077; Tue, 01 Apr 2025 12:24:00 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.23.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:23:59 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 4/6] crypto: sun8i-ce-hash - drop CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG ifdefs Date: Tue, 1 Apr 2025 22:23:19 +0300 Message-ID: <20250401192321.3370188-4-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> References: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 'struct sun8i_ce_alg_template' is always defined, even with CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG disabled, so the ifdef guards are not needed. Make sure the statistics have IS_ENABLED() checks instead. Signed-off-by: Ovidiu Panait --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index b0959d8218cb..530c5181d73c 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -31,9 +31,7 @@ static void sun8i_ce_hash_stat_fb_inc(struct crypto_ahash *tfm) algt = container_of(alg, struct sun8i_ce_alg_template, alg.hash.base); -#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG algt->stat_fb++; -#endif } } @@ -354,9 +352,9 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) flow = rctx->flow; chan = &ce->chanlist[flow]; -#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG - algt->stat_req++; -#endif + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) + algt->stat_req++; + dev_dbg(ce->dev, "%s %s len=%d\n", __func__, crypto_tfm_alg_name(areq->base.tfm), areq->nbytes); cet = chan->tl; From patchwork Tue Apr 1 19:23:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 14035260 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40FE5214221; Tue, 1 Apr 2025 19:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535445; cv=none; b=mkX1tX0KSk0mVKzWKTXsxMvPSoNJh9E3ZaPTJO67vPWbxr3/0kGQqxdlinpos8NVhgcEmibrriatDEoPCMaGFn53HZtfiWbtxHVNubL5BiMEALtlbLvOmeQ1yKQ34KvYszdiBAYIxmc1Hte/nUCeFUhiZyTYugOrofMaCU7ZP9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535445; c=relaxed/simple; bh=8ZKDGGf8d4/6E2eiXmvJNyK8cfqVo2y1RKH/3zxXGNg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m59d6ZugYhJDpNrX5jVZmJc3M0U0UQxrkkPT2cep2LQw1QLWp5MM33oBtDJsH3gN4gwVMUcPjsQqBO4RoLBTIn8CypM4hZJ3J57hNk9xNE9K/TRSaPJwQC3UtIJGDTsBggRy4hkJP4W5QwKLxOS6+qoNPURzamnzdDG4+1JYceI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WIgYYR7t; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WIgYYR7t" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-39bf44be22fso3090451f8f.0; Tue, 01 Apr 2025 12:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535441; x=1744140241; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i8z+fSx5TSn2FrXLNFfU/1u/JP6JDm+uKA06s523rtI=; b=WIgYYR7ttKSP3JYkfCqRtqCuLiRCqMfIp+oDjR43J18mnP60Vcsfwb1I5CtNxOaiNd 1hz4WVRsqO5+atNPchLLdqUO8r01YNgZRhb0jxj5YgjzIr7wSTjcAtTGC3X0kEt8VBPe IfOdTZVDPh0PbiiY0sWcd+rg5GxZOB6CUbSe/FdoJpdwdbhpz/VdmDSLFzAEcm76PRab 9sWH8G35wFS/VQalifmG/fW2YUbxWG+XhuWlHDOFxJDf6lPsroiGguRJWawx1qKiIwN0 keSfJDVFzfMCLeUv/ebD04T7KhaVncc6FUgrlb17cvex0u9XC8yVhhgucyIy5Xoarvpa mSTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535441; x=1744140241; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i8z+fSx5TSn2FrXLNFfU/1u/JP6JDm+uKA06s523rtI=; b=WLU2GvctshDsDR4GZiY4rAres6Q82NlI4FZ7p/7Q69+8cWZQ3jDz13JuN10G6Fbqu0 9HPn2isjU1ejCuxZf2i1TywNKl5GeX6NkCp/E6bxzO7NICfEriwTvirMNjV36CuNzrZ1 JwkqMHem+vCHNrK6iAJqELyBTccO0B2bzm7zxwqH/Vhu/rnzm+G0H4TWJTfZKoJQ6gU/ ZVxjYDCsbziVxWelkUw9Xi5dZsjyexse4GY3qtUVNjcF/Q2r0jWzpVSjMlGK/G2gyrbr tKGFx0B5mkjMLMGM55JxNNTpyDdz8sJ7KYmi/5WRwHW7Kbc8HT1l3hI3cfhNTBUQCxLD ohYA== X-Forwarded-Encrypted: i=1; AJvYcCW++VHtgmgt4SxCdhBrXVolht852xaESyogSRokUdHsHpUR1Uxuhiuo27bw4l+80BJWgOLUqnWM1zs6ffE=@vger.kernel.org, AJvYcCXttQepzN+A0hQS9NvoG+neHn8KeArBFFDC3IM4QUy7CXxys0KkVkSyFeY6Eu6k8FTtvQAdyGJKZxcpq5XZ@vger.kernel.org X-Gm-Message-State: AOJu0YwZU42/TPJAYpxA51oGcc8VTMuKh6N3IzqFE1FPr/0MfontwPQj 9ov1gQN0VzwmkUx2OZgAypzv5iuo06wl2OZT/IWK0KyDE861mNd4 X-Gm-Gg: ASbGncsy8mXDT4eZEx4Xv6rvD9hp4M1SKNROI06UWiSJLIzJRsKbPgSm7ofAygBOTlG 7HZSL645zwEojH4NQIKUuLluaJ9qI/OvakaD/kpPT27uzz7aEpYdGCuD2yD7j+Wj71SjdVu9hLy 9TZmCIHRnHkBeUIY38wtVShWDFEwmJ5Z95IbDq4j2mPcsguSi6FgzqUvhfZALA40+ALjIddG8ks ap+dgItKXweqIha18TaSm9KPiPKiGJelnite2AaaoRzS/bGvxafk//vssoEZ+zZAhqL7HNREQBP RZBP/813c2t9YCniHvLIGNqbxfzGD0A051/bt6xMEd/dQCIVbaN092p6RKsn+QvBLWXaJbMe X-Google-Smtp-Source: AGHT+IHEh+OGGdBfpbw9Ezhf9HsQaZImvcYBc/BECi3M6V/8EKmHii6CQkGoC7DxQblK6JTqZon8Ig== X-Received: by 2002:a05:6000:418a:b0:391:22e2:cd21 with SMTP id ffacd0b85a97d-39c12117df4mr9452334f8f.36.1743535441394; Tue, 01 Apr 2025 12:24:01 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:24:00 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 5/6] crypto: sun8i-ce-hash - add IS_ENABLED() checks to debugfs stats Date: Tue, 1 Apr 2025 22:23:20 +0300 Message-ID: <20250401192321.3370188-5-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> References: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG) checks before the fallback counter updates to make sure the code is not included when debugfs statistics support is not enabled. Signed-off-by: Ovidiu Panait --- .../crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index 530c5181d73c..f2481e1585ba 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -60,8 +60,10 @@ int sun8i_ce_hash_init_tfm(struct crypto_ahash *tfm) sizeof(struct sun8i_ce_hash_reqctx) + crypto_ahash_reqsize(op->fallback_tfm)); - memcpy(algt->fbname, crypto_ahash_driver_name(op->fallback_tfm), - CRYPTO_MAX_ALG_NAME); + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) + memcpy(algt->fbname, + crypto_ahash_driver_name(op->fallback_tfm), + CRYPTO_MAX_ALG_NAME); err = pm_runtime_get_sync(op->ce->dev); if (err < 0) @@ -198,22 +200,30 @@ static bool sun8i_ce_hash_need_fallback(struct ahash_request *areq) algt = container_of(alg, struct sun8i_ce_alg_template, alg.hash.base); if (areq->nbytes == 0) { - algt->stat_fb_len0++; + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) + algt->stat_fb_len0++; + return true; } /* we need to reserve one SG for padding one */ if (sg_nents_for_len(areq->src, areq->nbytes) > MAX_SG - 1) { - algt->stat_fb_maxsg++; + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) + algt->stat_fb_maxsg++; + return true; } sg = areq->src; while (sg) { if (sg->length % 4) { - algt->stat_fb_srclen++; + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) + algt->stat_fb_srclen++; + return true; } if (!IS_ALIGNED(sg->offset, sizeof(u32))) { - algt->stat_fb_srcali++; + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) + algt->stat_fb_srcali++; + return true; } sg = sg_next(sg); From patchwork Tue Apr 1 19:23:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 14035261 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 870F5215160; Tue, 1 Apr 2025 19:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535446; cv=none; b=IYT9A06X0vqJ0YSs1PpX8Q+lswsN6mjRCUQSoLn6DTykVeyPzCD4dABP2t8/Utz+u+dX3FIGN+YApxOjkI+CeTLoNg0WicMNYdNFxo6d7+zRdXmMzu2iOAbFsThhWZd7pPkYSq+1fH/cG1m03atrdV4FFBa3g51oSc+8P97iptQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535446; c=relaxed/simple; bh=NRVhERk2BAR2xqBjMJivMm5iv64usDIZsZsw3SPAVmI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rjNtLJG9VGukvgCKa0oupprkMzxNpjyUsPJMFr4k42Ea38GXTwCf91urzaMv4BZ79NA24gTrgu0VhsnDJN9eIl4KkBm8tb0bb2HTYBvySEx8IyT71UmNQ9S5ll9+58eqpVXbWPDb0xIutgB41zq/JEPeNS2oKEr0fYn/5U4Yw7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XY9ElwBh; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XY9ElwBh" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-399749152b4so2722923f8f.3; Tue, 01 Apr 2025 12:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535443; x=1744140243; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FPD+7okMltc/dAuqJI3eHLzfTcaBka9M3a4LKpm2uhg=; b=XY9ElwBhlffVSXsL5phzHmRrZfJt0aNCilJpmYPRsq0x52cnBo10nbFZMoiH2Mr9zD pxMORSxv8h9NEqbfFlSiOdN2hcRM9C7VW1RF/tEdQwqT1pQYSytQBI//LQHNJMFsZSbs WPwHIE+rEyUypbdDku+DppDeiPpsWM21i9Bp1mwGsF7ZTvetLoD/VEiTuh/Aiq+AZwUT VDE7jafLiQwkyCDd652vEFSdjm3TqB2VPB/CnwDKEm/BSrU1lm8b8W9KS3j2uQEYGJV/ iDDubM9w49kw41Rj+Mf9Q7yhyJSRRfw9/NoeC37kPXJmM62amcX0jsouEv4Hxm2h49gy 5Sgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535443; x=1744140243; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FPD+7okMltc/dAuqJI3eHLzfTcaBka9M3a4LKpm2uhg=; b=fcQk9My1ZOaIunKzjAQqdviNVjZiqV9Chva6hkSG+rLHL4bNJ9a4VDmVJRujM8BO4q elaxloO1jwxirTVetdifyJjbiq77cZCMheX0TYXgBLJyIwWEnYTeB1qoJuc6qo7Aqvha qytyov6tPOTxj96dpVpwQ6yJ8vayXVUlHKFy9/ROA8J+CWeJ7Far5RvfzmxBroy9B3yc Gmlp+U486UKuLRF0SF83t5gaabFTLJQ0JGZWGjDkectCqK0z3VEaQ53yKyn0JYVXBvKK IJrGImjWlH0Hon7IHYOni0HY1heqRdKusxcgmfR1xwqfXYY1MybCpcNvzRRVP8ySjkJI 5+Xw== X-Forwarded-Encrypted: i=1; AJvYcCW9FxNLFS8nxbVuC1YTRCgT3Hgpy1Cn8fATVQZhzI9vxoW0YZZOUqsPkYVXzejvJcKpj+VpUjqHATPFP6k=@vger.kernel.org, AJvYcCXYVRTYPmy9WTqLo/HSn14tH6JZCB8ab+5yvdt8n2O43l2nG9T4lqknnb09G2v9xjD5svfMqBLUWOVbzqHx@vger.kernel.org X-Gm-Message-State: AOJu0Yzz31vl8RAyX1AIBqATzYMHRpoPtzzVVgdkkgltvsqlX/jW+S0+ DCETGyDcXh/QKCH1gMnfTUWMhlcfoYb84e4upPn72U6BiYuqvrOf X-Gm-Gg: ASbGncthuP/6xJuCawF+GmOjd3SeyR5cusiuYSmZqzPJ78YHqBLOEhJYGPpqHPMZUsh z0fDmMXLR4L1sNyejgQ2S+fWZP1LZQzDUDYEopUp5bd6oLpToy/huPC1zzGudgZA7FVCbLJg/l2 B7LsLhq57xJJjpPlJOOPVho3UQ0ODX7rZTJOGSNU1GPC/mt+kFm4slKBeTxQzesRWF12K/8jwAL RAu/KoF68euCPjnYomkSP5eX6ekT0w1vSwCtyHBLCX6aUqZMsiAP9bqL7NyMHDILH/xTpjCzviO xzyucW41Nlf7fiqFQwfmFngSaRbrBdOTZBZpjXPj1UlFgywdPzTOk0WwOEKF+1atotou1EoB X-Google-Smtp-Source: AGHT+IEaiKwLn7JsnD/3lJiU7PGrasf+3+s7Prm3UNAJkOHPWOkOwYJ5/33v9GOGEA2VI8+dpTqX0g== X-Received: by 2002:a05:6000:1a8b:b0:39a:c9c1:5453 with SMTP id ffacd0b85a97d-39c2367439dmr3498181f8f.49.1743535442768; Tue, 01 Apr 2025 12:24:02 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.24.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:24:02 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 6/6] crypto: sun8i-ce-hash - use API helpers to setup fallback request Date: Tue, 1 Apr 2025 22:23:21 +0300 Message-ID: <20250401192321.3370188-6-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> References: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rather than setting up the fallback request by hand, use ahash_request_set_callback() and ahash_request_set_crypt() API helpers to properly setup the new request. Signed-off-by: Ovidiu Panait --- .../crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index f2481e1585ba..ba13fb75c05d 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -92,7 +92,9 @@ int sun8i_ce_hash_init(struct ahash_request *areq) memset(rctx, 0, sizeof(struct sun8i_ce_hash_reqctx)); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); return crypto_ahash_init(&rctx->fallback_req); } @@ -104,7 +106,9 @@ int sun8i_ce_hash_export(struct ahash_request *areq, void *out) struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); return crypto_ahash_export(&rctx->fallback_req, out); } @@ -116,7 +120,9 @@ int sun8i_ce_hash_import(struct ahash_request *areq, const void *in) struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); return crypto_ahash_import(&rctx->fallback_req, in); } @@ -130,9 +136,10 @@ int sun8i_ce_hash_final(struct ahash_request *areq) sun8i_ce_hash_stat_fb_inc(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & - CRYPTO_TFM_REQ_MAY_SLEEP; - rctx->fallback_req.result = areq->result; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); + ahash_request_set_crypt(&rctx->fallback_req, NULL, areq->result, 0); return crypto_ahash_final(&rctx->fallback_req); } @@ -144,10 +151,10 @@ int sun8i_ce_hash_update(struct ahash_request *areq) struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & - CRYPTO_TFM_REQ_MAY_SLEEP; - rctx->fallback_req.nbytes = areq->nbytes; - rctx->fallback_req.src = areq->src; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); + ahash_request_set_crypt(&rctx->fallback_req, areq->src, NULL, areq->nbytes); return crypto_ahash_update(&rctx->fallback_req); } @@ -161,12 +168,11 @@ int sun8i_ce_hash_finup(struct ahash_request *areq) sun8i_ce_hash_stat_fb_inc(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & - CRYPTO_TFM_REQ_MAY_SLEEP; - - rctx->fallback_req.nbytes = areq->nbytes; - rctx->fallback_req.src = areq->src; - rctx->fallback_req.result = areq->result; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); + ahash_request_set_crypt(&rctx->fallback_req, areq->src, areq->result, + areq->nbytes); return crypto_ahash_finup(&rctx->fallback_req); } @@ -180,12 +186,11 @@ static int sun8i_ce_hash_digest_fb(struct ahash_request *areq) sun8i_ce_hash_stat_fb_inc(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & - CRYPTO_TFM_REQ_MAY_SLEEP; - - rctx->fallback_req.nbytes = areq->nbytes; - rctx->fallback_req.src = areq->src; - rctx->fallback_req.result = areq->result; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); + ahash_request_set_crypt(&rctx->fallback_req, areq->src, areq->result, + areq->nbytes); return crypto_ahash_digest(&rctx->fallback_req); }