linux/drivers/net/ethernet/freescale/enetc/enetc.h

/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
/* Copyright 2017-2019 NXP */

#include <linux/timer.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/dma-mapping.h>
#include <linux/skbuff.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
#include <linux/phylink.h>
#include <linux/dim.h>
#include <net/xdp.h>

#include "enetc_hw.h"

#define ENETC_MAC_MAXFRM_SIZE
#define ENETC_MAX_MTU

#define ENETC_CBD_DATA_MEM_ALIGN

struct enetc_tx_swbd {};

#define ENETC_RX_MAXFRM_SIZE
#define ENETC_RXB_TRUESIZE
#define ENETC_RXB_PAD
#define ENETC_RXB_DMA_SIZE
#define ENETC_RXB_DMA_SIZE_XDP

struct enetc_rx_swbd {};

/* ENETC overhead: optional extension BD + 1 BD gap */
#define ENETC_TXBDS_NEEDED(val)
/* max # of chained Tx BDs is 15, including head and extension BD */
#define ENETC_MAX_SKB_FRAGS
#define ENETC_TXBDS_MAX_NEEDED

struct enetc_ring_stats {};

struct enetc_xdp_data {};

#define ENETC_RX_RING_DEFAULT_SIZE
#define ENETC_TX_RING_DEFAULT_SIZE
#define ENETC_DEFAULT_TX_WORK

struct enetc_bdr_resource {};

struct enetc_bdr {} ____cacheline_aligned_in_smp;

static inline void enetc_bdr_idx_inc(struct enetc_bdr *bdr, int *i)
{}

static inline int enetc_bd_unused(struct enetc_bdr *bdr)
{}

static inline int enetc_swbd_unused(struct enetc_bdr *bdr)
{}

/* Control BD ring */
#define ENETC_CBDR_DEFAULT_SIZE
struct enetc_cbdr {};

#define ENETC_TXBD(BDR, i)

static inline union enetc_rx_bd *enetc_rxbd(struct enetc_bdr *rx_ring, int i)
{}

static inline void enetc_rxbd_next(struct enetc_bdr *rx_ring,
				   union enetc_rx_bd **old_rxbd, int *old_index)
{}

static inline union enetc_rx_bd *enetc_rxbd_ext(union enetc_rx_bd *rxbd)
{}

struct enetc_msg_swbd {};

#define ENETC_REV1
enum enetc_errata {};

#define ENETC_SI_F_PSFP
#define ENETC_SI_F_QBV
#define ENETC_SI_F_QBU

/* PCI IEP device data */
struct enetc_si {};

#define ENETC_SI_ALIGN

static inline void *enetc_si_priv(const struct enetc_si *si)
{}

static inline bool enetc_si_is_pf(struct enetc_si *si)
{}

static inline int enetc_pf_to_port(struct pci_dev *pf_pdev)
{}

#define ENETC_MAX_NUM_TXQS
#define ENETC_INT_NAME_MAX

struct enetc_int_vector {} ____cacheline_aligned_in_smp;

struct enetc_cls_rule {};

#define ENETC_MAX_BDR_INT
struct psfp_cap {};

#define ENETC_F_TX_TSTAMP_MASK
enum enetc_active_offloads {};

enum enetc_flags_bit {};

/* interrupt coalescing modes */
enum enetc_ic_mode {};

#define ENETC_RXIC_PKTTHR
#define ENETC_TXIC_PKTTHR
#define ENETC_TXIC_TIMETHR

struct enetc_ndev_priv {};

/* Messaging */

/* VF-PF set primary MAC address message format */
struct enetc_msg_cmd_set_primary_mac {};

#define ENETC_CBD(R, i)

#define ENETC_CBDR_TIMEOUT

/* PTP driver exports */
extern int enetc_phc_index;

