1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
27fa8d547SShradha Shah /****************************************************************************
37fa8d547SShradha Shah  * Driver for Solarflare network controllers and boards
47fa8d547SShradha Shah  * Copyright 2015 Solarflare Communications Inc.
57fa8d547SShradha Shah  */
67fa8d547SShradha Shah 
77fa8d547SShradha Shah #ifndef EF10_SRIOV_H
87fa8d547SShradha Shah #define EF10_SRIOV_H
97fa8d547SShradha Shah 
107fa8d547SShradha Shah #include "net_driver.h"
117fa8d547SShradha Shah 
123c5eb876SShradha Shah /**
133c5eb876SShradha Shah  * struct ef10_vf - PF's store of VF data
14f1122a34SShradha Shah  * @efx: efx_nic struct for the current VF
156598dad2SDaniel Pieczko  * @pci_dev: the pci_dev struct for the VF, retained while the VF is assigned
163c5eb876SShradha Shah  * @vport_id: vport ID for the VF
173c5eb876SShradha Shah  * @vport_assigned: record whether the vport is currently assigned to the VF
183c5eb876SShradha Shah  * @mac: MAC address for the VF, zero when address is removed from the vport
192d432f20SShradha Shah  * @vlan: Default VLAN for the VF or #EFX_EF10_NO_VLAN
203c5eb876SShradha Shah  */
213c5eb876SShradha Shah struct ef10_vf {
22f1122a34SShradha Shah 	struct efx_nic *efx;
236598dad2SDaniel Pieczko 	struct pci_dev *pci_dev;
243c5eb876SShradha Shah 	unsigned int vport_id;
253c5eb876SShradha Shah 	unsigned int vport_assigned;
263c5eb876SShradha Shah 	u8 mac[ETH_ALEN];
272d432f20SShradha Shah 	u16 vlan;
282d432f20SShradha Shah #define EFX_EF10_NO_VLAN       0
293c5eb876SShradha Shah };
303c5eb876SShradha Shah 
efx_ef10_sriov_wanted(struct efx_nic * efx)317fa8d547SShradha Shah static inline bool efx_ef10_sriov_wanted(struct efx_nic *efx)
327fa8d547SShradha Shah {
337fa8d547SShradha Shah 	return false;
347fa8d547SShradha Shah }
357fa8d547SShradha Shah 
36834e23ddSShradha Shah int efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs);
3702246a7fSShradha Shah int efx_ef10_sriov_init(struct efx_nic *efx);
3802246a7fSShradha Shah void efx_ef10_sriov_fini(struct efx_nic *efx);
397fa8d547SShradha Shah 
40*76660757SJakub Kicinski int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf, const u8 *mac);
417fa8d547SShradha Shah 
422d432f20SShradha Shah int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i,
432d432f20SShradha Shah 			       u16 vlan, u8 qos);
447fa8d547SShradha Shah 
45860d2ffaSShradha Shah int efx_ef10_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf,
46860d2ffaSShradha Shah 				   bool spoofchk);
477fa8d547SShradha Shah 
48b9af9049SShradha Shah int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
49b9af9049SShradha Shah 				 struct ifla_vf_info *ivf);
507fa8d547SShradha Shah 
514392dc69SEdward Cree int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i,
524392dc69SEdward Cree 				     int link_state);
534392dc69SEdward Cree 
547b8c7b54SShradha Shah int efx_ef10_vswitching_probe_pf(struct efx_nic *efx);
557b8c7b54SShradha Shah int efx_ef10_vswitching_probe_vf(struct efx_nic *efx);
567b8c7b54SShradha Shah int efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
577b8c7b54SShradha Shah int efx_ef10_vswitching_restore_vf(struct efx_nic *efx);
587b8c7b54SShradha Shah void efx_ef10_vswitching_remove_pf(struct efx_nic *efx);
597b8c7b54SShradha Shah void efx_ef10_vswitching_remove_vf(struct efx_nic *efx);
607a186f47SDaniel Pieczko int efx_ef10_vport_add_mac(struct efx_nic *efx,
61*76660757SJakub Kicinski 			   unsigned int port_id, const u8 *mac);
627a186f47SDaniel Pieczko int efx_ef10_vport_del_mac(struct efx_nic *efx,
63*76660757SJakub Kicinski 			   unsigned int port_id, const u8 *mac);
647a186f47SDaniel Pieczko int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id);
6538d27f38SAndrew Rybchenko int efx_ef10_vadaptor_query(struct efx_nic *efx, unsigned int port_id,
6638d27f38SAndrew Rybchenko 			    u32 *port_flags, u32 *vadaptor_flags,
6738d27f38SAndrew Rybchenko 			    unsigned int *vlan_tags);
687a186f47SDaniel Pieczko int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id);
696d8aaaf6SDaniel Pieczko 
707fa8d547SShradha Shah #endif /* EF10_SRIOV_H */
71