From patchwork Wed Feb 5 18:20:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13961662 X-Patchwork-Delegate: kuba@kernel.org 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 6180713D897; Wed, 5 Feb 2025 18:20: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=1738779658; cv=none; b=L0P+oT+Izra/YNnXMM9jPzQsq/Rxr8mewt+g3sOHpjh58ywWpnhgJ5Pfq94dXYcVMBlyY5woDN/Cs7o+eLBry2mllOaPsN/HqeK3Sw0kEDN1X0Ufk9gKo4wVaoU60u4ZrmEmDDmikWFmPJpyUIRn2KK1x+6W3xpQj0w6meRtIAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738779658; c=relaxed/simple; bh=r597A/mrJflwwdNJJ4+diLkn7fbJg1NeWa572JQU1lw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WUXezYm28VIRNSv5VIXofbfvOVqDjaS6CCY1AHSZmUuKTm+KT8eYtFO2lFqgez478T+LcAQ7oprSUOyy8UHLFh0caI0TP6oECtQnMy7Ixqy3RckYsT44ZUoZ8frottP8qVMnH1kFm+NjCIOqr3rMAdCyuMdrTNuD40JjhVhRNeE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MYfe2IX4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MYfe2IX4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22B24C4CED1; Wed, 5 Feb 2025 18:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738779657; bh=r597A/mrJflwwdNJJ4+diLkn7fbJg1NeWa572JQU1lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MYfe2IX4HHbHPFfeTLqPwyEVtvpFDLtQ00dxIz1HjgifTX5I+ow4/9aoj5Q7bwSGw mc+2+jPV2QpDJtcj6EPEFG4kTsO1y2HN5YfDVQ7ZdVuk3umAK0mpzO7VhPz1fVGnwl UVG+SW389mHoZR649iKJxBV0xu2WinFdAIVeSj+EJeKtsANxOr2l0Vfsqqt670ttpK f2OE6CNM6O/JsY9XrN6k/Ja0YWNwG7Lu1oNMZe4ITunBeFS77VdjchkrLXqSEOadJ7 eAuQ829nfbzkHAZu2M3RdiHZL5yoFzXOfDPrQfKsvy9P2/f1hYird3LIvLqhavDz+h pYaCG+Vj3IFDQ== From: Leon Romanovsky To: Steffen Klassert Cc: Leon Romanovsky , Andrew Lunn , Ayush Sawal , Bharat Bhushan , Eric Dumazet , Geetha sowjanya , hariprasad , Herbert Xu , intel-wired-lan@lists.osuosl.org, Jakub Kicinski , Jay Vosburgh , Jonathan Corbet , linux-doc@vger.kernel.org, linux-rdma@vger.kernel.org, Louis Peens , netdev@vger.kernel.org, oss-drivers@corigine.com, Paolo Abeni , Potnuri Bharat Teja , Przemek Kitszel , Saeed Mahameed , Subbaraya Sundeep , Sunil Goutham , Tariq Toukan , Tony Nguyen , Ilia Lin Subject: [PATCH ipsec-next 3/5] xfrm: rely on XFRM offload Date: Wed, 5 Feb 2025 20:20:22 +0200 Message-ID: <3de0445fa7bf53af388bb8d05faf60e3deb81dc2.1738778580.git.leon@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Leon Romanovsky After change of initialization of x->type_offload pointer to be valid only for offloaded SAs. There is no need to rely both on x->type_offload and x->xso.type to determine if SA is offloaded or not. Signed-off-by: Leon Romanovsky --- net/xfrm/xfrm_device.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c index e01a7f5a4c75..c3c170953bf9 100644 --- a/net/xfrm/xfrm_device.c +++ b/net/xfrm/xfrm_device.c @@ -420,13 +420,11 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x) struct xfrm_dst *xdst = (struct xfrm_dst *)dst; struct net_device *dev = x->xso.dev; - if (!x->type_offload || - (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED && x->encap)) + if (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED) return false; if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET || - ((!dev || (dev == xfrm_dst_path(dst)->dev)) && - !xdst->child->xfrm)) { + ((dev == xfrm_dst_path(dst)->dev) && !xdst->child->xfrm)) { mtu = xfrm_state_mtu(x, xdst->child_mtu_cached); if (skb->len <= mtu) goto ok; @@ -438,8 +436,8 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x) return false; ok: - if (dev && dev->xfrmdev_ops && dev->xfrmdev_ops->xdo_dev_offload_ok) - return x->xso.dev->xfrmdev_ops->xdo_dev_offload_ok(skb, x); + if (dev->xfrmdev_ops->xdo_dev_offload_ok) + return dev->xfrmdev_ops->xdo_dev_offload_ok(skb, x); return true; }