PERFORCE change 175636 for review

Andre Oppermann andre at FreeBSD.org
Fri Mar 12 18:48:11 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=175636

Change 175636 by andre at andre_t61 on 2010/03/12 18:47:41

	Fold tcp_send() back into tcp_output(). Both are an integrated code flow and
	there is not much benefit in having them separate except of lots of argument
	passing.

Affected files ...

.. //depot/projects/tcp_new/netinet/tcp_output.c#17 edit

Differences ...

==== //depot/projects/tcp_new/netinet/tcp_output.c#17 (text+ko) ====

@@ -102,9 +102,6 @@
     &tcp_autosndbuf_max, 0, "Max size of automatic send buffer");
 
 static int	ip_optlen(struct inpcb *inp);
-static int	tcp_send(struct tcpcb *tp, struct socket *so,
-		    struct tcpopt *to, u_char *opt, int len,
-		    int optlen, int rwin, int flags);
 static int	tcp_retransmit(struct tcpcb *tp, struct socket *so,
 		    struct tcpopt *to, u_char *opt, int *len,
 		    int optlen, int rwin, int dlen, int slen, int flags);
@@ -146,10 +143,11 @@
 {
 	int flags, error, optlen = 0;
 	tcp_win len;
-	int duna, swnd, cwnd, dlen, slen, inflight, rwin;
+	int duna, swnd, cwnd, dlen, slen, inflight, rwin, off;
 	int tcp_min_idle = 1;		/* XXXAO */
 	struct inpcb *inp = tp->t_inpcb;
 	struct socket *so = inp->inp_socket;
+	struct tcphdr ths, *th = &ths;
 	struct tcpopt to;
 	u_char opt[TCP_MAXOLEN];
 #ifdef TCP_SIGNATURE
@@ -260,6 +258,7 @@
 		break;
 	case TP_LOSSRECOV:
 	case TP_REXMT:
+		optlen = tcp_options(tp, so, &to, &opt[0], flags);
 		error = tcp_retransmit(tp, so, &to, &opt[0], &len, optlen, rwin, dlen, slen, flags);
 		break;
 	case TP_PERSIST:
@@ -490,22 +489,13 @@
 	return (0);
 
 send:
-	optlen = tcp_options(tp, so, &to, &opt[0], flags);
-	error = tcp_send(tp, so, &to, &opt[0], len, optlen, rwin, flags);
-
-	if (!error)
-		tcp_snd_autoscale(tp, so, swnd);
+	/*
+	 * Only compute options if not already done for retransmit.
+	 * XXXAO: NOOPT
+	 */
+	if (optlen == 0)
+		optlen = tcp_options(tp, so, &to, &opt[0], flags);
 
-	return (error);
-}
-
-static int
-tcp_send(struct tcpcb *tp, struct socket *so, struct tcpopt *to,
-    u_char *opt, int len, int optlen, int rwin, int flags)
-{
-	int off, error;
-	struct tcphdr ths, *th = &ths;
-
 	KASSERT((flags & TH_SYN) || (tp->t_flags & TF_SENTSYN),
 	    ("%s: retransmitting SYN", __func__));
 	KASSERT((flags & TH_FIN) || (tp->t_flags & TF_SENTFIN),
@@ -650,6 +640,11 @@
 		}
 
 		/*
+		 * Scale the send window.
+		 */
+		tcp_snd_autoscale(tp, so, swnd);
+
+		/*
 		 * Set retransmit timer if not currently set,
 		 * and not doing a pure ack or a keep-alive probe.
 		 * Initial value for retransmit timer is smoothed
@@ -767,7 +762,7 @@
 	else
 		tcpstat.tcps_sndwinup++;
 
-	return (0);
+	return (error);
 }
 
 /*


More information about the p4-projects mailing list