[ovs-dev] [PATCH] dpif-netdev: move header prefetch earlier into the receive function

Zoltan Kiss zoltan.kiss at linaro.org
Thu Sep 17 20:29:45 UTC 2015


It's better to have it in the cache as soon as possible. On my test setup it
meant a 0.7 Mpps increase.

Signed-off-by: Zoltan Kiss <zoltan.kiss at linaro.org>

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 72e5653..3312cc0 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3229,11 +3229,6 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
             continue;
         }
 
-        if (i != cnt - 1) {
-            /* Prefetch next packet data */
-            OVS_PREFETCH(dp_packet_data(packets[i+1]));
-        }
-
         miniflow_extract(packets[i], &key.mf);
         key.len = 0; /* Not computed yet. */
         key.hash = dpif_netdev_packet_get_rss_hash(packets[i], &key.mf);
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index e4e3d2c..c3c7ec0 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1015,7 +1015,7 @@ netdev_dpdk_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet **packets,
     struct netdev_rxq_dpdk *rx = netdev_rxq_dpdk_cast(rxq_);
     struct netdev *netdev = rx->up.netdev;
     struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
-    int nb_rx;
+    int nb_rx, i;
 
     /* There is only one tx queue for this core.  Do not flush other
      * queues.
@@ -1033,6 +1033,9 @@ netdev_dpdk_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet **packets,
         return EAGAIN;
     }
 
+    for (i = 0; i < nb_rx; i++)
+        OVS_PREFETCH(dp_packet_data(packets[i]));
+
     *c = nb_rx;
 
     return 0;




More information about the dev mailing list