linux/drivers/net/ethernet/mediatek/airoha_eth.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2024 AIROHA Inc
 * Author: Lorenzo Bianconi <[email protected]>
 */
#include <linux/etherdevice.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/tcp.h>
#include <linux/u64_stats_sync.h>
#include <net/dsa.h>
#include <net/page_pool/helpers.h>
#include <uapi/linux/ppp_defs.h>

#define AIROHA_MAX_NUM_GDM_PORTS
#define AIROHA_MAX_NUM_RSTS
#define AIROHA_MAX_NUM_XSI_RSTS
#define AIROHA_MAX_MTU
#define AIROHA_MAX_PACKET_SIZE
#define AIROHA_NUM_TX_RING
#define AIROHA_NUM_RX_RING
#define AIROHA_FE_MC_MAX_VLAN_TABLE
#define AIROHA_FE_MC_MAX_VLAN_PORT
#define AIROHA_NUM_TX_IRQ
#define HW_DSCP_NUM
#define IRQ_QUEUE_LEN(_n)
#define TX_DSCP_NUM
#define RX_DSCP_NUM(_n)

#define PSE_RSV_PAGES
#define PSE_QUEUE_RSV_PAGES

/* FE */
#define PSE_BASE
#define CSR_IFC_BASE
#define CDM1_BASE
#define GDM1_BASE
#define PPE1_BASE

#define CDM2_BASE
#define GDM2_BASE

#define GDM3_BASE
#define GDM4_BASE

#define GDM_BASE(_n)

#define REG_FE_DMA_GLO_CFG
#define FE_DMA_GLO_L2_SPACE_MASK
#define FE_DMA_GLO_PG_SZ_MASK

#define REG_FE_RST_GLO_CFG
#define FE_RST_GDM4_MBI_ARB_MASK
#define FE_RST_GDM3_MBI_ARB_MASK
#define FE_RST_CORE_MASK

#define REG_FE_LAN_MAC_H
#define REG_FE_LAN_MAC_LMIN
#define REG_FE_LAN_MAC_LMAX

#define REG_FE_CDM1_OQ_MAP0
#define REG_FE_CDM1_OQ_MAP1
#define REG_FE_CDM1_OQ_MAP2
#define REG_FE_CDM1_OQ_MAP3

#define REG_FE_PCE_CFG
#define PCE_DPI_EN_MASK
#define PCE_KA_EN_MASK
#define PCE_MC_EN_MASK

#define REG_FE_PSE_QUEUE_CFG_WR
#define PSE_CFG_PORT_ID_MASK
#define PSE_CFG_QUEUE_ID_MASK
#define PSE_CFG_WR_EN_MASK
#define PSE_CFG_OQRSV_SEL_MASK

#define REG_FE_PSE_QUEUE_CFG_VAL
#define PSE_CFG_OQ_RSV_MASK

#define PSE_FQ_CFG
#define PSE_FQ_LIMIT_MASK

#define REG_FE_PSE_BUF_SET
#define PSE_SHARE_USED_LTHD_MASK
#define PSE_ALLRSV_MASK

#define REG_PSE_SHARE_USED_THD
#define PSE_SHARE_USED_MTHD_MASK
#define PSE_SHARE_USED_HTHD_MASK

#define REG_GDM_MISC_CFG
#define GDM2_RDM_ACK_WAIT_PREF_MASK
#define GDM2_CHN_VLD_MODE_MASK

#define REG_FE_CSR_IFC_CFG
#define FE_IFC_EN_MASK

#define REG_FE_VIP_PORT_EN
#define REG_FE_IFC_PORT_EN

#define REG_PSE_IQ_REV1
#define PSE_IQ_RES1_P2_MASK

#define REG_PSE_IQ_REV2
#define PSE_IQ_RES2_P5_MASK
#define PSE_IQ_RES2_P4_MASK

#define REG_FE_VIP_EN(_n)
#define PATN_FCPU_EN_MASK
#define PATN_SWP_EN_MASK
#define PATN_DP_EN_MASK
#define PATN_SP_EN_MASK
#define PATN_TYPE_MASK
#define PATN_EN_MASK

