Re: [PATCH bpf-next v4 3/7] net: remove duplicate reuseport_lookup functions

From: Lorenz Bauer
Date: Mon Jul 03 2023 - 05:46:21 EST


On Wed, Jun 28, 2023 at 7:33 PM Kuniyuki Iwashima <kuniyu@xxxxxxxxxx> wrote:

> > +
> > +inet6_ehashfn_t inet6_ehashfn;
> > +
> > +INDIRECT_CALLABLE_DECLARE(inet6_ehashfn_t udp6_ehashfn);
>
> We need not define udp6_ehashfn() here as inet6_hashtables.c has
> the definition.
>
> Only inet6_ehashfn() is needed because sk_ehashfn() uses it.

Without udp6_ehashfn we get the following error, as reported by Simon
against v1:

net/ipv4/udp.c:410:5: error: no previous prototype for ‘udp_ehashfn’
[-Werror=missing-prototypes]
410 | u32 udp_ehashfn(const struct net *net, const __be32 laddr,
const __u16 lport,
| ^~~~~~~~~~~

> > +inet_ehashfn_t inet_ehashfn;
> > +
> > +INDIRECT_CALLABLE_DECLARE(inet_ehashfn_t udp_ehashfn);
> > +
>
> We don't need inet_ehashfn() and udp_ehashfn() declarations here.

Without inet_ehashfn I get:

./include/net/inet_hashtables.h: In function ‘__inet_lookup_skb’:
./include/net/inet_hashtables.h:501:42: error: ‘inet_ehashfn’
undeclared (first use in this function); did you mean ‘inet_bhashfn’?
501 | refcounted, inet_ehashfn);

Same problem with the warning as above.

I think this needs to stay the way it is.