From owner-p4-projects@FreeBSD.ORG Tue Oct 30 19:06:23 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8BDFD16A468; Tue, 30 Oct 2007 19:06:23 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4041716A420 for ; Tue, 30 Oct 2007 19:06:23 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 31BA113C494 for ; Tue, 30 Oct 2007 19:06:23 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l9UJ6NYA019061 for ; Tue, 30 Oct 2007 19:06:23 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l9UJ6NFu019058 for perforce@freebsd.org; Tue, 30 Oct 2007 19:06:23 GMT (envelope-from kmacy@freebsd.org) Date: Tue, 30 Oct 2007 19:06:23 GMT Message-Id: <200710301906.l9UJ6NFu019058@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 128362 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2007 19:06:23 -0000 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); }