diff mbox series

[01/12] skbuff: Unconstantify struct net argument in flowdis functions

Message ID 20240731172332.683815-2-tom@herbertland.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series flow_dissector: Dissect UDP encapsulation protocols | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 91 this patch: 91
netdev/build_tools success Errors and warnings before: 10 this patch: 10
netdev/cc_maintainers warning 5 maintainers not CCed: almasrymina@google.com rkannoth@marvell.com pabeni@redhat.com ast@fiberby.net dcaratti@redhat.com
netdev/build_clang success Errors and warnings before: 153 this patch: 153
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5110 this patch: 5110
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 64 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 62 this patch: 62
netdev/source_inline success Was 0 now: 0

Commit Message

Tom Herbert July 31, 2024, 5:23 p.m. UTC
We want __skb_flow_dissect to be able to call functions that
take a non-constant struct net argument (UDP socket lookup
functions for instance). Change the net argument of flow dissector
functions to not be const

Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 include/linux/skbuff.h    | 10 +++++-----
 net/core/flow_dissector.c |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Willem de Bruijn Aug. 1, 2024, 1:13 p.m. UTC | #1
Tom Herbert wrote:
> We want __skb_flow_dissect to be able to call functions that
> take a non-constant struct net argument (UDP socket lookup
> functions for instance). Change the net argument of flow dissector
> functions to not be const
> 
> Signed-off-by: Tom Herbert <tom@herbertland.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>
Eric Dumazet Aug. 2, 2024, 1:33 p.m. UTC | #2
On Wed, Jul 31, 2024 at 7:23 PM Tom Herbert <tom@herbertland.com> wrote:
>
> We want __skb_flow_dissect to be able to call functions that
> take a non-constant struct net argument (UDP socket lookup
> functions for instance). Change the net argument of flow dissector
> functions to not be const
>
> Signed-off-by: Tom Herbert <tom@herbertland.com>


Hmm... let me send a patch series doing the opposite, ie add const
qualifiers to lookup functions.
Tom Herbert Aug. 15, 2024, 6:50 p.m. UTC | #3
On Fri, Aug 2, 2024 at 6:34 AM Eric Dumazet <edumazet@google.com> wrote:
>
> On Wed, Jul 31, 2024 at 7:23 PM Tom Herbert <tom@herbertland.com> wrote:
> >
> > We want __skb_flow_dissect to be able to call functions that
> > take a non-constant struct net argument (UDP socket lookup
> > functions for instance). Change the net argument of flow dissector
> > functions to not be const
> >
> > Signed-off-by: Tom Herbert <tom@herbertland.com>
>
>
> Hmm... let me send a patch series doing the opposite, ie add const
> qualifiers to lookup functions.

I had done that originally, but there were a lot of callers so it was
pretty messy.

Tom
Tom Herbert Aug. 15, 2024, 7:42 p.m. UTC | #4
On Thu, Aug 15, 2024 at 11:50 AM Tom Herbert <tom@herbertland.com> wrote:
>
> On Fri, Aug 2, 2024 at 6:34 AM Eric Dumazet <edumazet@google.com> wrote:
> >
> > On Wed, Jul 31, 2024 at 7:23 PM Tom Herbert <tom@herbertland.com> wrote:
> > >
> > > We want __skb_flow_dissect to be able to call functions that
> > > take a non-constant struct net argument (UDP socket lookup
> > > functions for instance). Change the net argument of flow dissector
> > > functions to not be const
> > >
> > > Signed-off-by: Tom Herbert <tom@herbertland.com>
> >
> >
> > Hmm... let me send a patch series doing the opposite, ie add const
> > qualifiers to lookup functions.
>
> I had done that originally, but there were a lot of callers so it was
> pretty messy.

Oops, I see this was already applied. Thanks!

Tom

>
> Tom
diff mbox series

Patch

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 29c3ea5b6e93..a0b5687fa49c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1504,14 +1504,14 @@  __skb_set_sw_hash(struct sk_buff *skb, __u32 hash, bool is_l4)
 	__skb_set_hash(skb, hash, true, is_l4);
 }
 
-u32 __skb_get_hash_symmetric_net(const struct net *net, const struct sk_buff *skb);
+u32 __skb_get_hash_symmetric_net(struct net *net, const struct sk_buff *skb);
 
 static inline u32 __skb_get_hash_symmetric(const struct sk_buff *skb)
 {
 	return __skb_get_hash_symmetric_net(NULL, skb);
 }
 
-void __skb_get_hash_net(const struct net *net, struct sk_buff *skb);
+void __skb_get_hash_net(struct net *net, struct sk_buff *skb);
 u32 skb_get_poff(const struct sk_buff *skb);
 u32 __skb_get_poff(const struct sk_buff *skb, const void *data,
 		   const struct flow_keys_basic *keys, int hlen);
@@ -1532,7 +1532,7 @@  struct bpf_flow_dissector;
 u32 bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx,
 		     __be16 proto, int nhoff, int hlen, unsigned int flags);
 
-bool __skb_flow_dissect(const struct net *net,
+bool __skb_flow_dissect(struct net *net,
 			const struct sk_buff *skb,
 			struct flow_dissector *flow_dissector,
 			void *target_container, const void *data,
@@ -1556,7 +1556,7 @@  static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb,
 }
 
 static inline bool
-skb_flow_dissect_flow_keys_basic(const struct net *net,
+skb_flow_dissect_flow_keys_basic(struct net *net,
 				 const struct sk_buff *skb,
 				 struct flow_keys_basic *flow,
 				 const void *data, __be16 proto,
@@ -1590,7 +1590,7 @@  void skb_flow_dissect_hash(const struct sk_buff *skb,
 			   struct flow_dissector *flow_dissector,
 			   void *target_container);
 
-static inline __u32 skb_get_hash_net(const struct net *net, struct sk_buff *skb)
+static inline __u32 skb_get_hash_net(struct net *net, struct sk_buff *skb)
 {
 	if (!skb->l4_hash && !skb->sw_hash)
 		__skb_get_hash_net(net, skb);
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 0e638a37aa09..e034e502ab49 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -1045,7 +1045,7 @@  static bool is_pppoe_ses_hdr_valid(const struct pppoe_hdr *hdr)
  *
  * Caller must take care of zeroing target container memory.
  */
-bool __skb_flow_dissect(const struct net *net,
+bool __skb_flow_dissect(struct net *net,
 			const struct sk_buff *skb,
 			struct flow_dissector *flow_dissector,
 			void *target_container, const void *data,
@@ -1854,7 +1854,7 @@  EXPORT_SYMBOL(make_flow_keys_digest);
 
 static struct flow_dissector flow_keys_dissector_symmetric __read_mostly;
 
-u32 __skb_get_hash_symmetric_net(const struct net *net, const struct sk_buff *skb)
+u32 __skb_get_hash_symmetric_net(struct net *net, const struct sk_buff *skb)
 {
 	struct flow_keys keys;
 
@@ -1878,7 +1878,7 @@  EXPORT_SYMBOL_GPL(__skb_get_hash_symmetric_net);
  * on success, zero indicates no valid hash.  Also, sets l4_hash in skb
  * if hash is a canonical 4-tuple hash over transport ports.
  */
-void __skb_get_hash_net(const struct net *net, struct sk_buff *skb)
+void __skb_get_hash_net(struct net *net, struct sk_buff *skb)
 {
 	struct flow_keys keys;
 	u32 hash;