From: Antonio Fischetti <antonio.fische...@intel.com>

When EMC is disabled the reading of RSS hash is skipped.
For packets that are not recirculated it retrieves the hash
value without considering the recirc id.

This is mostly a preliminary change for the next patch in
this series.

Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com>
---
In our testbench we used monodirectional traffic with
64B UDP packets
PDM threads:  2
Traffic gen. streams: 1

we saw the following performance improvement:

Orig               11.49 Mpps
With Patch#1:      11.62 Mpps

 lib/dpif-netdev.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 02af32e..fd2ed52 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4584,13 +4584,33 @@ emc_processing(struct dp_netdev_pmd_thread *pmd,
 
         if (!md_is_valid) {
             pkt_metadata_init(&packet->md, port_no);
+            miniflow_extract(packet, &key->mf);
+            /* This is not a recirculated packet. */
+            if (OVS_LIKELY(cur_min)) {
+                /* EMC is enabled.  We can retrieve the 5-tuple hash
+                 * without considering the recirc id. */
+                if (OVS_LIKELY(dp_packet_rss_valid(packet))) {
+                    key->hash = dp_packet_get_rss_hash(packet);
+                } else {
+                    key->hash = miniflow_hash_5tuple(&key->mf, 0);
+                    dp_packet_set_rss_hash(packet, key->hash);
+                }
+                flow = emc_lookup(flow_cache, key);
+            } else {
+                /* EMC is disabled, skip emc_lookup. */
+                flow = NULL;
+            }
+        } else {
+            /* Recirculated packets. */
+            miniflow_extract(packet, &key->mf);
+            if (OVS_LIKELY(cur_min)) {
+                key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf);
+                flow = emc_lookup(flow_cache, key);
+            } else {
+                flow = NULL;
+            }
         }
-        miniflow_extract(packet, &key->mf);
         key->len = 0; /* Not computed yet. */
-        key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf);
-
-        /* If EMC is disabled skip emc_lookup */
-        flow = (cur_min == 0) ? NULL: emc_lookup(flow_cache, key);
         if (OVS_LIKELY(flow)) {
             dp_netdev_queue_batches(packet, flow, &key->mf, batches,
                                     n_batches);
-- 
2.4.11

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to