Lines Matching refs:res_alloc

301 	struct resource_allocator *res_alloc =  in mlx4_grant_resource()  local
302 &priv->mfunc.master.res_tracker.res_alloc[res_type]; in mlx4_grant_resource()
310 spin_lock(&res_alloc->alloc_lock); in mlx4_grant_resource()
312 res_alloc->allocated[(port - 1) * in mlx4_grant_resource()
314 res_alloc->allocated[slave]; in mlx4_grant_resource()
315 free = (port > 0) ? res_alloc->res_port_free[port - 1] : in mlx4_grant_resource()
316 res_alloc->res_free; in mlx4_grant_resource()
317 reserved = (port > 0) ? res_alloc->res_port_rsvd[port - 1] : in mlx4_grant_resource()
318 res_alloc->res_reserved; in mlx4_grant_resource()
319 guaranteed = res_alloc->guaranteed[slave]; in mlx4_grant_resource()
321 if (allocated + count > res_alloc->quota[slave]) { in mlx4_grant_resource()
324 allocated, res_alloc->quota[slave]); in mlx4_grant_resource()
351 res_alloc->allocated[(port - 1) * in mlx4_grant_resource()
353 res_alloc->res_port_free[port - 1] -= count; in mlx4_grant_resource()
354 res_alloc->res_port_rsvd[port - 1] -= from_rsvd; in mlx4_grant_resource()
356 res_alloc->allocated[slave] += count; in mlx4_grant_resource()
357 res_alloc->res_free -= count; in mlx4_grant_resource()
358 res_alloc->res_reserved -= from_rsvd; in mlx4_grant_resource()
363 spin_unlock(&res_alloc->alloc_lock); in mlx4_grant_resource()
372 struct resource_allocator *res_alloc = in mlx4_release_resource() local
373 &priv->mfunc.master.res_tracker.res_alloc[res_type]; in mlx4_release_resource()
379 spin_lock(&res_alloc->alloc_lock); in mlx4_release_resource()
382 res_alloc->allocated[(port - 1) * in mlx4_release_resource()
384 res_alloc->allocated[slave]; in mlx4_release_resource()
385 guaranteed = res_alloc->guaranteed[slave]; in mlx4_release_resource()
398 res_alloc->allocated[(port - 1) * in mlx4_release_resource()
400 res_alloc->res_port_free[port - 1] += count; in mlx4_release_resource()
401 res_alloc->res_port_rsvd[port - 1] += from_rsvd; in mlx4_release_resource()
403 res_alloc->allocated[slave] -= count; in mlx4_release_resource()
404 res_alloc->res_free += count; in mlx4_release_resource()
405 res_alloc->res_reserved += from_rsvd; in mlx4_release_resource()
408 spin_unlock(&res_alloc->alloc_lock); in mlx4_release_resource()
413 struct resource_allocator *res_alloc, in initialize_res_quotas() argument
417 res_alloc->guaranteed[vf] = num_instances / in initialize_res_quotas()
419 res_alloc->quota[vf] = (num_instances / 2) + res_alloc->guaranteed[vf]; in initialize_res_quotas()
421 res_alloc->res_free = num_instances; in initialize_res_quotas()
424 res_alloc->res_free += dev->caps.reserved_mtts; in initialize_res_quotas()
425 res_alloc->guaranteed[vf] += dev->caps.reserved_mtts; in initialize_res_quotas()
426 res_alloc->quota[vf] += dev->caps.reserved_mtts; in initialize_res_quotas()
452 priv->mfunc.master.res_tracker.res_alloc[RES_QP].quota[pf]; in mlx4_init_quotas()
454 priv->mfunc.master.res_tracker.res_alloc[RES_CQ].quota[pf]; in mlx4_init_quotas()
456 priv->mfunc.master.res_tracker.res_alloc[RES_SRQ].quota[pf]; in mlx4_init_quotas()
458 priv->mfunc.master.res_tracker.res_alloc[RES_MTT].quota[pf]; in mlx4_init_quotas()
460 priv->mfunc.master.res_tracker.res_alloc[RES_MPT].quota[pf]; in mlx4_init_quotas()
487 struct resource_allocator *res_alloc = in mlx4_init_resource_tracker() local
488 &priv->mfunc.master.res_tracker.res_alloc[i]; in mlx4_init_resource_tracker()
489 res_alloc->quota = kmalloc((dev->persist->num_vfs + 1) * in mlx4_init_resource_tracker()
491 res_alloc->guaranteed = kmalloc((dev->persist->num_vfs + 1) * in mlx4_init_resource_tracker()
494 res_alloc->allocated = kzalloc(MLX4_MAX_PORTS * in mlx4_init_resource_tracker()
499 res_alloc->allocated = kzalloc((dev->persist-> in mlx4_init_resource_tracker()
503 if (!res_alloc->quota || !res_alloc->guaranteed || in mlx4_init_resource_tracker()
504 !res_alloc->allocated) in mlx4_init_resource_tracker()
507 spin_lock_init(&res_alloc->alloc_lock); in mlx4_init_resource_tracker()
513 initialize_res_quotas(dev, res_alloc, RES_QP, in mlx4_init_resource_tracker()
519 initialize_res_quotas(dev, res_alloc, RES_CQ, in mlx4_init_resource_tracker()
524 initialize_res_quotas(dev, res_alloc, RES_SRQ, in mlx4_init_resource_tracker()
529 initialize_res_quotas(dev, res_alloc, RES_MPT, in mlx4_init_resource_tracker()
534 initialize_res_quotas(dev, res_alloc, RES_MTT, in mlx4_init_resource_tracker()
554 res_alloc->quota[t] = in mlx4_init_resource_tracker()
557 res_alloc->guaranteed[t] = 2; in mlx4_init_resource_tracker()
559 res_alloc->res_port_free[j] = in mlx4_init_resource_tracker()
562 res_alloc->quota[t] = MLX4_MAX_MAC_NUM; in mlx4_init_resource_tracker()
563 res_alloc->guaranteed[t] = 2; in mlx4_init_resource_tracker()
568 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM; in mlx4_init_resource_tracker()
569 res_alloc->guaranteed[t] = MLX4_MAX_VLAN_NUM / 2; in mlx4_init_resource_tracker()
571 res_alloc->res_port_free[j] = in mlx4_init_resource_tracker()
572 res_alloc->quota[t]; in mlx4_init_resource_tracker()
574 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM / 2; in mlx4_init_resource_tracker()
575 res_alloc->guaranteed[t] = 0; in mlx4_init_resource_tracker()
579 res_alloc->quota[t] = dev->caps.max_counters; in mlx4_init_resource_tracker()
580 res_alloc->guaranteed[t] = 0; in mlx4_init_resource_tracker()
582 res_alloc->res_free = res_alloc->quota[t]; in mlx4_init_resource_tracker()
590 res_alloc->res_port_rsvd[j] += in mlx4_init_resource_tracker()
591 res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
593 res_alloc->res_reserved += res_alloc->guaranteed[t]; in mlx4_init_resource_tracker()
602 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated); in mlx4_init_resource_tracker()
603 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL; in mlx4_init_resource_tracker()
604 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed); in mlx4_init_resource_tracker()
605 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL; in mlx4_init_resource_tracker()
606 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota); in mlx4_init_resource_tracker()
607 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL; in mlx4_init_resource_tracker()
635 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated); in mlx4_free_resource_tracker()
636 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL; in mlx4_free_resource_tracker()
637 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed); in mlx4_free_resource_tracker()
638 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL; in mlx4_free_resource_tracker()
639 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota); in mlx4_free_resource_tracker()
640 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL; in mlx4_free_resource_tracker()