]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ice: add bitmap to track VF MSI-X usage
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Thu, 19 Oct 2023 17:32:21 +0000 (10:32 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Oct 2023 11:53:05 +0000 (12:53 +0100)
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 <michal.swiatkowski@linux.intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/intel/ice/ice.h
drivers/net/ethernet/intel/ice/ice_sriov.c

index 988b177d938836d342a8391539c20d8c8941561f..351e0d36df44cc2aa86f72aa38260dde4e0207b8 100644 (file)
@@ -554,6 +554,8 @@ struct ice_pf {
         * MSIX vectors allowed on this PF.
         */
        u16 sriov_base_vector;
+       unsigned long *sriov_irq_bm;    /* bitmap to track irq usage */
+       u16 sriov_irq_size;             /* size of the irq_bm bitmap */
 
        u16 ctrl_vsi_idx;               /* control VSI index in pf->vsi array */
 
index d345f5d8635baef4357ae22d984de8fb5b8a1ee3..49adb0b05817976b776c15b0d2184ec993b86e13 100644 (file)
@@ -138,6 +138,8 @@ static int ice_sriov_free_msix_res(struct ice_pf *pf)
        if (!pf)
                return -EINVAL;
 
+       bitmap_free(pf->sriov_irq_bm);
+       pf->sriov_irq_size = 0;
        pf->sriov_base_vector = 0;
 
        return 0;
@@ -853,10 +855,16 @@ err_free_entries:
  */
 static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs)
 {
+       int total_vectors = pf->hw.func_caps.common_cap.num_msix_vectors;
        struct device *dev = ice_pf_to_dev(pf);
        struct ice_hw *hw = &pf->hw;
        int ret;
 
+       pf->sriov_irq_bm = bitmap_zalloc(total_vectors, GFP_KERNEL);
+       if (!pf->sriov_irq_bm)
+               return -ENOMEM;
+       pf->sriov_irq_size = total_vectors;
+
        /* Disable global interrupt 0 so we don't try to handle the VFLR. */
        wr32(hw, GLINT_DYN_CTL(pf->oicr_irq.index),
             ICE_ITR_NONE << GLINT_DYN_CTL_ITR_INDX_S);
@@ -915,6 +923,7 @@ err_unroll_intr:
        /* rearm interrupts here */
        ice_irq_dynamic_ena(hw, NULL, NULL);
        clear_bit(ICE_OICR_INTR_DIS, pf->state);
+       bitmap_free(pf->sriov_irq_bm);
        return ret;
 }