include/net/net_shaper.h
Source file repositories/reference/linux-study-clean/include/net/net_shaper.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/net_shaper.h- Extension
.h- Size
- 3584 bytes
- Lines
- 122
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.huapi/linux/net_shaper.h
Detected Declarations
struct net_devicestruct devlinkstruct netlink_ext_ackstruct net_shaper_bindingstruct net_shaper_handlestruct net_shaperstruct net_shaper_opsenum net_shaper_binding_type
Annotated Snippet
struct net_shaper_binding {
enum net_shaper_binding_type type;
union {
struct net_device *netdev;
struct devlink *devlink;
};
};
struct net_shaper_handle {
enum net_shaper_scope scope;
u32 id;
};
/**
* struct net_shaper - represents a shaping node on the NIC H/W
* zeroed field are considered not set.
* @parent: Unique identifier for the shaper parent, usually implied
* @handle: Unique identifier for this shaper
* @metric: Specify if the rate limits refers to PPS or BPS
* @bw_min: Minimum guaranteed rate for this shaper
* @bw_max: Maximum peak rate allowed for this shaper
* @burst: Maximum burst for the peek rate of this shaper
* @priority: Scheduling priority for this shaper
* @weight: Scheduling weight for this shaper
*/
struct net_shaper {
struct net_shaper_handle parent;
struct net_shaper_handle handle;
enum net_shaper_metric metric;
u64 bw_min;
u64 bw_max;
u64 burst;
u32 priority;
u32 weight;
/* private: */
u32 leaves; /* accounted only for NODE scope */
bool valid;
struct rcu_head rcu;
};
/**
* struct net_shaper_ops - Operations on device H/W shapers
*
* The operations applies to either net_device and devlink objects.
* The initial shaping configuration at device initialization is empty:
* does not constraint the rate in any way.
* The network core keeps track of the applied user-configuration in
* the net_device or devlink structure.
* The operations are serialized via a per device lock.
*
* Device not supporting any kind of nesting should not provide the
* group operation.
*
* Each shaper is uniquely identified within the device with a 'handle'
* comprising the shaper scope and a scope-specific id.
*/
struct net_shaper_ops {
/**
* @group: create the specified shapers scheduling group
*
* Nest the @leaves shapers identified under the * @node shaper.
* All the shapers belong to the device specified by @binding.
* The @leaves arrays size is specified by @leaves_count.
* Create either the @leaves and the @node shaper; or if they already
* exists, links them together in the desired way.
* @leaves scope must be NET_SHAPER_SCOPE_QUEUE.
*/
int (*group)(struct net_shaper_binding *binding, int leaves_count,
const struct net_shaper *leaves,
const struct net_shaper *node,
struct netlink_ext_ack *extack);
/**
* @set: Updates the specified shaper
*
* Updates or creates the @shaper on the device specified by @binding.
*/
int (*set)(struct net_shaper_binding *binding,
const struct net_shaper *shaper,
struct netlink_ext_ack *extack);
/**
* @delete: Removes the specified shaper
*
* Removes the shaper configuration as identified by the given @handle
* on the device specified by @binding, restoring the default behavior.
*/
int (*delete)(struct net_shaper_binding *binding,
const struct net_shaper_handle *handle,
Annotation
- Immediate include surface: `linux/types.h`, `uapi/linux/net_shaper.h`.
- Detected declarations: `struct net_device`, `struct devlink`, `struct netlink_ext_ack`, `struct net_shaper_binding`, `struct net_shaper_handle`, `struct net_shaper`, `struct net_shaper_ops`, `enum net_shaper_binding_type`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.