[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b0ecec17f9c1409ba476cf370730278a@AcuMS.aculab.com>
Date: Mon, 5 Jun 2023 13:58:10 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Alexander Duyck' <alexander.duyck@...il.com>, Eric Dumazet
<edumazet@...gle.com>
CC: Alexander Duyck <alexanderduyck@...a.com>, "David S . Miller"
<davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "Xin
Long" <lucien.xin@...il.com>, David Ahern <dsahern@...nel.org>,
"eric.dumazet@...il.com" <eric.dumazet@...il.com>
Subject: RE: [PATCH net] tcp: gso: really support BIG TCP
From: Alexander Duyck
> Sent: 02 June 2023 16:39
...
> I wouldn't even bother with any of these changes.
>
> > @@ -78,7 +78,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
> > if (!pskb_may_pull(skb, thlen))
> > goto out;
> >
> > - oldlen = (u16)~skb->len;
> > + oldlen = skb->len;
> > __skb_pull(skb, thlen);
> >
> > mss = skb_shinfo(skb)->gso_size;
>
> As I stated before I would just drop the "(u16)". We are expanding the
> oldlen to a u32, but don't have to worry about it overflowing because
> skb->len should always be greater than or equal to our segmented
> length. So the most it could reach is ~0 if skb->len == segmented
> length.
Have you missed the ~ ?
The (u16) makes it equivalent to skb->len ^ 0xffff.
Otherwise all the high bit are set and any arithmetic will generate
a carry and the wrong value.
FWIW this C version of csum_fold() (eg from arch/arc)
generates better code than the existing versions on pretty
much every architecture.
return (~sum - ror32(sum, 16)) >> 16;
The main exception will be sparc (which has a carry flag but
no rotate) and arm with its barrel shifter.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists