Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1838296rdb; Sun, 19 Nov 2023 12:33:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHt06ZcVbUNNFysNJl8zcn74XW6ha/fYP73UfOullRSwFm1fdVefH7A9ELb414Fmf5W3vlM X-Received: by 2002:a05:6808:1912:b0:3b2:ec66:d868 with SMTP id bf18-20020a056808191200b003b2ec66d868mr7763799oib.41.1700425985616; Sun, 19 Nov 2023 12:33:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700425985; cv=none; d=google.com; s=arc-20160816; b=a/xcpzG32+aCVyxS8uDwzJU3WZgxjbO+o9s0BbJoMCOy5OSW7MLuyWFw9qMZVY86Ce yGsUCH2iMlrymmjDCRiT5i23RVNzu5jmnDIyGFnFR5vgSOn9MCIrRq83yD8pnjuejpG8 FQVM4/hronBRCnlfQPoiDdLK92fm3BSfGDntOv6+87WnkYQ6Al+nmP03aCS8rfCnDoJM YUqD/2O7AH2Uiev3MIYdFHifdaNLmUnkSX0MLA9mgmtJ7ZljyTE1JnfY5XgPlL/mItBV vSF0Y2tDVhcaohrC9muyzN6kxNvk1UgUdi3khT5a1Ng2FLcXNN55DKoP57UYNG7B4z2n MA7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oJ6NX4ZKjohw+xpjTip2J5RA+P8pv/8fQZlpnpavjkk=; fh=Fz83apCrKEjyMj5O6UeX0Rbv8LA9NzDgcZi7b1ijI+I=; b=CxiXygGLarV3lAt+STPiE1IJDconKJzj9O8OR3mNVGu2ITvZT8kWcC4JVro+d9AcKi tOYgCCYbqBLOrbdmMrDuZzt2acQ5UHqGOzYDdzjYMsQL42wcGDreJwYvU8X7wT+QCYA2 T5XIY1vCbqH53Og3Ns0rftfAKf2x7xzu/jfIC2x/PP499agnKKegPYL2VJvbpUAkyW6+ nqEZy+OlysKtk6sFAETMA08DQlcdhQDp/ZPKMChdmn3KueJkX8m/lUZcxg+MbChCGwLm B7KLItkZkTBFaNuOcwFDNfKBT2Eio3t48Qj5BmLPI9DXLiqhUgvqcaBM42jBBSNtiDhS Ur8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NDebwZKR; spf=pass (google.com: domain of linux-crypto+bounces-190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bz11-20020a056a02060b00b005c1cc53612dsi7219119pgb.500.2023.11.19.12.33.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 12:33:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NDebwZKR; spf=pass (google.com: domain of linux-crypto+bounces-190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4644A280CEC for ; Sun, 19 Nov 2023 20:33:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 004DC17999 for ; Sun, 19 Nov 2023 20:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NDebwZKR" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11D4A134AD; Sun, 19 Nov 2023 19:49:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E537C433C7; Sun, 19 Nov 2023 19:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700423375; bh=Y65QvSsXHqm7VX9AgZ5BI+hkRtsvRDz99qPdNHT4aK8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NDebwZKRzTY+jbu34I1hOcnskpgvZxP1VCMbL15KXFLd06R0pzFNB/x58zVKpNCuc 6scI15eSTKaDeIsb4QjT4GQ+w0FaPGLIk8cnW0rYrPtPgBjsGcWyucqn/asayFHZAN WK8vLf40QTB+aT7pc3FK/xueJlV8ElIrEcgsaOIUH/oR5fhrri7uen9KFk2kwLwzfu Tfo6cs/DnI07Dz8nNIA0SICm5u0ZFAw2cWRDnNoe2gkuaRsQe8WpirvvwzPMq0HHTU p3yk/BVUI+XR4XXgvjKw+9EUm6yvVj4SkAQ+WNpST5lniVxsnzhuxolkXYJMmXsIEJ Xpkcm+ne9B6/w== Date: Sun, 19 Nov 2023 19:49:30 +0000 From: Simon Horman To: Srujana Challa Cc: herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, bbrezillon@kernel.org, arno@natisbad.org, kuba@kernel.org, ndabilpuram@marvell.com, sgoutham@marvell.com Subject: Re: [PATCH v1 02/10] crypto: octeontx2: add SGv2 support for CN10KB or CN10KA B0 Message-ID: <20231119194930.GG186930@vergenet.net> References: <20231103053306.2259753-1-schalla@marvell.com> <20231103053306.2259753-3-schalla@marvell.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231103053306.2259753-3-schalla@marvell.com> On Fri, Nov 03, 2023 at 11:02:58AM +0530, Srujana Challa wrote: Hi Srujana, some minor feedback from my side. > Scatter Gather input format for CPT has changed on CN10KB/CN10KA B0 HW > to make it comapatible with NIX Scatter Gather format to support SG mode nit: compatible > for inline IPsec. This patch modifies the code to make the driver works > for the same. This patch also enables CPT firmware load for these chips. > > Signed-off-by: Srujana Challa ... > diff --git a/drivers/crypto/marvell/octeontx2/otx2_cpt_reqmgr.h b/drivers/crypto/marvell/octeontx2/otx2_cpt_reqmgr.h ... > +static inline int sgv2io_components_setup(struct pci_dev *pdev, > + struct otx2_cpt_buf_ptr *list, > + int buf_count, u8 *buffer) > +{ > + struct cn10kb_cpt_sglist_component *sg_ptr = NULL; > + int ret = 0, i, j; > + int components; > + > + if (unlikely(!list)) { > + dev_err(&pdev->dev, "Input list pointer is NULL\n"); > + return -EFAULT; > + } > + > + for (i = 0; i < buf_count; i++) { > + if (unlikely(!list[i].vptr)) > + continue; > + list[i].dma_addr = dma_map_single(&pdev->dev, list[i].vptr, > + list[i].size, > + DMA_BIDIRECTIONAL); > + if (unlikely(dma_mapping_error(&pdev->dev, list[i].dma_addr))) { > + dev_err(&pdev->dev, "Dma mapping failed\n"); > + ret = -EIO; > + goto sg_cleanup; > + } > + } > + components = buf_count / 3; > + sg_ptr = (struct cn10kb_cpt_sglist_component *)buffer; > + for (i = 0; i < components; i++) { > + sg_ptr->len0 = list[i * 3 + 0].size; > + sg_ptr->len1 = list[i * 3 + 1].size; > + sg_ptr->len2 = list[i * 3 + 2].size; > + sg_ptr->ptr0 = list[i * 3 + 0].dma_addr; > + sg_ptr->ptr1 = list[i * 3 + 1].dma_addr; > + sg_ptr->ptr2 = list[i * 3 + 2].dma_addr; > + sg_ptr->valid_segs = 3; > + sg_ptr++; > + } > + components = buf_count % 3; > + > + sg_ptr->valid_segs = components; > + switch (components) { > + case 2: > + sg_ptr->len1 = list[i * 3 + 1].size; > + sg_ptr->ptr1 = list[i * 3 + 1].dma_addr; > + fallthrough; > + case 1: > + sg_ptr->len0 = list[i * 3 + 0].size; > + sg_ptr->ptr0 = list[i * 3 + 0].dma_addr; > + break; > + default: > + break; > + } > + return ret; The above fields of sg_ptr all have big-endian types but are being assigned values in host byte-order. As flagged by Sparse. > + > +sg_cleanup: > + for (j = 0; j < i; j++) { > + if (list[j].dma_addr) { > + dma_unmap_single(&pdev->dev, list[j].dma_addr, > + list[j].size, DMA_BIDIRECTIONAL); > + } > + > + list[j].dma_addr = 0; > + } > + return ret; > +} > + > +static inline struct otx2_cpt_inst_info *cn10k_sgv2_info_create(struct pci_dev *pdev, > + struct otx2_cpt_req_info *req, > + gfp_t gfp) nit: I think it would be nicer to format the above as in a way that indentation isn't pushed so far to the right that alignment with the opening parentheses becomes impossible: static inline struct otx2_cpt_inst_info * cn10k_sgv2_info_create(struct pci_dev *pdev, struct otx2_cpt_req_info *req, gfp_t gfp) Running ./checkpatch.pl --strict over this patch-set might also be useful. ...