hyperv/hn: Avoid bit fields for LSOv2 setup.
MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7786
This commit is contained in:
parent
6f4440fbaa
commit
9dd95eb0d4
@ -910,6 +910,7 @@ hn_encap(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head0)
|
||||
}
|
||||
|
||||
if (m_head->m_pkthdr.csum_flags & CSUM_TSO) {
|
||||
#if defined(INET6) || defined(INET)
|
||||
rndis_tcp_tso_info *tso_info;
|
||||
struct ether_vlan_header *eh;
|
||||
int ether_len;
|
||||
@ -929,8 +930,6 @@ hn_encap(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head0)
|
||||
|
||||
tso_info = (rndis_tcp_tso_info *)((uint8_t *)rppi +
|
||||
rppi->per_packet_info_offset);
|
||||
tso_info->lso_v2_xmit.type =
|
||||
RNDIS_TCP_LARGE_SEND_OFFLOAD_V2_TYPE;
|
||||
|
||||
#ifdef INET
|
||||
if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) {
|
||||
@ -940,13 +939,12 @@ hn_encap(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head0)
|
||||
struct tcphdr *th =
|
||||
(struct tcphdr *)((caddr_t)ip + iph_len);
|
||||
|
||||
tso_info->lso_v2_xmit.ip_version =
|
||||
RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV4;
|
||||
ip->ip_len = 0;
|
||||
ip->ip_sum = 0;
|
||||
|
||||
th->th_sum = in_pseudo(ip->ip_src.s_addr,
|
||||
ip->ip_dst.s_addr, htons(IPPROTO_TCP));
|
||||
tso_info->value = NDIS_LSO2_INFO_MAKEIPV4(0,
|
||||
m_head->m_pkthdr.tso_segsz);
|
||||
}
|
||||
#endif
|
||||
#if defined(INET6) && defined(INET)
|
||||
@ -958,14 +956,13 @@ hn_encap(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head0)
|
||||
(m_head->m_data + ether_len);
|
||||
struct tcphdr *th = (struct tcphdr *)(ip6 + 1);
|
||||
|
||||
tso_info->lso_v2_xmit.ip_version =
|
||||
RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV6;
|
||||
ip6->ip6_plen = 0;
|
||||
th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0);
|
||||
tso_info->value = NDIS_LSO2_INFO_MAKEIPV6(0,
|
||||
m_head->m_pkthdr.tso_segsz);
|
||||
}
|
||||
#endif
|
||||
tso_info->lso_v2_xmit.tcp_header_offset = 0;
|
||||
tso_info->lso_v2_xmit.mss = m_head->m_pkthdr.tso_segsz;
|
||||
#endif /* INET6 || INET */
|
||||
} else if (m_head->m_pkthdr.csum_flags & txr->hn_csum_assist) {
|
||||
rndis_tcp_ip_csum_info *csum_info;
|
||||
|
||||
|
@ -231,4 +231,21 @@ struct ndis_rssprm_toeplitz {
|
||||
#define NDIS_RXCSUM_INFO_TCPCS_INVAL 0x0080
|
||||
#define NDIS_RXCSUM_INFO_IPCS_INVAL 0x0100
|
||||
|
||||
/* LSOv2 */
|
||||
#define NDIS_LSO2_INFO_MSS_MASK 0x000fffff
|
||||
#define NDIS_LSO2_INFO_THOFF_MASK 0x3ff00000
|
||||
#define NDIS_LSO2_INFO_ISLSO2 0x40000000
|
||||
#define NDIS_LSO2_INFO_ISIPV6 0x80000000
|
||||
|
||||
#define NDIS_LSO2_INFO_MAKE(thoff, mss) \
|
||||
((((uint32_t)(mss)) & NDIS_LSO2_INFO_MSS_MASK) | \
|
||||
((((uint32_t)(thoff)) & 0x3ff) << 20) | \
|
||||
NDIS_LSO2_INFO_ISLSO2)
|
||||
|
||||
#define NDIS_LSO2_INFO_MAKEIPV4(thoff, mss) \
|
||||
NDIS_LSO2_INFO_MAKE((thoff), (mss))
|
||||
|
||||
#define NDIS_LSO2_INFO_MAKEIPV6(thoff, mss) \
|
||||
(NDIS_LSO2_INFO_MAKE((thoff), (mss)) | NDIS_LSO2_INFO_ISIPV6)
|
||||
|
||||
#endif /* !_NET_NDIS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user