#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/if_vlan.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/log2.h>
#include <linux/prefetch.h>
#include <linux/irq.h>
#include <linux/iommu.h>
#include <linux/bpf.h>
#include <linux/bpf_trace.h>
#include <linux/filter.h>
#include <linux/net_tstamp.h>
#include <linux/workqueue.h>
#include "nic_reg.h"
#include "nic.h"
#include "nicvf_queues.h"
#include "thunder_bgx.h"
#include "../common/cavium_ptp.h"
#define DRV_NAME …
#define DRV_VERSION …
#define MAX_XDP_MTU …
static const struct pci_device_id nicvf_id_table[] = …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_VERSION(…);
MODULE_DEVICE_TABLE(pci, nicvf_id_table);
static int debug = …;
module_param(debug, int, 0644);
MODULE_PARM_DESC(…) …;
static int cpi_alg = …;
module_param(cpi_alg, int, 0444);
MODULE_PARM_DESC(…) …;
static inline u8 nicvf_netdev_qidx(struct nicvf *nic, u8 qidx)
{ … }
void nicvf_reg_write(struct nicvf *nic, u64 offset, u64 val)
{ … }
u64 nicvf_reg_read(struct nicvf *nic, u64 offset)
{ … }
void nicvf_queue_reg_write(struct nicvf *nic, u64 offset,
u64 qidx, u64 val)
{ … }
u64 nicvf_queue_reg_read(struct nicvf *nic, u64 offset, u64 qidx)
{ … }
static void nicvf_write_to_mbx(struct nicvf *nic, union nic_mbx *mbx)
{ … }
int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
{ … }
static int nicvf_check_pf_ready(struct nicvf *nic)
{ … }
static void nicvf_send_cfg_done(struct nicvf *nic)
{ … }
static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx)
{ … }
static void nicvf_handle_mbx_intr(struct nicvf *nic)
{ … }
static int nicvf_hw_set_mac_addr(struct nicvf *nic, struct net_device *netdev)
{ … }
static void nicvf_config_cpi(struct nicvf *nic)
{ … }
static void nicvf_get_rss_size(struct nicvf *nic)
{ … }
void nicvf_config_rss(struct nicvf *nic)
{ … }
void nicvf_set_rss_key(struct nicvf *nic)
{ … }
static int nicvf_rss_init(struct nicvf *nic)
{ … }
static void nicvf_request_sqs(struct nicvf *nic)
{ … }
static void nicvf_send_vf_struct(struct nicvf *nic)
{ … }
static void nicvf_get_primary_vf_struct(struct nicvf *nic)
{ … }
int nicvf_set_real_num_queues(struct net_device *netdev,
int tx_queues, int rx_queues)
{ … }
static int nicvf_init_resources(struct nicvf *nic)
{ … }
static inline bool nicvf_xdp_rx(struct nicvf *nic, struct bpf_prog *prog,
struct cqe_rx_t *cqe_rx, struct snd_queue *sq,
struct rcv_queue *rq, struct sk_buff **skb)
{ … }
static void nicvf_snd_ptp_handler(struct net_device *netdev,
struct cqe_send_t *cqe_tx)
{ … }
static void nicvf_snd_pkt_handler(struct net_device *netdev,
struct cqe_send_t *cqe_tx,
int budget, int *subdesc_cnt,
unsigned int *tx_pkts, unsigned int *tx_bytes)
{ … }
static inline void nicvf_set_rxhash(struct net_device *netdev,
struct cqe_rx_t *cqe_rx,
struct sk_buff *skb)
{ … }
static inline void nicvf_set_rxtstamp(struct nicvf *nic, struct sk_buff *skb)
{ … }
static void nicvf_rcv_pkt_handler(struct net_device *netdev,
struct napi_struct *napi,
struct cqe_rx_t *cqe_rx,
struct snd_queue *sq, struct rcv_queue *rq)
{ … }
static int nicvf_cq_intr_handler(struct net_device *netdev, u8 cq_idx,
struct napi_struct *napi, int budget)
{ … }
static int nicvf_poll(struct napi_struct *napi, int budget)
{ … }
static void nicvf_handle_qs_err(struct tasklet_struct *t)
{ … }
static void nicvf_dump_intr_status(struct nicvf *nic)
{ … }
static irqreturn_t nicvf_misc_intr_handler(int irq, void *nicvf_irq)
{ … }
static irqreturn_t nicvf_intr_handler(int irq, void *cq_irq)
{ … }
static irqreturn_t nicvf_rbdr_intr_handler(int irq, void *nicvf_irq)
{ … }
static irqreturn_t nicvf_qs_err_intr_handler(int irq, void *nicvf_irq)
{ … }
static void nicvf_set_irq_affinity(struct nicvf *nic)
{ … }
static int nicvf_register_interrupts(struct nicvf *nic)
{ … }
static void nicvf_unregister_interrupts(struct nicvf *nic)
{ … }
static int nicvf_register_misc_interrupt(struct nicvf *nic)
{ … }
static netdev_tx_t nicvf_xmit(struct sk_buff *skb, struct net_device *netdev)
{ … }
static inline void nicvf_free_cq_poll(struct nicvf *nic)
{ … }
int nicvf_stop(struct net_device *netdev)
{ … }
static int nicvf_config_hw_rx_tstamp(struct nicvf *nic, bool enable)
{ … }
static int nicvf_update_hw_max_frs(struct nicvf *nic, int mtu)
{ … }
static void nicvf_link_status_check_task(struct work_struct *work_arg)
{ … }
int nicvf_open(struct net_device *netdev)
{ … }
static int nicvf_change_mtu(struct net_device *netdev, int new_mtu)
{ … }
static int nicvf_set_mac_address(struct net_device *netdev, void *p)
{ … }
void nicvf_update_lmac_stats(struct nicvf *nic)
{ … }
void nicvf_update_stats(struct nicvf *nic)
{ … }
static void nicvf_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64 *stats)
{ … }
static void nicvf_tx_timeout(struct net_device *dev, unsigned int txqueue)
{ … }
static void nicvf_reset_task(struct work_struct *work)
{ … }
static int nicvf_config_loopback(struct nicvf *nic,
netdev_features_t features)
{ … }
static netdev_features_t nicvf_fix_features(struct net_device *netdev,
netdev_features_t features)
{ … }
static int nicvf_set_features(struct net_device *netdev,
netdev_features_t features)
{ … }
static void nicvf_set_xdp_queues(struct nicvf *nic, bool bpf_attached)
{ … }
static int nicvf_xdp_setup(struct nicvf *nic, struct bpf_prog *prog)
{ … }
static int nicvf_xdp(struct net_device *netdev, struct netdev_bpf *xdp)
{ … }
static int nicvf_config_hwtstamp(struct net_device *netdev, struct ifreq *ifr)
{ … }
static int nicvf_ioctl(struct net_device *netdev, struct ifreq *req, int cmd)
{ … }
static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,
struct nicvf *nic)
{ … }
static void nicvf_set_rx_mode_task(struct work_struct *work_arg)
{ … }
static void nicvf_set_rx_mode(struct net_device *netdev)
{ … }
static const struct net_device_ops nicvf_netdev_ops = …;
static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ … }
static void nicvf_remove(struct pci_dev *pdev)
{ … }
static void nicvf_shutdown(struct pci_dev *pdev)
{ … }
static struct pci_driver nicvf_driver = …;
static int __init nicvf_init_module(void)
{ … }
static void __exit nicvf_cleanup_module(void)
{ … }
module_init(…) …;
module_exit(nicvf_cleanup_module);