diff mbox series

[ovs-dev,v1,06/10] dpif-mfex: Change mfex fn pointer prototype to include md_is_valid.

Message ID 20220321061441.1833575-7-kumar.amber@intel.com
State Deferred
Headers show
Series DPIF + MFEX Inner Vxlan AVX512 Opts | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Kumar Amber March 21, 2022, 6:14 a.m. UTC
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 <kumar.amber@intel.com>
---
 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 mbox series

Patch

diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c
index fa8773331..5cf1264f8 100644
--- a/lib/dpif-netdev-avx512.c
+++ b/lib/dpif-netdev-avx512.c
@@ -162,7 +162,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);
     }
 
     uint32_t lookup_pkts_bitmask = (1ULL << batch_size) - 1;
diff --git a/lib/dpif-netdev-extract-avx512.c b/lib/dpif-netdev-extract-avx512.c
index c1c1fefb6..02056b731 100644
--- a/lib/dpif-netdev-extract-avx512.c
+++ b/lib/dpif-netdev-extract-avx512.c
@@ -480,6 +480,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)
 {
@@ -634,10 +635,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);    \
 }                                                                       \
                                                                         \
 uint32_t                                                                \
@@ -646,10 +647,10 @@  __attribute__((__target__("avx512vl")))                                 \
 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);    \
 }
 
 /* Each profile gets a single declare here, which specializes the function
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 c70f1fca9..b26603a57 100644
--- a/lib/dpif-netdev-private-extract.c
+++ b/lib/dpif-netdev-private-extract.c
@@ -251,7 +251,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];
@@ -296,7 +297,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 14365219e..1327dd7cb 100644
--- a/lib/dpif-netdev-private-extract.h
+++ b/lib/dpif-netdev-private-extract.h
@@ -36,7 +36,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);
 
 
 /* The function pointer miniflow_extract_func depends on batch size. */
@@ -157,7 +158,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
@@ -169,7 +171,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
@@ -192,12 +195,12 @@  int32_t mfex_avx512_vbmi_probe(void);
     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);