brintos

brintos / linux-shallow public Read only

0
0
Text · 2.0 KiB · a6981ba Raw
84 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/****************************************************************************3 * Driver for Solarflare network controllers and boards4 * Copyright 2014-2015 Solarflare Communications Inc.5 */6 7#ifndef EFX_SRIOV_H8#define EFX_SRIOV_H9 10#include "net_driver.h"11 12#ifdef CONFIG_SFC_SIENA_SRIOV13 14static inline15int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac)16{17	struct efx_nic *efx = netdev_priv(net_dev);18 19	if (efx->type->sriov_set_vf_mac)20		return efx->type->sriov_set_vf_mac(efx, vf_i, mac);21	else22		return -EOPNOTSUPP;23}24 25static inline26int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan,27			  u8 qos, __be16 vlan_proto)28{29	struct efx_nic *efx = netdev_priv(net_dev);30 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;35 36		if (vlan_proto != htons(ETH_P_8021Q))37			return -EPROTONOSUPPORT;38 39		return efx->type->sriov_set_vf_vlan(efx, vf_i, vlan, qos);40	} else {41		return -EOPNOTSUPP;42	}43}44 45static inline46int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i,47			      bool spoofchk)48{49	struct efx_nic *efx = netdev_priv(net_dev);50 51	if (efx->type->sriov_set_vf_spoofchk)52		return efx->type->sriov_set_vf_spoofchk(efx, vf_i, spoofchk);53	else54		return -EOPNOTSUPP;55}56 57static inline58int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i,59			    struct ifla_vf_info *ivi)60{61	struct efx_nic *efx = netdev_priv(net_dev);62 63	if (efx->type->sriov_get_vf_config)64		return efx->type->sriov_get_vf_config(efx, vf_i, ivi);65	else66		return -EOPNOTSUPP;67}68 69static inline70int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,71				int link_state)72{73	struct efx_nic *efx = netdev_priv(net_dev);74 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	else79		return -EOPNOTSUPP;80}81#endif /* CONFIG_SFC_SIENA_SRIOV */82 83#endif /* EFX_SRIOV_H */84