brintos

brintos / linux-shallow public Read only

0
0
Text · 2.7 KiB · 3d5ae51 Raw
77 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3================4Devlink Resource5================6 7``devlink`` provides the ability for drivers to register resources, which8can allow administrators to see the device restrictions for a given9resource, as well as how much of the given resource is currently10in use. Additionally, these resources can optionally have configurable size.11This could enable the administrator to limit the number of resources that12are used.13 14For example, the ``netdevsim`` driver enables ``/IPv4/fib`` and15``/IPv4/fib-rules`` as resources to limit the number of IPv4 FIB entries and16rules for a given device.17 18Resource Ids19============20 21Each resource is represented by an id, and contains information about its22current size and related sub resources. To access a sub resource, you23specify the path of the resource. For example ``/IPv4/fib`` is the id for24the ``fib`` sub-resource under the ``IPv4`` resource.25 26Generic Resources27=================28 29Generic resources are used to describe resources that can be shared by multiple30device drivers and their description must be added to the following table:31 32.. list-table:: List of Generic Resources33   :widths: 10 9034 35   * - Name36     - Description37   * - ``physical_ports``38     - A limited capacity of physical ports that the switch ASIC can support39 40example usage41-------------42 43The resources exposed by the driver can be observed, for example:44 45.. code:: shell46 47    $devlink resource show pci/0000:03:00.048    pci/0000:03:00.0:49      name kvd size 245760 unit entry50        resources:51          name linear size 98304 occ 0 unit entry size_min 0 size_max 147456 size_gran 12852          name hash_double size 60416 unit entry size_min 32768 size_max 180224 size_gran 12853          name hash_single size 87040 unit entry size_min 65536 size_max 212992 size_gran 12854 55Some resource's size can be changed. Examples:56 57.. code:: shell58 59    $devlink resource set pci/0000:03:00.0 path /kvd/hash_single size 7308860    $devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 7436861 62The changes do not apply immediately, this can be validated by the 'size_new'63attribute, which represents the pending change in size. For example:64 65.. code:: shell66 67    $devlink resource show pci/0000:03:00.068    pci/0000:03:00.0:69      name kvd size 245760 unit entry size_valid false70      resources:71        name linear size 98304 size_new 147456 occ 0 unit entry size_min 0 size_max 147456 size_gran 12872        name hash_double size 60416 unit entry size_min 32768 size_max 180224 size_gran 12873        name hash_single size 87040 unit entry size_min 65536 size_max 212992 size_gran 12874 75Note that changes in resource size may require a device reload to properly76take effect.77