linux/drivers/net/ethernet/fungible/funeth/funeth_txrx.h

/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */

#ifndef _FUNETH_TXRX_H
#define _FUNETH_TXRX_H

#include <linux/netdevice.h>
#include <linux/u64_stats_sync.h>
#include <net/xdp.h>

/* Tx descriptor size */
#define FUNETH_SQE_SIZE

/* Size of device headers per Tx packet */
#define FUNETH_FUNOS_HDR_SZ

/* Number of gather list entries per Tx descriptor */
#define FUNETH_GLE_PER_DESC

/* Max gather list size in bytes for an sk_buff. */
#define FUNETH_MAX_GL_SZ

#if IS_ENABLED(CONFIG_TLS_DEVICE)
#define FUNETH_TLS_SZ
#else
#define FUNETH_TLS_SZ
#endif

/* Max number of Tx descriptors for an sk_buff using a gather list. */
#define FUNETH_MAX_GL_DESC

/* Max number of Tx descriptors for any packet. */
#define FUNETH_MAX_PKT_DESC

/* Rx CQ descriptor size. */
#define FUNETH_CQE_SIZE

/* Offset of cqe_info within a CQE. */
#define FUNETH_CQE_INFO_OFFSET

/* Construct the IRQ portion of a CQ doorbell. The resulting value arms the
 * interrupt with the supplied time delay and packet count moderation settings.
 */
#define FUN_IRQ_CQ_DB(usec, pkts)

/* As above for SQ doorbells. */
#define FUN_IRQ_SQ_DB(usec, pkts)

/* Per packet tailroom. Present only for 1-frag packets. */
#define FUN_RX_TAILROOM

/* Per packet headroom for XDP. Preferred over XDP_PACKET_HEADROOM to
 * accommodate two packets per buffer for 4K pages and 1500B MTUs.
 */
#define FUN_XDP_HEADROOM

/* Initialization state of a queue. */
enum {};

/* Initialization state of an interrupt. */
enum {};

struct bpf_prog;

struct funeth_txq_stats {};

struct funeth_tx_info {};

struct funeth_txq {};

struct funeth_rxq_stats {};

struct funeth_rxbuf {};

struct funeth_rx_cache {};

/* An Rx queue consists of a CQ and an SQ used to provide Rx buffers. */
struct funeth_rxq {};

#define FUN_QSTAT_INC(q, counter)

#define FUN_QSTAT_READ(q, seq, stats_copy)

#define FUN_INT_NAME_LEN

struct fun_irq {} ____cacheline_internodealigned_in_smp;

/* Return the start address of the idx-th Tx descriptor. */
static inline void *fun_tx_desc_addr(const struct funeth_txq *q,
				     unsigned int idx)
{}

static inline void fun_txq_wr_db(const struct funeth_txq *q)
{}

static inline int fun_irq_node(const struct fun_irq *p)
{}

int fun_rxq_napi_poll(struct napi_struct *napi, int budget);
int fun_txq_napi_poll(struct napi_struct *napi, int budget);
netdev_tx_t fun_start_xmit(struct sk_buff *skb, struct net_device *netdev);
bool fun_xdp_tx(struct funeth_txq *q, struct xdp_frame *xdpf);
int fun_xdp_xmit_frames(struct net_device *dev, int n,
			struct xdp_frame **frames, u32 flags);

int funeth_txq_create(struct net_device *dev, unsigned int qidx,
		      unsigned int ndesc, struct fun_irq *irq, int state,
		      struct funeth_txq **qp);
int fun_txq_create_dev(struct funeth_txq *q, struct fun_irq *irq);
struct funeth_txq *funeth_txq_free(struct funeth_txq *q, int state);
int funeth_rxq_create(struct net_device *dev, unsigned int qidx,
		      unsigned int ncqe, unsigned int nrqe, struct fun_irq *irq,
		      int state, struct funeth_rxq **qp);
int fun_rxq_create_dev(struct funeth_rxq *q, struct fun_irq *irq);
struct funeth_rxq *funeth_rxq_free(struct funeth_rxq *q, int state);
int fun_rxq_set_bpf(struct funeth_rxq *q, struct bpf_prog *prog);

#endif /* _FUNETH_TXRX_H */