Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Nov 2019 19:33:15 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r355242 - stable/11/sys/dev/cxgbe/tom
Message-ID:  <201911301933.xAUJXFdr030599@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Sat Nov 30 19:33:14 2019
New Revision: 355242
URL: https://svnweb.freebsd.org/changeset/base/355242

Log:
  MFC r349500:
  
  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:
  stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c
  stable/11/sys/dev/cxgbe/tom/t4_tom.c
  stable/11/sys/dev/cxgbe/tom/t4_tom.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c	Sat Nov 30 19:33:02 2019	(r355241)
+++ stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c	Sat Nov 30 19:33:14 2019	(r355242)
@@ -337,31 +337,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 */
@@ -409,7 +411,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;
 
@@ -431,7 +433,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);
@@ -623,7 +625,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: stable/11/sys/dev/cxgbe/tom/t4_tom.c
==============================================================================
--- stable/11/sys/dev/cxgbe/tom/t4_tom.c	Sat Nov 30 19:33:02 2019	(r355241)
+++ stable/11/sys/dev/cxgbe/tom/t4_tom.c	Sat Nov 30 19:33:14 2019	(r355242)
@@ -532,8 +532,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: stable/11/sys/dev/cxgbe/tom/t4_tom.h
==============================================================================
--- stable/11/sys/dev/cxgbe/tom/t4_tom.h	Sat Nov 30 19:33:02 2019	(r355241)
+++ stable/11/sys/dev/cxgbe/tom/t4_tom.h	Sat Nov 30 19:33:14 2019	(r355242)
@@ -178,7 +178,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?201911301933.xAUJXFdr030599>