diff options
author | James Smart <james.smart@emulex.com> | 2012-09-29 11:32:37 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-10-08 07:14:41 -0400 |
commit | 8b68cd5258225ca77f7595ed2e310d692dc3ee31 (patch) | |
tree | 9c372e951944e3f1e92f58b461d08e2e211ce05a /drivers | |
parent | 2eb6862aaf7ea0685c997d833c3890dae2f94a62 (diff) |
[SCSI] lpfc 8.3.35: Fixed not reporting logical link speed to SCSI midlayer when QoS not on
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 1 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw4.h | 12 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 134 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 18 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 2 |
5 files changed, 151 insertions, 16 deletions
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index e470c489de07..4380a44000bc 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -467,3 +467,4 @@ int lpfc_sli4_read_config(struct lpfc_hba *); | |||
467 | void lpfc_sli4_node_prep(struct lpfc_hba *); | 467 | void lpfc_sli4_node_prep(struct lpfc_hba *); |
468 | int lpfc_sli4_xri_sgl_update(struct lpfc_hba *); | 468 | int lpfc_sli4_xri_sgl_update(struct lpfc_hba *); |
469 | void lpfc_free_sgl_list(struct lpfc_hba *, struct list_head *); | 469 | void lpfc_free_sgl_list(struct lpfc_hba *, struct list_head *); |
470 | uint32_t lpfc_sli_port_speed_get(struct lpfc_hba *); | ||
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index e2838e90ddfc..2cdeb5434fb7 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h | |||
@@ -1305,6 +1305,11 @@ struct lpfc_mbx_mq_create_ext { | |||
1305 | #define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK | 1305 | #define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK |
1306 | #define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001 | 1306 | #define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001 |
1307 | #define lpfc_mbx_mq_create_ext_async_evt_link_WORD async_evt_bmap | 1307 | #define lpfc_mbx_mq_create_ext_async_evt_link_WORD async_evt_bmap |
1308 | #define LPFC_EVT_CODE_LINK_NO_LINK 0x0 | ||
1309 | #define LPFC_EVT_CODE_LINK_10_MBIT 0x1 | ||
1310 | #define LPFC_EVT_CODE_LINK_100_MBIT 0x2 | ||
1311 | #define LPFC_EVT_CODE_LINK_1_GBIT 0x3 | ||
1312 | #define LPFC_EVT_CODE_LINK_10_GBIT 0x4 | ||
1308 | #define lpfc_mbx_mq_create_ext_async_evt_fip_SHIFT LPFC_TRAILER_CODE_FCOE | 1313 | #define lpfc_mbx_mq_create_ext_async_evt_fip_SHIFT LPFC_TRAILER_CODE_FCOE |
1309 | #define lpfc_mbx_mq_create_ext_async_evt_fip_MASK 0x00000001 | 1314 | #define lpfc_mbx_mq_create_ext_async_evt_fip_MASK 0x00000001 |
1310 | #define lpfc_mbx_mq_create_ext_async_evt_fip_WORD async_evt_bmap | 1315 | #define lpfc_mbx_mq_create_ext_async_evt_fip_WORD async_evt_bmap |
@@ -1314,6 +1319,13 @@ struct lpfc_mbx_mq_create_ext { | |||
1314 | #define lpfc_mbx_mq_create_ext_async_evt_fc_SHIFT LPFC_TRAILER_CODE_FC | 1319 | #define lpfc_mbx_mq_create_ext_async_evt_fc_SHIFT LPFC_TRAILER_CODE_FC |
1315 | #define lpfc_mbx_mq_create_ext_async_evt_fc_MASK 0x00000001 | 1320 | #define lpfc_mbx_mq_create_ext_async_evt_fc_MASK 0x00000001 |
1316 | #define lpfc_mbx_mq_create_ext_async_evt_fc_WORD async_evt_bmap | 1321 | #define lpfc_mbx_mq_create_ext_async_evt_fc_WORD async_evt_bmap |
1322 | #define LPFC_EVT_CODE_FC_NO_LINK 0x0 | ||
1323 | #define LPFC_EVT_CODE_FC_1_GBAUD 0x1 | ||
1324 | #define LPFC_EVT_CODE_FC_2_GBAUD 0x2 | ||
1325 | #define LPFC_EVT_CODE_FC_4_GBAUD 0x4 | ||
1326 | #define LPFC_EVT_CODE_FC_8_GBAUD 0x8 | ||
1327 | #define LPFC_EVT_CODE_FC_10_GBAUD 0xA | ||
1328 | #define LPFC_EVT_CODE_FC_16_GBAUD 0x10 | ||
1317 | #define lpfc_mbx_mq_create_ext_async_evt_sli_SHIFT LPFC_TRAILER_CODE_SLI | 1329 | #define lpfc_mbx_mq_create_ext_async_evt_sli_SHIFT LPFC_TRAILER_CODE_SLI |
1318 | #define lpfc_mbx_mq_create_ext_async_evt_sli_MASK 0x00000001 | 1330 | #define lpfc_mbx_mq_create_ext_async_evt_sli_MASK 0x00000001 |
1319 | #define lpfc_mbx_mq_create_ext_async_evt_sli_WORD async_evt_bmap | 1331 | #define lpfc_mbx_mq_create_ext_async_evt_sli_WORD async_evt_bmap |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 5a10acd4cdee..7dc4218d9c4c 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -3508,6 +3508,119 @@ lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba, | |||
3508 | } | 3508 | } |
3509 | 3509 | ||
3510 | /** | 3510 | /** |
3511 | * lpfc_sli_port_speed_get - Get sli3 link speed code to link speed | ||
3512 | * @phba: pointer to lpfc hba data structure. | ||
3513 | * | ||
3514 | * This routine is to get an SLI3 FC port's link speed in Mbps. | ||
3515 | * | ||
3516 | * Return: link speed in terms of Mbps. | ||
3517 | **/ | ||
3518 | uint32_t | ||
3519 | lpfc_sli_port_speed_get(struct lpfc_hba *phba) | ||
3520 | { | ||
3521 | uint32_t link_speed; | ||
3522 | |||
3523 | if (!lpfc_is_link_up(phba)) | ||
3524 | return 0; | ||
3525 | |||
3526 | switch (phba->fc_linkspeed) { | ||
3527 | case LPFC_LINK_SPEED_1GHZ: | ||
3528 | link_speed = 1000; | ||
3529 | break; | ||
3530 | case LPFC_LINK_SPEED_2GHZ: | ||
3531 | link_speed = 2000; | ||
3532 | break; | ||
3533 | case LPFC_LINK_SPEED_4GHZ: | ||
3534 | link_speed = 4000; | ||
3535 | break; | ||
3536 | case LPFC_LINK_SPEED_8GHZ: | ||
3537 | link_speed = 8000; | ||
3538 | break; | ||
3539 | case LPFC_LINK_SPEED_10GHZ: | ||
3540 | link_speed = 10000; | ||
3541 | break; | ||
3542 | case LPFC_LINK_SPEED_16GHZ: | ||
3543 | link_speed = 16000; | ||
3544 | break; | ||
3545 | default: | ||
3546 | link_speed = 0; | ||
3547 | } | ||
3548 | return link_speed; | ||
3549 | } | ||
3550 | |||
3551 | /** | ||
3552 | * lpfc_sli4_port_speed_parse - Parse async evt link speed code to link speed | ||
3553 | * @phba: pointer to lpfc hba data structure. | ||
3554 | * @evt_code: asynchronous event code. | ||
3555 | * @speed_code: asynchronous event link speed code. | ||
3556 | * | ||
3557 | * This routine is to parse the giving SLI4 async event link speed code into | ||
3558 | * value of Mbps for the link speed. | ||
3559 | * | ||
3560 | * Return: link speed in terms of Mbps. | ||
3561 | **/ | ||
3562 | static uint32_t | ||
3563 | lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, | ||
3564 | uint8_t speed_code) | ||
3565 | { | ||
3566 | uint32_t port_speed; | ||
3567 | |||
3568 | switch (evt_code) { | ||
3569 | case LPFC_TRAILER_CODE_LINK: | ||
3570 | switch (speed_code) { | ||
3571 | case LPFC_EVT_CODE_LINK_NO_LINK: | ||
3572 | port_speed = 0; | ||
3573 | break; | ||
3574 | case LPFC_EVT_CODE_LINK_10_MBIT: | ||
3575 | port_speed = 10; | ||
3576 | break; | ||
3577 | case LPFC_EVT_CODE_LINK_100_MBIT: | ||
3578 | port_speed = 100; | ||
3579 | break; | ||
3580 | case LPFC_EVT_CODE_LINK_1_GBIT: | ||
3581 | port_speed = 1000; | ||
3582 | break; | ||
3583 | case LPFC_EVT_CODE_LINK_10_GBIT: | ||
3584 | port_speed = 10000; | ||
3585 | break; | ||
3586 | default: | ||
3587 | port_speed = 0; | ||
3588 | } | ||
3589 | break; | ||
3590 | case LPFC_TRAILER_CODE_FC: | ||
3591 | switch (speed_code) { | ||
3592 | case LPFC_EVT_CODE_FC_NO_LINK: | ||
3593 | port_speed = 0; | ||
3594 | break; | ||
3595 | case LPFC_EVT_CODE_FC_1_GBAUD: | ||
3596 | port_speed = 1000; | ||
3597 | break; | ||
3598 | case LPFC_EVT_CODE_FC_2_GBAUD: | ||
3599 | port_speed = 2000; | ||
3600 | break; | ||
3601 | case LPFC_EVT_CODE_FC_4_GBAUD: | ||
3602 | port_speed = 4000; | ||
3603 | break; | ||
3604 | case LPFC_EVT_CODE_FC_8_GBAUD: | ||
3605 | port_speed = 8000; | ||
3606 | break; | ||
3607 | case LPFC_EVT_CODE_FC_10_GBAUD: | ||
3608 | port_speed = 10000; | ||
3609 | break; | ||
3610 | case LPFC_EVT_CODE_FC_16_GBAUD: | ||
3611 | port_speed = 16000; | ||
3612 | break; | ||
3613 | default: | ||
3614 | port_speed = 0; | ||
3615 | } | ||
3616 | break; | ||
3617 | default: | ||
3618 | port_speed = 0; | ||
3619 | } | ||
3620 | return port_speed; | ||
3621 | } | ||
3622 | |||
3623 | /** | ||
3511 | * lpfc_sli4_async_link_evt - Process the asynchronous FCoE link event | 3624 | * lpfc_sli4_async_link_evt - Process the asynchronous FCoE link event |
3512 | * @phba: pointer to lpfc hba data structure. | 3625 | * @phba: pointer to lpfc hba data structure. |
3513 | * @acqe_link: pointer to the async link completion queue entry. | 3626 | * @acqe_link: pointer to the async link completion queue entry. |
@@ -3564,7 +3677,8 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3564 | 3677 | ||
3565 | /* Keep the link status for extra SLI4 state machine reference */ | 3678 | /* Keep the link status for extra SLI4 state machine reference */ |
3566 | phba->sli4_hba.link_state.speed = | 3679 | phba->sli4_hba.link_state.speed = |
3567 | bf_get(lpfc_acqe_link_speed, acqe_link); | 3680 | lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, |
3681 | bf_get(lpfc_acqe_link_speed, acqe_link)); | ||
3568 | phba->sli4_hba.link_state.duplex = | 3682 | phba->sli4_hba.link_state.duplex = |
3569 | bf_get(lpfc_acqe_link_duplex, acqe_link); | 3683 | bf_get(lpfc_acqe_link_duplex, acqe_link); |
3570 | phba->sli4_hba.link_state.status = | 3684 | phba->sli4_hba.link_state.status = |
@@ -3576,7 +3690,8 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3576 | phba->sli4_hba.link_state.fault = | 3690 | phba->sli4_hba.link_state.fault = |
3577 | bf_get(lpfc_acqe_link_fault, acqe_link); | 3691 | bf_get(lpfc_acqe_link_fault, acqe_link); |
3578 | phba->sli4_hba.link_state.logical_speed = | 3692 | phba->sli4_hba.link_state.logical_speed = |
3579 | bf_get(lpfc_acqe_logical_link_speed, acqe_link); | 3693 | bf_get(lpfc_acqe_logical_link_speed, acqe_link) * 10; |
3694 | |||
3580 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3695 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
3581 | "2900 Async FC/FCoE Link event - Speed:%dGBit " | 3696 | "2900 Async FC/FCoE Link event - Speed:%dGBit " |
3582 | "duplex:x%x LA Type:x%x Port Type:%d Port Number:%d " | 3697 | "duplex:x%x LA Type:x%x Port Type:%d Port Number:%d " |
@@ -3586,7 +3701,7 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3586 | phba->sli4_hba.link_state.status, | 3701 | phba->sli4_hba.link_state.status, |
3587 | phba->sli4_hba.link_state.type, | 3702 | phba->sli4_hba.link_state.type, |
3588 | phba->sli4_hba.link_state.number, | 3703 | phba->sli4_hba.link_state.number, |
3589 | phba->sli4_hba.link_state.logical_speed * 10, | 3704 | phba->sli4_hba.link_state.logical_speed, |
3590 | phba->sli4_hba.link_state.fault); | 3705 | phba->sli4_hba.link_state.fault); |
3591 | /* | 3706 | /* |
3592 | * For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch | 3707 | * For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch |
@@ -3658,7 +3773,8 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) | |||
3658 | } | 3773 | } |
3659 | /* Keep the link status for extra SLI4 state machine reference */ | 3774 | /* Keep the link status for extra SLI4 state machine reference */ |
3660 | phba->sli4_hba.link_state.speed = | 3775 | phba->sli4_hba.link_state.speed = |
3661 | bf_get(lpfc_acqe_fc_la_speed, acqe_fc); | 3776 | lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, |
3777 | bf_get(lpfc_acqe_fc_la_speed, acqe_fc)); | ||
3662 | phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; | 3778 | phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; |
3663 | phba->sli4_hba.link_state.topology = | 3779 | phba->sli4_hba.link_state.topology = |
3664 | bf_get(lpfc_acqe_fc_la_topology, acqe_fc); | 3780 | bf_get(lpfc_acqe_fc_la_topology, acqe_fc); |
@@ -3671,7 +3787,7 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) | |||
3671 | phba->sli4_hba.link_state.fault = | 3787 | phba->sli4_hba.link_state.fault = |
3672 | bf_get(lpfc_acqe_link_fault, acqe_fc); | 3788 | bf_get(lpfc_acqe_link_fault, acqe_fc); |
3673 | phba->sli4_hba.link_state.logical_speed = | 3789 | phba->sli4_hba.link_state.logical_speed = |
3674 | bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc); | 3790 | bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc) * 10; |
3675 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3791 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
3676 | "2896 Async FC event - Speed:%dGBaud Topology:x%x " | 3792 | "2896 Async FC event - Speed:%dGBaud Topology:x%x " |
3677 | "LA Type:x%x Port Type:%d Port Number:%d Logical speed:" | 3793 | "LA Type:x%x Port Type:%d Port Number:%d Logical speed:" |
@@ -3681,7 +3797,7 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) | |||
3681 | phba->sli4_hba.link_state.status, | 3797 | phba->sli4_hba.link_state.status, |
3682 | phba->sli4_hba.link_state.type, | 3798 | phba->sli4_hba.link_state.type, |
3683 | phba->sli4_hba.link_state.number, | 3799 | phba->sli4_hba.link_state.number, |
3684 | phba->sli4_hba.link_state.logical_speed * 10, | 3800 | phba->sli4_hba.link_state.logical_speed, |
3685 | phba->sli4_hba.link_state.fault); | 3801 | phba->sli4_hba.link_state.fault); |
3686 | pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 3802 | pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
3687 | if (!pmb) { | 3803 | if (!pmb) { |
@@ -4171,11 +4287,11 @@ lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, | |||
4171 | phba->fcoe_eventtag = acqe_grp5->event_tag; | 4287 | phba->fcoe_eventtag = acqe_grp5->event_tag; |
4172 | prev_ll_spd = phba->sli4_hba.link_state.logical_speed; | 4288 | prev_ll_spd = phba->sli4_hba.link_state.logical_speed; |
4173 | phba->sli4_hba.link_state.logical_speed = | 4289 | phba->sli4_hba.link_state.logical_speed = |
4174 | (bf_get(lpfc_acqe_grp5_llink_spd, acqe_grp5)); | 4290 | (bf_get(lpfc_acqe_grp5_llink_spd, acqe_grp5)) * 10; |
4175 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 4291 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
4176 | "2789 GRP5 Async Event: Updating logical link speed " | 4292 | "2789 GRP5 Async Event: Updating logical link speed " |
4177 | "from %dMbps to %dMbps\n", (prev_ll_spd * 10), | 4293 | "from %dMbps to %dMbps\n", prev_ll_spd, |
4178 | (phba->sli4_hba.link_state.logical_speed*10)); | 4294 | phba->sli4_hba.link_state.logical_speed); |
4179 | } | 4295 | } |
4180 | 4296 | ||
4181 | /** | 4297 | /** |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 41ee7d5c415a..7f45ac9964a9 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -4163,7 +4163,7 @@ lpfc_info(struct Scsi_Host *host) | |||
4163 | { | 4163 | { |
4164 | struct lpfc_vport *vport = (struct lpfc_vport *) host->hostdata; | 4164 | struct lpfc_vport *vport = (struct lpfc_vport *) host->hostdata; |
4165 | struct lpfc_hba *phba = vport->phba; | 4165 | struct lpfc_hba *phba = vport->phba; |
4166 | int len; | 4166 | int len, link_speed = 0; |
4167 | static char lpfcinfobuf[384]; | 4167 | static char lpfcinfobuf[384]; |
4168 | 4168 | ||
4169 | memset(lpfcinfobuf,0,384); | 4169 | memset(lpfcinfobuf,0,384); |
@@ -4184,12 +4184,18 @@ lpfc_info(struct Scsi_Host *host) | |||
4184 | phba->Port); | 4184 | phba->Port); |
4185 | } | 4185 | } |
4186 | len = strlen(lpfcinfobuf); | 4186 | len = strlen(lpfcinfobuf); |
4187 | if (phba->sli4_hba.link_state.logical_speed) { | 4187 | if (phba->sli_rev <= LPFC_SLI_REV3) { |
4188 | snprintf(lpfcinfobuf + len, | 4188 | link_speed = lpfc_sli_port_speed_get(phba); |
4189 | 384-len, | 4189 | } else { |
4190 | " Logical Link Speed: %d Mbps", | 4190 | if (phba->sli4_hba.link_state.logical_speed) |
4191 | phba->sli4_hba.link_state.logical_speed * 10); | 4191 | link_speed = |
4192 | phba->sli4_hba.link_state.logical_speed; | ||
4193 | else | ||
4194 | link_speed = phba->sli4_hba.link_state.speed; | ||
4192 | } | 4195 | } |
4196 | if (link_speed != 0) | ||
4197 | snprintf(lpfcinfobuf + len, 384-len, | ||
4198 | " Logical Link Speed: %d Mbps", link_speed); | ||
4193 | } | 4199 | } |
4194 | return lpfcinfobuf; | 4200 | return lpfcinfobuf; |
4195 | } | 4201 | } |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 613f581faf94..f44a06a4c6e7 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -168,7 +168,7 @@ struct lpfc_queue { | |||
168 | }; | 168 | }; |
169 | 169 | ||
170 | struct lpfc_sli4_link { | 170 | struct lpfc_sli4_link { |
171 | uint8_t speed; | 171 | uint16_t speed; |
172 | uint8_t duplex; | 172 | uint8_t duplex; |
173 | uint8_t status; | 173 | uint8_t status; |
174 | uint8_t type; | 174 | uint8_t type; |