1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2024 Hisilicon Limited. */
7 #include <linux/netdevice.h>
11 #define HBG_STATUS_DISABLE 0x0
12 #define HBG_STATUS_ENABLE 0x1
13 #define HBG_RX_SKIP1 0x00
14 #define HBG_RX_SKIP2 0x01
15 #define HBG_VECTOR_NUM 4
16 #define HBG_PCU_CACHE_LINE_SIZE 32
17 #define HBG_TX_TIMEOUT_BUF_LEN 1024
18 #define HBG_RX_DESCR 0x01
20 #define HBG_PACKET_HEAD_SIZE ((HBG_RX_SKIP1 + HBG_RX_SKIP2 + \
21 HBG_RX_DESCR) * HBG_PCU_CACHE_LINE_SIZE)
26 HBG_DIR_TX_RX
= HBG_DIR_TX
| HBG_DIR_RX
,
30 HBG_TX_STATE_COMPLETE
= 0, /* clear state, must fix to 0 */
35 HBG_NIC_STATE_EVENT_HANDLING
= 0,
47 struct hbg_ring
*ring
;
48 struct hbg_priv
*priv
;
52 struct hbg_buffer
*queue
;
66 struct hbg_priv
*priv
;
67 struct napi_struct napi
;
68 char *tout_log_buf
; /* tx timeout log buffer */
71 enum hbg_hw_event_type
{
72 HBG_HW_EVENT_NONE
= 0,
73 HBG_HW_EVENT_INIT
, /* driver is loading */
77 struct hbg_dev_specs
{
79 struct sockaddr mac_addr
;
99 void (*irq_handle
)(struct hbg_priv
*priv
, struct hbg_irq_info
*info
);
103 char name
[HBG_VECTOR_NUM
][32];
104 struct hbg_irq_info
*info_array
;
109 struct mii_bus
*mdio_bus
;
110 struct phy_device
*phydev
;
120 struct net_device
*netdev
;
121 struct pci_dev
*pdev
;
123 struct hbg_dev_specs dev_specs
;
126 struct hbg_vector vectors
;
127 struct hbg_ring tx_ring
;
128 struct hbg_ring rx_ring
;