PERFORCE change 135047 for review

Steve Wise swise at FreeBSD.org
Fri Feb 8 12:09:23 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=135047

Change 135047 by swise at swise:vic10:iwarp on 2008/02/08 20:08:24

	More fixes for running over TOE socket.
	
	- save listen ep in cm_id->provider_id
	- only upcall on recv sockbuf
	- fixed sending ABORT via linger on + linger time 0

Affected files ...

.. //depot/projects/iwarp/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c#2 edit

Differences ...

==== //depot/projects/iwarp/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c#2 (text+ko) ====

@@ -265,7 +265,8 @@
 void __free_ep(struct iwch_ep_common *epc)
 {
 	PDBG("%s ep %p state %s\n", __FUNCTION__, epc, states[state_read(epc)]);
-	BUG_ON(epc->so);
+	if (epc->so)
+		printf("%s warning ep->so %p \n", __FUNCTION__, epc->so);
 	free(epc, M_DEVBUF);
 }
 
@@ -338,6 +339,11 @@
 static void
 close_socket(struct iwch_ep_common *epc)
 {
+	SOCK_LOCK(epc->so);
+	epc->so->so_upcall = NULL;
+	epc->so->so_upcallarg = NULL;
+	epc->so->so_rcv.sb_flags &= ~SB_UPCALL;
+	SOCK_UNLOCK(epc->so);
 	soclose(epc->so);
 	epc->so = NULL;
 }
@@ -347,18 +353,21 @@
 {
 	struct sockopt sopt;
 	int err;
-	int linger_time=0;
+	struct linger l;
+
+	l.l_onoff = 1;
+	l.l_linger = 0;
 
 	/* linger_time of 0 forces RST to be sent */
 	sopt.sopt_dir = SOPT_SET;
 	sopt.sopt_level = SOL_SOCKET;
 	sopt.sopt_name = SO_LINGER;
-	sopt.sopt_val = (caddr_t)&linger_time;
-	sopt.sopt_valsize = sizeof linger_time;
+	sopt.sopt_val = (caddr_t)&l;
+	sopt.sopt_valsize = sizeof l;
 	sopt.sopt_td = NULL;
 	err = sosetopt(ep->com.so, &sopt);
 	if (err) 
-		printf("%s can't set linger to 0, no RST!\n", __FUNCTION__);
+		printf("%s can't set linger to 0, no RST! err %d\n", __FUNCTION__, err);
 	close_socket(&ep->com);
 }
 
@@ -1250,7 +1259,6 @@
 	epc->so->so_upcall = iwch_so_upcall;
 	epc->so->so_upcallarg = epc;
 	epc->so->so_rcv.sb_flags |= SB_UPCALL;
-	epc->so->so_snd.sb_flags |= SB_UPCALL;
 	epc->so->so_state |= SS_NBIO;
 	return 0;
 }
@@ -1371,8 +1379,10 @@
 	}
 
 	err = solisten(ep->com.so, ep->backlog, ep->com.thread);
-	if (!err)
+	if (!err) {
+		cm_id->provider_data = ep;
 		goto out;
+	}
 fail2:
 	close_socket(&ep->com);
 fail1:
@@ -1522,7 +1532,6 @@
 	so->so_head = NULL;
 	soref(so);
 	so->so_rcv.sb_flags |= SB_UPCALL;
-	so->so_snd.sb_flags |= SB_UPCALL;
 	so->so_state |= SS_NBIO;
 	BUG_ON(!(so->so_state & SS_ISCONNECTED));
 	BUG_ON(so->so_error);
@@ -1590,19 +1599,19 @@
 	}
 
 	/* connection error */
-	if (ep->com.so->so_error) {
+	if (so->so_error) {
 		process_conn_error(ep);
 		return;
 	}
 
 	/* peer close */
-	if (ep->com.so->so_state & SS_ISDISCONNECTING && state < CLOSING) {
+	if (so->so_state & SS_ISDISCONNECTING && state < CLOSING) {
 		process_peer_close(ep);
 		return;
 	}
 
 	/* close complete */
-	if (ep->com.so->so_state & (SS_ISDISCONNECTED)) {
+	if (so->so_state & (SS_ISDISCONNECTED)) {
 		process_close_complete(ep);
 		return;
 	}


More information about the p4-projects mailing list