netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>
Cc: David Ahern <dsahern@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	 Tom Herbert <tom@herbertland.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	 Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 1/5] inet: constify inet_sk_bound_dev_eq() net parameter
Date: Fri,  2 Aug 2024 13:40:25 +0000	[thread overview]
Message-ID: <20240802134029.3748005-2-edumazet@google.com> (raw)
In-Reply-To: <20240802134029.3748005-1-edumazet@google.com>

inet_sk_bound_dev_eq() and its callers do not modify the net structure.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/inet6_hashtables.h | 2 +-
 include/net/inet_hashtables.h  | 2 +-
 include/net/inet_sock.h        | 3 ++-
 net/ipv4/inet_hashtables.c     | 2 +-
 net/ipv6/inet6_hashtables.c    | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 533a7337865a4308c073b30b69dae4dcf7e6b264..591cbf5e4d5f86375598b9622f616ac662b0fc4e 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -175,7 +175,7 @@ struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
 
 int inet6_hash(struct sock *sk);
 
-static inline bool inet6_match(struct net *net, const struct sock *sk,
+static inline bool inet6_match(const struct net *net, const struct sock *sk,
 			       const struct in6_addr *saddr,
 			       const struct in6_addr *daddr,
 			       const __portpair ports,
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 7f1b384587437d06834bde554edd8df983fd64a4..1cc8b7ca20a10c1b0c8a6b9a029e5f8b4a1e846d 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -351,7 +351,7 @@ static inline struct sock *inet_lookup_listener(struct net *net,
 				   ((__force __u64)(__be32)(__saddr)))
 #endif /* __BIG_ENDIAN */
 
-static inline bool inet_match(struct net *net, const struct sock *sk,
+static inline bool inet_match(const struct net *net, const struct sock *sk,
 			      const __addrpair cookie, const __portpair ports,
 			      int dif, int sdif)
 {
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index f9ddd47dc4f8d989e1c966bf363ed846c0911639..394c3b66065e20d34594d6e2a2010c55bb457810 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -150,7 +150,8 @@ static inline bool inet_bound_dev_eq(bool l3mdev_accept, int bound_dev_if,
 	return bound_dev_if == dif || bound_dev_if == sdif;
 }
 
-static inline bool inet_sk_bound_dev_eq(struct net *net, int bound_dev_if,
+static inline bool inet_sk_bound_dev_eq(const struct net *net,
+					int bound_dev_if,
 					int dif, int sdif)
 {
 #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 48d0d494185b19a5e7282ffb6b33051604c28c9f..3d913dbd028404b1a1bf4dc3f988133e4a1d52ec 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -310,7 +310,7 @@ inet_lhash2_bucket_sk(struct inet_hashinfo *h, struct sock *sk)
 	return inet_lhash2_bucket(h, hash);
 }
 
-static inline int compute_score(struct sock *sk, struct net *net,
+static inline int compute_score(struct sock *sk, const struct net *net,
 				const unsigned short hnum, const __be32 daddr,
 				const int dif, const int sdif)
 {
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index 6db71bb1cd300a9a3d91a8d771db4521978bc5d6..f29f094e57a4a5da8b238246d437328569a165d3 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -89,7 +89,7 @@ struct sock *__inet6_lookup_established(struct net *net,
 }
 EXPORT_SYMBOL(__inet6_lookup_established);
 
-static inline int compute_score(struct sock *sk, struct net *net,
+static inline int compute_score(struct sock *sk, const struct net *net,
 				const unsigned short hnum,
 				const struct in6_addr *daddr,
 				const int dif, const int sdif)
-- 
2.46.0.rc2.264.g509ed76dc8-goog


  reply	other threads:[~2024-08-02 13:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 13:40 [PATCH net-next 0/5] net: constify 'struct net' parameter of socket lookups Eric Dumazet
2024-08-02 13:40 ` Eric Dumazet [this message]
2024-08-05 13:52   ` [PATCH net-next 1/5] inet: constify inet_sk_bound_dev_eq() net parameter Simon Horman
2024-08-02 13:40 ` [PATCH net-next 2/5] inet: constify 'struct net' parameter of various lookup helpers Eric Dumazet
2024-08-05 13:52   ` Simon Horman
2024-08-02 13:40 ` [PATCH net-next 3/5] udp: constify 'struct net' parameter of socket lookups Eric Dumazet
2024-08-05 13:53   ` Simon Horman
2024-08-02 13:40 ` [PATCH net-next 4/5] inet6: constify 'struct net' parameter of various lookup helpers Eric Dumazet
2024-08-05 13:54   ` Simon Horman
2024-08-02 13:40 ` [PATCH net-next 5/5] ipv6: udp: constify 'struct net' parameter of socket lookups Eric Dumazet
2024-08-05 13:54   ` Simon Horman
2024-08-05 23:54 ` [PATCH net-next 0/5] net: " patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240802134029.3748005-2-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tom@herbertland.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).