linux/net/ipv6/exthdrs_offload.c
Richard Gobert f2e3fc2158 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>
2024-01-05 08:11:49 -08:00

49 lines
954 B
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* IPV6 GSO/GRO offload support
* Linux INET6 implementation
*
* IPV6 Extension Header GSO/GRO support
*/
#include <net/protocol.h>
#include "ip6_offload.h"
static const struct net_offload rthdr_offload = {
.flags = INET6_PROTO_GSO_EXTHDR,
};
static const struct net_offload dstopt_offload = {
.flags = INET6_PROTO_GSO_EXTHDR,
};
static const struct net_offload hbh_offload = {
.flags = INET6_PROTO_GSO_EXTHDR,
};
int __init ipv6_exthdrs_offload_init(void)
{
int ret;
ret = inet6_add_offload(&rthdr_offload, IPPROTO_ROUTING);
if (ret)
goto out;
ret = inet6_add_offload(&dstopt_offload, IPPROTO_DSTOPTS);
if (ret)
goto out_rt;
ret = inet6_add_offload(&hbh_offload, IPPROTO_HOPOPTS);
if (ret)
goto out_dstopts;
out:
return ret;
out_dstopts:
inet6_del_offload(&dstopt_offload, IPPROTO_DSTOPTS);
out_rt:
inet6_del_offload(&rthdr_offload, IPPROTO_ROUTING);
goto out;
}