Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp346823lqs; Thu, 13 Jun 2024 11:41:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUysDkS4EJ4I8PtVbvhwstL3nrgQcc8YUnGCAS6nyXhiyOud421e3fwD7RkirZfef5PN+4MGnuB5ARHWXcIK8ko0J1Tdd8Ry9p12yGxgw== X-Google-Smtp-Source: AGHT+IGqa3enVzoeHBl0kyL9PNFOqLb8Hzek0zqMZPldTT2EGtbXiDbW4LwbsL6742Xui8l4z49U X-Received: by 2002:a17:902:c409:b0:1f7:340e:71ac with SMTP id d9443c01a7336-1f8629febcemr6083145ad.50.1718304067630; Thu, 13 Jun 2024 11:41:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718304067; cv=pass; d=google.com; s=arc-20160816; b=Lx9MdcSP3Zpsw2MQrkV4AuhTYUeP0lBhhBVv4B2pRdWBz6rh/KdrYO+Ot2rhcJTYzI ZETBUaTcYyUED7vE7qEBKER/k2QfGwCWD6asyGiFwrrh6COTw/6MUD3c8D0VWD3Vcb1v UXtNqvCEzo2eThPyQfk3BdlSBQ3SlRAZV3qsyM56h23YQ1aSM5AOpnopyL9CfblAJANS sZd/0NVnSk/Lct7g3aWSqVai+6oXXyh7GUm+W8TWpuW/dVmGHhjxUi8T/Lj5/adKKUul S8bmT1YKP8ArLt8XjjauOagzrXL1cUlemB2oWGgb1O3nD+11/B4BKn/eRzdCvTwm6KWH zSdQ== ARC-Message-Signature: i=2; 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=h87k+dPVl1D/UE8gFW4pqRKSvcUIynxFdozvf3BwjUw=; fh=nfeNlPgxECSr4XGd3Ztrgiwx7uI5ZLZuJ2Fky0L9+4Q=; b=iJzYLnjzWq0k8d8VVYV658LejA1Sc/YroKg6ONq6QUEOHiFom/XAYAdylygra8LXM6 4DCqY9wXAhvwo9WDcgEaXGyi5Ghnjo+BbMJp5gF8+djKTm2myOs6wQSYx5rvRjGGdDqz N6VeUY8/SGEcgztDnqm1pUcoVQTkO9JqUVQkSEsgn1lCa+jOOTwUOE4uc9CI+lW1u4aN SDKNC8IHiro/MZNm9BGQbLTfzKqPNTx72OJomz/PmOgpRqAxkPSBBDGpGoafIP0emHMO Ct+G+T0VhTboJlcLK1VKm6yhDZkalQy1rSRFM9SeMapRegKEFzDDwizfFYfKqMr6Mv6L 9C4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HNokVVAx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-213852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213852-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 d9443c01a7336-1f855f168a0si17987035ad.553.2024.06.13.11.41.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 11:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213852-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=HNokVVAx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-213852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213852-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 3CDE6283A89 for ; Thu, 13 Jun 2024 18:41:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D4F014B94C; Thu, 13 Jun 2024 18:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HNokVVAx" 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 60F6F130AC8; Thu, 13 Jun 2024 18:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718304057; cv=none; b=BmuvYri4S03FeqyPp6cemQOA6IKLO7Nab4ZaOlDjfeXrec8muGULuHqqS7aTEEl0Q3Vxk6n+ZYSEP53eKUXSQ0Nl4m0zDs47jLamCQRzfZZLHWWE8F/b6qVidC7vMKUiK1fVydqI/W+NN0Szez34HXi0MMtpnuyCxhPHuyb4P3U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718304057; c=relaxed/simple; bh=dlNtThAMuLJ3XWCpoI7VTxxyt/1MyYvoexTmAVYy2OE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aS2gyPUvE7eGOZYASIYZ6QMs4/iXPGV+xCkQC0WBN/jBO6vF+T1xBh71rE3nXfeiDj9bpnPqHpRry7MMXx57dkwl263KudCDFl3ltXqJWjTgcIMvDvgAJBaVNTD+NmivuCj61kmR/scTE2IZdX3T7qjosr6QkWsdzW4geqC/M+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HNokVVAx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06338C2BBFC; Thu, 13 Jun 2024 18:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718304056; bh=dlNtThAMuLJ3XWCpoI7VTxxyt/1MyYvoexTmAVYy2OE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HNokVVAxZYYMWSUAKL4yoMg2IEvn+30uNAZ52QYlT5ph6gQB6bKcBnSVhcILFE70G 4JxsAHhH+kbBX0I9z+89VLKBxQZHzjDsHiBBw0hmXRshhrrMTphd/Q3FwVJuWCGk0d TI0jERHgSyEBPcOmBaoR/WVONbliJCcJEzUnPEaQx4vMVt1LREyB3IgksjGIpnNnIM 2bdd34Vl6xr/DMXz/MlGMvoGtBYgg1Gs7/Tuw6UgLykDL1YVrNFJUVY5MtC39kg+2C C5sN3M9yiu/jDVONNR5obFZDqu/C8pkPY7mc8W+uvrqWM5wselH5DGhjyqegqEMA/W 583c3W5dhEHSw== Date: Thu, 13 Jun 2024 21:40:51 +0300 From: Leon Romanovsky To: Bharat Bhushan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jerinj@marvell.com, lcherian@marvell.com, richardcochran@gmail.com Subject: Re: [net-next,v4 5/8] cn10k-ipsec: Add SA add/delete support for outb inline ipsec Message-ID: <20240613184051.GH4966@unreal> References: <20240612134622.2157086-1-bbhushan2@marvell.com> <20240612134622.2157086-6-bbhushan2@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20240612134622.2157086-6-bbhushan2@marvell.com> On Wed, Jun 12, 2024 at 07:16:19PM +0530, Bharat Bhushan wrote: > This patch adds support to add and delete Security Association > (SA) xfrm ops. Hardware maintains SA context in memory allocated > by software. Each SA context is 128 byte aligned and size of > each context is multiple of 128-byte. Add support for transport > and tunnel ipsec mode, ESP protocol, aead aes-gcm-icv16, key size > 128/192/256-bits with 32bit salt. > > Signed-off-by: Bharat Bhushan > --- > v3->v4: > - Added check for crypto offload (XFRM_DEV_OFFLOAD_CRYPTO) > Thanks "Leon Romanovsky" for pointing out > > v2->v3: > - Removed memset to zero wherever possible > (comment from Kalesh Anakkur Purayil) > - Corrected error hanlding when setting SA for inbound > (comment from Kalesh Anakkur Purayil) > - Move "netdev->xfrmdev_ops = &cn10k_ipsec_xfrmdev_ops;" to this patch > This fix build error with W=1 > > .../marvell/octeontx2/nic/cn10k_ipsec.c | 456 ++++++++++++++++++ > .../marvell/octeontx2/nic/cn10k_ipsec.h | 114 +++++ > 2 files changed, 570 insertions(+) > > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c > index fc1029c17c00..892bdbde92ee 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c > @@ -336,6 +336,12 @@ static int cn10k_outb_cpt_clean(struct otx2_nic *pf) > /* Set inline ipsec disabled for this device */ > pf->flags &= ~OTX2_FLAG_INLINE_IPSEC_ENABLED; > > + if (!bitmap_empty(pf->ipsec.sa_bitmap, CN10K_IPSEC_OUTB_MAX_SA)) { > + netdev_err(pf->netdev, "SA installed on this device\n"); > + mutex_unlock(&pf->ipsec.lock); > + return -EBUSY; > + } Sorry for not really reviewing the patches and posting some random comments, but this addition makes me wonder if it is correct design/implementation. At the stage of IPsec cleanup, all SAs should be removed before this call. BTW, In kernel, this type of IPsec is called "Crypto Offload" and not "inline ipsec". Thanks