ibmvnic: Fixes for device reset handling
cover ibmvnic: Fixes for device reset handling
This series contains three unrelated fixes to issues seen during device resets. The first patch fixes an error when the driver requests to deactivate the link of an uninitialized device, resulting in a failure to reset. Next, a patch to fix multicast transmission failures seen after a driver reset. The final patch fixes mishandling of memory allocation failures during device initialization, which caused a kernel oops.
Thomas Falcon (3):
ibmvnic: Do not close unopened driver during reset
ibmvnic: Refresh device multicast list after reset
ibmvnic: Fix unchecked return codes of memory allocations
drivers/net/ethernet/ibm/ibmvnic.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 ibmvnic: Do not close unopened driver during reset
Check driver state before halting it during a reset. If the driver is not running, do nothing. Otherwise, a request to deactivate a down link can cause an error and the reset will fail.
--- drivers/net/ethernet/ibm/ibmvnic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmvnic.c +2 -1
@@ -1745,7 +1745,8 @@ static int do_reset(struct ibmvnic_adapter *adapter,ibmvnic_cleanup (netdev); -if (adapter->reset_reason !=VNIC_RESET_MOBILITY && +if (reset_state ==VNIC_OPEN && + adapter->reset_reason !=VNIC_RESET_MOBILITY && adapter->reset_reason !=VNIC_RESET_FAILOVER ) { rc =__ibmvnic_close (netdev);if (rc)
Signature · 1 line
1.8.3.1
PATCH 2/3 ibmvnic: Refresh device multicast list after reset
In reply to Thomas FalconIt was observed that multicast packets were no longer received after a device reset. The fix is to resend the current multicast list to the backing device after recovery.
--- drivers/net/ethernet/ibm/ibmvnic.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/ibm/ibmvnic.c +3 -0
@@ -1845,6 +1845,9 @@ static int do_reset(struct ibmvnic_adapter *adapter,return 0 ; } +/* refresh device's multicast list */ +ibmvnic_set_multi (netdev); +/* kick napi */ for (i =0 ; i < adapter->req_rx_queues; i++)napi_schedule (&adapter->napi[i]);
Signature · 1 line
1.8.3.1
PATCH 3/3 ibmvnic: Fix unchecked return codes of memory allocations
In reply to Thomas FalconThe return values for these memory allocations are unchecked, which may cause an oops if the driver does not handle them after a failure. Fix by checking the function's return code.
--- drivers/net/ethernet/ibm/ibmvnic.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +7 -6
@@ -428,9 +428,10 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)if (rx_pool->buff_size !=be64_to_cpu (size_array[i])) {free_long_term_buff (adapter, &rx_pool->long_term_buff); rx_pool->buff_size =be64_to_cpu (size_array[i]); -alloc_long_term_buff (adapter, &rx_pool->long_term_buff, - rx_pool->size * - rx_pool->buff_size); + rc =alloc_long_term_buff (adapter, + &rx_pool->long_term_buff, + rx_pool->size * + rx_pool->buff_size); }else { rc =reset_long_term_buff (adapter, &rx_pool->long_term_buff);
@@ -696,9 +697,9 @@ static int init_tx_pools(struct net_device *netdev)return rc; } -init_one_tx_pool (netdev, &adapter->tso_pool[i], -IBMVNIC_TSO_BUFS , -IBMVNIC_TSO_BUF_SZ ); + rc =init_one_tx_pool (netdev, &adapter->tso_pool[i], +IBMVNIC_TSO_BUFS , +IBMVNIC_TSO_BUF_SZ );if (rc) {release_tx_pools (adapter);return rc;
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Thomas Falcon <[email protected]>
Date: Fri, 7 Jun 2019 16:03:52 -0500
Quoted 7 lines
This series contains three unrelated fixes to issues seen during device resets. The first patch fixes an error when the driver requests to deactivate the link of an uninitialized device, resulting in a failure to reset. Next, a patch to fix multicast transmission failures seen after a driver reset. The final patch fixes mishandling of memory allocation failures during device initialization, which caused a kernel oops.
Series applied, thanks.