netdev-dpdk: Reset RSS hash when receiving from a vhost device.
authorDaniele Di Proietto <diproiettod@vmware.com>
Wed, 24 Jun 2015 15:55:40 +0000 (08:55 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Thu, 25 Jun 2015 18:19:04 +0000 (11:19 -0700)
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@dtdream.com>
CC: Traynor, Kevin <kevin.traynor@intel.com>
CC: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/netdev-dpdk.c

index 8b843db..da2266b 100644 (file)
@@ -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);