• Sameeh Jubran's avatar
    net: ena: allow queue allocation backoff when low on memory · 13ca32a6
    Sameeh Jubran authored
    If there is not enough memory to allocate io queues the driver will
    try to allocate smaller queues.
    
    The backoff algorithm is as follows:
    
    1. Try to allocate TX and RX and if successful.
    1.1. return success
    
    2. Divide by 2 the size of the larger of RX and TX queues (or both if their size is the same).
    
    3. If TX or RX is smaller than 256
    3.1. return failure.
    4. else
    4.1. go back to 1.
    
    Also change the tx_queue_size, rx_queue_size field names in struct
    adapter to requested_tx_queue_size and requested_rx_queue_size, and
    use RX and TX queue 0 for actual queue sizes.
    Explanation:
    The original fields were useless as they were simply used to assign
    values once from them to each of the queues in the adapter in ena_probe().
    They could simply be deleted. However now that we have a backoff
    feature, we have use for them. In case of backoff there is a difference
    between the requested queue sizes and the actual sizes. Therefore there
    is a need to save the requested queue size for future retries of queue
    allocation (for example if allocation failed and then ifdown + ifup was
    called we want to start the allocation from the original requested size of
    the queues).
    Signed-off-by: default avatarArthur Kiyanovski <akiyano@amazon.com>
    Signed-off-by: default avatarSameeh Jubran <sameehj@amazon.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    13ca32a6
ena_netdev.c 102 KB