#include <linux/etherdevice.h>
#include <linux/crc32.h>
#include <linux/vmalloc.h>
#include <linux/crash_dump.h>
#include <linux/qed/qed_iov_if.h>
#include "qed_cxt.h"
#include "qed_hsi.h"
#include "qed_iro_hsi.h"
#include "qed_hw.h"
#include "qed_init_ops.h"
#include "qed_int.h"
#include "qed_mcp.h"
#include "qed_reg_addr.h"
#include "qed_sp.h"
#include "qed_sriov.h"
#include "qed_vf.h"
static int qed_iov_bulletin_set_mac(struct qed_hwfn *p_hwfn, u8 *mac, int vfid);
static u16 qed_vf_from_entity_id(__le16 entity_id)
{ … }
static u8 qed_vf_calculate_legacy(struct qed_vf_info *p_vf)
{ … }
static int qed_sp_vf_start(struct qed_hwfn *p_hwfn, struct qed_vf_info *p_vf)
{ … }
static int qed_sp_vf_stop(struct qed_hwfn *p_hwfn,
u32 concrete_vfid, u16 opaque_vfid)
{ … }
bool qed_iov_is_valid_vfid(struct qed_hwfn *p_hwfn,
int rel_vf_id,
bool b_enabled_only, bool b_non_malicious)
{ … }
static struct qed_vf_info *qed_iov_get_vf_info(struct qed_hwfn *p_hwfn,
u16 relative_vf_id,
bool b_enabled_only)
{ … }
static struct qed_queue_cid *
qed_iov_get_vf_rx_queue_cid(struct qed_vf_queue *p_queue)
{ … }
enum qed_iov_validate_q_mode { … };
static bool qed_iov_validate_queue_mode(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf,
u16 qid,
enum qed_iov_validate_q_mode mode,
bool b_is_tx)
{ … }
static bool qed_iov_validate_rxq(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf,
u16 rx_qid,
enum qed_iov_validate_q_mode mode)
{ … }
static bool qed_iov_validate_txq(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf,
u16 tx_qid,
enum qed_iov_validate_q_mode mode)
{ … }
static bool qed_iov_validate_sb(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, u16 sb_idx)
{ … }
static bool qed_iov_validate_active_rxq(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf)
{ … }
static bool qed_iov_validate_active_txq(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf)
{ … }
static int qed_iov_post_vf_bulletin(struct qed_hwfn *p_hwfn,
int vfid, struct qed_ptt *p_ptt)
{ … }
static int qed_iov_pci_cfg_info(struct qed_dev *cdev)
{ … }
static void qed_iov_setup_vfdb(struct qed_hwfn *p_hwfn)
{ … }
static int qed_iov_allocate_vfdb(struct qed_hwfn *p_hwfn)
{ … }
static void qed_iov_free_vfdb(struct qed_hwfn *p_hwfn)
{ … }
int qed_iov_alloc(struct qed_hwfn *p_hwfn)
{ … }
void qed_iov_setup(struct qed_hwfn *p_hwfn)
{ … }
void qed_iov_free(struct qed_hwfn *p_hwfn)
{ … }
void qed_iov_free_hw_info(struct qed_dev *cdev)
{ … }
int qed_iov_hw_info(struct qed_hwfn *p_hwfn)
{ … }
static bool _qed_iov_pf_sanity_check(struct qed_hwfn *p_hwfn,
int vfid, bool b_fail_malicious)
{ … }
static bool qed_iov_pf_sanity_check(struct qed_hwfn *p_hwfn, int vfid)
{ … }
static void qed_iov_set_vf_to_disable(struct qed_dev *cdev,
u16 rel_vf_id, u8 to_disable)
{ … }
static void qed_iov_set_vfs_to_disable(struct qed_dev *cdev, u8 to_disable)
{ … }
static void qed_iov_vf_pglue_clear_err(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, u8 abs_vfid)
{ … }
static void qed_iov_vf_igu_reset(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, struct qed_vf_info *vf)
{ … }
static void qed_iov_vf_igu_set_int(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf, bool enable)
{ … }
static int
qed_iov_enable_vf_access_msix(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, u8 abs_vf_id, u8 num_sbs)
{ … }
static int qed_iov_enable_vf_access(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void qed_iov_config_perm_table(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf, u8 enable)
{ … }
static void qed_iov_enable_vf_traffic(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static u8 qed_iov_alloc_vf_igu_sbs(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf, u16 num_rx_queues)
{ … }
static void qed_iov_free_vf_igu_sbs(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void qed_iov_set_link(struct qed_hwfn *p_hwfn,
u16 vfid,
struct qed_mcp_link_params *params,
struct qed_mcp_link_state *link,
struct qed_mcp_link_capabilities *p_caps)
{ … }
static int qed_iov_init_hw_for_vf(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_iov_vf_init_params *p_params)
{ … }
static int qed_iov_release_hw_for_vf(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, u16 rel_vf_id)
{ … }
static bool qed_iov_tlv_supported(u16 tlvtype)
{ … }
void *qed_add_tlv(struct qed_hwfn *p_hwfn, u8 **offset, u16 type, u16 length)
{ … }
void qed_dp_tlv_list(struct qed_hwfn *p_hwfn, void *tlvs_list)
{ … }
static void qed_iov_send_response(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf,
u16 length, u8 status)
{ … }
static u16 qed_iov_vport_to_tlv(struct qed_hwfn *p_hwfn,
enum qed_iov_vport_update_flag flag)
{ … }
static u16 qed_iov_prep_vp_update_resp_tlvs(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf,
struct qed_iov_vf_mbx *p_mbx,
u8 status,
u16 tlvs_mask, u16 tlvs_accepted)
{ … }
static void qed_iov_prepare_resp(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf_info,
u16 type, u16 length, u8 status)
{ … }
static struct
qed_public_vf_info *qed_iov_get_public_vf_info(struct qed_hwfn *p_hwfn,
u16 relative_vf_id,
bool b_enabled_only)
{ … }
static void qed_iov_clean_vf(struct qed_hwfn *p_hwfn, u8 vfid)
{ … }
static void qed_iov_vf_cleanup(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf)
{ … }
static u32 qed_iov_vf_db_bar_size(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt)
{ … }
static void
qed_iov_vf_mbx_acquire_resc_cids(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf,
struct vf_pf_resc_request *p_req,
struct pf_vf_resc *p_resp)
{ … }
static u8 qed_iov_vf_mbx_acquire_resc(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf,
struct vf_pf_resc_request *p_req,
struct pf_vf_resc *p_resp)
{ … }
static void qed_iov_vf_mbx_acquire_stats(struct qed_hwfn *p_hwfn,
struct pfvf_stats_info *p_stats)
{ … }
static void qed_iov_vf_mbx_acquire(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static int __qed_iov_spoofchk_set(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, bool val)
{ … }
static int qed_iov_reconfigure_unicast_vlan(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf)
{ … }
static int
qed_iov_reconfigure_unicast_shadow(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, u64 events)
{ … }
static int qed_iov_configure_vport_forced(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, u64 events)
{ … }
static void qed_iov_vf_mbx_start_vport(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void qed_iov_vf_mbx_stop_vport(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void qed_iov_vf_mbx_start_rxq_resp(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf,
u8 status, bool b_legacy)
{ … }
static u8 qed_iov_vf_mbx_qid(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, bool b_is_tx)
{ … }
static void qed_iov_vf_mbx_start_rxq(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void
qed_iov_pf_update_tun_response(struct pfvf_update_tunn_param_tlv *p_resp,
struct qed_tunnel_info *p_tun,
u16 tunn_feature_mask)
{ … }
static void
__qed_iov_pf_update_tun_param(struct vfpf_update_tunn_param_tlv *p_req,
struct qed_tunn_update_type *p_tun,
enum qed_tunn_mode mask, u8 tun_cls)
{ … }
static void
qed_iov_pf_update_tun_param(struct vfpf_update_tunn_param_tlv *p_req,
struct qed_tunn_update_type *p_tun,
struct qed_tunn_update_udp_port *p_port,
enum qed_tunn_mode mask,
u8 tun_cls, u8 update_port, u16 port)
{ … }
static bool
qed_iov_pf_validate_tunn_param(struct vfpf_update_tunn_param_tlv *p_req)
{ … }
static void qed_pf_validate_tunn_mode(struct qed_tunn_update_type *tun, int *rc)
{ … }
static int
qed_pf_validate_modify_tunn_config(struct qed_hwfn *p_hwfn,
u16 *tun_features, bool *update,
struct qed_tunnel_info *tun_src)
{ … }
static void qed_iov_vf_mbx_update_tunn_param(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf)
{ … }
static void qed_iov_vf_mbx_start_txq_resp(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf,
u32 cid, u8 status)
{ … }
static void qed_iov_vf_mbx_start_txq(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static int qed_iov_vf_stop_rxqs(struct qed_hwfn *p_hwfn,
struct qed_vf_info *vf,
u16 rxq_id,
u8 qid_usage_idx, bool cqe_completion)
{ … }
static int qed_iov_vf_stop_txqs(struct qed_hwfn *p_hwfn,
struct qed_vf_info *vf,
u16 txq_id, u8 qid_usage_idx)
{ … }
static void qed_iov_vf_mbx_stop_rxqs(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void qed_iov_vf_mbx_stop_txqs(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void qed_iov_vf_mbx_update_rxqs(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
void *qed_iov_search_list_tlvs(struct qed_hwfn *p_hwfn,
void *p_tlvs_list, u16 req_type)
{ … }
static void
qed_iov_vp_update_act_param(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_update_params *p_data,
struct qed_iov_vf_mbx *p_mbx, u16 *tlvs_mask)
{ … }
static void
qed_iov_vp_update_vlan_param(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_update_params *p_data,
struct qed_vf_info *p_vf,
struct qed_iov_vf_mbx *p_mbx, u16 *tlvs_mask)
{ … }
static void
qed_iov_vp_update_tx_switch(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_update_params *p_data,
struct qed_iov_vf_mbx *p_mbx, u16 *tlvs_mask)
{ … }
static void
qed_iov_vp_update_mcast_bin_param(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_update_params *p_data,
struct qed_iov_vf_mbx *p_mbx, u16 *tlvs_mask)
{ … }
static void
qed_iov_vp_update_accept_flag(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_update_params *p_data,
struct qed_iov_vf_mbx *p_mbx, u16 *tlvs_mask)
{ … }
static void
qed_iov_vp_update_accept_any_vlan(struct qed_hwfn *p_hwfn,
struct qed_sp_vport_update_params *p_data,
struct qed_iov_vf_mbx *p_mbx, u16 *tlvs_mask)
{ … }
static void
qed_iov_vp_update_rss_param(struct qed_hwfn *p_hwfn,
struct qed_vf_info *vf,
struct qed_sp_vport_update_params *p_data,
struct qed_rss_params *p_rss,
struct qed_iov_vf_mbx *p_mbx,
u16 *tlvs_mask, u16 *tlvs_accepted)
{ … }
static void
qed_iov_vp_update_sge_tpa_param(struct qed_hwfn *p_hwfn,
struct qed_vf_info *vf,
struct qed_sp_vport_update_params *p_data,
struct qed_sge_tpa_params *p_sge_tpa,
struct qed_iov_vf_mbx *p_mbx, u16 *tlvs_mask)
{ … }
static int qed_iov_pre_update_vport(struct qed_hwfn *hwfn,
u8 vfid,
struct qed_sp_vport_update_params *params,
u16 *tlvs)
{ … }
static void qed_iov_vf_mbx_vport_update(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static int qed_iov_vf_update_vlan_shadow(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf,
struct qed_filter_ucast *p_params)
{ … }
static int qed_iov_vf_update_mac_shadow(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf,
struct qed_filter_ucast *p_params)
{ … }
static int
qed_iov_vf_update_unicast_shadow(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf,
struct qed_filter_ucast *p_params)
{ … }
static int qed_iov_chk_ucast(struct qed_hwfn *hwfn,
int vfid, struct qed_filter_ucast *params)
{ … }
static void qed_iov_vf_mbx_ucast_filter(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void qed_iov_vf_mbx_int_cleanup(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static void qed_iov_vf_mbx_close(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, struct qed_vf_info *vf)
{ … }
static void qed_iov_vf_mbx_release(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf)
{ … }
static void qed_iov_vf_pf_get_coalesce(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf)
{ … }
static void qed_iov_vf_pf_set_coalesce(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{ … }
static int
qed_iov_vf_flr_poll_dorq(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, struct qed_ptt *p_ptt)
{ … }
#define MAX_NUM_EXT_VOQS …
static int
qed_iov_vf_flr_poll_pbf(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, struct qed_ptt *p_ptt)
{ … }
static int qed_iov_vf_flr_poll(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, struct qed_ptt *p_ptt)
{ … }
static int
qed_iov_execute_vf_flr_cleanup(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
u16 rel_vf_id, u32 *ack_vfs)
{ … }
static int
qed_iov_vf_flr_cleanup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
{ … }
bool qed_iov_mark_vf_flr(struct qed_hwfn *p_hwfn, u32 *p_disabled_vfs)
{ … }
static int qed_iov_get_link(struct qed_hwfn *p_hwfn,
u16 vfid,
struct qed_mcp_link_params *p_params,
struct qed_mcp_link_state *p_link,
struct qed_mcp_link_capabilities *p_caps)
{ … }
static int
qed_iov_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf)
{ … }
static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, int vfid)
{ … }
static void qed_iov_pf_get_pending_events(struct qed_hwfn *p_hwfn, u64 *events)
{ … }
static struct qed_vf_info *qed_sriov_get_vf_from_absid(struct qed_hwfn *p_hwfn,
u16 abs_vfid)
{ … }
static int qed_sriov_vfpf_msg(struct qed_hwfn *p_hwfn,
u16 abs_vfid, struct regpair *vf_msg)
{ … }
void qed_sriov_vfpf_malicious(struct qed_hwfn *p_hwfn,
struct fw_err_data *p_data)
{ … }
int qed_sriov_eqe_event(struct qed_hwfn *p_hwfn, u8 opcode, __le16 echo,
union event_ring_data *data, u8 fw_return_code)
{ … }
u16 qed_iov_get_next_active_vf(struct qed_hwfn *p_hwfn, u16 rel_vf_id)
{ … }
static int qed_iov_copy_vf_msg(struct qed_hwfn *p_hwfn, struct qed_ptt *ptt,
int vfid)
{ … }
static void qed_iov_bulletin_set_forced_mac(struct qed_hwfn *p_hwfn,
u8 *mac, int vfid)
{ … }
static int qed_iov_bulletin_set_mac(struct qed_hwfn *p_hwfn, u8 *mac, int vfid)
{ … }
static void qed_iov_bulletin_set_forced_vlan(struct qed_hwfn *p_hwfn,
u16 pvid, int vfid)
{ … }
void qed_iov_bulletin_set_udp_ports(struct qed_hwfn *p_hwfn,
int vfid, u16 vxlan_port, u16 geneve_port)
{ … }
static bool qed_iov_vf_has_vport_instance(struct qed_hwfn *p_hwfn, int vfid)
{ … }
static bool qed_iov_is_vf_stopped(struct qed_hwfn *p_hwfn, int vfid)
{ … }
static bool qed_iov_spoofchk_get(struct qed_hwfn *p_hwfn, int vfid)
{ … }
static int qed_iov_spoofchk_set(struct qed_hwfn *p_hwfn, int vfid, bool val)
{ … }
static u8 *qed_iov_bulletin_get_mac(struct qed_hwfn *p_hwfn, u16 rel_vf_id)
{ … }
static u8 *qed_iov_bulletin_get_forced_mac(struct qed_hwfn *p_hwfn,
u16 rel_vf_id)
{ … }
static u16
qed_iov_bulletin_get_forced_vlan(struct qed_hwfn *p_hwfn, u16 rel_vf_id)
{ … }
static int qed_iov_configure_tx_rate(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, int vfid, int val)
{ … }
static int
qed_iov_configure_min_tx_rate(struct qed_dev *cdev, int vfid, u32 rate)
{ … }
static int qed_iov_get_vf_min_rate(struct qed_hwfn *p_hwfn, int vfid)
{ … }
void qed_schedule_iov(struct qed_hwfn *hwfn, enum qed_iov_wq_flag flag)
{ … }
void qed_vf_start_iov_wq(struct qed_dev *cdev)
{ … }
int qed_sriov_disable(struct qed_dev *cdev, bool pci_enabled)
{ … }
static void qed_sriov_enable_qid_config(struct qed_hwfn *hwfn,
u16 vfid,
struct qed_iov_vf_init_params *params)
{ … }
static int qed_sriov_enable(struct qed_dev *cdev, int num)
{ … }
static int qed_sriov_configure(struct qed_dev *cdev, int num_vfs_param)
{ … }
static int qed_sriov_pf_set_mac(struct qed_dev *cdev, u8 *mac, int vfid)
{ … }
static int qed_sriov_pf_set_vlan(struct qed_dev *cdev, u16 vid, int vfid)
{ … }
static int qed_get_vf_config(struct qed_dev *cdev,
int vf_id, struct ifla_vf_info *ivi)
{ … }
void qed_inform_vf_link_state(struct qed_hwfn *hwfn)
{ … }
static int qed_set_vf_link_state(struct qed_dev *cdev,
int vf_id, int link_state)
{ … }
static int qed_spoof_configure(struct qed_dev *cdev, int vfid, bool val)
{ … }
static int qed_configure_max_vf_rate(struct qed_dev *cdev, int vfid, int rate)
{ … }
static int qed_set_vf_rate(struct qed_dev *cdev,
int vfid, u32 min_rate, u32 max_rate)
{ … }
static int qed_set_vf_trust(struct qed_dev *cdev, int vfid, bool trust)
{ … }
static void qed_handle_vf_msg(struct qed_hwfn *hwfn)
{ … }
static bool qed_pf_validate_req_vf_mac(struct qed_hwfn *hwfn,
u8 *mac,
struct qed_public_vf_info *info)
{ … }
static void qed_set_bulletin_mac(struct qed_hwfn *hwfn,
struct qed_public_vf_info *info,
int vfid)
{ … }
static void qed_handle_pf_set_vf_unicast(struct qed_hwfn *hwfn)
{ … }
static void qed_handle_bulletin_post(struct qed_hwfn *hwfn)
{ … }
static void qed_update_mac_for_vf_trust_change(struct qed_hwfn *hwfn, int vf_id)
{ … }
static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn)
{ … }
static void qed_iov_pf_task(struct work_struct *work)
{ … }
void qed_iov_wq_stop(struct qed_dev *cdev, bool schedule_first)
{ … }
int qed_iov_wq_start(struct qed_dev *cdev)
{ … }
const struct qed_iov_hv_ops qed_iov_ops_pass = …;