• Sukadev Bhattiprolu's avatar
    ibmvnic: Reuse tx pools when possible · bbd80930
    Sukadev Bhattiprolu authored
    Rather than releasing the tx pools on every close and reallocating
    them on open, reuse the tx pools unless the pool parameters (number
    of pools, size of each pool or size of each buffer in a pool) have
    changed.
    
    If the pool parameters changed, then release the old pools (if
    any) and allocate new ones.
    
    Specifically release tx pools, if:
    	- adapter is removed,
    	- pool parameters change during reset,
    	- we encounter an error when opening the adapter in response
    	  to a user request (in ibmvnic_open()).
    
    and don't release them:
    	- in __ibmvnic_close() or
    	- on errors in __ibmvnic_open()
    
    in the hope that we can reuse them during this or next reset.
    
    With these changes reset_tx_pools() can be dropped because its
    optimization is now included in init_tx_pools() itself.
    
    cleanup_tx_pools() releases all the skbs associated with the pool and
    is called from ibmvnic_cleanup(), which is called on every reset. Since
    we want to reuse skbs across resets, move cleanup_tx_pools() out of
    ibmvnic_cleanup() and call it only when user closes the adapter.
    
    Add two new adapter fields, ->prev_mtu, ->prev_tx_pool_size to track the
    previous values and use them to decide whether to reuse or realloc the
    pools.
    Reviewed-by: default avatarRick Lindsley <ricklind@linux.vnet.ibm.com>
    Reviewed-by: default avatarDany Madden <drt@linux.ibm.com>
    Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    bbd80930
ibmvnic.h 23.3 KB