On 12 Oct 2022, at 13:55, Cian Ferriter wrote:

> From: Kumar Amber <[email protected]>
>
> The md_is_valid parameter is passed from DPIF to MFEX to allow MFEX
> functions to detect the tunneling and decide the processing of Inner
> packets in static predictable branches.
>
> Signed-off-by: Kumar Amber <[email protected]>
> Acked-by: Cian Ferriter <[email protected]>
> Acked-by: Sunil Pai G <[email protected]>
> ---
>  lib/dpif-netdev-avx512.c          |  3 ++-
>  lib/dpif-netdev-extract-avx512.c  |  9 +++++----
>  lib/dpif-netdev-extract-study.c   |  6 ++++--
>  lib/dpif-netdev-private-extract.c |  6 ++++--
>  lib/dpif-netdev-private-extract.h | 13 ++++++++-----
>  5 files changed, 23 insertions(+), 14 deletions(-)
>
> diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c
> index 9def69a87..90bc7a57d 100644
> --- a/lib/dpif-netdev-avx512.c
> +++ b/lib/dpif-netdev-avx512.c
> @@ -190,7 +190,8 @@ dp_netdev_input_avx512__(struct dp_netdev_pmd_thread *pmd,
>          miniflow_extract_func mfex_func;
>          atomic_read_relaxed(&pmd->miniflow_extract_opt, &mfex_func);
>          if (mfex_func) {
> -            mf_mask = mfex_func(packets, keys, batch_size, in_port, pmd);
> +            mf_mask = mfex_func(packets, keys, batch_size, in_port, pmd,
> +                                md_is_valid);
>          }
>      }
>
> diff --git a/lib/dpif-netdev-extract-avx512.c 
> b/lib/dpif-netdev-extract-avx512.c
> index 4afbed97e..833e9bd31 100644
> --- a/lib/dpif-netdev-extract-avx512.c
> +++ b/lib/dpif-netdev-extract-avx512.c
> @@ -744,6 +744,7 @@ mfex_avx512_process(struct dp_packet_batch *packets,
>                      uint32_t keys_size OVS_UNUSED,
>                      odp_port_t in_port,
>                      void *pmd_handle OVS_UNUSED,
> +                    bool md_is_valid OVS_UNUSED,
>                      const enum MFEX_PROFILES profile_id,
>                      const uint32_t use_vbmi OVS_UNUSED)
>  {
> @@ -978,10 +979,10 @@ __attribute__((__target__("avx512vbmi")))               
>                 \
>  mfex_avx512_vbmi_##name(struct dp_packet_batch *packets,                \
>                          struct netdev_flow_key *keys, uint32_t keys_size,\
>                          odp_port_t in_port, struct dp_netdev_pmd_thread \
> -                        *pmd_handle)                                    \
> +                        *pmd_handle, bool md_is_valid)                  \
>  {                                                                       \
>      return mfex_avx512_process(packets, keys, keys_size, in_port,       \
> -                               pmd_handle, profile, 1);                 \
> +                               pmd_handle, md_is_valid, profile, 1);    \
>  }
>  #else
>  #define VBMI_MFEX_FUNC(name, profile)
> @@ -992,10 +993,10 @@ uint32_t                                                
>                 \
>  mfex_avx512_##name(struct dp_packet_batch *packets,                     \
>                     struct netdev_flow_key *keys, uint32_t keys_size,    \
>                     odp_port_t in_port, struct dp_netdev_pmd_thread      \
> -                   *pmd_handle)                                         \
> +                   *pmd_handle, bool md_is_valid)                       \
>  {                                                                       \
>      return mfex_avx512_process(packets, keys, keys_size, in_port,       \
> -                               pmd_handle, profile, 0);                 \
> +                               pmd_handle, md_is_valid, profile, 0);    \
>  }
>
>  #define DECLARE_MFEX_FUNC(name, profile)                                \
> diff --git a/lib/dpif-netdev-extract-study.c b/lib/dpif-netdev-extract-study.c
> index 69077c844..71354cc4c 100644
> --- a/lib/dpif-netdev-extract-study.c
> +++ b/lib/dpif-netdev-extract-study.c
> @@ -71,7 +71,8 @@ uint32_t
>  mfex_study_traffic(struct dp_packet_batch *packets,
>                     struct netdev_flow_key *keys,
>                     uint32_t keys_size, odp_port_t in_port,
> -                   struct dp_netdev_pmd_thread *pmd_handle)
> +                   struct dp_netdev_pmd_thread *pmd_handle,
> +                   bool md_is_valid)
>  {
>      uint32_t hitmask = 0;
>      uint32_t mask = 0;
> @@ -90,7 +91,8 @@ mfex_study_traffic(struct dp_packet_batch *packets,
>          }
>
>          hitmask = miniflow_funcs[i].extract_func(packets, keys, keys_size,
> -                                                 in_port, pmd_handle);
> +                                                 in_port, pmd_handle,
> +                                                 md_is_valid);
>          stats->impl_hitcount[i] += count_1bits(hitmask);
>
>          /* If traffic is not classified then we dont overwrite the keys
> diff --git a/lib/dpif-netdev-private-extract.c 
> b/lib/dpif-netdev-private-extract.c
> index fe0a53c2c..12ac8ecce 100644
> --- a/lib/dpif-netdev-private-extract.c
> +++ b/lib/dpif-netdev-private-extract.c
> @@ -340,7 +340,8 @@ uint32_t
>  dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
>                                      struct netdev_flow_key *keys,
>                                      uint32_t keys_size, odp_port_t in_port,
> -                                    struct dp_netdev_pmd_thread *pmd_handle)
> +                                    struct dp_netdev_pmd_thread *pmd_handle,
> +                                    bool md_is_valid)
>  {
>      const size_t cnt = dp_packet_batch_size(packets);
>      uint16_t good_l2_5_ofs[NETDEV_MAX_BURST];
> @@ -385,7 +386,8 @@ dpif_miniflow_extract_autovalidator(struct 
> dp_packet_batch *packets,
>          /* Call optimized miniflow for each batch of packet. */
>          uint32_t hit_mask = mfex_impls[j].extract_func(packets, test_keys,
>                                                         keys_size, in_port,
> -                                                       pmd_handle);
> +                                                       pmd_handle,
> +                                                       md_is_valid);
>
>          /* Do a miniflow compare for bits, blocks and offsets for all the
>           * classified packets in the hitmask marked by set bits. */
> diff --git a/lib/dpif-netdev-private-extract.h 
> b/lib/dpif-netdev-private-extract.h
> index f5e6d33c1..3cc3898ac 100644
> --- a/lib/dpif-netdev-private-extract.h
> +++ b/lib/dpif-netdev-private-extract.h
> @@ -39,7 +39,8 @@ typedef uint32_t (*miniflow_extract_func)(struct 
> dp_packet_batch *batch,
>                                            uint32_t keys_size,
>                                            odp_port_t in_port,
>                                            struct dp_netdev_pmd_thread
> -                                          *pmd_handle);
> +                                          *pmd_handle,
> +                                          bool md_is_valid);

