Lines Matching +full:max +full:- +full:cur

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2009-2013 Chelsio, Inc. All rights reserved.
16 * - Redistributions of source code must retain the above
20 * - Redistributions in binary form must reproduce the above
46 if (c4iw_id_table_alloc(&rdev->resource.qid_table, in c4iw_init_qid_table()
47 rdev->adap->vres.qp.start, in c4iw_init_qid_table()
48 rdev->adap->vres.qp.size, in c4iw_init_qid_table()
49 rdev->adap->vres.qp.size, 0)) { in c4iw_init_qid_table()
51 return -ENOMEM; in c4iw_init_qid_table()
54 for (i = rdev->adap->vres.qp.start; in c4iw_init_qid_table()
55 i < rdev->adap->vres.qp.start + rdev->adap->vres.qp.size; i++) in c4iw_init_qid_table()
56 if (!(i & rdev->qpmask)) in c4iw_init_qid_table()
57 c4iw_id_free(&rdev->resource.qid_table, i); in c4iw_init_qid_table()
65 err = c4iw_id_table_alloc(&rdev->resource.tpt_table, 0, nr_tpt, 1, in c4iw_init_resource()
72 err = c4iw_id_table_alloc(&rdev->resource.pdid_table, 0, in c4iw_init_resource()
78 c4iw_id_table_free(&rdev->resource.qid_table); in c4iw_init_resource()
80 c4iw_id_table_free(&rdev->resource.tpt_table); in c4iw_init_resource()
82 return -ENOMEM; in c4iw_init_resource()
92 if (entry == (u32)(-1)) { in c4iw_get_resource()
110 mutex_lock(&uctx->lock); in c4iw_get_cqid()
111 if (!list_empty(&uctx->cqids)) { in c4iw_get_cqid()
112 entry = list_entry(uctx->cqids.next, struct c4iw_qid_list, in c4iw_get_cqid()
114 list_del(&entry->entry); in c4iw_get_cqid()
115 qid = entry->qid; in c4iw_get_cqid()
118 qid = c4iw_get_resource(&rdev->resource.qid_table); in c4iw_get_cqid()
121 mutex_lock(&rdev->stats.lock); in c4iw_get_cqid()
122 rdev->stats.qid.cur += rdev->qpmask + 1; in c4iw_get_cqid()
123 mutex_unlock(&rdev->stats.lock); in c4iw_get_cqid()
124 for (i = qid+1; i & rdev->qpmask; i++) { in c4iw_get_cqid()
128 entry->qid = i; in c4iw_get_cqid()
129 list_add_tail(&entry->entry, &uctx->cqids); in c4iw_get_cqid()
139 entry->qid = qid; in c4iw_get_cqid()
140 list_add_tail(&entry->entry, &uctx->qpids); in c4iw_get_cqid()
141 for (i = qid+1; i & rdev->qpmask; i++) { in c4iw_get_cqid()
145 entry->qid = i; in c4iw_get_cqid()
146 list_add_tail(&entry->entry, &uctx->qpids); in c4iw_get_cqid()
150 mutex_unlock(&uctx->lock); in c4iw_get_cqid()
152 mutex_lock(&rdev->stats.lock); in c4iw_get_cqid()
153 if (rdev->stats.qid.cur > rdev->stats.qid.max) in c4iw_get_cqid()
154 rdev->stats.qid.max = rdev->stats.qid.cur; in c4iw_get_cqid()
155 mutex_unlock(&rdev->stats.lock); in c4iw_get_cqid()
168 entry->qid = qid; in c4iw_put_cqid()
169 mutex_lock(&uctx->lock); in c4iw_put_cqid()
170 list_add_tail(&entry->entry, &uctx->cqids); in c4iw_put_cqid()
171 mutex_unlock(&uctx->lock); in c4iw_put_cqid()
180 mutex_lock(&uctx->lock); in c4iw_get_qpid()
181 if (!list_empty(&uctx->qpids)) { in c4iw_get_qpid()
182 entry = list_entry(uctx->qpids.next, struct c4iw_qid_list, in c4iw_get_qpid()
184 list_del(&entry->entry); in c4iw_get_qpid()
185 qid = entry->qid; in c4iw_get_qpid()
188 qid = c4iw_get_resource(&rdev->resource.qid_table); in c4iw_get_qpid()
191 mutex_lock(&rdev->stats.lock); in c4iw_get_qpid()
192 rdev->stats.qid.cur += rdev->qpmask + 1; in c4iw_get_qpid()
193 mutex_unlock(&rdev->stats.lock); in c4iw_get_qpid()
194 for (i = qid+1; i & rdev->qpmask; i++) { in c4iw_get_qpid()
198 entry->qid = i; in c4iw_get_qpid()
199 list_add_tail(&entry->entry, &uctx->qpids); in c4iw_get_qpid()
209 entry->qid = qid; in c4iw_get_qpid()
210 list_add_tail(&entry->entry, &uctx->cqids); in c4iw_get_qpid()
211 for (i = qid; i & rdev->qpmask; i++) { in c4iw_get_qpid()
215 entry->qid = i; in c4iw_get_qpid()
216 list_add_tail(&entry->entry, &uctx->cqids); in c4iw_get_qpid()
220 mutex_unlock(&uctx->lock); in c4iw_get_qpid()
222 mutex_lock(&rdev->stats.lock); in c4iw_get_qpid()
223 if (rdev->stats.qid.cur > rdev->stats.qid.max) in c4iw_get_qpid()
224 rdev->stats.qid.max = rdev->stats.qid.cur; in c4iw_get_qpid()
225 mutex_unlock(&rdev->stats.lock); in c4iw_get_qpid()
238 entry->qid = qid; in c4iw_put_qpid()
239 mutex_lock(&uctx->lock); in c4iw_put_qpid()
240 list_add_tail(&entry->entry, &uctx->qpids); in c4iw_put_qpid()
241 mutex_unlock(&uctx->lock); in c4iw_put_qpid()
246 c4iw_id_table_free(&rscp->tpt_table); in c4iw_destroy_resource()
247 c4iw_id_table_free(&rscp->qid_table); in c4iw_destroy_resource()
248 c4iw_id_table_free(&rscp->pdid_table); in c4iw_destroy_resource()
259 vmem_xalloc(rdev->pbl_arena, roundup(size, (1 << MIN_PBL_SHIFT)), in c4iw_pblpool_alloc()
263 mutex_lock(&rdev->stats.lock); in c4iw_pblpool_alloc()
265 rdev->stats.pbl.cur += roundup(size, 1 << MIN_PBL_SHIFT); in c4iw_pblpool_alloc()
266 if (rdev->stats.pbl.cur > rdev->stats.pbl.max) in c4iw_pblpool_alloc()
267 rdev->stats.pbl.max = rdev->stats.pbl.cur; in c4iw_pblpool_alloc()
269 rdev->stats.pbl.fail++; in c4iw_pblpool_alloc()
270 mutex_unlock(&rdev->stats.lock); in c4iw_pblpool_alloc()
277 mutex_lock(&rdev->stats.lock); in c4iw_pblpool_free()
278 rdev->stats.pbl.cur -= roundup(size, 1 << MIN_PBL_SHIFT); in c4iw_pblpool_free()
279 mutex_unlock(&rdev->stats.lock); in c4iw_pblpool_free()
280 vmem_xfree(rdev->pbl_arena, addr, roundup(size,(1 << MIN_PBL_SHIFT))); in c4iw_pblpool_free()
285 rdev->pbl_arena = vmem_create("PBL_MEM_POOL", in c4iw_pblpool_create()
286 rdev->adap->vres.pbl.start, in c4iw_pblpool_create()
287 rdev->adap->vres.pbl.size, in c4iw_pblpool_create()
289 if (!rdev->pbl_arena) in c4iw_pblpool_create()
290 return -ENOMEM; in c4iw_pblpool_create()
297 vmem_destroy(rdev->pbl_arena); in c4iw_pblpool_destroy()
308 vmem_xalloc(rdev->rqt_arena, in c4iw_rqtpool_alloc()
316 device_get_nameunit(rdev->adap->dev)); in c4iw_rqtpool_alloc()
317 mutex_lock(&rdev->stats.lock); in c4iw_rqtpool_alloc()
319 rdev->stats.rqt.cur += roundup(size << 6, 1 << MIN_RQT_SHIFT); in c4iw_rqtpool_alloc()
320 if (rdev->stats.rqt.cur > rdev->stats.rqt.max) in c4iw_rqtpool_alloc()
321 rdev->stats.rqt.max = rdev->stats.rqt.cur; in c4iw_rqtpool_alloc()
323 rdev->stats.rqt.fail++; in c4iw_rqtpool_alloc()
324 mutex_unlock(&rdev->stats.lock); in c4iw_rqtpool_alloc()
331 mutex_lock(&rdev->stats.lock); in c4iw_rqtpool_free()
332 rdev->stats.rqt.cur -= roundup(size << 6, 1 << MIN_RQT_SHIFT); in c4iw_rqtpool_free()
333 mutex_unlock(&rdev->stats.lock); in c4iw_rqtpool_free()
334 vmem_xfree(rdev->rqt_arena, addr, in c4iw_rqtpool_free()
340 rdev->rqt_arena = vmem_create("RQT_MEM_POOL", in c4iw_rqtpool_create()
341 rdev->adap->vres.rq.start, in c4iw_rqtpool_create()
342 rdev->adap->vres.rq.size, in c4iw_rqtpool_create()
344 if (!rdev->rqt_arena) in c4iw_rqtpool_create()
345 return -ENOMEM; in c4iw_rqtpool_create()
352 vmem_destroy(rdev->rqt_arena); in c4iw_rqtpool_destroy()