Linux Audio

Check our new training course

Linux kernel drivers training

Mar 31-Apr 9, 2025, special US time zones
Register
Loading...
v6.13.7
  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 ice_pf *pf, u16 vf_id, const u8 *mac);
 32int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac);
 33int
 34ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi);
 35
 36void ice_free_vfs(struct ice_pf *pf);
 37void ice_restore_all_vfs_msi_state(struct ice_pf *pf);
 
 
 
 
 38
 39int
 40ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
 41		     __be16 vlan_proto);
 42
 43int
 44ice_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
 45	      int max_tx_rate);
 46
 47int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted);
 48
 49int ice_set_vf_link_state(struct net_device *netdev, int vf_id, int link_state);
 50
 51int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena);
 52
 53void ice_calc_vf_reg_idx(struct ice_vf *vf, struct ice_q_vector *q_vector);
 54
 55int
 56ice_get_vf_stats(struct net_device *netdev, int vf_id,
 57		 struct ifla_vf_stats *vf_stats);
 58void
 59ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);
 60void ice_print_vfs_mdd_events(struct ice_pf *pf);
 61void ice_print_vf_rx_mdd_event(struct ice_vf *vf);
 62void ice_print_vf_tx_mdd_event(struct ice_vf *vf);
 63bool
 64ice_vc_validate_pattern(struct ice_vf *vf, struct virtchnl_proto_hdrs *proto);
 65u32 ice_sriov_get_vf_total_msix(struct pci_dev *pdev);
 66int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count);
 67#else /* CONFIG_PCI_IOV */
 68static inline void ice_process_vflr_event(struct ice_pf *pf) { }
 69static inline void ice_free_vfs(struct ice_pf *pf) { }
 70static inline
 
 
 71void ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event) { }
 72static inline void ice_print_vfs_mdd_events(struct ice_pf *pf) { }
 73static inline void ice_print_vf_rx_mdd_event(struct ice_vf *vf) { }
 74static inline void ice_print_vf_tx_mdd_event(struct ice_vf *vf) { }
 75static inline void ice_restore_all_vfs_msi_state(struct ice_pf *pf) { }
 76
 77static inline int
 78ice_sriov_configure(struct pci_dev __always_unused *pdev,
 79		    int __always_unused num_vfs)
 
 
 80{
 81	return -EOPNOTSUPP;
 82}
 83
 84static inline int
 85__ice_set_vf_mac(struct ice_pf __always_unused *pf,
 86		 u16 __always_unused vf_id, const u8 __always_unused *mac)
 87{
 88	return -EOPNOTSUPP;
 89}
 90
 91static inline int
 92ice_set_vf_mac(struct net_device __always_unused *netdev,
 93	       int __always_unused vf_id, u8 __always_unused *mac)
 94{
 95	return -EOPNOTSUPP;
 96}
 97
 98static inline int
 99ice_get_vf_cfg(struct net_device __always_unused *netdev,
100	       int __always_unused vf_id,
101	       struct ifla_vf_info __always_unused *ivi)
102{
103	return -EOPNOTSUPP;
104}
105
106static inline int
107ice_set_vf_trust(struct net_device __always_unused *netdev,
108		 int __always_unused vf_id, bool __always_unused trusted)
109{
110	return -EOPNOTSUPP;
111}
112
113static inline int
114ice_set_vf_port_vlan(struct net_device __always_unused *netdev,
115		     int __always_unused vf_id, u16 __always_unused vid,
116		     u8 __always_unused qos, __be16 __always_unused v_proto)
117{
118	return -EOPNOTSUPP;
119}
120
121static inline int
122ice_set_vf_spoofchk(struct net_device __always_unused *netdev,
123		    int __always_unused vf_id, bool __always_unused ena)
124{
125	return -EOPNOTSUPP;
126}
127
128static inline int
129ice_set_vf_link_state(struct net_device __always_unused *netdev,
130		      int __always_unused vf_id, int __always_unused link_state)
131{
132	return -EOPNOTSUPP;
133}
134
135static inline int
136ice_set_vf_bw(struct net_device __always_unused *netdev,
137	      int __always_unused vf_id, int __always_unused min_tx_rate,
138	      int __always_unused max_tx_rate)
139{
140	return -EOPNOTSUPP;
141}
142
143static inline void
144ice_calc_vf_reg_idx(struct ice_vf __always_unused *vf,
145		    struct ice_q_vector __always_unused *q_vector)
146{
 
147}
148
149static inline int
150ice_get_vf_stats(struct net_device __always_unused *netdev,
151		 int __always_unused vf_id,
152		 struct ifla_vf_stats __always_unused *vf_stats)
153{
154	return -EOPNOTSUPP;
155}
156
157static inline u32 ice_sriov_get_vf_total_msix(struct pci_dev *pdev)
158{
159	return 0;
160}
161
162static inline int
163ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
164{
165	return -EOPNOTSUPP;
166}
167#endif /* CONFIG_PCI_IOV */
168#endif /* _ICE_SRIOV_H_ */
v6.2
  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_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event);
 37void ice_restore_all_vfs_msi_state(struct pci_dev *pdev);
 38bool
 39ice_is_malicious_vf(struct ice_pf *pf, struct ice_rq_event_info *event,
 40		    u16 num_msg_proc, u16 num_msg_pending);
 41
 42int
 43ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
 44		     __be16 vlan_proto);
 45
 46int
 47ice_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
 48	      int max_tx_rate);
 49
 50int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted);
 51
 52int ice_set_vf_link_state(struct net_device *netdev, int vf_id, int link_state);
 53
 54int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena);
 55
 56int ice_calc_vf_reg_idx(struct ice_vf *vf, struct ice_q_vector *q_vector);
 57
 58int
 59ice_get_vf_stats(struct net_device *netdev, int vf_id,
 60		 struct ifla_vf_stats *vf_stats);
 61void
 62ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);
 63void ice_print_vfs_mdd_events(struct ice_pf *pf);
 64void ice_print_vf_rx_mdd_event(struct ice_vf *vf);
 
 65bool
 66ice_vc_validate_pattern(struct ice_vf *vf, struct virtchnl_proto_hdrs *proto);
 
 
 67#else /* CONFIG_PCI_IOV */
 68static inline void ice_process_vflr_event(struct ice_pf *pf) { }
 69static inline void ice_free_vfs(struct ice_pf *pf) { }
 70static inline
 71void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event) { }
 72static inline
 73void ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event) { }
 74static inline void ice_print_vfs_mdd_events(struct ice_pf *pf) { }
 75static inline void ice_print_vf_rx_mdd_event(struct ice_vf *vf) { }
 76static inline void ice_restore_all_vfs_msi_state(struct pci_dev *pdev) { }
 
 77
 78static inline bool
 79ice_is_malicious_vf(struct ice_pf __always_unused *pf,
 80		    struct ice_rq_event_info __always_unused *event,
 81		    u16 __always_unused num_msg_proc,
 82		    u16 __always_unused num_msg_pending)
 83{
 84	return false;
 85}
 86
 87static inline int
 88ice_sriov_configure(struct pci_dev __always_unused *pdev,
 89		    int __always_unused num_vfs)
 90{
 91	return -EOPNOTSUPP;
 92}
 93
 94static inline int
 95ice_set_vf_mac(struct net_device __always_unused *netdev,
 96	       int __always_unused vf_id, u8 __always_unused *mac)
 97{
 98	return -EOPNOTSUPP;
 99}
