Message ID | 20220310054703.849899-7-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | tcp: BIG TCP implementation | expand |
On Wed, 2022-03-09 at 21:46 -0800, Eric Dumazet wrote: > From: Eric Dumazet <edumazet@google.com> > > Following patch will add GRO_IPV6_MAX_SIZE, allowing gro to build > BIG TCP ipv6 packets (bigger than 64K). > This looks like it belongs in the next patch, not this one. This patch is adding the HBH header. > This patch changes ipv6_gro_complete() to insert a HBH/jumbo header > so that resulting packet can go through IPv6/TCP stacks. > > Signed-off-by: Eric Dumazet <edumazet@google.com> > --- > net/ipv6/ip6_offload.c | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > > diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c > index a6a6c1539c28d242ef8c35fcd5ce900512ce912d..d12dba2dd5354dbb79bb80df4038dec2544cddeb 100644 > --- a/net/ipv6/ip6_offload.c > +++ b/net/ipv6/ip6_offload.c > @@ -342,15 +342,43 @@ static struct sk_buff *ip4ip6_gro_receive(struct list_head *head, > INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff) > { > const struct net_offload *ops; > - struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + nhoff); > + struct ipv6hdr *iph; > int err = -ENOSYS; > + u32 payload_len; > > if (skb->encapsulation) { > skb_set_inner_protocol(skb, cpu_to_be16(ETH_P_IPV6)); > skb_set_inner_network_header(skb, nhoff); > } > > - iph->payload_len = htons(skb->len - nhoff - sizeof(*iph)); > + payload_len = skb->len - nhoff - sizeof(*iph); > + if (unlikely(payload_len > IPV6_MAXPLEN)) { > + struct hop_jumbo_hdr *hop_jumbo; > + int hoplen = sizeof(*hop_jumbo); > + > + /* Move network header left */ > + memmove(skb_mac_header(skb) - hoplen, skb_mac_header(skb), > + skb->transport_header - skb->mac_header); > + skb->data -= hoplen; > + skb->len += hoplen; > + skb->mac_header -= hoplen; > + skb->network_header -= hoplen; > + iph = (struct ipv6hdr *)(skb->data + nhoff); > + hop_jumbo = (struct hop_jumbo_hdr *)(iph + 1); > + > + /* Build hop-by-hop options */ > + hop_jumbo->nexthdr = iph->nexthdr; > + hop_jumbo->hdrlen = 0; > + hop_jumbo->tlv_type = IPV6_TLV_JUMBO; > + hop_jumbo->tlv_len = 4; > + hop_jumbo->jumbo_payload_len = htonl(payload_len + hoplen); > + > + iph->nexthdr = NEXTHDR_HOP; > + iph->payload_len = 0; > + } else { > + iph = (struct ipv6hdr *)(skb->data + nhoff); > + iph->payload_len = htons(payload_len); > + } > > nhoff += sizeof(*iph) + ipv6_exthdrs_len(iph, &ops); > if (WARN_ON(!ops || !ops->callbacks.gro_complete))
On Fri, Mar 11, 2022 at 8:24 AM Alexander H Duyck <alexander.duyck@gmail.com> wrote: > > On Wed, 2022-03-09 at 21:46 -0800, Eric Dumazet wrote: > > From: Eric Dumazet <edumazet@google.com> > > > > Following patch will add GRO_IPV6_MAX_SIZE, allowing gro to build > > BIG TCP ipv6 packets (bigger than 64K). > > > > This looks like it belongs in the next patch, not this one. This patch > is adding the HBH header. What do you mean by "it belongs" ? Do you want me to squash the patches, or remove the first sentence ? I am confused. > > > This patch changes ipv6_gro_complete() to insert a HBH/jumbo header > > so that resulting packet can go through IPv6/TCP stacks. > >
> -----Original Message----- > From: Eric Dumazet <edumazet@google.com> > Sent: Tuesday, March 15, 2022 9:02 AM > To: Alexander H Duyck <alexander.duyck@gmail.com> > Cc: Eric Dumazet <eric.dumazet@gmail.com>; David S . Miller > <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; netdev > <netdev@vger.kernel.org>; Alexander Duyck <alexanderduyck@fb.com>; > Coco Li <lixiaoyan@google.com> > Subject: Re: [PATCH v4 net-next 06/14] ipv6/gro: insert temporary > HBH/jumbo header > > On Fri, Mar 11, 2022 at 8:24 AM Alexander H Duyck > <alexander.duyck@gmail.com> wrote: > > > > On Wed, 2022-03-09 at 21:46 -0800, Eric Dumazet wrote: > > > From: Eric Dumazet <edumazet@google.com> > > > > > > Following patch will add GRO_IPV6_MAX_SIZE, allowing gro to build > > > BIG TCP ipv6 packets (bigger than 64K). > > > > > > > This looks like it belongs in the next patch, not this one. This patch > > is adding the HBH header. > > What do you mean by "it belongs" ? > > Do you want me to squash the patches, or remove the first sentence ? > > I am confused. It is about the sentence. Your next patch essentially has that as the title and actually does add GRO_IPV6_MAX_SIZE. I wasn't sure if you reordered the patches or split them. However as I recall I didn't see anything in this patch that added GRO_IPV6_MAX_SIZE.
On Tue, Mar 15, 2022 at 9:04 AM Alexander Duyck <alexanderduyck@fb.com> wrote: > > > > > -----Original Message----- > > From: Eric Dumazet <edumazet@google.com> > > Sent: Tuesday, March 15, 2022 9:02 AM > > To: Alexander H Duyck <alexander.duyck@gmail.com> > > Cc: Eric Dumazet <eric.dumazet@gmail.com>; David S . Miller > > <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; netdev > > <netdev@vger.kernel.org>; Alexander Duyck <alexanderduyck@fb.com>; > > Coco Li <lixiaoyan@google.com> > > Subject: Re: [PATCH v4 net-next 06/14] ipv6/gro: insert temporary > > HBH/jumbo header > > > > On Fri, Mar 11, 2022 at 8:24 AM Alexander H Duyck > > <alexander.duyck@gmail.com> wrote: > > > > > > On Wed, 2022-03-09 at 21:46 -0800, Eric Dumazet wrote: > > > > From: Eric Dumazet <edumazet@google.com> > > > > > > > > Following patch will add GRO_IPV6_MAX_SIZE, allowing gro to build > > > > BIG TCP ipv6 packets (bigger than 64K). > > > > > > > > > > This looks like it belongs in the next patch, not this one. This patch > > > is adding the HBH header. > > > > What do you mean by "it belongs" ? > > > > Do you want me to squash the patches, or remove the first sentence ? > > > > I am confused. > > It is about the sentence. Your next patch essentially has that as the title and actually does add GRO_IPV6_MAX_SIZE. I wasn't sure if you reordered the patches or split them. However as I recall I didn't see anything in this patch that added GRO_IPV6_MAX_SIZE. I used "Following patch will", meaning the patch following _this_ one, sorry if this is confusing. I would have used "This patch is ..." if I wanted to describe what this patch is doing. Patches were not reordered, and have two different authors.
> -----Original Message----- > From: Eric Dumazet <edumazet@google.com> > Sent: Tuesday, March 15, 2022 9:11 AM > To: Alexander Duyck <alexanderduyck@fb.com> > Cc: Alexander H Duyck <alexander.duyck@gmail.com>; Eric Dumazet > <eric.dumazet@gmail.com>; David S . Miller <davem@davemloft.net>; > Jakub Kicinski <kuba@kernel.org>; netdev <netdev@vger.kernel.org>; Coco > Li <lixiaoyan@google.com> > Subject: Re: [PATCH v4 net-next 06/14] ipv6/gro: insert temporary > HBH/jumbo header > > On Tue, Mar 15, 2022 at 9:04 AM Alexander Duyck > <alexanderduyck@fb.com> wrote: > > > > > > > > > -----Original Message----- > > > From: Eric Dumazet <edumazet@google.com> > > > Sent: Tuesday, March 15, 2022 9:02 AM > > > To: Alexander H Duyck <alexander.duyck@gmail.com> > > > Cc: Eric Dumazet <eric.dumazet@gmail.com>; David S . Miller > > > <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; netdev > > > <netdev@vger.kernel.org>; Alexander Duyck > <alexanderduyck@fb.com>; > > > Coco Li <lixiaoyan@google.com> > > > Subject: Re: [PATCH v4 net-next 06/14] ipv6/gro: insert temporary > > > HBH/jumbo header > > > > > > On Fri, Mar 11, 2022 at 8:24 AM Alexander H Duyck > > > <alexander.duyck@gmail.com> wrote: > > > > > > > > On Wed, 2022-03-09 at 21:46 -0800, Eric Dumazet wrote: > > > > > From: Eric Dumazet <edumazet@google.com> > > > > > > > > > > Following patch will add GRO_IPV6_MAX_SIZE, allowing gro to > > > > > build BIG TCP ipv6 packets (bigger than 64K). > > > > > > > > > > > > > This looks like it belongs in the next patch, not this one. This > > > > patch is adding the HBH header. > > > > > > What do you mean by "it belongs" ? > > > > > > Do you want me to squash the patches, or remove the first sentence ? > > > > > > I am confused. > > > > It is about the sentence. Your next patch essentially has that as the title and > actually does add GRO_IPV6_MAX_SIZE. I wasn't sure if you reordered the > patches or split them. However as I recall I didn't see anything in this patch > that added GRO_IPV6_MAX_SIZE. > > > I used "Following patch will", meaning the patch following _this_ one, sorry if > this is confusing. > > I would have used "This patch is ..." if I wanted to describe what this patch is > doing. > > Patches were not reordered, and have two different authors. Yeah, the problem is I read "Following patch" as in the "The patch below". I would probably drop the line since it doesn't add much to the patch itself.
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index a6a6c1539c28d242ef8c35fcd5ce900512ce912d..d12dba2dd5354dbb79bb80df4038dec2544cddeb 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -342,15 +342,43 @@ static struct sk_buff *ip4ip6_gro_receive(struct list_head *head, INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff) { const struct net_offload *ops; - struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + nhoff); + struct ipv6hdr *iph; int err = -ENOSYS; + u32 payload_len; if (skb->encapsulation) { skb_set_inner_protocol(skb, cpu_to_be16(ETH_P_IPV6)); skb_set_inner_network_header(skb, nhoff); } - iph->payload_len = htons(skb->len - nhoff - sizeof(*iph)); + payload_len = skb->len - nhoff - sizeof(*iph); + if (unlikely(payload_len > IPV6_MAXPLEN)) { + struct hop_jumbo_hdr *hop_jumbo; + int hoplen = sizeof(*hop_jumbo); + + /* Move network header left */ + memmove(skb_mac_header(skb) - hoplen, skb_mac_header(skb), + skb->transport_header - skb->mac_header); + skb->data -= hoplen; + skb->len += hoplen; + skb->mac_header -= hoplen; + skb->network_header -= hoplen; + iph = (struct ipv6hdr *)(skb->data + nhoff); + hop_jumbo = (struct hop_jumbo_hdr *)(iph + 1); + + /* Build hop-by-hop options */ + hop_jumbo->nexthdr = iph->nexthdr; + hop_jumbo->hdrlen = 0; + hop_jumbo->tlv_type = IPV6_TLV_JUMBO; + hop_jumbo->tlv_len = 4; + hop_jumbo->jumbo_payload_len = htonl(payload_len + hoplen); + + iph->nexthdr = NEXTHDR_HOP; + iph->payload_len = 0; + } else { + iph = (struct ipv6hdr *)(skb->data + nhoff); + iph->payload_len = htons(payload_len); + } nhoff += sizeof(*iph) + ipv6_exthdrs_len(iph, &ops); if (WARN_ON(!ops || !ops->callbacks.gro_complete))