#ifndef _MLX4_EN_H_
#define _MLX4_EN_H_
#include <linux/bitops.h>
#include <linux/compiler.h>
#include <linux/ethtool.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/if_vlan.h>
#include <linux/net_tstamp.h>
#ifdef CONFIG_MLX4_EN_DCB
#include <linux/dcbnl.h>
#endif
#include <linux/cpu_rmap.h>
#include <linux/ptp_clock_kernel.h>
#include <linux/irq.h>
#include <net/xdp.h>
#include <linux/notifier.h>
#include <linux/mlx4/device.h>
#include <linux/mlx4/qp.h>
#include <linux/mlx4/cq.h>
#include <linux/mlx4/srq.h>
#include <linux/mlx4/doorbell.h>
#include <linux/mlx4/cmd.h>
#include "en_port.h"
#include "mlx4_stats.h"
#define DRV_NAME …
#define DRV_VERSION …
#define MLX4_EN_MSG_LEVEL …
#define MLX4_EN_PAGE_SHIFT …
#define MLX4_EN_PAGE_SIZE …
#define DEF_RX_RINGS …
#define MAX_RX_RINGS …
#define MIN_RX_RINGS …
#define LOG_TXBB_SIZE …
#define TXBB_SIZE …
#define HEADROOM …
#define STAMP_STRIDE …
#define STAMP_DWORDS …
#define STAMP_SHIFT …
#define STAMP_VAL …
#define STATS_DELAY …
#define SERVICE_TASK_DELAY …
#define MAX_NUM_OF_FS_RULES …
#define MLX4_EN_FILTER_HASH_SHIFT …
#define MLX4_EN_FILTER_EXPIRY_QUOTA …
#define CTRL_SIZE …
#define DS_SIZE …
#define MLX4_TX_BOUNCE_BUFFER_SIZE …
#define MLX4_MAX_DESC_TXBBS …
#define MLX4_EN_PRIV_FLAGS_BLUEFLAME …
#define MLX4_EN_PRIV_FLAGS_PHV …
#define MLX4_EN_WATCHDOG_TIMEOUT …
#define MLX4_EN_ALLOC_SIZE …
#define MLX4_EN_MAX_RX_FRAGS …
#define MLX4_EN_MAX_TX_SIZE …
#define MLX4_EN_MAX_RX_SIZE …
#define MLX4_EN_MIN_RX_SIZE …
#define MLX4_EN_MIN_TX_SIZE …
#define MLX4_EN_SMALL_PKT_SIZE …
#define MLX4_EN_MIN_TX_RING_P_UP …
#define MLX4_EN_MAX_TX_RING_P_UP …
#define MLX4_EN_NUM_UP_LOW …
#define MLX4_EN_NUM_UP_HIGH …
#define MLX4_EN_DEF_RX_RING_SIZE …
#define MLX4_EN_DEF_TX_RING_SIZE …
#define MAX_TX_RINGS …
#define MLX4_EN_DEFAULT_TX_WORK …
#define MLX4_EN_RX_COAL_TARGET …
#define MLX4_EN_RX_COAL_TIME …
#define MLX4_EN_TX_COAL_PKTS …
#define MLX4_EN_TX_COAL_TIME …
#define MLX4_EN_MAX_COAL_PKTS …
#define MLX4_EN_MAX_COAL_TIME …
#define MLX4_EN_RX_RATE_LOW …
#define MLX4_EN_RX_COAL_TIME_LOW …
#define MLX4_EN_RX_RATE_HIGH …
#define MLX4_EN_RX_COAL_TIME_HIGH …
#define MLX4_EN_RX_SIZE_THRESH …
#define MLX4_EN_RX_RATE_THRESH …
#define MLX4_EN_SAMPLE_INTERVAL …
#define MLX4_EN_AVG_PKT_SMALL …
#define MLX4_EN_AUTO_CONF …
#define MLX4_EN_DEF_RX_PAUSE …
#define MLX4_EN_DEF_TX_PAUSE …
#define MLX4_EN_TX_POLL_MODER …
#define MLX4_EN_TX_POLL_TIMEOUT …
#define SMALL_PACKET_SIZE …
#define HEADER_COPY_SIZE …
#define MLX4_LOOPBACK_TEST_PAYLOAD …
#define PREAMBLE_LEN …
#define MLX4_SELFTEST_LB_MIN_MTU …
#define MLX4_EN_EFF_MTU(mtu) …
#define ETH_BCAST …
#define MLX4_EN_LOOPBACK_RETRIES …
#define MLX4_EN_LOOPBACK_TIMEOUT …
enum { … };
enum cq_type { … };
#define ROUNDUP_LOG2(x) …
#define XNOR(x, y) …
struct mlx4_en_tx_info { … } ____cacheline_aligned_in_smp;
#define MLX4_EN_BIT_DESC_OWN …
#define MLX4_EN_MEMTYPE_PAD …
struct mlx4_en_tx_desc { … };
#define MLX4_EN_USE_SRQ …
#define MLX4_EN_CX3_LOW_ID …
#define MLX4_EN_CX3_HIGH_ID …
struct mlx4_en_rx_alloc { … };
#define MLX4_EN_CACHE_SIZE …
struct mlx4_en_page_cache { … };
enum { … };
struct mlx4_en_priv;
struct mlx4_en_tx_ring { … } ____cacheline_aligned_in_smp;
struct mlx4_en_rx_desc { … };
struct mlx4_en_rx_ring { … };
struct mlx4_en_cq { … };
struct mlx4_en_port_profile { … };
struct mlx4_en_profile { … };
struct mlx4_en_dev { … };
struct mlx4_en_rss_map { … };
enum mlx4_en_port_flag { … };
struct mlx4_en_port_state { … };
enum mlx4_en_mclist_act { … };
struct mlx4_en_mc_list { … };
struct mlx4_en_frag_info { … };
#ifdef CONFIG_MLX4_EN_DCB
#define MLX4_EN_BW_MIN …
#define MLX4_EN_BW_MAX …
#define MLX4_EN_TC_VENDOR …
#define MLX4_EN_TC_ETS …
enum dcb_pfc_type { … };
struct mlx4_en_cee_config { … };
#endif
struct ethtool_flow_id { … };
enum { … };
#define PORT_BEACON_MAX_LIMIT …
#define MLX4_EN_MAC_HASH_SIZE …
#define MLX4_EN_MAC_HASH_IDX …
struct mlx4_en_stats_bitmap { … };
enum { … };
struct mlx4_en_priv { … };
enum mlx4_en_wol { … };
struct mlx4_mac_entry { … };
static inline struct mlx4_cqe *mlx4_en_get_cqe(void *buf, int idx, int cqe_sz)
{ … }
#define MLX4_EN_WOL_DO_MODIFY …
void mlx4_en_init_ptys2ethtool_map(void);
void mlx4_en_update_loopback_state(struct net_device *dev,
netdev_features_t features);
void mlx4_en_destroy_netdev(struct net_device *dev);
int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
struct mlx4_en_port_profile *prof);
int mlx4_en_start_port(struct net_device *dev);
void mlx4_en_stop_port(struct net_device *dev, int detach);
void mlx4_en_set_stats_bitmap(struct mlx4_dev *dev,
struct mlx4_en_stats_bitmap *stats_bitmap,
u8 rx_ppp, u8 rx_pause,
u8 tx_ppp, u8 tx_pause);
int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv,
struct mlx4_en_priv *tmp,
struct mlx4_en_port_profile *prof,
bool carry_xdp_prog);
void mlx4_en_safe_replace_resources(struct mlx4_en_priv *priv,
struct mlx4_en_priv *tmp);
int mlx4_en_create_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq,
int entries, int ring, enum cq_type mode, int node);
void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq);
int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
int cq_idx);
void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
int mlx4_en_set_cq_moder(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
void mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
void mlx4_en_tx_irq(struct mlx4_cq *mcq);
u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb,
struct net_device *sb_dev);
netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev);
netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_ring *rx_ring,
struct mlx4_en_rx_alloc *frame,
struct mlx4_en_priv *priv, unsigned int length,
int tx_ind, bool *doorbell_pending);
void mlx4_en_xmit_doorbell(struct mlx4_en_tx_ring *ring);
bool mlx4_en_rx_recycle(struct mlx4_en_rx_ring *ring,
struct mlx4_en_rx_alloc *frame);
int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring **pring,
u32 size, u16 stride,
int node, int queue_index);
void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring **pring);
void mlx4_en_init_tx_xdp_ring_descs(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring *ring);
int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring *ring,
int cq, int user_prio);
void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring *ring);
void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev);
void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv);
int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
struct mlx4_en_rx_ring **pring,
u32 size, u16 stride, int node, int queue_index);
void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
struct mlx4_en_rx_ring **pring,
u32 size, u16 stride);
int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv);
void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,
struct mlx4_en_rx_ring *ring);
int mlx4_en_process_rx_cq(struct net_device *dev,
struct mlx4_en_cq *cq,
int budget);
int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget);
int mlx4_en_poll_tx_cq(struct napi_struct *napi, int budget);
int mlx4_en_process_tx_cq(struct net_device *dev,
struct mlx4_en_cq *cq, int napi_budget);
u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring *ring,
int index, u64 timestamp,
int napi_mode);
u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv,
struct mlx4_en_tx_ring *ring,
int index, u64 timestamp,
int napi_mode);
void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
int is_tx, int rss, int qpn, int cqn, int user_prio,
struct mlx4_qp_context *context);
void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event);
int mlx4_en_change_mcast_lb(struct mlx4_en_priv *priv, struct mlx4_qp *qp,
int loopback);
void mlx4_en_calc_rx_buf(struct net_device *dev);
int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv);
void mlx4_en_release_rss_steer(struct mlx4_en_priv *priv);
int mlx4_en_create_drop_qp(struct mlx4_en_priv *priv);
void mlx4_en_destroy_drop_qp(struct mlx4_en_priv *priv);
int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring);
void mlx4_en_rx_irq(struct mlx4_cq *mcq);
int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv);
void mlx4_en_fold_software_stats(struct net_device *dev);
int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset);
int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port);
#ifdef CONFIG_MLX4_EN_DCB
extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops;
extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_pfc_ops;
#endif
int mlx4_en_setup_tc(struct net_device *dev, u8 up);
int mlx4_en_alloc_tx_queue_per_tc(struct net_device *dev, u8 tc);
#ifdef CONFIG_RFS_ACCEL
void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv);
#endif
#define MLX4_EN_NUM_SELF_TEST …
void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf);
void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev);
#define DEV_FEATURE_CHANGED(dev, new_features, feature) …
int mlx4_en_moderation_update(struct mlx4_en_priv *priv);
int mlx4_en_reset_config(struct net_device *dev,
struct hwtstamp_config ts_config,
netdev_features_t new_features);
void mlx4_en_update_pfc_stats_bitmap(struct mlx4_dev *dev,
struct mlx4_en_stats_bitmap *stats_bitmap,
u8 rx_ppp, u8 rx_pause,
u8 tx_ppp, u8 tx_pause);
int mlx4_en_netdev_event(struct notifier_block *this,
unsigned long event, void *ptr);
struct xdp_md;
int mlx4_en_xdp_rx_timestamp(const struct xdp_md *ctx, u64 *timestamp);
int mlx4_en_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash,
enum xdp_rss_hash_type *rss_type);
u64 mlx4_en_get_cqe_ts(struct mlx4_cqe *cqe);
u64 mlx4_en_get_hwtstamp(struct mlx4_en_dev *mdev, u64 timestamp);
void mlx4_en_fill_hwtstamps(struct mlx4_en_dev *mdev,
struct skb_shared_hwtstamps *hwts,
u64 timestamp);
void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev);
void mlx4_en_remove_timestamp(struct mlx4_en_dev *mdev);
extern const struct ethtool_ops mlx4_en_ethtool_ops;
__printf(3, 4)
void en_print(const char *level, const struct mlx4_en_priv *priv,
const char *format, ...);
#define en_dbg(mlevel, priv, format, ...) …
#define en_warn(priv, format, ...) …
#define en_err(priv, format, ...) …
#define en_info(priv, format, ...) …
#define mlx4_err(mdev, format, ...) …
#define mlx4_info(mdev, format, ...) …
#define mlx4_warn(mdev, format, ...) …
#endif