#define REG_FE_VIP_PATN(_n)
#define PATN_DP_MASK
#define PATN_SP_MASK

#define REG_CDM1_VLAN_CTRL
#define CDM1_VLAN_MASK

#define REG_CDM1_FWD_CFG
#define CDM1_VIP_QSEL_MASK

#define REG_CDM1_CRSN_QSEL(_n)
#define CDM1_CRSN_QSEL_REASON_MASK(_n)

#define REG_CDM2_FWD_CFG
#define CDM2_OAM_QSEL_MASK
#define CDM2_VIP_QSEL_MASK

#define REG_CDM2_CRSN_QSEL(_n)
#define CDM2_CRSN_QSEL_REASON_MASK(_n)

#define REG_GDM_FWD_CFG(_n)
#define GDM_DROP_CRC_ERR
#define GDM_IP4_CKSUM
#define GDM_TCP_CKSUM
#define GDM_UDP_CKSUM
#define GDM_UCFQ_MASK
#define GDM_BCFQ_MASK
#define GDM_MCFQ_MASK
#define GDM_OCFQ_MASK

#define REG_GDM_INGRESS_CFG(_n)
#define GDM_INGRESS_FC_EN_MASK
#define GDM_STAG_EN_MASK

#define REG_GDM_LEN_CFG(_n)
#define GDM_SHORT_LEN_MASK
#define GDM_LONG_LEN_MASK

#define REG_FE_CPORT_CFG
#define FE_CPORT_PAD
#define FE_CPORT_PORT_XFC_MASK
#define FE_CPORT_QUEUE_XFC_MASK

#define REG_FE_GDM_MIB_CLEAR(_n)
#define FE_GDM_MIB_RX_CLEAR_MASK
#define FE_GDM_MIB_TX_CLEAR_MASK

#define REG_FE_GDM1_MIB_CFG
#define FE_STRICT_RFC2819_MODE_MASK
#define FE_GDM1_TX_MIB_SPLIT_EN_MASK
#define FE_GDM1_RX_MIB_SPLIT_EN_MASK
#define FE_TX_MIB_ID_MASK
#define FE_RX_MIB_ID_MASK

#define REG_FE_GDM_TX_OK_PKT_CNT_L(_n)
#define REG_FE_GDM_TX_OK_BYTE_CNT_L(_n)
#define REG_FE_GDM_TX_ETH_PKT_CNT_L(_n)
#define REG_FE_GDM_TX_ETH_BYTE_CNT_L(_n)
#define REG_FE_GDM_TX_ETH_DROP_CNT(_n)
#define REG_FE_GDM_TX_ETH_BC_CNT(_n)
#define REG_FE_GDM_TX_ETH_MC_CNT(_n)
#define REG_FE_GDM_TX_ETH_RUNT_CNT(_n)
#define REG_FE_GDM_TX_ETH_LONG_CNT(_n)
#define REG_FE_GDM_TX_ETH_E64_CNT_L(_n)
#define REG_FE_GDM_TX_ETH_L64_CNT_L(_n)
#define REG_FE_GDM_TX_ETH_L127_CNT_L(_n)
#define REG_FE_GDM_TX_ETH_L255_CNT_L(_n)
#define REG_FE_GDM_TX_ETH_L511_CNT_L(_n)
#define REG_FE_GDM_TX_ETH_L1023_CNT_L(_n)

