Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Driver for Solarflare network controllers and boards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright 2014-2015 Solarflare Communications Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include "net_driver.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include "nic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include "sriov.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	if (efx->type->sriov_set_vf_mac)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 		return efx->type->sriov_set_vf_mac(efx, vf_i, mac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 			  u8 qos, __be16 vlan_proto)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	if (efx->type->sriov_set_vf_vlan) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 		if ((vlan & ~VLAN_VID_MASK) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		    (qos & ~(VLAN_PRIO_MASK >> VLAN_PRIO_SHIFT)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 			return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 		if (vlan_proto != htons(ETH_P_8021Q))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 			return -EPROTONOSUPPORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 		return efx->type->sriov_set_vf_vlan(efx, vf_i, vlan, qos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 			      bool spoofchk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	if (efx->type->sriov_set_vf_spoofchk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		return efx->type->sriov_set_vf_spoofchk(efx, vf_i, spoofchk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 			    struct ifla_vf_info *ivi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	if (efx->type->sriov_get_vf_config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		return efx->type->sriov_get_vf_config(efx, vf_i, ivi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 				int link_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	if (efx->type->sriov_set_vf_link_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 		return efx->type->sriov_set_vf_link_state(efx, vf_i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 							  link_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }