mbox series

[ovs-dev,v6,00/11] MFEX Infrastructure + Optimizations

Message ID 20210706131150.45513-1-cian.ferriter@intel.com
Headers show
Series MFEX Infrastructure + Optimizations | expand

Message

Ferriter, Cian July 6, 2021, 1:11 p.m. UTC
v6 updates:
- Fix non-ssl build
v5 updates:
- reabse onto latest DPIF v14
- use Enum for mfex impls
- add pmd core id set paramter in set command
- get command modified to display the pmd thread for individual mfex functions
- resolved comments from Eelco, Ian, Flavio
- Use Atomic to get and set miniflow implementations
- removed and reduced sleep in unit tests
- fixed scalar miniflow perf degradation
v4 updates:
- rebase on to latest DPIF v13
- fix fuzzy.py script with random mac/ip
v3 updates:
- rebase on to latest DPIF v12
- add additonal AVX512 traffic profiles for tcp and vlan
- add new command line for study function to add packet count
- add unit tests for fuzzy testing and auto-validation of mfex
- add mfex option hit stats to perf-show command
v2 updates:
- rebase on to latest DPIF v11
This patchset introduces miniflow extract Infrastructure changes
which allows user to choose different type of ISA based optimized
miniflow extract variants which can be user choosen or set based on 
packets studies automatically by OVS using different commands.
The Infrastructure also provides a way to check the correctness of
different ISA optimized miniflow extract variants against the scalar
version.
This Patchset depends on the DPIF patchsets :
http://patchwork.ozlabs.org/project/openvswitch/list/?series=251534

Harry van Haaren (4):
  dpif/stats: add miniflow extract opt hits counter
  dpdk: add additional CPU ISA detection strings
  dpif-netdev/mfex: Add AVX512 based optimized miniflow extract
  dpif-netdev/mfex: add more AVX512 traffic profiles

Kumar Amber (7):
  dpif-netdev: Add command line and function pointer for miniflow
    extract
  dpif-netdev: Add auto validation function for miniflow extract
  dpif-netdev: Add study function to select the best mfex function
  docs/dpdk/bridge: add miniflow extract section.
  dpif-netdev: Add configure to enable autovalidator at build time.
  dpif-netdev: Add packet count and core id paramters for study
  test/sytem-dpdk: Add unit test for mfex autovalidator

 Documentation/topics/dpdk/bridge.rst | 140 +++++++
 NEWS                                 |  12 +-
 acinclude.m4                         |  16 +
 configure.ac                         |   1 +
 lib/automake.mk                      |   4 +
 lib/dpdk.c                           |   2 +
 lib/dpif-netdev-avx512.c             |  34 +-
 lib/dpif-netdev-extract-avx512.c     | 598 +++++++++++++++++++++++++++
 lib/dpif-netdev-extract-study.c      | 145 +++++++
 lib/dpif-netdev-perf.c               |   3 +
 lib/dpif-netdev-perf.h               |   1 +
 lib/dpif-netdev-private-extract.c    | 373 +++++++++++++++++
 lib/dpif-netdev-private-extract.h    | 179 ++++++++
 lib/dpif-netdev-private-thread.h     |   8 +
 lib/dpif-netdev-unixctl.man          |   1 +
 lib/dpif-netdev.c                    | 210 +++++++++-
 tests/automake.mk                    |   5 +
 tests/mfex_fuzzy.py                  |  32 ++
 tests/pcap/mfex_test                 | Bin 0 -> 416 bytes
 tests/pmd.at                         |   6 +-
 tests/system-dpdk.at                 |  46 +++
 21 files changed, 1803 insertions(+), 13 deletions(-)
 create mode 100644 lib/dpif-netdev-extract-avx512.c
 create mode 100644 lib/dpif-netdev-extract-study.c
 create mode 100644 lib/dpif-netdev-private-extract.c
 create mode 100644 lib/dpif-netdev-private-extract.h
 create mode 100755 tests/mfex_fuzzy.py
 create mode 100644 tests/pcap/mfex_test

Comments

Eelco Chaudron July 6, 2021, 2:34 p.m. UTC | #1
Cian,

Which patches change, so I know where to update my review? None of the commit messages show v6 changes.

//Eelco

On 6 Jul 2021, at 15:11, Cian Ferriter wrote:

> v6 updates:
> - Fix non-ssl build
> v5 updates:
> - reabse onto latest DPIF v14
> - use Enum for mfex impls
> - add pmd core id set paramter in set command
> - get command modified to display the pmd thread for individual mfex functions
> - resolved comments from Eelco, Ian, Flavio
> - Use Atomic to get and set miniflow implementations
> - removed and reduced sleep in unit tests
> - fixed scalar miniflow perf degradation
> v4 updates:
> - rebase on to latest DPIF v13
> - fix fuzzy.py script with random mac/ip
> v3 updates:
> - rebase on to latest DPIF v12
> - add additonal AVX512 traffic profiles for tcp and vlan
> - add new command line for study function to add packet count
> - add unit tests for fuzzy testing and auto-validation of mfex
> - add mfex option hit stats to perf-show command
> v2 updates:
> - rebase on to latest DPIF v11
> This patchset introduces miniflow extract Infrastructure changes
> which allows user to choose different type of ISA based optimized
> miniflow extract variants which can be user choosen or set based on
> packets studies automatically by OVS using different commands.
> The Infrastructure also provides a way to check the correctness of
> different ISA optimized miniflow extract variants against the scalar
> version.
> This Patchset depends on the DPIF patchsets :
> http://patchwork.ozlabs.org/project/openvswitch/list/?series=251534
>
> Harry van Haaren (4):
>   dpif/stats: add miniflow extract opt hits counter
>   dpdk: add additional CPU ISA detection strings
>   dpif-netdev/mfex: Add AVX512 based optimized miniflow extract
>   dpif-netdev/mfex: add more AVX512 traffic profiles
>
> Kumar Amber (7):
>   dpif-netdev: Add command line and function pointer for miniflow
>     extract
>   dpif-netdev: Add auto validation function for miniflow extract
>   dpif-netdev: Add study function to select the best mfex function
>   docs/dpdk/bridge: add miniflow extract section.
>   dpif-netdev: Add configure to enable autovalidator at build time.
>   dpif-netdev: Add packet count and core id paramters for study
>   test/sytem-dpdk: Add unit test for mfex autovalidator
>
>  Documentation/topics/dpdk/bridge.rst | 140 +++++++
>  NEWS                                 |  12 +-
>  acinclude.m4                         |  16 +
>  configure.ac                         |   1 +
>  lib/automake.mk                      |   4 +
>  lib/dpdk.c                           |   2 +
>  lib/dpif-netdev-avx512.c             |  34 +-
>  lib/dpif-netdev-extract-avx512.c     | 598 +++++++++++++++++++++++++++
>  lib/dpif-netdev-extract-study.c      | 145 +++++++
>  lib/dpif-netdev-perf.c               |   3 +
>  lib/dpif-netdev-perf.h               |   1 +
>  lib/dpif-netdev-private-extract.c    | 373 +++++++++++++++++
>  lib/dpif-netdev-private-extract.h    | 179 ++++++++
>  lib/dpif-netdev-private-thread.h     |   8 +
>  lib/dpif-netdev-unixctl.man          |   1 +
>  lib/dpif-netdev.c                    | 210 +++++++++-
>  tests/automake.mk                    |   5 +
>  tests/mfex_fuzzy.py                  |  32 ++
>  tests/pcap/mfex_test                 | Bin 0 -> 416 bytes
>  tests/pmd.at                         |   6 +-
>  tests/system-dpdk.at                 |  46 +++
>  21 files changed, 1803 insertions(+), 13 deletions(-)
>  create mode 100644 lib/dpif-netdev-extract-avx512.c
>  create mode 100644 lib/dpif-netdev-extract-study.c
>  create mode 100644 lib/dpif-netdev-private-extract.c
>  create mode 100644 lib/dpif-netdev-private-extract.h
>  create mode 100755 tests/mfex_fuzzy.py
>  create mode 100644 tests/pcap/mfex_test
>
> -- 
> 2.32.0
Kumar Amber July 6, 2021, 2:36 p.m. UTC | #2
Hi Eelco,

Only 3 lines Changed so nothing much just a build failure was addressed 😊

Regards
Amber

> -----Original Message-----
> From: Eelco Chaudron <echaudro@redhat.com>
> Sent: Tuesday, July 6, 2021 8:04 PM
> To: Ferriter, Cian <cian.ferriter@intel.com>
> Cc: ovs-dev@openvswitch.org; fbl@sysclose.org; i.maximets@ovn.org; Van
> Haaren, Harry <harry.van.haaren@intel.com>; Amber, Kumar
> <kumar.amber@intel.com>; Stokes, Ian <ian.stokes@intel.com>
> Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
> 
> Cian,
> 
> Which patches change, so I know where to update my review? None of the
> commit messages show v6 changes.
> 
> //Eelco
> 
> On 6 Jul 2021, at 15:11, Cian Ferriter wrote:
> 
> > v6 updates:
> > - Fix non-ssl build
> > v5 updates:
> > - reabse onto latest DPIF v14
> > - use Enum for mfex impls
> > - add pmd core id set paramter in set command
> > - get command modified to display the pmd thread for individual mfex
> > functions
> > - resolved comments from Eelco, Ian, Flavio
> > - Use Atomic to get and set miniflow implementations
> > - removed and reduced sleep in unit tests
> > - fixed scalar miniflow perf degradation
> > v4 updates:
> > - rebase on to latest DPIF v13
> > - fix fuzzy.py script with random mac/ip
> > v3 updates:
> > - rebase on to latest DPIF v12
> > - add additonal AVX512 traffic profiles for tcp and vlan
> > - add new command line for study function to add packet count
> > - add unit tests for fuzzy testing and auto-validation of mfex
> > - add mfex option hit stats to perf-show command
> > v2 updates:
> > - rebase on to latest DPIF v11
> > This patchset introduces miniflow extract Infrastructure changes which
> > allows user to choose different type of ISA based optimized miniflow
> > extract variants which can be user choosen or set based on packets
> > studies automatically by OVS using different commands.
> > The Infrastructure also provides a way to check the correctness of
> > different ISA optimized miniflow extract variants against the scalar
> > version.
> > This Patchset depends on the DPIF patchsets :
> > http://patchwork.ozlabs.org/project/openvswitch/list/?series=251534
> >
> > Harry van Haaren (4):
> >   dpif/stats: add miniflow extract opt hits counter
> >   dpdk: add additional CPU ISA detection strings
> >   dpif-netdev/mfex: Add AVX512 based optimized miniflow extract
> >   dpif-netdev/mfex: add more AVX512 traffic profiles
> >
> > Kumar Amber (7):
> >   dpif-netdev: Add command line and function pointer for miniflow
> >     extract
> >   dpif-netdev: Add auto validation function for miniflow extract
> >   dpif-netdev: Add study function to select the best mfex function
> >   docs/dpdk/bridge: add miniflow extract section.
> >   dpif-netdev: Add configure to enable autovalidator at build time.
> >   dpif-netdev: Add packet count and core id paramters for study
> >   test/sytem-dpdk: Add unit test for mfex autovalidator
> >
> >  Documentation/topics/dpdk/bridge.rst | 140 +++++++
> >  NEWS                                 |  12 +-
> >  acinclude.m4                         |  16 +
> >  configure.ac                         |   1 +
> >  lib/automake.mk                      |   4 +
> >  lib/dpdk.c                           |   2 +
> >  lib/dpif-netdev-avx512.c             |  34 +-
> >  lib/dpif-netdev-extract-avx512.c     | 598 +++++++++++++++++++++++++++
> >  lib/dpif-netdev-extract-study.c      | 145 +++++++
> >  lib/dpif-netdev-perf.c               |   3 +
> >  lib/dpif-netdev-perf.h               |   1 +
> >  lib/dpif-netdev-private-extract.c    | 373 +++++++++++++++++
> >  lib/dpif-netdev-private-extract.h    | 179 ++++++++
> >  lib/dpif-netdev-private-thread.h     |   8 +
> >  lib/dpif-netdev-unixctl.man          |   1 +
> >  lib/dpif-netdev.c                    | 210 +++++++++-
> >  tests/automake.mk                    |   5 +
> >  tests/mfex_fuzzy.py                  |  32 ++
> >  tests/pcap/mfex_test                 | Bin 0 -> 416 bytes
> >  tests/pmd.at                         |   6 +-
> >  tests/system-dpdk.at                 |  46 +++
> >  21 files changed, 1803 insertions(+), 13 deletions(-)  create mode
> > 100644 lib/dpif-netdev-extract-avx512.c  create mode 100644
> > lib/dpif-netdev-extract-study.c  create mode 100644
> > lib/dpif-netdev-private-extract.c  create mode 100644
> > lib/dpif-netdev-private-extract.h  create mode 100755
> > tests/mfex_fuzzy.py  create mode 100644 tests/pcap/mfex_test
> >
> > --
> > 2.32.0
Kumar Amber July 6, 2021, 3:06 p.m. UTC | #3
Hi Eelco ,


