RE: [PATCH 06/12] pm80xx : sysfs attribute for number of phys.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks John Garry. The intention here is to get the total number of phys for the controller through sysfs and it is used by the management utility as well. 

Regards,
Viswas G

-----Original Message-----
From: John Garry <john.garry@xxxxxxxxxx> 
Sent: Thursday, January 2, 2020 6:03 PM
To: Jinpu Wang <jinpu.wang@xxxxxxxxxxxxxxx>; Deepak Ukey - I31172 <Deepak.Ukey@xxxxxxxxxxxxx>
Cc: Linux SCSI Mailinglist <linux-scsi@xxxxxxxxxxxxxxx>; Vasanthalakshmi Tharmarajan - I30664 <Vasanthalakshmi.Tharmarajan@xxxxxxxxxxxxx>; Viswas G - I30667 <Viswas.G@xxxxxxxxxxxxx>; Jack Wang <jinpu.wang@xxxxxxxxxxxxxxxx>; Martin K. Petersen <martin.petersen@xxxxxxxxxx>; dpf@xxxxxxxxxx; yuuzheng@xxxxxxxxxx; Vikram Auradkar <auradkar@xxxxxxxxxx>; vishakhavc@xxxxxxxxxx; bjashnani@xxxxxxxxxx; Radha Ramachandran <radha@xxxxxxxxxx>; akshatzen@xxxxxxxxxx
Subject: Re: [PATCH 06/12] pm80xx : sysfs attribute for number of phys.

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

On 02/01/2020 12:07, Jinpu Wang wrote:
> On Tue, Dec 24, 2019 at 5:41 AM Deepak Ukey <mailto:deepak.ukey@xxxxxxxxxxxxx> wrote:
>>
>> From: Viswas G <mailto:Viswas.G@xxxxxxxxxxxxx>
>>
>> Added sysfs attribute to show number of phys.
>>
>> Signed-off-by: Deepak Ukey <mailto:deepak.ukey@xxxxxxxxxxxxx>
>> Signed-off-by: Viswas G <mailto:Viswas.G@xxxxxxxxxxxxx>
>> Signed-off-by: Vishakha Channapattan <mailto:vishakhavc@xxxxxxxxxx>
>> Signed-off-by: Bhavesh Jashnani <mailto:bjashnani@xxxxxxxxxx>
>> Signed-off-by: Radha Ramachandran <mailto:radha@xxxxxxxxxx>
>> Signed-off-by: Akshat Jain <mailto:akshatzen@xxxxxxxxxx>
>> Signed-off-by: Yu Zheng <mailto:yuuzheng@xxxxxxxxxx>
>> ---
>>   drivers/scsi/pm8001/pm8001_ctl.c | 20 ++++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/scsi/pm8001/pm8001_ctl.c 
>> b/drivers/scsi/pm8001/pm8001_ctl.c
>> index 69458b318a20..704c0daa7937 100644
>> --- a/drivers/scsi/pm8001/pm8001_ctl.c
>> +++ b/drivers/scsi/pm8001/pm8001_ctl.c
>> @@ -89,6 +89,25 @@ static ssize_t controller_fatal_error_show(struct device *cdev,
>>   }
>>   static DEVICE_ATTR_RO(controller_fatal_error);
>>
>> +/**
>> + * pm8001_ctl_num_phys_show - Number of phys
>> + * @cdev:pointer to embedded class device
>> + * @buf:the buffer returned
>> + * A sysfs 'read-only' shost attribute.
>> + */
>> +static ssize_t num_phys_show(struct device *cdev,
>> +               struct device_attribute *attr, char *buf)
> please use pm8001_ctl_num_phys_show as function name, so it follows 
> same conversion as other functions.
> Better also rename controller_fatal_error too.

If you don't mind me saying, this info is already available in sysfs for any libsas or even SAS host (using scsi_transport_sas.c), like this:

john@ubuntu:/sys/class/sas_phy$ ls
phy-0:0     phy-0:0:12  phy-0:0:17  phy-0:0:21  phy-0:0:4  phy-0:0:9
phy-0:5
phy-0:0:0   phy-0:0:13  phy-0:0:18  phy-0:0:22  phy-0:0:5  phy-0:1
phy-0:6
phy-0:0:1   phy-0:0:14  phy-0:0:19  phy-0:0:23  phy-0:0:6  phy-0:2
phy-0:7
phy-0:0:10  phy-0:0:15  phy-0:0:2   phy-0:0:24  phy-0:0:7  phy-0:3
phy-0:0:11  phy-0:0:16  phy-0:0:20  phy-0:0:3   phy-0:0:8  phy-0:4


Any phy-X:Y is a root phy, and X denotes the host index and Y is the phy index.

>
> Thanks
>> +{
>> +       int ret;
>> +       struct Scsi_Host *shost = class_to_shost(cdev);
>> +       struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
>> +       struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
>> +
>> +       ret = sprintf(buf, "%d", pm8001_ha->chip->n_phy);
>> +       return ret;
>> +}
>> +static DEVICE_ATTR_RO(num_phys);
>> +
>>   /**
>>    * pm8001_ctl_fw_version_show - firmware version
>>    * @cdev: pointer to embedded class device @@ -825,6 +844,7 @@ 
>> static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP,
>>   struct device_attribute *pm8001_host_attrs[] = {
>>          &dev_attr_interface_rev,
>>          &dev_attr_controller_fatal_error,
>> +       &dev_attr_num_phys,
>>          &dev_attr_fw_version,
>>          &dev_attr_update_fw,
>>          &dev_attr_aap_log,
>> --
>> 2.16.3
>>
> .
>





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux