diff mbox

[ovs-dev,emc,processing,optimization,v2,(rebase),2/2] dpif-netdev: optmizing emc_processing()

Message ID 1454359580-24838-2-git-send-email-azhou@ovn.org
State Accepted
Headers show

Commit Message

Andy Zhou Feb. 1, 2016, 8:46 p.m. UTC
Commit d262ac2c60ce1da7b477737f70e8efd38b32502d introduced a slight
performance drop for the fast path, where every packets hits the
emc cache.  This patch removes that performance drop by only reloading
the key pointer on emc cache miss.

Sgned-off-by: Andy Zhou <azhou@ovn.org>
---
 lib/dpif-netdev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Daniele Di Proietto Feb. 2, 2016, 3:02 a.m. UTC | #1
Thanks for the patch!

Acked-by: Daniele Di Proietto <diproiettod@vmware.com>

On 01/02/2016 12:46, "Andy Zhou" <azhou@ovn.org> wrote:

>Commit d262ac2c60ce1da7b477737f70e8efd38b32502d introduced a slight
>performance drop for the fast path, where every packets hits the
>emc cache.  This patch removes that performance drop by only reloading
>the key pointer on emc cache miss.
>
>Sgned-off-by: Andy Zhou <azhou@ovn.org>

   ^typo



>---
> lib/dpif-netdev.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
>index c619b86..faf5d45 100644
>--- a/lib/dpif-netdev.c
>+++ b/lib/dpif-netdev.c
>@@ -3297,6 +3297,7 @@ emc_processing(struct dp_netdev_pmd_thread *pmd,
>struct dp_packet **packets,
>                struct packet_batch batches[], size_t *n_batches)
> {
>     struct emc_cache *flow_cache = &pmd->flow_cache;
>+    struct netdev_flow_key *key = &keys[0];
>     size_t i, n_missed = 0, n_dropped = 0;
> 
>     for (i = 0; i < cnt; i++) {
>@@ -3314,8 +3315,7 @@ emc_processing(struct dp_netdev_pmd_thread *pmd,
>struct dp_packet **packets,
>             OVS_PREFETCH(dp_packet_data(packets[i+1]));
>         }
> 
>-        struct netdev_flow_key *key = &keys[n_missed];
>-        miniflow_extract(packets[i], &key->mf);
>+        miniflow_extract(packet, &key->mf);
>         key->len = 0; /* Not computed yet. */
>         key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf);
> 
>@@ -3326,7 +3326,8 @@ emc_processing(struct dp_netdev_pmd_thread *pmd,
>struct dp_packet **packets,
>         } else {
>             /* Exact match cache missed. Group missed packets together at
>              * the beginning of the 'packets' array.  */
>-            packets[n_missed++] = packet;
>+            packets[n_missed] = packet;
>+            key = &keys[n_missed++];
>         }
>     }
> 
>-- 
>1.9.1
>
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>http://openvswitch.org/mailman/listinfo/dev
Andy Zhou Feb. 2, 2016, 8:01 p.m. UTC | #2
On Mon, Feb 1, 2016 at 7:02 PM, Daniele Di Proietto <diproiettod@vmware.com>
wrote:

> Thanks for the patch!
>
> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
>
> On 01/02/2016 12:46, "Andy Zhou" <azhou@ovn.org> wrote:
>
> >Commit d262ac2c60ce1da7b477737f70e8efd38b32502d introduced a slight
> >performance drop for the fast path, where every packets hits the
> >emc cache.  This patch removes that performance drop by only reloading
> >the key pointer on emc cache miss.
> >
> >Sgned-off-by: Andy Zhou <azhou@ovn.org>
>
>    ^typo
>
> Fixed and pushed to master. Thanks.
diff mbox

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c619b86..faf5d45 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3297,6 +3297,7 @@  emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
                struct packet_batch batches[], size_t *n_batches)
 {
     struct emc_cache *flow_cache = &pmd->flow_cache;
+    struct netdev_flow_key *key = &keys[0];
     size_t i, n_missed = 0, n_dropped = 0;
 
     for (i = 0; i < cnt; i++) {
@@ -3314,8 +3315,7 @@  emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
             OVS_PREFETCH(dp_packet_data(packets[i+1]));
         }
 
-        struct netdev_flow_key *key = &keys[n_missed];
-        miniflow_extract(packets[i], &key->mf);
+        miniflow_extract(packet, &key->mf);
         key->len = 0; /* Not computed yet. */
         key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf);
 
@@ -3326,7 +3326,8 @@  emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
         } else {
             /* Exact match cache missed. Group missed packets together at
              * the beginning of the 'packets' array.  */
-            packets[n_missed++] = packet;
+            packets[n_missed] = packet;
+            key = &keys[n_missed++];
         }
     }