linux/drivers/net/ethernet/intel/fm10k/fm10k.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2013 - 2019 Intel Corporation. */

#ifndef _FM10K_H_
#define _FM10K_H_

#include <linux/types.h>
#include <linux/etherdevice.h>
#include <linux/cpumask.h>
#include <linux/rtnetlink.h>
#include <linux/if_vlan.h>
#include <linux/pci.h>

#include "fm10k_pf.h"
#include "fm10k_vf.h"

#define FM10K_MAX_JUMBO_FRAME_SIZE

#define MAX_QUEUES

#define FM10K_MIN_RXD
#define FM10K_MAX_RXD
#define FM10K_DEFAULT_RXD

#define FM10K_MIN_TXD
#define FM10K_MAX_TXD
#define FM10K_DEFAULT_TXD
#define FM10K_DEFAULT_TX_WORK

#define FM10K_RXBUFFER_256
#define FM10K_RX_HDR_LEN
#define FM10K_RXBUFFER_2048
#define FM10K_RX_BUFSZ

/* How many Rx Buffers do we bundle into one write to the hardware ? */
#define FM10K_RX_BUFFER_WRITE

#define FM10K_MAX_STATIONS
struct fm10k_l2_accel {};

enum fm10k_ring_state_t {};

#define check_for_tx_hang(ring)
#define set_check_for_tx_hang(ring)
#define clear_check_for_tx_hang(ring)

struct fm10k_tx_buffer {};

struct fm10k_rx_buffer {};

struct fm10k_queue_stats {};

struct fm10k_tx_queue_stats {};

struct fm10k_rx_queue_stats {};

struct fm10k_ring {} ____cacheline_internodealigned_in_smp;

struct fm10k_ring_container {};

#define FM10K_ITR_MAX
#define FM10K_ITR_10K
#define FM10K_ITR_20K
#define FM10K_ITR_40K
#define FM10K_ITR_ADAPTIVE

#define ITR_IS_ADAPTIVE(itr)

#define FM10K_TX_ITR_DEFAULT
#define FM10K_RX_ITR_DEFAULT
#define FM10K_ITR_ENABLE

static inline struct netdev_queue *txring_txq(const struct fm10k_ring *ring)
{}

/* iterator for handling rings in ring container */
#define fm10k_for_each_ring(pos, head)

#define MAX_Q_VECTORS
#define MIN_Q_VECTORS
enum fm10k_non_q_vectors {};

#define MIN_MSIX_COUNT(hw)

struct fm10k_q_vector {};

enum fm10k_ring_f_enum {};

struct fm10k_ring_feature {};

struct fm10k_iov_data {};

enum fm10k_macvlan_request_type {};

struct fm10k_macvlan_request {};

/* one work queue for entire driver */
extern struct workqueue_struct *fm10k_workqueue;

/* The following enumeration contains flags which indicate or enable modified
 * driver behaviors. To avoid race conditions, the flags are stored in
 * a BITMAP in the fm10k_intfc structure. The BITMAP should be accessed using
 * atomic *_bit() operations.
 */
enum fm10k_flags_t {};

enum fm10k_state_t {};

struct fm10k_intfc {};

static inline void fm10k_mbx_lock(struct fm10k_intfc *interface)
{}

static inline void fm10k_mbx_unlock(struct fm10k_intfc *interface)
{}

static inline int fm10k_mbx_trylock(struct fm10k_intfc *interface)
{}

/* fm10k_test_staterr - test bits in Rx descriptor status and error fields */
static inline __le32 fm10k_test_staterr(union fm10k_rx_desc *rx_desc,
					const u32 stat_err_bits)
{}

/* fm10k_desc_unused - calculate if we have unused descriptors */
static inline u16 fm10k_desc_unused(struct fm10k_ring *ring)
{}

#define FM10K_TX_DESC(R, i)
#define FM10K_RX_DESC(R, i)

#define FM10K_MAX_TXD_PWR
#define FM10K_MAX_DATA_PER_TXD

/* Tx Descriptors needed, worst case */
#define TXD_USE_COUNT(S)
#define DESC_NEEDED

enum fm10k_tx_flags {};

/* This structure is stored as little endian values as that is the native
 * format of the Rx descriptor.  The ordering of these fields is reversed
 * from the actual ftag header to allow for a single bswap to take care
 * of placing all of the values in network order
 */
fm10k_ftag_info;

struct fm10k_cb {};

#define FM10K_CB(skb)

/* main */
extern char fm10k_driver_name[];
int fm10k_init_queueing_scheme(struct fm10k_intfc *interface);
void fm10k_clear_queueing_scheme(struct fm10k_intfc *interface);
__be16 fm10k_tx_encap_offload(struct sk_buff *skb);
netdev_tx_t fm10k_xmit_frame_ring(struct sk_buff *skb,
				  struct fm10k_ring *tx_ring);
