• Arthur Kiyanovski's avatar
    net: ena: Fix error handling when calculating max IO queues number · 5055dc03
    Arthur Kiyanovski authored
    The role of ena_calc_max_io_queue_num() is to return the number
    of queues supported by the device, which means the return value
    should be >=0.
    
    The function that calls ena_calc_max_io_queue_num(), checks
    the return value. If it is 0, it means the device reported
    it supports 0 IO queues. This case is considered an error
    and is handled by the calling function accordingly.
    
    However the current implementation of ena_calc_max_io_queue_num()
    is wrong, since when it detects the device supports 0 IO queues,
    it returns -EFAULT.
    
    In such a case the calling function doesn't detect the error,
    and therefore doesn't handle it.
    
    This commit changes ena_calc_max_io_queue_num() to return 0
    in case the device reported it supports 0 queues, allowing the
    calling function to properly handle the error case.
    
    Fixes: 736ce3f4 ("net: ena: make ethtool -l show correct max number of queues")
    Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
    Signed-off-by: default avatarArthur Kiyanovski <akiyano@amazon.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    5055dc03
ena_netdev.c 125 KB