#include <linux/types.h>
#include <asm/byteorder.h>
#include <asm/param.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/etherdevice.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <linux/bug.h>
#include <linux/vmalloc.h>
#include "qed.h"
#include <linux/qed/qed_chain.h>
#include "qed_cxt.h"
#include "qed_dcbx.h"
#include "qed_dev_api.h"
#include <linux/qed/qed_eth_if.h>
#include "qed_hsi.h"
#include "qed_iro_hsi.h"
#include "qed_hw.h"
#include "qed_int.h"
#include "qed_l2.h"
#include "qed_mcp.h"
#include "qed_ptp.h"
#include "qed_reg_addr.h"
#include "qed_sp.h"
#include "qed_sriov.h"
#define QED_MAX_SGES_NUM …
#define CRC32_POLY …
struct qed_l2_info { … };
int qed_l2_alloc(struct qed_hwfn *p_hwfn)
{ … }
void qed_l2_setup(struct qed_hwfn *p_hwfn)
{ … }
void qed_l2_free(struct qed_hwfn *p_hwfn)
{ … }
static bool qed_eth_queue_qid_usage_add(struct qed_hwfn *p_hwfn,
struct qed_queue_cid *p_cid)
{ … }
static void qed_eth_queue_qid_usage_del(struct qed_hwfn *p_hwfn,
struct qed_queue_cid *p_cid)
{ … }
void qed_eth_queue_cid_release(struct qed_hwfn *p_hwfn,
struct qed_queue_cid *p_cid)
{ … }
static struct qed_queue_cid *
_qed_eth_queue_to_cid(struct qed_hwfn *p_hwfn,
u16 opaque_fid,
u32 cid,
struct qed_queue_start_common_params *p_params,
bool b_is_rx,
struct qed_queue_cid_vf_params *p_vf_params)
{ … }
struct qed_queue_cid *
qed_eth_queue_to_cid(struct qed_hwfn *p_hwfn,
u16 opaque_fid,
struct qed_queue_start_common_params *p_params,
bool b_is_rx,
struct qed_queue_cid_vf_params *p_vf_params)
{ … }
static struct qed_queue_cid *
qed_eth_queue_to_cid_pf(struct qed_hwfn *p_hwfn,
u16 opaque_fid,
bool b_is_rx,
struct qed_queue_start_common_params *p_params)
{ … }
int qed_sp_eth_vport_start(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_start_params *p_params)
{ … }
static int qed_sp_vport_start(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_start_params *p_params)
{ … }
static int
qed_sp_vport_update_rss(struct qed_hwfn *p_hwfn,
struct vport_update_ramrod_data *p_ramrod,
struct qed_rss_params *p_rss)
{ … }
static void
qed_sp_update_accept_mode(struct qed_hwfn *p_hwfn,
struct vport_update_ramrod_data *p_ramrod,
struct qed_filter_accept_flags accept_flags)
{ … }
static void
qed_sp_vport_update_sge_tpa(struct qed_hwfn *p_hwfn,
struct vport_update_ramrod_data *p_ramrod,
const struct qed_sge_tpa_params *param)
{ … }
static void
qed_sp_update_mcast_bin(struct qed_hwfn *p_hwfn,
struct vport_update_ramrod_data *p_ramrod,
struct qed_sp_vport_update_params *p_params)
{ … }
int qed_sp_vport_update(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_update_params *p_params,
enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data)
{ … }
int qed_sp_vport_stop(struct qed_hwfn *p_hwfn, u16 opaque_fid, u8 vport_id)
{ … }
static int
qed_vf_pf_accept_flags(struct qed_hwfn *p_hwfn,
struct qed_filter_accept_flags *p_accept_flags)
{ … }
static int qed_filter_accept_cmd(struct qed_dev *cdev,
u8 vport,
struct qed_filter_accept_flags accept_flags,
u8 update_accept_any_vlan,
u8 accept_any_vlan,
enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data)
{ … }
int qed_eth_rxq_start_ramrod(struct qed_hwfn *p_hwfn,
struct qed_queue_cid *p_cid,
u16 bd_max_bytes,
dma_addr_t bd_chain_phys_addr,
dma_addr_t cqe_pbl_addr, u16 cqe_pbl_size)
{ … }
static int
qed_eth_pf_rx_queue_start(struct qed_hwfn *p_hwfn,
struct qed_queue_cid *p_cid,
u16 bd_max_bytes,
dma_addr_t bd_chain_phys_addr,
dma_addr_t cqe_pbl_addr,
u16 cqe_pbl_size, void __iomem **pp_prod)
{ … }
static int
qed_eth_rx_queue_start(struct qed_hwfn *p_hwfn,
u16 opaque_fid,
struct qed_queue_start_common_params *p_params,
u16 bd_max_bytes,
dma_addr_t bd_chain_phys_addr,
dma_addr_t cqe_pbl_addr,
u16 cqe_pbl_size,
struct qed_rxq_start_ret_params *p_ret_params)
{ … }
int qed_sp_eth_rx_queues_update(struct qed_hwfn *p_hwfn,
void **pp_rxq_handles,
u8 num_rxqs,
u8 complete_cqe_flg,
u8 complete_event_flg,
enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data)
{ … }
static int
qed_eth_pf_rx_queue_stop(struct qed_hwfn *p_hwfn,
struct qed_queue_cid *p_cid,
bool b_eq_completion_only, bool b_cqe_completion)
{ … }
int qed_eth_rx_queue_stop(struct qed_hwfn *p_hwfn,
void *p_rxq,
bool eq_completion_only, bool cqe_completion)
{ … }
int
qed_eth_txq_start_ramrod(struct qed_hwfn *p_hwfn,
struct qed_queue_cid *p_cid,
dma_addr_t pbl_addr, u16 pbl_size, u16 pq_id)
{ … }
static int
qed_eth_pf_tx_queue_start(struct qed_hwfn *p_hwfn,
struct qed_queue_cid *p_cid,
u8 tc,
dma_addr_t pbl_addr,
u16 pbl_size, void __iomem **pp_doorbell)
{ … }
static int
qed_eth_tx_queue_start(struct qed_hwfn *p_hwfn,
u16 opaque_fid,
struct qed_queue_start_common_params *p_params,
u8 tc,
dma_addr_t pbl_addr,
u16 pbl_size,
struct qed_txq_start_ret_params *p_ret_params)
{ … }
static int
qed_eth_pf_tx_queue_stop(struct qed_hwfn *p_hwfn, struct qed_queue_cid *p_cid)
{ … }
int qed_eth_tx_queue_stop(struct qed_hwfn *p_hwfn, void *p_handle)
{ … }
static enum eth_filter_action qed_filter_action(enum qed_filter_opcode opcode)
{ … }
static int
qed_filter_ucast_common(struct qed_hwfn *p_hwfn,
u16 opaque_fid,
struct qed_filter_ucast *p_filter_cmd,
struct vport_filter_update_ramrod_data **pp_ramrod,
struct qed_spq_entry **pp_ent,
enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data)
{ … }
int qed_sp_eth_filter_ucast(struct qed_hwfn *p_hwfn,
u16 opaque_fid,
struct qed_filter_ucast *p_filter_cmd,
enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data)
{ … }
static u32 qed_calc_crc32c(u8 *crc32_packet,
u32 crc32_length, u32 crc32_seed, u8 complement)
{ … }
static u32 qed_crc32c_le(u32 seed, u8 *mac, u32 len)
{ … }
u8 qed_mcast_bin_from_mac(u8 *mac)
{ … }
static int
qed_sp_eth_filter_mcast(struct qed_hwfn *p_hwfn,
u16 opaque_fid,
struct qed_filter_mcast *p_filter_cmd,
enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data)
{ … }
static int qed_filter_mcast_cmd(struct qed_dev *cdev,
struct qed_filter_mcast *p_filter_cmd,
enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data)
{ … }
static int qed_filter_ucast_cmd(struct qed_dev *cdev,
struct qed_filter_ucast *p_filter_cmd,
enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data)
{ … }
static void __qed_get_vport_pstats_addrlen(struct qed_hwfn *p_hwfn,
u32 *p_addr,
u32 *p_len, u16 statistics_bin)
{ … }
static noinline_for_stack void
__qed_get_vport_pstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
struct qed_eth_stats *p_stats, u16 statistics_bin)
{ … }
static noinline_for_stack void
__qed_get_vport_tstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
struct qed_eth_stats *p_stats, u16 statistics_bin)
{ … }
static void __qed_get_vport_ustats_addrlen(struct qed_hwfn *p_hwfn,
u32 *p_addr,
u32 *p_len, u16 statistics_bin)
{ … }
static noinline_for_stack
void __qed_get_vport_ustats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
struct qed_eth_stats *p_stats, u16 statistics_bin)
{ … }
static void __qed_get_vport_mstats_addrlen(struct qed_hwfn *p_hwfn,
u32 *p_addr,
u32 *p_len, u16 statistics_bin)
{ … }
static noinline_for_stack void
__qed_get_vport_mstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
struct qed_eth_stats *p_stats, u16 statistics_bin)
{ … }
static noinline_for_stack void
__qed_get_vport_port_stats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
struct qed_eth_stats *p_stats)
{ … }
static void __qed_get_vport_stats(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_eth_stats *stats,
u16 statistics_bin, bool b_get_port_stats)
{ … }
static void _qed_get_vport_stats(struct qed_dev *cdev,
struct qed_eth_stats *stats,
bool is_atomic)
{ … }
void qed_get_vport_stats(struct qed_dev *cdev, struct qed_eth_stats *stats)
{ … }
void qed_get_vport_stats_context(struct qed_dev *cdev,
struct qed_eth_stats *stats,
bool is_atomic)
{ … }
void qed_reset_vport_stats(struct qed_dev *cdev)
{ … }
static enum gft_profile_type
qed_arfs_mode_to_hsi(enum qed_filter_config_mode mode)
{ … }
void qed_arfs_mode_configure(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_arfs_config_params *p_cfg_params)
{ … }
int
qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn,
struct qed_spq_comp_cb *p_cb,
struct qed_ntuple_filter_params *p_params)
{ … }
int qed_get_rxq_coalesce(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_queue_cid *p_cid, u16 *p_rx_coal)
{ … }
int qed_get_txq_coalesce(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_queue_cid *p_cid, u16 *p_tx_coal)
{ … }
int qed_get_queue_coalesce(struct qed_hwfn *p_hwfn, u16 *p_coal, void *handle)
{ … }
static int qed_fill_eth_dev_info(struct qed_dev *cdev,
struct qed_dev_eth_info *info)
{ … }
static void qed_register_eth_ops(struct qed_dev *cdev,
struct qed_eth_cb_ops *ops, void *cookie)
{ … }
static bool qed_check_mac(struct qed_dev *cdev, u8 *mac)
{ … }
static int qed_start_vport(struct qed_dev *cdev,
struct qed_start_vport_params *params)
{ … }
static int qed_stop_vport(struct qed_dev *cdev, u8 vport_id)
{ … }
static int qed_update_vport_rss(struct qed_dev *cdev,
struct qed_update_vport_rss_params *input,
struct qed_rss_params *rss)
{ … }
static int qed_update_vport(struct qed_dev *cdev,
struct qed_update_vport_params *params)
{ … }
static int qed_start_rxq(struct qed_dev *cdev,
u8 rss_num,
struct qed_queue_start_common_params *p_params,
u16 bd_max_bytes,
dma_addr_t bd_chain_phys_addr,
dma_addr_t cqe_pbl_addr,
u16 cqe_pbl_size,
struct qed_rxq_start_ret_params *ret_params)
{ … }
static int qed_stop_rxq(struct qed_dev *cdev, u8 rss_id, void *handle)
{ … }
static int qed_start_txq(struct qed_dev *cdev,
u8 rss_num,
struct qed_queue_start_common_params *p_params,
dma_addr_t pbl_addr,
u16 pbl_size,
struct qed_txq_start_ret_params *ret_params)
{ … }
#define QED_HW_STOP_RETRY_LIMIT …
static int qed_fastpath_stop(struct qed_dev *cdev)
{ … }
static int qed_stop_txq(struct qed_dev *cdev, u8 rss_id, void *handle)
{ … }
static int qed_tunn_configure(struct qed_dev *cdev,
struct qed_tunn_params *tunn_params)
{ … }
static int qed_configure_filter_rx_mode(struct qed_dev *cdev,
enum qed_filter_rx_mode_type type)
{ … }
static int qed_configure_filter_ucast(struct qed_dev *cdev,
struct qed_filter_ucast_params *params)
{ … }
static int qed_configure_filter_mcast(struct qed_dev *cdev,
struct qed_filter_mcast_params *params)
{ … }
static int qed_configure_arfs_searcher(struct qed_dev *cdev,
enum qed_filter_config_mode mode)
{ … }
static void
qed_arfs_sp_response_handler(struct qed_hwfn *p_hwfn,
void *cookie,
union event_ring_data *data, u8 fw_return_code)
{ … }
static int
qed_ntuple_arfs_filter_config(struct qed_dev *cdev,
void *cookie,
struct qed_ntuple_filter_params *params)
{ … }
static int qed_get_coalesce(struct qed_dev *cdev, u16 *coal, void *handle)
{ … }
static int qed_fp_cqe_completion(struct qed_dev *dev,
u8 rss_id, struct eth_slow_path_rx_cqe *cqe)
{ … }
static int qed_req_bulletin_update_mac(struct qed_dev *cdev, const u8 *mac)
{ … }
static const struct qed_eth_ops qed_eth_ops_pass = …;
const struct qed_eth_ops *qed_get_eth_ops(void)
{ … }
EXPORT_SYMBOL(…);
void qed_put_eth_ops(void)
{ … }
EXPORT_SYMBOL(…);