Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
0002 /* Copyright (C) 2017-2019 Netronome Systems, Inc. */
0003 
0004 #ifndef _NFP_NET_SRIOV_H_
0005 #define _NFP_NET_SRIOV_H_
0006 
0007 /* SRIOV VF configuration.
0008  * The configuration memory begins with a mailbox region for communication with
0009  * the firmware followed by individual VF entries.
0010  */
0011 #define NFP_NET_VF_CFG_SZ       16
0012 #define NFP_NET_VF_CFG_MB_SZ        16
0013 
0014 /* VF config mailbox */
0015 #define NFP_NET_VF_CFG_MB               0x0
0016 #define NFP_NET_VF_CFG_MB_CAP               0x0
0017 #define   NFP_NET_VF_CFG_MB_CAP_MAC           (0x1 << 0)
0018 #define   NFP_NET_VF_CFG_MB_CAP_VLAN              (0x1 << 1)
0019 #define   NFP_NET_VF_CFG_MB_CAP_SPOOF             (0x1 << 2)
0020 #define   NFP_NET_VF_CFG_MB_CAP_LINK_STATE        (0x1 << 3)
0021 #define   NFP_NET_VF_CFG_MB_CAP_TRUST             (0x1 << 4)
0022 #define   NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO        (0x1 << 5)
0023 #define   NFP_NET_VF_CFG_MB_CAP_RATE              (0x1 << 6)
0024 #define NFP_NET_VF_CFG_MB_RET               0x2
0025 #define NFP_NET_VF_CFG_MB_UPD               0x4
0026 #define   NFP_NET_VF_CFG_MB_UPD_MAC           (0x1 << 0)
0027 #define   NFP_NET_VF_CFG_MB_UPD_VLAN              (0x1 << 1)
0028 #define   NFP_NET_VF_CFG_MB_UPD_SPOOF             (0x1 << 2)
0029 #define   NFP_NET_VF_CFG_MB_UPD_LINK_STATE        (0x1 << 3)
0030 #define   NFP_NET_VF_CFG_MB_UPD_TRUST             (0x1 << 4)
0031 #define   NFP_NET_VF_CFG_MB_UPD_VLAN_PROTO        (0x1 << 5)
0032 #define   NFP_NET_VF_CFG_MB_UPD_RATE              (0x1 << 6)
0033 #define NFP_NET_VF_CFG_MB_VF_NUM            0x7
0034 
0035 /* VF config entry
0036  * MAC_LO is set that the MAC address can be read in a single 6 byte read
0037  * by the NFP
0038  */
0039 #define NFP_NET_VF_CFG_MAC              0x0
0040 #define   NFP_NET_VF_CFG_MAC_HI               0x0
0041 #define   NFP_NET_VF_CFG_MAC_LO               0x6
0042 #define NFP_NET_VF_CFG_CTRL             0x4
0043 #define   NFP_NET_VF_CFG_CTRL_TRUST           0x8
0044 #define   NFP_NET_VF_CFG_CTRL_SPOOF           0x4
0045 #define   NFP_NET_VF_CFG_CTRL_LINK_STATE          0x3
0046 #define     NFP_NET_VF_CFG_LS_MODE_AUTO             0
0047 #define     NFP_NET_VF_CFG_LS_MODE_ENABLE           1
0048 #define     NFP_NET_VF_CFG_LS_MODE_DISABLE          2
0049 #define NFP_NET_VF_CFG_VLAN             0x8
0050 #define   NFP_NET_VF_CFG_VLAN_PROT            0xffff0000
0051 #define   NFP_NET_VF_CFG_VLAN_QOS             0xe000
0052 #define   NFP_NET_VF_CFG_VLAN_VID             0x0fff
0053 #define NFP_NET_VF_CFG_RATE             0xc
0054 #define   NFP_NET_VF_CFG_MIN_RATE           0x0000ffff
0055 #define   NFP_NET_VF_CFG_MAX_RATE           0xffff0000
0056 
0057 #define NFP_NET_VF_RATE_MAX         0xffff
0058 
0059 int nfp_app_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
0060 int nfp_app_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos,
0061             __be16 vlan_proto);
0062 int nfp_app_set_vf_rate(struct net_device *netdev, int vf, int min_tx_rate,
0063             int max_tx_rate);
0064 int nfp_app_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
0065 int nfp_app_set_vf_trust(struct net_device *netdev, int vf, bool setting);
0066 int nfp_app_set_vf_link_state(struct net_device *netdev, int vf,
0067                   int link_state);
0068 int nfp_app_get_vf_config(struct net_device *netdev, int vf,
0069               struct ifla_vf_info *ivi);
0070 
0071 #endif /* _NFP_NET_SRIOV_H_ */