blob: cfe556d17313f64715aac29bc45ce6c4bd633da9 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Shradha Shah7fa8d542015-05-06 00:55:13 +01002/****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2015 Solarflare Communications Inc.
Shradha Shah7fa8d542015-05-06 00:55:13 +01005 */
6
7#ifndef EF10_SRIOV_H
8#define EF10_SRIOV_H
9
10#include "net_driver.h"
11
Shradha Shah3c5eb872015-05-06 00:58:31 +010012/**
13 * struct ef10_vf - PF's store of VF data
Shradha Shahf1122a32015-05-20 11:09:46 +010014 * @efx: efx_nic struct for the current VF
Daniel Pieczko6598dad2015-06-02 11:41:00 +010015 * @pci_dev: the pci_dev struct for the VF, retained while the VF is assigned
Shradha Shah3c5eb872015-05-06 00:58:31 +010016 * @vport_id: vport ID for the VF
17 * @vport_assigned: record whether the vport is currently assigned to the VF
18 * @mac: MAC address for the VF, zero when address is removed from the vport
Shradha Shah2d432f22015-05-20 11:11:54 +010019 * @vlan: Default VLAN for the VF or #EFX_EF10_NO_VLAN
Shradha Shah3c5eb872015-05-06 00:58:31 +010020 */
21struct ef10_vf {
Shradha Shahf1122a32015-05-20 11:09:46 +010022 struct efx_nic *efx;
Daniel Pieczko6598dad2015-06-02 11:41:00 +010023 struct pci_dev *pci_dev;
Shradha Shah3c5eb872015-05-06 00:58:31 +010024 unsigned int vport_id;
25 unsigned int vport_assigned;
26 u8 mac[ETH_ALEN];
Shradha Shah2d432f22015-05-20 11:11:54 +010027 u16 vlan;
28#define EFX_EF10_NO_VLAN 0
Shradha Shah3c5eb872015-05-06 00:58:31 +010029};
30
Shradha Shah7fa8d542015-05-06 00:55:13 +010031static inline bool efx_ef10_sriov_wanted(struct efx_nic *efx)
32{
33 return false;
34}
35
Shradha Shah834e23d2015-05-06 00:55:58 +010036int efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs);
Shradha Shah02246a72015-05-06 00:58:14 +010037int efx_ef10_sriov_init(struct efx_nic *efx);
Shradha Shah7fa8d542015-05-06 00:55:13 +010038static inline void efx_ef10_sriov_reset(struct efx_nic *efx) {}
Shradha Shah02246a72015-05-06 00:58:14 +010039void efx_ef10_sriov_fini(struct efx_nic *efx);
Shradha Shah7fa8d542015-05-06 00:55:13 +010040static inline void efx_ef10_sriov_flr(struct efx_nic *efx, unsigned vf_i) {}
41
Shradha Shahe340be92015-05-20 11:11:03 +010042int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf, u8 *mac);
Shradha Shah7fa8d542015-05-06 00:55:13 +010043
Shradha Shah2d432f22015-05-20 11:11:54 +010044int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i,
45 u16 vlan, u8 qos);
Shradha Shah7fa8d542015-05-06 00:55:13 +010046
Shradha Shah860d2ff2015-05-20 11:12:30 +010047int efx_ef10_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf,
48 bool spoofchk);
Shradha Shah7fa8d542015-05-06 00:55:13 +010049
Shradha Shahb9af9042015-05-20 11:11:18 +010050int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
51 struct ifla_vf_info *ivf);
Shradha Shah7fa8d542015-05-06 00:55:13 +010052
Edward Cree4392dc62015-05-20 11:12:13 +010053int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i,
54 int link_state);
55
Shradha Shah7b8c7b52015-05-06 00:58:54 +010056int efx_ef10_vswitching_probe_pf(struct efx_nic *efx);
57int efx_ef10_vswitching_probe_vf(struct efx_nic *efx);
58int efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
59int efx_ef10_vswitching_restore_vf(struct efx_nic *efx);
60void efx_ef10_vswitching_remove_pf(struct efx_nic *efx);
61void efx_ef10_vswitching_remove_vf(struct efx_nic *efx);
Daniel Pieczko7a186f42015-07-07 11:37:19 +010062int efx_ef10_vport_add_mac(struct efx_nic *efx,
63 unsigned int port_id, u8 *mac);
64int efx_ef10_vport_del_mac(struct efx_nic *efx,
65 unsigned int port_id, u8 *mac);
66int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id);
Andrew Rybchenko38d27f32016-06-15 17:52:08 +010067int efx_ef10_vadaptor_query(struct efx_nic *efx, unsigned int port_id,
68 u32 *port_flags, u32 *vadaptor_flags,
69 unsigned int *vlan_tags);
Daniel Pieczko7a186f42015-07-07 11:37:19 +010070int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id);
Daniel Pieczko6d8aaaf2015-05-06 00:57:34 +010071
Shradha Shah7fa8d542015-05-06 00:55:13 +010072#endif /* EF10_SRIOV_H */