1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /****************************************************************************
3*4882a593Smuzhiyun * Driver for Solarflare network controllers and boards
4*4882a593Smuzhiyun * Copyright 2015 Solarflare Communications Inc.
5*4882a593Smuzhiyun */
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun #ifndef EF10_SRIOV_H
8*4882a593Smuzhiyun #define EF10_SRIOV_H
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun #include "net_driver.h"
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun /**
13*4882a593Smuzhiyun * struct ef10_vf - PF's store of VF data
14*4882a593Smuzhiyun * @efx: efx_nic struct for the current VF
15*4882a593Smuzhiyun * @pci_dev: the pci_dev struct for the VF, retained while the VF is assigned
16*4882a593Smuzhiyun * @vport_id: vport ID for the VF
17*4882a593Smuzhiyun * @vport_assigned: record whether the vport is currently assigned to the VF
18*4882a593Smuzhiyun * @mac: MAC address for the VF, zero when address is removed from the vport
19*4882a593Smuzhiyun * @vlan: Default VLAN for the VF or #EFX_EF10_NO_VLAN
20*4882a593Smuzhiyun */
21*4882a593Smuzhiyun struct ef10_vf {
22*4882a593Smuzhiyun struct efx_nic *efx;
23*4882a593Smuzhiyun struct pci_dev *pci_dev;
24*4882a593Smuzhiyun unsigned int vport_id;
25*4882a593Smuzhiyun unsigned int vport_assigned;
26*4882a593Smuzhiyun u8 mac[ETH_ALEN];
27*4882a593Smuzhiyun u16 vlan;
28*4882a593Smuzhiyun #define EFX_EF10_NO_VLAN 0
29*4882a593Smuzhiyun };
30*4882a593Smuzhiyun
efx_ef10_sriov_wanted(struct efx_nic * efx)31*4882a593Smuzhiyun static inline bool efx_ef10_sriov_wanted(struct efx_nic *efx)
32*4882a593Smuzhiyun {
33*4882a593Smuzhiyun return false;
34*4882a593Smuzhiyun }
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun int efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs);
37*4882a593Smuzhiyun int efx_ef10_sriov_init(struct efx_nic *efx);
efx_ef10_sriov_reset(struct efx_nic * efx)38*4882a593Smuzhiyun static inline void efx_ef10_sriov_reset(struct efx_nic *efx) {}
39*4882a593Smuzhiyun void efx_ef10_sriov_fini(struct efx_nic *efx);
efx_ef10_sriov_flr(struct efx_nic * efx,unsigned vf_i)40*4882a593Smuzhiyun static inline void efx_ef10_sriov_flr(struct efx_nic *efx, unsigned vf_i) {}
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf, u8 *mac);
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i,
45*4882a593Smuzhiyun u16 vlan, u8 qos);
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun int efx_ef10_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf,
48*4882a593Smuzhiyun bool spoofchk);
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
51*4882a593Smuzhiyun struct ifla_vf_info *ivf);
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i,
54*4882a593Smuzhiyun int link_state);
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun int efx_ef10_vswitching_probe_pf(struct efx_nic *efx);
57*4882a593Smuzhiyun int efx_ef10_vswitching_probe_vf(struct efx_nic *efx);
58*4882a593Smuzhiyun int efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
59*4882a593Smuzhiyun int efx_ef10_vswitching_restore_vf(struct efx_nic *efx);
60*4882a593Smuzhiyun void efx_ef10_vswitching_remove_pf(struct efx_nic *efx);
61*4882a593Smuzhiyun void efx_ef10_vswitching_remove_vf(struct efx_nic *efx);
62*4882a593Smuzhiyun int efx_ef10_vport_add_mac(struct efx_nic *efx,
63*4882a593Smuzhiyun unsigned int port_id, u8 *mac);
64*4882a593Smuzhiyun int efx_ef10_vport_del_mac(struct efx_nic *efx,
65*4882a593Smuzhiyun unsigned int port_id, u8 *mac);
66*4882a593Smuzhiyun int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id);
67*4882a593Smuzhiyun int efx_ef10_vadaptor_query(struct efx_nic *efx, unsigned int port_id,
68*4882a593Smuzhiyun u32 *port_flags, u32 *vadaptor_flags,
69*4882a593Smuzhiyun unsigned int *vlan_tags);
70*4882a593Smuzhiyun int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id);
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun #endif /* EF10_SRIOV_H */
73