scsi: libsas: Introduce struct smp_rps_resp

Similarly to sas report general and discovery responses, define the
structure struct smp_rps_resp to handle SATA PHY report responses using a
structure with a size that is exactly equal to the sas defined response
size.

With this change, struct smp_resp becomes unused and is removed.

Link: https://lore.kernel.org/r/20220609022456.409087-4-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Damien Le Moal 2022-06-09 11:24:56 +09:00 committed by Martin K. Petersen
parent 44f2bfe9ef
commit 3dafe0648d
5 changed files with 7 additions and 11 deletions

View File

@ -159,7 +159,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
flags |= OPEN_REQUIRED; flags |= OPEN_REQUIRED;
if ((dev->dev_type == SAS_SATA_DEV) || if ((dev->dev_type == SAS_SATA_DEV) ||
(dev->tproto & SAS_PROTOCOL_STP)) { (dev->tproto & SAS_PROTOCOL_STP)) {
struct smp_resp *rps_resp = &dev->sata_dev.rps_resp; struct smp_rps_resp *rps_resp = &dev->sata_dev.rps_resp;
if (rps_resp->frame_type == SMP_RESPONSE && if (rps_resp->frame_type == SMP_RESPONSE &&
rps_resp->function == SMP_REPORT_PHY_SATA && rps_resp->function == SMP_REPORT_PHY_SATA &&
rps_resp->result == SMP_RESP_FUNC_ACC) { rps_resp->result == SMP_RESP_FUNC_ACC) {

View File

@ -676,10 +676,10 @@ int sas_smp_get_phy_events(struct sas_phy *phy)
#ifdef CONFIG_SCSI_SAS_ATA #ifdef CONFIG_SCSI_SAS_ATA
#define RPS_REQ_SIZE 16 #define RPS_REQ_SIZE 16
#define RPS_RESP_SIZE 60 #define RPS_RESP_SIZE sizeof(struct smp_rps_resp)
int sas_get_report_phy_sata(struct domain_device *dev, int phy_id, int sas_get_report_phy_sata(struct domain_device *dev, int phy_id,
struct smp_resp *rps_resp) struct smp_rps_resp *rps_resp)
{ {
int res; int res;
u8 *rps_req = alloc_smp_req(RPS_REQ_SIZE); u8 *rps_req = alloc_smp_req(RPS_REQ_SIZE);

View File

@ -83,7 +83,7 @@ struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy);
struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id); struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id);
int sas_ex_phy_discover(struct domain_device *dev, int single); int sas_ex_phy_discover(struct domain_device *dev, int single);
int sas_get_report_phy_sata(struct domain_device *dev, int phy_id, int sas_get_report_phy_sata(struct domain_device *dev, int phy_id,
struct smp_resp *rps_resp); struct smp_rps_resp *rps_resp);
int sas_try_ata_reset(struct asd_sas_phy *phy); int sas_try_ata_reset(struct asd_sas_phy *phy);
void sas_hae_reset(struct work_struct *work); void sas_hae_reset(struct work_struct *work);

View File

@ -145,7 +145,7 @@ struct sata_device {
struct ata_port *ap; struct ata_port *ap;
struct ata_host *ata_host; struct ata_host *ata_host;
struct smp_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */ struct smp_rps_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */
u8 fis[ATA_RESP_FIS_SIZE]; u8 fis[ATA_RESP_FIS_SIZE];
}; };

View File

@ -712,16 +712,12 @@ struct smp_disc_resp {
struct discover_resp disc; struct discover_resp disc;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct smp_resp { struct smp_rps_resp {
u8 frame_type; u8 frame_type;
u8 function; u8 function;
u8 result; u8 result;
u8 reserved; u8 reserved;
union { struct report_phy_sata_resp rps;
struct report_general_resp rg;
struct discover_resp disc;
struct report_phy_sata_resp rps;
};
} __attribute__ ((packed)); } __attribute__ ((packed));
#endif /* _SAS_H_ */ #endif /* _SAS_H_ */