svn commit: r340063 - head/sys/dev/cxgbe/iw_cxgbe

Navdeep Parhar np at FreeBSD.org
Fri Nov 2 16:21:45 UTC 2018


Author: np
Date: Fri Nov  2 16:21:44 2018
New Revision: 340063
URL: https://svnweb.freebsd.org/changeset/base/340063

Log:
  cxgbe/iw_cxgbe: Suppress spurious "Unexpected streaming data ..."
  messages.
  
  Submitted by:	Krishnamraju Eraparaju @ Chelsio
  MFC after:	1 month
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c
  head/sys/dev/cxgbe/iw_cxgbe/qp.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==============================================================================
--- head/sys/dev/cxgbe/iw_cxgbe/cm.c	Fri Nov  2 15:32:04 2018	(r340062)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.c	Fri Nov  2 16:21:44 2018	(r340063)
@@ -174,7 +174,6 @@ static void process_newconn(struct c4iw_listen_ep *mas
 		free(__a, M_SONAME); \
 	} while (0)
 
-#ifdef KTR
 static char *states[] = {
 	"idle",
 	"listen",
@@ -190,7 +189,6 @@ static char *states[] = {
 	"dead",
 	NULL,
 };
-#endif
 
 static void deref_cm_id(struct c4iw_ep_common *epc)
 {
@@ -883,7 +881,9 @@ uninit_iwarp_socket(struct socket *so)
 static void
 process_data(struct c4iw_ep *ep)
 {
+	int ret = 0;
 	int disconnect = 0;
+	struct c4iw_qp_attributes attrs = {0};
 
 	CTR5(KTR_IW_CXGBE, "%s: so %p, ep %p, state %s, sbused %d", __func__,
 	    ep->com.so, ep, states[ep->com.state], sbused(&ep->com.so->so_rcv));
@@ -898,9 +898,16 @@ process_data(struct c4iw_ep *ep)
 			/* Refered in process_newconn() */
 			c4iw_put_ep(&ep->parent_ep->com);
 		break;
+	case FPDU_MODE:
+		MPASS(ep->com.qp != NULL);
+		attrs.next_state = C4IW_QP_STATE_TERMINATE;
+		ret = c4iw_modify_qp(ep->com.dev, ep->com.qp,
+					C4IW_QP_ATTR_NEXT_STATE, &attrs, 1);
+		if (ret != -EINPROGRESS)
+			disconnect = 1;
+		break;
 	default:
-		if (sbused(&ep->com.so->so_rcv))
-			log(LOG_ERR, "%s: Unexpected streaming data. ep %p, "
+		log(LOG_ERR, "%s: Unexpected streaming data. ep %p, "
 			    "state %d, so %p, so_state 0x%x, sbused %u\n",
 			    __func__, ep, ep->com.state, ep->com.so,
 			    ep->com.so->so_state, sbused(&ep->com.so->so_rcv));
@@ -1180,7 +1187,24 @@ process_socket_event(struct c4iw_ep *ep)
 	}
 
 	/* rx data */
-	process_data(ep);
+	if (sbused(&ep->com.so->so_rcv)) {
+		process_data(ep);
+		return;
+	}
+
+	/* Socket events for 'MPA Request Received' and 'Close Complete'
+	 * were already processed earlier in their previous events handlers.
+	 * Hence, these socket events are skipped.
+	 * And any other socket events must have handled above.
+	 */
+	MPASS((ep->com.state == MPA_REQ_RCVD) || (ep->com.state == MORIBUND));
+
+	if ((ep->com.state != MPA_REQ_RCVD) && (ep->com.state != MORIBUND))
+		log(LOG_ERR, "%s: Unprocessed socket event so %p, "
+		"so_state 0x%x, so_err %d, sb_state 0x%x, ep %p, ep_state %s\n",
+		__func__, so, so->so_state, so->so_error, so->so_rcv.sb_state,
+			ep, states[state]);
+
 }
 
 SYSCTL_NODE(_hw, OID_AUTO, iw_cxgbe, CTLFLAG_RD, 0, "iw_cxgbe driver parameters");
@@ -1633,6 +1657,7 @@ send_abort(struct c4iw_ep *ep)
 	 * handler(not yet implemented) of iw_cxgbe driver.
 	 */
 	release_ep_resources(ep);
+	ep->com.state = DEAD;
 
 	return (0);
 }

Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c
==============================================================================
--- head/sys/dev/cxgbe/iw_cxgbe/qp.c	Fri Nov  2 15:32:04 2018	(r340062)
+++ head/sys/dev/cxgbe/iw_cxgbe/qp.c	Fri Nov  2 16:21:44 2018	(r340063)
@@ -1475,6 +1475,22 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_q
 	if (qhp->attr.state == attrs->next_state)
 		goto out;
 
+	/* Return EINPROGRESS if QP is already in transition state.
+	 * Eg: CLOSING->IDLE transition or *->ERROR transition.
+	 * This can happen while connection is switching(due to rdma_fini)
+	 * from iWARP/RDDP to TOE mode and any inflight RDMA RX data will
+	 * reach TOE driver -> TCP stack -> iWARP driver. In this way
+	 * iWARP driver keep receiving inflight RDMA RX data until socket
+	 * is closed or aborted. And if iWARP CM is in FPDU sate, then
+	 * it tries to put QP in TERM state and disconnects endpoint.
+	 * But as QP is already in transition state, this event is ignored.
+	 */
+	if ((qhp->attr.state >= C4IW_QP_STATE_ERROR) &&
+		(attrs->next_state == C4IW_QP_STATE_TERMINATE)) {
+		ret = -EINPROGRESS;
+		goto out;
+	}
+
 	switch (qhp->attr.state) {
 	case C4IW_QP_STATE_IDLE:
 		switch (attrs->next_state) {


More information about the svn-src-all mailing list