PERFORCE change 128668 for review

Kip Macy kmacy at FreeBSD.org
Sun Nov 4 23:47:34 PST 2007


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

Change 128668 by kmacy at kmacy:storage:toestack on 2007/11/05 07:47:18

	handle listen close
	don't set offload flag so as to avoid dereferencing null toe_usrreqs

Affected files ...

.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_listen.c#4 edit
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.c#7 edit

Differences ...

==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_listen.c#4 (text+ko) ====

@@ -56,6 +56,7 @@
 #include <netinet/tcp.h>
 #include <netinet/tcp_var.h>
 #include <netinet/tcp_fsm.h>
+
 #include <netinet/tcp_ofld.h>
 #include <net/route.h>
 
@@ -80,7 +81,23 @@
 static int
 do_close_server_rpl(struct t3cdev *cdev, struct mbuf *m, void *ctx)
 {
-	UNIMPLEMENTED();
+	struct cpl_close_listserv_rpl *rpl = cplhdr(m);
+	unsigned int stid = GET_TID(rpl);
+
+	if (rpl->status != CPL_ERR_NONE)
+		log(LOG_ERR, "Unexpected CLOSE_LISTSRV_RPL status %u for "
+		       "STID %u\n", rpl->status, stid);
+	else {
+		struct listen_ctx *listen_ctx = (struct listen_ctx *)ctx;
+
+		cxgb_free_stid(cdev, stid);
+#if 0		
+		sock_put(listen_ctx->lsk);
+#endif		
+		free(listen_ctx, M_DEVBUF);
+	}
+
+	return (CPL_RET_BUF_DONE);
 }
 
 /*
@@ -222,7 +239,6 @@
 	struct cpl_pass_open_req *req;
 	struct tom_data *d = TOM_DATA(dev);
 	struct inpcb *inp = sotoinpcb(so);
-	struct tcpcb *tp = sototcpcb(so);
 	struct listen_ctx *ctx;
 
 	if (!TOM_TUNABLE(dev, activated))
@@ -256,7 +272,6 @@
 	if (!listen_hash_add(d, so, stid))
 		goto free_all;
 
-	tp->t_flags |= TF_TOE;
 	req = mtod(m, struct cpl_pass_open_req *);
 	req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
 	OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, stid));
@@ -294,8 +309,7 @@
 	struct mbuf *m;
 	struct cpl_close_listserv_req *req;
 	int stid = listen_hash_del(TOM_DATA(dev), so);
-	printf("stop listen\n");
-
+	
 	if (stid < 0)
 		return;
 

==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.c#7 (text+ko) ====

@@ -358,8 +358,13 @@
 		TAILQ_FOREACH(p, &cxgb_list, entry) {
 			if (event == OFLD_LISTEN_OPEN)
 				t3_listen_start(&p->tdev, so, p->cdev);
-			else
+			else if (tp->t_state == TCPS_LISTEN) {
+				printf("stopping listen on port=%d\n",
+				    ntohs(tp->t_inpcb->inp_lport));
+				
 				t3_listen_stop(&p->tdev, so, p->cdev);
+			}
+			
 		}
 		mtx_unlock(&cxgb_list_lock);
 		break;


More information about the p4-projects mailing list