0
     ˆÁÃ„mçÜoÀÆÅ ?÷     /* SPDX-License-Identifier: GPL-2.0 */
/*
 * ethtool.h: Defines for Linux ethtool.
 *
 * Copyright (C) 1998 David S. Miller (davem@redhat.com)
 * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
 * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
 * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
 *                                christopher.leech@intel.com,
 *                                scott.feldman@intel.com)
 * Portions Copyright (C) Sun Microsystems 2008
 */
#ifndef _LINUX_ETHTOOL_H
#define _LINUX_ETHTOOL_H

#include <linux/bitmap.h>
#include <linux/compat.h>
#include <linux/if_ether.h>
#include <linux/netlink.h>
#include <linux/timer_types.h>
#include <uapi/linux/ethtool.h>
#include <uapi/linux/net_tstamp.h>

#include <linux/rh_kabi.h>

#define ETHTOOL_MM_MAX_VERIFY_TIME_MS		128
#define ETHTOOL_MM_MAX_VERIFY_RETRIES		3

struct compat_ethtool_rx_flow_spec {
	u32		flow_type;
	union ethtool_flow_union h_u;
	struct ethtool_flow_ext h_ext;
	union ethtool_flow_union m_u;
	struct ethtool_flow_ext m_ext;
	compat_u64	ring_cookie;
	u32		location;
};

struct compat_ethtool_rxnfc {
	u32				cmd;
	u32				flow_type;
	compat_u64			data;
	struct compat_ethtool_rx_flow_spec fs;
	u32				rule_cnt;
	u32				rule_locs[];
};

#include <linux/rculist.h>

/**
 * enum ethtool_phys_id_state - indicator state for physical identification
 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
 * @ETHTOOL_ID_ACTIVE: Physical ID indicator should be activated
 * @ETHTOOL_ID_ON: LED should be turned on (used iff %ETHTOOL_ID_ACTIVE
 *	is not supported)
 * @ETHTOOL_ID_OFF: LED should be turned off (used iff %ETHTOOL_ID_ACTIVE
 *	is not supported)
 */
enum ethtool_phys_id_state {
	ETHTOOL_ID_INACTIVE,
	ETHTOOL_ID_ACTIVE,
	ETHTOOL_ID_ON,
	ETHTOOL_ID_OFF
};

enum {
	ETH_RSS_HASH_TOP_BIT, /* Configurable RSS hash function - Toeplitz */
	ETH_RSS_HASH_XOR_BIT, /* Configurable RSS hash function - Xor */
	ETH_RSS_HASH_CRC32_BIT, /* Configurable RSS hash function - Crc32 */

	/*
	 * Add your fresh new hash function bits above and remember to update
	 * rss_hash_func_strings[] in ethtool.c
	 */
	ETH_RSS_HASH_FUNCS_COUNT
};

/**
 * struct kernel_ethtool_ringparam - RX/TX ring configuration
 * @rx_buf_len: Current length of buffers on the rx ring.
 * @tcp_data_split: Scatter packet headers and data to separate buffers
 * @tx_push: The flag of tx push mode
 * @rx_push: The flag of rx push mode
 * @cqe_size: Size of TX/RX completion queue event
 * @tx_push_buf_len: Size of TX push buffer
 * @tx_push_buf_max_len: Maximum allowed size of TX push buffer
 * @hds_thresh: Packet size threshold for header data split (HDS)
 * @hds_thresh_max: Maximum supported setting for @hds_threshold
 *
 */
struct kernel_ethtool_ringparam {
	u32	rx_buf_len;
	u8	tcp_data_split;
	u8	tx_push;
	u8	rx_push;
	u32	cqe_size;
	u32	tx_push_buf_len;
	u32	tx_push_buf_max_len;
	u32	hds_thresh;
	u32	hds_thresh_max;
};

/**
 * enum ethtool_supported_ring_param - indicator caps for setting ring params
 * @ETHTOOL_RING_USE_RX_BUF_LEN: capture for setting rx_buf_len
 * @ETHTOOL_RING_USE_CQE_SIZE: capture for setting cqe_size
 * @ETHTOOL_RING_USE_TX_PUSH: capture for setting tx_push
 * @ETHTOOL_RING_USE_RX_PUSH: capture for setting rx_push
 * @ETHTOOL_RING_USE_TX_PUSH_BUF_LEN: capture for setting tx_push_buf_len
 * @ETHTOOL_RING_USE_TCP_DATA_SPLIT: capture for setting tcp_data_split
 * @ETHTOOL_RING_USE_HDS_THRS: capture for setting header-data-split-thresh
 */
enum ethtool_supported_ring_param {
	ETHTOOL_RING_USE_RX_BUF_LEN		= BIT(0),
	ETHTOOL_RING_USE_CQE_SIZE		= BIT(1),
	ETHTOOL_RING_USE_TX_PUSH		= BIT(2),
	ETHTOOL_RING_USE_RX_PUSH		= BIT(3),
	ETHTOOL_RING_USE_TX_PUSH_BUF_LEN	= BIT(4),
	ETHTOOL_RING_USE_TCP_DATA_SPLIT		= BIT(5),
	ETHTOOL_RING_USE_HDS_THRS		= BIT(6),
};

#define __ETH_RSS_HASH_BIT(bit)	((u32)1 << (bit))
#define __ETH_RSS_HASH(name)	__ETH_RSS_HASH_BIT(ETH_RSS_HASH_##name##_BIT)

#define ETH_RSS_HASH_TOP	__ETH_RSS_HASH(TOP)
#define ETH_RSS_HASH_XOR	__ETH_RSS_HASH(XOR)
#define ETH_RSS_HASH_CRC32	__ETH_RSS_HASH(CRC32)

#defi