#define REG_FE_GDM_RX_OK_PKT_CNT_L(_n)
#define REG_FE_GDM_RX_FC_DROP_CNT(_n)
#define REG_FE_GDM_RX_RC_DROP_CNT(_n)
#define REG_FE_GDM_RX_OVERFLOW_DROP_CNT(_n)
#define REG_FE_GDM_RX_ERROR_DROP_CNT(_n)
#define REG_FE_GDM_RX_OK_BYTE_CNT_L(_n)
#define REG_FE_GDM_RX_ETH_PKT_CNT_L(_n)
#define REG_FE_GDM_RX_ETH_BYTE_CNT_L(_n)
#define REG_FE_GDM_RX_ETH_DROP_CNT(_n)
#define REG_FE_GDM_RX_ETH_BC_CNT(_n)
#define REG_FE_GDM_RX_ETH_MC_CNT(_n)
#define REG_FE_GDM_RX_ETH_CRC_ERR_CNT(_n)
#define REG_FE_GDM_RX_ETH_FRAG_CNT(_n)
#define REG_FE_GDM_RX_ETH_JABBER_CNT(_n)
#define REG_FE_GDM_RX_ETH_RUNT_CNT(_n)
#define REG_FE_GDM_RX_ETH_LONG_CNT(_n)
#define REG_FE_GDM_RX_ETH_E64_CNT_L(_n)
#define REG_FE_GDM_RX_ETH_L64_CNT_L(_n)
#define REG_FE_GDM_RX_ETH_L127_CNT_L(_n)
#define REG_FE_GDM_RX_ETH_L255_CNT_L(_n)
#define REG_FE_GDM_RX_ETH_L511_CNT_L(_n)
#define REG_FE_GDM_RX_ETH_L1023_CNT_L(_n)

#define REG_PPE1_TB_HASH_CFG
#define PPE1_SRAM_TABLE_EN_MASK
#define PPE1_SRAM_HASH1_EN_MASK
#define PPE1_DRAM_TABLE_EN_MASK
#define PPE1_DRAM_HASH1_EN_MASK

#define REG_FE_GDM_TX_OK_PKT_CNT_H(_n)
#define REG_FE_GDM_TX_OK_BYTE_CNT_H(_n)
#define REG_FE_GDM_TX_ETH_PKT_CNT_H(_n)
#define REG_FE_GDM_TX_ETH_BYTE_CNT_H(_n)

#define REG_FE_GDM_RX_OK_PKT_CNT_H(_n)
#define REG_FE_GDM_RX_OK_BYTE_CNT_H(_n)
#define REG_FE_GDM_RX_ETH_PKT_CNT_H(_n)
#define REG_FE_GDM_RX_ETH_BYTE_CNT_H(_n)
#define REG_FE_GDM_TX_ETH_E64_CNT_H(_n)
#define REG_FE_GDM_TX_ETH_L64_CNT_H(_n)
#define REG_FE_GDM_TX_ETH_L127_CNT_H(_n)
#define REG_FE_GDM_TX_ETH_L255_CNT_H(_n)
#define REG_FE_GDM_TX_ETH_L511_CNT_H(_n)
#define REG_FE_GDM_TX_ETH_L1023_CNT_H(_n)
#define REG_FE_GDM_RX_ETH_E64_CNT_H(_n)
#define REG_FE_GDM_RX_ETH_L64_CNT_H(_n)
#define REG_FE_GDM_RX_ETH_L127_CNT_H(_n)
#define REG_FE_GDM_RX_ETH_L255_CNT_H(_n)
#define REG_FE_GDM_RX_ETH_L511_CNT_H(_n)
#define REG_FE_GDM_RX_ETH_L1023_CNT_H(_n)

#define REG_GDM2_CHN_RLS
#define MBI_RX_AGE_SEL_MASK
#define MBI_TX_AGE_SEL_MASK

#define REG_GDM3_FWD_CFG
#define GDM3_PAD_EN_MASK

#define REG_GDM4_FWD_CFG
#define GDM4_PAD_EN_MASK
#define GDM4_SPORT_OFFSET0_MASK

#define REG_GDM4_SRC_PORT_SET
#define GDM4_SPORT_OFF2_MASK
#define GDM4_SPORT_OFF1_MASK
#define GDM4_SPORT_OFF0_MASK

#define REG_IP_FRAG_FP
#define IP_ASSEMBLE_PORT_MASK
#define IP_ASSEMBLE_NBQ_MASK
#define IP_FRAGMENT_PORT_MASK
#define IP_FRAGMENT_NBQ_MASK

#define REG_MC_VLAN_EN
#define MC_VLAN_EN_MASK

