Lines Matching refs:res_alloc

304 	struct resource_allocator *res_alloc =  in mlx4_grant_resource()  local
305 &priv->mfunc.master.res_tracker.res_alloc[res_type]; in mlx4_grant_resource()
313 spin_lock(&res_alloc->alloc_lock); in mlx4_grant_resource()
315 res_alloc->allocated[(port - 1) * in mlx4_grant_resource()
317 res_alloc->allocated[slave]; in mlx4_grant_resource()
318 free = (port > 0) ? res_alloc->res_port_free[port - 1] : in mlx4_grant_resource()
319 res_alloc->res_free; in mlx4_grant_resource()
320 reserved = (port > 0) ? res_alloc->res_port_rsvd[port - 1] : in mlx4_grant_resource()
321 res_alloc->res_reserved; in mlx4_grant_resource()
322 guaranteed = res_alloc->guaranteed[slave]; in mlx4_grant_resource()
324 if (allocated + count > res_alloc->quota[slave]) { in mlx4_grant_resource()
327 allocated, res_alloc->quota[slave]); in mlx4_grant_resource()
354 res_alloc->allocated[(port - 1) * in mlx4_grant_resource()
356 res_alloc->res_port_free[port - 1] -= count; in mlx4_grant_resource()
357 res_alloc->res_port_rsvd[port - 1] -= from_rsvd; in mlx4_grant_resource()
359 res_alloc->allocated[slave] += count; in mlx4_grant_resource()
360 res_alloc->res_free -= count; in mlx4_grant_resource()
361 res_alloc->res_reserved -= from_rsvd; in mlx4_grant_resource()
366 spin_unlock(&res_alloc->alloc_lock); in mlx4_grant_resource()
375 struct resource_allocator *res_alloc = in mlx4_release_resource() local
376 &priv->mfunc.master.res_tracker.res_alloc[res_type]; in mlx4_release_resource()
382 spin_lock(&res_alloc->alloc_lock); in mlx4_release_resource()
385 res_alloc->allocated[(port - 1) * in mlx4_release_resource()
387 res_alloc->allocated[slave]; in mlx4_release_resource()
388 guaranteed = res_alloc->guaranteed[slave]; in mlx4_release_resource()
401 res_alloc->allocated[(port - 1) * in mlx4_release_resource()
403 res_alloc->res_port_free[port - 1] += count; in mlx4_release_resource()
404 res_alloc->res_port_rsvd[port - 1] += from_rsvd; in mlx4_release_resource()
406 res_alloc->allocated[slave] -= count; in mlx4_release_resource()
407 res_alloc->res_free += count; in mlx4_release_resource()
408 res_alloc->res_reserved += from_rsvd; in mlx4_release_resource()
411 spin_unlock(&res_alloc->alloc_lock); in mlx4_release_resource()
416 struct resource_allocator *res_alloc, in initialize_res_quotas() argument
420 res_alloc->guaranteed[vf] = num_instances / in initialize_res_quotas()
422 res_alloc->quota[vf] = (num_instances / 2) + res_alloc->guaranteed[vf]; in initialize_res_quotas()
424 res_alloc->res_free = num_instances; in initialize_res_quotas()
427 res_alloc->res_free += dev->caps.reserved_mtts; in initialize_res_quotas()
428 res_alloc->guaranteed[vf] += dev->caps.reserved_mtts; in initialize_res_quotas()
429 res_alloc->quota[vf] += dev->caps.reserved_mtts; in initialize_res_quotas()
455 priv->mfunc.master.res_tracker.res_alloc[RES_QP].quota[pf]; in mlx4_init_quotas()
457 priv->mfunc.master.res_tracker.res_alloc[RES_CQ].quota[pf]; in mlx4_init_quotas()
459 priv->mfunc.master.res_tracker.res_alloc[RES_SRQ].quota[pf]; in mlx4_init_quotas()
461 priv->mfunc.master.res_tracker.res_alloc[RES_MTT].quota[pf]; in mlx4_init_quotas()
463 priv->mfunc.master.res_tracker.res_alloc[RES_MPT].quota[pf]; in mlx4_init_quotas()
500 struct resource_allocator *res_alloc = in mlx4_init_resource_tracker() local
501 &priv->mfunc.master.res_tracker.res_alloc[i]; in mlx4_init_resource_tracker()
502 res_alloc->quota = kmalloc((dev->persist->num_vfs + 1) * in mlx4_init_resource_tracker()
504 res_alloc->guaranteed = kmalloc((dev->persist->num_vfs + 1) * in mlx4_init_resource_tracker()
507 res_alloc->allocated = kzalloc(MLX4_MAX_PORTS * in mlx4_init_resource_tracker()
512 res_alloc->allocated = kzalloc((dev->persist-> in mlx4_init_resource_tracker()
517 res_alloc->res_free = dev->caps.max_counters - 1; in mlx4_init_resource_tracker()
519 if (!res_alloc->quota || !res_alloc->guaranteed || in mlx4_init_resource_tracker()
520 !res_alloc->allocated) in mlx4_init_resource_tracker()
523 spin_lock_init(&res_alloc->alloc_lock); in mlx4_init_resource_tracker()
529 initialize_res_quotas(dev, res_alloc, RES_QP, in mlx4_init_resource_tracker()
535 initialize_res_quotas(dev, res_alloc, RES_CQ, in mlx4_init_resource_tracker()
540 initialize_res_quotas(dev, res_alloc, RES_SRQ, in mlx4_init_resource_tracker()
545 initialize_res_quotas(dev, res_alloc, RES_MPT, in mlx4_init_resource_tracker()
550 initialize_res_quotas(dev, res_alloc, RES_MTT, in mlx4_init_resource_tracker()
570 res_alloc->quota[t] = in mlx4_init_resource_tracker()
573 res_alloc->guaranteed[t] = 2; in mlx4_init_resource_tracker()
575 res_alloc->res_port_free[j] = in mlx4_init_resource_tracker()
578 res_alloc->quota[t] = MLX4_MAX_MAC_NUM; in mlx4_init_resource_tracker()
579 res_alloc->guaranteed[t] = 2; in mlx4_init_resource_tracker()
584 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM; in mlx4_init_resource_tracker()
585 res_alloc->guaranteed[t] = MLX4_MAX_VLAN_NUM / 2; in mlx4_init_resource_tracker()
587 res_alloc->res_port_free[j] = in mlx4_init_resource_tracker()
588 res_alloc->quota[t]; in mlx4_init_resource_tracker()
590 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM / 2; in mlx4_init_resource_tracker()
591 res_alloc->guaranteed[t] = 0; in mlx4_init_resource_tracker()
595 res_alloc->quota[t] = dev->caps.max_counters; in mlx4_init_resource_tracker()
597 res_alloc->guaranteed[t] = in mlx4_init_resource_tracker()
601 res_alloc->guaranteed[t] = in mlx4_init_resource_tracker()
605 res_alloc->guaranteed[t] = 0; in mlx4_init_resource_tracker()
606 res_alloc->res_free -= res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
614 res_alloc->res_port_rsvd[j] += in mlx4_init_resource_tracker()
615 res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
617 res_alloc->res_reserved += res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
626 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated); in mlx4_init_resource_tracker()
627 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL; in mlx4_init_resource_tracker()
628 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed); in mlx4_init_resource_tracker()
629 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL; in mlx4_init_resource_tracker()
630 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota); in mlx4_init_resource_tracker()
631 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL; in mlx4_init_resource_tracker()
659 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated); in mlx4_free_resource_tracker()
660 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL; in mlx4_free_resource_tracker()
661 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed); in mlx4_free_resource_tracker()
662 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL; in mlx4_free_resource_tracker()
663 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota); in mlx4_free_resource_tracker()
664 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL; in mlx4_free_resource_tracker()