Lines Matching refs:res_alloc
312 struct resource_allocator *res_alloc =
313 &priv->mfunc.master.res_tracker.res_alloc[res_type];
321 spin_lock(&res_alloc->alloc_lock);
323 res_alloc->allocated[(port - 1) *
325 res_alloc->allocated[slave];
326 free = (port > 0) ? res_alloc->res_port_free[port - 1] :
327 res_alloc->res_free;
328 reserved = (port > 0) ? res_alloc->res_port_rsvd[port - 1] :
329 res_alloc->res_reserved;
330 guaranteed = res_alloc->guaranteed[slave];
332 if (allocated + count > res_alloc->quota[slave]) {
335 allocated, res_alloc->quota[slave]);
362 res_alloc->allocated[(port - 1) *
364 res_alloc->res_port_free[port - 1] -= count;
365 res_alloc->res_port_rsvd[port - 1] -= from_rsvd;
367 res_alloc->allocated[slave] += count;
368 res_alloc->res_free -= count;
369 res_alloc->res_reserved -= from_rsvd;
374 spin_unlock(&res_alloc->alloc_lock);
383 struct resource_allocator *res_alloc =
384 &priv->mfunc.master.res_tracker.res_alloc[res_type];
390 spin_lock(&res_alloc->alloc_lock);
393 res_alloc->allocated[(port - 1) *
395 res_alloc->allocated[slave];
396 guaranteed = res_alloc->guaranteed[slave];
409 res_alloc->allocated[(port - 1) *
411 res_alloc->res_port_free[port - 1] += count;
412 res_alloc->res_port_rsvd[port - 1] += from_rsvd;
414 res_alloc->allocated[slave] -= count;
415 res_alloc->res_free += count;
416 res_alloc->res_reserved += from_rsvd;
419 spin_unlock(&res_alloc->alloc_lock);
424 struct resource_allocator *res_alloc,
428 res_alloc->guaranteed[vf] = num_instances /
430 res_alloc->quota[vf] = (num_instances / 2) + res_alloc->guaranteed[vf];
432 res_alloc->res_free = num_instances;
435 res_alloc->res_free += dev->caps.reserved_mtts;
436 res_alloc->guaranteed[vf] += dev->caps.reserved_mtts;
437 res_alloc->quota[vf] += dev->caps.reserved_mtts;
463 priv->mfunc.master.res_tracker.res_alloc[RES_QP].quota[pf];
465 priv->mfunc.master.res_tracker.res_alloc[RES_CQ].quota[pf];
467 priv->mfunc.master.res_tracker.res_alloc[RES_SRQ].quota[pf];
469 priv->mfunc.master.res_tracker.res_alloc[RES_MTT].quota[pf];
471 priv->mfunc.master.res_tracker.res_alloc[RES_MPT].quota[pf];
476 struct resource_allocator *res_alloc,
494 if ((res_alloc->res_reserved + counters_guaranteed) >
526 struct resource_allocator *res_alloc =
527 &priv->mfunc.master.res_tracker.res_alloc[i];
528 res_alloc->quota = kmalloc_array(dev->persist->num_vfs + 1,
531 res_alloc->guaranteed = kmalloc_array(dev->persist->num_vfs + 1,
535 res_alloc->allocated =
540 res_alloc->allocated =
545 res_alloc->res_free = dev->caps.max_counters - 1;
547 if (!res_alloc->quota || !res_alloc->guaranteed ||
548 !res_alloc->allocated)
551 spin_lock_init(&res_alloc->alloc_lock);
557 initialize_res_quotas(dev, res_alloc, RES_QP,
563 initialize_res_quotas(dev, res_alloc, RES_CQ,
568 initialize_res_quotas(dev, res_alloc, RES_SRQ,
573 initialize_res_quotas(dev, res_alloc, RES_MPT,
578 initialize_res_quotas(dev, res_alloc, RES_MTT,
598 res_alloc->quota[t] =
601 res_alloc->guaranteed[t] = 2;
603 res_alloc->res_port_free[j] =
606 res_alloc->quota[t] = MLX4_MAX_MAC_NUM;
607 res_alloc->guaranteed[t] = 2;
612 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM;
613 res_alloc->guaranteed[t] = MLX4_MAX_VLAN_NUM / 2;
615 res_alloc->res_port_free[j] =
616 res_alloc->quota[t];
618 res_alloc->quota[t] = MLX4_MAX_VLAN_NUM / 2;
619 res_alloc->guaranteed[t] = 0;
623 res_alloc->quota[t] = dev->caps.max_counters;
624 res_alloc->guaranteed[t] =
625 mlx4_calc_res_counter_guaranteed(dev, res_alloc, t);
633 res_alloc->res_port_rsvd[j] +=
634 res_alloc->guaranteed[t];
636 res_alloc->res_reserved += res_alloc->guaranteed[t];
645 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated);
646 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL;
647 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed);
648 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL;
649 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota);
650 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL;
678 kfree(priv->mfunc.master.res_tracker.res_alloc[i].allocated);
679 priv->mfunc.master.res_tracker.res_alloc[i].allocated = NULL;
680 kfree(priv->mfunc.master.res_tracker.res_alloc[i].guaranteed);
681 priv->mfunc.master.res_tracker.res_alloc[i].guaranteed = NULL;
682 kfree(priv->mfunc.master.res_tracker.res_alloc[i].quota);
683 priv->mfunc.master.res_tracker.res_alloc[i].quota = NULL;