Date: Mon, 26 Nov 2007 00:00:26 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 129529 for review Message-ID: <200711260000.lAQ00QrU052356@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711260000.lAQ00QrU052356>