From patchwork Tue Sep 3 04:59:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 13788049 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (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 D5E1E1CE6F5; Tue, 3 Sep 2024 05:00:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725339610; cv=none; b=XjWzUSIPF1a8wnVnQXgW7N5ZE/gO5OBIAPvb3XQSOyLpWs2Wn9lafEExIErdfWoM8gx5m/XYxIXE2YTHUT8aRwsg3pOq3QF3O7FRhP0snabU1OGbSqfQE8TFSDS6xXfXyZpeJqNdbTQzPstl1WXnof87p5ql7Fd8dxttCOz4rgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725339610; c=relaxed/simple; bh=qk0sgXPXCUp423rPtuL4WTcRq66OpxzVHbZ67bq9zZw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=PJLUDVfDpn/nE8GLBREUdc3RvA4uUPsqStzZu4MlYbb06ygaIxKe8wl58pMNOYeYhOfOvU8C36p0kpdZH/6Z+OXdfzyb6fmBAC/mfpRkUJcWjmiZemoiCpJ44erFFFl1jEn+A0MHAaCYac9tmulDhR9X/oRpv/wIGebupuvbdu8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=ZeD8waQV; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ZeD8waQV" Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48329THu016348; Mon, 2 Sep 2024 21:59:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=lFstmWVsZnwKcwpH1H25XII GyN1jtIw4s8d/tDTcq9g=; b=ZeD8waQVWLHwqsMOqLTGZN9lnCz9HT3q3SQ8/3j NcO7WHucVRfMCWwn5a9Gz9YzfoQ1uURLfhSv7jbAjvOTa2UCs9/P/ph7Acj01Szu Xq1SfV7GB79zPhTHs/FxLHlY+AzTTGM62BU+Nh+8sHfdf7o802wvZQYunvkSm3S1 dhrA4uuPchg5Llta+OGCVaeXMHaurZM1oTpzOWcWg8cgaeZr0IytKp3N8Gyc1mpf 2G/DA6BGs85PuPZsJtuNLQqBiSDTv9rjpRlV4X2vRdTtNP3tQeJCSSJ4cyhMe6Az ZftmohP4xACD6p9kmThZOWZmLtAEIPEeM1K8h6jGiXcz8jg== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 41dbv1t92f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 Sep 2024 21:59:46 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 2 Sep 2024 21:59:44 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 2 Sep 2024 21:59:44 -0700 Received: from bharat-OptiPlex-Tower-Plus-7020.. (unknown [10.28.34.254]) by maili.marvell.com (Postfix) with ESMTP id DAE953F70DB; Mon, 2 Sep 2024 21:59:39 -0700 (PDT) From: Bharat Bhushan To: , , , , , , , , , , , , , , Subject: [net-next PATCH v8 0/8] cn10k-ipsec: Add outbound inline ipsec support Date: Tue, 3 Sep 2024 10:29:29 +0530 Message-ID: <20240903045937.1759543-1-bbhushan2@marvell.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: hbo3p3jJajHOTVxRp2NfECFP-wUrxsXP X-Proofpoint-ORIG-GUID: hbo3p3jJajHOTVxRp2NfECFP-wUrxsXP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-02_06,2024-09-02_01,2024-09-02_01 X-Patchwork-Delegate: kuba@kernel.org This patch series adds outbound inline ipsec support on Marvell cn10k series of platform. One crypto hardware logical function (cpt-lf) per netdev is required for inline ipsec outbound functionality. Software prepare and submit crypto hardware (CPT) instruction for outbound inline ipsec crypto mode offload. The CPT instruction have details for encryption and authentication Crypto hardware encrypt, authenticate and provide the ESP packet to network hardware logic to transmit ipsec packet. First patch makes dma memory writable for in-place encryption, Second patch moves code to common file, Third patch disable backpressure on crypto (CPT) and network (NIX) hardware. Patch four onwards enables inline outbound ipsec. v7->v8: - spell correction in patch 1/8 (s/sdk/skb) v6->v7: - skb data was mapped as device writeable but it was not ensured that skb is writeable. This version calls skb_unshare() to make skb data writeable (Thanks Jakub Kicinski for pointing out). v4->v5: - Fixed un-initialized warning and pointer check (comment from Kalesh Anakkur Purayil) v3->v4: - Few error messages in data-path removed and some moved under netif_msg_tx_err(). - Added check for crypto offload (XFRM_DEV_OFFLOAD_CRYPTO) Thanks "Leon Romanovsky" for pointing out - Fixed codespell error as per comment from Simon Horman - Added some other cleanup comment from Kalesh Anakkur Purayil v2->v3: - Fix smatch and sparse errors (Comment from Simon Horman) - Fix build error with W=1 (Comment from Simon Horman) https://patchwork.kernel.org/project/netdevbpf/patch/20240513105446.297451-6-bbhushan2@marvell.com/ - Some other minor cleanup as per comment https://www.spinics.net/lists/netdev/msg997197.html v1->v2: - Fix compilation error to build driver a module - Use dma_wmb() instead of architecture specific barrier - Fix couple of other compilation warnings Bharat Bhushan (8): octeontx2-pf: map skb data as device writeable octeontx2-pf: Move skb fragment map/unmap to common code octeontx2-af: Disable backpressure between CPT and NIX cn10k-ipsec: Init hardware for outbound ipsec crypto offload cn10k-ipsec: Add SA add/del support for outb ipsec crypto offload cn10k-ipsec: Process outbound ipsec crypto offload cn10k-ipsec: Allow ipsec crypto offload for skb with SA cn10k-ipsec: Enable outbound ipsec crypto offload MAINTAINERS | 1 + .../net/ethernet/marvell/octeontx2/af/mbox.h | 4 + .../ethernet/marvell/octeontx2/af/rvu_nix.c | 68 +- .../ethernet/marvell/octeontx2/nic/Makefile | 1 + .../marvell/octeontx2/nic/cn10k_ipsec.c | 1095 +++++++++++++++++ .../marvell/octeontx2/nic/cn10k_ipsec.h | 266 ++++ .../marvell/octeontx2/nic/otx2_common.c | 113 +- .../marvell/octeontx2/nic/otx2_common.h | 25 + .../marvell/octeontx2/nic/otx2_dcbnl.c | 3 + .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 19 +- .../marvell/octeontx2/nic/otx2_txrx.c | 65 +- .../marvell/octeontx2/nic/otx2_txrx.h | 3 + .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 10 +- 13 files changed, 1619 insertions(+), 54 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.h