[ovs-dev] [PATCH 2/2] netdev-dpdk: Reset RSS hash when receiving from a vhost device.

Daniele Di Proietto diproiettod at vmware.com
Wed Jun 24 15:55:40 UTC 2015


A vhost device, being a virtual interface, doesn't provide a valid RSS
hash.  As a workaround we set the value to 0, which suggests the
datapath to recompute the hash in software.

Reported-by: Dongjun <dongj at dtdream.com>
CC: Traynor, Kevin <kevin.traynor at intel.com>
CC: Flavio Leitner <fbl at sysclose.org>
Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
---
 lib/netdev-dpdk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index c03ff3d..7565462 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -897,6 +897,7 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq_,
     struct virtio_net *virtio_dev = netdev_dpdk_get_virtio(vhost_dev);
     int qid = 1;
     uint16_t nb_rx = 0;
+    uint16_t i;
 
     if (OVS_UNLIKELY(!is_vhost_running(virtio_dev))) {
         return EAGAIN;
@@ -910,6 +911,14 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq_,
         return EAGAIN;
     }
 
+    /* Vhost doesn't provide a valid RSS hash.  We tell the datapath to
+     * compute the hash in software by setting the field to 0.  This is
+     * a temporary workaround until we can rely on mbuf ol_flags
+     * PKT_RX_RSS_HASH. */
+    for (i = 0; i < nb_rx; i++) {
+        dp_packet_set_rss_hash(packets[i], 0);
+    }
+
     rte_spinlock_lock(&vhost_dev->stats_lock);
     vhost_dev->stats.rx_packets += (uint64_t)nb_rx;
     rte_spinlock_unlock(&vhost_dev->stats_lock);
-- 
2.1.4




More information about the dev mailing list