#define REG_MC_VLAN_CFG
#define MC_VLAN_CFG_CMD_DONE_MASK
#define MC_VLAN_CFG_TABLE_ID_MASK
#define MC_VLAN_CFG_PORT_ID_MASK
#define MC_VLAN_CFG_TABLE_SEL_MASK
#define MC_VLAN_CFG_RW_MASK

#define REG_MC_VLAN_DATA

#define REG_CDM5_RX_OQ1_DROP_CNT

/* QDMA */
#define REG_QDMA_GLOBAL_CFG
#define GLOBAL_CFG_RX_2B_OFFSET_MASK
#define GLOBAL_CFG_DMA_PREFERENCE_MASK
#define GLOBAL_CFG_CPU_TXR_RR_MASK
#define GLOBAL_CFG_DSCP_BYTE_SWAP_MASK
#define GLOBAL_CFG_PAYLOAD_BYTE_SWAP_MASK
#define GLOBAL_CFG_MULTICAST_MODIFY_FP_MASK
#define GLOBAL_CFG_OAM_MODIFY_MASK
#define GLOBAL_CFG_RESET_MASK
#define GLOBAL_CFG_RESET_DONE_MASK
#define GLOBAL_CFG_MULTICAST_EN_MASK
#define GLOBAL_CFG_IRQ1_EN_MASK
#define GLOBAL_CFG_IRQ0_EN_MASK
#define GLOBAL_CFG_LOOPCNT_EN_MASK
#define GLOBAL_CFG_RD_BYPASS_WR_MASK
#define GLOBAL_CFG_QDMA_LOOPBACK_MASK
#define GLOBAL_CFG_LPBK_RXQ_SEL_MASK
#define GLOBAL_CFG_CHECK_DONE_MASK
#define GLOBAL_CFG_TX_WB_DONE_MASK
#define GLOBAL_CFG_MAX_ISSUE_NUM_MASK
#define GLOBAL_CFG_RX_DMA_BUSY_MASK
#define GLOBAL_CFG_RX_DMA_EN_MASK
#define GLOBAL_CFG_TX_DMA_BUSY_MASK
#define GLOBAL_CFG_TX_DMA_EN_MASK

#define REG_FWD_DSCP_BASE
#define REG_FWD_BUF_BASE

#define REG_HW_FWD_DSCP_CFG
#define HW_FWD_DSCP_PAYLOAD_SIZE_MASK
#define HW_FWD_DSCP_SCATTER_LEN_MASK
#define HW_FWD_DSCP_MIN_SCATTER_LEN_MASK

#define REG_INT_STATUS(_n)

#define REG_INT_ENABLE(_n)

/* QDMA_CSR_INT_ENABLE1 */
#define RX15_COHERENT_INT_MASK
#define RX14_COHERENT_INT_MASK
#define RX13_COHERENT_INT_MASK
#define RX12_COHERENT_INT_MASK
#define RX11_COHERENT_INT_MASK
#define RX10_COHERENT_INT_MASK
#define RX9_COHERENT_INT_MASK
#define RX8_COHERENT_INT_MASK
#define RX7_COHERENT_INT_MASK
#define RX6_COHERENT_INT_MASK
#define RX5_COHERENT_INT_MASK
#define RX4_COHERENT_INT_MASK
#define RX3_COHERENT_INT_MASK
#define RX2_COHERENT_INT_MASK
#define RX1_COHERENT_INT_MASK
#define RX0_COHERENT_INT_MASK
#define TX7_COHERENT_INT_MASK
#define TX6_COHERENT_INT_MASK
#define TX5_COHERENT_INT_MASK
#define TX4_COHERENT_INT_MASK
#define TX3_COHERENT_INT_MASK
#define TX2_COHERENT_INT_MASK
#define TX1_COHERENT_INT_MASK
#define TX0_COHERENT_INT_MASK
#define CNT_OVER_FLOW_INT_MASK
#define IRQ1_FULL_INT_MASK
#define IRQ1_INT_MASK
#define HWFWD_DSCP_LOW_INT_MASK
#define HWFWD_DSCP_EMPTY_INT_MASK
#define IRQ0_FULL_INT_MASK
#define IRQ0_INT_MASK

