• Anirudh Venkataramanan's avatar
    ice: Alloc queue management bitmaps and arrays dynamically · 78b5713a
    Anirudh Venkataramanan authored
    The total number of queues available on the device is divided between
    multiple physical functions (PF) in the firmware and provided to the
    driver when it gets function capabilities from the firmware. Thus
    each PF knows how many Tx/Rx queues it has. These queues are then
    doled out to different VSIs (for LAN traffic, SR-IOV VF traffic, etc.)
    
    To track usage of these queues at the PF level, the driver uses two
    bitmaps avail_txqs and avail_rxqs. At the VSI level (i.e. struct ice_vsi
    instances) the driver uses two arrays txq_map and rxq_map, to track
    ownership of VSIs' queues in avail_txqs and avail_rxqs respectively.
    
    The aforementioned bitmaps and arrays should be allocated dynamically,
    because the number of queues supported by a PF is only available once
    function capabilities have been queried. The current static allocation
    consumes way more memory than required.
    
    This patch removes the DECLARE_BITMAP for avail_txqs and avail_rxqs
    and instead uses bitmap_zalloc to allocate the bitmaps during init.
    Similarly txq_map and rxq_map are now allocated in ice_vsi_alloc_arrays.
    As a result ICE_MAX_TXQS and ICE_MAX_RXQS defines are no longer needed.
    Also as txq_map and rxq_map are now allocated and freed, some code
    reordering was required in ice_vsi_rebuild for correct functioning.
    Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
    Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    78b5713a
ice_main.c 114 KB