aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorEddie Wai <eddie.wai@broadcom.com>2010-11-23 18:29:27 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:24:13 -0500
commit016ef69076f3e8f9e42f31152157f46812d25566 (patch)
treecae82f6d3e8f2aacda48396b504200a759096aeb /drivers/scsi
parent7a2962c77ced218faeeb7b5eda48abfebc578df2 (diff)
[SCSI] bnx2i: Removed the dynamic registration of CNIC
The code no longer needs to dynamically register and unregister the CNIC device. The CNIC device will be kept registered until module unload. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/bnx2i/bnx2i.h3
-rw-r--r--drivers/scsi/bnx2i/bnx2i_init.c82
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c7
3 files changed, 0 insertions, 92 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index a44b1b33fa1..2c34e22493d 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -717,14 +717,11 @@ extern struct device_attribute *bnx2i_dev_attributes[];
717 * Function Prototypes 717 * Function Prototypes
718 */ 718 */
719extern void bnx2i_identify_device(struct bnx2i_hba *hba); 719extern void bnx2i_identify_device(struct bnx2i_hba *hba);
720extern void bnx2i_register_device(struct bnx2i_hba *hba);
721 720
722extern void bnx2i_ulp_init(struct cnic_dev *dev); 721extern void bnx2i_ulp_init(struct cnic_dev *dev);
723extern void bnx2i_ulp_exit(struct cnic_dev *dev); 722extern void bnx2i_ulp_exit(struct cnic_dev *dev);
724extern void bnx2i_start(void *handle); 723extern void bnx2i_start(void *handle);
725extern void bnx2i_stop(void *handle); 724extern void bnx2i_stop(void *handle);
726extern void bnx2i_reg_dev_all(void);
727extern void bnx2i_unreg_dev_all(void);
728extern struct bnx2i_hba *get_adapter_list_head(void); 725extern struct bnx2i_hba *get_adapter_list_head(void);
729 726
730struct bnx2i_conn *bnx2i_get_conn_from_id(struct bnx2i_hba *hba, 727struct bnx2i_conn *bnx2i_get_conn_from_id(struct bnx2i_hba *hba,
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 50c2aa3b8eb..769311f6504 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -65,8 +65,6 @@ MODULE_PARM_DESC(rq_size, "Configure RQ size");
65 65
66u64 iscsi_error_mask = 0x00; 66u64 iscsi_error_mask = 0x00;
67 67
68static void bnx2i_unreg_one_device(struct bnx2i_hba *hba) ;
69
70 68
71/** 69/**
72 * bnx2i_identify_device - identifies NetXtreme II device type 70 * bnx2i_identify_device - identifies NetXtreme II device type
@@ -239,86 +237,6 @@ void bnx2i_stop(void *handle)
239} 237}
240 238
241/** 239/**
242 * bnx2i_register_device - register bnx2i adapter instance with the cnic driver
243 * @hba: Adapter instance to register
244 *
245 * registers bnx2i adapter instance with the cnic driver while holding the
246 * adapter structure lock
247 */
248void bnx2i_register_device(struct bnx2i_hba *hba)
249{
250 int rc;
251
252 if (test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state) ||
253 test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) {
254 return;
255 }
256
257 rc = hba->cnic->register_device(hba->cnic, CNIC_ULP_ISCSI, hba);
258
259 if (!rc)
260 set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic);
261}
262
263
264/**
265 * bnx2i_reg_dev_all - registers all adapter instances with the cnic driver
266 *
267 * registers all bnx2i adapter instances with the cnic driver while holding
268 * the global resource lock
269 */
270void bnx2i_reg_dev_all(void)
271{
272 struct bnx2i_hba *hba, *temp;
273
274 mutex_lock(&bnx2i_dev_lock);
275 list_for_each_entry_safe(hba, temp, &adapter_list, link)
276 bnx2i_register_device(hba);
277 mutex_unlock(&bnx2i_dev_lock);
278}
279
280
281/**
282 * bnx2i_unreg_one_device - unregister adapter instance with the cnic driver
283 * @hba: Adapter instance to unregister
284 *
285 * registers bnx2i adapter instance with the cnic driver while holding
286 * the adapter structure lock
287 */
288static void bnx2i_unreg_one_device(struct bnx2i_hba *hba)
289{
290 if (hba->ofld_conns_active ||
291 !test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic) ||
292 test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state))
293 return;
294
295 hba->cnic->unregister_device(hba->cnic, CNIC_ULP_ISCSI);
296
297 /* ep_disconnect could come before NETDEV_DOWN, driver won't
298 * see NETDEV_DOWN as it already unregistered itself.
299 */
300 hba->adapter_state = 0;
301 clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic);
302}
303
304/**
305 * bnx2i_unreg_dev_all - unregisters all bnx2i instances with the cnic driver
306 *
307 * unregisters all bnx2i adapter instances with the cnic driver while holding
308 * the global resource lock
309 */
310void bnx2i_unreg_dev_all(void)
311{
312 struct bnx2i_hba *hba, *temp;
313
314 mutex_lock(&bnx2i_dev_lock);
315 list_for_each_entry_safe(hba, temp, &adapter_list, link)
316 bnx2i_unreg_one_device(hba);
317 mutex_unlock(&bnx2i_dev_lock);
318}
319
320
321/**
322 * bnx2i_init_one - initialize an adapter instance and allocate memory resources 240 * bnx2i_init_one - initialize an adapter instance and allocate memory resources
323 * @hba: bnx2i adapter instance 241 * @hba: bnx2i adapter instance
324 * @cnic: cnic device handle 242 * @cnic: cnic device handle
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 07dd4f9036f..43b7dad8b48 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1606,8 +1606,6 @@ static struct bnx2i_hba *bnx2i_check_route(struct sockaddr *dst_addr)
1606 struct bnx2i_hba *hba; 1606 struct bnx2i_hba *hba;
1607 struct cnic_dev *cnic = NULL; 1607 struct cnic_dev *cnic = NULL;
1608 1608
1609 bnx2i_reg_dev_all();
1610
1611 hba = get_adapter_list_head(); 1609 hba = get_adapter_list_head();
1612 if (hba && hba->cnic) 1610 if (hba && hba->cnic)
1613 cnic = hba->cnic->cm_select_dev(desti, CNIC_ULP_ISCSI); 1611 cnic = hba->cnic->cm_select_dev(desti, CNIC_ULP_ISCSI);
@@ -1726,8 +1724,6 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
1726 if (shost) { 1724 if (shost) {
1727 /* driver is given scsi host to work with */ 1725 /* driver is given scsi host to work with */
1728 hba = iscsi_host_priv(shost); 1726 hba = iscsi_host_priv(shost);
1729 /* Register the device with cnic if not already done so */
1730 bnx2i_register_device(hba);
1731 } else 1727 } else
1732 /* 1728 /*
1733 * check if the given destination can be reached through 1729 * check if the given destination can be reached through
@@ -1853,7 +1849,6 @@ qp_resc_err:
1853check_busy: 1849check_busy:
1854 mutex_unlock(&hba->net_dev_lock); 1850 mutex_unlock(&hba->net_dev_lock);
1855nohba: 1851nohba:
1856 bnx2i_unreg_dev_all();
1857 return ERR_PTR(rc); 1852 return ERR_PTR(rc);
1858} 1853}
1859 1854
@@ -2089,8 +2084,6 @@ return_bnx2i_ep:
2089 2084
2090 bnx2i_free_ep(ep); 2085 bnx2i_free_ep(ep);
2091 mutex_unlock(&hba->net_dev_lock); 2086 mutex_unlock(&hba->net_dev_lock);
2092 if (!hba->ofld_conns_active)
2093 bnx2i_unreg_dev_all();
2094 2087
2095 wake_up_interruptible(&hba->eh_wait); 2088 wake_up_interruptible(&hba->eh_wait);
2096} 2089}