Here is the diff  vor v6 vs v5 :

Patch 1 : 

diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c
index 1aebf3656d..4987d628a4 100644
--- a/lib/dpif-netdev-private-extract.c
+++ b/lib/dpif-netdev-private-extract.c
@@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
                                     uint32_t keys_size, odp_port_t in_port,
                                     struct dp_netdev_pmd_thread *pmd_handle)
 {
-    const size_t cnt = dp_packet_batch_size(packets);
+    const uint32_t cnt = dp_packet_batch_size(packets);
     uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
     uint16_t good_l3_ofs[NETDEV_MAX_BURST];
     uint16_t good_l4_ofs[NETDEV_MAX_BURST];
@@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
         atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
         atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
         VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
-                 "batch_size: %ld", keys_size, cnt);
+                 "batch_size: %d", keys_size, cnt);
         return 0;
     }

Patch 7 :

AT_SKIP_IF([! pip3 list | grep scapy], [], [])

> -----Original Message-----
> From: Eelco Chaudron <echaudro@redhat.com>
> Sent: Tuesday, July 6, 2021 8:04 PM
> To: Ferriter, Cian <cian.ferriter@intel.com>
> Cc: ovs-dev@openvswitch.org; fbl@sysclose.org; i.maximets@ovn.org; Van
> Haaren, Harry <harry.van.haaren@intel.com>; Amber, Kumar
> <kumar.amber@intel.com>; Stokes, Ian <ian.stokes@intel.com>
> Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
> 
> Cian,
> 
> Which patches change, so I know where to update my review? None of the
> commit messages show v6 changes.
> 
> //Eelco
> 

Regards
Amber
Eelco Chaudron July 7, 2021, 8:34 a.m. UTC | #4
On 6 Jul 2021, at 17:06, Amber, Kumar wrote:

> Hi Eelco ,
>
>
> Here is the diff  vor v6 vs v5 :
>
> Patch 1 :
>
> diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c
> index 1aebf3656d..4987d628a4 100644
> --- a/lib/dpif-netdev-private-extract.c
> +++ b/lib/dpif-netdev-private-extract.c
> @@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
>                                      uint32_t keys_size, odp_port_t in_port,
>                                      struct dp_netdev_pmd_thread *pmd_handle)
>  {
> -    const size_t cnt = dp_packet_batch_size(packets);
> +    const uint32_t cnt = dp_packet_batch_size(packets);
>      uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
>      uint16_t good_l3_ofs[NETDEV_MAX_BURST];
>      uint16_t good_l4_ofs[NETDEV_MAX_BURST];
> @@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
>          atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
>          atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
>          VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
> -                 "batch_size: %ld", keys_size, cnt);
> +                 "batch_size: %d", keys_size, cnt);

What was the reason for changing this size_t to uint32_t? Is see other instances where %ld is used for logging?
And other functions like dp_netdev_run_meter() have it as a size_t?

>          return 0;
>      }
>
> Patch 7 :
>
> AT_SKIP_IF([! pip3 list | grep scapy], [], [])
>
>> -----Original Message-----
>> From: Eelco Chaudron <echaudro@redhat.com>
>> Sent: Tuesday, July 6, 2021 8:04 PM
>> To: Ferriter, Cian <cian.ferriter@intel.com>
>> Cc: ovs-dev@openvswitch.org; fbl@sysclose.org; i.maximets@ovn.org; Van
>> Haaren, Harry <harry.van.haaren@intel.com>; Amber, Kumar
>> <kumar.amber@intel.com>; Stokes, Ian <ian.stokes@intel.com>
>> Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
>>
>> Cian,
>>
>> Which patches change, so I know where to update my review? None of the
>> commit messages show v6 changes.
>>
>> //Eelco
>>
>
> Regards
> Amber
Van Haaren, Harry July 7, 2021, 9:09 a.m. UTC | #5
> -----Original Message-----
> From: Eelco Chaudron <echaudro@redhat.com>
> Sent: Wednesday, July 7, 2021 9:35 AM
> To: Amber, Kumar <kumar.amber@intel.com>
> Cc: Ferriter, Cian <cian.ferriter@intel.com>; ovs-dev@openvswitch.org;
> fbl@sysclose.org; i.maximets@ovn.org; Van Haaren, Harry
> <harry.van.haaren@intel.com>; Stokes, Ian <ian.stokes@intel.com>
> Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
> 
> 
> 
> On 6 Jul 2021, at 17:06, Amber, Kumar wrote:
> 
> > Hi Eelco ,
> >
> >
> > Here is the diff  vor v6 vs v5 :
> >
> > Patch 1 :
> >
> > diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c
> > index 1aebf3656d..4987d628a4 100644
> > --- a/lib/dpif-netdev-private-extract.c
> > +++ b/lib/dpif-netdev-private-extract.c
> > @@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct
> dp_packet_batch *packets,
> >                                      uint32_t keys_size, odp_port_t in_port,
> >                                      struct dp_netdev_pmd_thread *pmd_handle)
> >  {
> > -    const size_t cnt = dp_packet_batch_size(packets);
> > +    const uint32_t cnt = dp_packet_batch_size(packets);
> >      uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
> >      uint16_t good_l3_ofs[NETDEV_MAX_BURST];
> >      uint16_t good_l4_ofs[NETDEV_MAX_BURST];
> > @@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct
> dp_packet_batch *packets,
> >          atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
> >          atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
> >          VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
> > -                 "batch_size: %ld", keys_size, cnt);
> > +                 "batch_size: %d", keys_size, cnt);
> 
> What was the reason for changing this size_t to uint32_t? Is see other instances
> where %ld is used for logging?
> And other functions like dp_netdev_run_meter() have it as a size_t?

