Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2012 18:30:17 +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: r239514 - head/sys/dev/cxgbe/tom
Message-ID:  <201208211830.q7LIUH4S083299@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Aug 21 18:30:16 2012
New Revision: 239514
URL: http://svn.freebsd.org/changeset/base/239514

Log:
  Minor cleanup: use bitwise ops instead of pointless wrappers around
  setbit/clrbit.

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

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_connect.c	Tue Aug 21 18:24:11 2012	(r239513)
+++ head/sys/dev/cxgbe/tom/t4_connect.c	Tue Aug 21 18:30:16 2012	(r239514)
@@ -358,7 +358,7 @@ t4_connect(struct toedev *tod, struct so
 
 	rc = t4_l2t_send(sc, wr, e);
 	if (rc == 0) {
-		toepcb_set_flag(toep, TPF_CPL_PENDING);
+		toep->flags |= TPF_CPL_PENDING;
 		return (0);
 	}
 

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c	Tue Aug 21 18:24:11 2012	(r239513)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c	Tue Aug 21 18:30:16 2012	(r239514)
@@ -81,7 +81,7 @@ send_flowc_wr(struct toepcb *toep, struc
 	unsigned int pfvf = G_FW_VIID_PFN(pi->viid) << S_FW_VIID_PFN;
 	struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx];
 
-	KASSERT(!toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+	KASSERT(!(toep->flags & TPF_FLOWC_WR_SENT),
 	    ("%s: flowc for tid %u sent already", __func__, toep->tid));
 
 	CTR2(KTR_CXGBE, "%s: tid %u", __func__, toep->tid);
@@ -131,7 +131,7 @@ send_flowc_wr(struct toepcb *toep, struc
 		toep->txsd_pidx = 0;
 	toep->txsd_avail--;
 
-	toepcb_set_flag(toep, TPF_FLOWC_WR_SENT);
+	toep->flags |= TPF_FLOWC_WR_SENT;
         t4_wrq_tx(sc, wr);
 }
 
@@ -151,15 +151,15 @@ send_reset(struct adapter *sc, struct to
 	    inp->inp_flags & INP_DROPPED ? "inp dropped" :
 	    tcpstates[tp->t_state],
 	    toep->flags, inp->inp_flags,
-	    toepcb_flag(toep, TPF_ABORT_SHUTDOWN) ?
+	    toep->flags & TPF_ABORT_SHUTDOWN ?
 	    " (abort already in progress)" : "");
 
-	if (toepcb_flag(toep, TPF_ABORT_SHUTDOWN))
+	if (toep->flags & TPF_ABORT_SHUTDOWN)
 		return;	/* abort already in progress */
 
-	toepcb_set_flag(toep, TPF_ABORT_SHUTDOWN);
+	toep->flags |= TPF_ABORT_SHUTDOWN;
 
-	KASSERT(toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+	KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
 	    ("%s: flowc_wr not sent for tid %d.", __func__, tid));
 
 	wr = alloc_wrqe(sizeof(*req), toep->ofld_txq);
@@ -174,7 +174,7 @@ send_reset(struct adapter *sc, struct to
 		req->rsvd0 = htobe32(snd_nxt);
 	else
 		req->rsvd0 = htobe32(tp->snd_nxt);
-	req->rsvd1 = !toepcb_flag(toep, TPF_TX_DATA_SENT);
+	req->rsvd1 = !(toep->flags & TPF_TX_DATA_SENT);
 	req->cmd = CPL_ABORT_SEND_RST;
 
 	/*
@@ -364,12 +364,12 @@ close_conn(struct adapter *sc, struct to
 	unsigned int tid = toep->tid;
 
 	CTR3(KTR_CXGBE, "%s: tid %u%s", __func__, toep->tid,
-	    toepcb_flag(toep, TPF_FIN_SENT) ? ", IGNORED" : "");
+	    toep->flags & TPF_FIN_SENT ? ", IGNORED" : "");
 
-	if (toepcb_flag(toep, TPF_FIN_SENT))
+	if (toep->flags & TPF_FIN_SENT)
 		return (0);
 
-	KASSERT(toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+	KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
 	    ("%s: flowc_wr not sent for tid %u.", __func__, tid));
 
 	wr = alloc_wrqe(sizeof(*req), toep->ofld_txq);
@@ -387,8 +387,8 @@ close_conn(struct adapter *sc, struct to
         OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, tid));
 	req->rsvd = 0;
 
-	toepcb_set_flag(toep, TPF_FIN_SENT);
-	toepcb_clr_flag(toep, TPF_SEND_FIN);
+	toep->flags |= TPF_FIN_SENT;
+	toep->flags &= ~TPF_SEND_FIN;
 	t4_l2t_send(sc, wr, toep->l2te);
 
 	return (0);
@@ -540,7 +540,7 @@ t4_push_frames(struct adapter *sc, struc
 	struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx];
 
 	INP_WLOCK_ASSERT(inp);
-	KASSERT(toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+	KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
 	    ("%s: flowc_wr not sent for tid %u.", __func__, toep->tid));
 
 	if (__predict_false(toep->ulp_mode != ULP_MODE_NONE &&
@@ -551,7 +551,7 @@ t4_push_frames(struct adapter *sc, struc
 	 * This function doesn't resume by itself.  Someone else must clear the
 	 * flag and call this function.
 	 */
-	if (__predict_false(toepcb_flag(toep, TPF_TX_SUSPENDED)))
+	if (__predict_false(toep->flags & TPF_TX_SUSPENDED))
 		return;
 
 	do {
@@ -577,7 +577,7 @@ t4_push_frames(struct adapter *sc, struc
 				plen -= m->m_len;
 				if (plen == 0) {
 					/* Too few credits */
-					toepcb_set_flag(toep, TPF_TX_SUSPENDED);
+					toep->flags |= TPF_TX_SUSPENDED;
 					SOCKBUF_UNLOCK(sb);
 					return;
 				}
@@ -620,7 +620,7 @@ unlocked:
 			break;
 		}
 
-		if (__predict_false(toepcb_flag(toep, TPF_FIN_SENT)))
+		if (__predict_false(toep->flags & TPF_FIN_SENT))
 			panic("%s: excess tx.", __func__);
 
 		if (plen <= max_imm) {
@@ -631,7 +631,7 @@ unlocked:
 					toep->ofld_txq);
 			if (wr == NULL) {
 				/* XXX: how will we recover from this? */
-				toepcb_set_flag(toep, TPF_TX_SUSPENDED);
+				toep->flags |= TPF_TX_SUSPENDED;
 				return;
 			}
 			txwr = wrtod(wr);
@@ -649,7 +649,7 @@ unlocked:
 			wr = alloc_wrqe(roundup(wr_len, 16), toep->ofld_txq);
 			if (wr == NULL) {
 				/* XXX: how will we recover from this? */
-				toepcb_set_flag(toep, TPF_TX_SUSPENDED);
+				toep->flags |= TPF_TX_SUSPENDED;
 				return;
 			}
 			txwr = wrtod(wr);
@@ -678,7 +678,7 @@ unlocked:
 		sb->sb_sndptr = sb_sndptr;
 		SOCKBUF_UNLOCK(sb);
 
-		toepcb_set_flag(toep, TPF_TX_DATA_SENT);
+		toep->flags |= TPF_TX_DATA_SENT;
 
 		KASSERT(toep->txsd_avail > 0, ("%s: no txsd", __func__));
 		txsd->plen = plen;
@@ -694,7 +694,7 @@ unlocked:
 	} while (m != NULL);
 
 	/* Send a FIN if requested, but only if there's no more data to send */
-	if (m == NULL && toepcb_flag(toep, TPF_SEND_FIN))
+	if (m == NULL && toep->flags & TPF_SEND_FIN)
 		close_conn(sc, toep);
 }
 
@@ -731,7 +731,7 @@ t4_send_fin(struct toedev *tod, struct t
 	    ("%s: inp %p dropped.", __func__, inp));
 	KASSERT(toep != NULL, ("%s: toep is NULL", __func__));
 
-	toepcb_set_flag(toep, TPF_SEND_FIN);
+	toep->flags |= TPF_SEND_FIN;
 	t4_push_frames(sc, toep);
 
 	return (0);
@@ -752,7 +752,7 @@ t4_send_rst(struct toedev *tod, struct t
 	KASSERT(toep != NULL, ("%s: toep is NULL", __func__));
 
 	/* hmmmm */
-	KASSERT(toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+	KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
 	    ("%s: flowc for tid %u [%s] not sent already",
 	    __func__, toep->tid, tcpstates[tp->t_state]));
 
@@ -790,7 +790,7 @@ do_peer_close(struct sge_iq *iq, const s
 	CTR5(KTR_CXGBE, "%s: tid %u (%s), toep_flags 0x%x, inp %p", __func__,
 	    tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags, inp);
 
-	if (toepcb_flag(toep, TPF_ABORT_SHUTDOWN))
+	if (toep->flags & TPF_ABORT_SHUTDOWN)
 		goto done;
 
 	tp->rcv_nxt++;	/* FIN */
@@ -888,7 +888,7 @@ do_close_con_rpl(struct sge_iq *iq, cons
 	CTR4(KTR_CXGBE, "%s: tid %u (%s), toep_flags 0x%x",
 	    __func__, tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags);
 
-	if (toepcb_flag(toep, TPF_ABORT_SHUTDOWN))
+	if (toep->flags & TPF_ABORT_SHUTDOWN)
 		goto done;
 
 	so = inp->inp_socket;
@@ -986,7 +986,7 @@ do_abort_req(struct sge_iq *iq, const st
 	    ("%s: unexpected opcode 0x%x", __func__, opcode));
 	KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__));
 
-	if (toepcb_flag(toep, TPF_SYNQE))
+	if (toep->flags & TPF_SYNQE)
 		return (do_abort_req_synqe(iq, rss, m));
 
 	KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__));
@@ -1015,11 +1015,11 @@ do_abort_req(struct sge_iq *iq, const st
 	 * cleaning up resources.  Otherwise we tear everything down right here
 	 * right now.  We owe the T4 a CPL_ABORT_RPL no matter what.
 	 */
-	if (toepcb_flag(toep, TPF_ABORT_SHUTDOWN)) {
+	if (toep->flags & TPF_ABORT_SHUTDOWN) {
 		INP_WUNLOCK(inp);
 		goto done;
 	}
-	toepcb_set_flag(toep, TPF_ABORT_SHUTDOWN);
+	toep->flags |= TPF_ABORT_SHUTDOWN;
 
 	so_error_set(so, abort_status_to_errno(tp, cpl->status));
 	tp = tcp_close(tp);
@@ -1052,7 +1052,7 @@ do_abort_rpl(struct sge_iq *iq, const st
 	    ("%s: unexpected opcode 0x%x", __func__, opcode));
 	KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__));
 
-	if (toepcb_flag(toep, TPF_SYNQE))
+	if (toep->flags & TPF_SYNQE)
 		return (do_abort_rpl_synqe(iq, rss, m));
 
 	KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__));
