Skip to content

Commit ea4af9b

Browse files
Michal Swiatkowskidavem330
authored andcommitted
ice: add bitmap to track VF MSI-X usage
Create a bitamp to track MSI-X usage for VFs. The bitmap has the size of total MSI-X amount on device, because at init time the amount of MSI-X used by VFs isn't known. The bitmap is used in follow up patchset to provide a block of continuous block of MSI-X indexes for each created VF. Signed-off-by: Michal Swiatkowski <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fe1c5ca commit ea4af9b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ struct ice_pf {
554554
* MSIX vectors allowed on this PF.
555555
*/
556556
u16 sriov_base_vector;
557+
unsigned long *sriov_irq_bm; /* bitmap to track irq usage */
558+
u16 sriov_irq_size; /* size of the irq_bm bitmap */
557559

558560
u16 ctrl_vsi_idx; /* control VSI index in pf->vsi array */
559561

drivers/net/ethernet/intel/ice/ice_sriov.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ static int ice_sriov_free_msix_res(struct ice_pf *pf)
138138
if (!pf)
139139
return -EINVAL;
140140

141+
bitmap_free(pf->sriov_irq_bm);
142+
pf->sriov_irq_size = 0;
141143
pf->sriov_base_vector = 0;
142144

143145
return 0;
@@ -853,10 +855,16 @@ static int ice_create_vf_entries(struct ice_pf *pf, u16 num_vfs)
853855
*/
854856
static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs)
855857
{
858+
int total_vectors = pf->hw.func_caps.common_cap.num_msix_vectors;
856859
struct device *dev = ice_pf_to_dev(pf);
857860
struct ice_hw *hw = &pf->hw;
858861
int ret;
859862

863+
pf->sriov_irq_bm = bitmap_zalloc(total_vectors, GFP_KERNEL);
864+
if (!pf->sriov_irq_bm)
865+
return -ENOMEM;
866+
pf->sriov_irq_size = total_vectors;
867+
860868
/* Disable global interrupt 0 so we don't try to handle the VFLR. */
861869
wr32(hw, GLINT_DYN_CTL(pf->oicr_irq.index),
862870
ICE_ITR_NONE << GLINT_DYN_CTL_ITR_INDX_S);
@@ -915,6 +923,7 @@ static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs)
915923
/* rearm interrupts here */
916924
ice_irq_dynamic_ena(hw, NULL, NULL);
917925
clear_bit(ICE_OICR_INTR_DIS, pf->state);
926+
bitmap_free(pf->sriov_irq_bm);
918927
return ret;
919928
}
920929

0 commit comments

Comments
 (0)