aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice.h
diff options
context:
space:
mode:
authorPreethi Banala <preethi.banala@intel.com>2018-09-19 20:23:16 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-10-02 10:16:19 -0400
commiteb0208ec42d319bc09fead0e1afe2bc0c28aeca0 (patch)
tree0af2e51b50e4ab0f45e35fa4fcb090386f071267 /drivers/net/ethernet/intel/ice/ice.h
parent5755143dd18d3b7fa97b419d18d9bb4764b7b46f (diff)
ice: Split irq_tracker into sw_irq_tracker and hw_irq_tracker
For the PF driver, when mapping interrupts to queues, we need to request IRQs from the kernel and we also have to allocate interrupts from the device. Similarly, when the VF driver (iavf.ko) initializes, it requests the kernel IRQs that it needs but it can't directly allocate interrupts in the device. Instead, it sends a mailbox message to the ice driver, which then allocates interrupts in the device on the VF driver's behalf. Currently both these cases end up having to reserve entries in pf->irq_tracker but irq_tracker itself is sized based on how many vectors the PF driver needs. Under the right circumstances, the VF driver can fail to get entries in irq_tracker, which will result in the VF driver failing probe. To fix this, sw_irq_tracker and hw_irq_tracker are introduced. The sw_irq_tracker tracks only the PF's IRQ request and doesn't play any role in VF init. hw_irq_tracker represents the device's interrupt space. When interrupts have to be allocated in the device for either PF or VF, hw_irq_tracker will be looked up to see if the device has run out of interrupts. Signed-off-by: Preethi Banala <preethi.banala@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice.h')
-rw-r--r--drivers/net/ethernet/intel/ice/ice.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 9cce4cb91401..fc6bc1233f10 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -172,7 +172,8 @@ struct ice_vsi {
172 u32 rx_buf_failed; 172 u32 rx_buf_failed;
173 u32 rx_page_failed; 173 u32 rx_page_failed;
174 int num_q_vectors; 174 int num_q_vectors;
175 int base_vector; 175 int sw_base_vector; /* Irq base for OS reserved vectors */
176 int hw_base_vector; /* HW (absolute) index of a vector */
176 enum ice_vsi_type type; 177 enum ice_vsi_type type;
177 u16 vsi_num; /* HW (absolute) index of this VSI */ 178 u16 vsi_num; /* HW (absolute) index of this VSI */
178 u16 idx; /* software index in pf->vsi[] */ 179 u16 idx; /* software index in pf->vsi[] */
@@ -240,8 +241,14 @@ enum ice_pf_flags {
240 241
241struct ice_pf { 242struct ice_pf {
242 struct pci_dev *pdev; 243 struct pci_dev *pdev;
244
245 /* OS reserved IRQ details */
243 struct msix_entry *msix_entries; 246 struct msix_entry *msix_entries;
244 struct ice_res_tracker *irq_tracker; 247 struct ice_res_tracker *sw_irq_tracker;
248
249 /* HW reserved Interrupts for this PF */
250 struct ice_res_tracker *hw_irq_tracker;
251
245 struct ice_vsi **vsi; /* VSIs created by the driver */ 252 struct ice_vsi **vsi; /* VSIs created by the driver */
246 struct ice_sw *first_sw; /* first switch created by firmware */ 253 struct ice_sw *first_sw; /* first switch created by firmware */
247 DECLARE_BITMAP(state, __ICE_STATE_NBITS); 254 DECLARE_BITMAP(state, __ICE_STATE_NBITS);
@@ -256,9 +263,11 @@ struct ice_pf {
256 struct mutex sw_mutex; /* lock for protecting VSI alloc flow */ 263 struct mutex sw_mutex; /* lock for protecting VSI alloc flow */
257 u32 msg_enable; 264 u32 msg_enable;
258 u32 hw_csum_rx_error; 265 u32 hw_csum_rx_error;
259 u32 oicr_idx; /* Other interrupt cause vector index */ 266 u32 sw_oicr_idx; /* Other interrupt cause SW vector index */
267 u32 num_avail_sw_msix; /* remaining MSIX SW vectors left unclaimed */
268 u32 hw_oicr_idx; /* Other interrupt cause vector HW index */
269 u32 num_avail_hw_msix; /* remaining HW MSIX vectors left unclaimed */
260 u32 num_lan_msix; /* Total MSIX vectors for base driver */ 270 u32 num_lan_msix; /* Total MSIX vectors for base driver */
261 u32 num_avail_msix; /* remaining MSIX vectors left unclaimed */
262 u16 num_lan_tx; /* num lan tx queues setup */ 271 u16 num_lan_tx; /* num lan tx queues setup */
263 u16 num_lan_rx; /* num lan rx queues setup */ 272 u16 num_lan_rx; /* num lan rx queues setup */
264 u16 q_left_tx; /* remaining num tx queues left unclaimed */ 273 u16 q_left_tx; /* remaining num tx queues left unclaimed */
@@ -293,8 +302,8 @@ struct ice_netdev_priv {
293static inline void ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi, 302static inline void ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi,
294 struct ice_q_vector *q_vector) 303 struct ice_q_vector *q_vector)
295{ 304{
296 u32 vector = (vsi && q_vector) ? vsi->base_vector + q_vector->v_idx : 305 u32 vector = (vsi && q_vector) ? vsi->hw_base_vector + q_vector->v_idx :
297 ((struct ice_pf *)hw->back)->oicr_idx; 306 ((struct ice_pf *)hw->back)->hw_oicr_idx;
298 int itr = ICE_ITR_NONE; 307 int itr = ICE_ITR_NONE;
299 u32 val; 308 u32 val;
300 309