linux/net/ethtool/coalesce.c

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

#include <linux/dim.h>
#include "netlink.h"
#include "common.h"

struct coalesce_req_info {};

struct coalesce_reply_data {};

#define COALESCE_REPDATA(__reply_base)

#define __SUPPORTED_OFFSET
static u32 attr_to_mask(unsigned int attr_type)
{}

/* build time check that indices in ethtool_ops::supported_coalesce_params
 * match corresponding attribute types with an offset
 */
#define __CHECK_SUPPORTED_OFFSET(x)
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();
__CHECK_SUPPORTED_OFFSET();

const struct nla_policy ethnl_coalesce_get_policy[] =;

static int coalesce_prepare_data(const struct ethnl_req_info *req_base,
				 struct ethnl_reply_data *reply_base,
				 const struct genl_info *info)
{}

static int coalesce_reply_size(const struct ethnl_req_info *req_base,
			       const struct ethnl_reply_data *reply_base)
{}

static bool coalesce_put_u32(struct sk_buff *skb, u16 attr_type, u32 val,
			     u32 supported_params)
{}

static bool coalesce_put_bool(struct sk_buff *skb, u16 attr_type, u32 val,
			      u32 supported_params)
{}

/**
 * coalesce_put_profile - fill reply with a nla nest with four child nla nests.
 * @skb: socket buffer the message is stored in
 * @attr_type: nest attr type ETHTOOL_A_COALESCE_*X_PROFILE
 * @profile: data passed to userspace
 * @coal_flags: modifiable parameters supported by the driver
 *
 * Put a dim profile nest attribute. Refer to ETHTOOL_A_PROFILE_IRQ_MODERATION.
 *
 * Return: 0 on success or a negative error code.
 */
static int coalesce_put_profile(struct sk_buff *skb, u16 attr_type,
				const struct dim_cq_moder *profile,
				u8 coal_flags)
{}

static int coalesce_fill_reply(struct sk_buff *skb,
			       const struct ethnl_req_info *req_base,
			       const struct ethnl_reply_data *reply_base)
{}

/* COALESCE_SET */

static const struct nla_policy coalesce_irq_moderation_policy[] =;

static const struct nla_policy coalesce_profile_policy[] =;

const struct nla_policy ethnl_coalesce_set_policy[] =;

static int
ethnl_set_coalesce_validate(struct ethnl_req_info *req_info,
			    struct genl_info *info)
{}

/**
 * ethnl_update_irq_moder - update a specific field in the given profile
 * @irq_moder: place that collects dim related information
 * @irq_field: field in profile to modify
 * @attr_type: attr type ETHTOOL_A_IRQ_MODERATION_*
 * @tb: netlink attribute with new values or null
 * @coal_bit: DIM_COALESCE_* bit from coal_flags
 * @mod: pointer to bool for modification tracking
 * @extack: netlink extended ack
 *
 * Return: 0 on success or a negative error code.
 */
static int ethnl_update_irq_moder(struct dim_irq_moder *irq_moder,
				  u16 *irq_field, u16 attr_type,
				  struct nlattr **tb,
				  u8 coal_bit, bool *mod,
				  struct netlink_ext_ack *extack)
{}

/**
 * ethnl_update_profile - get a profile nest with child nests from userspace.
 * @dev: netdevice to update the profile
 * @dst: profile get from the driver and modified by ethnl_update_profile.
 * @nests: nest attr ETHTOOL_A_COALESCE_*X_PROFILE to set profile.
 * @mod: pointer to bool for modification tracking
 * @extack: Netlink extended ack
 *
 * Layout of nests:
 *   Nested ETHTOOL_A_COALESCE_*X_PROFILE attr
 *     Nested ETHTOOL_A_PROFILE_IRQ_MODERATION attr
 *       ETHTOOL_A_IRQ_MODERATION_USEC attr
 *       ETHTOOL_A_IRQ_MODERATION_PKTS attr
 *       ETHTOOL_A_IRQ_MODERATION_COMPS attr
 *     ...
 *     Nested ETHTOOL_A_PROFILE_IRQ_MODERATION attr
 *       ETHTOOL_A_IRQ_MODERATION_USEC attr
 *       ETHTOOL_A_IRQ_MODERATION_PKTS attr
 *       ETHTOOL_A_IRQ_MODERATION_COMPS attr
 *
 * Return: 0 on success or a negative error code.
 */
static int ethnl_update_profile(struct net_device *dev,
				struct dim_cq_moder __rcu **dst,
				const struct nlattr *nests,
				bool *mod,
				struct netlink_ext_ack *extack)
{}

static int
__ethnl_set_coalesce(struct ethnl_req_info *req_info, struct genl_info *info,
		     bool *dual_change)
{}

static int
ethnl_set_coalesce(struct ethnl_req_info *req_info, struct genl_info *info)
{}

const struct ethnl_request_ops ethnl_coalesce_request_ops =;