1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2024 Hisilicon Limited. */
7 #include <linux/etherdevice.h>
10 static inline u32
hbg_spec_max_frame_len(struct hbg_priv
*priv
,
13 return (dir
== HBG_DIR_TX
) ? priv
->dev_specs
.max_frame_len
:
14 priv
->dev_specs
.rx_buf_size
;
17 static inline u32
hbg_get_spec_fifo_max_num(struct hbg_priv
*priv
,
20 return (dir
== HBG_DIR_TX
) ? priv
->dev_specs
.tx_fifo_num
:
21 priv
->dev_specs
.rx_fifo_num
;
24 static inline bool hbg_fifo_is_full(struct hbg_priv
*priv
, enum hbg_dir dir
)
26 return hbg_hw_get_fifo_used_num(priv
, dir
) >=
27 hbg_get_spec_fifo_max_num(priv
, dir
);
30 static inline u32
hbg_get_queue_used_num(struct hbg_ring
*ring
)
32 return (ring
->ntu
+ ring
->len
- ring
->ntc
) % ring
->len
;
35 netdev_tx_t
hbg_net_start_xmit(struct sk_buff
*skb
, struct net_device
*netdev
);
36 int hbg_txrx_init(struct hbg_priv
*priv
);
37 void hbg_txrx_uninit(struct hbg_priv
*priv
);