This source file includes following definitions.
- ice_reset_all_vfs
- ice_sriov_configure
- ice_set_vf_mac
- ice_get_vf_cfg
- ice_set_vf_trust
- ice_set_vf_port_vlan
- ice_set_vf_spoofchk
- ice_set_vf_link_state
- ice_calc_vf_reg_idx
1
2
3
4 #ifndef _ICE_VIRTCHNL_PF_H_
5 #define _ICE_VIRTCHNL_PF_H_
6 #include "ice.h"
7
8 #define ICE_MAX_VLANID 4095
9 #define ICE_VLAN_PRIORITY_S 12
10 #define ICE_VLAN_M 0xFFF
11 #define ICE_PRIORITY_M 0x7000
12
13
14 #define ICE_MAX_VLAN_PER_VF 8
15 #define ICE_MAX_MACADDR_PER_VF 12
16
17
18 #define ICE_DFLT_NUM_INVAL_MSGS_ALLOWED 10
19 #define ICE_MDD_EVENTS_THRESHOLD 30
20
21
22 #define VF_DEVICE_STATUS 0xAA
23 #define VF_TRANS_PENDING_M 0x20
24
25
26 #define ICE_PCI_CIAD_WAIT_COUNT 100
27 #define ICE_PCI_CIAD_WAIT_DELAY_US 1
28
29
30 #define ICE_MAX_VF_COUNT 256
31 #define ICE_MAX_QS_PER_VF 256
32 #define ICE_MIN_QS_PER_VF 1
33 #define ICE_DFLT_QS_PER_VF 4
34 #define ICE_NONQ_VECS_VF 1
35 #define ICE_MAX_SCATTER_QS_PER_VF 16
36 #define ICE_MAX_BASE_QS_PER_VF 16
37 #define ICE_MAX_INTR_PER_VF 65
38 #define ICE_MAX_POLICY_INTR_PER_VF 33
39 #define ICE_MIN_INTR_PER_VF (ICE_MIN_QS_PER_VF + 1)
40 #define ICE_DFLT_INTR_PER_VF (ICE_DFLT_QS_PER_VF + 1)
41
42
43 enum ice_vf_states {
44 ICE_VF_STATE_INIT = 0,
45 ICE_VF_STATE_ACTIVE,
46 ICE_VF_STATE_QS_ENA,
47 ICE_VF_STATE_DIS,
48 ICE_VF_STATE_MC_PROMISC,
49 ICE_VF_STATE_UC_PROMISC,
50 ICE_VF_STATES_NBITS
51 };
52
53
54 enum ice_virtchnl_cap {
55 ICE_VIRTCHNL_VF_CAP_L2 = 0,
56 ICE_VIRTCHNL_VF_CAP_PRIVILEGE,
57 };
58
59
60 struct ice_vf {
61 struct ice_pf *pf;
62
63 s16 vf_id;
64 u16 lan_vsi_idx;
65
66 int first_vector_idx;
67 struct ice_sw *vf_sw_id;
68 struct virtchnl_version_info vf_ver;
69 u32 driver_caps;
70 struct virtchnl_ether_addr dflt_lan_addr;
71 DECLARE_BITMAP(txq_ena, ICE_MAX_BASE_QS_PER_VF);
72 DECLARE_BITMAP(rxq_ena, ICE_MAX_BASE_QS_PER_VF);
73 u16 port_vlan_id;
74 u8 pf_set_mac:1;
75 u8 trusted:1;
76 u8 spoofchk:1;
77 u8 link_forced:1;
78 u8 link_up:1;
79
80
81
82
83 u16 lan_vsi_num;
84 unsigned int tx_rate;
85 DECLARE_BITMAP(vf_states, ICE_VF_STATES_NBITS);
86
87 u64 num_mdd_events;
88 u64 num_inval_msgs;
89 u64 num_valid_msgs;
90 unsigned long vf_caps;
91 u8 num_req_qs;
92 u16 num_mac;
93 u16 num_vlan;
94 u16 num_vf_qs;
95 u16 num_qs_ena;
96 };
97
98 #ifdef CONFIG_PCI_IOV
99 void ice_process_vflr_event(struct ice_pf *pf);
100 int ice_sriov_configure(struct pci_dev *pdev, int num_vfs);
101 int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac);
102 int
103 ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi);
104
105 void ice_free_vfs(struct ice_pf *pf);
106 void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event);
107 void ice_vc_notify_link_state(struct ice_pf *pf);
108 void ice_vc_notify_reset(struct ice_pf *pf);
109 bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr);
110
111 int
112 ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
113 __be16 vlan_proto);
114
115 int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted);
116
117 int ice_set_vf_link_state(struct net_device *netdev, int vf_id, int link_state);
118
119 int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena);
120
121 int ice_calc_vf_reg_idx(struct ice_vf *vf, struct ice_q_vector *q_vector);
122
123 void ice_set_vf_state_qs_dis(struct ice_vf *vf);
124 #else
125 #define ice_process_vflr_event(pf) do {} while (0)
126 #define ice_free_vfs(pf) do {} while (0)
127 #define ice_vc_process_vf_msg(pf, event) do {} while (0)
128 #define ice_vc_notify_link_state(pf) do {} while (0)
129 #define ice_vc_notify_reset(pf) do {} while (0)
130 #define ice_set_vf_state_qs_dis(vf) do {} while (0)
131
132 static inline bool
133 ice_reset_all_vfs(struct ice_pf __always_unused *pf,
134 bool __always_unused is_vflr)
135 {
136 return true;
137 }
138
139 static inline int
140 ice_sriov_configure(struct pci_dev __always_unused *pdev,
141 int __always_unused num_vfs)
142 {
143 return -EOPNOTSUPP;
144 }
145
146 static inline int
147 ice_set_vf_mac(struct net_device __always_unused *netdev,
148 int __always_unused vf_id, u8 __always_unused *mac)
149 {
150 return -EOPNOTSUPP;
151 }
152
153 static inline int
154 ice_get_vf_cfg(struct net_device __always_unused *netdev,
155 int __always_unused vf_id,
156 struct ifla_vf_info __always_unused *ivi)
157 {
158 return -EOPNOTSUPP;
159 }
160
161 static inline int
162 ice_set_vf_trust(struct net_device __always_unused *netdev,
163 int __always_unused vf_id, bool __always_unused trusted)
164 {
165 return -EOPNOTSUPP;
166 }
167
168 static inline int
169 ice_set_vf_port_vlan(struct net_device __always_unused *netdev,
170 int __always_unused vf_id, u16 __always_unused vid,
171 u8 __always_unused qos, __be16 __always_unused v_proto)
172 {
173 return -EOPNOTSUPP;
174 }
175
176 static inline int
177 ice_set_vf_spoofchk(struct net_device __always_unused *netdev,
178 int __always_unused vf_id, bool __always_unused ena)
179 {
180 return -EOPNOTSUPP;
181 }
182
183 static inline int
184 ice_set_vf_link_state(struct net_device __always_unused *netdev,
185 int __always_unused vf_id, int __always_unused link_state)
186 {
187 return -EOPNOTSUPP;
188 }
189
190 static inline int
191 ice_calc_vf_reg_idx(struct ice_vf __always_unused *vf,
192 struct ice_q_vector __always_unused *q_vector)
193 {
194 return 0;
195 }
196 #endif
197 #endif