Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jan 2016 02:29:22 +0000
From:      "sepherosa_gmail.com (Sepherosa Ziehau)" <phabric-noreply@FreeBSD.org>
To:        freebsd-net@freebsd.org
Subject:   [Differential] [Request, 6 lines] D4825: tcp/lro: Add network driver configurable LRO entry depth
Message-ID:  <differential-rev-PHID-DREV-ou2jiti5cx3pzqhm5pb2-req@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
sepherosa_gmail.com created this revision.
sepherosa_gmail.com added reviewers: network, adrian, delphij, decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com, glebius.
sepherosa_gmail.com added a subscriber: freebsd-net-list.
Herald added a reviewer: transport.

REVISION SUMMARY
  When there is only tiny amount of TCP connections and the host is slow, e.g. in VM, holding too much TCP segments in an LRO entry will cause RX performance degradation.  We now allow network drivers to configure how deep one LRO entry should be.
  
  https://reviews.freebsd.org/D4824 has a disabled network driver usage example.
  
  Reviewed by: Hongjiang Zhang <honzhan microsoft com>, Dexuan Cui <decui microsoft com>, Jun Su <junsu microsoft com>
  Tested by: me (local), Hongjiang Zhang <honzhan microsoft com> (directly connected 40Ge)
  Sponsored by: Microsoft OSTC
  
  BTW, I think some drivers already put a limit on the # of drivers holding TCP segments, e.g. oce(4), though oce(4) does not use per-LRO entry depth.

REVISION DETAIL
  https://reviews.freebsd.org/D4825

AFFECTED FILES
  sys/netinet/tcp_lro.c
  sys/netinet/tcp_lro.h

CHANGE DETAILS
  diff --git a/sys/netinet/tcp_lro.h b/sys/netinet/tcp_lro.h
  --- a/sys/netinet/tcp_lro.h
  +++ b/sys/netinet/tcp_lro.h
  @@ -79,6 +79,7 @@
   	int		lro_flushed;
   	int		lro_bad_csum;
   	int		lro_cnt;
  +	int		lro_hiwat;
   
   	struct lro_head	lro_active;
   	struct lro_head	lro_free;
  diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
  --- a/sys/netinet/tcp_lro.c
  +++ b/sys/netinet/tcp_lro.c
  @@ -77,6 +77,7 @@
   	lc->lro_queued = 0;
   	lc->lro_flushed = 0;
   	lc->lro_cnt = 0;
  +	lc->lro_hiwat = 65535;
   	SLIST_INIT(&lc->lro_free);
   	SLIST_INIT(&lc->lro_active);
   
  @@ -501,7 +502,7 @@
   		}
   
   		/* Flush now if appending will result in overflow. */
  -		if (le->p_len > (65535 - tcp_data_len)) {
  +		if (le->p_len > (lc->lro_hiwat - tcp_data_len)) {
   			SLIST_REMOVE(&lc->lro_active, le, lro_entry, next);
   			tcp_lro_flush(lc, le);
   			break;
  @@ -559,7 +560,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_hiwat - 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, network, transport, adrian, delphij, decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com, glebius
Cc: freebsd-net-list

[-- Attachment #2 --]
diff --git a/sys/netinet/tcp_lro.h b/sys/netinet/tcp_lro.h
--- a/sys/netinet/tcp_lro.h
+++ b/sys/netinet/tcp_lro.h
@@ -79,6 +79,7 @@
 	int		lro_flushed;
 	int		lro_bad_csum;
 	int		lro_cnt;
+	int		lro_hiwat;
 
 	struct lro_head	lro_active;
 	struct lro_head	lro_free;
diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -77,6 +77,7 @@
 	lc->lro_queued = 0;
 	lc->lro_flushed = 0;
 	lc->lro_cnt = 0;
+	lc->lro_hiwat = 65535;
 	SLIST_INIT(&lc->lro_free);
 	SLIST_INIT(&lc->lro_active);
 
@@ -501,7 +502,7 @@
 		}
 
 		/* Flush now if appending will result in overflow. */
-		if (le->p_len > (65535 - tcp_data_len)) {
+		if (le->p_len > (lc->lro_hiwat - tcp_data_len)) {
 			SLIST_REMOVE(&lc->lro_active, le, lro_entry, next);
 			tcp_lro_flush(lc, le);
 			break;
@@ -559,7 +560,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_hiwat - 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?differential-rev-PHID-DREV-ou2jiti5cx3pzqhm5pb2-req>