See my comment in patch 6 that we should add details on the parameters.

>
>
>  /* The function pointer miniflow_extract_func depends on batch size. */
> @@ -188,7 +189,8 @@ uint32_t
>  dpif_miniflow_extract_autovalidator(struct dp_packet_batch *batch,
>                                      struct netdev_flow_key *keys,
>                                      uint32_t keys_size, odp_port_t in_port,
> -                                    struct dp_netdev_pmd_thread *pmd_handle);
> +                                    struct dp_netdev_pmd_thread *pmd_handle,
> +                                    bool md_is_valid);
>
>  /* Retrieve the number of packets by studying packets using different 
> miniflow
>   * implementations to choose the best implementation using the maximum 
> hitmask
> @@ -200,7 +202,8 @@ uint32_t
>  mfex_study_traffic(struct dp_packet_batch *packets,
>                     struct netdev_flow_key *keys,
>                     uint32_t keys_size, odp_port_t in_port,
> -                   struct dp_netdev_pmd_thread *pmd_handle);
> +                   struct dp_netdev_pmd_thread *pmd_handle,
> +                   bool md_is_valid);
>
>  /* Sets the packet count from user to the stats for use in
>   * study function to match against the classified packets to choose
> @@ -219,12 +222,12 @@ mfex_set_study_pkt_cnt(uint32_t pkt_cmp_count, const 
> char *name);
>      mfex_avx512_vbmi_##name(struct dp_packet_batch *packets,                \
>                              struct netdev_flow_key *keys, uint32_t 
> keys_size,\
>                              odp_port_t in_port, struct dp_netdev_pmd_thread \
> -                            *pmd_handle);                                   \
> +                            *pmd_handle, bool md_is_valid);                 \
>      uint32_t                                                                \
>      mfex_avx512_##name(struct dp_packet_batch *packets,                     \
>                          struct netdev_flow_key *keys, uint32_t keys_size,   \
>                          odp_port_t in_port, struct dp_netdev_pmd_thread     \
> -                        *pmd_handle);                                       \
> +                        *pmd_handle, bool md_is_valid);                     \
>
>  DECLARE_AVX512_MFEX_PROTOTYPE(ip_udp);
>  DECLARE_AVX512_MFEX_PROTOTYPE(ip_tcp);
> -- 
> 2.25.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to