The reason to change this is because 32-bit builds were breaking due to incorrect
format-specifier in the printf. Root cause is because size_t requires different printf
format specifier based on 32 or 64 bit arch.

(As you likely know, size_t is to describe objects in memory, or the return of sizeof operator.
Because 32-bit and 64-bit can have different amounts of memory, size_t can be "unsigned int"
or "unsigned long long").

It does not make sense to me to use a type of variable that changes width based on
architecture to count batch size (a value from 0 to 32).

Simplicity and obvious-ness is nice, and a uint32_t is always exactly what you read it to be,
and %d will always be correct for uint32_t regardless of 32 or 64 bit.

We should not change this back to the more complex and error-prone "size_t", uint32_t is better.

<snip>
Eelco Chaudron July 7, 2021, 9:32 a.m. UTC | #6
On 7 Jul 2021, at 11:09, Van Haaren, Harry wrote:

>> -----Original Message-----
>> From: Eelco Chaudron <echaudro@redhat.com>
>> Sent: Wednesday, July 7, 2021 9:35 AM
>> To: Amber, Kumar <kumar.amber@intel.com>
>> Cc: Ferriter, Cian <cian.ferriter@intel.com>; 
>> ovs-dev@openvswitch.org;
>> fbl@sysclose.org; i.maximets@ovn.org; Van Haaren, Harry
>> <harry.van.haaren@intel.com>; Stokes, Ian <ian.stokes@intel.com>
>> Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
>>
>>
>>
>> On 6 Jul 2021, at 17:06, Amber, Kumar wrote:
>>
>>> Hi Eelco ,
>>>
>>>
>>> Here is the diff  vor v6 vs v5 :
>>>
>>> Patch 1 :
>>>
>>> diff --git a/lib/dpif-netdev-private-extract.c 
>>> b/lib/dpif-netdev-private-extract.c
>>> index 1aebf3656d..4987d628a4 100644
>>> --- a/lib/dpif-netdev-private-extract.c
>>> +++ b/lib/dpif-netdev-private-extract.c
>>> @@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct
>> dp_packet_batch *packets,
>>>                                      uint32_t keys_size, odp_port_t 
>>> in_port,
>>>                                      struct dp_netdev_pmd_thread 
>>> *pmd_handle)
>>>  {
>>> -    const size_t cnt = dp_packet_batch_size(packets);
>>> +    const uint32_t cnt = dp_packet_batch_size(packets);
>>>      uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
>>>      uint16_t good_l3_ofs[NETDEV_MAX_BURST];
>>>      uint16_t good_l4_ofs[NETDEV_MAX_BURST];
>>> @@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct
>> dp_packet_batch *packets,
>>>          atomic_uintptr_t *pmd_func = (void 
>>> *)&pmd->miniflow_extract_opt;
>>>          atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
>>>          VLOG_ERR("Invalid key size supplied, Key_size: %d less 
>>> than"
>>> -                 "batch_size: %ld", keys_size, cnt);
>>> +                 "batch_size: %d", keys_size, cnt);
>>
>> What was the reason for changing this size_t to uint32_t? Is see 
>> other instances
>> where %ld is used for logging?
>> And other functions like dp_netdev_run_meter() have it as a size_t?
>
> The reason to change this is because 32-bit builds were breaking due 
> to incorrect
> format-specifier in the printf. Root cause is because size_t requires 
> different printf
> format specifier based on 32 or 64 bit arch.
>
> (As you likely know, size_t is to describe objects in memory, or the 
> return of sizeof operator.
> Because 32-bit and 64-bit can have different amounts of memory, size_t 
> can be "unsigned int"
> or "unsigned long long").
>
> It does not make sense to me to use a type of variable that changes 
> width based on
> architecture to count batch size (a value from 0 to 32).
>
> Simplicity and obvious-ness is nice, and a uint32_t is always exactly 
> what you read it to be,
> and %d will always be correct for uint32_t regardless of 32 or 64 bit.
>
> We should not change this back to the more complex and error-prone 
> "size_t", uint32_t is better.

I don't think it’s more error-prone if the right type qualifier is 
used, i.e. %zd. See also the coding style document, so I would suggest 
changing it to:

@@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct 
dp_packet_batch *packets,
                                      uint32_t keys_size, odp_port_t 
in_port,
                                      struct dp_netdev_pmd_thread 
*pmd_handle)
  {
-    const uint32_t cnt = dp_packet_batch_size(packets);
+    const size_t cnt = dp_packet_batch_size(packets);
      uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
      uint16_t good_l3_ofs[NETDEV_MAX_BURST];
      uint16_t good_l4_ofs[NETDEV_MAX_BURST];
@@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct 
dp_packet_batch *packets,
          atomic_uintptr_t *pmd_func = (void 
*)&pmd->miniflow_extract_opt;
          atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
          VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
-                 "batch_size: %d", keys_size, cnt);
+                 "batch_size: %"PRIdSIZE, keys_size, cnt);
          return 0;
      }



> <snip>
Kumar Amber July 7, 2021, 10:03 a.m. UTC | #7
Hi Eelco,


I tried with the suggestion “zd” is deprecated and in place of it %"PRIdSIZE`` is mentioned which still causes build failure on non-ssl 32 bit builds.

Regards
Amber

From: Eelco Chaudron <echaudro@redhat.com>
Sent: Wednesday, July 7, 2021 3:02 PM
To: Van Haaren, Harry <harry.van.haaren@intel.com>
Cc: Amber, Kumar <kumar.amber@intel.com>; Ferriter, Cian <cian.ferriter@intel.com>; ovs-dev@openvswitch.org; fbl@sysclose.org; i.maximets@ovn.org; Stokes, Ian <ian.stokes@intel.com>
Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations


On 7 Jul 2021, at 11:09, Van Haaren, Harry wrote:

-----Original Message-----
From: Eelco Chaudron <echaudro@redhat.com<mailto:echaudro@redhat.com>>
Sent: Wednesday, July 7, 2021 9:35 AM
To: Amber, Kumar <kumar.amber@intel.com<mailto:kumar.amber@intel.com>>
Cc: Ferriter, Cian <cian.ferriter@intel.com<mailto:cian.ferriter@intel.com>>; ovs-dev@openvswitch.org<mailto:ovs-dev@openvswitch.org>;
fbl@sysclose.org<mailto:fbl@sysclose.org>; i.maximets@ovn.org<mailto:i.maximets@ovn.org>; Van Haaren, Harry
<harry.van.haaren@intel.com<mailto:harry.van.haaren@intel.com>>; Stokes, Ian <ian.stokes@intel.com<mailto:ian.stokes@intel.com>>
Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations

On 6 Jul 2021, at 17:06, Amber, Kumar wrote:

Hi Eelco ,

Here is the diff vor v6 vs v5 :

Patch 1 :

diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c
index 1aebf3656d..4987d628a4 100644
--- a/lib/dpif-netdev-private-extract.c
+++ b/lib/dpif-netdev-private-extract.c
@@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct

dp_packet_batch *packets,

uint32_t keys_size, odp_port_t in_port,
struct dp_netdev_pmd_thread *pmd_handle)
{
- const size_t cnt = dp_packet_batch_size(packets);
+ const uint32_t cnt = dp_packet_batch_size(packets);
uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
uint16_t good_l3_ofs[NETDEV_MAX_BURST];
uint16_t good_l4_ofs[NETDEV_MAX_BURST];
@@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct

dp_packet_batch *packets,

atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
- "batch_size: %ld", keys_size, cnt);
+ "batch_size: %d", keys_size, cnt);

What was the reason for changing this size_t to uint32_t? Is see other instances
where %ld is used for logging?
And other functions like dp_netdev_run_meter() have it as a size_t?

The reason to change this is because 32-bit builds were breaking due to incorrect
format-specifier in the printf. Root cause is because size_t requires different printf
format specifier based on 32 or 64 bit arch.

(As you likely know, size_t is to describe objects in memory, or the return of sizeof operator.
Because 32-bit and 64-bit can have different amounts of memory, size_t can be "unsigned int"
or "unsigned long long").

It does not make sense to me to use a type of variable that changes width based on
architecture to count batch size (a value from 0 to 32).

Simplicity and obvious-ness is nice, and a uint32_t is always exactly what you read it to be,
and %d will always be correct for uint32_t regardless of 32 or 64 bit.

We should not change this back to the more complex and error-prone "size_t", uint32_t is better.

I don't think it’s more error-prone if the right type qualifier is used, i.e. %zd. See also the coding style document, so I would suggest changing it to:

@@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
uint32_t keys_size, odp_port_t in_port,
struct dp_netdev_pmd_thread *pmd_handle)
{

  *   const uint32_t cnt = dp_packet_batch_size(packets);

  *   const size_t cnt = dp_packet_batch_size(packets);
uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
uint16_t good_l3_ofs[NETDEV_MAX_BURST];
uint16_t good_l4_ofs[NETDEV_MAX_BURST];

@@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
VLOG_ERR("Invalid key size supplied, Key_size: %d less than"

·                    "batch_size: %d", keys_size, cnt);

  *

·                    "batch_size: %"PRIdSIZE, keys_size, cnt);

·           return 0;

  *   }

<snip>
Van Haaren, Harry July 7, 2021, 10:13 a.m. UTC | #8
Hi All,

This thread has dissolved into unnecessary time-wasting on nitpick changes. There is no
technical issue with uint32_t, so this patch remains as is, and this should be accepted for merge.

If you feel differently, reply to this with a detailed description of a genuine technical bug.

Regards, -Harry


From: Amber, Kumar <kumar.amber@intel.com>
Sent: Wednesday, July 7, 2021 11:04 AM
To: Eelco Chaudron <echaudro@redhat.com>; Van Haaren, Harry <harry.van.haaren@intel.com>
Cc: Ferriter, Cian <cian.ferriter@intel.com>; ovs-dev@openvswitch.org; fbl@sysclose.org; i.maximets@ovn.org; Stokes, Ian <ian.stokes@intel.com>
Subject: RE: [v6 00/11] MFEX Infrastructure + Optimizations

Hi Eelco,


I tried with the suggestion “zd” is deprecated and in place of it %"PRIdSIZE`` is mentioned which still causes build failure on non-ssl 32 bit builds.

Regards
Amber

From: Eelco Chaudron <echaudro@redhat.com<mailto:echaudro@redhat.com>>
Sent: Wednesday, July 7, 2021 3:02 PM
To: Van Haaren, Harry <harry.van.haaren@intel.com<mailto:harry.van.haaren@intel.com>>
Cc: Amber, Kumar <kumar.amber@intel.com<mailto:kumar.amber@intel.com>>; Ferriter, Cian <cian.ferriter@intel.com<mailto:cian.ferriter@intel.com>>; ovs-dev@openvswitch.org<mailto:ovs-dev@openvswitch.org>; fbl@sysclose.org<mailto:fbl@sysclose.org>; i.maximets@ovn.org<mailto:i.maximets@ovn.org>; Stokes, Ian <ian.stokes@intel.com<mailto:ian.stokes@intel.com>>
Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations


On 7 Jul 2021, at 11:09, Van Haaren, Harry wrote:

-----Original Message-----
From: Eelco Chaudron <echaudro@redhat.com<mailto:echaudro@redhat.com>>
Sent: Wednesday, July 7, 2021 9:35 AM
To: Amber, Kumar <kumar.amber@intel.com<mailto:kumar.amber@intel.com>>
Cc: Ferriter, Cian <cian.ferriter@intel.com<mailto:cian.ferriter@intel.com>>; ovs-dev@openvswitch.org<mailto:ovs-dev@openvswitch.org>;
fbl@sysclose.org<mailto:fbl@sysclose.org>; i.maximets@ovn.org<mailto:i.maximets@ovn.org>; Van Haaren, Harry
<harry.van.haaren@intel.com<mailto:harry.van.haaren@intel.com>>; Stokes, Ian <ian.stokes@intel.com<mailto:ian.stokes@intel.com>>
Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations

On 6 Jul 2021, at 17:06, Amber, Kumar wrote:

Hi Eelco ,

Here is the diff vor v6 vs v5 :

Patch 1 :

diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c
index 1aebf3656d..4987d628a4 100644
--- a/lib/dpif-netdev-private-extract.c
+++ b/lib/dpif-netdev-private-extract.c
@@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct

dp_packet_batch *packets,

uint32_t keys_size, odp_port_t in_port,
struct dp_netdev_pmd_thread *pmd_handle)
{
- const size_t cnt = dp_packet_batch_size(packets);
+ const uint32_t cnt = dp_packet_batch_size(packets);
uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
uint16_t good_l3_ofs[NETDEV_MAX_BURST];
uint16_t good_l4_ofs[NETDEV_MAX_BURST];
@@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct

dp_packet_batch *packets,

atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
- "batch_size: %ld", keys_size, cnt);
+ "batch_size: %d", keys_size, cnt);

What was the reason for changing this size_t to uint32_t? Is see other instances
where %ld is used for logging?
And other functions like dp_netdev_run_meter() have it as a size_t?

The reason to change this is because 32-bit builds were breaking due to incorrect
format-specifier in the printf. Root cause is because size_t requires different printf
format specifier based on 32 or 64 bit arch.

(As you likely know, size_t is to describe objects in memory, or the return of sizeof operator.
Because 32-bit and 64-bit can have different amounts of memory, size_t can be "unsigned int"
or "unsigned long long").

It does not make sense to me to use a type of variable that changes width based on
architecture to count batch size (a value from 0 to 32).

Simplicity and obvious-ness is nice, and a uint32_t is always exactly what you read it to be,
and %d will always be correct for uint32_t regardless of 32 or 64 bit.

We should not change this back to the more complex and error-prone "size_t", uint32_t is better.

I don't think it’s more error-prone if the right type qualifier is used, i.e. %zd. See also the coding style document, so I would suggest changing it to:

@@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
uint32_t keys_size, odp_port_t in_port,
struct dp_netdev_pmd_thread *pmd_handle)
{

  *   const uint32_t cnt = dp_packet_batch_size(packets);

  *   const size_t cnt = dp_packet_batch_size(packets);
uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
uint16_t good_l3_ofs[NETDEV_MAX_BURST];
uint16_t good_l4_ofs[NETDEV_MAX_BURST];

@@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
VLOG_ERR("Invalid key size supplied, Key_size: %d less than"

·                    "batch_size: %d", keys_size, cnt);

  *

·                    "batch_size: %"PRIdSIZE, keys_size, cnt);

·           return 0;

  *   }

<snip>
Eelco Chaudron July 7, 2021, 10:48 a.m. UTC | #9
On 7 Jul 2021, at 12:13, Van Haaren, Harry wrote:

> Hi All,
>
> This thread has dissolved into unnecessary time-wasting on nitpick changes. There is no
> technical issue with uint32_t, so this patch remains as is, and this should be accepted for merge.
>
> If you feel differently, reply to this with a detailed description of a genuine technical bug.

Reviews are not only about technical correctness but also about coding style and consistency.
In this case the dp_packet_batch_size() API returns a size_t, so we should try to use it.

But I leave it to the maintainers to decide if they accept this as is, or not :)

//Eelco

