162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright(c) 1999 - 2018 Intel Corporation. */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef _IXGBE_SRIOV_H_
562306a36Sopenharmony_ci#define _IXGBE_SRIOV_H_
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci/*  ixgbe driver limit the max number of VFs could be enabled to
862306a36Sopenharmony_ci *  63 (IXGBE_MAX_VF_FUNCTIONS - 1)
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci#define IXGBE_MAX_VFS_DRV_LIMIT  (IXGBE_MAX_VF_FUNCTIONS - 1)
1162306a36Sopenharmony_ci#define IXGBE_MAX_VFS_1TC		IXGBE_MAX_VF_FUNCTIONS
1262306a36Sopenharmony_ci#define IXGBE_MAX_VFS_4TC		32
1362306a36Sopenharmony_ci#define IXGBE_MAX_VFS_8TC		16
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#ifdef CONFIG_PCI_IOV
1662306a36Sopenharmony_civoid ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter);
1762306a36Sopenharmony_ci#endif
1862306a36Sopenharmony_civoid ixgbe_msg_task(struct ixgbe_adapter *adapter);
1962306a36Sopenharmony_ciint ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask);
2062306a36Sopenharmony_civoid ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter);
2162306a36Sopenharmony_civoid ixgbe_set_all_vfs(struct ixgbe_adapter *adapter);
2262306a36Sopenharmony_ciint ixgbe_ndo_set_vf_mac(struct net_device *netdev, int queue, u8 *mac);
2362306a36Sopenharmony_ciint ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int queue, u16 vlan,
2462306a36Sopenharmony_ci			   u8 qos, __be16 vlan_proto);
2562306a36Sopenharmony_ciint ixgbe_link_mbps(struct ixgbe_adapter *adapter);
2662306a36Sopenharmony_ciint ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate,
2762306a36Sopenharmony_ci			int max_tx_rate);
2862306a36Sopenharmony_ciint ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
2962306a36Sopenharmony_ciint ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf,
3062306a36Sopenharmony_ci				  bool setting);
3162306a36Sopenharmony_ciint ixgbe_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting);
3262306a36Sopenharmony_ciint ixgbe_ndo_get_vf_config(struct net_device *netdev,
3362306a36Sopenharmony_ci			    int vf, struct ifla_vf_info *ivi);
3462306a36Sopenharmony_ciint ixgbe_ndo_set_vf_link_state(struct net_device *netdev, int vf, int state);
3562306a36Sopenharmony_civoid ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);
3662306a36Sopenharmony_civoid ixgbe_set_vf_link_state(struct ixgbe_adapter *adapter, int vf, int state);
3762306a36Sopenharmony_ciint ixgbe_disable_sriov(struct ixgbe_adapter *adapter);
3862306a36Sopenharmony_ci#ifdef CONFIG_PCI_IOV
3962306a36Sopenharmony_civoid ixgbe_enable_sriov(struct ixgbe_adapter *adapter, unsigned int max_vfs);
4062306a36Sopenharmony_ci#endif
4162306a36Sopenharmony_ciint ixgbe_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_cistatic inline void ixgbe_set_vmvir(struct ixgbe_adapter *adapter,
4462306a36Sopenharmony_ci				   u16 vid, u16 qos, u32 vf)
4562306a36Sopenharmony_ci{
4662306a36Sopenharmony_ci	struct ixgbe_hw *hw = &adapter->hw;
4762306a36Sopenharmony_ci	u32 vmvir = vid | (qos << VLAN_PRIO_SHIFT) | IXGBE_VMVIR_VLANA_DEFAULT;
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf), vmvir);
5062306a36Sopenharmony_ci}
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#endif /* _IXGBE_SRIOV_H_ */
5362306a36Sopenharmony_ci
54