Author: np
Date: Thu Apr 11 21:36:01 2013
New Revision: 249385
URL: http://svnweb.freebsd.org/changeset/base/249385

Log:
  cxgbe/tom: Slight simplification of code that calculates options2.
  
  MFC after:    3 days

Modified:
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/dev/cxgbe/tom/t4_listen.c

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_connect.c Thu Apr 11 21:18:04 2013        
(r249384)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Thu Apr 11 21:36:01 2013        
(r249385)
@@ -226,7 +226,10 @@ calc_opt2a(struct socket *so, struct toe
        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 toe
        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)

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_listen.c  Thu Apr 11 21:18:04 2013        
(r249384)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Thu Apr 11 21:36:01 2013        
(r249385)
@@ -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 po
        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)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to