]> Pileus Git - ~andy/linux/commitdiff
[SCSI] be2iscsi: Fix issue of displaying adapter family.
authorJohn Soni Jose <sony.john-n@emulex.com>
Fri, 19 Oct 2012 23:15:06 +0000 (04:45 +0530)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 27 Nov 2012 04:59:41 +0000 (08:59 +0400)
Fix issue of displaying adapter family through the sysfs
entry for each Scsi_Host created for the adapter.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/be2iscsi/be_mgmt.c
drivers/scsi/be2iscsi/be_mgmt.h

index 2d28cac34f55e3a9ee0e385e8a7a5475a7f1fd4e..ea510ef656f047d911e30e022b319b9d5aa54549 100644 (file)
@@ -152,9 +152,11 @@ BEISCSI_RW_ATTR(log_enable, 0x00,
                "\t\t\t\tConfiguration Path     : 0x20\n");
 
 DEVICE_ATTR(beiscsi_drvr_ver, S_IRUGO, beiscsi_drvr_ver_disp, NULL);
+DEVICE_ATTR(beiscsi_adapter_family, S_IRUGO, beiscsi_adap_family_disp, NULL);
 struct device_attribute *beiscsi_attrs[] = {
        &dev_attr_beiscsi_log_enable,
        &dev_attr_beiscsi_drvr_ver,
+       &dev_attr_beiscsi_adapter_family,
        NULL,
 };
 
index b96a159b12c324082f3e42edc3754cb6ac23e887..ee130bc240c3a827b28269b8d9ec3e19a5081265 100644 (file)
@@ -1153,6 +1153,45 @@ beiscsi_drvr_ver_disp(struct device *dev, struct device_attribute *attr,
        return snprintf(buf, PAGE_SIZE, BE_NAME "\n");
 }
 
+/**
+ * beiscsi_adap_family_disp()- Display adapter family.
+ * @dev: ptr to device to get priv structure
+ * @attr: device attribute, not used.
+ * @buf: contains formatted text driver name and version
+ *
+ * return
+ * size of the formatted string
+ **/
+ssize_t
+beiscsi_adap_family_disp(struct device *dev, struct device_attribute *attr,
+                         char *buf)
+{
+       uint16_t dev_id = 0;
+       struct Scsi_Host *shost = class_to_shost(dev);
+       struct beiscsi_hba *phba = iscsi_host_priv(shost);
+
+       dev_id = phba->pcidev->device;
+       switch (dev_id) {
+       case BE_DEVICE_ID1:
+       case OC_DEVICE_ID1:
+       case OC_DEVICE_ID2:
+               return snprintf(buf, PAGE_SIZE, "BE2 Adapter Family\n");
+               break;
+       case BE_DEVICE_ID2:
+       case OC_DEVICE_ID3:
+               return snprintf(buf, PAGE_SIZE, "BE3-R Adapter Family\n");
+               break;
+       case OC_SKH_ID1:
+               return snprintf(buf, PAGE_SIZE, "Skyhawk-R Adapter Family\n");
+               break;
+       default:
+               return snprintf(buf, PAGE_SIZE,
+                               "Unkown Adapter Family: 0x%x\n", dev_id);
+               break;
+       }
+}
+
+
 void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
                             struct wrb_handle *pwrb_handle,
                             struct be_mem_descriptor *mem_descr)
index 4ec61274e70cb9767c448e128e39b87bc8b82878..e2c222a1cc837f2369a4cc7572707c94ac08790a 100644 (file)
@@ -305,6 +305,9 @@ int mgmt_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
 ssize_t beiscsi_drvr_ver_disp(struct device *dev,
                               struct device_attribute *attr, char *buf);
 
+ssize_t beiscsi_adap_family_disp(struct device *dev,
+                                 struct device_attribute *attr, char *buf);
+
 void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
                             struct wrb_handle *pwrb_handle,
                             struct be_mem_descriptor *mem_descr);