Re: [PATCH v4] net: fix checksum with unaligned buffer

2022-07-07 Thread Stanisław Kardach
On Thu, Jun 30, 2022 at 6:32 PM Morten Brørup wrote: > > > From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] > > Sent: Tuesday, 28 June 2022 08.28 > > > > On 2022-06-27 22:21, Morten Brørup wrote: > > >> From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] > > >> Sent: Monday, 27 June 2022 1

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-07-01 Thread Morten Brørup
> From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Friday, 1 July 2022 19.05 > > On Fri, 1 Jul 2022 18:50:34 +0200 > Morten Brørup wrote: > > > But I guess it is something else. > > > > Anyway, this function has ugly alignment problems (also before the > patch), and has gone t

Re: [PATCH v4] net: fix checksum with unaligned buffer

2022-07-01 Thread Stephen Hemminger
On Fri, 1 Jul 2022 18:50:34 +0200 Morten Brørup wrote: > But I guess it is something else. > > Anyway, this function has ugly alignment problems (also before the patch), > and has gone through a couple of iterations to silence warnings from the > compiler. These warnings should have been addre

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-07-01 Thread Morten Brørup
> From: Emil Berg [mailto:emil.b...@ericsson.com] > Sent: Friday, 1 July 2022 06.11 > > > From: Stephen Hemminger > > Sent: den 30 juni 2022 19:46 > > > > On Thu, 23 Jun 2022 14:39:00 +0200 > > Morten Brørup wrote: > > > > > + /* if buffer is unaligned, keeping it byte order independent */ > > >

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-07-01 Thread Emil Berg
> -Original Message- > From: Stephen Hemminger > Sent: den 30 juni 2022 19:46 > To: Morten Brørup > Cc: Emil Berg ; bruce.richard...@intel.com; > dev@dpdk.org; sta...@dpdk.org; bugzi...@dpdk.org; hof...@lysator.liu.se; > olivier.m...@6wind.com > Subject:

Re: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-30 Thread Stephen Hemminger
On Thu, 23 Jun 2022 14:39:00 +0200 Morten Brørup wrote: > + /* if buffer is unaligned, keeping it byte order independent */ > + if (unlikely(unaligned)) { > + uint16_t first = 0; > + if (unlikely(len == 0)) > + return 0; Why is length == 0 uniq

Re: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-30 Thread Stephen Hemminger
On Thu, 23 Jun 2022 14:39:00 +0200 Morten Brørup wrote: > diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h > index b502481670..738d643da0 100644 > --- a/lib/net/rte_ip.h > +++ b/lib/net/rte_ip.h > @@ -3,6 +3,7 @@ > * The Regents of the University of California. > * Copyright(c) 2010-2014

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-30 Thread Morten Brørup
> From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] > Sent: Tuesday, 28 June 2022 08.28 > > On 2022-06-27 22:21, Morten Brørup wrote: > >> From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] > >> Sent: Monday, 27 June 2022 19.23 > >> > >> On 2022-06-27 15:22, Morten Brørup wrote: > From

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-29 Thread Emil Berg
..@networkplumber.org; sta...@dpdk.org; bugzi...@dpdk.org; > > olivier.m...@6wind.com > > Subject: Re: [PATCH v4] net: fix checksum with unaligned buffer > > > > On 2022-06-23 14:51, Morten Brørup wrote: > > >> From: Morten Brørup [mailto:m...@smartsharesystems.com] &

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-29 Thread Emil Berg
> -Original Message- > From: Mattias Rönnblom > Sent: den 27 juni 2022 14:28 > To: Morten Brørup ; Emil Berg > ; bruce.richard...@intel.com; dev@dpdk.org > Cc: step...@networkplumber.org; sta...@dpdk.org; bugzi...@dpdk.org; > olivier.m...@6wind.com > Subject:

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-29 Thread Emil Berg
> -Original Message- > From: Morten Brørup > Sent: den 23 juni 2022 14:51 > To: Emil Berg ; bruce.richard...@intel.com; > dev@dpdk.org > Cc: step...@networkplumber.org; sta...@dpdk.org; bugzi...@dpdk.org; > hof...@lysator.liu.se; olivier.m...@6wind.com > Subject:

Re: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-27 Thread Mattias Rönnblom
On 2022-06-27 22:21, Morten Brørup wrote: From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] Sent: Monday, 27 June 2022 19.23 On 2022-06-27 15:22, Morten Brørup wrote: From: Emil Berg [mailto:emil.b...@ericsson.com] Sent: Monday, 27 June 2022 14.51 From: Emil Berg Sent: den 27 juni 2022 14

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-27 Thread Morten Brørup
> From: Mattias Rönnblom [mailto:hof...@lysator.liu.se] > Sent: Monday, 27 June 2022 19.23 > > On 2022-06-27 15:22, Morten Brørup wrote: > >> From: Emil Berg [mailto:emil.b...@ericsson.com] > >> Sent: Monday, 27 June 2022 14.51 > >> > >>> From: Emil Berg > >>> Sent: den 27 juni 2022 14:46 > >>> >

Re: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-27 Thread Mattias Rönnblom
On 2022-06-27 15:22, Morten Brørup wrote: From: Emil Berg [mailto:emil.b...@ericsson.com] Sent: Monday, 27 June 2022 14.51 From: Emil Berg Sent: den 27 juni 2022 14:46 From: Mattias Rönnblom Sent: den 27 juni 2022 14:28 On 2022-06-23 14:51, Morten Brørup wrote: From: Morten Brørup [mailto:

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-27 Thread Morten Brørup
> From: Emil Berg [mailto:emil.b...@ericsson.com] > Sent: Monday, 27 June 2022 14.51 > > > From: Emil Berg > > Sent: den 27 juni 2022 14:46 > > > > > From: Mattias Rönnblom > > > Sent: den 27 juni 2022 14:28 > > > > > > On 2022-06-23 14:51, Morten Brørup wrote: > > > >> From: Morten Brørup [mailt

Re: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-27 Thread Mattias Rönnblom
On 2022-06-23 14:51, Morten Brørup wrote: From: Morten Brørup [mailto:m...@smartsharesystems.com] Sent: Thursday, 23 June 2022 14.39 With this patch, the checksum can be calculated on an unaligned buffer. I.e. the buf parameter is no longer required to be 16 bit aligned. The checksum is still c

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-27 Thread Morten Brørup
> From: Emil Berg [mailto:emil.b...@ericsson.com] > Sent: Monday, 27 June 2022 09.57 > > > From: Morten Brørup > > Sent: den 23 juni 2022 14:51 > > > > > From: Morten Brørup [mailto:m...@smartsharesystems.com] > > > Sent: Thursday, 23 June 2022 14.39 > > > > > > With this patch, the checksum can

RE: [PATCH v4] net: fix checksum with unaligned buffer

2022-06-23 Thread Morten Brørup
> From: Morten Brørup [mailto:m...@smartsharesystems.com] > Sent: Thursday, 23 June 2022 14.39 > > With this patch, the checksum can be calculated on an unaligned buffer. > I.e. the buf parameter is no longer required to be 16 bit aligned. > > The checksum is still calculated using a 16 bit align

[PATCH v4] net: fix checksum with unaligned buffer

2022-06-23 Thread Morten Brørup
With this patch, the checksum can be calculated on an unaligned buffer. I.e. the buf parameter is no longer required to be 16 bit aligned. The checksum is still calculated using a 16 bit aligned pointer, so the compiler can auto-vectorize the function's inner loop. When the buffer is unaligned, t