Commit 711c1d91 authored by Seokmann Ju's avatar Seokmann Ju Committed by James Bottomley

[SCSI] qla2xxx: Cleanup NPIV related functions

Removed repeated or unnecessary operations during vport
creation/deletion.
Signed-off-by: default avatarShyam Sundar <shyam.sundar@qlogic.com>
Signed-off-by: default avatarSeokmann Ju <seokmann.ju@qlogic.com>
Signed-off-by: default avatarRavi Anand <ravi.anand@qlogic.com>
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 032d8dd7
...@@ -1200,17 +1200,11 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) ...@@ -1200,17 +1200,11 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
static int static int
qla24xx_vport_delete(struct fc_vport *fc_vport) qla24xx_vport_delete(struct fc_vport *fc_vport)
{ {
scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
scsi_qla_host_t *vha = fc_vport->dd_data; scsi_qla_host_t *vha = fc_vport->dd_data;
qla24xx_disable_vp(vha); qla24xx_disable_vp(vha);
qla24xx_deallocate_vp_id(vha); qla24xx_deallocate_vp_id(vha);
mutex_lock(&ha->vport_lock);
ha->cur_vport_count--;
clear_bit(vha->vp_idx, ha->vp_idx_map);
mutex_unlock(&ha->vport_lock);
kfree(vha->node_name); kfree(vha->node_name);
kfree(vha->port_name); kfree(vha->port_name);
......
...@@ -2170,7 +2170,6 @@ typedef struct scsi_qla_host { ...@@ -2170,7 +2170,6 @@ typedef struct scsi_qla_host {
struct pci_dev *pdev; struct pci_dev *pdev;
unsigned long host_no; unsigned long host_no;
unsigned long instance;
volatile struct { volatile struct {
uint32_t init_done :1; uint32_t init_done :1;
......
...@@ -62,7 +62,6 @@ extern int ql2xfdmienable; ...@@ -62,7 +62,6 @@ extern int ql2xfdmienable;
extern int ql2xallocfwdump; extern int ql2xallocfwdump;
extern int ql2xextended_error_logging; extern int ql2xextended_error_logging;
extern int ql2xqfullrampup; extern int ql2xqfullrampup;
extern int num_hosts;
extern int qla2x00_loop_reset(scsi_qla_host_t *); extern int qla2x00_loop_reset(scsi_qla_host_t *);
extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
......
...@@ -43,6 +43,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) ...@@ -43,6 +43,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
set_bit(vp_id, ha->vp_idx_map); set_bit(vp_id, ha->vp_idx_map);
ha->num_vhosts++; ha->num_vhosts++;
ha->cur_vport_count++;
vha->vp_idx = vp_id; vha->vp_idx = vp_id;
list_add_tail(&vha->vp_list, &ha->vp_list); list_add_tail(&vha->vp_list, &ha->vp_list);
mutex_unlock(&ha->vport_lock); mutex_unlock(&ha->vport_lock);
...@@ -58,6 +59,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) ...@@ -58,6 +59,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
mutex_lock(&ha->vport_lock); mutex_lock(&ha->vport_lock);
vp_id = vha->vp_idx; vp_id = vha->vp_idx;
ha->num_vhosts--; ha->num_vhosts--;
ha->cur_vport_count--;
clear_bit(vp_id, ha->vp_idx_map); clear_bit(vp_id, ha->vp_idx_map);
list_del(&vha->vp_list); list_del(&vha->vp_list);
mutex_unlock(&ha->vport_lock); mutex_unlock(&ha->vport_lock);
...@@ -390,7 +392,6 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) ...@@ -390,7 +392,6 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
vha->parent = ha; vha->parent = ha;
vha->fc_vport = fc_vport; vha->fc_vport = fc_vport;
vha->device_flags = 0; vha->device_flags = 0;
vha->instance = num_hosts;
vha->vp_idx = qla24xx_allocate_vp_id(vha); vha->vp_idx = qla24xx_allocate_vp_id(vha);
if (vha->vp_idx > ha->max_npiv_vports) { if (vha->vp_idx > ha->max_npiv_vports) {
DEBUG15(printk("scsi(%ld): Couldn't allocate vp_id.\n", DEBUG15(printk("scsi(%ld): Couldn't allocate vp_id.\n",
...@@ -428,7 +429,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) ...@@ -428,7 +429,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
host->max_cmd_len = MAX_CMDSZ; host->max_cmd_len = MAX_CMDSZ;
host->max_channel = MAX_BUSES - 1; host->max_channel = MAX_BUSES - 1;
host->max_lun = MAX_LUNS; host->max_lun = MAX_LUNS;
host->unique_id = vha->instance; host->unique_id = host->host_no;
host->max_id = MAX_TARGETS_2200; host->max_id = MAX_TARGETS_2200;
host->transportt = qla2xxx_transport_vport_template; host->transportt = qla2xxx_transport_vport_template;
...@@ -436,12 +437,6 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) ...@@ -436,12 +437,6 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
vha->host_no, vha)); vha->host_no, vha));
vha->flags.init_done = 1; vha->flags.init_done = 1;
num_hosts++;
mutex_lock(&ha->vport_lock);
set_bit(vha->vp_idx, ha->vp_idx_map);
ha->cur_vport_count++;
mutex_unlock(&ha->vport_lock);
return vha; return vha;
......
...@@ -27,7 +27,6 @@ char qla2x00_version_str[40]; ...@@ -27,7 +27,6 @@ char qla2x00_version_str[40];
*/ */
static struct kmem_cache *srb_cachep; static struct kmem_cache *srb_cachep;
int num_hosts;
int ql2xlogintimeout = 20; int ql2xlogintimeout = 20;
module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR);
MODULE_PARM_DESC(ql2xlogintimeout, MODULE_PARM_DESC(ql2xlogintimeout,
...@@ -1663,9 +1662,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1663,9 +1662,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
} }
host->can_queue = ha->request_q_length + 128; host->can_queue = ha->request_q_length + 128;
/* load the F/W, read paramaters, and init the H/W */
ha->instance = num_hosts;
mutex_init(&ha->vport_lock); mutex_init(&ha->vport_lock);
init_completion(&ha->mbx_cmd_comp); init_completion(&ha->mbx_cmd_comp);
complete(&ha->mbx_cmd_comp); complete(&ha->mbx_cmd_comp);
...@@ -1713,7 +1709,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1713,7 +1709,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
host->this_id = 255; host->this_id = 255;
host->cmd_per_lun = 3; host->cmd_per_lun = 3;
host->unique_id = ha->instance; host->unique_id = host->host_no;
host->max_cmd_len = MAX_CMDSZ; host->max_cmd_len = MAX_CMDSZ;
host->max_channel = MAX_BUSES - 1; host->max_channel = MAX_BUSES - 1;
host->max_lun = MAX_LUNS; host->max_lun = MAX_LUNS;
...@@ -1734,8 +1730,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1734,8 +1730,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
ha->flags.init_done = 1; ha->flags.init_done = 1;
ha->flags.online = 1; ha->flags.online = 1;
num_hosts++;
ret = scsi_add_host(host, &pdev->dev); ret = scsi_add_host(host, &pdev->dev);
if (ret) if (ret)
goto probe_failed; goto probe_failed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment