linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next,1/3] hv_netvsc: Use per socket hash when available
@ 2017-04-09  0:53 Haiyang Zhang
  2017-04-09  0:54 ` [PATCH net-next,2/3] hv_netvsc: Fix the queue index computation in forwarding case Haiyang Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Haiyang Zhang @ 2017-04-09  0:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: haiyangz, kys, olaf, vkuznets, linux-kernel

From: Haiyang Zhang <haiyangz@microsoft.com>

The per socket hash is set when a socket is connected. Use it, when
available, to save CPU cycles on repeatedly computing hash on the same
connection.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/net/hyperv/netvsc_drv.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index f24c289..0a129cb 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -211,9 +211,14 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
 	int q_idx = sk_tx_queue_get(sk);
 
 	if (q_idx < 0 || skb->ooo_okay || q_idx >= num_tx_queues) {
-		u16 hash = __skb_tx_hash(ndev, skb, VRSS_SEND_TAB_SIZE);
+		u16 hash;
 		int new_idx;
 
+		if (sk)
+			skb_set_hash_from_sk(skb, sk);
+
+		hash = __skb_tx_hash(ndev, skb, VRSS_SEND_TAB_SIZE);
+
 		new_idx = net_device_ctx->tx_send_table[hash] % num_tx_queues;
 
 		if (q_idx != new_idx && sk &&
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-12 16:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-09  0:53 [PATCH net-next,1/3] hv_netvsc: Use per socket hash when available Haiyang Zhang
2017-04-09  0:54 ` [PATCH net-next,2/3] hv_netvsc: Fix the queue index computation in forwarding case Haiyang Zhang
2017-04-09  0:54 ` [PATCH net-next,3/3] hv_netvsc: Exclude non-TCP port numbers from vRSS hashing Haiyang Zhang
2017-04-12  2:12 ` [PATCH net-next,1/3] hv_netvsc: Use per socket hash when available David Miller
2017-04-12 16:24   ` Haiyang Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).