Skip to content

Commit 1fac7ca

Browse files
shemmingerdavem330
authored andcommitted
hv_netvsc: record hardware hash in skb
Since RSS hash is available from the host, record it in the skb. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent df9f540 commit 1fac7ca

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

drivers/net/hyperv/hyperv_net.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ struct multi_recv_comp {
853853
struct nvsc_rsc {
854854
const struct ndis_pkt_8021q_info *vlan;
855855
const struct ndis_tcp_ip_checksum_info *csum_info;
856+
const u32 *hash_info;
856857
u8 is_last; /* last RNDIS msg in a vmtransfer_page */
857858
u32 cnt; /* #fragments in an RSC packet */
858859
u32 pktlen; /* Full packet length */

drivers/net/hyperv/netvsc_drv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
766766
const struct ndis_pkt_8021q_info *vlan = nvchan->rsc.vlan;
767767
const struct ndis_tcp_ip_checksum_info *csum_info =
768768
nvchan->rsc.csum_info;
769+
const u32 *hash_info = nvchan->rsc.hash_info;
769770
struct sk_buff *skb;
770771
int i;
771772

@@ -802,6 +803,9 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
802803
skb->ip_summed = CHECKSUM_UNNECESSARY;
803804
}
804805

806+
if (hash_info)
807+
skb_set_hash(skb, *hash_info, PKT_HASH_TYPE_L4);
808+
805809
if (vlan) {
806810
u16 vlan_tci = vlan->vlanid | (vlan->pri << VLAN_PRIO_SHIFT) |
807811
(vlan->cfi ? VLAN_CFI_MASK : 0);

drivers/net/hyperv/rndis_filter.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ static inline
358358
void rsc_add_data(struct netvsc_channel *nvchan,
359359
const struct ndis_pkt_8021q_info *vlan,
360360
const struct ndis_tcp_ip_checksum_info *csum_info,
361+
const u32 *hash_info,
361362
void *data, u32 len)
362363
{
363364
u32 cnt = nvchan->rsc.cnt;
@@ -368,6 +369,7 @@ void rsc_add_data(struct netvsc_channel *nvchan,
368369
nvchan->rsc.vlan = vlan;
369370
nvchan->rsc.csum_info = csum_info;
370371
nvchan->rsc.pktlen = len;
372+
nvchan->rsc.hash_info = hash_info;
371373
}
372374

373375
nvchan->rsc.data[cnt] = data;
@@ -385,6 +387,7 @@ static int rndis_filter_receive_data(struct net_device *ndev,
385387
const struct ndis_tcp_ip_checksum_info *csum_info;
386388
const struct ndis_pkt_8021q_info *vlan;
387389
const struct rndis_pktinfo_id *pktinfo_id;
390+
const u32 *hash_info;
388391
u32 data_offset;
389392
void *data;
390393
bool rsc_more = false;
@@ -411,6 +414,8 @@ static int rndis_filter_receive_data(struct net_device *ndev,
411414

412415
csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO, 0);
413416

417+
hash_info = rndis_get_ppi(rndis_pkt, NBL_HASH_VALUE, 0);
418+
414419
pktinfo_id = rndis_get_ppi(rndis_pkt, RNDIS_PKTINFO_ID, 1);
415420

416421
data = (void *)msg + data_offset;
@@ -441,7 +446,8 @@ static int rndis_filter_receive_data(struct net_device *ndev,
441446
* rndis_pkt->data_len tell us the real data length, we only copy
442447
* the data packet to the stack, without the rndis trailer padding
443448
*/
444-
rsc_add_data(nvchan, vlan, csum_info, data, rndis_pkt->data_len);
449+
rsc_add_data(nvchan, vlan, csum_info, hash_info,
450+
data, rndis_pkt->data_len);
445451

446452
if (rsc_more)
447453
return NVSP_STAT_SUCCESS;

0 commit comments

Comments
 (0)