linux/drivers/net/ethernet/hisilicon/hns3/hnae3.h

/* SPDX-License-Identifier: GPL-2.0+ */
// Copyright (c) 2016-2017 Hisilicon Limited.

#ifndef __HNAE3_H
#define __HNAE3_H

/* Names used in this framework:
 *      ae handle (handle):
 *        a set of queues provided by AE
 *      ring buffer queue (rbq):
 *        the channel between upper layer and the AE, can do tx and rx
 *      ring:
 *        a tx or rx channel within a rbq
 *      ring description (desc):
 *        an element in the ring with packet information
 *      buffer:
 *        a memory region referred by desc with the full packet payload
 *
 * "num" means a static number set as a parameter, "count" mean a dynamic
 *   number set while running
 * "cb" means control block
 */

#include <linux/acpi.h>
#include <linux/dcbnl.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/ethtool.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/pci.h>
#include <linux/pkt_sched.h>
#include <linux/types.h>
#include <linux/bitmap.h>
#include <net/pkt_cls.h>
#include <net/pkt_sched.h>

#define HNAE3_MOD_VERSION

#define HNAE3_MIN_VECTOR_NUM

/* Device version */
#define HNAE3_DEVICE_VERSION_V1
#define HNAE3_DEVICE_VERSION_V2
#define HNAE3_DEVICE_VERSION_V3

#define HNAE3_PCI_REVISION_BIT_SIZE

/* Device IDs */
#define HNAE3_DEV_ID_GE
#define HNAE3_DEV_ID_25GE
#define HNAE3_DEV_ID_25GE_RDMA
#define HNAE3_DEV_ID_25GE_RDMA_MACSEC
#define HNAE3_DEV_ID_50GE_RDMA
#define HNAE3_DEV_ID_50GE_RDMA_MACSEC
#define HNAE3_DEV_ID_100G_RDMA_MACSEC
#define HNAE3_DEV_ID_200G_RDMA
#define HNAE3_DEV_ID_VF
#define HNAE3_DEV_ID_RDMA_DCB_PFC_VF

#define HNAE3_CLASS_NAME_SIZE

#define HNAE3_DEV_INITED_B
#define HNAE3_DEV_SUPPORT_ROCE_B
#define HNAE3_DEV_SUPPORT_DCB_B
#define HNAE3_KNIC_CLIENT_INITED_B
#define HNAE3_UNIC_CLIENT_INITED_B
#define HNAE3_ROCE_CLIENT_INITED_B

#define HNAE3_DEV_SUPPORT_ROCE_DCB_BITS

#define hnae3_dev_roce_supported(hdev)

#define hnae3_dev_dcb_supported(hdev)

enum HNAE3_DEV_CAP_BITS {};

#define hnae3_ae_dev_fd_supported(ae_dev)

#define hnae3_ae_dev_gro_supported(ae_dev)

#define hnae3_dev_fec_supported(hdev)

#define hnae3_dev_udp_gso_supported(hdev)

#define hnae3_dev_qb_supported(hdev)

#define hnae3_dev_fd_forward_tc_supported(hdev)

#define hnae3_dev_ptp_supported(hdev)

#define hnae3_dev_int_ql_supported(hdev)

#define hnae3_dev_hw_csum_supported(hdev)

#define hnae3_dev_tx_push_supported(hdev)

#define hnae3_dev_phy_imp_supported(hdev)

#define hnae3_dev_ras_imp_supported(hdev)

#define hnae3_dev_tqp_txrx_indep_supported(hdev)

#define hnae3_dev_hw_pad_supported(hdev)

#define hnae3_dev_stash_supported(hdev)

#define hnae3_dev_pause_supported(hdev)

#define hnae3_ae_dev_tqp_txrx_indep_supported(ae_dev)

#define hnae3_ae_dev_rxd_adv_layout_supported(ae_dev)

#define hnae3_ae_dev_mc_mac_mng_supported(ae_dev)

#define hnae3_ae_dev_cq_supported(ae_dev)

#define hnae3_ae_dev_fec_stats_supported(ae_dev)

#define hnae3_ae_dev_lane_num_supported(ae_dev)

#define hnae3_ae_dev_wol_supported(ae_dev)

#define hnae3_ae_dev_tm_flush_supported(hdev)

#define hnae3_ae_dev_vf_fault_supported(ae_dev)

#define hnae3_ae_dev_gen_reg_dfx_supported(hdev)

enum HNAE3_PF_CAP_BITS {};
#define ring_ptr_move_fw(ring, p)
#define ring_ptr_move_bw(ring, p)

struct hnae3_handle;

struct hnae3_queue {};

struct hns3_mac_stats {};

/* hnae3 loop mode */
enum hnae3_loop {};

enum hnae3_client_type {};

/* mac media type */
enum hnae3_media_type {};

