Re: [PATCH bpf-next v6 4/8] net: remove duplicate reuseport_lookup functions

From: Martin KaFai Lau
Date: Tue Jul 25 2023 - 17:20:11 EST


On 7/24/23 5:53 PM, Martin KaFai Lau wrote:
On 7/20/23 8:30 AM, Lorenz Bauer wrote:
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 032ddab48f8f..f89320b6fee3 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -48,12 +48,21 @@ struct sock *__inet6_lookup_established(struct net *net,
                      const u16 hnum, const int dif,
                      const int sdif);
+typedef u32 (inet6_ehashfn_t)(const struct net *net,
+                   const struct in6_addr *laddr, const u16 lport,
+                   const struct in6_addr *faddr, const __be16 fport);
+
+inet6_ehashfn_t inet6_ehashfn;
+
+INDIRECT_CALLABLE_DECLARE(inet6_ehashfn_t udp6_ehashfn);
+

[ ... ]

diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index b7c56867314e..3616225c89ef 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -39,6 +39,7 @@ u32 inet6_ehashfn(const struct net *net,
      return __inet6_ehashfn(lhash, lport, fhash, fport,
                     inet6_ehash_secret + net_hash_mix(net));
  }
+EXPORT_SYMBOL_GPL(inet6_ehashfn);
  /*
   * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -111,18 +112,22 @@ static inline int compute_score(struct sock *sk, struct net *net,
      return score;
  }
+INDIRECT_CALLABLE_DECLARE(inet6_ehashfn_t udp6_ehashfn);

The same INDIRECT_CALLABLE_DECLARE is also added to inet6_hashtables.h. Is this one still needed here?

The same goes for the inet_hashtables.c.

Please follow up if one of the INDIRECT_CALLABLE_DECLARE makes sense to remove.

I have applied the set after fixing up patch 7 and 8.