/* SI common */
u32 enetc_port_mac_rd(struct enetc_si *si, u32 reg);
void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val);
int enetc_pci_probe(struct pci_dev *pdev, const char *name, int sizeof_priv);
void enetc_pci_remove(struct pci_dev *pdev);
int enetc_alloc_msix(struct enetc_ndev_priv *priv);
void enetc_free_msix(struct enetc_ndev_priv *priv);
void enetc_get_si_caps(struct enetc_si *si);
void enetc_init_si_rings_params(struct enetc_ndev_priv *priv);
int enetc_alloc_si_resources(struct enetc_ndev_priv *priv);
void enetc_free_si_resources(struct enetc_ndev_priv *priv);
int enetc_configure_si(struct enetc_ndev_priv *priv);

int enetc_open(struct net_device *ndev);
int enetc_close(struct net_device *ndev);
void enetc_start(struct net_device *ndev);
void enetc_stop(struct net_device *ndev);
netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev);
struct net_device_stats *enetc_get_stats(struct net_device *ndev);
void enetc_set_features(struct net_device *ndev, netdev_features_t features);
int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd);
int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data);
void enetc_reset_tc_mqprio(struct net_device *ndev);
int enetc_setup_bpf(struct net_device *ndev, struct netdev_bpf *bpf);
int enetc_xdp_xmit(struct net_device *ndev, int num_frames,
		   struct xdp_frame **frames, u32 flags);

/* ethtool */
void enetc_set_ethtool_ops(struct net_device *ndev);
void enetc_mm_link_state_update(struct enetc_ndev_priv *priv, bool link);
void enetc_mm_commit_preemptible_tcs(struct enetc_ndev_priv *priv);

/* control buffer descriptor ring (CBDR) */
int enetc_setup_cbdr(struct device *dev, struct enetc_hw *hw, int bd_count,
		     struct enetc_cbdr *cbdr);
void enetc_teardown_cbdr(struct enetc_cbdr *cbdr);
int enetc_set_mac_flt_entry(struct enetc_si *si, int index,
			    char *mac_addr, int si_map);
int enetc_clear_mac_flt_entry(struct enetc_si *si, int index);
int enetc_set_fs_entry(struct enetc_si *si, struct enetc_cmd_rfse *rfse,
		       int index);
void enetc_set_rss_key(struct enetc_hw *hw, const u8 *bytes);
int enetc_get_rss_table(struct enetc_si *si, u32 *table, int count);
int enetc_set_rss_table(struct enetc_si *si, const u32 *table, int count);
int enetc_send_cmd(struct enetc_si *si, struct enetc_cbd *cbd);

static inline void *enetc_cbd_alloc_data_mem(struct enetc_si *si,
					     struct enetc_cbd *cbd,
					     int size, dma_addr_t *dma,
					     void **data_align)
{}

static inline void enetc_cbd_free_data_mem(struct enetc_si *si, int size,
					   void *data, dma_addr_t *dma)
{}

void enetc_reset_ptcmsdur(struct enetc_hw *hw);
void enetc_set_ptcmsdur(struct enetc_hw *hw, u32 *queue_max_sdu);

#ifdef CONFIG_FSL_ENETC_QOS
int enetc_qos_query_caps(struct net_device *ndev, void *type_data);
int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data);
void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed);
int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data);
int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data);
int enetc_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
			    void *cb_priv);
int enetc_setup_tc_psfp(struct net_device *ndev, void *type_data);
int enetc_psfp_init(struct enetc_ndev_priv *priv);
int enetc_psfp_clean(struct enetc_ndev_priv *priv);
int enetc_set_psfp(struct net_device *ndev, bool en);

static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv)
{}

static inline int enetc_psfp_enable(struct enetc_ndev_priv *priv)
{}

static inline int enetc_psfp_disable(struct enetc_ndev_priv *priv)
{}

#else
#define enetc_qos_query_caps
#define enetc_setup_tc_taprio
#define enetc_sched_speed_set
#define enetc_setup_tc_cbs
#define enetc_setup_tc_txtime
#define enetc_setup_tc_psfp
#define enetc_setup_tc_block_cb

#define enetc_get_max_cap

static inline int enetc_psfp_enable(struct enetc_ndev_priv *priv)
{
	return 0;
}

static inline int enetc_psfp_disable(struct enetc_ndev_priv *priv)
{
	return 0;
}

static inline int enetc_set_psfp(struct net_device *ndev, bool en)
{
	return 0;
}
#endif