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()
476 struct resource_allocator *res_alloc, in mlx4_calc_res_counter_guaranteed() argument
494 if ((res_alloc->res_reserved + counters_guaranteed) > in mlx4_calc_res_counter_guaranteed()
526 struct resource_allocator *res_alloc = in mlx4_init_resource_tracker() local
527 &priv->mfunc.master.res_tracker.res_alloc[i]; in mlx4_init_resource_tracker()
528 res_alloc->quota = kmalloc_array(dev->persist->num_vfs + 1, in mlx4_init_resource_tracker()
531 res_alloc->guaranteed = kmalloc_array(dev->persist->num_vfs + 1, in mlx4_init_resource_tracker()
535 res_alloc->allocated = in mlx4_init_resource_tracker()
540 res_alloc->allocated = in mlx4_init_resource_tracker()
545 res_alloc->res_free = dev->caps.max_counters - 1; in mlx4_init_resource_tracker()
547 if (!res_alloc->quota || !res_alloc->guaranteed || in mlx4_init_resource_tracker()
548 !res_alloc->allocated) in mlx4_init_resource_tracker()
551 spin_lock_init(&res_alloc->alloc_lock); in mlx4_init_resource_tracker()
557 initialize_res_quotas(dev, res_alloc, RES_QP, in mlx4_init_resource_tracker()
563 initialize_res_quotas(dev, res_alloc, RES_CQ, in mlx4_init_resource_tracker()
568 initialize_res_quotas(dev, res_alloc, RES_SRQ, in mlx4_init_resource_tracker()
573 initialize_res_quotas(dev, res_alloc, RES_MPT, in mlx4_init_resource_tracker()
578 initialize_res_quotas(dev, res_alloc, RES_MTT, in mlx4_init_resource_tracker()
598 res_alloc->quota[t] = in mlx4_init_resource_tracker()
601 res_alloc->guaranteed[t] = 2; in mlx4_init_resource_tracker()
603 res_alloc->res_port_free[j] = in mlx4_init_resource_tracker()
606 res_alloc->quota[t] = MLX4_MAX_MAC_NUM; in mlx4_init_resource_tracker()
607 res_alloc->guaranteed[t] = 2; in mlx4_init_resource_tracker()
612 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM; in mlx4_init_resource_tracker()
613 res_alloc->guaranteed[t] = MLX4_MAX_VLAN_NUM / 2; in mlx4_init_resource_tracker()
615 res_alloc->res_port_free[j] = in mlx4_init_resource_tracker()
616 res_alloc->quota[t]; in mlx4_init_resource_tracker()
618 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM / 2; in mlx4_init_resource_tracker()
619 res_alloc->guaranteed[t] = 0; in mlx4_init_resource_tracker()
623 res_alloc->quota[t] = dev->caps.max_counters; in mlx4_init_resource_tracker()
624 res_alloc->guaranteed[t] = in mlx4_init_resource_tracker()
625 mlx4_calc_res_counter_guaranteed(dev, res_alloc, t); in mlx4_init_resource_tracker()
633 res_alloc->res_port_rsvd[j] += in mlx4_init_resource_tracker()
634 res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
636 res_alloc->res_reserved += res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
645 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated); in mlx4_init_resource_tracker()
646 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL; in mlx4_init_resource_tracker()
647 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed); in mlx4_init_resource_tracker()
648 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL; in mlx4_init_resource_tracker()
649 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota); in mlx4_init_resource_tracker()
650 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL; in mlx4_init_resource_tracker()
678 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated); in mlx4_free_resource_tracker()
679 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL; in mlx4_free_resource_tracker()
680 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed); in mlx4_free_resource_tracker()
681 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL; in mlx4_free_resource_tracker()
682 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota); in mlx4_free_resource_tracker()
683 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL; in mlx4_free_resource_tracker()