diff options
author | Navdeep Parhar <np@FreeBSD.org> | 2011-03-24 01:16:48 +0000 |
---|---|---|
committer | Navdeep Parhar <np@FreeBSD.org> | 2011-03-24 01:16:48 +0000 |
commit | 7eeb16cee749581407fbb248a688a70a31af0ee9 (patch) | |
tree | 02cd4d93490769de9b1e72646403cbdc8c9994ba /sys | |
parent | 2b3b9558ef6bce90dff5e4448da83a95190ef42f (diff) | |
download | src-7eeb16cee749581407fbb248a688a70a31af0ee9.tar.gz src-7eeb16cee749581407fbb248a688a70a31af0ee9.zip |
t3_free_sge_resources should be given the number of qsets it needs to free.
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=219946
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/cxgb/cxgb_adapter.h | 2 | ||||
-rw-r--r-- | sys/dev/cxgb/cxgb_main.c | 11 | ||||
-rw-r--r-- | sys/dev/cxgb/cxgb_sge.c | 8 |
3 files changed, 9 insertions, 12 deletions
diff --git a/sys/dev/cxgb/cxgb_adapter.h b/sys/dev/cxgb/cxgb_adapter.h index 478538c4f1bf..511b4700a0e3 100644 --- a/sys/dev/cxgb/cxgb_adapter.h +++ b/sys/dev/cxgb/cxgb_adapter.h @@ -510,7 +510,7 @@ int t3_sge_alloc(struct adapter *); int t3_sge_free(struct adapter *); int t3_sge_alloc_qset(adapter_t *, uint32_t, int, int, const struct qset_params *, int, struct port_info *); -void t3_free_sge_resources(adapter_t *); +void t3_free_sge_resources(adapter_t *, int); void t3_sge_start(adapter_t *); void t3_sge_stop(adapter_t *); void t3b_intr(void *data); diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c index be65f02d9165..ae32221de64f 100644 --- a/sys/dev/cxgb/cxgb_main.c +++ b/sys/dev/cxgb/cxgb_main.c @@ -717,7 +717,7 @@ cxgb_controller_detach(device_t dev) static void cxgb_free(struct adapter *sc) { - int i; + int i, nqsets = 0; ADAPTER_LOCK(sc); sc->flags |= CXGB_SHUTDOWN; @@ -731,6 +731,7 @@ cxgb_free(struct adapter *sc) if (sc->portdev[i] && device_delete_child(sc->dev, sc->portdev[i]) != 0) device_printf(sc->dev, "failed to delete child port\n"); + nqsets += sc->port[i].nqsets; } /* @@ -756,7 +757,7 @@ cxgb_free(struct adapter *sc) * sysctls are cleaned up by the kernel linker. */ if (sc->flags & FULL_INIT_DONE) { - t3_free_sge_resources(sc); + t3_free_sge_resources(sc, nqsets); sc->flags &= ~FULL_INIT_DONE; } @@ -842,9 +843,9 @@ setup_sge_qsets(adapter_t *sc) (sc->flags & USING_MSIX) ? qset_idx + 1 : irq_idx, &sc->params.sge.qset[qset_idx], ntxq, pi); if (err) { - t3_free_sge_resources(sc); - device_printf(sc->dev, "t3_sge_alloc_qset failed with %d\n", - err); + t3_free_sge_resources(sc, qset_idx); + device_printf(sc->dev, + "t3_sge_alloc_qset failed with %d\n", err); return (err); } } diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 7b19b0d3da9e..5fce3f574772 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -2092,18 +2092,14 @@ t3_free_qset(adapter_t *sc, struct sge_qset *q) * Frees resources used by the SGE queue sets. */ void -t3_free_sge_resources(adapter_t *sc) +t3_free_sge_resources(adapter_t *sc, int nqsets) { - int i, nqsets; - - for (nqsets = i = 0; i < (sc)->params.nports; i++) - nqsets += sc->port[i].nqsets; + int i; for (i = 0; i < nqsets; ++i) { TXQ_LOCK(&sc->sge.qs[i]); t3_free_qset(sc, &sc->sge.qs[i]); } - } /** |