Date: Thu, 18 Feb 2016 04:59:00 +0000 From: Phabricator <phabric-noreply@FreeBSD.org> To: freebsd-net@freebsd.org Subject: [Differential] [Closed] D5185: tcp/lro: Allow network drivers to set the limit for TCP ACK/data segment aggregation limit Message-ID: <72048c45c69ee6f25f66535b059a2bc4@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-wthfupxgtart42sdknmd-req@FreeBSD.org> References: <differential-rev-PHID-DREV-wthfupxgtart42sdknmd-req@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] This revision was automatically updated to reflect the committed changes. Closed by commit rS295739: tcp/lro: Allow drivers to set the TCP ACK/data segment aggregation limit (authored by sephe). CHANGED PRIOR TO COMMIT https://reviews.freebsd.org/D5185?vs=13282&id=13397#toc REPOSITORY rS FreeBSD src repository CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D5185?vs=13282&id=13397 REVISION DETAIL https://reviews.freebsd.org/D5185 AFFECTED FILES head/sys/netinet/tcp_lro.c head/sys/netinet/tcp_lro.h head/sys/sys/param.h CHANGE DETAILS diff --git a/head/sys/sys/param.h b/head/sys/sys/param.h --- a/head/sys/sys/param.h +++ b/head/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100098 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100099 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/head/sys/netinet/tcp_lro.h b/head/sys/netinet/tcp_lro.h --- a/head/sys/netinet/tcp_lro.h +++ b/head/sys/netinet/tcp_lro.h @@ -91,11 +91,16 @@ unsigned lro_cnt; unsigned lro_mbuf_count; unsigned lro_mbuf_max; + unsigned short lro_ackcnt_lim; /* max # of aggregated ACKs */ + unsigned lro_length_lim; /* max len of aggregated data */ struct lro_head lro_active; struct lro_head lro_free; }; +#define TCP_LRO_LENGTH_MAX 65535 +#define TCP_LRO_ACKCNT_MAX 65535 /* unlimited */ + int tcp_lro_init(struct lro_ctrl *); int tcp_lro_init_args(struct lro_ctrl *, struct ifnet *, unsigned, unsigned); void tcp_lro_free(struct lro_ctrl *); diff --git a/head/sys/netinet/tcp_lro.c b/head/sys/netinet/tcp_lro.c --- a/head/sys/netinet/tcp_lro.c +++ b/head/sys/netinet/tcp_lro.c @@ -88,6 +88,8 @@ lc->lro_mbuf_count = 0; lc->lro_mbuf_max = lro_mbufs; lc->lro_cnt = lro_entries; + lc->lro_ackcnt_lim = TCP_LRO_ACKCNT_MAX; + lc->lro_length_lim = TCP_LRO_LENGTH_MAX; lc->ifp = ifp; SLIST_INIT(&lc->lro_free); SLIST_INIT(&lc->lro_active); @@ -610,7 +612,7 @@ } /* Flush now if appending will result in overflow. */ - if (le->p_len > (65535 - tcp_data_len)) { + if (le->p_len > (lc->lro_length_lim - tcp_data_len)) { SLIST_REMOVE(&lc->lro_active, le, lro_entry, next); tcp_lro_flush(lc, le); break; @@ -648,6 +650,15 @@ if (tcp_data_len == 0) { m_freem(m); + /* + * Flush this LRO entry, if this ACK should not + * be further delayed. + */ + if (le->append_cnt >= lc->lro_ackcnt_lim) { + SLIST_REMOVE(&lc->lro_active, le, lro_entry, + next); + tcp_lro_flush(lc, le); + } return (0); } @@ -668,7 +679,7 @@ * If a possible next full length packet would cause an * overflow, pro-actively flush now. */ - if (le->p_len > (65535 - lc->ifp->if_mtu)) { + if (le->p_len > (lc->lro_length_lim - lc->ifp->if_mtu)) { SLIST_REMOVE(&lc->lro_active, le, lro_entry, next); tcp_lro_flush(lc, le); } else EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: sepherosa_gmail.com, delphij, royger, decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com, np, transport, hselasky, gallatin, adrian, network Cc: freebsd-virtualization-list, freebsd-net-list [-- Attachment #2 --] diff --git a/head/sys/sys/param.h b/head/sys/sys/param.h --- a/head/sys/sys/param.h +++ b/head/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100098 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100099 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/head/sys/netinet/tcp_lro.h b/head/sys/netinet/tcp_lro.h --- a/head/sys/netinet/tcp_lro.h +++ b/head/sys/netinet/tcp_lro.h @@ -91,11 +91,16 @@ unsigned lro_cnt; unsigned lro_mbuf_count; unsigned lro_mbuf_max; + unsigned short lro_ackcnt_lim; /* max # of aggregated ACKs */ + unsigned lro_length_lim; /* max len of aggregated data */ struct lro_head lro_active; struct lro_head lro_free; }; +#define TCP_LRO_LENGTH_MAX 65535 +#define TCP_LRO_ACKCNT_MAX 65535 /* unlimited */ + int tcp_lro_init(struct lro_ctrl *); int tcp_lro_init_args(struct lro_ctrl *, struct ifnet *, unsigned, unsigned); void tcp_lro_free(struct lro_ctrl *); diff --git a/head/sys/netinet/tcp_lro.c b/head/sys/netinet/tcp_lro.c --- a/head/sys/netinet/tcp_lro.c +++ b/head/sys/netinet/tcp_lro.c @@ -88,6 +88,8 @@ lc->lro_mbuf_count = 0; lc->lro_mbuf_max = lro_mbufs; lc->lro_cnt = lro_entries; + lc->lro_ackcnt_lim = TCP_LRO_ACKCNT_MAX; + lc->lro_length_lim = TCP_LRO_LENGTH_MAX; lc->ifp = ifp; SLIST_INIT(&lc->lro_free); SLIST_INIT(&lc->lro_active); @@ -610,7 +612,7 @@ } /* Flush now if appending will result in overflow. */ - if (le->p_len > (65535 - tcp_data_len)) { + if (le->p_len > (lc->lro_length_lim - tcp_data_len)) { SLIST_REMOVE(&lc->lro_active, le, lro_entry, next); tcp_lro_flush(lc, le); break; @@ -648,6 +650,15 @@ if (tcp_data_len == 0) { m_freem(m); + /* + * Flush this LRO entry, if this ACK should not + * be further delayed. + */ + if (le->append_cnt >= lc->lro_ackcnt_lim) { + SLIST_REMOVE(&lc->lro_active, le, lro_entry, + next); + tcp_lro_flush(lc, le); + } return (0); } @@ -668,7 +679,7 @@ * If a possible next full length packet would cause an * overflow, pro-actively flush now. */ - if (le->p_len > (65535 - lc->ifp->if_mtu)) { + if (le->p_len > (lc->lro_length_lim - lc->ifp->if_mtu)) { SLIST_REMOVE(&lc->lro_active, le, lro_entry, next); tcp_lro_flush(lc, le); } else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?72048c45c69ee6f25f66535b059a2bc4>
