mirror of
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10.git
synced 2026-09-09 00:07:04 +08:00
net: gro: remove is_ipv6 from napi_gro_cb
JIRA: https://issues.redhat.com/browse/RHEL-123213 Upstream Status: linux.git commit 25c550464acd40803d63868dfa4a42506df48b88 Author: Richard Gobert <richardbgobert@gmail.com> Date: Tue Sep 23 10:59:04 2025 +0200 net: gro: remove is_ipv6 from napi_gro_cb Remove is_ipv6 from napi_gro_cb and use sk->sk_family instead. This frees up space for another ip_fixedid bit that will be added in the next commit. udp_sock_create always creates either a AF_INET or a AF_INET6 socket, so using sk->sk_family is reliable. In IPv6-FOU, cfg->ipv6_v6only is always enabled. Signed-off-by: Richard Gobert <richardbgobert@gmail.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20250923085908.4687-2-richardbgobert@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Antoine Tenart <atenart@redhat.com>
This commit is contained in:
@@ -71,9 +71,6 @@ struct napi_gro_cb {
|
||||
/* Free the skb? */
|
||||
u8 free:2;
|
||||
|
||||
/* Used in foo-over-udp, set in udp[46]_gro_receive */
|
||||
u8 is_ipv6:1;
|
||||
|
||||
/* Used in GRE, set in fou/gue_gro_receive */
|
||||
u8 is_fou:1;
|
||||
|
||||
|
||||
+14
-18
@@ -231,21 +231,27 @@ drop:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_offload *fou_gro_ops(const struct sock *sk,
|
||||
int proto)
|
||||
{
|
||||
const struct net_offload __rcu **offloads;
|
||||
|
||||
/* FOU doesn't allow IPv4 on IPv6 sockets. */
|
||||
offloads = sk->sk_family == AF_INET6 ? inet6_offloads : inet_offloads;
|
||||
return rcu_dereference(offloads[proto]);
|
||||
}
|
||||
|
||||
static struct sk_buff *fou_gro_receive(struct sock *sk,
|
||||
struct list_head *head,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
const struct net_offload __rcu **offloads;
|
||||
struct fou *fou = fou_from_sock(sk);
|
||||
const struct net_offload *ops;
|
||||
struct sk_buff *pp = NULL;
|
||||
u8 proto;
|
||||
|
||||
if (!fou)
|
||||
goto out;
|
||||
|
||||
proto = fou->protocol;
|
||||
|
||||
/* We can clear the encap_mark for FOU as we are essentially doing
|
||||
* one of two possible things. We are either adding an L4 tunnel
|
||||
* header to the outer L3 tunnel header, or we are simply
|
||||
@@ -257,8 +263,7 @@ static struct sk_buff *fou_gro_receive(struct sock *sk,
|
||||
/* Flag this frame as already having an outer encap header */
|
||||
NAPI_GRO_CB(skb)->is_fou = 1;
|
||||
|
||||
offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
|
||||
ops = rcu_dereference(offloads[proto]);
|
||||
ops = fou_gro_ops(sk, fou->protocol);
|
||||
if (!ops || !ops->callbacks.gro_receive)
|
||||
goto out;
|
||||
|
||||
@@ -271,10 +276,8 @@ out:
|
||||
static int fou_gro_complete(struct sock *sk, struct sk_buff *skb,
|
||||
int nhoff)
|
||||
{
|
||||
const struct net_offload __rcu **offloads;
|
||||
struct fou *fou = fou_from_sock(sk);
|
||||
const struct net_offload *ops;
|
||||
u8 proto;
|
||||
int err;
|
||||
|
||||
if (!fou) {
|
||||
@@ -282,10 +285,7 @@ static int fou_gro_complete(struct sock *sk, struct sk_buff *skb,
|
||||
goto out;
|
||||
}
|
||||
|
||||
proto = fou->protocol;
|
||||
|
||||
offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
|
||||
ops = rcu_dereference(offloads[proto]);
|
||||
ops = fou_gro_ops(sk, fou->protocol);
|
||||
if (WARN_ON(!ops || !ops->callbacks.gro_complete)) {
|
||||
err = -ENOSYS;
|
||||
goto out;
|
||||
@@ -326,7 +326,6 @@ static struct sk_buff *gue_gro_receive(struct sock *sk,
|
||||
struct list_head *head,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
const struct net_offload __rcu **offloads;
|
||||
const struct net_offload *ops;
|
||||
struct sk_buff *pp = NULL;
|
||||
struct sk_buff *p;
|
||||
@@ -453,8 +452,7 @@ next_proto:
|
||||
/* Flag this frame as already having an outer encap header */
|
||||
NAPI_GRO_CB(skb)->is_fou = 1;
|
||||
|
||||
offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
|
||||
ops = rcu_dereference(offloads[proto]);
|
||||
ops = fou_gro_ops(sk, proto);
|
||||
if (!ops || !ops->callbacks.gro_receive)
|
||||
goto out;
|
||||
|
||||
@@ -470,7 +468,6 @@ out:
|
||||
static int gue_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)
|
||||
{
|
||||
struct guehdr *guehdr = (struct guehdr *)(skb->data + nhoff);
|
||||
const struct net_offload __rcu **offloads;
|
||||
const struct net_offload *ops;
|
||||
unsigned int guehlen = 0;
|
||||
u8 proto;
|
||||
@@ -497,8 +494,7 @@ static int gue_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)
|
||||
return err;
|
||||
}
|
||||
|
||||
offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
|
||||
ops = rcu_dereference(offloads[proto]);
|
||||
ops = fou_gro_ops(sk, proto);
|
||||
if (WARN_ON(!ops || !ops->callbacks.gro_complete))
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -730,8 +730,6 @@ struct sk_buff *udp4_gro_receive(struct list_head *head, struct sk_buff *skb)
|
||||
skb_gro_checksum_try_convert(skb, IPPROTO_UDP,
|
||||
inet_gro_compute_pseudo);
|
||||
skip:
|
||||
NAPI_GRO_CB(skb)->is_ipv6 = 0;
|
||||
|
||||
if (static_branch_unlikely(&udp_encap_needed_key))
|
||||
sk = udp4_gro_lookup_skb(skb, uh->source, uh->dest);
|
||||
|
||||
|
||||
@@ -149,8 +149,6 @@ struct sk_buff *udp6_gro_receive(struct list_head *head, struct sk_buff *skb)
|
||||
ip6_gro_compute_pseudo);
|
||||
|
||||
skip:
|
||||
NAPI_GRO_CB(skb)->is_ipv6 = 1;
|
||||
|
||||
if (static_branch_unlikely(&udpv6_encap_needed_key))
|
||||
sk = udp6_gro_lookup_skb(skb, uh->source, uh->dest);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user