Linux Audio

Check our new training course

Loading...
v6.9.4
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/* Copyright (c) 2018, Intel Corporation. */
  3
  4#ifndef _ICE_SRIOV_H_
  5#define _ICE_SRIOV_H_
  6#include "ice_virtchnl_fdir.h"
  7#include "ice_vf_lib.h"
  8#include "ice_virtchnl.h"
  9
 10/* Static VF transaction/status register def */
 11#define VF_DEVICE_STATUS		0xAA
 12#define VF_TRANS_PENDING_M		0x20
 13
 14/* wait defines for polling PF_PCI_CIAD register status */
 15#define ICE_PCI_CIAD_WAIT_COUNT		100
 16#define ICE_PCI_CIAD_WAIT_DELAY_US	1
 17
 18/* VF resource constraints */
 19#define ICE_MIN_QS_PER_VF		1
 20#define ICE_NONQ_VECS_VF		1
 21#define ICE_NUM_VF_MSIX_MED		17
 22#define ICE_NUM_VF_MSIX_SMALL		5
 23#define ICE_NUM_VF_MSIX_MULTIQ_MIN	3
 24#define ICE_MIN_INTR_PER_VF		(ICE_MIN_QS_PER_VF + 1)
 25#define ICE_MAX_VF_RESET_TRIES		40
 26#define ICE_MAX_VF_RESET_SLEEP_MS	20
 27
 28#ifdef CONFIG_PCI_IOV
 29void ice_process_vflr_event(struct ice_pf *pf);
 30int ice_sriov_configure(struct pci_dev *pdev, int num_vfs);
 31int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac);
 32int
 33ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi);
 34
 35void ice_free_vfs(struct ice_pf *pf);
 36void ice_restore_all_vfs_msi_state(struct ice_pf *pf);
 37
 38int
 39ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
 40		     __be16 vlan_proto);
 41
 42int
 43ice_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
 44	      int max_tx_rate);
 45
 46int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted);
 47
 48int ice_set_vf_link_state(struct net_device *netdev, int vf_id, int link_state);
 49
 50int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena);
 51
 52int ice_calc_vf_reg_idx(struct ice_vf *vf, struct ice_q_vector *q_vector);
 53
 54int
 55ice_get_vf_stats(struct net_device *netdev, int vf_id,
 56		 struct ifla_vf_stats *vf_stats);
 57void
 58ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);
 59void ice_print_vfs_mdd_events(struct ice_pf *pf);
 60void ice_print_vf_rx_mdd_event(struct ice_vf *vf);
 61bool
 62ice_vc_validate_pattern(struct ice_vf *vf, struct virtchnl_proto_hdrs *proto);
 63u32 ice_sriov_get_vf_total_msix(struct pci_dev *pdev);
 64int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count);
 65#else /* CONFIG_PCI_IOV */
 66static inline void ice_process_vflr_event(struct ice_pf *pf) { }
 67static inline void ice_free_vfs(struct ice_pf *pf) { }
 68static inline
 69void ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event) { }
 70static inline void ice_print_vfs_mdd_events(struct ice_pf *pf) { }
 71static inline void ice_print_vf_rx_mdd_event(struct ice_vf *vf) { }
 72static inline void ice_restore_all_vfs_msi_state(struct ice_pf *pf) { }
 73
 74static inline int
 75ice_sriov_configure(struct pci_dev __always_unused *pdev,
 76		    int __always_unused num_vfs)
 77{
 78	return -EOPNOTSUPP;
 79}
 80
 81static inline int
 82ice_set_vf_mac(struct net_device __always_unused *netdev,
 83	       int __always_unused vf_id, u8 __always_unused *mac)
 84{
 85	return -EOPNOTSUPP;
 86}
 87
 88static inline int
 89ice_get_vf_cfg(struct net_device __always_unused *netdev,
 90	       int __always_unused vf_id,
 91	       struct ifla_vf_info __always_unused *ivi)
 92{
 93	return -EOPNOTSUPP;
 94}
 95
 96static inline int
 97ice_set_vf_trust(struct net_device __always_unused *netdev,
 98		 int __always_unused vf_id, bool __always_unused trusted)
 99{
100	return -EOPNOTSUPP;
101}
102
103static inline int
104ice_set_vf_port_vlan(struct net_device __always_unused *netdev,
105		     int __always_unused vf_id, u16 __always_unused vid,
106		     u8 __always_unused qos, __be16 __always_unused v_proto)
107{
108	return -EOPNOTSUPP;
109}
110
111static inline int
112ice_set_vf_spoofchk(struct net_device __always_unused *netdev,
113		    int __always_unused vf_id, bool __always_unused ena)
114{
115	return -EOPNOTSUPP;
116}
117
118static inline int
119ice_set_vf_link_state(struct net_device __always_unused *netdev,
120		      int __always_unused vf_id, int __always_unused link_state)
121{
122	return -EOPNOTSUPP;
123}
124
125static inline int
126ice_set_vf_bw(struct net_device __always_unused *netdev,
127	      int __always_unused vf_id, int __always_unused min_tx_rate,
128	      int __always_unused max_tx_rate)
129{
130	return -EOPNOTSUPP;
131}
132
133static inline int
134ice_calc_vf_reg_idx(struct ice_vf __always_unused *vf,
135		    struct ice_q_vector __always_unused *q_vector)
136{
137	return 0;
138}
139
140static inline int
141ice_get_vf_stats(struct net_device __always_unused *netdev,
142		 int __always_unused vf_id,
143		 struct ifla_vf_stats __always_unused *vf_stats)
144{
145	return -EOPNOTSUPP;
146}
147
148static inline u32 ice_sriov_get_vf_total_msix(struct pci_dev *pdev)
149{
150	return 0;
151}
152
153static inline int
154ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
155{
156	return -EOPNOTSUPP;
157}
158#endif /* CONFIG_PCI_IOV */
159#endif /* _ICE_SRIOV_H_ */
v5.14.15
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* Copyright (c) 2018, Intel Corporation. */
 3
 4#ifndef _ICE_SRIOV_H_
 5#define _ICE_SRIOV_H_
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 6
 7#include "ice_type.h"
 8#include "ice_controlq.h"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 9
