Index: head/sys/dev/hyperv/netvsc/hv_net_vsc.h =================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -1039,6 +1039,7 @@ struct buf_ring *hn_mbuf_br; int hn_oactive; + int hn_tx_idx; struct mtx hn_tx_lock; struct hn_softc *hn_sc; Index: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c =================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -138,6 +138,7 @@ #define HN_RNDIS_MSG_LEN \ (sizeof(rndis_msg) + \ + RNDIS_HASH_PPI_SIZE + \ RNDIS_VLAN_PPI_SIZE + \ RNDIS_TSO_PPI_SIZE + \ RNDIS_CSUM_PPI_SIZE) @@ -737,6 +738,7 @@ rndis_msg *rndis_mesg; rndis_packet *rndis_pkt; rndis_per_packet_info *rppi; + struct ndis_hash_info *hash_info; uint32_t rndis_msg_size; packet = &txd->netvsc_pkt; @@ -761,6 +763,18 @@ rndis_msg_size = RNDIS_MESSAGE_SIZE(rndis_packet); + /* + * Set the hash info for this packet, so that the host could + * dispatch the TX done event for this packet back to this TX + * ring's channel. + */ + rndis_msg_size += RNDIS_HASH_PPI_SIZE; + rppi = hv_set_rppi_data(rndis_mesg, RNDIS_HASH_PPI_SIZE, + nbl_hash_value); + hash_info = (struct ndis_hash_info *)((uint8_t *)rppi + + rppi->per_packet_info_offset); + hash_info->hash = txr->hn_tx_idx; + if (m_head->m_flags & M_VLANTAG) { ndis_8021q_info *rppi_vlan_info; @@ -2148,6 +2162,7 @@ int error, i; txr->hn_sc = sc; + txr->hn_tx_idx = id; #ifndef HN_USE_TXDESC_BUFRING mtx_init(&txr->hn_txlist_spin, "hn txlist", NULL, MTX_SPIN); Index: head/sys/dev/hyperv/netvsc/hv_rndis.h =================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis.h +++ head/sys/dev/hyperv/netvsc/hv_rndis.h @@ -608,6 +608,8 @@ max_perpkt_info } ndis_per_pkt_infotype; +#define nbl_hash_value pkt_cancel_id + typedef struct ndis_8021q_info_ { union { struct { @@ -620,6 +622,10 @@ } u1; } ndis_8021q_info; +struct ndis_hash_info { + uint32_t hash; +} __packed; + struct rndis_object_header { uint8_t type; uint8_t revision; @@ -713,6 +719,9 @@ }; } rndis_tcp_tso_info; +#define RNDIS_HASH_PPI_SIZE (sizeof(rndis_per_packet_info) + \ + sizeof(struct ndis_hash_info)) + #define RNDIS_VLAN_PPI_SIZE (sizeof(rndis_per_packet_info) + \ sizeof(ndis_8021q_info))