Class: Nl::Linux::NetShaper

Inherits:
Genl::Family show all
Defined in:
nl-linux/generated/nl/linux/net_shaper.rb

Overview

Networking HW rate limiting configuration.

This API allows configuring HW shapers available on the network devices at different levels (queues, network device) and allows arbitrary manipulation of the scheduling tree of the involved shapers.

Each shaper is identified within the given device, by a handle, comprising both a scope and an id.

Depending on the scope value, the shapers are attached to specific HW objects (queues, devices) or, for node scope, represent a scheduling group, that can be placed in an arbitrary location of the scheduling tree.

Shapers can be created with two different operations: the set operation, to create and update a single "attached" shaper, and the group operation, to create and update a scheduling group. Only the group operation can create node scope shapers.

Existing shapers can be deleted/reset via the delete operation.

The user can query the running configuration via the get operation.

Different devices can provide different feature sets, e.g. with no support for complex scheduling hierarchy, or for some shaping parameters. The user can introspect the HW capabilities via the cap-get operation.

Defined Under Namespace

Modules: AttributeSets, Constants, Enums, Messages, Notifications, Structs Classes: AsyncOperations

Constant Summary collapse

NAME =
"net-shaper"
VERSION =
1

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Genl::Family

version

Class Method Details

.open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY) ⇒ NetShaper .open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY) {|family| ... } ⇒ Object

