linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] netvsc: RSS related patches
@ 2019-11-01 23:42 Stephen Hemminger
  2019-11-01 23:42 ` [PATCH net-next 1/2] hv_netvsc: flag software created hash value Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stephen Hemminger @ 2019-11-01 23:42 UTC (permalink / raw)
  To: davem, haiyangz, kys, sashal; +Cc: netdev, linux-hyperv, Stephen Hemminger

Address a couple of issues related to recording RSS hash
value in skb. These were found by reviewing RSS support.

Stephen Hemminger (2):
  hv_netvsc: flag software created hash value
  hv_netvsc: record hardware hash in skb

 drivers/net/hyperv/hyperv_net.h   |  1 +
 drivers/net/hyperv/netvsc_drv.c   | 11 +++++++----
 drivers/net/hyperv/rndis_filter.c |  8 +++++++-
 3 files changed, 15 insertions(+), 5 deletions(-)

-- 
2.20.1


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

* [PATCH net-next 1/2] hv_netvsc: flag software created hash value
  2019-11-01 23:42 [PATCH net-next 0/2] netvsc: RSS related patches Stephen Hemminger
@ 2019-11-01 23:42 ` Stephen Hemminger
  2019-11-01 23:42 ` [PATCH net-next 2/2] hv_netvsc: record hardware hash in skb Stephen Hemminger
  2019-11-05 22:02 ` [PATCH net-next 0/2] netvsc: RSS related patches David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2019-11-01 23:42 UTC (permalink / raw)
  To: davem, haiyangz, kys, sashal; +Cc: netdev, linux-hyperv, Stephen Hemminger

From: Stephen Hemminger <sthemmin@microsoft.com>

When the driver needs to create a hash value because it
was not done at higher level, then the hash should be marked
as a software not hardware hash.

Fixes: f72860afa2e3 ("hv_netvsc: Exclude non-TCP port numbers from vRSS hashing")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/net/hyperv/netvsc_drv.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 39dddcd8b3cb..fa56fcde9f8b 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -285,9 +285,9 @@ static inline u32 netvsc_get_hash(
 		else if (flow.basic.n_proto == htons(ETH_P_IPV6))
 			hash = jhash2((u32 *)&flow.addrs.v6addrs, 8, hashrnd);
 		else
-			hash = 0;
+			return 0;
 
-		skb_set_hash(skb, hash, PKT_HASH_TYPE_L3);
+		__skb_set_sw_hash(skb, hash, false);
 	}
 
 	return hash;
@@ -795,8 +795,7 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
 	    skb->protocol == htons(ETH_P_IP))
 		netvsc_comp_ipcsum(skb);
 
