net/ethtool/netlink.h
Source file repositories/reference/linux-study-clean/net/ethtool/netlink.h
File Facts
- System
- Linux kernel
- Corpus path
net/ethtool/netlink.h- Extension
.h- Size
- 22700 bytes
- Lines
- 529
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ethtool_netlink.hlinux/netdevice.hnet/genetlink.hnet/sock.h
Detected Declarations
struct ethnl_req_infostruct ethnl_req_infostruct ethnl_reply_datastruct ethnl_sock_privstruct ethnl_request_opsenum ethnl_sock_typefunction ethnl_strz_sizefunction ethnl_put_strzfunction ethnl_update_u32function ethnl_update_u8function ethnl_update_bool32function ethnl_update_boolfunction ethnl_update_binaryfunction ethnl_update_bitfield32function ethnl_reply_header_sizefunction ethnl_parse_header_dev_put
Annotated Snippet
struct ethnl_req_info {
struct net_device *dev;
netdevice_tracker dev_tracker;
u32 flags;
u32 phy_index;
};
static inline void ethnl_parse_header_dev_put(struct ethnl_req_info *req_info)
{
netdev_put(req_info->dev, &req_info->dev_tracker);
}
/**
* ethnl_req_get_phydev() - Gets the phy_device targeted by this request,
* if any.
* @req_info: The ethnl request to get the phy from.
* @tb: The netlink attributes array, for error reporting.
* @header: The netlink header index, used for error reporting.
* @extack: The netlink extended ACK, for error reporting.
*
* If a phy_device is returned the caller must hold rtnl_lock when calling
* this function, and until it's done interacting with the returned phy_device.
* IOW caller must hold rtnl_lock unless they know netdev has no phy_device.
*
* Return: A phy_device pointer corresponding either to the passed phy_index
* if one is provided. If not, the phy_device attached to the
* net_device targeted by this request is returned. If there's no
* targeted net_device, or no phy_device is attached, NULL is
* returned. If the provided phy_index is invalid, an error pointer
* is returned.
*/
struct phy_device *ethnl_req_get_phydev(const struct ethnl_req_info *req_info,
struct nlattr **tb, unsigned int header,
struct netlink_ext_ack *extack);
/**
* struct ethnl_reply_data - base type of reply data for GET requests
* @dev: device for current reply message; in single shot requests it is
* equal to ðnl_req_info.dev; in dumps it's different for each
* reply message
*
* This is a common base for request specific structures holding data for
* kernel reply message. These always embed struct ethnl_reply_data at zero
* offset.
*/
struct ethnl_reply_data {
struct net_device *dev;
};
int ethnl_ops_begin(struct net_device *dev);
void ethnl_ops_complete(struct net_device *dev);
enum ethnl_sock_type {
ETHTOOL_SOCK_TYPE_MODULE_FW_FLASH,
};
struct ethnl_sock_priv {
struct net *net;
u32 portid;
enum ethnl_sock_type type;
};
int ethnl_sock_priv_set(struct sk_buff *skb, struct net *net, u32 portid,
enum ethnl_sock_type type);
/**
* struct ethnl_request_ops - unified handling of GET and SET requests
* @request_cmd: command id for request (GET)
* @reply_cmd: command id for reply (GET_REPLY)
* @hdr_attr: attribute type for request header
* @req_info_size: size of request info
* @reply_data_size: size of reply data
* @allow_nodev_do:
* Allow non-dump request with no device identification.
* Note that locks (rtnl_lock etc.) are only taken if device is set.
* @set_ntf_cmd: notification to generate on changes (SET)
* @parse_request:
* Parse request except common header (struct ethnl_req_info). Common
* header is already filled on entry, the rest up to @repdata_offset
* is zero initialized. This callback should only modify type specific
* request info by parsed attributes from request message.
* Called for both GET and SET. Information parsed for SET will
* be conveyed to the req_info used during NTF generation.
* @prepare_data:
* Retrieve and prepare data needed to compose a reply message. Calls to
* ethtool_ops handlers are limited to this callback. Common reply data
* (struct ethnl_reply_data) is filled on entry, type specific part after
* it is zero initialized. This callback should only modify the type
* specific part of reply data. Device identification from struct
* ethnl_reply_data is to be used as for dump requests, it iterates
Annotation
- Immediate include surface: `linux/ethtool_netlink.h`, `linux/netdevice.h`, `net/genetlink.h`, `net/sock.h`.
- Detected declarations: `struct ethnl_req_info`, `struct ethnl_req_info`, `struct ethnl_reply_data`, `struct ethnl_sock_priv`, `struct ethnl_request_ops`, `enum ethnl_sock_type`, `function ethnl_strz_size`, `function ethnl_put_strz`, `function ethnl_update_u32`, `function ethnl_update_u8`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.