From owner-p4-projects@FreeBSD.ORG Mon Nov 26 00:00:27 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0DDB516A510; Mon, 26 Nov 2007 00:00:26 +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 4F6EC16A469 for ; Mon, 26 Nov 2007 00:00:26 +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 3CE8713C4CE for ; Mon, 26 Nov 2007 00:00:26 +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 lAQ00QMa052359 for ; Mon, 26 Nov 2007 00:00:26 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lAQ00QrU052356 for perforce@freebsd.org; Mon, 26 Nov 2007 00:00:26 GMT (envelope-from kmacy@freebsd.org) Date: Mon, 26 Nov 2007 00:00:26 GMT Message-Id: <200711260000.lAQ00QrU052356@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 129529 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: Mon, 26 Nov 2007 00:00:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=129529 Change 129529 by kmacy@kmacy:storage:toestack on 2007/11/26 00:00:25 unhook toepcb from its tcpcb use cxgb malloc type Affected files ... .. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.c#13 edit Differences ... ==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.c#13 (text+ko) ==== @@ -144,8 +144,6 @@ return (NULL); toepcb_init(toep); - toepcb_hold(toep); - return (toep); } @@ -153,6 +151,7 @@ toepcb_init(struct toepcb *toep) { bzero(toep, sizeof(*toep)); + toep->tp_refcount = 1; } void @@ -164,11 +163,20 @@ void toepcb_release(struct toepcb *toep) { + struct tcpcb *tp; + + if (toep->tp_refcount == 1) { /* * XXX clear our reference on the inpcb */ cxgb_remove_tid(TOM_DATA(toep->tp_toedev)->cdev, NULL, toep->tp_tid); + if ((tp = toep->tp_tp) != NULL) { + INP_LOCK(tp->t_inpcb); + tp->t_flags &= ~TF_TOE; + tp->t_toe = NULL; + INP_UNLOCK(tp->t_inpcb); + } free(toep, M_DEVBUF); return; } @@ -200,7 +208,7 @@ struct toedev *tdev; struct adap_ports *port_info; - t = malloc(sizeof(*t), M_DEVBUF, M_NOWAIT|M_ZERO); + t = malloc(sizeof(*t), M_CXGB, M_NOWAIT|M_ZERO); if (!t) return; @@ -208,7 +216,7 @@ if (cdev->ctl(cdev, GET_WR_LEN, &wr_len) < 0) goto out_free_tom; - port_info = malloc(sizeof(*port_info), M_DEVBUF, M_NOWAIT|M_ZERO); + port_info = malloc(sizeof(*port_info), M_CXGB, M_NOWAIT|M_ZERO); if (!port_info) goto out_free_tom; @@ -247,9 +255,9 @@ return; out_free_all: - free(port_info, M_DEVBUF); + free(port_info, M_CXGB); out_free_tom: - free(t, M_DEVBUF); + free(t, M_CXGB); return; }