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
This commit is contained in:
Navdeep Parhar 2019-06-28 02:41:17 +00:00
parent 24a508820c
commit b7acf27c2e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349500
3 changed files with 19 additions and 15 deletions

View File

@ -327,31 +327,33 @@ send_reset(struct adapter *sc, struct toepcb *toep, uint32_t snd_nxt)
* 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, uint32_t irs, uint16_t opt)
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, uint32_t irs, uint16_t opt)
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 int immdlen,
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

View File

@ -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,

View File

@ -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;