-	/* Do L4 checksum offload if enabled and present.
-	 */
+	/* Do L4 checksum offload if enabled and present. */
 	if (csum_info && (net->features & NETIF_F_RXCSUM)) {
 		if (csum_info->receive.tcp_checksum_succeeded ||
 		    csum_info->receive.udp_checksum_succeeded)
-- 
2.20.1


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

* [PATCH net-next 2/2] hv_netvsc: record hardware hash in skb
  2019-11-01 23:42 [PATCH net-next 0/2] netvsc: RSS related patches Stephen Hemminger
  2019-11-01 23:42 ` [PATCH net-next 1/2] hv_netvsc: flag software created hash value Stephen Hemminger
@ 2019-11-01 23:42 ` Stephen Hemminger
  2019-11-05 23:13   ` Eric Dumazet
  2019-11-05 22:02 ` [PATCH net-next 0/2] netvsc: RSS related patches David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2019-11-01 23:42 UTC (permalink / raw)
  To: davem, haiyangz, kys, sashal; +Cc: netdev, linux-hyperv, Stephen Hemminger

From: Stephen Hemminger <sthemmin@microsoft.com>

Since RSS hash is available from the host, record it in
the skb.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/net/hyperv/hyperv_net.h   | 1 +
 drivers/net/hyperv/netvsc_drv.c   | 4 ++++
 drivers/net/hyperv/rndis_filter.c | 8 +++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 670ef682f268..4209d1cf57f6 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -853,6 +853,7 @@ struct multi_recv_comp {
 struct nvsc_rsc {
 	const struct ndis_pkt_8021q_info *vlan;
 	const struct ndis_tcp_ip_checksum_info *csum_info;
+	const u32 *hash_info;
 	u8 is_last; /* last RNDIS msg in a vmtransfer_page */
 	u32 cnt; /* #fragments in an RSC packet */
 	u32 pktlen; /* Full packet length */
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index fa56fcde9f8b..01b0d15ac681 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -766,6 +766,7 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
 	const struct ndis_pkt_8021q_info *vlan = nvchan->rsc.vlan;
 	const struct ndis_tcp_ip_checksum_info *csum_info =
 						nvchan->rsc.csum_info;
+	const u32 *hash_info = nvchan->rsc.hash_info;
 	struct sk_buff *skb;
 	int i;
 
@@ -802,6 +803,9 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
 	}
 
+	if (hash_info)
+		skb_set_hash(skb, *hash_info, PKT_HASH_TYPE_L4);
+
 	if (vlan) {
 		u16 vlan_tci = vlan->vlanid | (vlan->pri << VLAN_PRIO_SHIFT) |
 			(vlan->cfi ? VLAN_CFI_MASK : 0);
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index abaf8156d19d..c06178380ac8 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -358,6 +358,7 @@ static inline
 void rsc_add_data(struct netvsc_channel *nvchan,
 		  const struct ndis_pkt_8021q_info *vlan,
 		  const struct ndis_tcp_ip_checksum_info *csum_info,
+		  const u32 *hash_info,
 		  void *data, u32 len)
 {
 	u32 cnt = nvchan->rsc.cnt;
@@ -368,6 +369,7 @@ void rsc_add_data(struct netvsc_channel *nvchan,
 		nvchan->rsc.vlan = vlan;
 		nvchan->rsc.csum_info = csum_info;
 		nvchan->rsc.pktlen = len;
+		nvchan->rsc.hash_info = hash_info;
 	}
 
 	nvchan->rsc.data[cnt] = data;
@@ -385,6 +387,7 @@ static int rndis_filter_receive_data(struct net_device *ndev,
 	const struct ndis_tcp_ip_checksum_info *csum_info;
 	const struct ndis_pkt_8021q_info *vlan;
 	const struct rndis_pktinfo_id *pktinfo_id;
+	const u32 *hash_info;
 	u32 data_offset;
 	void *data;
 	bool rsc_more = false;
@@ -411,6 +414,8 @@ static int rndis_filter_receive_data(struct net_device *ndev,
 
 	csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO, 0);
 
+	hash_info = rndis_get_ppi(rndis_pkt, NBL_HASH_VALUE, 0);
+
 	pktinfo_id = rndis_get_ppi(rndis_pkt, RNDIS_PKTINFO_ID, 1);
 
 	data = (void *)msg + data_offset;
@@ -441,7 +446,8 @@ static int rndis_filter_receive_data(struct net_device *ndev,
 	 * rndis_pkt->data_len tell us the real data length, we only copy
 	 * the data packet to the stack, without the rndis trailer padding
 	 */
-	rsc_add_data(nvchan, vlan, csum_info, data, rndis_pkt->data_len);
+	rsc_add_data(nvchan, vlan, csum_info, hash_info,
+		     data, rndis_pkt->data_len);
 
 	if (rsc_more)
 		return NVSP_STAT_SUCCESS;
-- 
2.20.1


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

* Re: [PATCH net-next 0/2] netvsc: RSS related patches
  2019-11-01 23:42 [PATCH net-next 0/2] netvsc: RSS related patches Stephen Hemminger
  2019-11-01 23:42 ` [PATCH net-next 1/2] hv_netvsc: flag software created hash value Stephen Hemminger
  2019-11-01 23:42 ` [PATCH net-next 2/2] hv_netvsc: record hardware hash in skb Stephen Hemminger
@ 2019-11-05 22:02 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-11-05 22:02 UTC (permalink / raw)
  To: stephen; +Cc: haiyangz, kys, sashal, netdev, linux-hyperv

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri,  1 Nov 2019 16:42:36 -0700

> Address a couple of issues related to recording RSS hash
> value in skb. These were found by reviewing RSS support.

Series applied.

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

* Re: [PATCH net-next 2/2] hv_netvsc: record hardware hash in skb
  2019-11-01 23:42 ` [PATCH net-next 2/2] hv_netvsc: record hardware hash in skb Stephen Hemminger
@ 2019-11-05 23:13   ` Eric Dumazet
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2019-11-05 23:13 UTC (permalink / raw)
  To: Stephen Hemminger, davem, haiyangz, kys, sashal
  Cc: netdev, linux-hyperv, Stephen Hemminger



On 11/1/19 4:42 PM, Stephen Hemminger wrote:
> From: Stephen Hemminger <sthemmin@microsoft.com>
> 
> Since RSS hash is available from the host, record it in
> the skb.
>

Note that drivers are supposed to do this only if (dev->features & NETIF_F_RXHASH) is true...



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

end of thread, other threads:[~2019-11-05 23:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01 23:42 [PATCH net-next 0/2] netvsc: RSS related patches Stephen Hemminger
2019-11-01 23:42 ` [PATCH net-next 1/2] hv_netvsc: flag software created hash value Stephen Hemminger
2019-11-01 23:42 ` [PATCH net-next 2/2] hv_netvsc: record hardware hash in skb Stephen Hemminger
2019-11-05 23:13   ` Eric Dumazet
2019-11-05 22:02 ` [PATCH net-next 0/2] netvsc: RSS related patches David Miller

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).