0001
0002
0003
0004 #ifndef _I40E_VIRTCHNL_PF_H_
0005 #define _I40E_VIRTCHNL_PF_H_
0006
0007 #include "i40e.h"
0008
0009 #define I40E_MAX_VLANID 4095
0010
0011 #define I40E_VIRTCHNL_SUPPORTED_QTYPES 2
0012
0013 #define I40E_VLAN_PRIORITY_SHIFT 13
0014 #define I40E_VLAN_MASK 0xFFF
0015 #define I40E_PRIORITY_MASK 0xE000
0016
0017 #define I40E_MAX_VF_PROMISC_FLAGS 3
0018
0019 #define I40E_VF_STATE_WAIT_COUNT 20
0020 #define I40E_VFR_WAIT_COUNT 100
0021
0022
0023 enum i40e_queue_ctrl {
0024 I40E_QUEUE_CTRL_UNKNOWN = 0,
0025 I40E_QUEUE_CTRL_ENABLE,
0026 I40E_QUEUE_CTRL_ENABLECHECK,
0027 I40E_QUEUE_CTRL_DISABLE,
0028 I40E_QUEUE_CTRL_DISABLECHECK,
0029 I40E_QUEUE_CTRL_FASTDISABLE,
0030 I40E_QUEUE_CTRL_FASTDISABLECHECK,
0031 };
0032
0033
0034 enum i40e_vf_states {
0035 I40E_VF_STATE_INIT = 0,
0036 I40E_VF_STATE_ACTIVE,
0037 I40E_VF_STATE_IWARPENA,
0038 I40E_VF_STATE_DISABLED,
0039 I40E_VF_STATE_MC_PROMISC,
0040 I40E_VF_STATE_UC_PROMISC,
0041 I40E_VF_STATE_PRE_ENABLE,
0042 };
0043
0044
0045 enum i40e_vf_capabilities {
0046 I40E_VIRTCHNL_VF_CAP_PRIVILEGE = 0,
0047 I40E_VIRTCHNL_VF_CAP_L2,
0048 I40E_VIRTCHNL_VF_CAP_IWARP,
0049 };
0050
0051
0052
0053
0054
0055
0056
0057 struct i40evf_channel {
0058 u16 vsi_idx;
0059 u16 vsi_id;
0060 u16 num_qps;
0061 u64 max_tx_rate;
0062 };
0063
0064
0065 struct i40e_vf {
0066 struct i40e_pf *pf;
0067
0068
0069 s16 vf_id;
0070
0071 enum i40e_switch_element_types parent_type;
0072 struct virtchnl_version_info vf_ver;
0073 u32 driver_caps;
0074
0075
0076 u16 stag;
0077
0078 struct virtchnl_ether_addr default_lan_addr;
0079 u16 port_vlan_id;
0080 bool pf_set_mac;
0081 bool trusted;
0082
0083
0084
0085
0086
0087 u16 lan_vsi_idx;
0088 u16 lan_vsi_id;
0089
0090 u8 num_queue_pairs;
0091 u8 num_req_queues;
0092 u64 num_mdd_events;
0093
0094 unsigned long vf_caps;
0095 unsigned long vf_states;
0096 unsigned int tx_rate;
0097 bool link_forced;
0098 bool link_up;
0099 bool spoofchk;
0100 u16 num_vlan;
0101
0102
0103 bool adq_enabled;
0104 u8 num_tc;
0105 struct i40evf_channel ch[I40E_MAX_VF_VSI];
0106 struct hlist_head cloud_filter_list;
0107 u16 num_cloud_filters;
0108
0109
0110 struct virtchnl_iwarp_qvlist_info *qvlist_info;
0111 };
0112
0113 void i40e_free_vfs(struct i40e_pf *pf);
0114 int i40e_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
0115 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs);
0116 int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,
0117 u32 v_retval, u8 *msg, u16 msglen);
0118 int i40e_vc_process_vflr_event(struct i40e_pf *pf);
0119 bool i40e_reset_vf(struct i40e_vf *vf, bool flr);
0120 bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr);
0121 void i40e_vc_notify_vf_reset(struct i40e_vf *vf);
0122
0123
0124 int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac);
0125 int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
0126 u16 vlan_id, u8 qos, __be16 vlan_proto);
0127 int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
0128 int max_tx_rate);
0129 int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting);
0130 int i40e_ndo_get_vf_config(struct net_device *netdev,
0131 int vf_id, struct ifla_vf_info *ivi);
0132 int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link);
0133 int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable);
0134
0135 void i40e_vc_notify_link_state(struct i40e_pf *pf);
0136 void i40e_vc_notify_reset(struct i40e_pf *pf);
0137 int i40e_get_vf_stats(struct net_device *netdev, int vf_id,
0138 struct ifla_vf_stats *vf_stats);
0139
0140 #endif