aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Fontenot <nfont@linux.vnet.ibm.com>2018-04-06 19:37:06 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-08 12:39:47 -0400
commit30f796258c49baa313222456bcf5b0246da55ff1 (patch)
treebf407ed2e5cb059ec44d637240969abd095ba4e1
parent5a18e1e0c193b2f6a8d4651f38aaabee58080647 (diff)
ibmvnic: Do not reset CRQ for Mobility driver resets
When resetting the ibmvnic driver after a partition migration occurs there is no requirement to do a reset of the main CRQ. The current driver code does the required re-enable of the main CRQ, then does a reset of the main CRQ later. What we should be doing for a driver reset after a migration is to re-enable the main CRQ, release all the sub-CRQs, and then allocate new sub-CRQs after capability negotiation. This patch updates the handling of mobility resets to do the proper work and not reset the main CRQ. To do this the initialization/reset of the main CRQ had to be moved out of the ibmvnic_init routine and in to the ibmvnic_probe and do_reset routines. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 151542e79884..aad5658d79d5 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -118,6 +118,7 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter);
118static int ibmvnic_init(struct ibmvnic_adapter *); 118static int ibmvnic_init(struct ibmvnic_adapter *);
119static void release_crq_queue(struct ibmvnic_adapter *); 119static void release_crq_queue(struct ibmvnic_adapter *);
120static int __ibmvnic_set_mac(struct net_device *netdev, struct sockaddr *p); 120static int __ibmvnic_set_mac(struct net_device *netdev, struct sockaddr *p);
121static int init_crq_queue(struct ibmvnic_adapter *adapter);
121 122
122struct ibmvnic_stat { 123struct ibmvnic_stat {
123 char name[ETH_GSTRING_LEN]; 124 char name[ETH_GSTRING_LEN];
@@ -1224,7 +1225,6 @@ static int __ibmvnic_close(struct net_device *netdev)
1224 rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN); 1225 rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
1225 if (rc) 1226 if (rc)
1226 return rc; 1227 return rc;
1227 ibmvnic_cleanup(netdev);
1228 adapter->state = VNIC_CLOSED; 1228 adapter->state = VNIC_CLOSED;
1229 return 0; 1229 return 0;
1230} 1230}
@@ -1244,6 +1244,7 @@ static int ibmvnic_close(struct net_device *netdev)
1244 1244
1245 mutex_lock(&adapter->reset_lock); 1245 mutex_lock(&adapter->reset_lock);
1246 rc = __ibmvnic_close(netdev); 1246 rc = __ibmvnic_close(netdev);
1247 ibmvnic_cleanup(netdev);
1247 mutex_unlock(&adapter->reset_lock); 1248 mutex_unlock(&adapter->reset_lock);
1248 1249
1249 return rc; 1250 return rc;
@@ -1726,14 +1727,10 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1726 old_num_rx_queues = adapter->req_rx_queues; 1727 old_num_rx_queues = adapter->req_rx_queues;
1727 old_num_tx_queues = adapter->req_tx_queues; 1728 old_num_tx_queues = adapter->req_tx_queues;
1728 1729
1729 if (rwi->reset_reason == VNIC_RESET_MOBILITY) { 1730 ibmvnic_cleanup(netdev);
1730 rc = ibmvnic_reenable_crq_queue(adapter); 1731
1731 if (rc) 1732 if (adapter->reset_reason != VNIC_RESET_MOBILITY &&
1732 return 0; 1733 adapter->reset_reason != VNIC_RESET_FAILOVER) {
1733 ibmvnic_cleanup(netdev);
1734 } else if (rwi->reset_reason == VNIC_RESET_FAILOVER) {
1735 ibmvnic_cleanup(netdev);
1736 } else {
1737 rc = __ibmvnic_close(netdev); 1734 rc = __ibmvnic_close(netdev);
1738 if (rc) 1735 if (rc)
1739 return rc; 1736 return rc;
@@ -1752,6 +1749,23 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1752 */ 1749 */
1753 adapter->state = VNIC_PROBED; 1750 adapter->state = VNIC_PROBED;
1754 1751
1752 if (adapter->wait_for_reset) {
1753 rc = init_crq_queue(adapter);
1754 } else if (adapter->reset_reason == VNIC_RESET_MOBILITY) {
1755 rc = ibmvnic_reenable_crq_queue(adapter);
1756 release_sub_crqs(adapter, 1);
1757 } else {
1758 rc = ibmvnic_reset_crq(adapter);
1759 if (!rc)
1760 rc = vio_enable_interrupts(adapter->vdev);
1761 }
1762
1763 if (rc) {
1764 netdev_err(adapter->netdev,
1765 "Couldn't initialize crq. rc=%d\n", rc);
1766 return rc;
1767 }
1768
1755 rc = ibmvnic_init(adapter); 1769 rc = ibmvnic_init(adapter);
1756 if (rc) 1770 if (rc)
1757 return IBMVNIC_INIT_FAILED; 1771 return IBMVNIC_INIT_FAILED;
@@ -4500,19 +4514,6 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
4500 u64 old_num_rx_queues, old_num_tx_queues; 4514 u64 old_num_rx_queues, old_num_tx_queues;
4501 int rc; 4515 int rc;
4502 4516
4503 if (adapter->resetting && !adapter->wait_for_reset) {
4504 rc = ibmvnic_reset_crq(adapter);
4505 if (!rc)
4506 rc = vio_enable_interrupts(adapter->vdev);
4507 } else {
4508 rc = init_crq_queue(adapter);
4509 }
4510
4511 if (rc) {
4512 dev_err(dev, "Couldn't initialize crq. rc=%d\n", rc);
4513 return rc;
4514 }
4515
4516 adapter->from_passive_init = false; 4517 adapter->from_passive_init = false;
4517 4518
4518 old_num_rx_queues = adapter->req_rx_queues; 4519 old_num_rx_queues = adapter->req_rx_queues;
@@ -4537,7 +4538,8 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
4537 return -1; 4538 return -1;
4538 } 4539 }
4539 4540
4540 if (adapter->resetting && !adapter->wait_for_reset) { 4541 if (adapter->resetting && !adapter->wait_for_reset &&
4542 adapter->reset_reason != VNIC_RESET_MOBILITY) {
4541 if (adapter->req_rx_queues != old_num_rx_queues || 4543 if (adapter->req_rx_queues != old_num_rx_queues ||
4542 adapter->req_tx_queues != old_num_tx_queues) { 4544 adapter->req_tx_queues != old_num_tx_queues) {
4543 release_sub_crqs(adapter, 0); 4545 release_sub_crqs(adapter, 0);
@@ -4625,6 +4627,13 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
4625 adapter->mac_change_pending = false; 4627 adapter->mac_change_pending = false;
4626 4628
4627 do { 4629 do {
4630 rc = init_crq_queue(adapter);
4631 if (rc) {
4632 dev_err(&dev->dev, "Couldn't initialize crq. rc=%d\n",
4633 rc);
4634 goto ibmvnic_init_fail;
4635 }
4636
4628 rc = ibmvnic_init(adapter); 4637 rc = ibmvnic_init(adapter);
4629 if (rc && rc != EAGAIN) 4638 if (rc && rc != EAGAIN)
4630 goto ibmvnic_init_fail; 4639 goto ibmvnic_init_fail;