diff mbox

[V2,2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset.

Message ID 1439285792-12030-3-git-send-email-Viswas.G@pmcs.com (mailing list archive)
State New, archived
Headers show

Commit Message

Viswas.G@pmcs.com Aug. 11, 2015, 9:36 a.m. UTC
From: Viswas G <Viswas.G@pmcs.com>

In Nexus reset the device state request are not needed.

Changes from V1:
Device state change request has been removed as the firmware
will handle it during internal cleanup. Also updated the
proper return value in case of failures.

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
---
 drivers/scsi/pm8001/pm8001_sas.c |   18 +++++++++++++-----
 drivers/scsi/pm8001/pm8001_sas.h |    8 ++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)

Comments

Jinpu Wang Aug. 13, 2015, 12:43 p.m. UTC | #1
Hi

On Tue, Aug 11, 2015 at 11:36 AM,  <Viswas.G@pmcs.com> wrote:
> From: Viswas G <Viswas.G@pmcs.com>
>
> In Nexus reset the device state request are not needed.
>
> Changes from V1:
> Device state change request has been removed as the firmware
> will handle it during internal cleanup. Also updated the
> proper return value in case of failures.

If above is true, should we remove the device state change command
support at all?

Other than that, please feel free to add:
Acked-by: Jack Wang <jinpu.wang@profitbricks.com>

Thanks
Jack


