diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-08-02 11:09:59 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-08-01 13:19:24 -0400 |
commit | 3de2a653a127c468284c48e233719dc39769e354 (patch) | |
tree | c57fd1c8b8ce28d2e2e87ddbff0ecb10ac1524f9 /drivers/scsi/lpfc/lpfc_scsi.c | |
parent | 549e55cd2a1b83ea45ac17fb6c309654a3d371a4 (diff) |
[SCSI] lpfc 8.2.2 : Attribute and Parameter splits for vport and physical port
- Split attributes up into vport and non-vport attributes.
- Move vport specific cfg params to vport
Many of the vport-specific behaviors were still global attributes
on the physical port. Move them to the vport itself.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 0284ded96bad..78666c62330e 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -84,22 +84,21 @@ lpfc_adjust_queue_depth(struct lpfc_hba *phba) | |||
84 | * SCSI command completion. | 84 | * SCSI command completion. |
85 | */ | 85 | */ |
86 | static inline void | 86 | static inline void |
87 | lpfc_rampup_queue_depth(struct lpfc_hba *phba, | 87 | lpfc_rampup_queue_depth(struct lpfc_vport *vport, |
88 | struct scsi_device *sdev) | 88 | struct scsi_device *sdev) |
89 | { | 89 | { |
90 | unsigned long flags; | 90 | unsigned long flags; |
91 | struct lpfc_hba *phba = vport->phba; | ||
91 | atomic_inc(&phba->num_cmd_success); | 92 | atomic_inc(&phba->num_cmd_success); |
92 | 93 | ||
93 | if (phba->cfg_lun_queue_depth <= sdev->queue_depth) | 94 | if (vport->cfg_lun_queue_depth <= sdev->queue_depth) |
94 | return; | 95 | return; |
95 | |||
96 | spin_lock_irqsave(&phba->hbalock, flags); | 96 | spin_lock_irqsave(&phba->hbalock, flags); |
97 | if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || | 97 | if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || |
98 | ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) { | 98 | ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) { |
99 | spin_unlock_irqrestore(&phba->hbalock, flags); | 99 | spin_unlock_irqrestore(&phba->hbalock, flags); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | |||
103 | phba->last_ramp_up_time = jiffies; | 102 | phba->last_ramp_up_time = jiffies; |
104 | spin_unlock_irqrestore(&phba->hbalock, flags); | 103 | spin_unlock_irqrestore(&phba->hbalock, flags); |
105 | 104 | ||
@@ -627,16 +626,16 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
627 | 626 | ||
628 | 627 | ||
629 | if (!result) | 628 | if (!result) |
630 | lpfc_rampup_queue_depth(phba, sdev); | 629 | lpfc_rampup_queue_depth(vport, sdev); |
631 | 630 | ||
632 | if (!result && pnode != NULL && | 631 | if (!result && pnode != NULL && |
633 | ((jiffies - pnode->last_ramp_up_time) > | 632 | ((jiffies - pnode->last_ramp_up_time) > |
634 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | 633 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && |
635 | ((jiffies - pnode->last_q_full_time) > | 634 | ((jiffies - pnode->last_q_full_time) > |
636 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | 635 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && |
637 | (phba->cfg_lun_queue_depth > sdev->queue_depth)) { | 636 | (vport->cfg_lun_queue_depth > sdev->queue_depth)) { |
638 | shost_for_each_device(tmp_sdev, sdev->host) { | 637 | shost_for_each_device(tmp_sdev, sdev->host) { |
639 | if (phba->cfg_lun_queue_depth > tmp_sdev->queue_depth) { | 638 | if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){ |
640 | if (tmp_sdev->id != sdev->id) | 639 | if (tmp_sdev->id != sdev->id) |
641 | continue; | 640 | continue; |
642 | if (tmp_sdev->ordered_tags) | 641 | if (tmp_sdev->ordered_tags) |
@@ -1099,7 +1098,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
1099 | 1098 | ||
1100 | schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ); | 1099 | schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ); |
1101 | if (++loop_count | 1100 | if (++loop_count |
1102 | > (2 * phba->cfg_devloss_tmo)/LPFC_ABORT_WAIT) | 1101 | > (2 * vport->cfg_devloss_tmo)/LPFC_ABORT_WAIT) |
1103 | break; | 1102 | break; |
1104 | } | 1103 | } |
1105 | 1104 | ||
@@ -1154,7 +1153,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
1154 | loopcnt++; | 1153 | loopcnt++; |
1155 | rdata = cmnd->device->hostdata; | 1154 | rdata = cmnd->device->hostdata; |
1156 | if (!rdata || | 1155 | if (!rdata || |
1157 | (loopcnt > ((phba->cfg_devloss_tmo * 2) + 1))) { | 1156 | (loopcnt > ((vport->cfg_devloss_tmo * 2) + 1))){ |
1158 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1157 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1159 | "%d (%d):0721 LUN Reset rport " | 1158 | "%d (%d):0721 LUN Reset rport " |
1160 | "failure: cnt x%x rdata x%p\n", | 1159 | "failure: cnt x%x rdata x%p\n", |
@@ -1230,7 +1229,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
1230 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); | 1229 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); |
1231 | 1230 | ||
1232 | if (++loopcnt | 1231 | if (++loopcnt |
1233 | > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) | 1232 | > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) |
1234 | break; | 1233 | break; |
1235 | 1234 | ||
1236 | cnt = lpfc_sli_sum_iocb(phba, | 1235 | cnt = lpfc_sli_sum_iocb(phba, |
@@ -1339,7 +1338,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
1339 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); | 1338 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); |
1340 | 1339 | ||
1341 | if (++loopcnt | 1340 | if (++loopcnt |
1342 | > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) | 1341 | > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) |
1343 | break; | 1342 | break; |
1344 | 1343 | ||
1345 | cnt = lpfc_sli_sum_iocb(phba, | 1344 | cnt = lpfc_sli_sum_iocb(phba, |
@@ -1386,7 +1385,7 @@ lpfc_slave_alloc(struct scsi_device *sdev) | |||
1386 | * extra. This list of scsi bufs exists for the lifetime of the driver. | 1385 | * extra. This list of scsi bufs exists for the lifetime of the driver. |
1387 | */ | 1386 | */ |
1388 | total = phba->total_scsi_bufs; | 1387 | total = phba->total_scsi_bufs; |
1389 | num_to_alloc = phba->cfg_lun_queue_depth + 2; | 1388 | num_to_alloc = vport->cfg_lun_queue_depth + 2; |
1390 | 1389 | ||
1391 | /* Allow some exchanges to be available always to complete discovery */ | 1390 | /* Allow some exchanges to be available always to complete discovery */ |
1392 | if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { | 1391 | if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { |
@@ -1435,9 +1434,9 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
1435 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); | 1434 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); |
1436 | 1435 | ||
1437 | if (sdev->tagged_supported) | 1436 | if (sdev->tagged_supported) |
1438 | scsi_activate_tcq(sdev, phba->cfg_lun_queue_depth); | 1437 | scsi_activate_tcq(sdev, vport->cfg_lun_queue_depth); |
1439 | else | 1438 | else |
1440 | scsi_deactivate_tcq(sdev, phba->cfg_lun_queue_depth); | 1439 | scsi_deactivate_tcq(sdev, vport->cfg_lun_queue_depth); |
1441 | 1440 | ||
1442 | /* | 1441 | /* |
1443 | * Initialize the fc transport attributes for the target | 1442 | * Initialize the fc transport attributes for the target |
@@ -1445,7 +1444,7 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
1445 | * target pointer is stored in the starget_data for the | 1444 | * target pointer is stored in the starget_data for the |
1446 | * driver's sysfs entry point functions. | 1445 | * driver's sysfs entry point functions. |
1447 | */ | 1446 | */ |
1448 | rport->dev_loss_tmo = phba->cfg_devloss_tmo; | 1447 | rport->dev_loss_tmo = vport->cfg_devloss_tmo; |
1449 | 1448 | ||
1450 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | 1449 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { |
1451 | lpfc_sli_poll_fcp_ring(phba); | 1450 | lpfc_sli_poll_fcp_ring(phba); |
@@ -1483,3 +1482,23 @@ struct scsi_host_template lpfc_template = { | |||
1483 | .shost_attrs = lpfc_hba_attrs, | 1482 | .shost_attrs = lpfc_hba_attrs, |
1484 | .max_sectors = 0xFFFF, | 1483 | .max_sectors = 0xFFFF, |
1485 | }; | 1484 | }; |
1485 | |||
1486 | struct scsi_host_template lpfc_vport_template = { | ||
1487 | .module = THIS_MODULE, | ||
1488 | .name = LPFC_DRIVER_NAME, | ||
1489 | .info = lpfc_info, | ||
1490 | .queuecommand = lpfc_queuecommand, | ||
1491 | .eh_abort_handler = lpfc_abort_handler, | ||
1492 | .eh_device_reset_handler= lpfc_device_reset_handler, | ||
1493 | .eh_bus_reset_handler = lpfc_bus_reset_handler, | ||
1494 | .slave_alloc = lpfc_slave_alloc, | ||
1495 | .slave_configure = lpfc_slave_configure, | ||
1496 | .slave_destroy = lpfc_slave_destroy, | ||
1497 | .scan_finished = lpfc_scan_finished, | ||
1498 | .this_id = -1, | ||
1499 | .sg_tablesize = LPFC_SG_SEG_CNT, | ||
1500 | .cmd_per_lun = LPFC_CMD_PER_LUN, | ||
1501 | .use_clustering = ENABLE_CLUSTERING, | ||
1502 | .shost_attrs = lpfc_vport_attrs, | ||
1503 | .max_sectors = 0xFFFF, | ||
1504 | }; | ||