All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neal Cardwell <ncardwell@google.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Neal Cardwell <ncardwell@google.com>,
	Van Jacobson <vanj@google.com>, Yuchung Cheng <ycheng@google.com>,
	Nandita Dukkipati <nanditad@google.com>,
	Eric Dumazet <edumazet@google.com>,
	Soheil Hassas Yeganeh <soheil@google.com>
Subject: [PATCH net-next 08/14] tcp: allow congestion control module to request TSO skb segment count
Date: Fri, 16 Sep 2016 14:48:57 -0400	[thread overview]
Message-ID: <1474051743-13311-9-git-send-email-ncardwell@google.com> (raw)
In-Reply-To: <1474051743-13311-1-git-send-email-ncardwell@google.com>

Add the tso_segs_goal() function in tcp_congestion_ops to allow the
congestion control module to specify the number of segments that
should be in a TSO skb sent by tcp_write_xmit() and
tcp_xmit_retransmit_queue(). The congestion control module can either
request a particular number of segments in TSO skb that we transmit,
or return 0 if it doesn't care.

This allows the upcoming BBR congestion control module to select small
TSO skb sizes if the module detects that the bottleneck bandwidth is
very low, or that the connection is policed to a low rate.

Signed-off-by: Van Jacobson <vanj@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Nandita Dukkipati <nanditad@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
---
 include/net/tcp.h     |  2 ++
 net/ipv4/tcp_output.c | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 9829aa7..4d85cd7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -913,6 +913,8 @@ struct tcp_congestion_ops {
 	u32  (*undo_cwnd)(struct sock *sk);
 	/* hook for packet ack accounting (optional) */
 	void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample);
+	/* suggest number of segments for each skb to transmit (optional) */
+	u32 (*tso_segs_goal)(struct sock *sk);
 	/* get info for inet_diag (optional) */
 	size_t (*get_info)(struct sock *sk, u32 ext, int *attr,
 			   union tcp_cc_info *info);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index e02c8eb..0137956 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1566,6 +1566,17 @@ static u32 tcp_tso_autosize(const struct sock *sk, unsigned int mss_now)
 	return min_t(u32, segs, sk->sk_gso_max_segs);
 }
 
+/* Return the number of segments we want in the skb we are transmitting.
+ * See if congestion control module wants to decide; otherwise, autosize.
+ */
+static u32 tcp_tso_segs(struct sock *sk, unsigned int mss_now)
+{
+	const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops;
+	u32 tso_segs = ca_ops->tso_segs_goal ? ca_ops->tso_segs_goal(sk) : 0;
+
+	return tso_segs ? : tcp_tso_autosize(sk, mss_now);
+}
+
 /* Returns the portion of skb which can be sent right away */
 static unsigned int tcp_mss_split_point(const struct sock *sk,
 					const struct sk_buff *skb,
@@ -2061,7 +2072,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
 		}
 	}
 
-	max_segs = tcp_tso_autosize(sk, mss_now);
+	max_segs = tcp_tso_segs(sk, mss_now);
 	while ((skb = tcp_send_head(sk))) {
 		unsigned int limit;
 
@@ -2778,7 +2789,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
 		last_lost = tp->snd_una;
 	}
 
-	max_segs = tcp_tso_autosize(sk, tcp_current_mss(sk));
+	max_segs = tcp_tso_segs(sk, tcp_current_mss(sk));
 	tcp_for_write_queue_from(skb, sk) {
 		__u8 sacked;
 		int segs;
-- 
2.8.0.rc3.226.g39d4020

  parent reply	other threads:[~2016-09-16 18:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-16 18:48 [PATCH net-next 00/14] tcp: BBR congestion control algorithm Neal Cardwell
2016-09-16 18:48 ` [PATCH net-next 01/14] lib/win_minmax: windowed min or max estimator Neal Cardwell
2016-09-16 18:48 ` [PATCH net-next 02/14] tcp: use windowed min filter library for TCP min_rtt estimation Neal Cardwell
2016-09-16 19:21   ` kbuild test robot
2016-09-16 19:25     ` Neal Cardwell
2016-09-16 18:48 ` [PATCH net-next 03/14] net_sched: sch_fq: add low_rate_threshold parameter Neal Cardwell
2016-09-16 18:48 ` [PATCH net-next 04/14] tcp: count packets marked lost for a TCP connection Neal Cardwell
2016-09-16 18:48 ` [PATCH net-next 05/14] tcp: track data delivery rate " Neal Cardwell
2016-09-16 21:38   ` kbuild test robot
2016-09-17 12:09     ` Neal Cardwell
2016-09-16 18:48 ` [PATCH net-next 06/14] tcp: track application-limited rate samples Neal Cardwell
2016-09-16 18:48 ` [PATCH net-next 07/14] tcp: export data delivery rate Neal Cardwell
2016-09-16 21:38   ` kbuild test robot
2016-09-17  3:56   ` kbuild test robot
2016-09-16 20:03     ` Neal Cardwell
2016-09-16 20:11       ` Eric Dumazet
2016-09-16 20:04     ` Eric Dumazet
2016-09-16 18:48 ` Neal Cardwell [this message]
2016-09-16 18:48 ` [PATCH net-next 09/14] tcp: export tcp_tso_autosize() and parameterize minimum number of TSO segments Neal Cardwell
2016-09-16 18:48 ` [PATCH net-next 10/14] tcp: export tcp_mss_to_mtu() for congestion control modules Neal Cardwell
2016-09-16 18:49 ` [PATCH net-next 11/14] tcp: allow congestion control to expand send buffer differently Neal Cardwell
2016-09-16 18:49 ` [PATCH net-next 12/14] tcp: new CC hook to set sending rate with rate_sample in any CA state Neal Cardwell
2016-09-16 18:49 ` [PATCH net-next 13/14] tcp: increase ICSK_CA_PRIV_SIZE from 64 bytes to 88 Neal Cardwell
2016-09-16 18:49 ` [PATCH net-next 14/14] tcp_bbr: add BBR congestion control Neal Cardwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474051743-13311-9-git-send-email-ncardwell@google.com \
    --to=ncardwell@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=nanditad@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=soheil@google.com \
    --cc=vanj@google.com \
    --cc=ycheng@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.