Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5669785rdb; Wed, 13 Dec 2023 16:12:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9I3tQW0/BWLjvkYYmskXuy3u6zvApibWdG63yfZpyKIPhxoSbhnCHaRV2sNoF58y3UwAy X-Received: by 2002:a17:902:da91:b0:1d0:bcb2:b905 with SMTP id j17-20020a170902da9100b001d0bcb2b905mr5333618plx.121.1702512755961; Wed, 13 Dec 2023 16:12:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702512755; cv=none; d=google.com; s=arc-20160816; b=0GAavjWBhd2k01MYdRu7KMtpKJ/V/HMB70r/dkOqxTUDkl4LrtiAGt92+RLObPVPsa PaDlOUkJ18NcHX1ZazXrAebYtvpgwmv2pQClTlDslB4i/KGDfyohx0/QuXOKsZBi11xa 9ZXnqYadY1kdttekujOxlnvBBxDZI0GRNBVFiyYJaa7/7qHd4NEX2Ruwc7yAqVdZEzEt FA+1/tKCuNtLecykA53k8zsksDw5pj9cbjxrBPu2CSqjcz9eOU1T7q96xaBrzzs3UFuX 7Dfi+PH9gogm5pr7PuIxrGOhx/LMf/W0M95jzXz3awgJ493I3vZaxbekGR955NpN5NyH eDAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=EbVFFpEobNWdQHXshAr/NMnhj/JmFbUe7fxCcbtimqw=; fh=HnGbwm2krInnA2b1kJD0ftTfjVlhhyFlc4sfTERIsI8=; b=PjICMRTR/TNnkrH41gy9MkJxCEUMcbSeDpPWBGZhKvrSL1UWfWrCLvQ2nHgYi+95zq 57b4W6EMKB2uPMa/LT+lh02E9lcfpP6NMyGCvV4P5S3RSMSBEQ/EWGQpco0Iu8xFFKC+ PjPLE1KwxTM1cCwmXbh/h1ZCUEJKTg2yD3b5apn5K048tV5U0IBPL5f+2e2Y1h60Lxzm avmy+aLp5eV+NHwELMyYSD/afej7zokwkSZpqI/o7ZwNrYBBgMx2HHKB9j0VP1upBPdb IGGrHbjF+bYBo3PqwMHfMPHdcMcrrkIf71UuG09n+8Y7Ie/K/H7VVPS69YzjhLdj4msc an6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=cA0RNA2Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id c12-20020a170903234c00b001cfcf1faaa6si10626023plh.206.2023.12.13.16.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 16:12:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=cA0RNA2Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 2DE8380236D9; Wed, 13 Dec 2023 16:12:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234098AbjLNALp (ORCPT + 99 others); Wed, 13 Dec 2023 19:11:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjLNALo (ORCPT ); Wed, 13 Dec 2023 19:11:44 -0500 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C71ECC9 for ; Wed, 13 Dec 2023 16:11:48 -0800 (PST) Message-ID: <36f7f017-ecea-4715-b352-2ce1d43c8cab@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702512152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EbVFFpEobNWdQHXshAr/NMnhj/JmFbUe7fxCcbtimqw=; b=cA0RNA2Z0fVci/KCO4mQrO1kuZeN227KjjcalKGlaFuP6Q7OtkgC84U5QIPZ62pAGEfrpn WsVCZ8w1W5GPcbsfaM8crkIGVqUqL6CHHyoHKWNPyw305OivKS/vsLartz/KVm/s2EhCzJ NwR/ksXxWS6wWuouH3Yh09btLF+oLEE= Date: Wed, 13 Dec 2023 16:02:24 -0800 MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v5 1/9] bpf: xfrm: Add bpf_xdp_get_xfrm_state() kfunc Content-Language: en-US To: Daniel Xu Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, devel@linux-ipsec.org, daniel@iogearbox.net, davem@davemloft.net, edumazet@google.com, Herbert Xu , ast@kernel.org, john.fastabend@gmail.com, kuba@kernel.org, steffen.klassert@secunet.com, pabeni@redhat.com, hawk@kernel.org, antony.antony@secunet.com, alexei.starovoitov@gmail.com, yonghong.song@linux.dev, eddyz87@gmail.com, eyal.birger@gmail.com References: X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Dec 2023 16:12:22 -0800 (PST) On 12/11/23 12:20 PM, Daniel Xu wrote: > +/* bpf_xfrm_state_opts - Options for XFRM state lookup helpers > + * > + * Members: > + * @error - Out parameter, set for any errors encountered > + * Values: > + * -EINVAL - netns_id is less than -1 > + * -EINVAL - opts__sz isn't BPF_XFRM_STATE_OPTS_SZ > + * -ENONET - No network namespace found for netns_id > + * @netns_id - Specify the network namespace for lookup > + * Values: > + * BPF_F_CURRENT_NETNS (-1) > + * Use namespace associated with ctx > + * [0, S32_MAX] > + * Network Namespace ID > + * @mark - XFRM mark to match on > + * @daddr - Destination address to match on > + * @spi - Security parameter index to match on > + * @proto - L3 protocol to match on > + * @family - L3 protocol family to match on > + */ > +struct bpf_xfrm_state_opts { > + s32 error; > + s32 netns_id; > + u32 mark; > + xfrm_address_t daddr; > + __be32 spi; > + u8 proto; > + u16 family; > +}; > + > +enum { > + BPF_XFRM_STATE_OPTS_SZ = sizeof(struct bpf_xfrm_state_opts), The bpf prog can use the bpf_core_type_size() to figure out the size also.