[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220114045114.pre4iyblsdntkmiy@apollo.legion>
Date: Fri, 14 Jan 2022 10:21:14 +0530
From: Kumar Kartikeya Dwivedi <memxor@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: bpf@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, netdev@...r.kernel.org,
netfilter-devel@...r.kernel.org, Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
Maxim Mikityanskiy <maximmi@...dia.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
Florian Westphal <fw@...len.de>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH bpf-next v7 07/10] selftests/bpf: Add test for unstable
CT lookup API
On Fri, Jan 14, 2022 at 04:05:57AM IST, Alexei Starovoitov wrote:
> On Tue, Jan 11, 2022 at 11:34:25PM +0530, Kumar Kartikeya Dwivedi wrote:
> > +
> > +#define nf_ct_test(func, ctx) \
> > + ({ \
> > + struct bpf_ct_opts opts_def = { .l4proto = IPPROTO_TCP, \
> > + .netns_id = -1 }; \
> > + struct bpf_sock_tuple bpf_tuple; \
> > + struct nf_conn *ct; \
> > + __builtin_memset(&bpf_tuple, 0, sizeof(bpf_tuple.ipv4)); \
> > + ct = func(ctx, NULL, 0, &opts_def, sizeof(opts_def)); \
>
> Have you tried converting the macro to static always_inline
> and passing func as a pointer to a function?
> The first argument 'ctx' is different, but if you prototype it
> in this static inline as (*fn)(void *ctx)
> and type case it later in nf_skb/xdp_ct_test() that should still work?
Good idea, I'll switch it to this in the next version.
--
Kartikeya
Powered by blists - more mailing lists