Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2007 19:06:23 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 128362 for review
Message-ID:  <200710301906.l9UJ6NFu019058@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=128362

Change 128362 by kmacy@kmacy:storage:toestack on 2007/10/30 19:05:34

	- fix null deref
	- fix error code return
	- add debug prints

Affected files ...

.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#4 edit

Differences ...

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

@@ -168,8 +168,24 @@
 {
 	unsigned int idx;
 	struct tcpcb *tp = sototcpcb(so);
-	struct tom_data *d = TOM_DATA(TOE_DEV(so));
-	const struct t3c_data *td = T3C_DATA(d->cdev);
+	struct tom_data *d; 
+	const struct t3c_data *td;
+	struct toedev *toed;
+
+	printf("getting toedev\n");
+	
+	toed = TOE_DEV(so);
+	printf("toedev=%p\n", toed);
+	
+	printf("getting tom_data\n");
+	d = TOM_DATA(toed);
+	printf("tom_data=%p\n", d);
+	if (d == NULL)
+		panic("tom_data not set");
+
+	printf("d->cdev=%p\n", d->cdev);
+	td = T3C_DATA(d->cdev);
+	
 #ifdef notyet
 	struct rtentry *dst = sotoinpcb(so)->inp_route.ro_rt;
 #endif
@@ -258,25 +274,33 @@
 	if (toep == NULL)
 		return (ENOMEM);
 
+	printf("initializing offload socket\n");
+	
 	toepcb_init(toep);
 	toepcb_hold(toep);
 	    
 	tp->t_toe = toep;
 
 	toep->tp_toedev = dev;
+	printf("tp->tp_toedev=%p\n", dev);
+	
 	toep->tp_tid = tid;
 	toep->tp_l2t = e;
 	toep->tp_wr_max = toep->tp_wr_avail = TOM_TUNABLE(dev, max_wrs);
 	toep->tp_wr_unacked = 0;
 	toep->tp_delack_mode = 0;
+	
 	toep->tp_mtu_idx = select_mss(so, dst->rt_ifp->if_mtu);
+	printf("mss selected\n");
+	
 	tp->rcv_wnd = select_rcv_wnd(so);
+	printf("rcv_wnd selected\n");
         toep->tp_ulp_mode = TOM_TUNABLE(dev, ddp) && !(so->so_options & SO_NO_DDP) &&
 		       tp->rcv_wnd >= MIN_DDP_RCV_WIN ? ULP_MODE_TCPDDP : 0;
 	toep->tp_qset_idx = 0;
 	
 	reset_wr_list(tp);
-
+	printf("initialization done\n");
 	return (0);
 }
 
@@ -401,7 +425,7 @@
 	struct inpcb *inp = sotoinpcb(so);
 	struct tcpcb *tp = intotcpcb(inp);
 	struct rtentry *dst = inp->inp_route.ro_rt;
-	struct toepcb *toep = tp->t_toe;
+	struct toepcb *toep; /* allocated by init_offload_socket */
 		
 	int atid, err;
 
@@ -418,18 +442,21 @@
 	
 	if ((err = init_offload_socket(so, tdev, atid, e, dst)))
 		return (err);
-	
+
 	install_offload_ops(so);
 	mk_act_open_req(so, m, atid, e);
 	l2t_send(d->cdev, (struct mbuf *)m, e);
+
+	toep = tp->t_toe;
 	if (toep->tp_ulp_mode)
 		t3_enable_ddp(so, 0);
-	return 	0;
+
+	return 	(0);
 	
 free_tid:
        cxgb_free_atid(d->cdev, atid);
 out_err:
-       return -1;
+       return (ENOMEM);
 }
 
 



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