#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/ip.h>
#include <linux/etherdevice.h>
#include <linux/iommu.h>
#include <net/ip.h>
#include <net/tso.h>
#include <uapi/linux/bpf.h>
#include "nic_reg.h"
#include "nic.h"
#include "q_struct.h"
#include "nicvf_queues.h"
static inline void nicvf_sq_add_gather_subdesc(struct snd_queue *sq, int qentry,
int size, u64 data);
static void nicvf_get_page(struct nicvf *nic)
{ … }
static int nicvf_poll_reg(struct nicvf *nic, int qidx,
u64 reg, int bit_pos, int bits, int val)
{ … }
static int nicvf_alloc_q_desc_mem(struct nicvf *nic, struct q_desc_mem *dmem,
int q_len, int desc_size, int align_bytes)
{ … }
static void nicvf_free_q_desc_mem(struct nicvf *nic, struct q_desc_mem *dmem)
{ … }
#define XDP_PAGE_REFCNT_REFILL …
static inline struct pgcache *nicvf_alloc_page(struct nicvf *nic,
struct rbdr *rbdr, gfp_t gfp)
{ … }
static inline int nicvf_alloc_rcv_buffer(struct nicvf *nic, struct rbdr *rbdr,
gfp_t gfp, u32 buf_len, u64 *rbuf)
{ … }
static struct sk_buff *nicvf_rb_ptr_to_skb(struct nicvf *nic,
u64 rb_ptr, int len)
{ … }
static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr,
int ring_len, int buf_size)
{ … }
static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr)
{ … }
static void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp)
{ … }
void nicvf_rbdr_work(struct work_struct *work)
{ … }
void nicvf_rbdr_task(struct tasklet_struct *t)
{ … }
static int nicvf_init_cmp_queue(struct nicvf *nic,
struct cmp_queue *cq, int q_len)
{ … }
static void nicvf_free_cmp_queue(struct nicvf *nic, struct cmp_queue *cq)
{ … }
static int nicvf_init_snd_queue(struct nicvf *nic,
struct snd_queue *sq, int q_len, int qidx)
{ … }
void nicvf_unmap_sndq_buffers(struct nicvf *nic, struct snd_queue *sq,
int hdr_sqe, u8 subdesc_cnt)
{ … }
static void nicvf_free_snd_queue(struct nicvf *nic, struct snd_queue *sq)
{ … }
static void nicvf_reclaim_snd_queue(struct nicvf *nic,
struct queue_set *qs, int qidx)
{ … }
static void nicvf_reclaim_rcv_queue(struct nicvf *nic,
struct queue_set *qs, int qidx)
{ … }
static void nicvf_reclaim_cmp_queue(struct nicvf *nic,
struct queue_set *qs, int qidx)
{ … }
static void nicvf_reclaim_rbdr(struct nicvf *nic,
struct rbdr *rbdr, int qidx)
{ … }
void nicvf_config_vlan_stripping(struct nicvf *nic, netdev_features_t features)
{ … }
static void nicvf_reset_rcv_queue_stats(struct nicvf *nic)
{ … }
static void nicvf_rcv_queue_config(struct nicvf *nic, struct queue_set *qs,
int qidx, bool enable)
{ … }
void nicvf_cmp_queue_config(struct nicvf *nic, struct queue_set *qs,
int qidx, bool enable)
{ … }
static void nicvf_snd_queue_config(struct nicvf *nic, struct queue_set *qs,
int qidx, bool enable)
{ … }
static void nicvf_rbdr_config(struct nicvf *nic, struct queue_set *qs,
int qidx, bool enable)
{ … }
void nicvf_qset_config(struct nicvf *nic, bool enable)
{ … }
static void nicvf_free_resources(struct nicvf *nic)
{ … }
static int nicvf_alloc_resources(struct nicvf *nic)
{ … }
int nicvf_set_qset_resources(struct nicvf *nic)
{ … }
int nicvf_config_data_transfer(struct nicvf *nic, bool enable)
{ … }
static inline int nicvf_get_sq_desc(struct snd_queue *sq, int desc_cnt)
{ … }
static inline void nicvf_rollback_sq_desc(struct snd_queue *sq,
int qentry, int desc_cnt)
{ … }
void nicvf_put_sq_desc(struct snd_queue *sq, int desc_cnt)
{ … }
static inline int nicvf_get_nxt_sqentry(struct snd_queue *sq, int qentry)
{ … }
void nicvf_sq_enable(struct nicvf *nic, struct snd_queue *sq, int qidx)
{ … }
void nicvf_sq_disable(struct nicvf *nic, int qidx)
{ … }
void nicvf_sq_free_used_descs(struct net_device *netdev, struct snd_queue *sq,
int qidx)
{ … }
void nicvf_xdp_sq_doorbell(struct nicvf *nic,
struct snd_queue *sq, int sq_num)
{ … }
static inline void
nicvf_xdp_sq_add_hdr_subdesc(struct snd_queue *sq, int qentry,
int subdesc_cnt, u64 data, int len)
{ … }
int nicvf_xdp_sq_append_pkt(struct nicvf *nic, struct snd_queue *sq,
u64 bufaddr, u64 dma_addr, u16 len)
{ … }
static int nicvf_tso_count_subdescs(struct sk_buff *skb)
{ … }
#define POST_CQE_DESC_COUNT …
static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb)
{ … }
static inline void
nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry,
int subdesc_cnt, struct sk_buff *skb, int len)
{ … }
static inline void nicvf_sq_add_gather_subdesc(struct snd_queue *sq, int qentry,
int size, u64 data)
{ … }
static inline void nicvf_sq_add_cqe_subdesc(struct snd_queue *sq, int qentry,
int tso_sqe, struct sk_buff *skb)
{ … }
static inline void nicvf_sq_doorbell(struct nicvf *nic, struct sk_buff *skb,
int sq_num, int desc_cnt)
{ … }
static int nicvf_sq_append_tso(struct nicvf *nic, struct snd_queue *sq,
int sq_num, int qentry, struct sk_buff *skb)
{ … }
int nicvf_sq_append_skb(struct nicvf *nic, struct snd_queue *sq,
struct sk_buff *skb, u8 sq_num)
{ … }
static inline unsigned frag_num(unsigned i)
{ … }
static void nicvf_unmap_rcv_buffer(struct nicvf *nic, u64 dma_addr,
u64 buf_addr, bool xdp)
{ … }
struct sk_buff *nicvf_get_rcv_skb(struct nicvf *nic,
struct cqe_rx_t *cqe_rx, bool xdp)
{ … }
static u64 nicvf_int_type_to_mask(int int_type, int q_idx)
{ … }
void nicvf_enable_intr(struct nicvf *nic, int int_type, int q_idx)
{ … }
void nicvf_disable_intr(struct nicvf *nic, int int_type, int q_idx)
{ … }
void nicvf_clear_intr(struct nicvf *nic, int int_type, int q_idx)
{ … }
int nicvf_is_intr_enabled(struct nicvf *nic, int int_type, int q_idx)
{ … }
void nicvf_update_rq_stats(struct nicvf *nic, int rq_idx)
{ … }
void nicvf_update_sq_stats(struct nicvf *nic, int sq_idx)
{ … }
int nicvf_check_cqe_rx_errs(struct nicvf *nic, struct cqe_rx_t *cqe_rx)
{ … }
int nicvf_check_cqe_tx_errs(struct nicvf *nic, struct cqe_send_t *cqe_tx)
{ … }