10/* Defining the mailbox message threshold as 63 asynchronous
11 * pending messages. Normal VF functionality does not require
12 * sending more than 63 asynchronous pending message.
13 */
14#define ICE_ASYNC_VF_MSG_THRESHOLD	63
 
 
15
16#ifdef CONFIG_PCI_IOV
17enum ice_status
18ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 v_retval,
19		      u8 *msg, u16 msglen, struct ice_sq_cd *cd);
20
21u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed);
22enum ice_status
23ice_mbx_vf_state_handler(struct ice_hw *hw, struct ice_mbx_data *mbx_data,
24			 u16 vf_id, bool *is_mal_vf);
25enum ice_status
26ice_mbx_clear_malvf(struct ice_mbx_snapshot *snap, unsigned long *all_malvfs,
27		    u16 bitmap_len, u16 vf_id);
28enum ice_status ice_mbx_init_snapshot(struct ice_hw *hw, u16 vf_count);
29void ice_mbx_deinit_snapshot(struct ice_hw *hw);
30enum ice_status
31ice_mbx_report_malvf(struct ice_hw *hw, unsigned long *all_malvfs,
32		     u16 bitmap_len, u16 vf_id, bool *report_malvf);
33#else /* CONFIG_PCI_IOV */
34static inline enum ice_status
35ice_aq_send_msg_to_vf(struct ice_hw __always_unused *hw,
36		      u16 __always_unused vfid, u32 __always_unused v_opcode,
37		      u32 __always_unused v_retval, u8 __always_unused *msg,
38		      u16 __always_unused msglen,
39		      struct ice_sq_cd __always_unused *cd)
 
40{
41	return 0;
42}
43
44static inline u32
45ice_conv_link_speed_to_virtchnl(bool __always_unused adv_link_support,
46				u16 __always_unused link_speed)
 
 
 
 
 
 
47{
48	return 0;
49}
50
 
 
 
 
 
51#endif /* CONFIG_PCI_IOV */
52#endif /* _ICE_SRIOV_H_ */