aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2i
diff options
context:
space:
mode:
authorEddie Wai <eddie.wai@broadcom.com>2011-06-23 18:51:35 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-06-29 17:51:00 -0400
commit3601b531987ea9f861300ae1189256f7118f4f09 (patch)
tree5877729bfc6924a3b6a538f7a50b9c8a755328c0 /drivers/scsi/bnx2i
parentb5cf6b63f73abdc051035f0050b367beeb2ef94c (diff)
[SCSI] bnx2i: Modified to skip CNIC registration if iSCSI is not supported
The init routine will now examine the cnic->max_iscsi_conn variable before registering to CNIC during ulp_init. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com> Acked-by: Michael Chan <mchan@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bnx2i')
-rw-r--r--drivers/scsi/bnx2i/bnx2i_init.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 0f7fb14c78ab..28bfa9e60d25 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -172,21 +172,14 @@ void bnx2i_start(void *handle)
172 struct bnx2i_hba *hba = handle; 172 struct bnx2i_hba *hba = handle;
173 int i = HZ; 173 int i = HZ;
174 174
175 if (!hba->cnic->max_iscsi_conn) { 175 /*
176 printk(KERN_ALERT "bnx2i: dev %s does not support " 176 * We should never register devices that don't support iSCSI
177 "iSCSI\n", hba->netdev->name); 177 * (see bnx2i_init_one), so something is wrong if we try to
178 * start a iSCSI adapter on hardware with 0 supported iSCSI
179 * connections
180 */
181 BUG_ON(!hba->cnic->max_iscsi_conn);
178 182
179 if (test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) {
180 mutex_lock(&bnx2i_dev_lock);
181 list_del_init(&hba->link);
182 adapter_count--;
183 hba->cnic->unregister_device(hba->cnic, CNIC_ULP_ISCSI);
184 clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic);
185 mutex_unlock(&bnx2i_dev_lock);
186 bnx2i_free_hba(hba);
187 }
188 return;
189 }
190 bnx2i_send_fw_iscsi_init_msg(hba); 183 bnx2i_send_fw_iscsi_init_msg(hba);
191 while (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state) && i--) 184 while (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state) && i--)
192 msleep(BNX2I_INIT_POLL_TIME); 185 msleep(BNX2I_INIT_POLL_TIME);
@@ -290,6 +283,13 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)
290 int rc; 283 int rc;
291 284
292 mutex_lock(&bnx2i_dev_lock); 285 mutex_lock(&bnx2i_dev_lock);
286 if (!cnic->max_iscsi_conn) {
287 printk(KERN_ALERT "bnx2i: dev %s does not support "
288 "iSCSI\n", hba->netdev->name);
289 rc = -EOPNOTSUPP;
290 goto out;
291 }
292
293 hba->cnic = cnic; 293 hba->cnic = cnic;
294 rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba); 294 rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba);
295 if (!rc) { 295 if (!rc) {
@@ -307,6 +307,7 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)
307 else 307 else
308 printk(KERN_ERR "bnx2i dev reg, unknown error, %d\n", rc); 308 printk(KERN_ERR "bnx2i dev reg, unknown error, %d\n", rc);
309 309
310out:
310 mutex_unlock(&bnx2i_dev_lock); 311 mutex_unlock(&bnx2i_dev_lock);
311 312
312 return rc; 313 return rc;