Skip site navigation (1)Skip section navigation (2)
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

--b1_72048c45c69ee6f25f66535b059a2bc4
Content-Type: text/plain; charset = "utf-8"
Content-Transfer-Encoding: 8bit

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

--b1_72048c45c69ee6f25f66535b059a2bc4
Content-Type: text/x-patch; charset=utf-8; name="D5185.13397.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="D5185.13397.patch"

ZGlmZiAtLWdpdCBhL2hlYWQvc3lzL3N5cy9wYXJhbS5oIGIvaGVhZC9zeXMvc3lzL3BhcmFtLmgK
LS0tIGEvaGVhZC9zeXMvc3lzL3BhcmFtLmgKKysrIGIvaGVhZC9zeXMvc3lzL3BhcmFtLmgKQEAg
LTU4LDcgKzU4LDcgQEAKICAqCQlpbiB0aGUgcmFuZ2UgNSB0byA5LgogICovCiAjdW5kZWYgX19G
cmVlQlNEX3ZlcnNpb24KLSNkZWZpbmUgX19GcmVlQlNEX3ZlcnNpb24gMTEwMDA5OAkvKiBNYXN0
ZXIsIHByb3BhZ2F0ZWQgdG8gbmV3dmVycyAqLworI2RlZmluZSBfX0ZyZWVCU0RfdmVyc2lvbiAx
MTAwMDk5CS8qIE1hc3RlciwgcHJvcGFnYXRlZCB0byBuZXd2ZXJzICovCiAKIC8qCiAgKiBfX0Zy
ZWVCU0Rfa2VybmVsX18gaW5kaWNhdGVzIHRoYXQgdGhpcyBzeXN0ZW0gdXNlcyB0aGUga2VybmVs
IG9mIEZyZWVCU0QsCmRpZmYgLS1naXQgYS9oZWFkL3N5cy9uZXRpbmV0L3RjcF9scm8uaCBiL2hl
YWQvc3lzL25ldGluZXQvdGNwX2xyby5oCi0tLSBhL2hlYWQvc3lzL25ldGluZXQvdGNwX2xyby5o
CisrKyBiL2hl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KiBJZiBhIHBvc3NpYmxlIG5leHQgZnVsbCBsZW5ndGggcGFja2V0IHdvdWxkIGNhdXNl
IGFuCiAJCSAqIG92ZXJmbG93LCBwcm8tYWN0aXZlbHkgZmx1c2ggbm93LgogCQkgKi8KLQkJaWYg
KGxlLT5wX2xlbiA+ICg2NTUzNSAtIGxjLT5pZnAtPmlmX210dSkpIHsKKwkJaWYgKGxlLT5wX2xl
biA+IChsYy0+bHJvX2xlbmd0aF9saW0gLSBsYy0+aWZwLT5pZl9tdHUpKSB7CiAJCQlTTElTVF9S
RU1PVkUoJmxjLT5scm9fYWN0aXZlLCBsZSwgbHJvX2VudHJ5LCBuZXh0KTsKIAkJCXRjcF9scm9f
Zmx1c2gobGMsIGxlKTsKIAkJfSBlbHNlCgo=


--b1_72048c45c69ee6f25f66535b059a2bc4--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?72048c45c69ee6f25f66535b059a2bc4>