diff mbox

[ovs-dev,2/3] dpif-netdev: drop swapping

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

Commit Message

Andy Zhou Jan. 27, 2016, 9:31 p.m. UTC
emc_processing() moves all the missed packets towards the beginning of
packet array; matched packets are queued up into flow queues. Since the
remaining of the packet array is not used anymore, don't bother swap
packet pointers to save cycles and simplify logic.

Signed-off-by: Andy Zhou <azhou@ovn.org>
---
 lib/dpif-netdev.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index dec06fc..a7e15aa 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3188,14 +3188,6 @@  dp_netdev_queue_batches(struct dp_packet *pkt,
     packet_batch_update(batch, pkt, mf);
 }
 
-static inline void
-dp_packet_swap(struct dp_packet **a, struct dp_packet **b)
-{
-    struct dp_packet *tmp = *a;
-    *a = *b;
-    *b = tmp;
-}
-
 /* Try to process all ('cnt') the 'packets' using only the exact match cache
  * 'flow_cache'. If a flow is not found for a packet 'packets[i]', the
  * miniflow is copied into 'keys' and the packet pointer is moved at the
@@ -3236,10 +3228,9 @@  emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
             dp_netdev_queue_batches(packets[i], flow, &key.mf, batches,
                                     n_batches);
         } else {
-            if (i != n_missed) {
-                dp_packet_swap(&packets[i], &packets[n_missed]);
-            }
-
+            /* Exact match cache missed. Group missed packets together at
+             * the beginning of the 'packets' array.  */
+            packets[n_missed] = packets[i];
             keys[n_missed++] = key;
         }
     }