b98557670f730580870529359e9891b72365fbab
[firefly-linux-kernel-4.4.55.git] / drivers / net / ethernet / sfc / ef10_sriov.h
1 /****************************************************************************
2  * Driver for Solarflare network controllers and boards
3  * Copyright 2015 Solarflare Communications Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation, incorporated herein by reference.
8  */
9
10 #ifndef EF10_SRIOV_H
11 #define EF10_SRIOV_H
12
13 #include "net_driver.h"
14
15 /**
16  * struct ef10_vf - PF's store of VF data
17  * @efx: efx_nic struct for the current VF
18  * @vport_id: vport ID for the VF
19  * @vport_assigned: record whether the vport is currently assigned to the VF
20  * @mac: MAC address for the VF, zero when address is removed from the vport
21  * @vlan: Default VLAN for the VF or #EFX_EF10_NO_VLAN
22  */
23 struct ef10_vf {
24         struct efx_nic *efx;
25         unsigned int vport_id;
26         unsigned int vport_assigned;
27         u8 mac[ETH_ALEN];
28         u16 vlan;
29 #define EFX_EF10_NO_VLAN       0
30 };
31
32 static inline bool efx_ef10_sriov_wanted(struct efx_nic *efx)
33 {
34         return false;
35 }
36
37 int efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs);
38 int efx_ef10_sriov_init(struct efx_nic *efx);
39 static inline void efx_ef10_sriov_reset(struct efx_nic *efx) {}
40 void efx_ef10_sriov_fini(struct efx_nic *efx);
41 static inline void efx_ef10_sriov_flr(struct efx_nic *efx, unsigned vf_i) {}
42
43 int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf, u8 *mac);
44
45 int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i,
46                                u16 vlan, u8 qos);
47
48 int efx_ef10_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf,
49                                    bool spoofchk);
50
51 int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
52                                  struct ifla_vf_info *ivf);
53
54 int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i,
55                                      int link_state);
56
57 int efx_ef10_vswitching_probe_pf(struct efx_nic *efx);
58 int efx_ef10_vswitching_probe_vf(struct efx_nic *efx);
59 int efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
60 int efx_ef10_vswitching_restore_vf(struct efx_nic *efx);
61 void efx_ef10_vswitching_remove_pf(struct efx_nic *efx);
62 void efx_ef10_vswitching_remove_vf(struct efx_nic *efx);
63
64 #endif /* EF10_SRIOV_H */