#define TX_DONE_INT_MASK(_n)

#define INT_TX_MASK

#define INT_IDX0_MASK

/* QDMA_CSR_INT_ENABLE2 */
#define RX15_NO_CPU_DSCP_INT_MASK
#define RX14_NO_CPU_DSCP_INT_MASK
#define RX13_NO_CPU_DSCP_INT_MASK
#define RX12_NO_CPU_DSCP_INT_MASK
#define RX11_NO_CPU_DSCP_INT_MASK
#define RX10_NO_CPU_DSCP_INT_MASK
#define RX9_NO_CPU_DSCP_INT_MASK
#define RX8_NO_CPU_DSCP_INT_MASK
#define RX7_NO_CPU_DSCP_INT_MASK
#define RX6_NO_CPU_DSCP_INT_MASK
#define RX5_NO_CPU_DSCP_INT_MASK
#define RX4_NO_CPU_DSCP_INT_MASK
#define RX3_NO_CPU_DSCP_INT_MASK
#define RX2_NO_CPU_DSCP_INT_MASK
#define RX1_NO_CPU_DSCP_INT_MASK
#define RX0_NO_CPU_DSCP_INT_MASK
#define RX15_DONE_INT_MASK
#define RX14_DONE_INT_MASK
#define RX13_DONE_INT_MASK
#define RX12_DONE_INT_MASK
#define RX11_DONE_INT_MASK
#define RX10_DONE_INT_MASK
#define RX9_DONE_INT_MASK
#define RX8_DONE_INT_MASK
#define RX7_DONE_INT_MASK
#define RX6_DONE_INT_MASK
#define RX5_DONE_INT_MASK
#define RX4_DONE_INT_MASK
#define RX3_DONE_INT_MASK
#define RX2_DONE_INT_MASK
#define RX1_DONE_INT_MASK
#define RX0_DONE_INT_MASK

#define RX_DONE_INT_MASK
#define INT_IDX1_MASK

/* QDMA_CSR_INT_ENABLE5 */
#define TX31_COHERENT_INT_MASK
#define TX30_COHERENT_INT_MASK
#define TX29_COHERENT_INT_MASK
#define TX28_COHERENT_INT_MASK
#define TX27_COHERENT_INT_MASK
#define TX26_COHERENT_INT_MASK
#define TX25_COHERENT_INT_MASK
#define TX24_COHERENT_INT_MASK
#define TX23_COHERENT_INT_MASK
#define TX22_COHERENT_INT_MASK
#define TX21_COHERENT_INT_MASK
#define TX20_COHERENT_INT_MASK
#define TX19_COHERENT_INT_MASK
#define TX18_COHERENT_INT_MASK
#define TX17_COHERENT_INT_MASK
#define TX16_COHERENT_INT_MASK
#define TX15_COHERENT_INT_MASK
#define TX14_COHERENT_INT_MASK
#define TX13_COHERENT_INT_MASK
#define TX12_COHERENT_INT_MASK
#define TX11_COHERENT_INT_MASK
#define TX10_COHERENT_INT_MASK
#define TX9_COHERENT_INT_MASK
#define TX8_COHERENT_INT_MASK

#define INT_IDX4_MASK

#define REG_TX_IRQ_BASE(_n)

#define REG_TX_IRQ_CFG(_n)
#define TX_IRQ_THR_MASK
#define TX_IRQ_DEPTH_MASK

#define REG_IRQ_CLEAR_LEN(_n)
#define IRQ_CLEAR_LEN_MASK

#define REG_IRQ_STATUS(_n)
#define IRQ_ENTRY_LEN_MASK
#define IRQ_HEAD_IDX_MASK

#define REG_TX_RING_BASE(_n)

#define REG_TX_RING_BLOCKING(_n)

