forked from luck/tmp_suning_uos_patched
ice: Implement virtchnl commands for AVF support
virtchnl is a protocol/interface specification that allows the Intel "Adaptive Virtual Function (AVF)" driver (iavf.ko) to work with more than one physical function driver. The AVF driver sends "virtchnl commands" (control plane only) to the PF driver over mailbox queues and the PF driver executes these commands and returns a result to the VF, again over mailbox. This patch adds AVF support for the ice PF driver by implementing the following virtchnl commands: VIRTCHNL_OP_VERSION VIRTCHNL_OP_GET_VF_RESOURCES VIRTCHNL_OP_RESET_VF VIRTCHNL_OP_ADD_ETH_ADDR VIRTCHNL_OP_DEL_ETH_ADDR VIRTCHNL_OP_CONFIG_VSI_QUEUES VIRTCHNL_OP_ENABLE_QUEUES VIRTCHNL_OP_DISABLE_QUEUES VIRTCHNL_OP_ADD_ETH_ADDR VIRTCHNL_OP_DEL_ETH_ADDR VIRTCHNL_OP_CONFIG_VSI_QUEUES VIRTCHNL_OP_ENABLE_QUEUES VIRTCHNL_OP_DISABLE_QUEUES VIRTCHNL_OP_REQUEST_QUEUES VIRTCHNL_OP_CONFIG_IRQ_MAP VIRTCHNL_OP_CONFIG_RSS_KEY VIRTCHNL_OP_CONFIG_RSS_LUT VIRTCHNL_OP_GET_STATS VIRTCHNL_OP_ADD_VLAN VIRTCHNL_OP_DEL_VLAN VIRTCHNL_OP_ENABLE_VLAN_STRIPPING VIRTCHNL_OP_DISABLE_VLAN_STRIPPING Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
7c710869d6
commit
1071a8358a
|
@ -71,6 +71,7 @@ extern const char ice_drv_ver[];
|
|||
#define ICE_MAX_QS_PER_VF 256
|
||||
#define ICE_MIN_QS_PER_VF 1
|
||||
#define ICE_DFLT_QS_PER_VF 4
|
||||
#define ICE_MAX_BASE_QS_PER_VF 16
|
||||
#define ICE_MAX_INTR_PER_VF 65
|
||||
#define ICE_MIN_INTR_PER_VF (ICE_MIN_QS_PER_VF + 1)
|
||||
#define ICE_DFLT_INTR_PER_VF (ICE_DFLT_QS_PER_VF + 1)
|
||||
|
|
|
@ -1446,6 +1446,7 @@ enum ice_adminq_opc {
|
|||
ice_aqc_opc_nvm_read = 0x0701,
|
||||
|
||||
/* PF/VF mailbox commands */
|
||||
ice_mbx_opc_send_msg_to_pf = 0x0801,
|
||||
ice_mbx_opc_send_msg_to_vf = 0x0802,
|
||||
|
||||
/* RSS commands */
|
||||
|
|
|
@ -800,6 +800,9 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)
|
|||
dev_err(&pf->pdev->dev,
|
||||
"Could not handle link event\n");
|
||||
break;
|
||||
case ice_mbx_opc_send_msg_to_pf:
|
||||
ice_vc_process_vf_msg(pf, &event);
|
||||
break;
|
||||
case ice_aqc_opc_fw_logging:
|
||||
ice_output_fw_log(hw, &event.desc, event.msg_buf);
|
||||
break;
|
||||
|
|
|
@ -187,6 +187,7 @@ ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
|
|||
if (!vsi_ctx->alloc_from_pool)
|
||||
cmd->vsi_num = cpu_to_le16(vsi_ctx->vsi_num |
|
||||
ICE_AQ_VSI_IS_VALID);
|
||||
cmd->vf_id = vsi_ctx->vf_num;
|
||||
|
||||
cmd->vsi_flags = cpu_to_le16(vsi_ctx->flags);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,6 +9,11 @@
|
|||
#define ICE_VLAN_PRIORITY_S 12
|
||||
#define ICE_VLAN_M 0xFFF
|
||||
#define ICE_PRIORITY_M 0x7000
|
||||
#define ICE_MAX_VLAN_PER_VF 8 /* restriction for non-trusted VF */
|
||||
|
||||
/* Restrict number of MACs a non-trusted VF can program */
|
||||
#define ICE_MAX_MACADDR_PER_VF 12
|
||||
#define ICE_DFLT_NUM_INVAL_MSGS_ALLOWED 10
|
||||
|
||||
/* Static VF transaction/status register def */
|
||||
#define VF_DEVICE_STATUS 0xAA
|
||||
|
@ -44,12 +49,15 @@ struct ice_vf {
|
|||
u32 driver_caps; /* reported by VF driver */
|
||||
int first_vector_idx; /* first vector index of this VF */
|
||||
struct ice_sw *vf_sw_id; /* switch id the VF VSIs connect to */
|
||||
struct virtchnl_version_info vf_ver;
|
||||
struct virtchnl_ether_addr dflt_lan_addr;
|
||||
u16 port_vlan_id;
|
||||
u8 pf_set_mac; /* VF MAC address set by VMM admin */
|
||||
u8 trusted;
|
||||
u16 lan_vsi_idx; /* index into PF struct */
|
||||
u16 lan_vsi_num; /* ID as used by firmware */
|
||||
u64 num_inval_msgs; /* number of continuous invalid msgs */
|
||||
u64 num_valid_msgs; /* number of valid msgs detected */
|
||||
unsigned long vf_caps; /* vf's adv. capabilities */
|
||||
DECLARE_BITMAP(vf_states, ICE_VF_STATES_NBITS); /* VF runtime states */
|
||||
unsigned int tx_rate; /* Tx bandwidth limit in Mbps */
|
||||
|
@ -58,6 +66,7 @@ struct ice_vf {
|
|||
u8 spoofchk;
|
||||
u16 num_mac;
|
||||
u16 num_vlan;
|
||||
u8 num_req_qs; /* num of queue pairs requested by VF */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PCI_IOV
|
||||
|
@ -68,6 +77,7 @@ int ice_get_vf_cfg(struct net_device *netdev, int vf_id,
|
|||
struct ifla_vf_info *ivi);
|
||||
|
||||
void ice_free_vfs(struct ice_pf *pf);
|
||||
void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event);
|
||||
void ice_vc_notify_reset(struct ice_pf *pf);
|
||||
bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr);
|
||||
|
||||
|
@ -85,6 +95,7 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena);
|
|||
#else /* CONFIG_PCI_IOV */
|
||||
#define ice_process_vflr_event(pf) do {} while (0)
|
||||
#define ice_free_vfs(pf) do {} while (0)
|
||||
#define ice_vc_process_vf_msg(pf, event) do {} while (0)
|
||||
#define ice_vc_notify_reset(pf) do {} while (0)
|
||||
static inline bool
|
||||
ice_reset_all_vfs(struct ice_pf __always_unused *pf,
|
||||
|
|
Loading…
Reference in New Issue
Block a user