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

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

#ifndef __HNS3_ENET_H
#define __HNS3_ENET_H

#include <linux/dim.h>
#include <linux/if_vlan.h>
#include <net/page_pool/types.h>
#include <asm/barrier.h>

#include "hnae3.h"

struct iphdr;
struct ipv6hdr;

enum hns3_nic_state {};

#define HNS3_MAX_PUSH_BD_NUM

#define HNS3_RING_RX_RING_BASEADDR_L_REG
#define HNS3_RING_RX_RING_BASEADDR_H_REG
#define HNS3_RING_RX_RING_BD_NUM_REG
#define HNS3_RING_RX_RING_BD_LEN_REG
#define HNS3_RING_RX_RING_TAIL_REG
#define HNS3_RING_RX_RING_HEAD_REG
#define HNS3_RING_RX_RING_FBDNUM_REG
#define HNS3_RING_RX_RING_PKTNUM_RECORD_REG

#define HNS3_RING_TX_RING_BASEADDR_L_REG
#define HNS3_RING_TX_RING_BASEADDR_H_REG
#define HNS3_RING_TX_RING_BD_NUM_REG
#define HNS3_RING_TX_RING_TC_REG
#define HNS3_RING_TX_RING_TAIL_REG
#define HNS3_RING_TX_RING_HEAD_REG
#define HNS3_RING_TX_RING_FBDNUM_REG
#define HNS3_RING_TX_RING_OFFSET_REG
#define HNS3_RING_TX_RING_EBDNUM_REG
#define HNS3_RING_TX_RING_PKTNUM_RECORD_REG
#define HNS3_RING_TX_RING_EBD_OFFSET_REG
#define HNS3_RING_TX_RING_BD_ERR_REG
#define HNS3_RING_EN_REG
#define HNS3_RING_RX_EN_REG
#define HNS3_RING_TX_EN_REG

#define HNS3_RX_HEAD_SIZE

#define HNS3_TX_TIMEOUT
#define HNS3_RING_NAME_LEN
#define HNS3_BUFFER_SIZE_2048
#define HNS3_RING_MAX_PENDING
#define HNS3_RING_MIN_PENDING
#define HNS3_RING_BD_MULTIPLE
/* max frame size of mac */
#define HNS3_MAX_MTU(max_frm_size)

#define HNS3_BD_SIZE_512_TYPE
#define HNS3_BD_SIZE_1024_TYPE
#define HNS3_BD_SIZE_2048_TYPE
#define HNS3_BD_SIZE_4096_TYPE

#define HNS3_RX_FLAG_VLAN_PRESENT
#define HNS3_RX_FLAG_L3ID_IPV4
#define HNS3_RX_FLAG_L3ID_IPV6
#define HNS3_RX_FLAG_L4ID_UDP
#define HNS3_RX_FLAG_L4ID_TCP

#define HNS3_RXD_DMAC_S
#define HNS3_RXD_DMAC_M
#define HNS3_RXD_VLAN_S
#define HNS3_RXD_VLAN_M
#define HNS3_RXD_L3ID_S
#define HNS3_RXD_L3ID_M
#define HNS3_RXD_L4ID_S
#define HNS3_RXD_L4ID_M
#define HNS3_RXD_FRAG_B
#define HNS3_RXD_STRP_TAGP_S
#define HNS3_RXD_STRP_TAGP_M

#define HNS3_RXD_L2E_B
#define HNS3_RXD_L3E_B
#define HNS3_RXD_L4E_B
#define HNS3_RXD_TRUNCAT_B
#define HNS3_RXD_HOI_B
#define HNS3_RXD_DOI_B
#define HNS3_RXD_OL3E_B
#define HNS3_RXD_OL4E_B
#define HNS3_RXD_GRO_COUNT_S
#define HNS3_RXD_GRO_COUNT_M
#define HNS3_RXD_GRO_FIXID_B
#define HNS3_RXD_GRO_ECN_B

#define HNS3_RXD_ODMAC_S
#define HNS3_RXD_ODMAC_M
#define HNS3_RXD_OVLAN_S
#define HNS3_RXD_OVLAN_M
#define HNS3_RXD_OL3ID_S
#define HNS3_RXD_OL3ID_M
#define HNS3_RXD_OL4ID_S
#define HNS3_RXD_OL4ID_M
#define HNS3_RXD_FBHI_S
#define HNS3_RXD_FBHI_M
#define HNS3_RXD_FBLI_S
#define HNS3_RXD_FBLI_M

