linux/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.h

/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/* Copyright (C) 2017-2019 Netronome Systems, Inc. */

#ifndef _NFP_NET_SRIOV_H_
#define _NFP_NET_SRIOV_H_

/* SRIOV VF configuration.
 * The configuration memory begins with a mailbox region for communication with
 * the firmware followed by individual VF entries.
 */
#define NFP_NET_VF_CFG_SZ
#define NFP_NET_VF_CFG_MB_SZ

/* VF config mailbox */
#define NFP_NET_VF_CFG_MB
#define NFP_NET_VF_CFG_MB_CAP
#define NFP_NET_VF_CFG_MB_CAP_MAC
#define NFP_NET_VF_CFG_MB_CAP_VLAN
#define NFP_NET_VF_CFG_MB_CAP_SPOOF
#define NFP_NET_VF_CFG_MB_CAP_LINK_STATE
#define NFP_NET_VF_CFG_MB_CAP_TRUST
#define NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO
#define NFP_NET_VF_CFG_MB_CAP_RATE
#define NFP_NET_VF_CFG_MB_RET
#define NFP_NET_VF_CFG_MB_UPD
#define NFP_NET_VF_CFG_MB_UPD_MAC
#define NFP_NET_VF_CFG_MB_UPD_VLAN
#define NFP_NET_VF_CFG_MB_UPD_SPOOF
#define NFP_NET_VF_CFG_MB_UPD_LINK_STATE
#define NFP_NET_VF_CFG_MB_UPD_TRUST
#define NFP_NET_VF_CFG_MB_UPD_VLAN_PROTO
#define NFP_NET_VF_CFG_MB_UPD_RATE
#define NFP_NET_VF_CFG_MB_VF_NUM

/* VF config entry
 * MAC_LO is set that the MAC address can be read in a single 6 byte read
 * by the NFP
 */
#define NFP_NET_VF_CFG_MAC
#define NFP_NET_VF_CFG_MAC_HI
#define NFP_NET_VF_CFG_MAC_LO
#define NFP_NET_VF_CFG_CTRL
#define NFP_NET_VF_CFG_CTRL_TRUST
#define NFP_NET_VF_CFG_CTRL_SPOOF
#define NFP_NET_VF_CFG_CTRL_LINK_STATE
#define NFP_NET_VF_CFG_LS_MODE_AUTO
#define NFP_NET_VF_CFG_LS_MODE_ENABLE
#define NFP_NET_VF_CFG_LS_MODE_DISABLE
#define NFP_NET_VF_CFG_VLAN
#define NFP_NET_VF_CFG_VLAN_PROT
#define NFP_NET_VF_CFG_VLAN_QOS
#define NFP_NET_VF_CFG_VLAN_VID
#define NFP_NET_VF_CFG_RATE
#define NFP_NET_VF_CFG_MIN_RATE
#define NFP_NET_VF_CFG_MAX_RATE

#define NFP_NET_VF_RATE_MAX

int nfp_app_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
int nfp_app_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos,
			__be16 vlan_proto);
int nfp_app_set_vf_rate(struct net_device *netdev, int vf, int min_tx_rate,
			int max_tx_rate);
int nfp_app_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
int nfp_app_set_vf_trust(struct net_device *netdev, int vf, bool setting);
int nfp_app_set_vf_link_state(struct net_device *netdev, int vf,
			      int link_state);
int nfp_app_get_vf_config(struct net_device *netdev, int vf,
			  struct ifla_vf_info *ivi);

#endif /* _NFP_NET_SRIOV_H_ */