Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jun 2019 02:41:18 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349500 - head/sys/dev/cxgbe/tom
Message-ID:  <201906280241.x5S2fIt3038967@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Fri Jun 28 02:41:17 2019
New Revision: 349500
URL: https://svnweb.freebsd.org/changeset/base/349500

Log:
  cxgbe/t4_tom: Fix regression in t_maxseg usage within t4_tom.
  
  t_maxseg was changed in r293284 to not have any adjustment for TCP
  timestamps.  t4_tom inadvertently went back to pre-r293284 semantics
  in r332506.
  
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c	Fri Jun 28 02:21:42 2019	(r349499)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c	Fri Jun 28 02:41:17 2019	(r349500)
@@ -327,31 +327,33 @@ send_reset(struct adapter *sc, struct toepcb *toep, ui
  * reported by HW to FreeBSD's native format.
  */
 static void
-assign_rxopt(struct tcpcb *tp, unsigned int opt)
+assign_rxopt(struct tcpcb *tp, uint16_t opt)
 {
 	struct toepcb *toep = tp->t_toe;
 	struct inpcb *inp = tp->t_inpcb;
 	struct adapter *sc = td_adapter(toep->td);
-	int n;
 
 	INP_LOCK_ASSERT(inp);
 
+	toep->tcp_opt = opt;
+	toep->mtu_idx = G_TCPOPT_MSS(opt);
+	tp->t_maxseg = sc->params.mtus[toep->mtu_idx];
 	if (inp->inp_inc.inc_flags & INC_ISIPV6)
-		n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
+		tp->t_maxseg -= sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
 	else
-		n = sizeof(struct ip) + sizeof(struct tcphdr);
-	tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n;
+		tp->t_maxseg -= sizeof(struct ip) + sizeof(struct tcphdr);
 
+	toep->emss = tp->t_maxseg;
 	if (G_TCPOPT_TSTAMP(opt)) {
 		tp->t_flags |= TF_RCVD_TSTMP;	/* timestamps ok */
 		tp->ts_recent = 0;		/* hmmm */
 		tp->ts_recent_age = tcp_ts_getticks();
-		tp->t_maxseg -= TCPOLEN_TSTAMP_APPA;
+		toep->emss -= TCPOLEN_TSTAMP_APPA;
 	}
 
-	CTR5(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), mss %u", __func__,
-	    toep->tid, G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)],
-	    tp->t_maxseg);
+	CTR6(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), t_maxseg %u, emss %u",
+	    __func__, toep->tid, toep->mtu_idx,
+	    sc->params.mtus[G_TCPOPT_MSS(opt)], tp->t_maxseg, toep->emss);
 
 	if (G_TCPOPT_SACK(opt))
 		tp->t_flags |= TF_SACK_PERMIT;	/* should already be set */
@@ -399,7 +401,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui
 
 	tp->irs = irs;
 	tcp_rcvseqinit(tp);
-	tp->rcv_wnd = toep->opt0_rcv_bufsize << 10;
+	tp->rcv_wnd = (u_int)toep->opt0_rcv_bufsize << 10;
 	tp->rcv_adv += tp->rcv_wnd;
 	tp->last_ack_sent = tp->rcv_nxt;
 
@@ -421,7 +423,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui
 	ftxp.snd_nxt = tp->snd_nxt;
 	ftxp.rcv_nxt = tp->rcv_nxt;
 	ftxp.snd_space = bufsize;
-	ftxp.mss = tp->t_maxseg;
+	ftxp.mss = toep->emss;
 	send_flowc_wr(toep, &ftxp);
 
 	soisconnected(so);
@@ -613,7 +615,7 @@ write_tx_wr(void *dst, struct toepcb *toep, unsigned i
 	if (txalign > 0) {
 		struct tcpcb *tp = intotcpcb(toep->inp);
 
-		if (plen < 2 * tp->t_maxseg)
+		if (plen < 2 * toep->emss)
 			txwr->lsodisable_to_flags |=
 			    htobe32(F_FW_OFLD_TX_DATA_WR_LSODISABLE);
 		else

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tom.c	Fri Jun 28 02:21:42 2019	(r349499)
+++ head/sys/dev/cxgbe/tom/t4_tom.c	Fri Jun 28 02:41:17 2019	(r349500)
@@ -851,8 +851,7 @@ remove_tid(struct adapter *sc, int tid, int ntids)
  * What mtu_idx to use, given a 4-tuple.  Note that both s->mss and tcp_mssopt
  * have the MSS that we should advertise in our SYN.  Advertised MSS doesn't
  * account for any TCP options so the effective MSS (only payload, no headers or
- * options) could be different.  We fill up tp->t_maxseg with the effective MSS
- * at the end of the 3-way handshake.
+ * options) could be different.
  */
 int
 find_best_mtu_idx(struct adapter *sc, struct in_conninfo *inc,

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tom.h	Fri Jun 28 02:21:42 2019	(r349499)
+++ head/sys/dev/cxgbe/tom/t4_tom.h	Fri Jun 28 02:41:17 2019	(r349500)
@@ -181,7 +181,10 @@ struct toepcb {
 	u_int tx_nocompl;	/* tx WR credits since last compl request */
 	u_int plen_nocompl;	/* payload since last compl request */
 
-	int opt0_rcv_bufsize;	/* XXX: save full opt0/opt2 for later? */
+	uint16_t opt0_rcv_bufsize;	/* XXX: save full opt0/opt2 for later? */
+	uint16_t mtu_idx;
+	uint16_t emss;
+	uint16_t tcp_opt;
 
 	u_int ulp_mode;	/* ULP mode */
 	void *ulpcb;



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