#define HNS3_RXD_PTYPE_S
#define HNS3_RXD_PTYPE_M

#define HNS3_RXD_BDTYPE_S
#define HNS3_RXD_BDTYPE_M
#define HNS3_RXD_VLD_B
#define HNS3_RXD_UDP0_B
#define HNS3_RXD_EXTEND_B
#define HNS3_RXD_FE_B
#define HNS3_RXD_LUM_B
#define HNS3_RXD_CRCP_B
#define HNS3_RXD_L3L4P_B
#define HNS3_RXD_TSIDX_S
#define HNS3_RXD_TSIDX_M
#define HNS3_RXD_TS_VLD_B
#define HNS3_RXD_LKBK_B
#define HNS3_RXD_GRO_SIZE_S
#define HNS3_RXD_GRO_SIZE_M

#define HNS3_TXD_L3T_S
#define HNS3_TXD_L3T_M
#define HNS3_TXD_L4T_S
#define HNS3_TXD_L4T_M
#define HNS3_TXD_L3CS_B
#define HNS3_TXD_L4CS_B
#define HNS3_TXD_VLAN_B
#define HNS3_TXD_TSO_B

#define HNS3_TXD_L2LEN_S
#define HNS3_TXD_L2LEN_M
#define HNS3_TXD_L3LEN_S
#define HNS3_TXD_L3LEN_M
#define HNS3_TXD_L4LEN_S
#define HNS3_TXD_L4LEN_M

#define HNS3_TXD_CSUM_START_S
#define HNS3_TXD_CSUM_START_M

#define HNS3_TXD_OL3T_S
#define HNS3_TXD_OL3T_M
#define HNS3_TXD_OVLAN_B
#define HNS3_TXD_MACSEC_B
#define HNS3_TXD_TUNTYPE_S
#define HNS3_TXD_TUNTYPE_M

#define HNS3_TXD_CSUM_OFFSET_S
#define HNS3_TXD_CSUM_OFFSET_M

#define HNS3_TXD_BDTYPE_S
#define HNS3_TXD_BDTYPE_M
#define HNS3_TXD_FE_B
#define HNS3_TXD_SC_S
#define HNS3_TXD_SC_M
#define HNS3_TXD_EXTEND_B
#define HNS3_TXD_VLD_B
#define HNS3_TXD_RI_B
#define HNS3_TXD_RA_B
#define HNS3_TXD_TSYN_B
#define HNS3_TXD_DECTTL_S
#define HNS3_TXD_DECTTL_M

#define HNS3_TXD_OL4CS_B

#define HNS3_TXD_MSS_S
#define HNS3_TXD_MSS_M
#define HNS3_TXD_HW_CS_B

#define HNS3_VECTOR_TX_IRQ
#define HNS3_VECTOR_RX_IRQ

#define HNS3_VECTOR_NOT_INITED
#define HNS3_VECTOR_INITED

#define HNS3_MAX_BD_SIZE
#define HNS3_MAX_TSO_BD_NUM
#define HNS3_MAX_TSO_SIZE
#define HNS3_MAX_NON_TSO_SIZE

#define HNS3_VECTOR_GL_MASK
#define HNS3_VECTOR_GL0_OFFSET
#define HNS3_VECTOR_GL1_OFFSET
#define HNS3_VECTOR_GL2_OFFSET
#define HNS3_VECTOR_RL_OFFSET
#define HNS3_VECTOR_RL_EN_B
#define HNS3_VECTOR_QL_MASK
#define HNS3_VECTOR_TX_QL_OFFSET
#define HNS3_VECTOR_RX_QL_OFFSET

#define HNS3_RING_EN_B

#define HNS3_GL0_CQ_MODE_REG
#define HNS3_GL1_CQ_MODE_REG
#define HNS3_GL2_CQ_MODE_REG
#define HNS3_CQ_MODE_EQE
#define HNS3_CQ_MODE_CQE

#define HNS3_RESCHED_BD_NUM

enum hns3_pkt_l2t_type {};

enum hns3_pkt_l3t_type {};

enum hns3_pkt_l4t_type {};

enum hns3_pkt_ol3t_type {};

enum hns3_pkt_tun_type {};

/* hardware spec ring buffer format */
struct __packed hns3_desc {};

enum hns3_desc_type {};

struct hns3_desc_cb {};

enum hns3_pkt_l3type {};

enum hns3_pkt_l4type {};

enum hns3_pkt_ol3type {};

enum hns3_pkt_ol4type {};

struct hns3_rx_ptype {};

