Hi Harry,

> -----Original Message-----
> From: Van Haaren, Harry <[email protected]>
> Sent: Wednesday, May 25, 2022 8:00 PM
> To: Amber, Kumar <[email protected]>; [email protected]
> Cc: [email protected]; [email protected]; [email protected];
> Ferriter, Cian <[email protected]>; Stokes, Ian <[email protected]>;
> [email protected]; [email protected]
> Subject: RE: [PATCH v7 2/4] mfex_avx512: Calculate miniflow_bits at compile
> time.
> 
> > -----Original Message-----
> > From: Amber, Kumar <[email protected]>
> > Sent: Friday, May 6, 2022 6:23 AM
> > To: [email protected]
> > Cc: [email protected]; [email protected]; [email protected];
> > Ferriter, Cian <[email protected]>; Stokes, Ian
> > <[email protected]>; [email protected]; [email protected];
> > Van Haaren, Harry <[email protected]>; Amber, Kumar
> > <[email protected]>
> > Subject: [PATCH v7 2/4] mfex_avx512: Calculate miniflow_bits at compile
> time.
> >
> > The patch removes magic numbers from miniflow_bits and calculates the
> > bits at compile time. This also makes it easier to handle any ABI
> > changes.
> >
> > Signed-off-by: Kumar Amber <[email protected]>
> > ---
> >  lib/dpif-netdev-extract-avx512.c | 21 +++++++++++++++++----
> >  1 file changed, 17 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/dpif-netdev-extract-avx512.c
> > b/lib/dpif-netdev-extract-avx512.c
> > index 6ae15a4db..e77bb3214 100644
> > --- a/lib/dpif-netdev-extract-avx512.c
> > +++ b/lib/dpif-netdev-extract-avx512.c
> > @@ -256,6 +256,19 @@
> _mm512_maskz_permutexvar_epi8_wrap(__mmask64
> > kmask, __m512i idx, __m512i a)
> >  #define PKT_MIN_ETH_IPv4_TCP      (PKT_OFFSET_L4_IPv4 +
> TCP_HEADER_LEN)
> >  #define PKT_MIN_ETH_VLAN_IPv4_TCP (PKT_OFFSET_L4_VLAN_IPv4 +
> > TCP_HEADER_LEN)
> >
> > +/* MF bits. */
> > +#define MF_BIT(field) (MAP_1 << ((offsetof(struct flow, field) / 8) %      
> >    \
> > +                       MAP_T_BITS))
> 
> Had a look to see if "flow.c" had any re-usable macro defines for this, but
> didn't spot any as the macros in flow.c all operate on struct flowmap's or
> other more complex structs, not a simple u64.
> 
> Given the result of this calculation is checked by autovalidation, we can have
> good confidence in the correctness of the arithmetic here.
> 
> By calculating the miniflow bits at compile-time like this, the SIMD optimized
> implementation becomes a lot more robust to "Miniflow ABI" breakages, as
> the implementation will re-adjust bits as required at compile time (instead of
> requiring manual patching).
> 
> Nice work.
> 

Thanks, Harry, for the reviews .

Regards
Amber
> <snip>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to