1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2014-2015 Solarflare Communications Inc.
10 #include "net_driver.h"
12 #ifdef CONFIG_SFC_SIENA_SRIOV
15 int efx_sriov_set_vf_mac(struct net_device
*net_dev
, int vf_i
, u8
*mac
)
17 struct efx_nic
*efx
= netdev_priv(net_dev
);
19 if (efx
->type
->sriov_set_vf_mac
)
20 return efx
->type
->sriov_set_vf_mac(efx
, vf_i
, mac
);
26 int efx_sriov_set_vf_vlan(struct net_device
*net_dev
, int vf_i
, u16 vlan
,
27 u8 qos
, __be16 vlan_proto
)
29 struct efx_nic
*efx
= netdev_priv(net_dev
);
31 if (efx
->type
->sriov_set_vf_vlan
) {
32 if ((vlan
& ~VLAN_VID_MASK
) ||
33 (qos
& ~(VLAN_PRIO_MASK
>> VLAN_PRIO_SHIFT
)))
36 if (vlan_proto
!= htons(ETH_P_8021Q
))
37 return -EPROTONOSUPPORT
;
39 return efx
->type
->sriov_set_vf_vlan(efx
, vf_i
, vlan
, qos
);
46 int efx_sriov_set_vf_spoofchk(struct net_device
*net_dev
, int vf_i
,
49 struct efx_nic
*efx
= netdev_priv(net_dev
);
51 if (efx
->type
->sriov_set_vf_spoofchk
)
52 return efx
->type
->sriov_set_vf_spoofchk(efx
, vf_i
, spoofchk
);
58 int efx_sriov_get_vf_config(struct net_device
*net_dev
, int vf_i
,
59 struct ifla_vf_info
*ivi
)
61 struct efx_nic
*efx
= netdev_priv(net_dev
);
63 if (efx
->type
->sriov_get_vf_config
)
64 return efx
->type
->sriov_get_vf_config(efx
, vf_i
, ivi
);
70 int efx_sriov_set_vf_link_state(struct net_device
*net_dev
, int vf_i
,
73 struct efx_nic
*efx
= netdev_priv(net_dev
);
75 if (efx
->type
->sriov_set_vf_link_state
)
76 return efx
->type
->sriov_set_vf_link_state(efx
, vf_i
,
81 #endif /* CONFIG_SFC_SIENA_SRIOV */
83 #endif /* EFX_SRIOV_H */