Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_lro.c
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | tcp_lro_init_args(struct lro_ctrl *lc, struct ifnet *ifp, | ||||
lc->lro_bad_csum = 0; | lc->lro_bad_csum = 0; | ||||
lc->lro_queued = 0; | lc->lro_queued = 0; | ||||
lc->lro_flushed = 0; | lc->lro_flushed = 0; | ||||
lc->lro_cnt = 0; | lc->lro_cnt = 0; | ||||
lc->lro_mbuf_count = 0; | lc->lro_mbuf_count = 0; | ||||
lc->lro_mbuf_max = lro_mbufs; | lc->lro_mbuf_max = lro_mbufs; | ||||
lc->lro_cnt = lro_entries; | lc->lro_cnt = lro_entries; | ||||
lc->ifp = ifp; | lc->ifp = ifp; | ||||
lc->lro_ack_append_lim = 0; | |||||
lc->lro_data_append_lim = 0; | |||||
SLIST_INIT(&lc->lro_free); | SLIST_INIT(&lc->lro_free); | ||||
SLIST_INIT(&lc->lro_active); | SLIST_INIT(&lc->lro_active); | ||||
/* compute size to allocate */ | /* compute size to allocate */ | ||||
size = (lro_mbufs * sizeof(struct mbuf *)) + | size = (lro_mbufs * sizeof(struct mbuf *)) + | ||||
(lro_entries * sizeof(*le)); | (lro_entries * sizeof(*le)); | ||||
lc->lro_mbuf_data = (struct mbuf **) | lc->lro_mbuf_data = (struct mbuf **) | ||||
malloc(size, M_LRO, M_NOWAIT | M_ZERO); | malloc(size, M_LRO, M_NOWAIT | M_ZERO); | ||||
▲ Show 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | |||||
#ifdef TCP_LRO_UPDATE_CSUM | #ifdef TCP_LRO_UPDATE_CSUM | ||||
le->ulp_csum += tcp_lro_rx_csum_fixup(le, l3hdr, th, | le->ulp_csum += tcp_lro_rx_csum_fixup(le, l3hdr, th, | ||||
tcp_data_len, ~csum); | tcp_data_len, ~csum); | ||||
#endif | #endif | ||||
if (tcp_data_len == 0) { | if (tcp_data_len == 0) { | ||||
m_freem(m); | m_freem(m); | ||||
/* | |||||
* Flush this LRO entry, if this ACK should | |||||
* not be further delayed. | |||||
*/ | |||||
if (lc->lro_ack_append_lim && | |||||
gallatin: Can you just initialize ack_append_limit to the max value for whatever type it is and eliminate… | |||||
sepherosa_gmail.comAuthorUnsubmitted Not Done Inline ActionsSure :) sepherosa_gmail.com: Sure :) | |||||
le->append_cnt >= lc->lro_ack_append_lim) { | |||||
SLIST_REMOVE(&lc->lro_active, le, lro_entry, | |||||
next); | |||||
tcp_lro_flush(lc, le); | |||||
} | |||||
return (0); | return (0); | ||||
} | } | ||||
le->p_len += tcp_data_len; | le->p_len += tcp_data_len; | ||||
/* | /* | ||||
* Adjust the mbuf so that m_data points to the first byte of | * Adjust the mbuf so that m_data points to the first byte of | ||||
* the ULP payload. Adjust the mbuf to avoid complications and | * the ULP payload. Adjust the mbuf to avoid complications and | ||||
* append new segment to existing mbuf chain. | * append new segment to existing mbuf chain. | ||||
*/ | */ | ||||
m_adj(m, m->m_pkthdr.len - tcp_data_len); | m_adj(m, m->m_pkthdr.len - tcp_data_len); | ||||
m_demote_pkthdr(m); | m_demote_pkthdr(m); | ||||
le->m_tail->m_next = m; | le->m_tail->m_next = m; | ||||
le->m_tail = m_last(m); | le->m_tail = m_last(m); | ||||
/* | /* | ||||
* If a possible next full length packet would cause an | * If a possible next full length packet would cause an | ||||
* overflow, pro-actively flush now. | * overflow, pro-actively flush now. And if we are asked | ||||
* to limit the data aggregate, flush this LRO entry now. | |||||
*/ | */ | ||||
if (le->p_len > (65535 - lc->ifp->if_mtu)) { | if (le->p_len > (65535 - lc->ifp->if_mtu) || | ||||
(lc->lro_data_append_lim && | |||||
le->append_cnt >= lc->lro_data_append_lim)) { | |||||
gallatinUnsubmitted Not Done Inline ActionsRather than adding more clauses to this condition, how would to feel about setting an append limit in bytes, and replacing the hard-coded 65535 with this new limit? The default lro init would initialize the new limit to 65535. And hn(4) would initialize it in terms of multiples of its MTU. gallatin: Rather than adding more clauses to this condition, how would to feel about setting an append… | |||||
sepherosa_gmail.comAuthorUnsubmitted Not Done Inline ActionsSounds fine to me. I did the byte limit before (https://reviews.freebsd.org/D4825). But it turns out the ACKs need seperate limit (append count based). To make them consistent, I changed the original patch to use append count too. sepherosa_gmail.com: Sounds fine to me. I did the byte limit before (https://reviews.freebsd.org/D4825). But it… | |||||
SLIST_REMOVE(&lc->lro_active, le, lro_entry, next); | SLIST_REMOVE(&lc->lro_active, le, lro_entry, next); | ||||
tcp_lro_flush(lc, le); | tcp_lro_flush(lc, le); | ||||
} else | } else | ||||
getmicrotime(&le->mtime); | getmicrotime(&le->mtime); | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |
Can you just initialize ack_append_limit to the max value for whatever type it is and eliminate the check for a 0 ack_append_limit? That would eliminate one clause from this conditional.