hyperv/hn: Avoid bit fields for TXCSUM setup.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7792
This commit is contained in:
Sepherosa Ziehau 2016-09-07 05:27:43 +00:00
parent a2fe9079a8
commit 5761f5dfdd
2 changed files with 16 additions and 8 deletions

View File

@ -972,16 +972,14 @@ hn_encap(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head0)
csum_info = (rndis_tcp_ip_csum_info *)((uint8_t *)rppi +
rppi->per_packet_info_offset);
csum_info->xmit.is_ipv4 = 1;
csum_info->value = NDIS_TXCSUM_INFO_IPV4;
if (m_head->m_pkthdr.csum_flags & CSUM_IP)
csum_info->xmit.ip_header_csum = 1;
csum_info->value |= NDIS_TXCSUM_INFO_IPCS;
if (m_head->m_pkthdr.csum_flags & CSUM_TCP) {
csum_info->xmit.tcp_csum = 1;
csum_info->xmit.tcp_header_offset = 0;
} else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) {
csum_info->xmit.udp_csum = 1;
}
if (m_head->m_pkthdr.csum_flags & CSUM_TCP)
csum_info->value |= NDIS_TXCSUM_INFO_TCPCS;
else if (m_head->m_pkthdr.csum_flags & CSUM_UDP)
csum_info->value |= NDIS_TXCSUM_INFO_UDPCS;
}
rndis_mesg->msg_len = tot_data_buf_len + rndis_msg_size;

View File

@ -232,6 +232,7 @@ struct ndis_rssprm_toeplitz {
#define NDIS_RXCSUM_INFO_IPCS_INVAL 0x0100
/* LSOv2 */
#define NDIS_LSO2_INFO_SIZE sizeof(uint32_t)
#define NDIS_LSO2_INFO_MSS_MASK 0x000fffff
#define NDIS_LSO2_INFO_THOFF_MASK 0x3ff00000
#define NDIS_LSO2_INFO_ISLSO2 0x40000000
@ -248,4 +249,13 @@ struct ndis_rssprm_toeplitz {
#define NDIS_LSO2_INFO_MAKEIPV6(thoff, mss) \
(NDIS_LSO2_INFO_MAKE((thoff), (mss)) | NDIS_LSO2_INFO_ISIPV6)
/* Transmission checksum */
#define NDIS_TXCSUM_INFO_SIZE sizeof(uint32_t)
#define NDIS_TXCSUM_INFO_IPV4 0x00000001
#define NDIS_TXCSUM_INFO_IPV6 0x00000002
#define NDIS_TXCSUM_INFO_TCPCS 0x00000004
#define NDIS_TXCSUM_INFO_UDPCS 0x00000008
#define NDIS_TXCSUM_INFO_IPCS 0x00000010
#define NDIS_TXCSUM_INFO_THOFF 0x03ff0000
#endif /* !_NET_NDIS_H_ */