diff mbox series

[net-next,2/6] sk_buff: track dst status in slow_gro

Message ID a6d684d37ca7598dc89b1ff886f9b049393f0d99.1627405778.git.pabeni@redhat.com (mailing list archive)
State Accepted
Commit 8a886b142bd03d36612747e9aefdf0282c8b02dd
Delegated to: Netdev Maintainers
Headers show
Series sk_buff: optimize GRO for the common case | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 10 maintainers not CCed: jonathan.lemon@gmail.com wenxu@ucloud.cn cong.wang@bytedance.com ilias.apalodimas@linaro.org willemb@google.com elver@google.com memxor@gmail.com alobakin@pm.me nogikh@google.com haokexin@gmail.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 6054 this patch: 6054
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 6114 this patch: 6114
netdev/header_inline success Link

Commit Message

Paolo Abeni July 28, 2021, 4:24 p.m. UTC
Similar to the previous patch, but covering the dst field:
the slow_gro flag is additionally set when a dst is attached
to the skb

RFC -> v1:
 - use the existing flag instead of adding a new one

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 include/linux/skbuff.h | 2 ++
 include/net/dst.h      | 2 ++
 2 files changed, 4 insertions(+)

Comments

Jakub Kicinski July 30, 2021, 11:08 a.m. UTC | #1
On Wed, 28 Jul 2021 18:24:00 +0200 Paolo Abeni wrote:
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 3ff18300d210..b1e5bbfcc926 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -992,6 +992,7 @@ static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
>   */
>  static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
>  {
> +	skb->slow_gro |= !!dst;
>  	skb->_skb_refdst = (unsigned long)dst;
>  }
>  
> @@ -1008,6 +1009,7 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
>  static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
>  {
>  	WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
> +	skb->slow_gro = !!dst;

why is this one = and not |= ?

>  	skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
>  }
Paolo Abeni July 30, 2021, 1:08 p.m. UTC | #2
On Fri, 2021-07-30 at 04:08 -0700, Jakub Kicinski wrote:
> On Wed, 28 Jul 2021 18:24:00 +0200 Paolo Abeni wrote:
> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > index 3ff18300d210..b1e5bbfcc926 100644
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> > @@ -992,6 +992,7 @@ static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
> >   */
> >  static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
> >  {
> > +	skb->slow_gro |= !!dst;
> >  	skb->_skb_refdst = (unsigned long)dst;
> >  }
> >  
> > @@ -1008,6 +1009,7 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
> >  static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
> >  {
> >  	WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
> > +	skb->slow_gro = !!dst;
> 
> why is this one = and not |= ?

Mostly because I'm dumb. Sabrina Dubroca noted that already. I'll send
a follow-up ASAP.

Thanks!

Paolo
diff mbox series

Patch

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 3ff18300d210..b1e5bbfcc926 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -992,6 +992,7 @@  static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
  */
 static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
 {
+	skb->slow_gro |= !!dst;
 	skb->_skb_refdst = (unsigned long)dst;
 }
 
@@ -1008,6 +1009,7 @@  static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
 static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
 {
 	WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
+	skb->slow_gro = !!dst;
 	skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
 }
 
diff --git a/include/net/dst.h b/include/net/dst.h
index 75b1e734e9c2..a057319aabef 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -277,6 +277,7 @@  static inline void skb_dst_drop(struct sk_buff *skb)
 
 static inline void __skb_dst_copy(struct sk_buff *nskb, unsigned long refdst)
 {
+	nskb->slow_gro |= !!refdst;
 	nskb->_skb_refdst = refdst;
 	if (!(nskb->_skb_refdst & SKB_DST_NOREF))
 		dst_clone(skb_dst(nskb));
@@ -316,6 +317,7 @@  static inline bool skb_dst_force(struct sk_buff *skb)
 			dst = NULL;
 
 		skb->_skb_refdst = (unsigned long)dst;
+		skb->slow_gro |= !!dst;
 	}
 
 	return skb->_skb_refdst != 0UL;