void fm10k_tx_timeout_reset(struct fm10k_intfc *interface);
u64 fm10k_get_tx_pending(struct fm10k_ring *ring, bool in_sw);
bool fm10k_check_tx_hang(struct fm10k_ring *tx_ring);
void fm10k_alloc_rx_buffers(struct fm10k_ring *rx_ring, u16 cleaned_count);

/* PCI */
void fm10k_mbx_free_irq(struct fm10k_intfc *);
int fm10k_mbx_request_irq(struct fm10k_intfc *);
void fm10k_qv_free_irq(struct fm10k_intfc *interface);
int fm10k_qv_request_irq(struct fm10k_intfc *interface);
int fm10k_register_pci_driver(void);
void fm10k_unregister_pci_driver(void);
void fm10k_up(struct fm10k_intfc *interface);
void fm10k_down(struct fm10k_intfc *interface);
void fm10k_update_stats(struct fm10k_intfc *interface);
void fm10k_service_event_schedule(struct fm10k_intfc *interface);
void fm10k_macvlan_schedule(struct fm10k_intfc *interface);
void fm10k_update_rx_drop_en(struct fm10k_intfc *interface);

/* Netdev */
struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info);
int fm10k_setup_rx_resources(struct fm10k_ring *);
int fm10k_setup_tx_resources(struct fm10k_ring *);
void fm10k_free_rx_resources(struct fm10k_ring *);
void fm10k_free_tx_resources(struct fm10k_ring *);
void fm10k_clean_all_rx_rings(struct fm10k_intfc *);
void fm10k_clean_all_tx_rings(struct fm10k_intfc *);
void fm10k_unmap_and_free_tx_resource(struct fm10k_ring *,
				      struct fm10k_tx_buffer *);
void fm10k_restore_rx_state(struct fm10k_intfc *);
void fm10k_reset_rx_state(struct fm10k_intfc *);
int fm10k_setup_tc(struct net_device *dev, u8 tc);
int fm10k_open(struct net_device *netdev);
int fm10k_close(struct net_device *netdev);
int fm10k_queue_vlan_request(struct fm10k_intfc *interface, u32 vid,
			     u8 vsi, bool set);
int fm10k_queue_mac_request(struct fm10k_intfc *interface, u16 glort,
			    const unsigned char *addr, u16 vid, bool set);
void fm10k_clear_macvlan_queue(struct fm10k_intfc *interface,
			       u16 glort, bool vlans);

/* Ethtool */
void fm10k_set_ethtool_ops(struct net_device *dev);
void fm10k_write_reta(struct fm10k_intfc *interface, const u32 *indir);

/* IOV */
s32 fm10k_iov_event(struct fm10k_intfc *interface);
s32 fm10k_iov_mbx(struct fm10k_intfc *interface);
void fm10k_iov_suspend(struct pci_dev *pdev);
int fm10k_iov_resume(struct pci_dev *pdev);
void fm10k_iov_disable(struct pci_dev *pdev);
int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs);
void fm10k_iov_update_stats(struct fm10k_intfc *interface);
s32 fm10k_iov_update_pvid(struct fm10k_intfc *interface, u16 glort, u16 pvid);
int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac);
int fm10k_ndo_set_vf_vlan(struct net_device *netdev,
			  int vf_idx, u16 vid, u8 qos, __be16 vlan_proto);
int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx,
			int __always_unused min_rate, int max_rate);
int fm10k_ndo_get_vf_config(struct net_device *netdev,
			    int vf_idx, struct ifla_vf_info *ivi);
int fm10k_ndo_get_vf_stats(struct net_device *netdev,
			   int vf_idx, struct ifla_vf_stats *stats);

/* DebugFS */
#ifdef CONFIG_DEBUG_FS
void fm10k_dbg_q_vector_init(struct fm10k_q_vector *q_vector);
void fm10k_dbg_q_vector_exit(struct fm10k_q_vector *q_vector);
void fm10k_dbg_intfc_init(struct fm10k_intfc *interface);
void fm10k_dbg_intfc_exit(struct fm10k_intfc *interface);
void fm10k_dbg_init(void);
void fm10k_dbg_exit(void);
#else
static inline void fm10k_dbg_q_vector_init(struct fm10k_q_vector *q_vector) {}
static inline void fm10k_dbg_q_vector_exit(struct fm10k_q_vector *q_vector) {}
static inline void fm10k_dbg_intfc_init(struct fm10k_intfc *interface) {}
static inline void fm10k_dbg_intfc_exit(struct fm10k_intfc *interface) {}
static inline void fm10k_dbg_init(void) {}
static inline void fm10k_dbg_exit(void) {}
#endif /* CONFIG_DEBUG_FS */

/* DCB */
#ifdef CONFIG_DCB
void fm10k_dcbnl_set_ops(struct net_device *dev);
#else
static inline void fm10k_dcbnl_set_ops(struct net_device *dev) {}
#endif
#endif /* _FM10K_H_ */