From b7a7c6d0c3b626af1ba6335b6f2a4b9be851ec4e Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Thu, 11 Apr 2013 21:36:01 +0000 Subject: [PATCH] cxgbe/tom: Slight simplification of code that calculates options2. MFC after: 3 days --- sys/dev/cxgbe/tom/t4_connect.c | 13 ++++++++----- sys/dev/cxgbe/tom/t4_listen.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_connect.c b/sys/dev/cxgbe/tom/t4_connect.c index 9d755531f703..ac48d313a0ad 100644 --- a/sys/dev/cxgbe/tom/t4_connect.c +++ b/sys/dev/cxgbe/tom/t4_connect.c @@ -226,7 +226,10 @@ calc_opt2a(struct socket *so, struct toepcb *toep) struct tcpcb *tp = so_sototcpcb(so); struct port_info *pi = toep->port; struct adapter *sc = pi->adapter; - uint32_t opt2 = 0; + uint32_t opt2; + + opt2 = V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]) | + F_RSS_QUEUE_VALID | V_RSS_QUEUE(toep->ofld_rxq->iq.abs_id); if (tp->t_flags & TF_SACK_PERMIT) opt2 |= F_SACK_EN; @@ -240,12 +243,12 @@ calc_opt2a(struct socket *so, struct toepcb *toep) if (V_tcp_do_ecn) opt2 |= F_CCTRL_ECN; - opt2 |= V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]); - opt2 |= F_RSS_QUEUE_VALID | V_RSS_QUEUE(toep->ofld_rxq->iq.abs_id); + /* RX_COALESCE is always a valid value (M_RX_COALESCE). */ if (is_t4(sc)) - opt2 |= F_RX_COALESCE_VALID | V_RX_COALESCE(M_RX_COALESCE); + opt2 |= F_RX_COALESCE_VALID; else - opt2 |= F_T5_OPT_2_VALID | V_RX_COALESCE(M_RX_COALESCE); + opt2 |= F_T5_OPT_2_VALID; + opt2 |= V_RX_COALESCE(M_RX_COALESCE); #ifdef USE_DDP_RX_FLOW_CONTROL if (toep->ulp_mode == ULP_MODE_TCPDDP) diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index 30949e896b40..aa76762435a5 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -990,8 +990,11 @@ static uint32_t calc_opt2p(struct adapter *sc, struct port_info *pi, int rxqid, const struct tcp_options *tcpopt, struct tcphdr *th, int ulp_mode) { - uint32_t opt2 = 0; struct sge_ofld_rxq *ofld_rxq = &sc->sge.ofld_rxq[rxqid]; + uint32_t opt2; + + opt2 = V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]) | + F_RSS_QUEUE_VALID | V_RSS_QUEUE(ofld_rxq->iq.abs_id); if (V_tcp_do_rfc1323) { if (tcpopt->tstamp) @@ -1005,12 +1008,12 @@ calc_opt2p(struct adapter *sc, struct port_info *pi, int rxqid, if (V_tcp_do_ecn && th->th_flags & (TH_ECE | TH_CWR)) opt2 |= F_CCTRL_ECN; - opt2 |= V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]); - opt2 |= F_RSS_QUEUE_VALID | V_RSS_QUEUE(ofld_rxq->iq.abs_id); + /* RX_COALESCE is always a valid value (0 or M_RX_COALESCE). */ if (is_t4(sc)) - opt2 |= F_RX_COALESCE_VALID | V_RX_COALESCE(M_RX_COALESCE); + opt2 |= F_RX_COALESCE_VALID; else - opt2 |= F_T5_OPT_2_VALID | V_RX_COALESCE(M_RX_COALESCE); + opt2 |= F_T5_OPT_2_VALID; + opt2 |= V_RX_COALESCE(M_RX_COALESCE); #ifdef USE_DDP_RX_FLOW_CONTROL if (ulp_mode == ULP_MODE_TCPDDP)