xen-netback: pass hash value to the frontend

My recent patch to include/xen/interface/io/netif.h defines a new extra
info type that can be used to pass hash values between backend and guest
frontend.

This patch adds code to xen-netback to pass hash values calculated for
guest receive-side packets (i.e. netback transmit side) to the frontend.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Paul Durrant
2016-05-13 09:37:28 +01:00
committed by David S. Miller
parent 40d8abdee8
commit f07f989338
2 changed files with 77 additions and 14 deletions

View File

@@ -158,8 +158,17 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
struct xenvif *vif = netdev_priv(dev);
unsigned int size = vif->hash.size;
if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
return fallback(dev, skb) % dev->real_num_tx_queues;
if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) {
u16 index = fallback(dev, skb) % dev->real_num_tx_queues;
/* Make sure there is no hash information in the socket
* buffer otherwise it would be incorrectly forwarded
* to the frontend.
*/
skb_clear_hash(skb);
return index;
}
xenvif_set_skb_hash(vif, skb);