0001
0002
0003
0004
0005
0006
0007 #ifndef EFX_SRIOV_H
0008 #define EFX_SRIOV_H
0009
0010 #include "net_driver.h"
0011
0012 #ifdef CONFIG_SFC_SIENA_SRIOV
0013
0014 static inline
0015 int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac)
0016 {
0017 struct efx_nic *efx = netdev_priv(net_dev);
0018
0019 if (efx->type->sriov_set_vf_mac)
0020 return efx->type->sriov_set_vf_mac(efx, vf_i, mac);
0021 else
0022 return -EOPNOTSUPP;
0023 }
0024
0025 static inline
0026 int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan,
0027 u8 qos, __be16 vlan_proto)
0028 {
0029 struct efx_nic *efx = netdev_priv(net_dev);
0030
0031 if (efx->type->sriov_set_vf_vlan) {
0032 if ((vlan & ~VLAN_VID_MASK) ||
0033 (qos & ~(VLAN_PRIO_MASK >> VLAN_PRIO_SHIFT)))
0034 return -EINVAL;
0035
0036 if (vlan_proto != htons(ETH_P_8021Q))
0037 return -EPROTONOSUPPORT;
0038
0039 return efx->type->sriov_set_vf_vlan(efx, vf_i, vlan, qos);
0040 } else {
0041 return -EOPNOTSUPP;
0042 }
0043 }
0044
0045 static inline
0046 int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i,
0047 bool spoofchk)
0048 {
0049 struct efx_nic *efx = netdev_priv(net_dev);
0050
0051 if (efx->type->sriov_set_vf_spoofchk)
0052 return efx->type->sriov_set_vf_spoofchk(efx, vf_i, spoofchk);
0053 else
0054 return -EOPNOTSUPP;
0055 }
0056
0057 static inline
0058 int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i,
0059 struct ifla_vf_info *ivi)
0060 {
0061 struct efx_nic *efx = netdev_priv(net_dev);
0062
0063 if (efx->type->sriov_get_vf_config)
0064 return efx->type->sriov_get_vf_config(efx, vf_i, ivi);
0065 else
0066 return -EOPNOTSUPP;
0067 }
0068
0069 static inline
0070 int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,
0071 int link_state)
0072 {
0073 struct efx_nic *efx = netdev_priv(net_dev);
0074
0075 if (efx->type->sriov_set_vf_link_state)
0076 return efx->type->sriov_set_vf_link_state(efx, vf_i,
0077 link_state);
0078 else
0079 return -EOPNOTSUPP;
0080 }
0081 #endif
0082
0083 #endif