linux/drivers/net/ethernet/netronome/nfp/nfp_net_dp.h

/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/* Copyright (C) 2019 Netronome Systems, Inc. */

#ifndef _NFP_NET_DP_
#define _NFP_NET_DP_

#include "nfp_net.h"

static inline dma_addr_t nfp_net_dma_map_rx(struct nfp_net_dp *dp, void *frag)
{}

static inline void
nfp_net_dma_sync_dev_rx(const struct nfp_net_dp *dp, dma_addr_t dma_addr)
{}

static inline void nfp_net_dma_unmap_rx(struct nfp_net_dp *dp,
					dma_addr_t dma_addr)
{}

static inline void nfp_net_dma_sync_cpu_rx(struct nfp_net_dp *dp,
					   dma_addr_t dma_addr,
					   unsigned int len)
{}

/**
 * nfp_net_tx_full() - check if the TX ring is full
 * @tx_ring: TX ring to check
 * @dcnt:    Number of descriptors that need to be enqueued (must be >= 1)
 *
 * This function checks, based on the *host copy* of read/write
 * pointer if a given TX ring is full.  The real TX queue may have
 * some newly made available slots.
 *
 * Return: True if the ring is full.
 */
static inline int nfp_net_tx_full(struct nfp_net_tx_ring *tx_ring, int dcnt)
{}

static inline void nfp_net_tx_xmit_more_flush(struct nfp_net_tx_ring *tx_ring)
{}

static inline u32
nfp_net_read_tx_cmpl(struct nfp_net_tx_ring *tx_ring, struct nfp_net_dp *dp)
{}

static inline void nfp_net_free_frag(void *frag, bool xdp)
{}

/**
 * nfp_net_irq_unmask() - Unmask automasked interrupt
 * @nn:       NFP Network structure
 * @entry_nr: MSI-X table entry
 *
 * Clear the ICR for the IRQ entry.
 */
static inline void nfp_net_irq_unmask(struct nfp_net *nn, unsigned int entry_nr)
{}

struct seq_file;

/* Common */
void
nfp_net_rx_ring_hw_cfg_write(struct nfp_net *nn,
			     struct nfp_net_rx_ring *rx_ring, unsigned int idx);
void
nfp_net_tx_ring_hw_cfg_write(struct nfp_net *nn,
			     struct nfp_net_tx_ring *tx_ring, unsigned int idx);
void nfp_net_vec_clear_ring_data(struct nfp_net *nn, unsigned int idx);

void *nfp_net_rx_alloc_one(struct nfp_net_dp *dp, dma_addr_t *dma_addr);
int nfp_net_rx_rings_prepare(struct nfp_net *nn, struct nfp_net_dp *dp);
int nfp_net_tx_rings_prepare(struct nfp_net *nn, struct nfp_net_dp *dp);
void nfp_net_rx_rings_free(struct nfp_net_dp *dp);
void nfp_net_tx_rings_free(struct nfp_net_dp *dp);
void nfp_net_rx_ring_reset(struct nfp_net_rx_ring *rx_ring);
bool nfp_net_vlan_strip(struct sk_buff *skb, const struct nfp_net_rx_desc *rxd,
			const struct nfp_meta_parsed *meta);

enum nfp_nfd_version {};

/**
 * struct nfp_dp_ops - Hooks to wrap different implementation of different dp
 * @version:			Indicate dp type
 * @tx_min_desc_per_pkt:	Minimal TX descs needed for each packet
 * @cap_mask:			Mask of supported features
 * @dma_mask:			DMA addressing capability
 * @poll:			Napi poll for normal rx/tx
 * @xsk_poll:			Napi poll when xsk is enabled
 * @ctrl_poll:			Tasklet poll for ctrl rx/tx
 * @xmit:			Xmit for normal path
 * @ctrl_tx_one:		Xmit for ctrl path
 * @rx_ring_fill_freelist:	Give buffers from the ring to FW
 * @tx_ring_alloc:		Allocate resource for a TX ring
 * @tx_ring_reset:		Free any untransmitted buffers and reset pointers
 * @tx_ring_free:		Free resources allocated to a TX ring
 * @tx_ring_bufs_alloc:		Allocate resource for each TX buffer
 * @tx_ring_bufs_free:		Free resources allocated to each TX buffer
 * @print_tx_descs:		Show TX ring's info for debug purpose
 */
struct nfp_dp_ops {};

static inline void
nfp_net_tx_ring_reset(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring)
{}

static inline void
nfp_net_rx_ring_fill_freelist(struct nfp_net_dp *dp,
			      struct nfp_net_rx_ring *rx_ring)
{}

static inline int
nfp_net_tx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring)
{}

static inline void
nfp_net_tx_ring_free(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring)
{}

static inline int
nfp_net_tx_ring_bufs_alloc(struct nfp_net_dp *dp,
			   struct nfp_net_tx_ring *tx_ring)
{}

static inline void
nfp_net_tx_ring_bufs_free(struct nfp_net_dp *dp,
			  struct nfp_net_tx_ring *tx_ring)
{}

static inline void
nfp_net_debugfs_print_tx_descs(struct seq_file *file, struct nfp_net_dp *dp,
			       struct nfp_net_r_vector *r_vec,
			       struct nfp_net_tx_ring *tx_ring,
			       u32 d_rd_p, u32 d_wr_p)
{}

extern const struct nfp_dp_ops nfp_nfd3_ops;
extern const struct nfp_dp_ops nfp_nfdk_ops;

netdev_tx_t nfp_net_tx(struct sk_buff *skb, struct net_device *netdev);

#endif /* _NFP_NET_DP_ */