@@ -1060,7 +1060,7 @@ do_abort_rpl(struct sge_iq *iq, const st
 	CTR5(KTR_CXGBE, "%s: tid %u, toep %p, inp %p, status %d",
 	    __func__, tid, toep, inp, cpl->status);
 
-	KASSERT(toepcb_flag(toep, TPF_ABORT_SHUTDOWN),
+	KASSERT(toep->flags & TPF_ABORT_SHUTDOWN,
 	    ("%s: wasn't expecting abort reply", __func__));
 
 	INP_WLOCK(inp);
@@ -1082,13 +1082,13 @@ do_rx_data(struct sge_iq *iq, const stru
 	struct sockbuf *sb;
 	int len;
 
-	if (__predict_false(toepcb_flag(toep, TPF_SYNQE))) {
+	if (__predict_false(toep->flags & TPF_SYNQE)) {
 		/*
 		 * do_pass_establish failed and must be attempting to abort the
 		 * synqe's tid.  Meanwhile, the T4 has sent us data for such a
 		 * connection.
 		 */
-		KASSERT(toepcb_flag(toep, TPF_ABORT_SHUTDOWN),
+		KASSERT(toep->flags & TPF_ABORT_SHUTDOWN,
 		    ("%s: synqe and tid isn't being aborted.", __func__));
 		m_freem(m);
 		return (0);
@@ -1266,8 +1266,8 @@ do_fw4_ack(struct sge_iq *iq, const stru
 	 * Very unusual case: we'd sent a flowc + abort_req for a synq entry and
 	 * now this comes back carrying the credits for the flowc.
 	 */
-	if (__predict_false(toepcb_flag(toep, TPF_SYNQE))) {
-		KASSERT(toepcb_flag(toep, TPF_ABORT_SHUTDOWN),
+	if (__predict_false(toep->flags & TPF_SYNQE)) {
+		KASSERT(toep->flags & TPF_ABORT_SHUTDOWN,
 		    ("%s: credits for a synq entry %p", __func__, toep));
 		return (0);
 	}
@@ -1281,7 +1281,7 @@ do_fw4_ack(struct sge_iq *iq, const stru
 
 	INP_WLOCK(inp);
 
-	if (__predict_false(toepcb_flag(toep, TPF_ABORT_SHUTDOWN))) {
+	if (__predict_false(toep->flags & TPF_ABORT_SHUTDOWN)) {
 		INP_WUNLOCK(inp);
 		return (0);
 	}
@@ -1337,11 +1337,11 @@ do_fw4_ack(struct sge_iq *iq, const stru
 	}
 
 	/* XXX */
-	if ((toepcb_flag(toep, TPF_TX_SUSPENDED) &&
+	if ((toep->flags & TPF_TX_SUSPENDED &&
 	    toep->tx_credits >= MIN_OFLD_TX_CREDITS) ||
 	    toep->tx_credits == toep->txsd_total *
 	    howmany((sizeof(struct fw_ofld_tx_data_wr) + 1), 16)) {
-		toepcb_clr_flag(toep, TPF_TX_SUSPENDED);
+		toep->flags &= ~TPF_TX_SUSPENDED;
 		t4_push_frames(sc, toep);
 	}
 	INP_WUNLOCK(inp);

Modified: head/sys/dev/cxgbe/tom/t4_ddp.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_ddp.c	Tue Aug 21 18:24:11 2012	(r239513)
+++ head/sys/dev/cxgbe/tom/t4_ddp.c	Tue Aug 21 18:30:16 2012	(r239514)
@@ -472,7 +472,7 @@ do_rx_data_ddp(struct sge_iq *iq, const 
 
 	KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__));
 	KASSERT(toep->tid == tid, ("%s: toep tid/atid mismatch", __func__));
-	KASSERT(!toepcb_flag(toep, TPF_SYNQE),
+	KASSERT(!(toep->flags & TPF_SYNQE),
 	    ("%s: toep %p claims to be a synq entry", __func__, toep));
 
 	vld = be32toh(cpl->ddpvld);
@@ -497,7 +497,7 @@ do_rx_ddp_complete(struct sge_iq *iq, co
 
 	KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__));
 	KASSERT(toep->tid == tid, ("%s: toep tid/atid mismatch", __func__));
-	KASSERT(!toepcb_flag(toep, TPF_SYNQE),
+	KASSERT(!(toep->flags & TPF_SYNQE),
 	    ("%s: toep %p claims to be a synq entry", __func__, toep));
 
 	handle_ddp_data(toep, cpl->ddp_report, cpl->rcv_nxt, 0);

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_listen.c	Tue Aug 21 18:24:11 2012	(r239513)
+++ head/sys/dev/cxgbe/tom/t4_listen.c	Tue Aug 21 18:30:16 2012	(r239514)
@@ -283,11 +283,11 @@ send_reset_synqe(struct toedev *tod, str
 
 	CTR4(KTR_CXGBE, "%s: synqe %p, tid %d%s",
 	    __func__, synqe, synqe->tid,
-	    synqe_flag(synqe, TPF_ABORT_SHUTDOWN) ?
+	    synqe->flags & TPF_ABORT_SHUTDOWN ?
 	    " (abort already in progress)" : "");
-	if (synqe_flag(synqe, TPF_ABORT_SHUTDOWN))
+	if (synqe->flags & TPF_ABORT_SHUTDOWN)
 		return;	/* abort already in progress */
-	synqe_set_flag(synqe, TPF_ABORT_SHUTDOWN);
+	synqe->flags |= TPF_ABORT_SHUTDOWN;
 
 	get_qids_from_mbuf(m, &txqid, &rxqid);
 	ofld_txq = &sc->sge.ofld_txq[txqid];
@@ -318,7 +318,7 @@ send_reset_synqe(struct toedev *tod, str
         flowc->mnemval[2].val = htobe32(pi->tx_chan);
         flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID;
         flowc->mnemval[3].val = htobe32(ofld_rxq->iq.abs_id);
-	synqe_set_flag(synqe, TPF_FLOWC_WR_SENT);
+	synqe->flags |= TPF_FLOWC_WR_SENT;
 
 	/* ... then ABORT request */
 	INIT_TP_WR_MIT_CPL(req, CPL_ABORT_REQ, synqe->tid);
@@ -515,7 +515,7 @@ release_synqe(struct synq_entry *synqe)
 {
 
 	if (refcount_release(&synqe->refcnt)) {
-		int needfree = synqe_flag(synqe, TPF_SYNQE_NEEDFREE);
+		int needfree = synqe->flags & TPF_SYNQE_NEEDFREE;
 
 		m_freem(synqe->syn);
 		if (needfree)
@@ -740,7 +740,7 @@ do_abort_req_synqe(struct sge_iq *iq, co
 	 * cleaning up resources.  Otherwise we tear everything down right here
 	 * right now.  We owe the T4 a CPL_ABORT_RPL no matter what.
 	 */
-	if (synqe_flag(synqe, TPF_ABORT_SHUTDOWN)) {
+	if (synqe->flags & TPF_ABORT_SHUTDOWN) {
 		INP_WUNLOCK(inp);
 		goto done;
 	}
@@ -775,7 +775,7 @@ do_abort_rpl_synqe(struct sge_iq *iq, co
 	    __func__, tid, synqe, synqe->flags, synqe->lctx, cpl->status);
 
 	INP_WLOCK(inp);
-	KASSERT(synqe_flag(synqe, TPF_ABORT_SHUTDOWN),
+	KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN,
 	    ("%s: wasn't expecting abort reply for synqe %p (0x%x)",
 	    __func__, synqe, synqe->flags));
 
@@ -798,12 +798,12 @@ t4_offload_socket(struct toedev *tod, vo
 
 	INP_INFO_LOCK_ASSERT(&V_tcbinfo); /* prevents bad race with accept() */
 	INP_WLOCK_ASSERT(inp);
-	KASSERT(synqe_flag(synqe, TPF_SYNQE),
+	KASSERT(synqe->flags & TPF_SYNQE,
 	    ("%s: %p not a synq_entry?", __func__, arg));
 
 	offload_socket(so, toep);
 	make_established(toep, cpl->snd_isn, cpl->rcv_isn, cpl->tcp_opt);
-	toepcb_set_flag(toep, TPF_CPL_PENDING);
+	toep->flags |= TPF_CPL_PENDING;
 	update_tid(sc, synqe->tid, toep);
 }
 
@@ -843,13 +843,11 @@ mbuf_to_synqe(struct mbuf *m)
 		synqe = malloc(sizeof(*synqe), M_CXGBE, M_NOWAIT);
 		if (synqe == NULL)
 			return (NULL);
-	} else
+		synqe->flags = TPF_SYNQE | TPF_SYNQE_NEEDFREE;
+	} else {
 		synqe = (void *)(m->m_data + m->m_len + tspace - sizeof(*synqe));
-
-	synqe->flags = 0;
-	synqe_set_flag(synqe, TPF_SYNQE);
-	if (tspace < len)
-		synqe_set_flag(synqe, TPF_SYNQE_NEEDFREE);
+		synqe->flags = TPF_SYNQE;
+	}
 
 	return (synqe);
 }
@@ -1115,7 +1113,7 @@ do_pass_accept_req(struct sge_iq *iq, co
 	INIT_TP_WR_MIT_CPL(rpl, CPL_PASS_ACCEPT_RPL, tid);
 	if (sc->tt.ddp && (so->so_options & SO_NO_DDP) == 0) {
 		ulp_mode = ULP_MODE_TCPDDP;
-		synqe_set_flag(synqe, TPF_SYNQE_TCPDDP);
+		synqe->flags |= TPF_SYNQE_TCPDDP;
 	} else
 		ulp_mode = ULP_MODE_NONE;
 	rpl->opt0 = calc_opt0(so, pi, e, mtu_idx, rscale, rx_credits, ulp_mode);
@@ -1160,7 +1158,7 @@ do_pass_accept_req(struct sge_iq *iq, co
 		INP_WLOCK(inp);
 		if (__predict_false(inp->inp_flags & INP_DROPPED)) {
 			/* listener closed.  synqe must have been aborted. */
-			KASSERT(synqe_flag(synqe, TPF_ABORT_SHUTDOWN),
+			KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN,
 			    ("%s: listener %p closed but synqe %p not aborted",
 			    __func__, inp, synqe));
 
@@ -1178,7 +1176,7 @@ do_pass_accept_req(struct sge_iq *iq, co
 		 * that can only happen if the listener was closed and we just
 		 * checked for that.
 		 */
-		KASSERT(!synqe_flag(synqe, TPF_ABORT_SHUTDOWN),
+		KASSERT(!(synqe->flags & TPF_ABORT_SHUTDOWN),
 		    ("%s: synqe %p aborted, but listener %p not dropped.",
 		    __func__, synqe, inp));
 
@@ -1275,7 +1273,7 @@ do_pass_establish(struct sge_iq *iq, con
 	    ("%s: unexpected opcode 0x%x", __func__, opcode));
 	KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__));
 	KASSERT(lctx->stid == stid, ("%s: lctx stid mismatch", __func__));
-	KASSERT(synqe_flag(synqe, TPF_SYNQE),
+	KASSERT(synqe->flags & TPF_SYNQE,
 	    ("%s: tid %u (ctx %p) not a synqe", __func__, tid, synqe));
 
 	INP_INFO_WLOCK(&V_tcbinfo);	/* for syncache_expand */
@@ -1292,7 +1290,7 @@ do_pass_establish(struct sge_iq *iq, con
 		 * on the lctx's synq.  do_abort_rpl for the tid is responsible
 		 * for cleaning up.
 		 */
-		KASSERT(synqe_flag(synqe, TPF_ABORT_SHUTDOWN),
+		KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN,
 		    ("%s: listen socket dropped but tid %u not aborted.",
 		    __func__, tid));
 
@@ -1322,7 +1320,7 @@ reset:
 	}
 	toep->tid = tid;
 	toep->l2te = &sc->l2t->l2tab[synqe->l2e_idx];
-	if (synqe_flag(synqe, TPF_SYNQE_TCPDDP))
+	if (synqe->flags & TPF_SYNQE_TCPDDP)
 		set_tcpddp_ulp_mode(toep);
 	else
 		toep->ulp_mode = ULP_MODE_NONE;

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tom.c	Tue Aug 21 18:24:11 2012	(r239513)
+++ head/sys/dev/cxgbe/tom/t4_tom.c	Tue Aug 21 18:30:16 2012	(r239514)
@@ -141,9 +141,9 @@ void
 free_toepcb(struct toepcb *toep)
 {
 
-	KASSERT(toepcb_flag(toep, TPF_ATTACHED) == 0,
+	KASSERT(!(toep->flags & TPF_ATTACHED),
 	    ("%s: attached to an inpcb", __func__));
-	KASSERT(toepcb_flag(toep, TPF_CPL_PENDING) == 0,
+	KASSERT(!(toep->flags & TPF_CPL_PENDING),
 	    ("%s: CPL pending", __func__));
 
 	free(toep, M_CXGBE);
@@ -181,7 +181,7 @@ offload_socket(struct socket *so, struct
 
 	/* Install an extra hold on inp */
 	toep->inp = inp;
-	toepcb_set_flag(toep, TPF_ATTACHED);
+	toep->flags |= TPF_ATTACHED;
 	in_pcbref(inp);
 
 	/* Add the TOE PCB to the active list */
@@ -216,7 +216,7 @@ undo_offload_socket(struct socket *so)
 	tp->t_flags &= ~TF_TOE;
 
 	toep->inp = NULL;
-	toepcb_clr_flag(toep, TPF_ATTACHED);
+	toep->flags &= ~TPF_ATTACHED;
 	if (in_pcbrele_wlocked(inp))
 		panic("%s: inp freed.", __func__);
 
@@ -232,9 +232,9 @@ release_offload_resources(struct toepcb 
 	struct adapter *sc = td_adapter(td);
 	int tid = toep->tid;
 
-	KASSERT(toepcb_flag(toep, TPF_CPL_PENDING) == 0,
+	KASSERT(!(toep->flags & TPF_CPL_PENDING),
 	    ("%s: %p has CPL pending.", __func__, toep));
-	KASSERT(toepcb_flag(toep, TPF_ATTACHED) == 0,
+	KASSERT(!(toep->flags & TPF_ATTACHED),
 	    ("%s: %p is still attached.", __func__, toep));
 
 	CTR4(KTR_CXGBE, "%s: toep %p (tid %d, l2te %p)",
@@ -277,7 +277,7 @@ t4_pcb_detach(struct toedev *tod __unuse
 	INP_WLOCK_ASSERT(inp);
 
 	KASSERT(toep != NULL, ("%s: toep is NULL", __func__));
-	KASSERT(toepcb_flag(toep, TPF_ATTACHED),
+	KASSERT(toep->flags & TPF_ATTACHED,
 	    ("%s: not attached", __func__));
 
 #ifdef KTR
@@ -295,9 +295,9 @@ t4_pcb_detach(struct toedev *tod __unuse
 
 	tp->t_toe = NULL;
 	tp->t_flags &= ~TF_TOE;
-	toepcb_clr_flag(toep, TPF_ATTACHED);
+	toep->flags &= ~TPF_ATTACHED;
 
-	if (toepcb_flag(toep, TPF_CPL_PENDING) == 0)
+	if (!(toep->flags & TPF_CPL_PENDING))
 		release_offload_resources(toep);
 }
 
@@ -312,16 +312,16 @@ final_cpl_received(struct toepcb *toep)
 
 	KASSERT(inp != NULL, ("%s: inp is NULL", __func__));
 	INP_WLOCK_ASSERT(inp);
-	KASSERT(toepcb_flag(toep, TPF_CPL_PENDING),
+	KASSERT(toep->flags & TPF_CPL_PENDING,
 	    ("%s: CPL not pending already?", __func__));
 
 	CTR6(KTR_CXGBE, "%s: tid %d, toep %p (0x%x), inp %p (0x%x)",
 	    __func__, toep->tid, toep, toep->flags, inp, inp->inp_flags);
 
 	toep->inp = NULL;
-	toepcb_clr_flag(toep, TPF_CPL_PENDING);
+	toep->flags &= ~TPF_CPL_PENDING;
 
-	if (toepcb_flag(toep, TPF_ATTACHED) == 0)
+	if (!(toep->flags & TPF_ATTACHED))
 		release_offload_resources(toep);
 
 	if (!in_pcbrele_wlocked(inp))

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tom.h	Tue Aug 21 18:24:11 2012	(r239513)
+++ head/sys/dev/cxgbe/tom/t4_tom.h	Tue Aug 21 18:30:16 2012	(r239514)
@@ -55,17 +55,17 @@
 
 /* TOE PCB flags */
 enum {
-	TPF_ATTACHED,		/* a tcpcb refers to this toepcb */
-	TPF_FLOWC_WR_SENT,	/* firmware flow context WR sent */
-	TPF_TX_DATA_SENT,	/* some data sent */
-	TPF_TX_SUSPENDED,	/* tx suspended for lack of resources */
-	TPF_SEND_FIN,		/* send FIN after sending all pending data */
-	TPF_FIN_SENT,		/* FIN has been sent */
-	TPF_ABORT_SHUTDOWN,	/* connection abort is in progress */
-	TPF_CPL_PENDING,	/* haven't received the last CPL */
-	TPF_SYNQE,		/* synq_entry, not really a toepcb */
-	TPF_SYNQE_NEEDFREE,	/* synq_entry was allocated externally */
-	TPF_SYNQE_TCPDDP,	/* ulp_mode TCPDDP when toepcb is allocated */
+	TPF_ATTACHED	   = (1 << 0),	/* a tcpcb refers to this toepcb */
+	TPF_FLOWC_WR_SENT  = (1 << 1),	/* firmware flow context WR sent */
+	TPF_TX_DATA_SENT   = (1 << 2),	/* some data sent */
+	TPF_TX_SUSPENDED   = (1 << 3),	/* tx suspended for lack of resources */
+	TPF_SEND_FIN	   = (1 << 4),	/* send FIN after all pending data */
+	TPF_FIN_SENT	   = (1 << 5),	/* FIN has been sent */
+	TPF_ABORT_SHUTDOWN = (1 << 6),	/* connection abort is in progress */
+	TPF_CPL_PENDING    = (1 << 7),	/* haven't received the last CPL */
+	TPF_SYNQE	   = (1 << 8),	/* synq_entry, not really a toepcb */
+	TPF_SYNQE_NEEDFREE = (1 << 9),	/* synq_entry was malloc'd separately */
+	TPF_SYNQE_TCPDDP   = (1 << 10),	/* ulp_mode TCPDDP in toepcb */
 };
 
 enum {
@@ -134,27 +134,6 @@ struct flowc_tx_params {
 	unsigned int mss;
 };
 
-static inline int
-toepcb_flag(struct toepcb *toep, int flag)
-{
-
-	return isset(&toep->flags, flag);
-}
-
-static inline void
-toepcb_set_flag(struct toepcb *toep, int flag)
-{
-
-	setbit(&toep->flags, flag);
-}
-
-static inline void
-toepcb_clr_flag(struct toepcb *toep, int flag)
-{
-
-	clrbit(&toep->flags, flag);
-}
-
 #define	DDP_RETRY_WAIT	5	/* seconds to wait before re-enabling DDP */
 #define	DDP_LOW_SCORE	1
 #define	DDP_HIGH_SCORE	3
@@ -186,27 +165,6 @@ struct synq_entry {
 	uint16_t rcv_bufsize;
 };
 
-static inline int
-synqe_flag(struct synq_entry *synqe, int flag)
-{
-
-	return isset(&synqe->flags, flag);
-}
-
-static inline void
-synqe_set_flag(struct synq_entry *synqe, int flag)
-{
-
-	setbit(&synqe->flags, flag);
-}
-
-static inline void
-synqe_clr_flag(struct synq_entry *synqe, int flag)
-{
-
-	clrbit(&synqe->flags, flag);
-}
-
 /* listen_ctx flags */
 #define LCTX_RPL_PENDING 1	/* waiting for a CPL_PASS_OPEN_RPL */
 



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