This set of patches implements several updates to the ibmvnic driver
to fix issues that have been found in testing. Most of the updates
invovle updating queue handling during driver close and reset
operations.
-Nathan
---
John Allen (4):
ibmvnic: Track state of adapter napis
ibmvnic: Handle failover after failed init crq
ibmvnic: Send gratuitous arp on reset
ibmvnic: Non-fatal error handling
Nathan Fontenot (4):
ibmvnic: Check adapter state during ibmvnic_poll
ibmvnic: Reset the CRQ queue during driver reset
ibmvnic: Reset tx/rx pools on driver reset
ibmvnic: Reset sub-crqs during driver reset
Thomas Falcon (3):
ibmvnic: Fix cleanup of SKB's on driver close
ibmvnic: Halt TX and report carrier off on H_CLOSED return code
ibmvnic: Deactivate RX pool buffer replenishment on H_CLOSED
drivers/net/ethernet/ibm/ibmvnic.c | 259 ++++++++++++++++++++++++++++++------
drivers/net/ethernet/ibm/ibmvnic.h | 2
2 files changed, 220 insertions(+), 41 deletions(-)
From: John Allen <redacted>
Track the state of ibmvnic napis. The driver can get into states where it
can be reset when napis are already disabled and attempting to disable them
again will cause the driver to hang.
Signed-off-by: John Allen <redacted>
Signed-off-by: Nathan Fontenot <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 37 +++++++++++++++++++++++++++---------
drivers/net/ethernet/ibm/ibmvnic.h | 1 +
2 files changed, 29 insertions(+), 9 deletions(-)
From: John Allen <redacted>
Handle case where phyp sends a failover after failing to send the
init crq.
Signed-off-by: John Allen <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 11 ++++++++++-
drivers/net/ethernet/ibm/ibmvnic.h | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
From: John Allen <redacted>
Send gratuitous arp after any reset.
Signed-off-by: John Allen <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 1 +
1 file changed, 1 insertion(+)
From: Thomas Falcon <redacted>
A race condition occurs when closing the driver. Free'ing of skb's
can race between the close routine and ibmvnic_tx_interrupt. To fix
this we move the claenup of tx pools during close to after the
sub-CRQ interrupts are disabled.
Signed-off-by: Thomas Falcon <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: John Allen <redacted>
Handle non-fatal error conditions. The process to do this when
resetting the driver is to just do __ibmvnic_close followed by
__ibmvnic_open.
Signed-off-by: John Allen <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 56 ++++++++++++++++++++----------------
drivers/net/ethernet/ibm/ibmvnic.h | 1 +
2 files changed, 32 insertions(+), 25 deletions(-)
@@ -1225,37 +1225,41 @@ static int do_reset(struct ibmvnic_adapter *adapter,if(rc)returnrc;-/* remove the closed state so when we call open it appears-*wearecomingfromtheprobedstate.-*/-adapter->state=VNIC_PROBED;+if(adapter->reset_reason!=VNIC_RESET_NON_FATAL){+/* remove the closed state so when we call open it appears+*wearecomingfromtheprobedstate.+*/+adapter->state=VNIC_PROBED;-release_resources(adapter);-release_sub_crqs(adapter);-release_crq_queue(adapter);+release_resources(adapter);+release_sub_crqs(adapter);+release_crq_queue(adapter);-rc=ibmvnic_init(adapter);-if(rc)-return0;+rc=ibmvnic_init(adapter);+if(rc)+return0;-/* If the adapter was in PROBE state prior to the reset, exit here. */-if(reset_state==VNIC_PROBED)-return0;+/* If the adapter was in PROBE state prior to the reset,+*exithere.+*/+if(reset_state==VNIC_PROBED)+return0;-rc=ibmvnic_login(netdev);-if(rc){-adapter->state=VNIC_PROBED;-return0;-}+rc=ibmvnic_login(netdev);+if(rc){+adapter->state=VNIC_PROBED;+return0;+}-rtnl_lock();-rc=init_resources(adapter);-rtnl_unlock();-if(rc)-returnrc;+rtnl_lock();+rc=init_resources(adapter);+rtnl_unlock();+if(rc)+returnrc;-if(reset_state==VNIC_CLOSED)-return0;+if(reset_state==VNIC_CLOSED)+return0;+}rc=__ibmvnic_open(netdev);if(rc){
From: Thomas Falcon <redacted>
This patch disables transmissions and reports carrier off if xmit
function returns that the hardware TX queue is closed. The driver can
then await a signal from firmware to determine the correct reset method.
Signed-off-by: Thomas Falcon <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
@@ -1111,8 +1111,14 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)dev_kfree_skb_any(skb);tx_buff->skb=NULL;-if(lpar_rc==H_CLOSED)-netif_stop_subqueue(netdev,queue_num);+if(lpar_rc==H_CLOSED){+/* Disable TX and report carrier off if queue is closed.+*Firmwareguaranteesthatasignalwillbesenttothe+*driver,triggeringaresetorsomeotheraction.+*/+netif_tx_stop_all_queues(netdev);+netif_carrier_off(netdev);+}tx_send_failed++;tx_dropped++;
From: Thomas Falcon <redacted>
If H_CLOSED is returned, halt RX buffer replenishment activity
until firmware sends a notification that the driver can reset.
Signed-off-by: Thomas Falcon <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
We do not want to process any receive frames if the ibmvnic_poll
routine is invoked while a reset is in process. Also, before
replenishing the rx pools in the ibmvnic_poll, we want to
make sure the adapter is not in the process of closing.
Signed-off-by: Nathan Fontenot <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
When a driver reset operation occurs there is not a need to release
the CRQ resources and re-allocate them. Instead a reset of the CRQ
will suffice.
Signed-off-by: Nathan Fontenot <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
When resetting the ibmvnic driver there is not a need to release
and re-allocate the resources for the tx and rx pools. These
resources can just be reset to avoid the re-allocations.
Signed-off-by: Nathan Fontenot <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 71 ++++++++++++++++++++++++++++++++++--
1 file changed, 67 insertions(+), 4 deletions(-)
@@ -163,6 +163,16 @@ static long h_reg_sub_crq(unsigned long unit_address, unsigned long token,returnrc;}+staticvoidreset_long_term_buff(structibmvnic_adapter*adapter,+structibmvnic_long_term_buff*ltb)+{+memset(ltb->buff,0,ltb->size);++init_completion(&adapter->fw_done);+send_request_map(adapter,ltb->addr,ltb->size,ltb->map_id);+wait_for_completion(&adapter->fw_done);+}+staticintalloc_long_term_buff(structibmvnic_adapter*adapter,structibmvnic_long_term_buff*ltb,intsize){
@@ -352,6 +362,32 @@ static int init_stats_token(struct ibmvnic_adapter *adapter)return0;}+staticintreset_rx_pools(structibmvnic_adapter*adapter)+{+structibmvnic_rx_pool*rx_pool;+intrx_scrqs;+inti,j;++rx_scrqs=be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs);+for(i=0;i<rx_scrqs;i++){+rx_pool=&adapter->rx_pool[i];++reset_long_term_buff(adapter,&rx_pool->long_term_buff);++for(j=0;j<rx_pool->size;j++)+rx_pool->free_map[j]=j;++memset(rx_pool->rx_buff,0,+rx_pool->size*sizeof(structibmvnic_rx_buff));++atomic_set(&rx_pool->available,0);+rx_pool->next_alloc=0;+rx_pool->next_free=0;+}++return0;+}+staticvoidrelease_rx_pools(structibmvnic_adapter*adapter){structibmvnic_rx_pool*rx_pool;
@@ -453,6 +489,32 @@ static int init_rx_pools(struct net_device *netdev)return0;}+staticintreset_tx_pools(structibmvnic_adapter*adapter)+{+structibmvnic_tx_pool*tx_pool;+inttx_scrqs;+inti,j;++tx_scrqs=be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);+for(i=0;i<tx_scrqs;i++){+tx_pool=&adapter->tx_pool[i];++reset_long_term_buff(adapter,&tx_pool->long_term_buff);++memset(tx_pool->tx_buff,0,+adapter->req_tx_entries_per_subcrq*+sizeof(structibmvnic_tx_buff));++for(j=0;j<adapter->req_tx_entries_per_subcrq;j++)+tx_pool->free_map[j]=j;++tx_pool->consumer_index=0;+tx_pool->producer_index=0;+}++return0;+}+staticvoidrelease_tx_pools(structibmvnic_adapter*adapter){structibmvnic_tx_pool*tx_pool;
@@ -1258,7 +1320,6 @@ static int do_reset(struct ibmvnic_adapter *adapter,*/adapter->state=VNIC_PROBED;-release_resources(adapter);release_sub_crqs(adapter);rc=ibmvnic_init(adapter);
@@ -1277,9 +1338,11 @@ static int do_reset(struct ibmvnic_adapter *adapter,return0;}-rtnl_lock();-rc=init_resources(adapter);-rtnl_unlock();+rc=reset_tx_pools(adapter);+if(rc)+returnrc;++rc=reset_rx_pools(adapter);if(rc)returnrc;
When the ibmvnic driver is resetting, we can just reset the sub crqs
instead of releasing all of their resources and re-allocting them.
Signed-off-by: Nathan Fontenot <redacted>
---
drivers/net/ethernet/ibm/ibmvnic.c | 46 ++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 3 deletions(-)
@@ -3607,7 +3644,10 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)return-1;}-rc=init_sub_crqs(adapter);+if(adapter->resetting)+rc=reset_sub_crq_queues(adapter);+else+rc=init_sub_crqs(adapter);if(rc){dev_err(dev,"Initialization of sub crqs failed\n");release_crq_queue(adapter);
This set of patches implements several updates to the ibmvnic driver
to fix issues that have been found in testing. Most of the updates
invovle updating queue handling during driver close and reset
operations.