From patchwork Tue Mar 14 08:58:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13173925 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A7CEC6FD1C for ; Tue, 14 Mar 2023 08:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbjCNI7Y (ORCPT ); Tue, 14 Mar 2023 04:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbjCNI7T (ORCPT ); Tue, 14 Mar 2023 04:59:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 104C385B0E for ; Tue, 14 Mar 2023 01:59:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B756AB818B8 for ; Tue, 14 Mar 2023 08:59:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6E00C433EF; Tue, 14 Mar 2023 08:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678784351; bh=iocWtO/7iHieePJNhjmBhxiXwPoD/5UKvVkAR+VEVEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhaSTQElHkt/mmClvoX6eGR6unMBwduAxj3/XNZpfbK8GvS7twmGAKlf3zCgbpALT erF/U4Kt6TXKCZUnnJX6Dk863ajw0l+gxnyznfUh0mLjp0yb7j1xL0cp/E1DFDgrPF ao1Muxsza3kfzt7ayEvNeQhWgn4Eo3Tpn8OsxpEoRXFxw4Mk6vQewXehfxJHVGCfMj gnikQPNKoiVaZGHKt4DnokScyKpa4hclRCj64G5eKC5uLJv7+AYToFtOULZuJC2Fw+ SLfscsXsphTPFaQ4iwkkFAoe4Gjbbv2N6qEyLd4V4qjQEr441SZ4vTMO8aDhkm2nHk +Jf8rgGUWYtSw== From: Leon Romanovsky To: Steffen Klassert Cc: Raed Salem , "David S. Miller" , Eric Dumazet , Herbert Xu , Jakub Kicinski , netdev@vger.kernel.org, Paolo Abeni , Paul Blakey , Saeed Mahameed Subject: [PATCH xfrm-next 4/9] xfrm: add new device offload acquire flag Date: Tue, 14 Mar 2023 10:58:39 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Raed Salem During XFRM acquire flow, a default SA is created to be updated later, once acquire netlink message is handled in user space. When the relevant policy is offloaded this default SA is also offloaded to IPsec offload supporting driver, however this SA does not have context suitable for offloading in HW, nor is interesting to offload to HW, consequently needs a special driver handling apart from other offloaded SA(s). Add a special flag that marks such SA so driver can handle it correctly. Signed-off-by: Raed Salem Signed-off-by: Leon Romanovsky Acked-by: Steffen Klassert --- include/net/xfrm.h | 5 +++++ net/xfrm/xfrm_state.c | 1 + 2 files changed, 6 insertions(+) diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 3e1f70e8e424..33ee3f5936e6 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -138,6 +138,10 @@ enum { XFRM_DEV_OFFLOAD_PACKET, }; +enum { + XFRM_DEV_OFFLOAD_FLAG_ACQ = 1, +}; + struct xfrm_dev_offload { struct net_device *dev; netdevice_tracker dev_tracker; @@ -145,6 +149,7 @@ struct xfrm_dev_offload { unsigned long offload_handle; u8 dir : 2; u8 type : 2; + u8 flags : 2; }; struct xfrm_mode { diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 2ab3e09e2227..7cca0a1fa5ff 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -1272,6 +1272,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr, xso->dir = xdo->dir; xso->dev = xdo->dev; xso->real_dev = xdo->real_dev; + xso->flags = XFRM_DEV_OFFLOAD_FLAG_ACQ; netdev_tracker_alloc(xso->dev, &xso->dev_tracker, GFP_ATOMIC); error = xso->dev->xfrmdev_ops->xdo_dev_state_add(x, NULL);