]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/scsi/be2iscsi/be_mgmt.c
[SCSI] be2iscsi: Fix CID allocation/freeing to support Dual chute mode
[karo-tx-linux.git] / drivers / scsi / be2iscsi / be_mgmt.c
index 75756d72253827ba81084356aeba4f1d53439bf7..fcb9976e5ec61be6d2f0972a35680283300aaad9 100644 (file)
@@ -1338,9 +1338,21 @@ beiscsi_active_cid_disp(struct device *dev, struct device_attribute *attr,
 {
        struct Scsi_Host *shost = class_to_shost(dev);
        struct beiscsi_hba *phba = iscsi_host_priv(shost);
+       uint16_t avlbl_cids = 0, ulp_num, len = 0, total_cids = 0;
+
+       for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) {
+               if (test_bit(ulp_num, (void *)&phba->fw_config.ulp_supported)) {
+                       avlbl_cids = BEISCSI_ULP_AVLBL_CID(phba, ulp_num);
+                       total_cids = BEISCSI_GET_CID_COUNT(phba, ulp_num);
+                       len += snprintf(buf+len, PAGE_SIZE - len,
+                                       "ULP%d : %d\n", ulp_num,
+                                       (total_cids - avlbl_cids));
+               } else
+                       len += snprintf(buf+len, PAGE_SIZE - len,
+                                       "ULP%d : %d\n", ulp_num, 0);
+       }
 
-       return snprintf(buf, PAGE_SIZE, "%d\n",
-                      (phba->params.cxns_per_ctrl - phba->avlbl_cids));
+       return len;
 }
 
 /**