/* must be consistent with definition in firmware */
enum hnae3_module_type {};

enum hnae3_fec_mode {};

enum hnae3_reset_notify_type {};

enum hnae3_hw_error_type {};

enum hnae3_reset_type {};

enum hnae3_port_base_vlan_state {};

enum hnae3_dbg_cmd {};

enum hnae3_tc_map_mode {};

struct hnae3_vector_info {};

#define HNAE3_RING_TYPE_B
#define HNAE3_RING_TYPE_TX
#define HNAE3_RING_TYPE_RX
#define HNAE3_RING_GL_IDX_S
#define HNAE3_RING_GL_IDX_M
#define HNAE3_RING_GL_RX
#define HNAE3_RING_GL_TX

#define HNAE3_FW_VERSION_BYTE3_SHIFT
#define HNAE3_FW_VERSION_BYTE3_MASK
#define HNAE3_FW_VERSION_BYTE2_SHIFT
#define HNAE3_FW_VERSION_BYTE2_MASK
#define HNAE3_FW_VERSION_BYTE1_SHIFT
#define HNAE3_FW_VERSION_BYTE1_MASK
#define HNAE3_FW_VERSION_BYTE0_SHIFT
#define HNAE3_FW_VERSION_BYTE0_MASK

#define HNAE3_SCC_VERSION_BYTE3_SHIFT
#define HNAE3_SCC_VERSION_BYTE3_MASK
#define HNAE3_SCC_VERSION_BYTE2_SHIFT
#define HNAE3_SCC_VERSION_BYTE2_MASK
#define HNAE3_SCC_VERSION_BYTE1_SHIFT
#define HNAE3_SCC_VERSION_BYTE1_MASK
#define HNAE3_SCC_VERSION_BYTE0_SHIFT
#define HNAE3_SCC_VERSION_BYTE0_MASK

struct hnae3_ring_chain_node {};

#define HNAE3_IS_TX_RING(node)

/* device specification info from firmware */
struct hnae3_dev_specs {};

struct hnae3_client_ops {};

#define HNAE3_CLIENT_NAME_LENGTH
struct hnae3_client {};

#define HNAE3_DEV_CAPS_MAX_NUM
struct hnae3_ae_dev {};

/* This struct defines the operation on the handle.
 *
 * init_ae_dev(): (mandatory)
 *   Get PF configure from pci_dev and initialize PF hardware
 * uninit_ae_dev()
 *   Disable PF device and release PF resource
 * register_client
 *   Register client to ae_dev
 * unregister_client()
 *   Unregister client from ae_dev
 * start()
 *   Enable the hardware
 * stop()
 *   Disable the hardware
 * start_client()
 *   Inform the hclge that client has been started
 * stop_client()
 *   Inform the hclge that client has been stopped
 * get_status()
 *   Get the carrier state of the back channel of the handle, 1 for ok, 0 for
 *   non-ok
 * get_ksettings_an_result()
 *   Get negotiation status,speed and duplex
 * get_media_type()
 *   Get media type of MAC
 * check_port_speed()
 *   Check target speed whether is supported
 * adjust_link()
 *   Adjust link status
 * set_loopback()
 *   Set loopback
 * set_promisc_mode
 *   Set promisc mode
 * request_update_promisc_mode
 *   request to hclge(vf) to update promisc mode
 * set_mtu()
 *   set mtu
 * get_pauseparam()
 *   get tx and rx of pause frame use
 * set_pauseparam()
 *   set tx and rx of pause frame use
 * set_autoneg()
 *   set auto autonegotiation of pause frame use
 * get_autoneg()
 *   get auto autonegotiation of pause frame use
 * restart_autoneg()
 *   restart autonegotiation
 * halt_autoneg()
 *   halt/resume autonegotiation when autonegotiation on
 * get_coalesce_usecs()
 *   get usecs to delay a TX interrupt after a packet is sent
 * get_rx_max_coalesced_frames()
 *   get Maximum number of packets to be sent before a TX interrupt.
 * set_coalesce_usecs()
 *   set usecs to delay a TX interrupt after a packet is sent
 * set_coalesce_frames()
 *   set Maximum number of packets to be sent before a TX interrupt.
 * get_mac_addr()
 *   get mac address
 * set_mac_addr()
 *   set mac address
 * add_uc_addr
 *   Add unicast addr to mac table
 * rm_uc_addr
 *   Remove unicast addr from mac table
 * set_mc_addr()
 *   Set multicast address
 * add_mc_addr
 *   Add multicast address to mac table
 * rm_mc_addr
 *   Remove multicast address from mac table
 * update_stats()
 *   Update Old network device statistics
 * get_mac_stats()
 *   get mac pause statistics including tx_cnt and rx_cnt
 * get_ethtool_stats()
 *   Get ethtool network device statistics
 * get_strings()
 *   Get a set of strings that describe the requested objects
 * get_sset_count()
 *   Get number of strings that @get_strings will write
 * update_led_status()
 *   Update the led status
 * set_led_id()
 *   Set led id
 * get_regs()
 *   Get regs dump
 * get_regs_len()
 *   Get the len of the regs dump
 * get_rss_key_size()
 *   Get rss key size
 * get_rss()
 *   Get rss table
 * set_rss()
 *   Set rss table
 * get_tc_size()
 *   Get tc size of handle
 * get_vector()
 *   Get vector number and vector information
 * put_vector()
 *   Put the vector in hdev
 * map_ring_to_vector()
 *   Map rings to vector
 * unmap_ring_from_vector()
 *   Unmap rings from vector
 * reset_queue()
 *   Reset queue
 * get_fw_version()
 *   Get firmware version
 * get_mdix_mode()
 *   Get media typr of phy
 * enable_vlan_filter()
 *   Enable vlan filter
 * set_vlan_filter()
 *   Set vlan filter config of Ports
 * set_vf_vlan_filter()
 *   Set vlan filter config of vf
 * enable_hw_strip_rxvtag()
 *   Enable/disable hardware strip vlan tag of packets received
 * set_gro_en
 *   Enable/disable HW GRO
 * add_arfs_entry
 *   Check the 5-tuples of flow, and create flow director rule
 * get_vf_config
 *   Get the VF configuration setting by the host
 * set_vf_link_state
 *   Set VF link status
 * set_vf_spoofchk
 *   Enable/disable spoof check for specified vf
 * set_vf_trust
 *   Enable/disable trust for specified vf, if the vf being trusted, then
 *   it can enable promisc mode
 * set_vf_rate
 *   Set the max tx rate of specified vf.
 * set_vf_mac
 *   Configure the default MAC for specified VF
 * get_module_eeprom
 *   Get the optical module eeprom info.
 * add_cls_flower
 *   Add clsflower rule
 * del_cls_flower
 *   Delete clsflower rule
 * cls_flower_active
 *   Check if any cls flower rule exist
 * dbg_read_cmd
 *   Execute debugfs read command.
 * set_tx_hwts_info
 *   Save information for 1588 tx packet
 * get_rx_hwts
 *   Get 1588 rx hwstamp
 * get_ts_info
 *   Get phc info
 * clean_vf_config
 *   Clean residual vf info after disable sriov
 * get_wol
 *   Get wake on lan info
 * set_wol
 *   Config wake on lan
 */
