]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/linux/0021-hyperv-Add-hash-value-into-RNDIS-Per-packet-info.patch
make.sh limit build to 23 parallel threads.
[ipfire-2.x.git] / src / patches / linux / 0021-hyperv-Add-hash-value-into-RNDIS-Per-packet-info.patch
1 From 1267d9b235e7612f8cdfa842a0433bb82e75f7fb Mon Sep 17 00:00:00 2001
2 From: Haiyang Zhang <haiyangz@microsoft.com>
3 Date: Wed, 21 May 2014 12:55:39 -0700
4 Subject: [PATCH 21/25] hyperv: Add hash value into RNDIS Per-packet info
5
6 It passes the hash value as the RNDIS Per-packet info to the Hyper-V host,
7 so that the send completion notices can be spread across multiple channels.
8 MS-TFS: 140273
9
10 Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
12 ---
13 drivers/net/hyperv/hyperv_net.h | 4 ++++
14 drivers/net/hyperv/netvsc_drv.c | 18 ++++++++++++++----
15 2 files changed, 18 insertions(+), 4 deletions(-)
16
17 diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
18 index 4b7df5a5c966..6cc37c15e0bf 100644
19 --- a/drivers/net/hyperv/hyperv_net.h
20 +++ b/drivers/net/hyperv/hyperv_net.h
21 @@ -791,6 +791,7 @@ enum ndis_per_pkt_info_type {
22 IEEE_8021Q_INFO,
23 ORIGINAL_PKTINFO,
24 PACKET_CANCEL_ID,
25 + NBL_HASH_VALUE = PACKET_CANCEL_ID,
26 ORIGINAL_NET_BUFLIST,
27 CACHED_NET_BUFLIST,
28 SHORT_PKT_PADINFO,
29 @@ -937,6 +938,9 @@ struct ndis_tcp_lso_info {
30 #define NDIS_LSO_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \
31 sizeof(struct ndis_tcp_lso_info))
32
33 +#define NDIS_HASH_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \
34 + sizeof(u32))
35 +
36 /* Format of Information buffer passed in a SetRequest for the OID */
37 /* OID_GEN_RNDIS_CONFIG_PARAMETER. */
38 struct rndis_config_parameter_info {
39 diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
40 index 346f1aeb9c24..bd3b3acd04dc 100644
41 --- a/drivers/net/hyperv/netvsc_drv.c
42 +++ b/drivers/net/hyperv/netvsc_drv.c
43 @@ -224,9 +224,11 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
44 if (nvsc_dev == NULL || ndev->real_num_tx_queues <= 1)
45 return 0;
46
47 - if (netvsc_set_hash(&hash, skb))
48 + if (netvsc_set_hash(&hash, skb)) {
49 q_idx = nvsc_dev->send_table[hash % VRSS_SEND_TAB_SIZE] %
50 ndev->real_num_tx_queues;
51 + skb_set_hash(skb, hash, PKT_HASH_TYPE_L3);
52 + }
53
54 return q_idx;
55 }
56 @@ -385,6 +387,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
57 struct ndis_tcp_lso_info *lso_info;
58 int hdr_offset;
59 u32 net_trans_info;
60 + u32 hash;
61
62
63 /* We will atmost need two pages to describe the rndis
64 @@ -403,9 +406,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
65 packet = kzalloc(sizeof(struct hv_netvsc_packet) +
66 (num_data_pgs * sizeof(struct hv_page_buffer)) +
67 sizeof(struct rndis_message) +
68 - NDIS_VLAN_PPI_SIZE +
69 - NDIS_CSUM_PPI_SIZE +
70 - NDIS_LSO_PPI_SIZE, GFP_ATOMIC);
71 + NDIS_VLAN_PPI_SIZE + NDIS_CSUM_PPI_SIZE +
72 + NDIS_LSO_PPI_SIZE + NDIS_HASH_PPI_SIZE, GFP_ATOMIC);
73 if (!packet) {
74 /* out of memory, drop packet */
75 netdev_err(net, "unable to allocate hv_netvsc_packet\n");
76 @@ -444,6 +446,14 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
77
78 rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet);
79
80 + hash = skb_get_hash_raw(skb);
81 + if (hash != 0 && net->real_num_tx_queues > 1) {
82 + rndis_msg_size += NDIS_HASH_PPI_SIZE;
83 + ppi = init_ppi_data(rndis_msg, NDIS_HASH_PPI_SIZE,
84 + NBL_HASH_VALUE);
85 + *(u32 *)((void *)ppi + ppi->ppi_offset) = hash;
86 + }
87 +
88 if (isvlan) {
89 struct ndis_pkt_8021q_info *vlan;
90
91 --
92 2.4.3
93