18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright(c) 1999 - 2018 Intel Corporation. */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _IXGBE_SRIOV_H_
58c2ecf20Sopenharmony_ci#define _IXGBE_SRIOV_H_
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/*  ixgbe driver limit the max number of VFs could be enabled to
88c2ecf20Sopenharmony_ci *  63 (IXGBE_MAX_VF_FUNCTIONS - 1)
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#define IXGBE_MAX_VFS_DRV_LIMIT  (IXGBE_MAX_VF_FUNCTIONS - 1)
118c2ecf20Sopenharmony_ci#define IXGBE_MAX_VFS_1TC		IXGBE_MAX_VF_FUNCTIONS
128c2ecf20Sopenharmony_ci#define IXGBE_MAX_VFS_4TC		32
138c2ecf20Sopenharmony_ci#define IXGBE_MAX_VFS_8TC		16
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI_IOV
168c2ecf20Sopenharmony_civoid ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter);
178c2ecf20Sopenharmony_ci#endif
188c2ecf20Sopenharmony_civoid ixgbe_msg_task(struct ixgbe_adapter *adapter);
198c2ecf20Sopenharmony_ciint ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask);
208c2ecf20Sopenharmony_civoid ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter);
218c2ecf20Sopenharmony_civoid ixgbe_set_all_vfs(struct ixgbe_adapter *adapter);
228c2ecf20Sopenharmony_ciint ixgbe_ndo_set_vf_mac(struct net_device *netdev, int queue, u8 *mac);
238c2ecf20Sopenharmony_ciint ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int queue, u16 vlan,
248c2ecf20Sopenharmony_ci			   u8 qos, __be16 vlan_proto);
258c2ecf20Sopenharmony_ciint ixgbe_link_mbps(struct ixgbe_adapter *adapter);
268c2ecf20Sopenharmony_ciint ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate,
278c2ecf20Sopenharmony_ci			int max_tx_rate);
288c2ecf20Sopenharmony_ciint ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
298c2ecf20Sopenharmony_ciint ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf,
308c2ecf20Sopenharmony_ci				  bool setting);
318c2ecf20Sopenharmony_ciint ixgbe_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting);
328c2ecf20Sopenharmony_ciint ixgbe_ndo_get_vf_config(struct net_device *netdev,
338c2ecf20Sopenharmony_ci			    int vf, struct ifla_vf_info *ivi);
348c2ecf20Sopenharmony_ciint ixgbe_ndo_set_vf_link_state(struct net_device *netdev, int vf, int state);
358c2ecf20Sopenharmony_civoid ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);
368c2ecf20Sopenharmony_civoid ixgbe_set_vf_link_state(struct ixgbe_adapter *adapter, int vf, int state);
378c2ecf20Sopenharmony_ciint ixgbe_disable_sriov(struct ixgbe_adapter *adapter);
388c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI_IOV
398c2ecf20Sopenharmony_civoid ixgbe_enable_sriov(struct ixgbe_adapter *adapter, unsigned int max_vfs);
408c2ecf20Sopenharmony_ci#endif
418c2ecf20Sopenharmony_ciint ixgbe_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistatic inline void ixgbe_set_vmvir(struct ixgbe_adapter *adapter,
448c2ecf20Sopenharmony_ci				   u16 vid, u16 qos, u32 vf)
458c2ecf20Sopenharmony_ci{
468c2ecf20Sopenharmony_ci	struct ixgbe_hw *hw = &adapter->hw;
478c2ecf20Sopenharmony_ci	u32 vmvir = vid | (qos << VLAN_PRIO_SHIFT) | IXGBE_VMVIR_VLANA_DEFAULT;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf), vmvir);
508c2ecf20Sopenharmony_ci}
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#endif /* _IXGBE_SRIOV_H_ */
538c2ecf20Sopenharmony_ci
54