struct hnae3_ae_ops {};

struct hnae3_dcb_ops {};

struct hnae3_ae_algo {};

#define HNAE3_INT_NAME_LEN
#define HNAE3_ITR_COUNTDOWN_START

#define HNAE3_MAX_TC
#define HNAE3_MAX_USER_PRIO
struct hnae3_tc_info {};

#define HNAE3_MAX_DSCP
#define HNAE3_PRIO_ID_INVALID
struct hnae3_knic_private_info {};

struct hnae3_roce_private_info {};

#define HNAE3_SUPPORT_APP_LOOPBACK
#define HNAE3_SUPPORT_PHY_LOOPBACK
#define HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK
#define HNAE3_SUPPORT_VF
#define HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK
#define HNAE3_SUPPORT_EXTERNAL_LOOPBACK

#define HNAE3_USER_UPE
#define HNAE3_USER_MPE
#define HNAE3_BPE
#define HNAE3_OVERFLOW_UPE
#define HNAE3_OVERFLOW_MPE
#define HNAE3_UPE
#define HNAE3_MPE

enum hnae3_pflag {};

struct hnae3_handle {};

#define hnae3_set_field(origin, mask, shift, val)
#define hnae3_get_field(origin, mask, shift)

#define hnae3_set_bit(origin, shift, val)
#define hnae3_get_bit(origin, shift)

#define HNAE3_FORMAT_MAC_ADDR_LEN
#define HNAE3_FORMAT_MAC_ADDR_OFFSET_0
#define HNAE3_FORMAT_MAC_ADDR_OFFSET_4
#define HNAE3_FORMAT_MAC_ADDR_OFFSET_5

static inline void hnae3_format_mac_addr(char *format_mac_addr,
					 const u8 *mac_addr)
{}

int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev);
void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev);

void hnae3_unregister_ae_algo_prepare(struct hnae3_ae_algo *ae_algo);
void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo);
void hnae3_register_ae_algo(struct hnae3_ae_algo *ae_algo);

void hnae3_unregister_client(struct hnae3_client *client);
int hnae3_register_client(struct hnae3_client *client);

void hnae3_set_client_init_flag(struct hnae3_client *client,
				struct hnae3_ae_dev *ae_dev,
				unsigned int inited);
#endif