Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1840259lqo; Sun, 12 May 2024 22:48:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzCBb5dO9TldHc6DQf/7aTrh/NOApKA3LtYK3cSQ97jzT3wL2aNL8t7r6kP7LpFs300xzlkCsmV98qtUHn7Y+ifp1i3iZBfyqjTsg6QQ== X-Google-Smtp-Source: AGHT+IG7xMKx9HFC2gUJ5EhZrgoNOu82njb093IVxTNi7H90zTLNPeCikx1bXZtAU18wcyWl/zM9 X-Received: by 2002:a05:622a:394:b0:43a:fbe3:c2ea with SMTP id d75a77b69052e-43dec297879mr120308691cf.21.1715579317540; Sun, 12 May 2024 22:48:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715579317; cv=pass; d=google.com; s=arc-20160816; b=dkYV5m5ZBmBfDIckIgdlpxa5KFflrTenzHEiJVkl65rPLBqf9DmuylCw5fawT5JpRs HTnSUUTWskEvMu435IN5p9MiMoox+Id4Vs2XyefDROLKn6zi5qIkPwhhv04hv/AUrCxY ZmuXEugiJBZkJT41FxqyfGhYstnvlSOjhOcOMV8HL0ujNx6pR9wnDq3ck5e98veMoJ3g U7qotyG2lgr7QuqKb8Lvv3jnvtRdWwWmx1S/zaj8JuIMGrDPfvGGGin4BGspV+G50trH qi9iCBpy9KPTvOIfPe035G6HZmvD198VxOECQ05Fy95Yhl5pnxly62dq/KOEq4qSTD+8 6Log== 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=p+/gdlGfDKH/5/E5NftrHXp9fUeRUy+AaPfiQbo+csA=; fh=gRl1jDjFaQrE5E7yP3UhNvXh3favzrfGz7jimd0QwiM=; b=OGEyRNNOimVAaI0MNFzxNg1+Bg+x1b8UTAgjvApvCR8Oxnr9kTaRZZDUDr4k9AtS0c 3AAOoomylTYhiwQXfyLvA3Vrc0Et+KgCqecpz8/NJ6Pow9LNAV1OnSq+xI57Eo36Yryw 629eFWqA4qIc727SHYmtiT1qkWA7hCRUKA6LgnxQ0nfpPOzFK4pwn2MAdriloe7ASiWH hrwBmpcv3eA/8ZVy35Ztszd2bkwtvGNA/qhov8vqoWBeewWYGa7Jw7C7paKG1734swrq JC7AP0jNGAXcbTzU0widCnWXi92AwROLEfd+/Ui2eTmxyTr0FV4Mt7QRjRQSoMw+prsk pykw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Fq8hGNnf; 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-177176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177176-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43e200c707asi1751291cf.492.2024.05.12.22.48.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 22:48:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Fq8hGNnf; 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-177176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177176-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 05A421C20EFF for ; Mon, 13 May 2024 05:48:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6FCC147C7D; Mon, 13 May 2024 05:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Fq8hGNnf" 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 BAA1F1465B5; Mon, 13 May 2024 05:47:06 +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=1715579228; cv=none; b=oJd2zqiPAI7qw2pO2koeuk1Zav/3RpkygBGBsCNL2dJ52ejH1YTABBBCc6uJ8WSWTo/tMnQeie0jKjQu56lW66Alca7KzI01vmLiO+K/4pZqCqR+Qv+DbrGk8bpf+mMvIDpFow5wPT9u50P0U3RGVh1bA8JN36vyTXE78MbyKP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715579228; c=relaxed/simple; bh=guVd29ZqGYtK1XsQ55gSS+//1SW6fgJwX72cm4L6Ej8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OiifEtdXNEKM5itqsVETxy8j1PpuA63QlzO7dSUAgnGjq4bQyNQ3OEOqctGb22gp/wVeEYsYcKuBIzgqPwgduVtqqGj5BFb+ClDGf/P2igRUiiqhdWCncV/GlUBDkKN4zss8PoM8bkYi/wTQAkZmQxgjySZmCKnINd3gPCmurvU= 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=Fq8hGNnf; 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 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 44CMhlWc005185; Sun, 12 May 2024 22:46:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=p+/gdlGfDKH/5/E5NftrHXp9fUeRUy+AaPfiQbo+csA=; b=Fq8 hGNnf/gUz/ImYjFoOR7ibK62R5bK4msMgaHUdS4A7nXYfNaezmN4WlZhlHi5ON6w RuCPUvdDbsuYidX2A6GMON6etC1tkfYemtEDK++SOiiK5mRGyYmUMZ+fD48HAivl c3QEQgSO3XBzVJl0kx0LayUnGn0Q9suLbPTNl+tJTMuN4GLhGIC71xajoOwDC/UB JyGyZtnRpVrz2qO3iPkWYqTs9o87cM0eI4XZsEDmX44ehxt/TngiTRDnV+4zbagw 81q2nleqY+wi2vdUPfHZPou2j766eGI7eUXolidfQJtlMPRRh8ffzgwx9wtqgfdu wPez3RSA0MQeTjB/PMg== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3y261jucwn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 12 May 2024 22:46:58 -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; Sun, 12 May 2024 22:46:57 -0700 Received: from bharat-OptiPlex-3070.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; Sun, 12 May 2024 22:46:54 -0700 From: Bharat Bhushan To: , , , , , , , , , CC: Bharat Bhushan Subject: [PATCH 7/8] cn10k-ipsec: Allow inline ipsec offload for skb with SA Date: Mon, 13 May 2024 11:16:22 +0530 Message-ID: <20240513054623.270366-8-bbhushan2@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513054623.270366-1-bbhushan2@marvell.com> References: <20240513054623.270366-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: BG83G_tCGF6bLa2d0rnuzxd4KyvFfz0W X-Proofpoint-ORIG-GUID: BG83G_tCGF6bLa2d0rnuzxd4KyvFfz0W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-13_04,2024-05-10_02,2023-05-22_02 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 98a200879b3b..8fbe39458e22 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c @@ -768,9 +768,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