Lines Matching refs:res_alloc

312 	struct resource_allocator *res_alloc =  in mlx4_grant_resource()  local
313 &priv->mfunc.master.res_tracker.res_alloc[res_type]; in mlx4_grant_resource()
321 spin_lock(&res_alloc->alloc_lock); in mlx4_grant_resource()
323 res_alloc->allocated[(port - 1) * in mlx4_grant_resource()
325 res_alloc->allocated[slave]; in mlx4_grant_resource()
326 free = (port > 0) ? res_alloc->res_port_free[port - 1] : in mlx4_grant_resource()
327 res_alloc->res_free; in mlx4_grant_resource()
328 reserved = (port > 0) ? res_alloc->res_port_rsvd[port - 1] : in mlx4_grant_resource()
329 res_alloc->res_reserved; in mlx4_grant_resource()
330 guaranteed = res_alloc->guaranteed[slave]; in mlx4_grant_resource()
332 if (allocated + count > res_alloc->quota[slave]) { in mlx4_grant_resource()
335 allocated, res_alloc->quota[slave]); in mlx4_grant_resource()
362 res_alloc->allocated[(port - 1) * in mlx4_grant_resource()
364 res_alloc->res_port_free[port - 1] -= count; in mlx4_grant_resource()
365 res_alloc->res_port_rsvd[port - 1] -= from_rsvd; in mlx4_grant_resource()
367 res_alloc->allocated[slave] += count; in mlx4_grant_resource()
368 res_alloc->res_free -= count; in mlx4_grant_resource()
369 res_alloc->res_reserved -= from_rsvd; in mlx4_grant_resource()
374 spin_unlock(&res_alloc->alloc_lock); in mlx4_grant_resource()
383 struct resource_allocator *res_alloc = in mlx4_release_resource() local
384 &priv->mfunc.master.res_tracker.res_alloc[res_type]; in mlx4_release_resource()
390 spin_lock(&res_alloc->alloc_lock); in mlx4_release_resource()
393 res_alloc->allocated[(port - 1) * in mlx4_release_resource()
395 res_alloc->allocated[slave]; in mlx4_release_resource()
396 guaranteed = res_alloc->guaranteed[slave]; in mlx4_release_resource()
409 res_alloc->allocated[(port - 1) * in mlx4_release_resource()
411 res_alloc->res_port_free[port - 1] += count; in mlx4_release_resource()
412 res_alloc->res_port_rsvd[port - 1] += from_rsvd; in mlx4_release_resource()
414 res_alloc->allocated[slave] -= count; in mlx4_release_resource()
415 res_alloc->res_free += count; in mlx4_release_resource()
416 res_alloc->res_reserved += from_rsvd; in mlx4_release_resource()
419 spin_unlock(&res_alloc->alloc_lock); in mlx4_release_resource()
424 struct resource_allocator *res_alloc, in initialize_res_quotas() argument
428 res_alloc->guaranteed[vf] = num_instances / in initialize_res_quotas()
430 res_alloc->quota[vf] = (num_instances / 2) + res_alloc->guaranteed[vf]; in initialize_res_quotas()
432 res_alloc->res_free = num_instances; in initialize_res_quotas()
435 res_alloc->res_free += dev->caps.reserved_mtts; in initialize_res_quotas()
436 res_alloc->guaranteed[vf] += dev->caps.reserved_mtts; in initialize_res_quotas()
437 res_alloc->quota[vf] += dev->caps.reserved_mtts; in initialize_res_quotas()
463 priv->mfunc.master.res_tracker.res_alloc[RES_QP].quota[pf]; in mlx4_init_quotas()
465 priv->mfunc.master.res_tracker.res_alloc[RES_CQ].quota[pf]; in mlx4_init_quotas()
467 priv->mfunc.master.res_tracker.res_alloc[RES_SRQ].quota[pf]; in mlx4_init_quotas()
469 priv->mfunc.master.res_tracker.res_alloc[RES_MTT].quota[pf]; in mlx4_init_quotas()
471 priv->mfunc.master.res_tracker.res_alloc[RES_MPT].quota[pf]; in mlx4_init_quotas()
508 struct resource_allocator *res_alloc = in mlx4_init_resource_tracker() local
509 &priv->mfunc.master.res_tracker.res_alloc[i]; in mlx4_init_resource_tracker()
510 res_alloc->quota = kmalloc_array(dev->persist->num_vfs + 1, in mlx4_init_resource_tracker()
513 res_alloc->guaranteed = kmalloc_array(dev->persist->num_vfs + 1, in mlx4_init_resource_tracker()
517 res_alloc->allocated = in mlx4_init_resource_tracker()
522 res_alloc->allocated = in mlx4_init_resource_tracker()
527 res_alloc->res_free = dev->caps.max_counters - 1; in mlx4_init_resource_tracker()
529 if (!res_alloc->quota || !res_alloc->guaranteed || in mlx4_init_resource_tracker()
530 !res_alloc->allocated) in mlx4_init_resource_tracker()
533 spin_lock_init(&res_alloc->alloc_lock); in mlx4_init_resource_tracker()
539 initialize_res_quotas(dev, res_alloc, RES_QP, in mlx4_init_resource_tracker()
545 initialize_res_quotas(dev, res_alloc, RES_CQ, in mlx4_init_resource_tracker()
550 initialize_res_quotas(dev, res_alloc, RES_SRQ, in mlx4_init_resource_tracker()
555 initialize_res_quotas(dev, res_alloc, RES_MPT, in mlx4_init_resource_tracker()
560 initialize_res_quotas(dev, res_alloc, RES_MTT, in mlx4_init_resource_tracker()
580 res_alloc->quota[t] = in mlx4_init_resource_tracker()
583 res_alloc->guaranteed[t] = 2; in mlx4_init_resource_tracker()
585 res_alloc->res_port_free[j] = in mlx4_init_resource_tracker()
588 res_alloc->quota[t] = MLX4_MAX_MAC_NUM; in mlx4_init_resource_tracker()
589 res_alloc->guaranteed[t] = 2; in mlx4_init_resource_tracker()
594 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM; in mlx4_init_resource_tracker()
595 res_alloc->guaranteed[t] = MLX4_MAX_VLAN_NUM / 2; in mlx4_init_resource_tracker()
597 res_alloc->res_port_free[j] = in mlx4_init_resource_tracker()
598 res_alloc->quota[t]; in mlx4_init_resource_tracker()
600 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM / 2; in mlx4_init_resource_tracker()
601 res_alloc->guaranteed[t] = 0; in mlx4_init_resource_tracker()
605 res_alloc->quota[t] = dev->caps.max_counters; in mlx4_init_resource_tracker()
607 res_alloc->guaranteed[t] = in mlx4_init_resource_tracker()
611 res_alloc->guaranteed[t] = in mlx4_init_resource_tracker()
615 res_alloc->guaranteed[t] = 0; in mlx4_init_resource_tracker()
623 res_alloc->res_port_rsvd[j] += in mlx4_init_resource_tracker()
624 res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
626 res_alloc->res_reserved += res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
635 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated); in mlx4_init_resource_tracker()
636 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL; in mlx4_init_resource_tracker()
637 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed); in mlx4_init_resource_tracker()
638 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL; in mlx4_init_resource_tracker()
639 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota); in mlx4_init_resource_tracker()
640 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL; in mlx4_init_resource_tracker()
668 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated); in mlx4_free_resource_tracker()
669 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL; in mlx4_free_resource_tracker()
670 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed); in mlx4_free_resource_tracker()
671 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL; in mlx4_free_resource_tracker()
672 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota); in mlx4_free_resource_tracker()
673 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL; in mlx4_free_resource_tracker()