lkml.org 
[lkml]   [2022]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 31/54] net: ethernet: replace bitmap_weight with bitmap_weight_eq for intel
    Date
    ixgbe_disable_sriov calls bitmap_weight() to compare the weight of bitmap
    with a given number. We can do it more efficiently with bitmap_weight_eq
    because conditional bitmap_weight may stop traversing the bitmap earlier,
    as soon as condition is met.

    Signed-off-by: Yury Norov <yury.norov@gmail.com>
    ---
    drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
    index 214a38de3f41..35297d8a488b 100644
    --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
    +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
    @@ -246,7 +246,7 @@ int ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
    #endif

    /* Disable VMDq flag so device will be set in VM mode */
    - if (bitmap_weight(adapter->fwd_bitmask, adapter->num_rx_pools) == 1) {
    + if (bitmap_weight_eq(adapter->fwd_bitmask, adapter->num_rx_pools, 1)) {
    adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED;
    adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED;
    rss = min_t(int, ixgbe_max_rss_indices(adapter),
    --
    2.30.2
    \
     
     \ /
      Last update: 2022-01-23 19:43    [W:9.893 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site