• S
    igb: Fix oops caused by missing queue pairing · 72ddef05
    Shota Suzuki 提交于
    When initializing igb driver (e.g. 82576, I350), IGB_FLAG_QUEUE_PAIRS is
    set if adapter->rss_queues exceeds half of max_rss_queues in
    igb_init_queue_configuration().
    On the other hand, IGB_FLAG_QUEUE_PAIRS is not set even if the number of
    queues exceeds half of max_combined in igb_set_channels() when changing
    the number of queues by "ethtool -L".
    In this case, if numvecs is larger than MAX_MSIX_ENTRIES (10), the size
    of adapter->msix_entries[], an overflow can occur in
    igb_set_interrupt_capability(), which in turn leads to an oops.
    
    Fix this problem as follows:
     - When changing the number of queues by "ethtool -L", set
       IGB_FLAG_QUEUE_PAIRS in the same way as initializing igb driver.
     - When increasing the size of q_vector, reallocate it appropriately.
       (With IGB_FLAG_QUEUE_PAIRS set, the size of q_vector gets larger.)
    
    Another possible way to fix this problem is to cap the queues at its
    initial number, which is the number of the initial online cpus. But this
    is not the optimal way because we cannot increase queues when another
    cpu becomes online.
    
    Note that before commit cd14ef54 ("igb: Change to use statically
    allocated array for MSIx entries"), this problem did not cause oops
    but just made the number of queues become 1 because of entering msi_only
    mode in igb_set_interrupt_capability().
    
    Fixes: 907b7835 ("igb: Add ethtool support to configure number of channels")
    CC: stable <stable@vger.kernel.org>
    Signed-off-by: NShota Suzuki <suzuki_shota_t3@lab.ntt.co.jp>
    Tested-by: NAaron Brown <aaron.f.brown@intel.com>
    Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
    72ddef05
igb.h 16.1 KB