From patchwork Mon Aug 19 12:23:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 13768313 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (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 C180F16C862; Mon, 19 Aug 2024 12:24:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724070280; cv=none; b=HC5obNww3WOVMjfoL65To2DisvwLWTW6HkQxWMTwipVcea5NTUb5jRJtNFG8PiHCSxxZxU3cDdHVJaTfYmYz5KaQf9dMgdnvur1UQCX2SKs8xvZ39RhdgslvwKbC6J2u3i2DCuiXDJpy9zjVVMMzCWgpg+Nfw5+8RAroASkEOqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724070280; c=relaxed/simple; bh=wpaPQyLTMcILsZfXzCjWYbrxiBtNPXW80UUroHbluMM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m8rckbwNF2sWKIlkn6n1Cng48UwriqMmWYf/4qgsQMuQ0dXDmghu/Er/b6Xzi2VX1EaHwCl8OsA3zx+cMJWU+pIlD2a9e6dLR0zMFsFZpf6xukGrRMwwW3YHSTyN+UMK1xn/y9j+2prMQtgBmmZ2IXBkfMFzpHObX6APjHNKIGY= 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=fail (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=RDEi+dKL reason="signature verification failed"; arc=none smtp.client-ip=67.231.148.174 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=fail reason="signature verification failed" (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="RDEi+dKL" Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47J9QxWj004260; Mon, 19 Aug 2024 05:24:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=T YnLsZQRc4bC8NOacrHdfgP4/MqV+/LHzMccjNv3st8=; b=RDEi+dKLGtWoiN+GH 34EFg+jL3/6JZyXa1BPMc/7tyceJsRnSHnSZtVCmRcABebrOyi3vuGbdfb5SETDc ZD9z5YNRwJQJ2e5ZnSVnM/BPatJecsg7+ZpSyVZToqLFJUt890g/TJ2H/1nNfww+ DXnuVFWSv29fW98ARTcEA7ePR+h1Y/vmPt5j/nt9YEGKMVFZ4XBLfp1P70kONy9n mUWNteeQaRwKbjQLbyIv4l3owtXttS44Ea6SHbF+OmExFzUd/055b4zy/S2r+oZe mU4KaELpOz+GJ5LxWGwexQoigCMFcWArnOJowinDA2CbSk0iyoPs7TH7iImq5boz piMtQ== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 4143e80g0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Aug 2024 05:24:32 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 19 Aug 2024 05:24:31 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 19 Aug 2024 05:24:31 -0700 Received: from bharat-OptiPlex-Tower-Plus-7020.. (unknown [10.28.34.254]) by maili.marvell.com (Postfix) with ESMTP id 665183F70A9; Mon, 19 Aug 2024 05:24:26 -0700 (PDT) From: Bharat Bhushan To: , , , , , , , , , , , , , , b@mx0a-0016f401.pphosted.com Subject: [net-next,v6 7/8] cn10k-ipsec: Allow ipsec crypto offload for skb with SA Date: Mon, 19 Aug 2024 17:53:47 +0530 Message-ID: <20240819122348.490445-8-bbhushan2@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819122348.490445-1-bbhushan2@marvell.com> References: <20240819122348.490445-1-bbhushan2@marvell.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: y-B0K_AU7Q0Z__GD0APIkXEcbqlYlyM1 X-Proofpoint-GUID: y-B0K_AU7Q0Z__GD0APIkXEcbqlYlyM1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-19_11,2024-08-19_01,2024-05-17_01 X-Patchwork-Delegate: kuba@kernel.org Allow to use hardware offload for outbound ipsec crypto mode if security association (SA) is set for a given skb. Signed-off-by: Bharat Bhushan --- .../ethernet/marvell/octeontx2/nic/cn10k_ipsec.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c index 41c200ee940b..6506b9893a33 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c @@ -777,9 +777,24 @@ static void cn10k_ipsec_del_state(struct xfrm_state *x) mutex_unlock(&pf->ipsec.lock); } +static bool cn10k_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *x) +{ + if (x->props.family == AF_INET) { + /* Offload with IPv4 options is not supported yet */ + if (ip_hdr(skb)->ihl > 5) + return false; + } else { + /* Offload with IPv6 extension headers is not support yet */ + if (ipv6_ext_hdr(ipv6_hdr(skb)->nexthdr)) + return false; + } + return true; +} + static const struct xfrmdev_ops cn10k_ipsec_xfrmdev_ops = { .xdo_dev_state_add = cn10k_ipsec_add_state, .xdo_dev_state_delete = cn10k_ipsec_del_state, + .xdo_dev_offload_ok = cn10k_ipsec_offload_ok, }; static void cn10k_ipsec_sa_wq_handler(struct work_struct *work)