>
> Signed-off-by: Viswas G <Viswas.G@pmcs.com>
>
> Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
> ---
>  drivers/scsi/pm8001/pm8001_sas.c |   18 +++++++++++++-----
>  drivers/scsi/pm8001/pm8001_sas.h |    8 ++++++++
>  2 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index b93f289..48f4627 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -975,19 +975,27 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)
>         phy = sas_get_local_phy(dev);
>
>         if (dev_is_sata(dev)) {
> -               DECLARE_COMPLETION_ONSTACK(completion_setstate);
>                 if (scsi_is_sas_phy_local(phy)) {
>                         rc = 0;
>                         goto out;
>                 }
>                 rc = sas_phy_reset(phy, 1);
> +               if (rc) {
> +                       PM8001_EH_DBG(pm8001_ha,
> +                       pm8001_printk("phy reset failed for device %x\n"
> +                       "with rc %d\n", pm8001_dev->device_id, rc));
> +                       rc = TMF_RESP_FUNC_FAILED;
> +                       goto out;
> +               }
>                 msleep(2000);
>                 rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
>                         dev, 1, 0);
> -               pm8001_dev->setds_completion = &completion_setstate;
> -               rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
> -                       pm8001_dev, 0x01);
> -               wait_for_completion(&completion_setstate);
> +               if (rc) {
> +                       PM8001_EH_DBG(pm8001_ha,
> +                       pm8001_printk("task abort failed %x\n"
> +                       "with rc %d\n", pm8001_dev->device_id, rc));
> +                       rc = TMF_RESP_FUNC_FAILED;
> +               }
>         } else {
>                 rc = sas_phy_reset(phy, 1);
>                 msleep(2000);
> diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
> index 8dd8b78..c9736cc 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.h
> +++ b/drivers/scsi/pm8001/pm8001_sas.h
> @@ -569,6 +569,14 @@ struct pm8001_fw_image_header {
>  #define        NCQ_READ_LOG_FLAG                       0x80000000
>  #define        NCQ_ABORT_ALL_FLAG                      0x40000000
>  #define        NCQ_2ND_RLE_FLAG                        0x20000000
> +
> +/* Device states */
> +#define DS_OPERATIONAL                         0x01
> +#define DS_PORT_IN_RESET                       0x02
> +#define DS_IN_RECOVERY                         0x03
> +#define DS_IN_ERROR                            0x04
> +#define DS_NON_OPERATIONAL                     0x07
> +
>  /**
>   * brief param structure for firmware flash update.
>   */
> --
> 1.7.1
>
Viswas.G@pmcs.com Aug. 14, 2015, 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gICAgICBpZiAoc2NzaV9pc19zYXNfcGh5X2xvY2FsKHBoeSkpIHsNCj4+ICAg
ICAgICAgICAgICAgICAgICAgICAgIHJjID0gMDsNCj4+ICAgICAgICAgICAgICAgICAgICAgICAg
IGdvdG8gb3V0Ow0KPj4gICAgICAgICAgICAgICAgIH0NCj4+ICAgICAgICAgICAgICAgICByYyA9
IHNhc19waHlfcmVzZXQocGh5LCAxKTsNCj4+ICsgICAgICAgICAgICAgICBpZiAocmMpIHsNCj4+
ICsgICAgICAgICAgICAgICAgICAgICAgIFBNODAwMV9FSF9EQkcocG04MDAxX2hhLA0KPj4gKyAg
ICAgICAgICAgICAgICAgICAgICAgcG04MDAxX3ByaW50aygicGh5IHJlc2V0IGZhaWxlZCBmb3Ig
ZGV2aWNlICV4XG4iDQo+PiArICAgICAgICAgICAgICAgICAgICAgICAid2l0aCByYyAlZFxuIiwg
cG04MDAxX2Rldi0+ZGV2aWNlX2lkLCByYykpOw0KPj4gKyAgICAgICAgICAgICAgICAgICAgICAg
cmMgPSBUTUZfUkVTUF9GVU5DX0ZBSUxFRDsNCj4+ICsgICAgICAgICAgICAgICAgICAgICAgIGdv
dG8gb3V0Ow0KPj4gKyAgICAgICAgICAgICAgIH0NCj4+ICAgICAgICAgICAgICAgICBtc2xlZXAo
MjAwMCk7DQo+PiAgICAgICAgICAgICAgICAgcmMgPSBwbTgwMDFfZXhlY19pbnRlcm5hbF90YXNr
X2Fib3J0KHBtODAwMV9oYSwgcG04MDAxX2RldiAsDQo+PiAgICAgICAgICAgICAgICAgICAgICAg
ICBkZXYsIDEsIDApOw0KPj4gLSAgICAgICAgICAgICAgIHBtODAwMV9kZXYtPnNldGRzX2NvbXBs
ZXRpb24gPSAmY29tcGxldGlvbl9zZXRzdGF0ZTsNCj4+IC0gICAgICAgICAgICAgICByYyA9IFBN
ODAwMV9DSElQX0RJU1AtPnNldF9kZXZfc3RhdGVfcmVxKHBtODAwMV9oYSwNCj4+IC0gICAgICAg
ICAgICAgICA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U3NzAwODMtNDINCj4gRmF4OiAr
NDkgMzAgNTc3MDA4NS05OA0KPiBFbWFpbDogamlucHUud2FuZ0Bwcm9maXRicmlja3MuY29tDQo+
IFVSTDogaHR0cDovL3d3dy5wcm9maXRicmlja3MuZGUNCj4NCj4gU2l0eiBkZXIgR2VzZWxsc2No
YWZ0OiBCZXJsaW4uDQo+IFJlZ2lzdGVyZ2VyaWNodDogQW10c2dlcmljaHQgQ2hhcmxvdHRlbmJ1
cmcsIEhSQiAxMjU1MDYgQi4NCj4gR2VzY2jDpGZ0c2bDvGhyZXI6IEFuZHJlYXMgR2F1Z2VyLCBB
Y2hpbSBXZWlzcy4NCj4gLS0NCj4gVG8gdW5zdWJzY3JpYmUgZnJvbSB0aGlzIGxpc3Q6IHNlbmQg
dGhlIGxpbmUgInVuc3Vic2NyaWJlIGxpbnV4LXNjc2kiIGluDQo+IHRoZSBib2R5IG9mIGEgbWVz
c2FnZSB0byBtYWpvcmRvbW9Admdlci5rZXJuZWwub3JnDQo+IE1vcmUgbWFqb3Jkb21vIGluZm8g
YXQgIGh0dHA6Ly92Z2VyLmtlcm5lbC5vcmcvbWFqb3Jkb21vLWluZm8uaHRtbA0K
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jinpu Wang Aug. 17, 2015, 7:52 a.m. UTC | #3
On Fri, Aug 14, 2015 at 9:15 AM, Viswas G <Viswas.G@pmcs.com> wrote:
> On Thu, Aug 13, 2015 at 6:13 PM, Jinpu Wang <jinpu.wang@profitbricks.com> wrote:
>> Hi
>>
>> On Tue, Aug 11, 2015 at 11:36 AM,  <Viswas.G@pmcs.com> wrote:
>>> From: Viswas G <Viswas.G@pmcs.com>
>>>
>>> In Nexus reset the device state request are not needed.
>>>
>>> Changes from V1:
>>> Device state change request has been removed as the firmware
>>> will handle it during internal cleanup. Also updated the
>>> proper return value in case of failures.
>>
>> If above is true, should we remove the device state change command
>> support at all?
>>
>
> We can't remove the state change command as it is required for
> some task management command such as ABORT_TASK.
>

Ok, thanks
Tomas Henzl Aug. 20, 2015, 2:51 p.m. UTC | #4
On 11.8.2015 11:36, Viswas.G@pmcs.com wrote:
> From: Viswas G <Viswas.G@pmcs.com>
> 
> In Nexus reset the device state request are not needed.
> 
> Changes from V1:
> Device state change request has been removed as the firmware
> will handle it during internal cleanup. Also updated the
> proper return value in case of failures.
> 
> Signed-off-by: Viswas G <Viswas.G@pmcs.com>
> 
> Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Tomas

> ---
>  drivers/scsi/pm8001/pm8001_sas.c |   18 +++++++++++++-----
>  drivers/scsi/pm8001/pm8001_sas.h |    8 ++++++++
>  2 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index b93f289..48f4627 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -975,19 +975,27 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)
>  	phy = sas_get_local_phy(dev);
>  
>  	if (dev_is_sata(dev)) {
> -		DECLARE_COMPLETION_ONSTACK(completion_setstate);
>  		if (scsi_is_sas_phy_local(phy)) {
>  			rc = 0;
>  			goto out;
>  		}
>  		rc = sas_phy_reset(phy, 1);
> +		if (rc) {
> +			PM8001_EH_DBG(pm8001_ha,
> +			pm8001_printk("phy reset failed for device %x\n"
> +			"with rc %d\n", pm8001_dev->device_id, rc));
> +			rc = TMF_RESP_FUNC_FAILED;
> +			goto out;
> +		}
>  		msleep(2000);
>  		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
>  			dev, 1, 0);
> -		pm8001_dev->setds_completion = &completion_setstate;
> -		rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
> -			pm8001_dev, 0x01);
> -		wait_for_completion(&completion_setstate);
> +		if (rc) {
> +			PM8001_EH_DBG(pm8001_ha,
> +			pm8001_printk("task abort failed %x\n"
> +			"with rc %d\n", pm8001_dev->device_id, rc));
> +			rc = TMF_RESP_FUNC_FAILED;
> +		}
>  	} else {
>  		rc = sas_phy_reset(phy, 1);
>  		msleep(2000);
> diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
> index 8dd8b78..c9736cc 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.h
> +++ b/drivers/scsi/pm8001/pm8001_sas.h
> @@ -569,6 +569,14 @@ struct pm8001_fw_image_header {
>  #define	NCQ_READ_LOG_FLAG			0x80000000
>  #define	NCQ_ABORT_ALL_FLAG			0x40000000
>  #define	NCQ_2ND_RLE_FLAG			0x20000000
> +
> +/* Device states */
> +#define DS_OPERATIONAL				0x01
> +#define DS_PORT_IN_RESET			0x02
> +#define DS_IN_RECOVERY				0x03
> +#define DS_IN_ERROR				0x04
> +#define DS_NON_OPERATIONAL			0x07
> +
>  /**
>   * brief param structure for firmware flash update.
>   */
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index b93f289..48f4627 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -975,19 +975,27 @@  int pm8001_I_T_nexus_reset(struct domain_device *dev)
 	phy = sas_get_local_phy(dev);
 
 	if (dev_is_sata(dev)) {
-		DECLARE_COMPLETION_ONSTACK(completion_setstate);
 		if (scsi_is_sas_phy_local(phy)) {
 			rc = 0;
 			goto out;
 		}
 		rc = sas_phy_reset(phy, 1);
+		if (rc) {
+			PM8001_EH_DBG(pm8001_ha,
+			pm8001_printk("phy reset failed for device %x\n"
+			"with rc %d\n", pm8001_dev->device_id, rc));
+			rc = TMF_RESP_FUNC_FAILED;
+			goto out;
+		}
 		msleep(2000);
 		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
 			dev, 1, 0);
-		pm8001_dev->setds_completion = &completion_setstate;
-		rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
-			pm8001_dev, 0x01);
-		wait_for_completion(&completion_setstate);
+		if (rc) {
+			PM8001_EH_DBG(pm8001_ha,
+			pm8001_printk("task abort failed %x\n"
+			"with rc %d\n", pm8001_dev->device_id, rc));
+			rc = TMF_RESP_FUNC_FAILED;
+		}
 	} else {
 		rc = sas_phy_reset(phy, 1);
 		msleep(2000);
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index 8dd8b78..c9736cc 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -569,6 +569,14 @@  struct pm8001_fw_image_header {
 #define	NCQ_READ_LOG_FLAG			0x80000000
 #define	NCQ_ABORT_ALL_FLAG			0x40000000
 #define	NCQ_2ND_RLE_FLAG			0x20000000
+
+/* Device states */
+#define DS_OPERATIONAL				0x01
+#define DS_PORT_IN_RESET			0x02
+#define DS_IN_RECOVERY				0x03
+#define DS_IN_ERROR				0x04
+#define DS_NON_OPERATIONAL			0x07
+
 /**
  * brief param structure for firmware flash update.
  */