smartpqi_init.c (b212c2510d7ca15af8758eade5e4002ed5267d1b) smartpqi_init.c (3406384b76a77ea3b3bab7923c1a3bd4649318f5)
1/*
2 * driver for Microsemi PQI-based storage controllers
3 * Copyright (c) 2016-2017 Microsemi Corporation
4 * Copyright (c) 2016 PMC-Sierra, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.

--- 2651 unchanged lines hidden (view full) ---

2660{
2661 int rc;
2662
2663 switch (response->response_code) {
2664 case SOP_TMF_COMPLETE:
2665 case SOP_TMF_FUNCTION_SUCCEEDED:
2666 rc = 0;
2667 break;
1/*
2 * driver for Microsemi PQI-based storage controllers
3 * Copyright (c) 2016-2017 Microsemi Corporation
4 * Copyright (c) 2016 PMC-Sierra, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.

--- 2651 unchanged lines hidden (view full) ---

2660{
2661 int rc;
2662
2663 switch (response->response_code) {
2664 case SOP_TMF_COMPLETE:
2665 case SOP_TMF_FUNCTION_SUCCEEDED:
2666 rc = 0;
2667 break;
2668 case SOP_TMF_REJECTED:
2669 rc = -EAGAIN;
2670 break;
2668 default:
2669 rc = -EIO;
2670 break;
2671 }
2672
2673 return rc;
2674}
2675

--- 2537 unchanged lines hidden (view full) ---

5213 if (rc == 0)
5214 rc = io_request->status;
5215
5216 pqi_free_io_request(io_request);
5217
5218 return rc;
5219}
5220
2671 default:
2672 rc = -EIO;
2673 break;
2674 }
2675
2676 return rc;
2677}
2678

--- 2537 unchanged lines hidden (view full) ---

5216 if (rc == 0)
5217 rc = io_request->status;
5218
5219 pqi_free_io_request(io_request);
5220
5221 return rc;
5222}
5223
5224#define PQI_LUN_RESET_RETRIES 3
5225#define PQI_LUN_RESET_RETRY_INTERVAL_MSECS 10000
5221/* Performs a reset at the LUN level. */
5222
5223static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info,
5224 struct pqi_scsi_dev *device)
5225{
5226 int rc;
5226/* Performs a reset at the LUN level. */
5227
5228static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info,
5229 struct pqi_scsi_dev *device)
5230{
5231 int rc;
5232 unsigned int retries;
5227
5233
5228 rc = pqi_lun_reset(ctrl_info, device);
5234 for (retries = 0;;) {
5235 rc = pqi_lun_reset(ctrl_info, device);
5236 if (rc != -EAGAIN ||
5237 ++retries > PQI_LUN_RESET_RETRIES)
5238 break;
5239 msleep(PQI_LUN_RESET_RETRY_INTERVAL_MSECS);
5240 }
5229 if (rc == 0)
5230 rc = pqi_device_wait_for_pending_io(ctrl_info, device);
5231
5232 return rc == 0 ? SUCCESS : FAILED;
5233}
5234
5235static int pqi_eh_device_reset_handler(struct scsi_cmnd *scmd)
5236{

--- 2540 unchanged lines hidden ---
5241 if (rc == 0)
5242 rc = pqi_device_wait_for_pending_io(ctrl_info, device);
5243
5244 return rc == 0 ? SUCCESS : FAILED;
5245}
5246
5247static int pqi_eh_device_reset_handler(struct scsi_cmnd *scmd)
5248{

--- 2540 unchanged lines hidden ---