linux/net/ethtool/netlink.c

// SPDX-License-Identifier: GPL-2.0-only

#include <net/sock.h>
#include <linux/ethtool_netlink.h>
#include <linux/pm_runtime.h>
#include "netlink.h"
#include "module_fw.h"

static struct genl_family ethtool_genl_family;

static bool ethnl_ok __read_mostly;
static u32 ethnl_bcast_seq;

#define ETHTOOL_FLAGS_BASIC
#define ETHTOOL_FLAGS_STATS

const struct nla_policy ethnl_header_policy[] =;

const struct nla_policy ethnl_header_policy_stats[] =;

int ethnl_sock_priv_set(struct sk_buff *skb, struct net_device *dev, u32 portid,
			enum ethnl_sock_type type)
{}

static void ethnl_sock_priv_destroy(void *priv)
{}

int ethnl_ops_begin(struct net_device *dev)
{}

void ethnl_ops_complete(struct net_device *dev)
{}

/**
 * ethnl_parse_header_dev_get() - parse request header
 * @req_info:    structure to put results into
 * @header:      nest attribute with request header
 * @net:         request netns
 * @extack:      netlink extack for error reporting
 * @require_dev: fail if no device identified in header
 *
 * Parse request header in nested attribute @nest and puts results into
 * the structure pointed to by @req_info. Extack from @info is used for error
 * reporting. If req_info->dev is not null on return, reference to it has
 * been taken. If error is returned, *req_info is null initialized and no
 * reference is held.
 *
 * Return: 0 on success or negative error code
 */
int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
			       const struct nlattr *header, struct net *net,
			       struct netlink_ext_ack *extack, bool require_dev)
{}

/**
 * ethnl_fill_reply_header() - Put common header into a reply message
 * @skb:      skb with the message
 * @dev:      network device to describe in header
 * @attrtype: attribute type to use for the nest
 *
 * Create a nested attribute with attributes describing given network device.
 *
 * Return: 0 on success, error value (-EMSGSIZE only) on error
 */
int ethnl_fill_reply_header(struct sk_buff *skb, struct net_device *dev,
			    u16 attrtype)
{}

/**
 * ethnl_reply_init() - Create skb for a reply and fill device identification
 * @payload:      payload length (without netlink and genetlink header)
 * @dev:          device the reply is about (may be null)
 * @cmd:          ETHTOOL_MSG_* message type for reply
 * @hdr_attrtype: attribute type for common header
 * @info:         genetlink info of the received packet we respond to
 * @ehdrp:        place to store payload pointer returned by genlmsg_new()
 *
 * Return: pointer to allocated skb on success, NULL on error
 */
struct sk_buff *ethnl_reply_init(size_t payload, struct net_device *dev, u8 cmd,
				 u16 hdr_attrtype, struct genl_info *info,
				 void **ehdrp)
{}

void *ethnl_dump_put(struct sk_buff *skb, struct netlink_callback *cb, u8 cmd)
{}

void *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd)
{}

void *ethnl_unicast_put(struct sk_buff *skb, u32 portid, u32 seq, u8 cmd)
{}

int ethnl_multicast(struct sk_buff *skb, struct net_device *dev)
{}

/* GET request helpers */

/**
 * struct ethnl_dump_ctx - context structure for generic dumpit() callback
 * @ops:        request ops of currently processed message type
 * @req_info:   parsed request header of processed request
 * @reply_data: data needed to compose the reply
 * @pos_ifindex: saved iteration position - ifindex
 *
 * These parameters are kept in struct netlink_callback as context preserved
 * between iterations. They are initialized by ethnl_default_start() and used
 * in ethnl_default_dumpit() and ethnl_default_done().
 */
struct ethnl_dump_ctx {};

static const struct ethnl_request_ops *
ethnl_default_requests[__ETHTOOL_MSG_USER_CNT] =;

static struct ethnl_dump_ctx *ethnl_dump_context(struct netlink_callback *cb)
{}

/**
 * ethnl_default_parse() - Parse request message
 * @req_info:    pointer to structure to put data into
 * @info:	 genl_info from the request
 * @request_ops: struct request_ops for request type
 * @require_dev: fail if no device identified in header
 *
 * Parse universal request header and call request specific ->parse_request()
 * callback (if defined) to parse the rest of the message.
 *
 * Return: 0 on success or negative error code
 */
static int ethnl_default_parse(struct ethnl_req_info *req_info,
			       const struct genl_info *info,
			       const struct ethnl_request_ops *request_ops,
			       bool require_dev)
{}

/**
 * ethnl_init_reply_data() - Initialize reply data for GET request
 * @reply_data: pointer to embedded struct ethnl_reply_data
 * @ops:        instance of struct ethnl_request_ops describing the layout
 * @dev:        network device to initialize the reply for
 *
 * Fills the reply data part with zeros and sets the dev member. Must be called
 * before calling the ->fill_reply() callback (for each iteration when handling
 * dump requests).
 */
static void ethnl_init_reply_data(struct ethnl_reply_data *reply_data,
				  const struct ethnl_request_ops *ops,
				  struct net_device *dev)
{}

/* default ->doit() handler for GET type requests */
static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info)
{}

static int ethnl_default_dump_one(struct sk_buff *skb, struct net_device *dev,
				  const struct ethnl_dump_ctx *ctx,
				  const struct genl_info *info)
{}

/* Default ->dumpit() handler for GET requests. */
static int ethnl_default_dumpit(struct sk_buff *skb,
				struct netlink_callback *cb)
{}

/* generic ->start() handler for GET requests */
static int ethnl_default_start(struct netlink_callback *cb)
{}

/* default ->done() handler for GET requests */
static int ethnl_default_done(struct netlink_callback *cb)
{}

static int ethnl_default_set_doit(struct sk_buff *skb, struct genl_info *info)
{}

static const struct ethnl_request_ops *
ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] =;

/* default notification handler */
static void ethnl_default_notify(struct net_device *dev, unsigned int cmd,
				 const void *data)
{}

/* notifications */

ethnl_notify_handler_t;

static const ethnl_notify_handler_t ethnl_notify_handlers[] =;

void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)
{}
EXPORT_SYMBOL();

static void ethnl_notify_features(struct netdev_notifier_info *info)
{}

static int ethnl_netdev_event(struct notifier_block *this, unsigned long event,
			      void *ptr)
{}

static struct notifier_block ethnl_netdev_notifier =;

/* genetlink setup */

static const struct genl_ops ethtool_genl_ops[] =;

static const struct genl_multicast_group ethtool_nl_mcgrps[] =;

static struct genl_family ethtool_genl_family __ro_after_init =;

/* module setup */

static int __init ethnl_init(void)
{}

subsys_initcall(ethnl_init);