Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: gso: add HBH extension header offload support

This commit adds net_offload to IPv6 Hop-by-Hop extension headers (as it
is done for routing and dstopts) since it is supported in GSO and GRO.
This allows to remove specific HBH conditionals in GSO and GRO when
pulling and parsing an incoming packet.

Signed-off-by: Richard Gobert <richardbgobert@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/d4f8825a-1d55-4b12-9d67-a254dbbfa6ae@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Richard Gobert and committed by
Jakub Kicinski
f2e3fc21 cb420106

+22 -14
+11
net/ipv6/exthdrs_offload.c
··· 16 16 .flags = INET6_PROTO_GSO_EXTHDR, 17 17 }; 18 18 19 + static const struct net_offload hbh_offload = { 20 + .flags = INET6_PROTO_GSO_EXTHDR, 21 + }; 22 + 19 23 int __init ipv6_exthdrs_offload_init(void) 20 24 { 21 25 int ret; ··· 32 28 if (ret) 33 29 goto out_rt; 34 30 31 + ret = inet6_add_offload(&hbh_offload, IPPROTO_HOPOPTS); 32 + if (ret) 33 + goto out_dstopts; 34 + 35 35 out: 36 36 return ret; 37 + 38 + out_dstopts: 39 + inet6_del_offload(&dstopt_offload, IPPROTO_DSTOPTS); 37 40 38 41 out_rt: 39 42 inet6_del_offload(&rthdr_offload, IPPROTO_ROUTING);
+11 -14
net/ipv6/ip6_offload.c
··· 45 45 struct ipv6_opt_hdr *opth; 46 46 int len; 47 47 48 - if (proto != NEXTHDR_HOP) { 49 - ops = rcu_dereference(inet6_offloads[proto]); 48 + ops = rcu_dereference(inet6_offloads[proto]); 50 49 51 - if (unlikely(!ops)) 52 - break; 50 + if (unlikely(!ops)) 51 + break; 53 52 54 - if (!(ops->flags & INET6_PROTO_GSO_EXTHDR)) 55 - break; 56 - } 53 + if (!(ops->flags & INET6_PROTO_GSO_EXTHDR)) 54 + break; 57 55 58 56 if (unlikely(!pskb_may_pull(skb, 8))) 59 57 break; ··· 169 171 170 172 proto = iph->nexthdr; 171 173 for (;;) { 172 - if (proto != NEXTHDR_HOP) { 173 - *opps = rcu_dereference(inet6_offloads[proto]); 174 - if (unlikely(!(*opps))) 175 - break; 176 - if (!((*opps)->flags & INET6_PROTO_GSO_EXTHDR)) 177 - break; 178 - } 174 + *opps = rcu_dereference(inet6_offloads[proto]); 175 + if (unlikely(!(*opps))) 176 + break; 177 + if (!((*opps)->flags & INET6_PROTO_GSO_EXTHDR)) 178 + break; 179 + 179 180 opth = (void *)opth + optlen; 180 181 optlen = ipv6_optlen(opth); 181 182 len += optlen;