Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / net / ethernet / hisilicon / hibmcge / hbg_txrx.h
blob2883a5899ae29e41a54837bc753f2bec9a477781
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2024 Hisilicon Limited. */
4 #ifndef __HBG_TXRX_H
5 #define __HBG_TXRX_H
7 #include <linux/etherdevice.h>
8 #include "hbg_hw.h"
10 static inline u32 hbg_spec_max_frame_len(struct hbg_priv *priv,
11 enum hbg_dir dir)
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,
18 enum hbg_dir dir)
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);
39 #endif