Skip to content

Commit

Permalink
netdev-dpdk: Reset RSS hash when receiving from a vhost device.
Browse files Browse the repository at this point in the history
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 <[email protected]>
CC: Traynor, Kevin <[email protected]>
CC: Flavio Leitner <[email protected]>
Signed-off-by: Daniele Di Proietto <[email protected]>
Acked-by: Flavio Leitner <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
  • Loading branch information
ddiproietto authored and Pravin B Shelar committed Jun 25, 2015
1 parent 534caf0 commit ab09c9f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit ab09c9f

Please sign in to comment.