hyperv/hn: Don't set HASHVAL pktinfo for NDIS < 6.30

This unbreaks packet sending on WS2008R2.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8057
This commit is contained in:
Sepherosa Ziehau 2016-09-29 05:13:58 +00:00
parent e77ed95960
commit a53b5f81c2
2 changed files with 18 additions and 9 deletions

View File

@ -168,6 +168,7 @@ struct hn_tx_ring {
struct buf_ring *hn_mbuf_br;
int hn_oactive;
int hn_tx_idx;
int hn_tx_flags;
struct mtx hn_tx_lock;
struct hn_softc *hn_sc;
@ -194,10 +195,10 @@ struct hn_tx_ring {
struct hn_txdesc *hn_txdesc;
bus_dma_tag_t hn_tx_rndis_dtag;
struct sysctl_oid *hn_tx_sysctl_tree;
int hn_tx_flags;
} __aligned(CACHE_LINE_SIZE);
#define HN_TX_FLAG_ATTACHED 0x1
#define HN_TX_FLAG_HASHVAL 0x2 /* support HASHVAL pktinfo */
/*
* Device-specific softc structure

View File

@ -1006,14 +1006,16 @@ hn_encap(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head0)
pkt->rm_pktinfooffset = sizeof(*pkt);
pkt->rm_pktinfolen = 0;
/*
* Set the hash value for this packet, so that the host could
* dispatch the TX done event for this packet back to this TX
* ring's channel.
*/
pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN,
HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL);
*pi_data = txr->hn_tx_idx;
if (txr->hn_tx_flags & HN_TX_FLAG_HASHVAL) {
/*
* Set the hash value for this packet, so that the host could
* dispatch the TX done event for this packet back to this TX
* ring's channel.
*/
pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN,
HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL);
*pi_data = txr->hn_tx_idx;
}
if (m_head->m_flags & M_VLANTAG) {
pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN,
@ -2920,6 +2922,12 @@ hn_fixup_tx_data(struct hn_softc *sc)
for (i = 0; i < sc->hn_tx_ring_cnt; ++i)
sc->hn_tx_ring[i].hn_csum_assist = csum_assist;
if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) {
/* Support HASHVAL pktinfo on TX path. */
for (i = 0; i < sc->hn_tx_ring_cnt; ++i)
sc->hn_tx_ring[i].hn_tx_flags |= HN_TX_FLAG_HASHVAL;
}
}
static void