#define TX_RING_IRQ_BLOCKING_MAP_MASK
#define TX_RING_IRQ_BLOCKING_CFG_MASK
#define TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK
#define TX_RING_IRQ_BLOCKING_MAX_TH_TXRING_EN_MASK
#define TX_RING_IRQ_BLOCKING_MIN_TH_TXRING_EN_MASK

#define REG_TX_CPU_IDX(_n)

#define TX_RING_CPU_IDX_MASK

#define REG_TX_DMA_IDX(_n)

#define TX_RING_DMA_IDX_MASK

#define IRQ_RING_IDX_MASK
#define IRQ_DESC_IDX_MASK

#define REG_RX_RING_BASE(_n)

#define REG_RX_RING_SIZE(_n)

#define RX_RING_THR_MASK
#define RX_RING_SIZE_MASK

#define REG_RX_CPU_IDX(_n)

#define RX_RING_CPU_IDX_MASK

#define REG_RX_DMA_IDX(_n)

#define REG_RX_DELAY_INT_IDX(_n)

#define RX_DELAY_INT_MASK

#define RX_RING_DMA_IDX_MASK

#define REG_INGRESS_TRTCM_CFG
#define INGRESS_TRTCM_EN_MASK
#define INGRESS_TRTCM_MODE_MASK
#define INGRESS_SLOW_TICK_RATIO_MASK
#define INGRESS_FAST_TICK_MASK

#define REG_TXQ_DIS_CFG_BASE(_n)
#define REG_TXQ_DIS_CFG(_n, _m)

#define REG_LMGR_INIT_CFG
#define LMGR_INIT_START
#define LMGR_SRAM_MODE_MASK
#define HW_FWD_PKTSIZE_OVERHEAD_MASK
#define HW_FWD_DESC_NUM_MASK

#define REG_FWD_DSCP_LOW_THR
#define FWD_DSCP_LOW_THR_MASK

#define REG_EGRESS_RATE_METER_CFG
#define EGRESS_RATE_METER_EN_MASK
#define EGRESS_RATE_METER_EQ_RATE_EN_MASK
#define EGRESS_RATE_METER_WINDOW_SZ_MASK
#define EGRESS_RATE_METER_TIMESLICE_MASK

#define REG_EGRESS_TRTCM_CFG
#define EGRESS_TRTCM_EN_MASK
#define EGRESS_TRTCM_MODE_MASK
#define EGRESS_SLOW_TICK_RATIO_MASK
#define EGRESS_FAST_TICK_MASK

#define REG_TXWRR_MODE_CFG
#define TWRR_WEIGHT_SCALE_MASK
#define TWRR_WEIGHT_BASE_MASK

#define REG_PSE_BUF_USAGE_CFG
#define PSE_BUF_ESTIMATE_EN_MASK

#define REG_GLB_TRTCM_CFG
#define GLB_TRTCM_EN_MASK
#define GLB_TRTCM_MODE_MASK
#define GLB_SLOW_TICK_RATIO_MASK
#define GLB_FAST_TICK_MASK

#define REG_TXQ_CNGST_CFG
#define TXQ_CNGST_DROP_EN
#define TXQ_CNGST_DEI_DROP_EN

#define REG_SLA_TRTCM_CFG
#define SLA_TRTCM_EN_MASK
#define SLA_TRTCM_MODE_MASK
#define SLA_SLOW_TICK_RATIO_MASK
#define SLA_FAST_TICK_MASK

