diff options
Diffstat (limited to 'drivers/net/ethernet/sfc/nic.h')
-rw-r--r-- | drivers/net/ethernet/sfc/nic.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 5df7da8b8ebf..246c4140453c 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -169,6 +169,95 @@ static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx) | |||
169 | } | 169 | } |
170 | #endif | 170 | #endif |
171 | 171 | ||
172 | /* | ||
173 | * On the SFC9000 family each port is associated with 1 PCI physical | ||
174 | * function (PF) handled by sfc and a configurable number of virtual | ||
175 | * functions (VFs) that may be handled by some other driver, often in | ||
176 | * a VM guest. The queue pointer registers are mapped in both PF and | ||
177 | * VF BARs such that an 8K region provides access to a single RX, TX | ||
178 | * and event queue (collectively a Virtual Interface, VI or VNIC). | ||
179 | * | ||
180 | * The PF has access to all 1024 VIs while VFs are mapped to VIs | ||
181 | * according to VI_BASE and VI_SCALE: VF i has access to VIs numbered | ||
182 | * in range [VI_BASE + i << VI_SCALE, VI_BASE + i + 1 << VI_SCALE). | ||
183 | * The number of VIs and the VI_SCALE value are configurable but must | ||
184 | * be established at boot time by firmware. | ||
185 | */ | ||
186 | |||
187 | /* Maximum VI_SCALE parameter supported by Siena */ | ||
188 | #define EFX_VI_SCALE_MAX 6 | ||
189 | /* Base VI to use for SR-IOV. Must be aligned to (1 << EFX_VI_SCALE_MAX), | ||
190 | * so this is the smallest allowed value. */ | ||
191 | #define EFX_VI_BASE 128U | ||
192 | /* Maximum number of VFs allowed */ | ||
193 | #define EFX_VF_COUNT_MAX 127 | ||
194 | /* Limit EVQs on VFs to be only 8k to reduce buffer table reservation */ | ||
195 | #define EFX_MAX_VF_EVQ_SIZE 8192UL | ||
196 | /* The number of buffer table entries reserved for each VI on a VF */ | ||
197 | #define EFX_VF_BUFTBL_PER_VI \ | ||
198 | ((EFX_MAX_VF_EVQ_SIZE + 2 * EFX_MAX_DMAQ_SIZE) * \ | ||
199 | sizeof(efx_qword_t) / EFX_BUF_SIZE) | ||
200 | |||
201 | #ifdef CONFIG_SFC_SRIOV | ||
202 | |||
203 | static inline bool efx_sriov_wanted(struct efx_nic *efx) | ||
204 | { | ||
205 | return efx->vf_count != 0; | ||
206 | } | ||
207 | static inline bool efx_sriov_enabled(struct efx_nic *efx) | ||
208 | { | ||
209 | return efx->vf_init_count != 0; | ||
210 | } | ||
211 | static inline unsigned int efx_vf_size(struct efx_nic *efx) | ||
212 | { | ||
213 | return 1 << efx->vi_scale; | ||
214 | } | ||
215 | |||
216 | extern int efx_init_sriov(void); | ||
217 | extern void efx_sriov_probe(struct efx_nic *efx); | ||
218 | extern int efx_sriov_init(struct efx_nic *efx); | ||
219 | extern void efx_sriov_mac_address_changed(struct efx_nic *efx); | ||
220 | extern void efx_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event); | ||
221 | extern void efx_sriov_rx_flush_done(struct efx_nic *efx, efx_qword_t *event); | ||
222 | extern void efx_sriov_event(struct efx_channel *channel, efx_qword_t *event); | ||
223 | extern void efx_sriov_desc_fetch_err(struct efx_nic *efx, unsigned dmaq); | ||
224 | extern void efx_sriov_flr(struct efx_nic *efx, unsigned flr); | ||
225 | extern void efx_sriov_reset(struct efx_nic *efx); | ||
226 | extern void efx_sriov_fini(struct efx_nic *efx); | ||
227 | extern void efx_fini_sriov(void); | ||
228 | |||
229 | #else | ||
230 | |||
231 | static inline bool efx_sriov_wanted(struct efx_nic *efx) { return false; } | ||
232 | static inline bool efx_sriov_enabled(struct efx_nic *efx) { return false; } | ||
233 | static inline unsigned int efx_vf_size(struct efx_nic *efx) { return 0; } | ||
234 | |||
235 | static inline int efx_init_sriov(void) { return 0; } | ||
236 | static inline void efx_sriov_probe(struct efx_nic *efx) {} | ||
237 | static inline int efx_sriov_init(struct efx_nic *efx) { return -EOPNOTSUPP; } | ||
238 | static inline void efx_sriov_mac_address_changed(struct efx_nic *efx) {} | ||
239 | static inline void efx_sriov_tx_flush_done(struct efx_nic *efx, | ||
240 | efx_qword_t *event) {} | ||
241 | static inline void efx_sriov_rx_flush_done(struct efx_nic *efx, | ||
242 | efx_qword_t *event) {} | ||
243 | static inline void efx_sriov_event(struct efx_channel *channel, | ||
244 | efx_qword_t *event) {} | ||
245 | static inline void efx_sriov_desc_fetch_err(struct efx_nic *efx, unsigned dmaq) {} | ||
246 | static inline void efx_sriov_flr(struct efx_nic *efx, unsigned flr) {} | ||
247 | static inline void efx_sriov_reset(struct efx_nic *efx) {} | ||
248 | static inline void efx_sriov_fini(struct efx_nic *efx) {} | ||
249 | static inline void efx_fini_sriov(void) {} | ||
250 | |||
251 | #endif | ||
252 | |||
253 | extern int efx_sriov_set_vf_mac(struct net_device *dev, int vf, u8 *mac); | ||
254 | extern int efx_sriov_set_vf_vlan(struct net_device *dev, int vf, | ||
255 | u16 vlan, u8 qos); | ||
256 | extern int efx_sriov_get_vf_config(struct net_device *dev, int vf, | ||
257 | struct ifla_vf_info *ivf); | ||
258 | extern int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf, | ||
259 | bool spoofchk); | ||
260 | |||
172 | extern const struct efx_nic_type falcon_a1_nic_type; | 261 | extern const struct efx_nic_type falcon_a1_nic_type; |
173 | extern const struct efx_nic_type falcon_b0_nic_type; | 262 | extern const struct efx_nic_type falcon_b0_nic_type; |
174 | extern const struct efx_nic_type siena_a0_nic_type; | 263 | extern const struct efx_nic_type siena_a0_nic_type; |