> Regards, -Harry
>
>
> From: Amber, Kumar <kumar.amber@intel.com>
> Sent: Wednesday, July 7, 2021 11:04 AM
> To: Eelco Chaudron <echaudro@redhat.com>; Van Haaren, Harry <harry.van.haaren@intel.com>
> Cc: Ferriter, Cian <cian.ferriter@intel.com>; ovs-dev@openvswitch.org; fbl@sysclose.org; i.maximets@ovn.org; Stokes, Ian <ian.stokes@intel.com>
> Subject: RE: [v6 00/11] MFEX Infrastructure + Optimizations
>
> Hi Eelco,
>
>
> I tried with the suggestion “zd” is deprecated and in place of it %"PRIdSIZE`` is mentioned which still causes build failure on non-ssl 32 bit builds.
>
> Regards
> Amber
>
> From: Eelco Chaudron <echaudro@redhat.com<mailto:echaudro@redhat.com>>
> Sent: Wednesday, July 7, 2021 3:02 PM
> To: Van Haaren, Harry <harry.van.haaren@intel.com<mailto:harry.van.haaren@intel.com>>
> Cc: Amber, Kumar <kumar.amber@intel.com<mailto:kumar.amber@intel.com>> ; Ferriter, Cian <cian.ferriter@intel.com<mailto:cian.ferriter@intel.com>> ; ovs-dev@openvswitch.org<mailto:ovs-dev@openvswitch.org> ; fbl@sysclose.org<mailto:fbl@sysclose.org> ; i.maximets@ovn.org<mailto:i.maximets@ovn.org> ; Stokes, Ian <ian.stokes@intel.com<mailto:ian.stokes@intel.com>>
> Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
>
>
> On 7 Jul 2021, at 11:09, Van Haaren, Harry wrote:
>
> -----Original Message-----
> From: Eelco Chaudron <echaudro@redhat.com<mailto:echaudro@redhat.com>>
> Sent: Wednesday, July 7, 2021 9:35 AM
> To: Amber, Kumar <kumar.amber@intel.com<mailto:kumar.amber@intel.com>>
> Cc: Ferriter, Cian <cian.ferriter@intel.com<mailto:cian.ferriter@intel.com>> ; ovs-dev@openvswitch.org<mailto:ovs-dev@openvswitch.org> ;
> fbl@sysclose.org<mailto:fbl@sysclose.org> ; i.maximets@ovn.org<mailto:i.maximets@ovn.org> ; Van Haaren, Harry
> <harry.van.haaren@intel.com<mailto:harry.van.haaren@intel.com>> ; Stokes, Ian <ian.stokes@intel.com<mailto:ian.stokes@intel.com>>
> Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
>
> On 6 Jul 2021, at 17:06, Amber, Kumar wrote:
>
> Hi Eelco ,
>
> Here is the diff vor v6 vs v5 :
>
> Patch 1 :
>
> diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c
> index 1aebf3656d..4987d628a4 100644
> --- a/lib/dpif-netdev-private-extract.c
> +++ b/lib/dpif-netdev-private-extract.c
> @@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct
>
> dp_packet_batch *packets,
>
> uint32_t keys_size, odp_port_t in_port,
> struct dp_netdev_pmd_thread *pmd_handle)
> {
> - const size_t cnt = dp_packet_batch_size(packets);
> + const uint32_t cnt = dp_packet_batch_size(packets);
> uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
> uint16_t good_l3_ofs[NETDEV_MAX_BURST];
> uint16_t good_l4_ofs[NETDEV_MAX_BURST];
> @@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct
>
> dp_packet_batch *packets,
>
> atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
> atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
> VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
> - "batch_size: %ld", keys_size, cnt);
> + "batch_size: %d", keys_size, cnt);
>
> What was the reason for changing this size_t to uint32_t? Is see other instances
> where %ld is used for logging?
> And other functions like dp_netdev_run_meter() have it as a size_t?
>
> The reason to change this is because 32-bit builds were breaking due to incorrect
> format-specifier in the printf. Root cause is because size_t requires different printf
> format specifier based on 32 or 64 bit arch.
>
> (As you likely know, size_t is to describe objects in memory, or the return of sizeof operator.
> Because 32-bit and 64-bit can have different amounts of memory, size_t can be "unsigned int"
> or "unsigned long long").
>
> It does not make sense to me to use a type of variable that changes width based on
> architecture to count batch size (a value from 0 to 32).
>
> Simplicity and obvious-ness is nice, and a uint32_t is always exactly what you read it to be,
> and %d will always be correct for uint32_t regardless of 32 or 64 bit.
>
> We should not change this back to the more complex and error-prone "size_t", uint32_t is better.
>
> I don't think it’s more error-prone if the right type qualifier is used, i.e. %zd. See also the coding style document, so I would suggest changing it to:
>
> @@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
> uint32_t keys_size, odp_port_t in_port,
> struct dp_netdev_pmd_thread *pmd_handle)
> {
>
>   *   const uint32_t cnt = dp_packet_batch_size(packets);
>
>   *   const size_t cnt = dp_packet_batch_size(packets);
> uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
> uint16_t good_l3_ofs[NETDEV_MAX_BURST];
> uint16_t good_l4_ofs[NETDEV_MAX_BURST];
>
> @@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
> atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
> atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
> VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
>
> ·                    "batch_size: %d", keys_size, cnt);
>
>   *
>
> ·                    "batch_size: %"PRIdSIZE, keys_size, cnt);
>
> ·           return 0;
>
>   *   }
>
> <snip>
Stokes, Ian July 7, 2021, 2:37 p.m. UTC | #10
> On 7 Jul 2021, at 12:13, Van Haaren, Harry wrote:
> 
> > Hi All,
> >
> > This thread has dissolved into unnecessary time-wasting on nitpick changes.
> There is no
> > technical issue with uint32_t, so this patch remains as is, and this should be
> accepted for merge.
> >
> > If you feel differently, reply to this with a detailed description of a genuine
> technical bug.
> 
> Reviews are not only about technical correctness but also about coding style
> and consistency.
> In this case the dp_packet_batch_size() API returns a size_t, so we should try to
> use it.
> 
+1

> But I leave it to the maintainers to decide if they accept this as is, or not :)
> 

If the standard is to use size_t then I believe we should stick with that. I think it's a separate conversation with regards to if size_t should be used and is best for the dp_packet_batch_size API and probably beyond the scope of this patch series.

For the moment I'd prefer to see a solution using size_t.

Regards
Ian

> //Eelco
> 
> > Regards, -Harry
> >
> >
> > From: Amber, Kumar <kumar.amber@intel.com>
> > Sent: Wednesday, July 7, 2021 11:04 AM
> > To: Eelco Chaudron <echaudro@redhat.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>
> > Cc: Ferriter, Cian <cian.ferriter@intel.com>; ovs-dev@openvswitch.org;
> fbl@sysclose.org; i.maximets@ovn.org; Stokes, Ian <ian.stokes@intel.com>
> > Subject: RE: [v6 00/11] MFEX Infrastructure + Optimizations
> >
> > Hi Eelco,
> >
> >
> > I tried with the suggestion “zd” is deprecated and in place of it %"PRIdSIZE`` is
> mentioned which still causes build failure on non-ssl 32 bit builds.
> >
> > Regards
> > Amber
> >
> > From: Eelco Chaudron
> <echaudro@redhat.com<mailto:echaudro@redhat.com>>
> > Sent: Wednesday, July 7, 2021 3:02 PM
> > To: Van Haaren, Harry
> <harry.van.haaren@intel.com<mailto:harry.van.haaren@intel.com>>
> > Cc: Amber, Kumar
> <kumar.amber@intel.com<mailto:kumar.amber@intel.com>> ; Ferriter, Cian
> <cian.ferriter@intel.com<mailto:cian.ferriter@intel.com>> ; ovs-
> dev@openvswitch.org<mailto:ovs-dev@openvswitch.org> ;
> fbl@sysclose.org<mailto:fbl@sysclose.org> ;
> i.maximets@ovn.org<mailto:i.maximets@ovn.org> ; Stokes, Ian
> <ian.stokes@intel.com<mailto:ian.stokes@intel.com>>
> > Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
> >
> >
> > On 7 Jul 2021, at 11:09, Van Haaren, Harry wrote:
> >
> > -----Original Message-----
> > From: Eelco Chaudron
> <echaudro@redhat.com<mailto:echaudro@redhat.com>>
> > Sent: Wednesday, July 7, 2021 9:35 AM
> > To: Amber, Kumar
> <kumar.amber@intel.com<mailto:kumar.amber@intel.com>>
> > Cc: Ferriter, Cian <cian.ferriter@intel.com<mailto:cian.ferriter@intel.com>> ;
> ovs-dev@openvswitch.org<mailto:ovs-dev@openvswitch.org> ;
> > fbl@sysclose.org<mailto:fbl@sysclose.org> ;
> i.maximets@ovn.org<mailto:i.maximets@ovn.org> ; Van Haaren, Harry
> > <harry.van.haaren@intel.com<mailto:harry.van.haaren@intel.com>> ; Stokes,
> Ian <ian.stokes@intel.com<mailto:ian.stokes@intel.com>>
> > Subject: Re: [v6 00/11] MFEX Infrastructure + Optimizations
> >
> > On 6 Jul 2021, at 17:06, Amber, Kumar wrote:
> >
> > Hi Eelco ,
> >
> > Here is the diff vor v6 vs v5 :
> >
> > Patch 1 :
> >
> > diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c
> > index 1aebf3656d..4987d628a4 100644
> > --- a/lib/dpif-netdev-private-extract.c
> > +++ b/lib/dpif-netdev-private-extract.c
> > @@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct
> >
> > dp_packet_batch *packets,
> >
> > uint32_t keys_size, odp_port_t in_port,
> > struct dp_netdev_pmd_thread *pmd_handle)
> > {
> > - const size_t cnt = dp_packet_batch_size(packets);
> > + const uint32_t cnt = dp_packet_batch_size(packets);
> > uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
> > uint16_t good_l3_ofs[NETDEV_MAX_BURST];
> > uint16_t good_l4_ofs[NETDEV_MAX_BURST];
> > @@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct
> >
> > dp_packet_batch *packets,
> >
> > atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
> > atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
> > VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
> > - "batch_size: %ld", keys_size, cnt);
> > + "batch_size: %d", keys_size, cnt);
> >
> > What was the reason for changing this size_t to uint32_t? Is see other
> instances
> > where %ld is used for logging?
> > And other functions like dp_netdev_run_meter() have it as a size_t?
> >
> > The reason to change this is because 32-bit builds were breaking due to
> incorrect
> > format-specifier in the printf. Root cause is because size_t requires different
> printf
> > format specifier based on 32 or 64 bit arch.
> >
> > (As you likely know, size_t is to describe objects in memory, or the return of
> sizeof operator.
> > Because 32-bit and 64-bit can have different amounts of memory, size_t can
> be "unsigned int"
> > or "unsigned long long").
> >
> > It does not make sense to me to use a type of variable that changes width
> based on
> > architecture to count batch size (a value from 0 to 32).
> >
> > Simplicity and obvious-ness is nice, and a uint32_t is always exactly what you
> read it to be,
> > and %d will always be correct for uint32_t regardless of 32 or 64 bit.
> >
> > We should not change this back to the more complex and error-prone "size_t",
> uint32_t is better.
> >
> > I don't think it’s more error-prone if the right type qualifier is used, i.e. %zd.
> See also the coding style document, so I would suggest changing it to:
> >
> > @@ -233,7 +233,7 @@ dpif_miniflow_extract_autovalidator(struct
> dp_packet_batch *packets,
> > uint32_t keys_size, odp_port_t in_port,
> > struct dp_netdev_pmd_thread *pmd_handle)
> > {
> >
> >   *   const uint32_t cnt = dp_packet_batch_size(packets);
> >
> >   *   const size_t cnt = dp_packet_batch_size(packets);
> > uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
> > uint16_t good_l3_ofs[NETDEV_MAX_BURST];
> > uint16_t good_l4_ofs[NETDEV_MAX_BURST];
> >
> > @@ -247,7 +247,7 @@ dpif_miniflow_extract_autovalidator(struct
> dp_packet_batch *packets,
> > atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
> > atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
> > VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
> >
> > ·                    "batch_size: %d", keys_size, cnt);
> >
> >   *
> >
> > ·                    "batch_size: %"PRIdSIZE, keys_size, cnt);
> >
> > ·           return 0;
> >
> >   *   }
> >
> > <snip>
Van Haaren, Harry July 7, 2021, 2:53 p.m. UTC | #11
> -----Original Message-----
> From: Stokes, Ian <ian.stokes@intel.com>
> Sent: Wednesday, July 7, 2021 3:38 PM
> To: Eelco Chaudron <echaudro@redhat.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; Amber, Kumar <kumar.amber@intel.com>
> Cc: Amber, Kumar <kumar.amber@intel.com>; Ferriter, Cian
> <cian.ferriter@intel.com>; ovs-dev@openvswitch.org; fbl@sysclose.org;
> i.maximets@ovn.org
> Subject: RE: [v6 00/11] MFEX Infrastructure + Optimizations
> 
> > On 7 Jul 2021, at 12:13, Van Haaren, Harry wrote:
> >
> > > Hi All,
> > >
> > > This thread has dissolved into unnecessary time-wasting on nitpick changes.
> > There is no
> > > technical issue with uint32_t, so this patch remains as is, and this should be
> > accepted for merge.
> > >
> > > If you feel differently, reply to this with a detailed description of a genuine
> > technical bug.
> >
> > Reviews are not only about technical correctness but also about coding style
> > and consistency.
> > In this case the dp_packet_batch_size() API returns a size_t, so we should try
> to
> > use it.
> >
> +1

OK, lets work on a viable solution that OVS build-system & the compilers support.

> > But I leave it to the maintainers to decide if they accept this as is, or not :)
> 
> If the standard is to use size_t then I believe we should stick with that. I think it's
> a separate conversation with regards to if size_t should be used and is best for
> the dp_packet_batch_size API and probably beyond the scope of this patch
> series.

Agree that it's beyond scope of patchset. 

> For the moment I'd prefer to see a solution using size_t.

OK, based on coding-style.rst, the PRIuSIZE format spec. will be used.

> Regards
> Ian
> 
> > //Eelco

Thanks for input all.

<snip>