linux_dsm_epyc7002/drivers/net/ethernet/mellanox/mlx4
Jack Morgenstein 5a0d0a6161 mlx4: Structures and init/teardown for VF resource quotas
This is step #1 for implementing SRIOV resource quotas for VFs.

Quotas are implemented per resource type for VFs and the PF, to prevent
any entity from simply grabbing all the resources for itself and leaving
the other entities unable to obtain such resources.

Resources which are allocated using quotas:  QPs, CQs, SRQs, MPTs, MTTs, MAC,
                                             VLAN, and Counters.

The quota system works as follows:
Each entity (VF or PF) is given a max number of a given resource (its quota),
and a guaranteed minimum number for each resource (starvation prevention).

For QPs, CQs, SRQs, MPTs and MTTs:
50% of the available quantity for the resource is divided equally among
the PF and all the active VFs (i.e., the number of VFs in the mlx4_core module
parameter "num_vfs"). This 50% represents the "guaranteed minimum" pool.
The other 50% is the "free pool", allocated on a first-come-first-serve basis.
For each VF/PF, resources are first allocated from its "guaranteed-minimum"
pool. When that pool is exhausted, the driver attempts to allocate from
the resource "free-pool".

The quota (i.e., max) for the VFs and the PF is:
  The free-pool amount (50% of the real max) + the guaranteed minimum

For MACs:
  Guarantee 2 MACs per VF/PF per port. As a result, since we have only
  128 MACs per port, reduce the allowable number of VFs from 64 to 63.
  Any remaining MACs are put into a free pool.

For VLANs:
  For the PF, the per-port quota is 128 and guarantee is 64
     (to allow the PF to register at least a VLAN per VF in VST mode).
  For the VFs, the per-port quota is 64 and the guarantee is 0.
      We assume that VGT VFs are trusted not to abuse the VLAN resource.

For Counters:
  For all functions (PF and VFs), the quota is 128 and the guarantee is 0.

In this patch, we define the needed structures, which are added to the
resource-tracker struct.  In addition, we do initialization
for the resource quota, and adjust the query_device response to use quotas
rather than resource maxima.

As part of the implementation, we introduce a new field in
mlx4_dev: quotas.  This field holds the resource quotas used
to report maxima to the upper layers (ib_core, via query_device).

The HCA maxima of these values are passed to the VFs (via
QUERY_HCA) so that they may continue to use these in handling
QPs, CQs, SRQs and MPTs.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-04 16:19:07 -05:00
..
alloc.c mlx4_core: Change bitmap allocator to work in round-robin fashion 2012-05-14 13:44:38 -07:00
catas.c mlx4: Add support for EEH error recovery 2012-07-25 15:24:13 -07:00
cmd.c net/mlx4_core: Don't fail reg/unreg vlan for older guests 2013-11-04 16:19:07 -05:00
cq.c net/mlx4_en: Add HW timestamping (TS) support 2013-04-24 16:30:14 -04:00
en_clock.c mlx4_en: fix a build error on 32bit arches 2013-04-30 19:00:25 -04:00
en_cq.c net/mlx4_en: Add Low Latency Socket (LLS) support 2013-06-19 18:32:16 -07:00
en_dcb_nl.c net/mlx4_en: Disable global flow control when PFC enabled 2013-08-21 12:19:26 -07:00
en_ethtool.c net/mlx4_en: Check device state when setting coalescing 2013-09-12 23:42:15 -04:00
en_main.c net/mlx4_en: Fix resource leak in error flow 2013-06-25 16:29:38 -07:00
en_netdev.c net/mlx4_en: Use vlan id instead of vlan index for unregistration 2013-11-04 16:19:07 -05:00
en_port.c mlx4: Ethernet port management modifications 2011-12-13 13:56:07 -05:00
en_port.h net/mlx4_core: set port QoS attributes 2012-04-05 05:08:03 -04:00
en_resources.c net/mlx4: Strengthen VLAN tags/priorities enforcement in VST mode 2013-05-11 16:12:44 -07:00
en_rx.c net/mlx4_en: Fix pages never dma unmapped on rx 2013-10-08 16:09:50 -04:00
en_selftest.c drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
en_tx.c net/mlx4_en: Reduce scope of local variables in mlx4_en_xmit 2013-08-21 12:19:26 -07:00
eq.c net/mlx4_core: Respond to operation request by firmware 2013-07-29 01:12:40 -07:00
fw.c mlx4: Structures and init/teardown for VF resource quotas 2013-11-04 16:19:07 -05:00
fw.h net/mlx4_core: Respond to operation request by firmware 2013-07-29 01:12:40 -07:00
icm.c mlx4_core: Fix integer overflows so 8TBs of memory registration works 2012-09-13 17:52:02 -07:00
icm.h mlx4_core: Fix integer overflows so 8TBs of memory registration works 2012-09-13 17:52:02 -07:00
intf.c mlx4: Use port management change event instead of smp_snoop 2012-07-10 09:47:10 -07:00
Kconfig mlx4_en: Remove remnants of LRO support 2012-11-19 19:13:59 -05:00
main.c mlx4: Structures and init/teardown for VF resource quotas 2013-11-04 16:19:07 -05:00
Makefile net/mlx4_en: Add HW timestamping (TS) support 2013-04-24 16:30:14 -04:00
mcg.c net/mlx4: Clean the code to eliminate trivial build warnings 2013-10-17 15:10:49 -04:00
mlx4_en.h net/mlx4_en: Rename name of mlx4_en_rx_alloc members 2013-10-08 16:09:50 -04:00
mlx4.h mlx4: Structures and init/teardown for VF resource quotas 2013-11-04 16:19:07 -05:00
mr.c net/mlx4_core: Fix checking order in MR table init 2013-11-04 16:19:07 -05:00
pd.c net/mlx4_core: Fix endianness bug in set_param_l 2013-03-07 15:52:03 -05:00
port.c net/mlx4_en: Use vlan id instead of vlan index for unregistration 2013-11-04 16:19:07 -05:00
profile.c mlx4_core: Fix integer overflow issues around MTT table 2012-08-15 21:05:26 -07:00
qp.c mlx4: Structures and init/teardown for VF resource quotas 2013-11-04 16:19:07 -05:00
reset.c mlx4: Use PCI Express Capability accessors 2012-08-23 10:11:13 -06:00
resource_tracker.c mlx4: Structures and init/teardown for VF resource quotas 2013-11-04 16:19:07 -05:00
sense.c Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
srq.c net/mlx4: Clean the code to eliminate trivial build warnings 2013-10-17 15:10:49 -04:00