struct ring_stats {};

struct hns3_tx_spare {};

struct hns3_enet_ring {} ____cacheline_internodealigned_in_smp;

enum hns3_flow_level_range {};

#define HNS3_INT_GL_50K
#define HNS3_INT_GL_20K
#define HNS3_INT_GL_18K
#define HNS3_INT_GL_8K

#define HNS3_INT_GL_1US

#define HNS3_INT_RL_MAX
#define HNS3_INT_RL_ENABLE_MASK

#define HNS3_INT_QL_DEFAULT_CFG

struct hns3_enet_coalesce {};

struct hns3_enet_ring_group {};

struct hns3_enet_tqp_vector {} ____cacheline_internodealigned_in_smp;

struct hns3_nic_priv {};

l3_hdr_info;

l4_hdr_info;

struct hns3_hw_error_info {};

struct hns3_reset_type_map {};

static inline int ring_space(struct hns3_enet_ring *ring)
{}

static inline u32 hns3_tqp_read_reg(struct hns3_enet_ring *ring, u32 reg)
{}

static inline u32 hns3_read_reg(void __iomem *base, u32 reg)
{}

static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)
{}

#define hns3_read_dev(a, reg)

static inline bool hns3_nic_resetting(struct net_device *netdev)
{}

#define hns3_write_dev(a, reg, value)

#define ring_to_dev(ring)

#define ring_to_netdev(ring)

#define ring_to_dma_dir(ring)

#define hns3_buf_size(_ring)

#define hns3_ring_stats_update(ring, cnt) \

static inline unsigned int hns3_page_order(struct hns3_enet_ring *ring)
{}

#define hns3_page_size(_ring)

/* iterator for handling rings in ring group */
#define hns3_for_each_ring(pos, head)

#define hns3_get_handle(ndev)

#define hns3_get_ae_dev(handle)

#define hns3_get_ops(handle)

#define hns3_gl_usec_to_reg(int_gl)
#define hns3_gl_round_down(int_gl)

#define hns3_rl_usec_to_reg(int_rl)
#define hns3_rl_round_down(int_rl)

void hns3_ethtool_set_ops(struct net_device *netdev);
int hns3_set_channels(struct net_device *netdev,
		      struct ethtool_channels *ch);

void hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
int hns3_init_all_ring(struct hns3_nic_priv *priv);
int hns3_nic_reset_all_ring(struct hnae3_handle *h);
void hns3_fini_ring(struct hns3_enet_ring *ring);
netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev);
bool hns3_is_phys_func(struct pci_dev *pdev);
int hns3_clean_rx_ring(
		struct hns3_enet_ring *ring, int budget,
		void (*rx_fn)(struct hns3_enet_ring *, struct sk_buff *));

void hns3_set_vector_coalesce_rx_gl(struct hns3_enet_tqp_vector *tqp_vector,
				    u32 gl_value);
void hns3_set_vector_coalesce_tx_gl(struct hns3_enet_tqp_vector *tqp_vector,
				    u32 gl_value);
void hns3_set_vector_coalesce_rl(struct hns3_enet_tqp_vector *tqp_vector,
				 u32 rl_value);
void hns3_set_vector_coalesce_rx_ql(struct hns3_enet_tqp_vector *tqp_vector,
				    u32 ql_value);
void hns3_set_vector_coalesce_tx_ql(struct hns3_enet_tqp_vector *tqp_vector,
				    u32 ql_value);

void hns3_request_update_promisc_mode(struct hnae3_handle *handle);
int hns3_reset_notify(struct hnae3_handle *handle,
		      enum hnae3_reset_notify_type type);

#ifdef CONFIG_HNS3_DCB
void hns3_dcbnl_setup(struct hnae3_handle *handle);
#else
static inline void hns3_dcbnl_setup(struct hnae3_handle *handle) {}
#endif

int hns3_dbg_init(struct hnae3_handle *handle);
void hns3_dbg_uninit(struct hnae3_handle *handle);
void hns3_dbg_register_debugfs(const char *debugfs_dir_name);
void hns3_dbg_unregister_debugfs(void);
void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size);
u16 hns3_get_max_available_channels(struct hnae3_handle *h);
void hns3_cq_period_mode_init(struct hns3_nic_priv *priv,
			      enum dim_cq_period_mode tx_mode,
			      enum dim_cq_period_mode rx_mode);

void hns3_external_lb_prepare(struct net_device *ndev, bool if_running);
void hns3_external_lb_restore(struct net_device *ndev, bool if_running);
#endif