#include <linux/bitfield.h>
#include <linux/ethtool.h>
#include <linux/firmware.h>
#include <linux/if_vlan.h>
#include <linux/iopoll.h>
#include <linux/netdevice.h>
#include <linux/pci.h>
#include <linux/phylink.h>
#include <linux/vmalloc.h>
#include <net/netdev_queues.h>
#include <net/page_pool/helpers.h>
#include "tn40.h"
#define TN40_SHORT_PACKET_SIZE …
#define TN40_FIRMWARE_NAME …
static void tn40_enable_interrupts(struct tn40_priv *priv)
{ … }
static void tn40_disable_interrupts(struct tn40_priv *priv)
{ … }
static int tn40_fifo_alloc(struct tn40_priv *priv, struct tn40_fifo *f,
int fsz_type,
u16 reg_cfg0, u16 reg_cfg1,
u16 reg_rptr, u16 reg_wptr)
{ … }
static void tn40_fifo_free(struct tn40_priv *priv, struct tn40_fifo *f)
{ … }
static struct tn40_rxdb *tn40_rxdb_alloc(int nelem)
{ … }
static void tn40_rxdb_free(struct tn40_rxdb *db)
{ … }
static int tn40_rxdb_alloc_elem(struct tn40_rxdb *db)
{ … }
static void *tn40_rxdb_addr_elem(struct tn40_rxdb *db, unsigned int n)
{ … }
static int tn40_rxdb_available(struct tn40_rxdb *db)
{ … }
static void tn40_rxdb_free_elem(struct tn40_rxdb *db, unsigned int n)
{ … }
static int tn40_create_rx_ring(struct tn40_priv *priv)
{ … }
static void tn40_rx_free_buffers(struct tn40_priv *priv)
{ … }
static void tn40_destroy_rx_ring(struct tn40_priv *priv)
{ … }
static void tn40_set_rx_desc(struct tn40_priv *priv, int idx, u64 dma)
{ … }
static void tn40_rx_alloc_buffers(struct tn40_priv *priv)
{ … }
static void tn40_recycle_rx_buffer(struct tn40_priv *priv,
struct tn40_rxd_desc *rxdd)
{ … }
static int tn40_rx_receive(struct tn40_priv *priv, int budget)
{ … }
static void tn40_do_tx_db_ptr_next(struct tn40_txdb *db,
struct tn40_tx_map **pptr)
{ … }
static void tn40_tx_db_inc_rptr(struct tn40_txdb *db)
{ … }
static void tn40_tx_db_inc_wptr(struct tn40_txdb *db)
{ … }
static int tn40_tx_db_init(struct tn40_txdb *d, int sz_type)
{ … }
static void tn40_tx_db_close(struct tn40_txdb *d)
{ … }
static struct { … } tn40_txd_sizes[] = …;
static void tn40_pbl_set(struct tn40_pbl *pbl, dma_addr_t dma, int len)
{ … }
static void tn40_txdb_set(struct tn40_txdb *db, dma_addr_t dma, int len)
{ … }
struct tn40_mapping_info { … };
static int tn40_tx_map_skb(struct tn40_priv *priv, struct sk_buff *skb,
struct tn40_txd_desc *txdd, unsigned int *pkt_len)
{ … }
static int tn40_create_tx_ring(struct tn40_priv *priv)
{ … }
static int tn40_tx_space(struct tn40_priv *priv)
{ … }
#define TN40_TXD_FULL_CHECKSUM …
static netdev_tx_t tn40_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{ … }
static void tn40_tx_cleanup(struct tn40_priv *priv)
{ … }
static void tn40_tx_free_skbs(struct tn40_priv *priv)
{ … }
static void tn40_destroy_tx_ring(struct tn40_priv *priv)
{ … }
static void tn40_tx_push_desc(struct tn40_priv *priv, void *data, int size)
{ … }
static void tn40_tx_push_desc_safe(struct tn40_priv *priv, void *data, int size)
{ … }
int tn40_set_link_speed(struct tn40_priv *priv, u32 speed)
{ … }
static void tn40_link_changed(struct tn40_priv *priv)
{ … }
static void tn40_isr_extra(struct tn40_priv *priv, u32 isr)
{ … }
static irqreturn_t tn40_isr_napi(int irq, void *dev)
{ … }
static int tn40_poll(struct napi_struct *napi, int budget)
{ … }
static int tn40_fw_load(struct tn40_priv *priv)
{ … }
static void tn40_restore_mac(struct net_device *ndev, struct tn40_priv *priv)
{ … }
static void tn40_hw_start(struct tn40_priv *priv)
{ … }
static int tn40_hw_reset(struct tn40_priv *priv)
{ … }
static void tn40_sw_reset(struct tn40_priv *priv)
{ … }
static int tn40_start(struct tn40_priv *priv)
{ … }
static void tn40_stop(struct tn40_priv *priv)
{ … }
static int tn40_close(struct net_device *ndev)
{ … }
static int tn40_open(struct net_device *dev)
{ … }
static void __tn40_vlan_rx_vid(struct net_device *ndev, uint16_t vid,
int enable)
{ … }
static int tn40_vlan_rx_add_vid(struct net_device *ndev,
__always_unused __be16 proto, u16 vid)
{ … }
static int tn40_vlan_rx_kill_vid(struct net_device *ndev,
__always_unused __be16 proto, u16 vid)
{ … }
static void tn40_setmulti(struct net_device *ndev)
{ … }
static int tn40_set_mac(struct net_device *ndev, void *p)
{ … }
static void tn40_mac_init(struct tn40_priv *priv)
{ … }
static void tn40_get_stats(struct net_device *ndev,
struct rtnl_link_stats64 *stats)
{ … }
static const struct net_device_ops tn40_netdev_ops = …;
static int tn40_ethtool_get_link_ksettings(struct net_device *ndev,
struct ethtool_link_ksettings *cmd)
{ … }
static const struct ethtool_ops tn40_ethtool_ops = …;
static void tn40_get_queue_stats_rx(struct net_device *ndev, int idx,
struct netdev_queue_stats_rx *stats)
{ … }
static void tn40_get_queue_stats_tx(struct net_device *ndev, int idx,
struct netdev_queue_stats_tx *stats)
{ … }
static void tn40_get_base_stats(struct net_device *ndev,
struct netdev_queue_stats_rx *rx,
struct netdev_queue_stats_tx *tx)
{ … }
static const struct netdev_stat_ops tn40_stat_ops = …;
static int tn40_priv_init(struct tn40_priv *priv)
{ … }
static struct net_device *tn40_netdev_alloc(struct pci_dev *pdev)
{ … }
static int tn40_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ … }
static void tn40_remove(struct pci_dev *pdev)
{ … }
static const struct pci_device_id tn40_id_table[] = …;
static struct pci_driver tn40_driver = …;
module_pci_driver(…) …;
MODULE_DEVICE_TABLE(pci, tn40_id_table);
MODULE_LICENSE(…) …;
MODULE_FIRMWARE(…);
MODULE_DESCRIPTION(…) …;