Commit 7ad4dfe187a4ce1eabe7e0c6364e4561dc930564

Authored by Jayamohan Kallickal
Committed by James Bottomley
1 parent 22661e25cc

[SCSI] be2iscsi: Fix displaying the Active Session Count from driver

This patch fixes the displaying of number of active
sessions in use.

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>

Showing 3 changed files with 25 additions and 0 deletions Side-by-side Diff

drivers/scsi/be2iscsi/be_main.c
... ... @@ -154,11 +154,13 @@
154 154 DEVICE_ATTR(beiscsi_drvr_ver, S_IRUGO, beiscsi_drvr_ver_disp, NULL);
155 155 DEVICE_ATTR(beiscsi_adapter_family, S_IRUGO, beiscsi_adap_family_disp, NULL);
156 156 DEVICE_ATTR(beiscsi_fw_ver, S_IRUGO, beiscsi_fw_ver_disp, NULL);
  157 +DEVICE_ATTR(beiscsi_active_cid_count, S_IRUGO, beiscsi_active_cid_disp, NULL);
157 158 struct device_attribute *beiscsi_attrs[] = {
158 159 &dev_attr_beiscsi_log_enable,
159 160 &dev_attr_beiscsi_drvr_ver,
160 161 &dev_attr_beiscsi_adapter_family,
161 162 &dev_attr_beiscsi_fw_ver,
  163 + &dev_attr_beiscsi_active_cid_count,
162 164 NULL,
163 165 };
164 166  
drivers/scsi/be2iscsi/be_mgmt.c
... ... @@ -1281,6 +1281,26 @@
1281 1281 }
1282 1282  
1283 1283 /**
  1284 + * beiscsi_active_cid_disp()- Display Sessions Active
  1285 + * @dev: ptr to device not used.
  1286 + * @attr: device attribute, not used.
  1287 + * @buf: contains formatted text Session Count
  1288 + *
  1289 + * return
  1290 + * size of the formatted string
  1291 + **/
  1292 +ssize_t
  1293 +beiscsi_active_cid_disp(struct device *dev, struct device_attribute *attr,
  1294 + char *buf)
  1295 +{
  1296 + struct Scsi_Host *shost = class_to_shost(dev);
  1297 + struct beiscsi_hba *phba = iscsi_host_priv(shost);
  1298 +
  1299 + return snprintf(buf, PAGE_SIZE, "%d\n",
  1300 + (phba->params.cxns_per_ctrl - phba->avlbl_cids));
  1301 +}
  1302 +
  1303 +/**
1284 1304 * beiscsi_adap_family_disp()- Display adapter family.
1285 1305 * @dev: ptr to device to get priv structure
1286 1306 * @attr: device attribute, not used.
drivers/scsi/be2iscsi/be_mgmt.h
... ... @@ -315,6 +315,9 @@
315 315 ssize_t beiscsi_fw_ver_disp(struct device *dev,
316 316 struct device_attribute *attr, char *buf);
317 317  
  318 +ssize_t beiscsi_active_cid_disp(struct device *dev,
  319 + struct device_attribute *attr, char *buf);
  320 +
318 321 ssize_t beiscsi_adap_family_disp(struct device *dev,
319 322 struct device_attribute *attr, char *buf);
320 323