Message ID | 20220506052326.3191931-2-kumar.amber@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | MFEX Optimizations IPv6 + Hashing Optimizations | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
ovsrobot/intel-ovs-compilation | success | test: success |
> -----Original Message----- > From: Amber, Kumar <kumar.amber@intel.com> > Sent: Friday, May 6, 2022 6:23 AM > To: ovs-dev@openvswitch.org > Cc: echaudro@redhat.com; ktraynor@redhat.com; i.maximets@ovn.org; Ferriter, > Cian <cian.ferriter@intel.com>; Stokes, Ian <ian.stokes@intel.com>; > david.marchand@redhat.com; fbl@sysclose.org; Van Haaren, Harry > <harry.van.haaren@intel.com>; Amber, Kumar <kumar.amber@intel.com> > Subject: [PATCH v7 1/4] mfex_avx512: Calculate pkt offsets at compile time. > > The patch removes magic numbers pkt offsets and > minimum packet lenght and instead calculate it at > compile time. > > Signed-off-by: Kumar Amber <kumar.amber@intel.com> > --- > lib/dpif-netdev-extract-avx512.c | 28 ++++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/lib/dpif-netdev-extract-avx512.c b/lib/dpif-netdev-extract-avx512.c > index 6b6fe07db..6ae15a4db 100644 > --- a/lib/dpif-netdev-extract-avx512.c > +++ b/lib/dpif-netdev-extract-avx512.c > @@ -246,6 +246,16 @@ _mm512_maskz_permutexvar_epi8_wrap(__mmask64 > kmask, __m512i idx, __m512i a) > NC, NC, NC, NC, 0xBF, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, \ > NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC > > +#define PKT_OFFSET_L2 (ETH_HEADER_LEN) > +#define PKT_OFFSET_L3_VLAN (ETH_HEADER_LEN + VLAN_HEADER_LEN) VLAN is part of L2, so the naming convention here gets unclear...? It should be either L2_SIZE or L3_OFFSET. > +#define PKT_OFFSET_L4_IPv4 (ETH_HEADER_LEN + IP_HEADER_LEN) as a result of the above, here it looks like IP is L4? I think PKT_OFFSET_L3_IPV4 would be a clearer name here (as it's the L3 offset). <snip remaining, will review next version> > @@ -345,9 +355,9 @@ static const struct mfex_profile > mfex_profiles[PROFILE_COUNT] = > > .mf_bits = { 0x18a0000000000000, 0x0000000000040401}, > .dp_pkt_offs = { > - 0, UINT16_MAX, 14, 34, > + 0, UINT16_MAX, PKT_OFFSET_L2, PKT_OFFSET_L4_IPv4, Usage here is as follows: l2_pad_size, l2_5_ofs, l3_ofs, l4_ofs so 0, UINT16_MAX, PKT_L3_OFFSET, PKT_L4_OFFSET would be a nice set of defines to use. <snip>
diff --git a/lib/dpif-netdev-extract-avx512.c b/lib/dpif-netdev-extract-avx512.c index 6b6fe07db..6ae15a4db 100644 --- a/lib/dpif-netdev-extract-avx512.c +++ b/lib/dpif-netdev-extract-avx512.c @@ -246,6 +246,16 @@ _mm512_maskz_permutexvar_epi8_wrap(__mmask64 kmask, __m512i idx, __m512i a) NC, NC, NC, NC, 0xBF, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, \ NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC +#define PKT_OFFSET_L2 (ETH_HEADER_LEN) +#define PKT_OFFSET_L3_VLAN (ETH_HEADER_LEN + VLAN_HEADER_LEN) +#define PKT_OFFSET_L4_IPv4 (ETH_HEADER_LEN + IP_HEADER_LEN) +#define PKT_OFFSET_L4_VLAN_IPv4 (PKT_OFFSET_L4_IPv4 + VLAN_HEADER_LEN) + +#define PKT_MIN_ETH_IPv4_UDP (PKT_OFFSET_L4_IPv4 + UDP_HEADER_LEN) +#define PKT_MIN_ETH_VLAN_IPv4_UDP (PKT_OFFSET_L4_VLAN_IPv4 + UDP_HEADER_LEN) +#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) + /* This union allows initializing static data as u8, but easily loading it * into AVX512 registers too. The union ensures proper alignment for the zmm. */ @@ -345,9 +355,9 @@ static const struct mfex_profile mfex_profiles[PROFILE_COUNT] = .mf_bits = { 0x18a0000000000000, 0x0000000000040401}, .dp_pkt_offs = { - 0, UINT16_MAX, 14, 34, + 0, UINT16_MAX, PKT_OFFSET_L2, PKT_OFFSET_L4_IPv4, }, - .dp_pkt_min_size = 42, + .dp_pkt_min_size = PKT_MIN_ETH_IPv4_UDP, }, [PROFILE_ETH_IPV4_TCP] = { @@ -368,9 +378,9 @@ static const struct mfex_profile mfex_profiles[PROFILE_COUNT] = .mf_bits = { 0x18a0000000000000, 0x0000000000044401}, .dp_pkt_offs = { - 0, UINT16_MAX, 14, 34, + 0, UINT16_MAX, PKT_OFFSET_L2, PKT_OFFSET_L4_IPv4, }, - .dp_pkt_min_size = 54, + .dp_pkt_min_size = PKT_MIN_ETH_IPv4_TCP, }, [PROFILE_ETH_VLAN_IPV4_UDP] = { @@ -387,9 +397,10 @@ static const struct mfex_profile mfex_profiles[PROFILE_COUNT] = .mf_bits = { 0x38a0000000000000, 0x0000000000040401}, .dp_pkt_offs = { - 14, UINT16_MAX, 18, 38, + PKT_OFFSET_L2, UINT16_MAX, PKT_OFFSET_L3_VLAN, + PKT_OFFSET_L4_VLAN_IPv4, }, - .dp_pkt_min_size = 46, + .dp_pkt_min_size = PKT_MIN_ETH_VLAN_IPv4_UDP, }, [PROFILE_ETH_VLAN_IPV4_TCP] = { @@ -412,9 +423,10 @@ static const struct mfex_profile mfex_profiles[PROFILE_COUNT] = .mf_bits = { 0x38a0000000000000, 0x0000000000044401}, .dp_pkt_offs = { - 14, UINT16_MAX, 18, 38, + PKT_OFFSET_L2, UINT16_MAX, PKT_OFFSET_L3_VLAN, + PKT_OFFSET_L4_VLAN_IPv4, }, - .dp_pkt_min_size = 58, + .dp_pkt_min_size = PKT_MIN_ETH_VLAN_IPv4_TCP, }, };
The patch removes magic numbers pkt offsets and minimum packet lenght and instead calculate it at compile time. Signed-off-by: Kumar Amber <kumar.amber@intel.com> --- lib/dpif-netdev-extract-avx512.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)