Thread (18 messages) 18 messages, 2 authors, 2022-01-14

Re: [PATCH bpf-next v7 07/10] selftests/bpf: Add test for unstable CT lookup API

From: Alexei Starovoitov <hidden>
Date: 2022-01-13 22:36:02
Also in: bpf, netfilter-devel

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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help