Overloads:

  • .open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY) ⇒ NetShaper

    Parameters:

    • resolver (#call) (defaults to: ::Nl::Linux::DEFAULT_RESOLVER)
    • executor (Symbol, nil) (defaults to: nil)
    • notification_capacity (Integer, nil) (defaults to: DEFAULT_NOTIFICATION_CAPACITY)

    Returns:

  • .open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY) {|family| ... } ⇒ Object

    Returns the result of the block.

    Parameters:

    • resolver (#call) (defaults to: ::Nl::Linux::DEFAULT_RESOLVER)
    • executor (Symbol, nil) (defaults to: nil)
    • notification_capacity (Integer, nil) (defaults to: DEFAULT_NOTIFICATION_CAPACITY)

    Yield Parameters:

    Returns:

    • (Object) —

      the result of the block



53
54
55
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 53

def self.open(resolver: ::Nl::Linux::DEFAULT_RESOLVER, executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY)
  super
end

Instance Method Details

#async(stream_capacity: nil) ⇒ AsyncOperations

Returns the asynchronous operation facade for this family.

Parameters:

  • stream_capacity (::Integer, nil) (defaults to: nil)

Returns:



1407
1408
1409
1410
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 1407

def async(stream_capacity: nil)
  return @async_operations ||= build_async_facade(AsyncOperations) if stream_capacity.nil?
  build_async_facade(AsyncOperations, stream_capacity:)
end

#do_cap_get(**args) ⇒ Messages::DoCapGetReply

Get the shaper capabilities supported by the given device for the specified scope.

Parameters:

  • args (Hash)

Options Hash (**args):

  • ifindex (Integer) —

    Interface index queried for shapers capabilities.

  • scope (Integer) —

    The scope to which the queried capabilities apply.

    Known enum values are defined in Nl::Linux::NetShaper::Enums::Scope.

Returns:

See Also:



1235
1236
1237
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 1235

def do_cap_get(**args)
  exchange_message(:"do", Messages::DoCapGetRequest, Messages::DoCapGetReply, args)
end

#do_delete(**args) ⇒ void

This method returns an undefined value.

Clear (remove) the specified shaper. When deleting a node shaper, reattach all the node's leaves to the deleted node's parent. If, after the removal, the parent shaper has no more leaves and the parent shaper scope is node, the parent node is deleted, recursively. When deleting a queue shaper or a netdev shaper, the shaper disappears from the hierarchy, but the queue/device can still send traffic: it has an implicit node with infinite bandwidth. The queue's implicit node feeds an implicit RR node at the root of the hierarchy.

Requires CAP_NET_ADMIN in the initial user namespace.

Parameters:

  • args (Hash)

Options Hash (**args):

  • handle (AttributeSets::Handle, Hash<Symbol, Object>) —

    Unique identifier for the given shaper inside the owning device.

  • ifindex (Integer) —

    Interface index owning the specified shaper.

See Also:



1175
1176
1177
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 1175

def do_delete(**args)
  exchange_message(:"do", Messages::DoDeleteRequest, nil, args)
end

#do_get(**args) ⇒ Messages::DoGetReply

Get information about a shaper for a given device.

Parameters:

  • args (Hash)

Options Hash (**args):

  • handle (AttributeSets::Handle, Hash<Symbol, Object>) —

    Unique identifier for the given shaper inside the owning device.

  • ifindex (Integer) —

    Interface index owning the specified shaper.

Returns:

See Also:



1106
1107
1108
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 1106

def do_get(**args)
  exchange_message(:"do", Messages::DoGetRequest, Messages::DoGetReply, args)
end

#do_group(**args) ⇒ Messages::DoGroupReply

Create or update a scheduling group, attaching the specified leaves shapers under the specified node identified by handle. The leaves shapers scope must be queue and the node shaper scope must be either node or netdev. When the node shaper has node scope, if the handle id is not specified, a new shaper of such scope is created, otherwise the specified node must already exist. When updating an existing node shaper, the specified leaves are added to the existing node; such node will also retain any preexisting leave. The parent handle for a new node shaper defaults to the parent of all the leaves, provided all the leaves share the same parent. Otherwise parent handle must be specified. The user can optionally provide shaping attributes for the node shaper. The operation is atomic, on failure no change is applied to the device shaping configuration, otherwise the node shaper full identifier, comprising binding and handle, is provided as the reply.

Requires CAP_NET_ADMIN in the initial user namespace.

Parameters:

  • args (Hash)

Options Hash (**args):

  • handle (AttributeSets::Handle, Hash<Symbol, Object>) —

    Unique identifier for the given shaper inside the owning device.

  • metric (Integer) —

    Metric used by the given shaper for bw-min, bw-max and burst.

    Known enum values are defined in Nl::Linux::NetShaper::Enums::Metric.

  • bw_min (Integer) —

    Guaranteed bandwidth for the given shaper.

  • bw_max (Integer) —

    Maximum bandwidth for the given shaper or 0 when unlimited.

  • burst (Integer) —

    Maximum burst-size for shaping. Should not be interpreted as a quantum.

  • priority (Integer) —

    Scheduling priority for the given shaper. The priority scheduling is applied to sibling shapers.

  • weight (Integer) —

    Relative weight for round robin scheduling of the given shaper. The scheduling is applied to all sibling shapers with the same priority.

  • ifindex (Integer) —

    Interface index owning the specified shaper.

  • parent (AttributeSets::Handle, Hash<Symbol, Object>) —

    Identifier for the parent of the affected shaper. Only needed for group operation.

  • leaves (Array<AttributeSets::LeafInfo, Hash<Symbol, Object>>) —

    Describes a set of leaves shapers for a group operation.

Returns:

See Also:



1222
1223
1224
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 1222

def do_group(**args)
  exchange_message(:"do", Messages::DoGroupRequest, Messages::DoGroupReply, args)
end

#do_set(**args) ⇒ void

This method returns an undefined value.

Create or update the specified shaper. The set operation can't be used to create a node scope shaper, use the group operation instead.

Requires CAP_NET_ADMIN in the initial user namespace.

Parameters:

  • args (Hash)

Options Hash (**args):

  • handle (AttributeSets::Handle, Hash<Symbol, Object>) —

    Unique identifier for the given shaper inside the owning device.

  • metric (Integer) —

    Metric used by the given shaper for bw-min, bw-max and burst.

    Known enum values are defined in Nl::Linux::NetShaper::Enums::Metric.

  • bw_min (Integer) —

    Guaranteed bandwidth for the given shaper.

  • bw_max (Integer) —

    Maximum bandwidth for the given shaper or 0 when unlimited.

  • burst (Integer) —

    Maximum burst-size for shaping. Should not be interpreted as a quantum.

  • priority (Integer) —

    Scheduling priority for the given shaper. The priority scheduling is applied to sibling shapers.

  • weight (Integer) —

    Relative weight for round robin scheduling of the given shaper. The scheduling is applied to all sibling shapers with the same priority.

  • ifindex (Integer) —

    Interface index owning the specified shaper.

See Also:



1152
1153
1154
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 1152

def do_set(**args)
  exchange_message(:"do", Messages::DoSetRequest, nil, args)
end

#dump_cap_get(**args) ⇒ Array<Messages::DumpCapGetReply> #dump_cap_get(**args) {|reply| ... } ⇒ void

Get the shaper capabilities supported by the given device for the specified scope.

Overloads:

  • #dump_cap_get(**args) ⇒ Array<Messages::DumpCapGetReply>

    Returns an array when no block is given.

    Parameters:

    • args (Hash)

    Options Hash (**args):

    • ifindex (Integer) —

      Interface index queried for shapers capabilities.

    Returns:

  • #dump_cap_get(**args) {|reply| ... } ⇒ void

    This method returns an undefined value.

    Yields each reply when a block is given.

    Parameters:

    • args (Hash)

    Options Hash (**args):

    • ifindex (Integer) —

      Interface index queried for shapers capabilities.

    Yield Parameters:

See Also:



1254
1255
1256
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 1254

def dump_cap_get(**args, &block)
  exchange_message(:"dump", Messages::DumpCapGetRequest, Messages::DumpCapGetReply, args, &block)
end

#dump_get(**args) ⇒ Array<Messages::DumpGetReply> #dump_get(**args) {|reply| ... } ⇒ void

Get information about a shaper for a given device.

Overloads:

  • #dump_get(**args) ⇒ Array<Messages::DumpGetReply>

    Returns an array when no block is given.

    Parameters:

    • args (Hash)

    Options Hash (**args):

    • ifindex (Integer) —

      Interface index owning the specified shaper.

    Returns:

  • #dump_get(**args) {|reply| ... } ⇒ void

    This method returns an undefined value.

    Yields each reply when a block is given.

    Parameters:

    • args (Hash)

    Options Hash (**args):

    • ifindex (Integer) —

      Interface index owning the specified shaper.

    Yield Parameters:

See Also:



1124
1125
1126
# File 'nl-linux/generated/nl/linux/net_shaper.rb', line 1124

def dump_get(**args, &block)
  exchange_message(:"dump", Messages::DumpGetRequest, Messages::DumpGetReply, args, &block)
end