diff options
author | David S. Miller | 2021-07-29 12:18:51 +0100 |
---|---|---|
committer | David S. Miller | 2021-07-29 12:18:51 +0100 |
commit | 8cb79af5c63ff2dbcab048085302256dd7e8208d (patch) | |
tree | 3fd1eae06a0bb5286063d8aed35c11a51db5c531 /include/net | |
parent | 883d71a55e968371d1ff151249732466b5581f58 (diff) | |
parent | d504fff0d14a0fd683e9ec1f736c6e1f894667ae (diff) |
Merge branch 'skb-gro-optimize'
Paolo Abeni says:
====================
sk_buff: optimize GRO for the common case
This is a trimmed down revision of "sk_buff: optimize layout for GRO",
specifically dropping the changes to the sk_buff layout[1].
This series tries to accomplish 2 goals:
- optimize the GRO stage for the most common scenario, avoiding a bunch
of conditional and some more code
- let owned skbs entering the GRO engine, allowing backpressure in the
veth GRO forward path.
A new sk_buff flag (!!!) is introduced and maintained for GRO's sake.
Such field uses an existing hole, so there is no change to the sk_buff
size.
[1] two main reasons:
- move skb->inner_ field requires some extra care, as some in kernel
users access and the fields regardless of skb->encapsulation.
- extending secmark size clash with ct and nft uAPIs
address the all above is possible, I think, but for sure not in a single
series.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/dst.h | 2 | ||||
-rw-r--r-- | include/net/sock.h | 9 |
2 files changed, 11 insertions, 0 deletions
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; diff --git a/include/net/sock.h b/include/net/sock.h index f23cb259b0e2..ff1be7e7e90b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2249,6 +2249,15 @@ static inline __must_check bool skb_set_owner_sk_safe(struct sk_buff *skb, struc return false; } +static inline void skb_prepare_for_gro(struct sk_buff *skb) +{ + if (skb->destructor != sock_wfree) { + skb_orphan(skb); + return; + } + skb->slow_gro = 1; +} + void sk_reset_timer(struct sock *sk, struct timer_list *timer, unsigned long expires); |