/* CTRL */
#define QDMA_DESC_DONE_MASK
#define QDMA_DESC_DROP_MASK
#define QDMA_DESC_MORE_MASK
#define QDMA_DESC_DEI_MASK
#define QDMA_DESC_NO_DROP_MASK
#define QDMA_DESC_LEN_MASK
/* DATA */
#define QDMA_DESC_NEXT_ID_MASK
/* TX MSG0 */
#define QDMA_ETH_TXMSG_MIC_IDX_MASK
#define QDMA_ETH_TXMSG_SP_TAG_MASK
#define QDMA_ETH_TXMSG_ICO_MASK
#define QDMA_ETH_TXMSG_UCO_MASK
#define QDMA_ETH_TXMSG_TCO_MASK
#define QDMA_ETH_TXMSG_TSO_MASK
#define QDMA_ETH_TXMSG_FAST_MASK
#define QDMA_ETH_TXMSG_OAM_MASK
#define QDMA_ETH_TXMSG_CHAN_MASK
#define QDMA_ETH_TXMSG_QUEUE_MASK
/* TX MSG1 */
#define QDMA_ETH_TXMSG_NO_DROP
#define QDMA_ETH_TXMSG_METER_MASK
#define QDMA_ETH_TXMSG_FPORT_MASK
#define QDMA_ETH_TXMSG_NBOQ_MASK
#define QDMA_ETH_TXMSG_HWF_MASK
#define QDMA_ETH_TXMSG_HOP_MASK
#define QDMA_ETH_TXMSG_PTP_MASK
#define QDMA_ETH_TXMSG_ACNT_G1_MASK
#define QDMA_ETH_TXMSG_ACNT_G0_MASK

/* RX MSG1 */
#define QDMA_ETH_RXMSG_DEI_MASK
#define QDMA_ETH_RXMSG_IP6_MASK
#define QDMA_ETH_RXMSG_IP4_MASK
#define QDMA_ETH_RXMSG_IP4F_MASK
#define QDMA_ETH_RXMSG_L4_VALID_MASK
#define QDMA_ETH_RXMSG_L4F_MASK
#define QDMA_ETH_RXMSG_SPORT_MASK
#define QDMA_ETH_RXMSG_CRSN_MASK
#define QDMA_ETH_RXMSG_PPE_ENTRY_MASK

struct airoha_qdma_desc {};

/* CTRL0 */
#define QDMA_FWD_DESC_CTX_MASK
#define QDMA_FWD_DESC_RING_MASK
#define QDMA_FWD_DESC_IDX_MASK
#define QDMA_FWD_DESC_LEN_MASK
/* CTRL1 */
#define QDMA_FWD_DESC_FIRST_IDX_MASK
/* CTRL2 */
#define QDMA_FWD_DESC_MORE_PKT_NUM_MASK

struct airoha_qdma_fwd_desc {};

enum {};

enum {};

enum {};

enum {};

enum {};

enum {};

enum {};

struct airoha_queue_entry {};

struct airoha_queue {};

struct airoha_tx_irq_queue {};

struct airoha_hw_stats {};

struct airoha_gdm_port {};

struct airoha_eth {};

static u32 airoha_rr(void __iomem *base, u32 offset)
{}

static void airoha_wr(void __iomem *base, u32 offset, u32 val)
{}

static u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val)
{}

#define airoha_fe_rr(eth, offset)
#define airoha_fe_wr(eth, offset, val)
#define airoha_fe_rmw(eth, offset, mask, val)
#define airoha_fe_set(eth, offset, val)
#define airoha_fe_clear(eth, offset, val)

#define airoha_qdma_rr(eth, offset)
#define airoha_qdma_wr(eth, offset, val)
#define airoha_qdma_rmw(eth, offset, mask, val)
#define airoha_qdma_set(eth, offset, val)
#define airoha_qdma_clear(eth, offset, val)

static void airoha_qdma_set_irqmask(struct airoha_eth *eth, int index,
				    u32 clear, u32 set)
{}

static void airoha_qdma_irq_enable(struct airoha_eth *eth, int index,
				   u32 mask)
{}

static void airoha_qdma_irq_disable(struct airoha_eth *eth, int index,
				    u32 mask)
{}

static void airoha_set_macaddr(struct airoha_eth *eth, const u8 *addr)
{}

static void airoha_set_gdm_port_fwd_cfg(struct airoha_eth *eth, u32 addr,
					u32 val)
{}

static int airoha_set_gdm_port(struct airoha_eth *eth, int port, bool enable)
{}

static int airoha_set_gdm_ports(struct airoha_eth *eth, bool enable)
{}

static void airoha_fe_maccr_init(struct airoha_eth *eth)
{}

static void airoha_fe_vip_setup(struct airoha_eth *eth)
{}

