svn commit: r296252 - head/sys/dev/hyperv/netvsc
Sepherosa Ziehau
sephe at FreeBSD.org
Tue Mar 1 04:59:20 UTC 2016
Author: sephe
Date: Tue Mar 1 04:59:18 2016
New Revision: 296252
URL: https://svnweb.freebsd.org/changeset/base/296252
Log:
hyperv/hn: Set hash per-packet-info for each packet transmission
So that the host could dispatch the TX done back to this TX ring's
owner channel
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5498
Modified:
head/sys/dev/hyperv/netvsc/hv_net_vsc.h
head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
head/sys/dev/hyperv/netvsc/hv_rndis.h
Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Mar 1 03:41:48 2016 (r296251)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Mar 1 04:59:18 2016 (r296252)
@@ -1039,6 +1039,7 @@ struct hn_tx_ring {
struct buf_ring *hn_mbuf_br;
int hn_oactive;
+ int hn_tx_idx;
struct mtx hn_tx_lock;
struct hn_softc *hn_sc;
Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Mar 1 03:41:48 2016 (r296251)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Mar 1 04:59:18 2016 (r296252)
@@ -138,6 +138,7 @@ __FBSDID("$FreeBSD$");
#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 @@ hn_encap(struct hn_tx_ring *txr, struct
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 @@ hn_encap(struct hn_tx_ring *txr, struct
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 @@ hn_create_tx_ring(struct hn_softc *sc, i
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);
Modified: head/sys/dev/hyperv/netvsc/hv_rndis.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis.h Tue Mar 1 03:41:48 2016 (r296251)
+++ head/sys/dev/hyperv/netvsc/hv_rndis.h Tue Mar 1 04:59:18 2016 (r296252)
@@ -608,6 +608,8 @@ typedef enum ndis_per_pkt_infotype_ {
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 @@ typedef struct ndis_8021q_info_ {
} 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 @@ typedef struct rndis_tcp_tso_info_ {
};
} 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))
More information about the svn-src-head
mailing list