1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Some "cleanup" of tcp_mss():

- Move the assigment of the socket down before we first need it.
  No need to do it at the beginning and then drop out the function
  by one of the returns before using it 100 lines further down.
- Use t_maxopd which was assigned the "tcp_mssdflt" for the corrrect
  AF already instead of another #ifdef ? : #endif block doing the same.
- Remove an unneeded (duplicate) assignment of mss to t_maxseg just before
  we possibly change mss and re-do the assignment without using t_maxseg
  in between.

Reviewed by:	silby
No objections:	net@ (silence)
MFC after:	5 days
This commit is contained in:
Bjoern A. Zeeb 2008-03-02 08:40:47 +00:00
parent 62fa74d95a
commit c3b02504bc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176736

View File

@ -2740,7 +2740,6 @@ tcp_mss(struct tcpcb *tp, int offer)
maxmtu = tcp_maxmtu(&inp->inp_inc, &mtuflags);
tp->t_maxopd = tp->t_maxseg = tcp_mssdflt;
}
so = inp->inp_socket;
/*
* No route to sender, stay with default mss and return.
@ -2753,13 +2752,10 @@ tcp_mss(struct tcpcb *tp, int offer)
case 0:
/*
* Offer == 0 means that there was no MSS on the SYN
* segment, in this case we use tcp_mssdflt.
* segment, in this case we use tcp_mssdflt as
* already assigned to t_maxopd above.
*/
offer =
#ifdef INET6
isipv6 ? tcp_v6mssdflt :
#endif
tcp_mssdflt;
offer = tp->t_maxopd;
break;
case -1:
@ -2829,7 +2825,6 @@ tcp_mss(struct tcpcb *tp, int offer)
(origoffer == -1 ||
(tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP))
mss -= TCPOLEN_TSTAMP_APPA;
tp->t_maxseg = mss;
#if (MCLBYTES & (MCLBYTES - 1)) == 0
if (mss > MCLBYTES)
@ -2847,6 +2842,7 @@ tcp_mss(struct tcpcb *tp, int offer)
* Make the socket buffers an integral number of mss units;
* if the mss is larger than the socket buffer, decrease the mss.
*/
so = inp->inp_socket;
SOCKBUF_LOCK(&so->so_snd);
if ((so->so_snd.sb_hiwat == tcp_sendspace) && metrics.rmx_sendpipe)
bufsize = metrics.rmx_sendpipe;