static u32 airoha_fe_get_pse_queue_rsv_pages(struct airoha_eth *eth,
					     u32 port, u32 queue)
{}

static void airoha_fe_set_pse_queue_rsv_pages(struct airoha_eth *eth,
					      u32 port, u32 queue, u32 val)
{}

static int airoha_fe_set_pse_oq_rsv(struct airoha_eth *eth,
				    u32 port, u32 queue, u32 val)
{}

static void airoha_fe_pse_ports_init(struct airoha_eth *eth)
{}

static int airoha_fe_mc_vlan_clear(struct airoha_eth *eth)
{}

static void airoha_fe_crsn_qsel_init(struct airoha_eth *eth)
{}

static int airoha_fe_init(struct airoha_eth *eth)
{}

static int airoha_qdma_fill_rx_queue(struct airoha_queue *q)
{}

static int airoha_qdma_get_gdm_port(struct airoha_eth *eth,
				    struct airoha_qdma_desc *desc)
{}

static int airoha_qdma_rx_process(struct airoha_queue *q, int budget)
{}

static int airoha_qdma_rx_napi_poll(struct napi_struct *napi, int budget)
{}

static int airoha_qdma_init_rx_queue(struct airoha_eth *eth,
				     struct airoha_queue *q, int ndesc)
{}

static void airoha_qdma_cleanup_rx_queue(struct airoha_queue *q)
{}

static int airoha_qdma_init_rx(struct airoha_eth *eth)
{}

static int airoha_qdma_tx_napi_poll(struct napi_struct *napi, int budget)
{}

static int airoha_qdma_init_tx_queue(struct airoha_eth *eth,
				     struct airoha_queue *q, int size)
{}

static int airoha_qdma_tx_irq_init(struct airoha_eth *eth,
				   struct airoha_tx_irq_queue *irq_q,
				   int size)
{}

static int airoha_qdma_init_tx(struct airoha_eth *eth)
{}

static void airoha_qdma_cleanup_tx_queue(struct airoha_queue *q)
{}

static int airoha_qdma_init_hfwd_queues(struct airoha_eth *eth)
{}

static void airoha_qdma_init_qos(struct airoha_eth *eth)
{}

static int airoha_qdma_hw_init(struct airoha_eth *eth)
{}

static irqreturn_t airoha_irq_handler(int irq, void *dev_instance)
{}

static int airoha_qdma_init(struct airoha_eth *eth)
{}

static int airoha_hw_init(struct airoha_eth *eth)
{}

static void airoha_hw_cleanup(struct airoha_eth *eth)
{}

static void airoha_qdma_start_napi(struct airoha_eth *eth)
{}

static void airoha_update_hw_stats(struct airoha_gdm_port *port)
{}

static int airoha_dev_open(struct net_device *dev)
{}

static int airoha_dev_stop(struct net_device *dev)
{}

static int airoha_dev_set_macaddr(struct net_device *dev, void *p)
{}

static int airoha_dev_init(struct net_device *dev)
{}

static void airoha_dev_get_stats64(struct net_device *dev,
				   struct rtnl_link_stats64 *storage)
{}

static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
				   struct net_device *dev)
{}

static void airoha_ethtool_get_drvinfo(struct net_device *dev,
				       struct ethtool_drvinfo *info)
{}

static void airoha_ethtool_get_mac_stats(struct net_device *dev,
					 struct ethtool_eth_mac_stats *stats)
{}

static const struct ethtool_rmon_hist_range airoha_ethtool_rmon_ranges[] =;

static void
airoha_ethtool_get_rmon_stats(struct net_device *dev,
			      struct ethtool_rmon_stats *stats,
			      const struct ethtool_rmon_hist_range **ranges)
{}

static const struct net_device_ops airoha_netdev_ops =;

static const struct ethtool_ops airoha_ethtool_ops =;

static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np)
{}

static int airoha_probe(struct platform_device *pdev)
{}

static void airoha_remove(struct platform_device *pdev)
{}

static const struct of_device_id of_airoha_match[] =;

static struct platform_driver airoha_driver =;
module_platform_driver();

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();