18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/****************************************************************************
38c2ecf20Sopenharmony_ci * Driver for Solarflare network controllers and boards
48c2ecf20Sopenharmony_ci * Copyright 2015 Solarflare Communications Inc.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef EF10_SRIOV_H
88c2ecf20Sopenharmony_ci#define EF10_SRIOV_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include "net_driver.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/**
138c2ecf20Sopenharmony_ci * struct ef10_vf - PF's store of VF data
148c2ecf20Sopenharmony_ci * @efx: efx_nic struct for the current VF
158c2ecf20Sopenharmony_ci * @pci_dev: the pci_dev struct for the VF, retained while the VF is assigned
168c2ecf20Sopenharmony_ci * @vport_id: vport ID for the VF
178c2ecf20Sopenharmony_ci * @vport_assigned: record whether the vport is currently assigned to the VF
188c2ecf20Sopenharmony_ci * @mac: MAC address for the VF, zero when address is removed from the vport
198c2ecf20Sopenharmony_ci * @vlan: Default VLAN for the VF or #EFX_EF10_NO_VLAN
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_cistruct ef10_vf {
228c2ecf20Sopenharmony_ci	struct efx_nic *efx;
238c2ecf20Sopenharmony_ci	struct pci_dev *pci_dev;
248c2ecf20Sopenharmony_ci	unsigned int vport_id;
258c2ecf20Sopenharmony_ci	unsigned int vport_assigned;
268c2ecf20Sopenharmony_ci	u8 mac[ETH_ALEN];
278c2ecf20Sopenharmony_ci	u16 vlan;
288c2ecf20Sopenharmony_ci#define EFX_EF10_NO_VLAN       0
298c2ecf20Sopenharmony_ci};
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistatic inline bool efx_ef10_sriov_wanted(struct efx_nic *efx)
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci	return false;
348c2ecf20Sopenharmony_ci}
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciint efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs);
378c2ecf20Sopenharmony_ciint efx_ef10_sriov_init(struct efx_nic *efx);
388c2ecf20Sopenharmony_cistatic inline void efx_ef10_sriov_reset(struct efx_nic *efx) {}
398c2ecf20Sopenharmony_civoid efx_ef10_sriov_fini(struct efx_nic *efx);
408c2ecf20Sopenharmony_cistatic inline void efx_ef10_sriov_flr(struct efx_nic *efx, unsigned vf_i) {}
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciint efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf, u8 *mac);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciint efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i,
458c2ecf20Sopenharmony_ci			       u16 vlan, u8 qos);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciint efx_ef10_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf,
488c2ecf20Sopenharmony_ci				   bool spoofchk);
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciint efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
518c2ecf20Sopenharmony_ci				 struct ifla_vf_info *ivf);
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciint efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i,
548c2ecf20Sopenharmony_ci				     int link_state);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciint efx_ef10_vswitching_probe_pf(struct efx_nic *efx);
578c2ecf20Sopenharmony_ciint efx_ef10_vswitching_probe_vf(struct efx_nic *efx);
588c2ecf20Sopenharmony_ciint efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
598c2ecf20Sopenharmony_ciint efx_ef10_vswitching_restore_vf(struct efx_nic *efx);
608c2ecf20Sopenharmony_civoid efx_ef10_vswitching_remove_pf(struct efx_nic *efx);
618c2ecf20Sopenharmony_civoid efx_ef10_vswitching_remove_vf(struct efx_nic *efx);
628c2ecf20Sopenharmony_ciint efx_ef10_vport_add_mac(struct efx_nic *efx,
638c2ecf20Sopenharmony_ci			   unsigned int port_id, u8 *mac);
648c2ecf20Sopenharmony_ciint efx_ef10_vport_del_mac(struct efx_nic *efx,
658c2ecf20Sopenharmony_ci			   unsigned int port_id, u8 *mac);
668c2ecf20Sopenharmony_ciint efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id);
678c2ecf20Sopenharmony_ciint efx_ef10_vadaptor_query(struct efx_nic *efx, unsigned int port_id,
688c2ecf20Sopenharmony_ci			    u32 *port_flags, u32 *vadaptor_flags,
698c2ecf20Sopenharmony_ci			    unsigned int *vlan_tags);
708c2ecf20Sopenharmony_ciint efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id);
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#endif /* EF10_SRIOV_H */
73