lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 12 Feb 2016 10:13:25 +0000
From:	Paul Durrant <paul.durrant@...rix.com>
To:	<netdev@...r.kernel.org>, <xen-devel@...ts.xenproject.org>
CC:	Paul Durrant <paul.durrant@...rix.com>,
	Ian Campbell <ian.campbell@...rix.com>,
	Wei Liu <wei.liu2@...rix.com>
Subject: [PATCH net-next v1 8/8] xen-netback: use toeplitz hash value from the frontend

This patch adds code to xen-netback to use the value in a toeplitz hash
extra info fragment passed from the VM frontend in a transmit-side packet
to set the skb hash accordingly.

Signed-off-by: Paul Durrant <paul.durrant@...rix.com>
Cc: Ian Campbell <ian.campbell@...rix.com>
Cc: Wei Liu <wei.liu2@...rix.com>
---
 drivers/net/xen-netback/netback.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 57c91fe..f550b8a 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1341,6 +1341,28 @@ void xenvif_mcast_addr_list_free(struct xenvif *vif)
 	}
 }
 
+static void xenvif_set_skb_hash(struct xenvif *vif,
+				struct sk_buff *skb,
+				struct xen_netif_extra_info *extra)
+{
+	u32 hash = *(u32 *)extra->u.toeplitz.value;
+	enum pkt_hash_types type = PKT_HASH_TYPE_NONE;
+
+	switch (extra->u.toeplitz.type) {
+	case _XEN_NETIF_CTRL_TOEPLITZ_HASH_IPV4:
+	case _XEN_NETIF_CTRL_TOEPLITZ_HASH_IPV6:
+		type = PKT_HASH_TYPE_L3;
+		break;
+
+	case _XEN_NETIF_CTRL_TOEPLITZ_HASH_IPV4_TCP:
+	case _XEN_NETIF_CTRL_TOEPLITZ_HASH_IPV6_TCP:
+		type = PKT_HASH_TYPE_L4;
+		break;
+	}
+
+	skb_set_hash(skb, hash, type);
+}
+
 static void xenvif_tx_build_gops(struct xenvif_queue *queue,
 				     int budget,
 				     unsigned *copy_ops,
@@ -1502,6 +1524,13 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
 			}
 		}
 
+		if (extras[XEN_NETIF_EXTRA_TYPE_TOEPLITZ - 1].type) {
+			struct xen_netif_extra_info *extra;
+
+			extra = &extras[XEN_NETIF_EXTRA_TYPE_TOEPLITZ - 1];
+			xenvif_set_skb_hash(queue->vif, skb, extra);
+		}
+
 		XENVIF_TX_CB(skb)->pending_idx = pending_idx;
 
 		__skb_put(skb, data_len);
-- 
2.1.4

Powered by blists - more mailing lists