mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
Improve HW checksums support in VNIC
- Do not mark CSUM_IP_CHECKED and CSUM_IP_VALID on IPv6 packets. IPv6 does not have checksums by definition. - Set SCTP packets csum_flags CSUM_SCTP_VALID instead of CSUM_DATA_VALID and skip csum_data - Set csum_data simply as 0xffff without byteswap Pointed out by: yongari Reviewed by: yongari, wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5537
This commit is contained in:
parent
d6d108caa1
commit
c890792330
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297389
@ -1771,7 +1771,6 @@ nicvf_sq_add_hdr_subdesc(struct snd_queue *sq, int qentry,
|
||||
}
|
||||
|
||||
ip = (struct ip *)(mbuf->m_data + ehdrlen);
|
||||
ip->ip_sum = 0;
|
||||
iphlen = ip->ip_hl << 2;
|
||||
poff = ehdrlen + iphlen;
|
||||
|
||||
@ -1984,19 +1983,23 @@ nicvf_get_rcv_mbuf(struct nicvf *nic, struct cqe_rx_t *cqe_rx)
|
||||
/*
|
||||
* HW by default verifies IP & TCP/UDP/SCTP checksums
|
||||
*/
|
||||
|
||||
/* XXX: Do we need to include IP with options too? */
|
||||
if (__predict_true(cqe_rx->l3_type == L3TYPE_IPV4 ||
|
||||
cqe_rx->l3_type == L3TYPE_IPV6)) {
|
||||
if (__predict_true(cqe_rx->l3_type == L3TYPE_IPV4)) {
|
||||
mbuf->m_pkthdr.csum_flags =
|
||||
(CSUM_IP_CHECKED | CSUM_IP_VALID);
|
||||
}
|
||||
if (cqe_rx->l4_type == L4TYPE_TCP ||
|
||||
cqe_rx->l4_type == L4TYPE_UDP ||
|
||||
cqe_rx->l4_type == L4TYPE_SCTP) {
|
||||
|
||||
switch (cqe_rx->l4_type) {
|
||||
case L4TYPE_UDP:
|
||||
case L4TYPE_TCP: /* fall through */
|
||||
mbuf->m_pkthdr.csum_flags |=
|
||||
(CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
|
||||
mbuf->m_pkthdr.csum_data = htons(0xffff);
|
||||
mbuf->m_pkthdr.csum_data = 0xffff;
|
||||
break;
|
||||
case L4TYPE_SCTP:
|
||||
mbuf->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user