100
101static inline int
102ice_get_vf_cfg(struct net_device __always_unused *netdev,
103	       int __always_unused vf_id,
104	       struct ifla_vf_info __always_unused *ivi)
105{
106	return -EOPNOTSUPP;
107}
108
109static inline int
110ice_set_vf_trust(struct net_device __always_unused *netdev,
111		 int __always_unused vf_id, bool __always_unused trusted)
112{
113	return -EOPNOTSUPP;
114}
115
116static inline int
117ice_set_vf_port_vlan(struct net_device __always_unused *netdev,
118		     int __always_unused vf_id, u16 __always_unused vid,
119		     u8 __always_unused qos, __be16 __always_unused v_proto)
120{
121	return -EOPNOTSUPP;
122}
123
124static inline int
125ice_set_vf_spoofchk(struct net_device __always_unused *netdev,
126		    int __always_unused vf_id, bool __always_unused ena)
127{
128	return -EOPNOTSUPP;
129}
130
131static inline int
132ice_set_vf_link_state(struct net_device __always_unused *netdev,
133		      int __always_unused vf_id, int __always_unused link_state)
134{
135	return -EOPNOTSUPP;
136}
137
138static inline int
139ice_set_vf_bw(struct net_device __always_unused *netdev,
140	      int __always_unused vf_id, int __always_unused min_tx_rate,
141	      int __always_unused max_tx_rate)
142{
143	return -EOPNOTSUPP;
144}
145
146static inline int
147ice_calc_vf_reg_idx(struct ice_vf __always_unused *vf,
148		    struct ice_q_vector __always_unused *q_vector)
149{
150	return 0;
151}
152
153static inline int
154ice_get_vf_stats(struct net_device __always_unused *netdev,
155		 int __always_unused vf_id,
156		 struct ifla_vf_stats __always_unused *vf_stats)
 
 
 
 
 
 
 
 
 
 
 
157{
158	return -EOPNOTSUPP;
159}
160#endif /* CONFIG_PCI_IOV */
161#endif /* _ICE_SRIOV_H_ */