diff options
author | Seokmann Ju <seokmann.ju@qlogic.com> | 2008-07-10 19:55:51 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-07-26 15:14:37 -0400 |
commit | 711c1d916be083a5bf4fbc8e66201e7e9f8b9334 (patch) | |
tree | 30ef763b5fae1f9bc1136757d3c895cf1d959aa1 /drivers/scsi | |
parent | 032d8dd739eccbb39c78c901beece70062d1820d (diff) |
[SCSI] qla2xxx: Cleanup NPIV related functions
Removed repeated or unnecessary operations during vport
creation/deletion.
Signed-off-by: Shyam Sundar <shyam.sundar@qlogic.com>
Signed-off-by: Seokmann Ju <seokmann.ju@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 6 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mid.c | 11 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 8 |
5 files changed, 4 insertions, 23 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 40b5d656ab6c..fe8d70862d59 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1200,17 +1200,11 @@ vport_create_failed_2: | |||
1200 | static int | 1200 | static int |
1201 | qla24xx_vport_delete(struct fc_vport *fc_vport) | 1201 | qla24xx_vport_delete(struct fc_vport *fc_vport) |
1202 | { | 1202 | { |
1203 | scsi_qla_host_t *ha = shost_priv(fc_vport->shost); | ||
1204 | scsi_qla_host_t *vha = fc_vport->dd_data; | 1203 | scsi_qla_host_t *vha = fc_vport->dd_data; |
1205 | 1204 | ||
1206 | qla24xx_disable_vp(vha); | 1205 | qla24xx_disable_vp(vha); |
1207 | qla24xx_deallocate_vp_id(vha); | 1206 | qla24xx_deallocate_vp_id(vha); |
1208 | 1207 | ||
1209 | mutex_lock(&ha->vport_lock); | ||
1210 | ha->cur_vport_count--; | ||
1211 | clear_bit(vha->vp_idx, ha->vp_idx_map); | ||
1212 | mutex_unlock(&ha->vport_lock); | ||
1213 | |||
1214 | kfree(vha->node_name); | 1208 | kfree(vha->node_name); |
1215 | kfree(vha->port_name); | 1209 | kfree(vha->port_name); |
1216 | 1210 | ||
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 2b1bc57adf2d..00c7052a70a3 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2170,7 +2170,6 @@ typedef struct scsi_qla_host { | |||
2170 | struct pci_dev *pdev; | 2170 | struct pci_dev *pdev; |
2171 | 2171 | ||
2172 | unsigned long host_no; | 2172 | unsigned long host_no; |
2173 | unsigned long instance; | ||
2174 | 2173 | ||
2175 | volatile struct { | 2174 | volatile struct { |
2176 | uint32_t init_done :1; | 2175 | uint32_t init_done :1; |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 5a50fb749728..1d57ddd74fd5 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -62,7 +62,6 @@ extern int ql2xfdmienable; | |||
62 | extern int ql2xallocfwdump; | 62 | extern int ql2xallocfwdump; |
63 | extern int ql2xextended_error_logging; | 63 | extern int ql2xextended_error_logging; |
64 | extern int ql2xqfullrampup; | 64 | extern int ql2xqfullrampup; |
65 | extern int num_hosts; | ||
66 | 65 | ||
67 | extern int qla2x00_loop_reset(scsi_qla_host_t *); | 66 | extern int qla2x00_loop_reset(scsi_qla_host_t *); |
68 | extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); | 67 | extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 62a3ad6e8ecb..fa35339b7b69 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -43,6 +43,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) | |||
43 | 43 | ||
44 | set_bit(vp_id, ha->vp_idx_map); | 44 | set_bit(vp_id, ha->vp_idx_map); |
45 | ha->num_vhosts++; | 45 | ha->num_vhosts++; |
46 | ha->cur_vport_count++; | ||
46 | vha->vp_idx = vp_id; | 47 | vha->vp_idx = vp_id; |
47 | list_add_tail(&vha->vp_list, &ha->vp_list); | 48 | list_add_tail(&vha->vp_list, &ha->vp_list); |
48 | mutex_unlock(&ha->vport_lock); | 49 | mutex_unlock(&ha->vport_lock); |
@@ -58,6 +59,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) | |||
58 | mutex_lock(&ha->vport_lock); | 59 | mutex_lock(&ha->vport_lock); |
59 | vp_id = vha->vp_idx; | 60 | vp_id = vha->vp_idx; |
60 | ha->num_vhosts--; | 61 | ha->num_vhosts--; |
62 | ha->cur_vport_count--; | ||
61 | clear_bit(vp_id, ha->vp_idx_map); | 63 | clear_bit(vp_id, ha->vp_idx_map); |
62 | list_del(&vha->vp_list); | 64 | list_del(&vha->vp_list); |
63 | mutex_unlock(&ha->vport_lock); | 65 | mutex_unlock(&ha->vport_lock); |
@@ -390,7 +392,6 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
390 | vha->parent = ha; | 392 | vha->parent = ha; |
391 | vha->fc_vport = fc_vport; | 393 | vha->fc_vport = fc_vport; |
392 | vha->device_flags = 0; | 394 | vha->device_flags = 0; |
393 | vha->instance = num_hosts; | ||
394 | vha->vp_idx = qla24xx_allocate_vp_id(vha); | 395 | vha->vp_idx = qla24xx_allocate_vp_id(vha); |
395 | if (vha->vp_idx > ha->max_npiv_vports) { | 396 | if (vha->vp_idx > ha->max_npiv_vports) { |
396 | DEBUG15(printk("scsi(%ld): Couldn't allocate vp_id.\n", | 397 | DEBUG15(printk("scsi(%ld): Couldn't allocate vp_id.\n", |
@@ -428,7 +429,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
428 | host->max_cmd_len = MAX_CMDSZ; | 429 | host->max_cmd_len = MAX_CMDSZ; |
429 | host->max_channel = MAX_BUSES - 1; | 430 | host->max_channel = MAX_BUSES - 1; |
430 | host->max_lun = MAX_LUNS; | 431 | host->max_lun = MAX_LUNS; |
431 | host->unique_id = vha->instance; | 432 | host->unique_id = host->host_no; |
432 | host->max_id = MAX_TARGETS_2200; | 433 | host->max_id = MAX_TARGETS_2200; |
433 | host->transportt = qla2xxx_transport_vport_template; | 434 | host->transportt = qla2xxx_transport_vport_template; |
434 | 435 | ||
@@ -436,12 +437,6 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
436 | vha->host_no, vha)); | 437 | vha->host_no, vha)); |
437 | 438 | ||
438 | vha->flags.init_done = 1; | 439 | vha->flags.init_done = 1; |
439 | num_hosts++; | ||
440 | |||
441 | mutex_lock(&ha->vport_lock); | ||
442 | set_bit(vha->vp_idx, ha->vp_idx_map); | ||
443 | ha->cur_vport_count++; | ||
444 | mutex_unlock(&ha->vport_lock); | ||
445 | 440 | ||
446 | return vha; | 441 | return vha; |
447 | 442 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 047ee644aa91..e98d502d649e 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -27,7 +27,6 @@ char qla2x00_version_str[40]; | |||
27 | */ | 27 | */ |
28 | static struct kmem_cache *srb_cachep; | 28 | static struct kmem_cache *srb_cachep; |
29 | 29 | ||
30 | int num_hosts; | ||
31 | int ql2xlogintimeout = 20; | 30 | int ql2xlogintimeout = 20; |
32 | module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); | 31 | module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); |
33 | MODULE_PARM_DESC(ql2xlogintimeout, | 32 | MODULE_PARM_DESC(ql2xlogintimeout, |
@@ -1663,9 +1662,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1663 | } | 1662 | } |
1664 | host->can_queue = ha->request_q_length + 128; | 1663 | host->can_queue = ha->request_q_length + 128; |
1665 | 1664 | ||
1666 | /* load the F/W, read paramaters, and init the H/W */ | ||
1667 | ha->instance = num_hosts; | ||
1668 | |||
1669 | mutex_init(&ha->vport_lock); | 1665 | mutex_init(&ha->vport_lock); |
1670 | init_completion(&ha->mbx_cmd_comp); | 1666 | init_completion(&ha->mbx_cmd_comp); |
1671 | complete(&ha->mbx_cmd_comp); | 1667 | complete(&ha->mbx_cmd_comp); |
@@ -1713,7 +1709,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1713 | 1709 | ||
1714 | host->this_id = 255; | 1710 | host->this_id = 255; |
1715 | host->cmd_per_lun = 3; | 1711 | host->cmd_per_lun = 3; |
1716 | host->unique_id = ha->instance; | 1712 | host->unique_id = host->host_no; |
1717 | host->max_cmd_len = MAX_CMDSZ; | 1713 | host->max_cmd_len = MAX_CMDSZ; |
1718 | host->max_channel = MAX_BUSES - 1; | 1714 | host->max_channel = MAX_BUSES - 1; |
1719 | host->max_lun = MAX_LUNS; | 1715 | host->max_lun = MAX_LUNS; |
@@ -1734,8 +1730,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1734 | ha->flags.init_done = 1; | 1730 | ha->flags.init_done = 1; |
1735 | ha->flags.online = 1; | 1731 | ha->flags.online = 1; |
1736 | 1732 | ||
1737 | num_hosts++; | ||
1738 | |||
1739 | ret = scsi_add_host(host, &pdev->dev); | 1733 | ret = scsi_add_host(host, &pdev->dev); |
1740 | if (ret) | 1734 | if (ret) |
1741 | goto probe_failed; | 1735 | goto probe_failed; |