Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / net / ethernet / sfc / siena / sriov.h
bloba6981bad76215ff641ca6cb142b30369ea6a190d
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2014-2015 Solarflare Communications Inc.
5 */
7 #ifndef EFX_SRIOV_H
8 #define EFX_SRIOV_H
10 #include "net_driver.h"
12 #ifdef CONFIG_SFC_SIENA_SRIOV
14 static inline
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);
21 else
22 return -EOPNOTSUPP;
25 static inline
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)))
34 return -EINVAL;
36 if (vlan_proto != htons(ETH_P_8021Q))
37 return -EPROTONOSUPPORT;
39 return efx->type->sriov_set_vf_vlan(efx, vf_i, vlan, qos);
40 } else {
41 return -EOPNOTSUPP;
45 static inline
46 int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i,
47 bool spoofchk)
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);
53 else
54 return -EOPNOTSUPP;
57 static inline
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);
65 else
66 return -EOPNOTSUPP;
69 static inline
70 int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,
71 int link_state)
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,
77 link_state);
78 else
79 return -EOPNOTSUPP;
81 #endif /* CONFIG_SFC_SIENA_SRIOV */
83 #endif /* EFX_SRIOV_H */