Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2661048lqb; Tue, 28 May 2024 06:56:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWZ9flLq8mC11vdfnpSKxTAK35dQe5uPbthzFFAlUjeLNGne4sqH6EXiKGRg8aUOY+8kNFJdpDjCP7e8DbZX/XRPd4Qge5uqCq0hLM3g== X-Google-Smtp-Source: AGHT+IGqf6ahzDCCvCikZf8XDvJSJmfjM9T9bv5JAbNLAIP+9KP0G0VzBEFMuakws0rdNZ3mGTx2 X-Received: by 2002:a17:90b:3709:b0:2bd:eb83:47ed with SMTP id 98e67ed59e1d1-2bf5f51aee5mr13591519a91.36.1716904608226; Tue, 28 May 2024 06:56:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716904608; cv=pass; d=google.com; s=arc-20160816; b=Kyvk7gqTSMwerbNBDMFJi8q1rkYcjkSzGgF7mPCD+/wxUQZLu4/m83Dc7EUSIQjH0c 8NmuwU7iRMWuZD2LXqak+lzh3XFsq2pHsu3PK//yNhOb6Akq1wwHuw/6T3Nphvz57vmT 9JpJBxbsGsMWx/Q+bs4KXEp3phJdqwGt6ZO69nsAyHgiC2AETuVO/YplXmA5B6DarO8j zR+1InDvRr+ghbbM5PctCdQgPNahaHdUJ6aKSOJdnR07lG3BRK4wnV1IbPlBRJ8NQklO QNV3zZX9dwOk83soNG918TEOYvGFizIM083+botwTGV2OTP5S8l0wiYSeFLBMoRzLZyl todw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Bj3KpeKpRC3Q4IYBK+Z2I1J1fSwe5MH2/ACvbBo9KEU=; fh=j7UdCSvSbUmOxvkqY4yQZi9wqG46MeQhtGJgH3+ZkeE=; b=RJuxo0FJGx2xTMUz+l9KauLCYCcibcqQKW6CzBeImIz96b5e6T6Yy/RUpyMzwugTcW 9X4UUWIjBVcC4KcIsoTWX2WNkYsTSbxZc952wYWtqVYw22hpaq4VbYg7q+stQNXD2diZ IJzo1nVo4D+BhoOUbdsR7Grg8V3V0vO/xusLDnDknctYWUSHqhwtRFgOu3YpggqC6tSh XjJAZbefHGg2ZvPp46dpl2Y4vYUtmVQROs5gUBppCu+by1V8p1EJJgwB0ruM3c7r2lKQ X7NYd3rOMche1JIiD8j1rbZMOE8zQ64uUPjyFbjd7MCbCeuNtcb/HXUh0g0oFOSFwEtm w0ug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="QFDfc/0W"; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-192475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf94655741si5734386a91.91.2024.05.28.06.56.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 06:56:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192475-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=@marvell.com header.s=pfpt0220 header.b="QFDfc/0W"; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-192475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com 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 0D696285A28 for ; Tue, 28 May 2024 13:56:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4DCD216F8F8; Tue, 28 May 2024 13:55:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="QFDfc/0W" 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 17FBD16E87B; Tue, 28 May 2024 13:55:06 +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=1716904507; cv=none; b=rBvbBCm8k83ojJajG/09TTtjYLZZ8HuKpdwH01jdGfhXdL8gb4b4PhYE/oDXNWEV+AgAoQJnM5jBJh7yOziJO/mPUPU0RhjYJLhTBljta31YV/V6yRvkSxEn9m7vb2Cq9fhkCj2G5YjGEDMqtYfDSYI1/ZvT8Zp277hYZPD9g0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716904507; c=relaxed/simple; bh=7AXP4aII1REOPComeL7e91AHwVdHokmFcNhXL+OX/mU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dg2mQDNBGe/Z0ghr92C9Gs+MsZ2Vk5xVL1puiadbPlRonEIauFjI1zJwZ1sGQoHMlu/QV9h+cOt2jCwWDjgd4NtCrY0aWSPFwG/xH/dxKLxMb26sqqB1ZhZVnBtayD+gWXS2WirkourEJ76sfNiJ6bccHAUm0LKN64yw/JtV+YQ= 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=QFDfc/0W; 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 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 44SAbsFb001366; Tue, 28 May 2024 06:54:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=B j3KpeKpRC3Q4IYBK+Z2I1J1fSwe5MH2/ACvbBo9KEU=; b=QFDfc/0WZgGVY2f9h YLyAFDtGCaDS2CE0fBZM6NpMQ2eBOmlJ88lRtfiJE4a/GmKyIBL5TgRhuoLpygTG 6Sq2Vxab8BoKLx0QdhL3xjDIQPqWQLnaOPoJyA2M6z1q6FqKvdPJri5Mx7Qlbczn 6h0Rdf15PQkqo4yu6tOllJPXwi0O3noLyfpjwIG20jp9u33qZDEnx55zF0Eaj4F0 NzYvshLZRxyqXLVggroQeR44mviR0WPUgigjRP4Daf21IM4lSFdvNp2Bbz3Qzc/p urE1KE36oTId4qomPOy5yhzzYB42TQOhfhNj7BPcv+luUVNBv5Fe1j/yI0UweEcY /HBkQ== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3yddnv8pcx-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:54:59 -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; Tue, 28 May 2024 06:54:36 -0700 Received: from bharat-OptiPlex-3070.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; Tue, 28 May 2024 06:54:31 -0700 From: Bharat Bhushan To: , , , , , , , , , , , , CC: Subject: [net-next,v3 7/8] cn10k-ipsec: Allow inline ipsec offload for skb with SA Date: Tue, 28 May 2024 19:23:48 +0530 Message-ID: <20240528135349.932669-8-bbhushan2@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240528135349.932669-1-bbhushan2@marvell.com> References: <20240528135349.932669-1-bbhushan2@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: UWB9CMROENTcuYXoKpLoaE30nImPFmQ0 X-Proofpoint-ORIG-GUID: UWB9CMROENTcuYXoKpLoaE30nImPFmQ0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-28_09,2024-05-28_01,2024-05-17_01 Allow to use hardware offload for outbound inline ipsec 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 1974fda2e0d3..81f1258cd996 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c @@ -784,9 +784,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, }; int cn10k_ipsec_ethtool_init(struct net_device *netdev, bool enable) -- 2.34.1