diff options
author | Jitendra Bhivare <jitendra.bhivare@avagotech.com> | 2016-01-20 03:40:53 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-02-23 21:27:02 -0500 |
commit | 53aefe2552e6efadb0e1a12c2c3adb12105a64f9 (patch) | |
tree | c4e5f79e2744a665099b8ceb34ee260230774e9e /drivers | |
parent | c9beb6fa14576c4e566696d62f26d748459bac2d (diff) |
be2iscsi: Fix to handle misconfigured optics events
Log messages for misconfigured transceivers reported by FW.
Register async events that driver handles using MCC_CREATE_EXT ioctl.
Errors messages for faulted/uncertified/unqualified optics are logged.
Added IOCTL to get port_name to be displayed in error message.
Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/be2iscsi/be_cmds.c | 164 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_cmds.h | 47 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 19 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.h | 10 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_mgmt.c | 42 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_mgmt.h | 2 |
6 files changed, 199 insertions, 85 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c index 66a1fc3f3ddc..533060e12c7f 100644 --- a/drivers/scsi/be2iscsi/be_cmds.c +++ b/drivers/scsi/be2iscsi/be_cmds.c | |||
@@ -267,26 +267,6 @@ void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag) | |||
267 | spin_unlock(&ctrl->mcc_lock); | 267 | spin_unlock(&ctrl->mcc_lock); |
268 | } | 268 | } |
269 | 269 | ||
270 | bool is_link_state_evt(u32 trailer) | ||
271 | { | ||
272 | return (((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) & | ||
273 | ASYNC_TRAILER_EVENT_CODE_MASK) == | ||
274 | ASYNC_EVENT_CODE_LINK_STATE); | ||
275 | } | ||
276 | |||
277 | static bool is_iscsi_evt(u32 trailer) | ||
278 | { | ||
279 | return ((trailer >> ASYNC_TRAILER_EVENT_CODE_SHIFT) & | ||
280 | ASYNC_TRAILER_EVENT_CODE_MASK) == | ||
281 | ASYNC_EVENT_CODE_ISCSI; | ||
282 | } | ||
283 | |||
284 | static int iscsi_evt_type(u32 trailer) | ||
285 | { | ||
286 | return (trailer >> ASYNC_TRAILER_EVENT_TYPE_SHIFT) & | ||
287 | ASYNC_TRAILER_EVENT_TYPE_MASK; | ||
288 | } | ||
289 | |||
290 | static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl) | 270 | static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl) |
291 | { | 271 | { |
292 | if (compl->flags != 0) { | 272 | if (compl->flags != 0) { |
@@ -425,7 +405,7 @@ void beiscsi_fail_session(struct iscsi_cls_session *cls_session) | |||
425 | iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED); | 405 | iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED); |
426 | } | 406 | } |
427 | 407 | ||
428 | void beiscsi_async_link_state_process(struct beiscsi_hba *phba, | 408 | static void beiscsi_async_link_state_process(struct beiscsi_hba *phba, |
429 | struct be_async_event_link_state *evt) | 409 | struct be_async_event_link_state *evt) |
430 | { | 410 | { |
431 | if ((evt->port_link_status == ASYNC_EVENT_LINK_DOWN) || | 411 | if ((evt->port_link_status == ASYNC_EVENT_LINK_DOWN) || |
@@ -453,6 +433,100 @@ void beiscsi_async_link_state_process(struct beiscsi_hba *phba, | |||
453 | } | 433 | } |
454 | } | 434 | } |
455 | 435 | ||
436 | static char *beiscsi_port_misconf_event_msg[] = { | ||
437 | "Physical Link is functional.", | ||
438 | "Optics faulted/incorrectly installed/not installed - Reseat optics, if issue not resolved, replace.", | ||
439 | "Optics of two types installed - Remove one optic or install matching pair of optics.", | ||
440 | "Incompatible optics - Replace with compatible optics for card to function.", | ||
441 | "Unqualified optics - Replace with Avago optics for Warranty and Technical Support.", | ||
442 | "Uncertified optics - Replace with Avago Certified optics to enable link operation." | ||
443 | }; | ||
444 | |||
445 | static void beiscsi_process_async_sli(struct beiscsi_hba *phba, | ||
446 | struct be_mcc_compl *compl) | ||
447 | { | ||
448 | struct be_async_event_sli *async_sli; | ||
449 | u8 evt_type, state, old_state, le; | ||
450 | char *sev = KERN_WARNING; | ||
451 | char *msg = NULL; | ||
452 | |||
453 | evt_type = compl->flags >> ASYNC_TRAILER_EVENT_TYPE_SHIFT; | ||
454 | evt_type &= ASYNC_TRAILER_EVENT_TYPE_MASK; | ||
455 | |||
456 | /* processing only MISCONFIGURED physical port event */ | ||
457 | if (evt_type != ASYNC_SLI_EVENT_TYPE_MISCONFIGURED) | ||
458 | return; | ||
459 | |||
460 | async_sli = (struct be_async_event_sli *)compl; | ||
461 | state = async_sli->event_data1 >> | ||
462 | (phba->fw_config.phys_port * 8) & 0xff; | ||
463 | le = async_sli->event_data2 >> | ||
464 | (phba->fw_config.phys_port * 8) & 0xff; | ||
465 | |||
466 | old_state = phba->optic_state; | ||
467 | phba->optic_state = state; | ||
468 | |||
469 | if (state >= ARRAY_SIZE(beiscsi_port_misconf_event_msg)) { | ||
470 | /* fw is reporting a state we don't know, log and return */ | ||
471 | __beiscsi_log(phba, KERN_ERR, | ||
472 | "BC_%d : Port %c: Unrecognized optic state 0x%x\n", | ||
473 | phba->port_name, async_sli->event_data1); | ||
474 | return; | ||
475 | } | ||
476 | |||
477 | if (ASYNC_SLI_LINK_EFFECT_VALID(le)) { | ||
478 | /* log link effect for unqualified-4, uncertified-5 optics */ | ||
479 | if (state > 3) | ||
480 | msg = (ASYNC_SLI_LINK_EFFECT_STATE(le)) ? | ||
481 | " Link is non-operational." : | ||
482 | " Link is operational."; | ||
483 | /* 1 - info */ | ||
484 | if (ASYNC_SLI_LINK_EFFECT_SEV(le) == 1) | ||
485 | sev = KERN_INFO; | ||
486 | /* 2 - error */ | ||
487 | if (ASYNC_SLI_LINK_EFFECT_SEV(le) == 2) | ||
488 | sev = KERN_ERR; | ||
489 | } | ||
490 | |||
491 | if (old_state != phba->optic_state) | ||
492 | __beiscsi_log(phba, sev, "BC_%d : Port %c: %s%s\n", | ||
493 | phba->port_name, | ||
494 | beiscsi_port_misconf_event_msg[state], | ||
495 | !msg ? "" : msg); | ||
496 | } | ||
497 | |||
498 | void beiscsi_process_async_event(struct beiscsi_hba *phba, | ||
499 | struct be_mcc_compl *compl) | ||
500 | { | ||
501 | char *sev = KERN_INFO; | ||
502 | u8 evt_code; | ||
503 | |||
504 | /* interpret flags as an async trailer */ | ||
505 | evt_code = compl->flags >> ASYNC_TRAILER_EVENT_CODE_SHIFT; | ||
506 | evt_code &= ASYNC_TRAILER_EVENT_CODE_MASK; | ||
507 | switch (evt_code) { | ||
508 | case ASYNC_EVENT_CODE_LINK_STATE: | ||
509 | beiscsi_async_link_state_process(phba, | ||
510 | (struct be_async_event_link_state *)compl); | ||
511 | break; | ||
512 | case ASYNC_EVENT_CODE_ISCSI: | ||
513 | phba->state |= BE_ADAPTER_CHECK_BOOT; | ||
514 | phba->get_boot = BE_GET_BOOT_RETRIES; | ||
515 | sev = KERN_ERR; | ||
516 | break; | ||
517 | case ASYNC_EVENT_CODE_SLI: | ||
518 | beiscsi_process_async_sli(phba, compl); | ||
519 | break; | ||
520 | default: | ||
521 | /* event not registered */ | ||
522 | sev = KERN_ERR; | ||
523 | } | ||
524 | |||
525 | beiscsi_log(phba, sev, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, | ||
526 | "BC_%d : ASYNC Event: status 0x%08x flags 0x%08x\n", | ||
527 | compl->status, compl->flags); | ||
528 | } | ||
529 | |||
456 | int beiscsi_process_mcc(struct beiscsi_hba *phba) | 530 | int beiscsi_process_mcc(struct beiscsi_hba *phba) |
457 | { | 531 | { |
458 | struct be_mcc_compl *compl; | 532 | struct be_mcc_compl *compl; |
@@ -462,45 +536,10 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba) | |||
462 | spin_lock_bh(&phba->ctrl.mcc_cq_lock); | 536 | spin_lock_bh(&phba->ctrl.mcc_cq_lock); |
463 | while ((compl = be_mcc_compl_get(phba))) { | 537 | while ((compl = be_mcc_compl_get(phba))) { |
464 | if (compl->flags & CQE_FLAGS_ASYNC_MASK) { | 538 | if (compl->flags & CQE_FLAGS_ASYNC_MASK) { |
465 | /* Interpret flags as an async trailer */ | 539 | beiscsi_process_async_event(phba, compl); |
466 | if (is_link_state_evt(compl->flags)) | ||
467 | /* Interpret compl as a async link evt */ | ||
468 | beiscsi_async_link_state_process(phba, | ||
469 | (struct be_async_event_link_state *) compl); | ||
470 | else if (is_iscsi_evt(compl->flags)) { | ||
471 | switch (iscsi_evt_type(compl->flags)) { | ||
472 | case ASYNC_EVENT_NEW_ISCSI_TGT_DISC: | ||
473 | case ASYNC_EVENT_NEW_ISCSI_CONN: | ||
474 | case ASYNC_EVENT_NEW_TCP_CONN: | ||
475 | phba->state |= BE_ADAPTER_CHECK_BOOT; | ||
476 | phba->get_boot = BE_GET_BOOT_RETRIES; | ||
477 | beiscsi_log(phba, KERN_ERR, | ||
478 | BEISCSI_LOG_CONFIG | | ||
479 | BEISCSI_LOG_MBOX, | ||
480 | "BC_%d : Async iscsi Event," | ||
481 | " flags handled = 0x%08x\n", | ||
482 | compl->flags); | ||
483 | break; | ||
484 | default: | ||
485 | phba->state |= BE_ADAPTER_CHECK_BOOT; | ||
486 | phba->get_boot = BE_GET_BOOT_RETRIES; | ||
487 | beiscsi_log(phba, KERN_ERR, | ||
488 | BEISCSI_LOG_CONFIG | | ||
489 | BEISCSI_LOG_MBOX, | ||
490 | "BC_%d : Unsupported Async" | ||
491 | " Event, flags = 0x%08x\n", | ||
492 | compl->flags); | ||
493 | } | ||
494 | } else | ||
495 | beiscsi_log(phba, KERN_ERR, | ||
496 | BEISCSI_LOG_CONFIG | | ||
497 | BEISCSI_LOG_MBOX, | ||
498 | "BC_%d : Unsupported Async Event, flags" | ||
499 | " = 0x%08x\n", compl->flags); | ||
500 | |||
501 | } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { | 540 | } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { |
502 | status = be_mcc_compl_process(ctrl, compl); | 541 | status = be_mcc_compl_process(ctrl, compl); |
503 | atomic_dec(&phba->ctrl.mcc_obj.q.used); | 542 | atomic_dec(&phba->ctrl.mcc_obj.q.used); |
504 | } | 543 | } |
505 | be_mcc_compl_use(compl); | 544 | be_mcc_compl_use(compl); |
506 | num++; | 545 | num++; |
@@ -1016,7 +1055,7 @@ int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba, | |||
1016 | struct be_queue_info *cq) | 1055 | struct be_queue_info *cq) |
1017 | { | 1056 | { |
1018 | struct be_mcc_wrb *wrb; | 1057 | struct be_mcc_wrb *wrb; |
1019 | struct be_cmd_req_mcc_create *req; | 1058 | struct be_cmd_req_mcc_create_ext *req; |
1020 | struct be_dma_mem *q_mem = &mccq->dma_mem; | 1059 | struct be_dma_mem *q_mem = &mccq->dma_mem; |
1021 | struct be_ctrl_info *ctrl; | 1060 | struct be_ctrl_info *ctrl; |
1022 | void *ctxt; | 1061 | void *ctxt; |
@@ -1032,9 +1071,12 @@ int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba, | |||
1032 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); | 1071 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); |
1033 | 1072 | ||
1034 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, | 1073 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, |
1035 | OPCODE_COMMON_MCC_CREATE, sizeof(*req)); | 1074 | OPCODE_COMMON_MCC_CREATE_EXT, sizeof(*req)); |
1036 | 1075 | ||
1037 | req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); | 1076 | req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); |
1077 | req->async_evt_bitmap = 1 << ASYNC_EVENT_CODE_LINK_STATE; | ||
1078 | req->async_evt_bitmap |= 1 << ASYNC_EVENT_CODE_ISCSI; | ||
1079 | req->async_evt_bitmap |= 1 << ASYNC_EVENT_CODE_SLI; | ||
1038 | 1080 | ||
1039 | AMAP_SET_BITS(struct amap_mcc_context, fid, ctxt, | 1081 | AMAP_SET_BITS(struct amap_mcc_context, fid, ctxt, |
1040 | PCI_FUNC(phba->pcidev->devfn)); | 1082 | PCI_FUNC(phba->pcidev->devfn)); |
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h index f98816447615..724974eca5a3 100644 --- a/drivers/scsi/be2iscsi/be_cmds.h +++ b/drivers/scsi/be2iscsi/be_cmds.h | |||
@@ -119,13 +119,22 @@ struct be_mcc_compl { | |||
119 | #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF | 119 | #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF |
120 | #define ASYNC_EVENT_CODE_LINK_STATE 0x1 | 120 | #define ASYNC_EVENT_CODE_LINK_STATE 0x1 |
121 | #define ASYNC_EVENT_CODE_ISCSI 0x4 | 121 | #define ASYNC_EVENT_CODE_ISCSI 0x4 |
122 | #define ASYNC_EVENT_CODE_SLI 0x11 | ||
122 | 123 | ||
123 | #define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16 /* bits 16 - 23 */ | 124 | #define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16 /* bits 16 - 23 */ |
124 | #define ASYNC_TRAILER_EVENT_TYPE_MASK 0xF | 125 | #define ASYNC_TRAILER_EVENT_TYPE_MASK 0xFF |
126 | |||
127 | /* iSCSI events */ | ||
125 | #define ASYNC_EVENT_NEW_ISCSI_TGT_DISC 0x4 | 128 | #define ASYNC_EVENT_NEW_ISCSI_TGT_DISC 0x4 |
126 | #define ASYNC_EVENT_NEW_ISCSI_CONN 0x5 | 129 | #define ASYNC_EVENT_NEW_ISCSI_CONN 0x5 |
127 | #define ASYNC_EVENT_NEW_TCP_CONN 0x7 | 130 | #define ASYNC_EVENT_NEW_TCP_CONN 0x7 |
128 | 131 | ||
132 | /* SLI events */ | ||
133 | #define ASYNC_SLI_EVENT_TYPE_MISCONFIGURED 0x9 | ||
134 | #define ASYNC_SLI_LINK_EFFECT_VALID(le) (le & 0x80) | ||
135 | #define ASYNC_SLI_LINK_EFFECT_SEV(le) ((le >> 1) & 0x03) | ||
136 | #define ASYNC_SLI_LINK_EFFECT_STATE(le) (le & 0x01) | ||
137 | |||
129 | struct be_async_event_trailer { | 138 | struct be_async_event_trailer { |
130 | u32 code; | 139 | u32 code; |
131 | }; | 140 | }; |
@@ -153,6 +162,16 @@ struct be_async_event_link_state { | |||
153 | struct be_async_event_trailer trailer; | 162 | struct be_async_event_trailer trailer; |
154 | } __packed; | 163 | } __packed; |
155 | 164 | ||
165 | /** | ||
166 | * When async-trailer is SLI event, mcc_compl is interpreted as | ||
167 | */ | ||
168 | struct be_async_event_sli { | ||
169 | u32 event_data1; | ||
170 | u32 event_data2; | ||
171 | u32 reserved; | ||
172 | u32 trailer; | ||
173 | } __packed; | ||
174 | |||
156 | struct be_mcc_mailbox { | 175 | struct be_mcc_mailbox { |
157 | struct be_mcc_wrb wrb; | 176 | struct be_mcc_wrb wrb; |
158 | struct be_mcc_compl compl; | 177 | struct be_mcc_compl compl; |
@@ -172,6 +191,7 @@ struct be_mcc_mailbox { | |||
172 | #define OPCODE_COMMON_CQ_CREATE 12 | 191 | #define OPCODE_COMMON_CQ_CREATE 12 |
173 | #define OPCODE_COMMON_EQ_CREATE 13 | 192 | #define OPCODE_COMMON_EQ_CREATE 13 |
174 | #define OPCODE_COMMON_MCC_CREATE 21 | 193 | #define OPCODE_COMMON_MCC_CREATE 21 |
194 | #define OPCODE_COMMON_MCC_CREATE_EXT 90 | ||
175 | #define OPCODE_COMMON_ADD_TEMPLATE_HEADER_BUFFERS 24 | 195 | #define OPCODE_COMMON_ADD_TEMPLATE_HEADER_BUFFERS 24 |
176 | #define OPCODE_COMMON_REMOVE_TEMPLATE_HEADER_BUFFERS 25 | 196 | #define OPCODE_COMMON_REMOVE_TEMPLATE_HEADER_BUFFERS 25 |
177 | #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32 | 197 | #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32 |
@@ -183,6 +203,7 @@ struct be_mcc_mailbox { | |||
183 | #define OPCODE_COMMON_EQ_DESTROY 55 | 203 | #define OPCODE_COMMON_EQ_DESTROY 55 |
184 | #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 | 204 | #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 |
185 | #define OPCODE_COMMON_FUNCTION_RESET 61 | 205 | #define OPCODE_COMMON_FUNCTION_RESET 61 |
206 | #define OPCODE_COMMON_GET_PORT_NAME 77 | ||
186 | 207 | ||
187 | /** | 208 | /** |
188 | * LIST of opcodes that are common between Initiator and Target | 209 | * LIST of opcodes that are common between Initiator and Target |
@@ -587,10 +608,11 @@ struct amap_mcc_context { | |||
587 | u8 rsvd2[32]; | 608 | u8 rsvd2[32]; |
588 | } __packed; | 609 | } __packed; |
589 | 610 | ||
590 | struct be_cmd_req_mcc_create { | 611 | struct be_cmd_req_mcc_create_ext { |
591 | struct be_cmd_req_hdr hdr; | 612 | struct be_cmd_req_hdr hdr; |
592 | u16 num_pages; | 613 | u16 num_pages; |
593 | u16 rsvd0; | 614 | u16 rsvd0; |
615 | u32 async_evt_bitmap; | ||
594 | u8 context[sizeof(struct amap_mcc_context) / 8]; | 616 | u8 context[sizeof(struct amap_mcc_context) / 8]; |
595 | struct phys_addr pages[8]; | 617 | struct phys_addr pages[8]; |
596 | } __packed; | 618 | } __packed; |
@@ -748,8 +770,8 @@ struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba); | |||
748 | int be_mcc_notify_wait(struct beiscsi_hba *phba, unsigned int tag); | 770 | int be_mcc_notify_wait(struct beiscsi_hba *phba, unsigned int tag); |
749 | void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag); | 771 | void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag); |
750 | unsigned int alloc_mcc_tag(struct beiscsi_hba *phba); | 772 | unsigned int alloc_mcc_tag(struct beiscsi_hba *phba); |
751 | void beiscsi_async_link_state_process(struct beiscsi_hba *phba, | 773 | void beiscsi_process_async_event(struct beiscsi_hba *phba, |
752 | struct be_async_event_link_state *evt); | 774 | struct be_mcc_compl *compl); |
753 | int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl, | 775 | int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl, |
754 | struct be_mcc_compl *compl); | 776 | struct be_mcc_compl *compl); |
755 | 777 | ||
@@ -777,8 +799,6 @@ int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem, | |||
777 | struct hwi_wrb_context *pwrb_context, | 799 | struct hwi_wrb_context *pwrb_context, |
778 | uint8_t ulp_num); | 800 | uint8_t ulp_num); |
779 | 801 | ||
780 | bool is_link_state_evt(u32 trailer); | ||
781 | |||
782 | /* Configuration Functions */ | 802 | /* Configuration Functions */ |
783 | int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag); | 803 | int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag); |
784 | 804 | ||
@@ -1137,6 +1157,21 @@ struct be_cmd_get_all_if_id_req { | |||
1137 | u32 if_hndl_list[1]; | 1157 | u32 if_hndl_list[1]; |
1138 | } __packed; | 1158 | } __packed; |
1139 | 1159 | ||
1160 | struct be_cmd_get_port_name { | ||
1161 | union { | ||
1162 | struct be_cmd_req_hdr req_hdr; | ||
1163 | struct be_cmd_resp_hdr resp_hdr; | ||
1164 | } h; | ||
1165 | union { | ||
1166 | struct { | ||
1167 | u32 reserved; | ||
1168 | } req; | ||
1169 | struct { | ||
1170 | u32 port_names; | ||
1171 | } resp; | ||
1172 | } p; | ||
1173 | } __packed; | ||
1174 | |||
1140 | #define ISCSI_OPCODE_SCSI_DATA_OUT 5 | 1175 | #define ISCSI_OPCODE_SCSI_DATA_OUT 5 |
1141 | #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5 | 1176 | #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5 |
1142 | #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 | 1177 | #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 5aab8fd32e4d..e86eca98a525 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -2046,21 +2046,7 @@ static void beiscsi_process_mcc_isr(struct beiscsi_hba *phba) | |||
2046 | num_processed = 0; | 2046 | num_processed = 0; |
2047 | } | 2047 | } |
2048 | if (mcc_compl->flags & CQE_FLAGS_ASYNC_MASK) { | 2048 | if (mcc_compl->flags & CQE_FLAGS_ASYNC_MASK) { |
2049 | /* Interpret flags as an async trailer */ | 2049 | beiscsi_process_async_event(phba, mcc_compl); |
2050 | if (is_link_state_evt(mcc_compl->flags)) | ||
2051 | /* Interpret compl as a async link evt */ | ||
2052 | beiscsi_async_link_state_process(phba, | ||
2053 | (struct be_async_event_link_state *) mcc_compl); | ||
2054 | else { | ||
2055 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_MBOX, | ||
2056 | "BM_%d : Unsupported Async Event, flags" | ||
2057 | " = 0x%08x\n", | ||
2058 | mcc_compl->flags); | ||
2059 | if (phba->state & BE_ADAPTER_LINK_UP) { | ||
2060 | phba->state |= BE_ADAPTER_CHECK_BOOT; | ||
2061 | phba->get_boot = BE_GET_BOOT_RETRIES; | ||
2062 | } | ||
2063 | } | ||
2064 | } else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) { | 2050 | } else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) { |
2065 | be_mcc_compl_process_isr(&phba->ctrl, mcc_compl); | 2051 | be_mcc_compl_process_isr(&phba->ctrl, mcc_compl); |
2066 | atomic_dec(&phba->ctrl.mcc_obj.q.used); | 2052 | atomic_dec(&phba->ctrl.mcc_obj.q.used); |
@@ -3866,6 +3852,8 @@ static int hwi_init_port(struct beiscsi_hba *phba) | |||
3866 | phwi_context->min_eqd = 0; | 3852 | phwi_context->min_eqd = 0; |
3867 | phwi_context->cur_eqd = 0; | 3853 | phwi_context->cur_eqd = 0; |
3868 | be_cmd_fw_initialize(&phba->ctrl); | 3854 | be_cmd_fw_initialize(&phba->ctrl); |
3855 | /* set optic state to unknown */ | ||
3856 | phba->optic_state = 0xff; | ||
3869 | 3857 | ||
3870 | status = beiscsi_create_eqs(phba, phwi_context); | 3858 | status = beiscsi_create_eqs(phba, phwi_context); |
3871 | if (status != 0) { | 3859 | if (status != 0) { |
@@ -5678,6 +5666,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, | |||
5678 | "BM_%d : Error getting fw config\n"); | 5666 | "BM_%d : Error getting fw config\n"); |
5679 | goto free_port; | 5667 | goto free_port; |
5680 | } | 5668 | } |
5669 | mgmt_get_port_name(&phba->ctrl, phba); | ||
5681 | 5670 | ||
5682 | if (enable_msix) | 5671 | if (enable_msix) |
5683 | find_num_cpus(phba); | 5672 | find_num_cpus(phba); |
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index bd9d1e175b07..c09082aef7ae 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h | |||
@@ -415,6 +415,7 @@ struct beiscsi_hba { | |||
415 | } fw_config; | 415 | } fw_config; |
416 | 416 | ||
417 | unsigned int state; | 417 | unsigned int state; |
418 | u8 optic_state; | ||
418 | int get_boot; | 419 | int get_boot; |
419 | bool fw_timeout; | 420 | bool fw_timeout; |
420 | bool ue_detected; | 421 | bool ue_detected; |
@@ -422,6 +423,7 @@ struct beiscsi_hba { | |||
422 | 423 | ||
423 | bool mac_addr_set; | 424 | bool mac_addr_set; |
424 | u8 mac_address[ETH_ALEN]; | 425 | u8 mac_address[ETH_ALEN]; |
426 | u8 port_name; | ||
425 | char fw_ver_str[BEISCSI_VER_STRLEN]; | 427 | char fw_ver_str[BEISCSI_VER_STRLEN]; |
426 | char wq_name[20]; | 428 | char wq_name[20]; |
427 | struct workqueue_struct *wq; /* The actuak work queue */ | 429 | struct workqueue_struct *wq; /* The actuak work queue */ |
@@ -1073,12 +1075,14 @@ struct hwi_context_memory { | |||
1073 | #define BEISCSI_LOG_CONFIG 0x0020 /* CONFIG Code Path */ | 1075 | #define BEISCSI_LOG_CONFIG 0x0020 /* CONFIG Code Path */ |
1074 | #define BEISCSI_LOG_ISCSI 0x0040 /* SCSI/iSCSI Protocol related Logs */ | 1076 | #define BEISCSI_LOG_ISCSI 0x0040 /* SCSI/iSCSI Protocol related Logs */ |
1075 | 1077 | ||
1078 | #define __beiscsi_log(phba, level, fmt, arg...) \ | ||
1079 | shost_printk(level, phba->shost, fmt, __LINE__, ##arg) | ||
1080 | |||
1076 | #define beiscsi_log(phba, level, mask, fmt, arg...) \ | 1081 | #define beiscsi_log(phba, level, mask, fmt, arg...) \ |
1077 | do { \ | 1082 | do { \ |
1078 | uint32_t log_value = phba->attr_log_enable; \ | 1083 | uint32_t log_value = phba->attr_log_enable; \ |
1079 | if (((mask) & log_value) || (level[1] <= '3')) \ | 1084 | if (((mask) & log_value) || (level[1] <= '3')) \ |
1080 | shost_printk(level, phba->shost, \ | 1085 | __beiscsi_log(phba, level, fmt, ##arg); \ |
1081 | fmt, __LINE__, ##arg); \ | 1086 | } while (0); |
1082 | } while (0) | ||
1083 | 1087 | ||
1084 | #endif | 1088 | #endif |
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 7aa7a3c311e3..5aae153d3a6c 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -316,6 +316,48 @@ unsigned int mgmt_get_session_info(struct beiscsi_hba *phba, | |||
316 | } | 316 | } |
317 | 317 | ||
318 | /** | 318 | /** |
319 | * mgmt_get_port_name()- Get port name for the function | ||
320 | * @ctrl: ptr to Ctrl Info | ||
321 | * @phba: ptr to the dev priv structure | ||
322 | * | ||
323 | * Get the alphanumeric character for port | ||
324 | * | ||
325 | **/ | ||
326 | int mgmt_get_port_name(struct be_ctrl_info *ctrl, | ||
327 | struct beiscsi_hba *phba) | ||
328 | { | ||
329 | int ret = 0; | ||
330 | struct be_mcc_wrb *wrb; | ||
331 | struct be_cmd_get_port_name *ioctl; | ||
332 | |||
333 | mutex_lock(&ctrl->mbox_lock); | ||
334 | wrb = wrb_from_mbox(&ctrl->mbox_mem); | ||
335 | memset(wrb, 0, sizeof(*wrb)); | ||
336 | ioctl = embedded_payload(wrb); | ||
337 | |||
338 | be_wrb_hdr_prepare(wrb, sizeof(*ioctl), true, 0); | ||
339 | be_cmd_hdr_prepare(&ioctl->h.req_hdr, CMD_SUBSYSTEM_COMMON, | ||
340 | OPCODE_COMMON_GET_PORT_NAME, | ||
341 | EMBED_MBX_MAX_PAYLOAD_SIZE); | ||
342 | ret = be_mbox_notify(ctrl); | ||
343 | phba->port_name = 0; | ||
344 | if (!ret) { | ||
345 | phba->port_name = ioctl->p.resp.port_names >> | ||
346 | (phba->fw_config.phys_port * 8) & 0xff; | ||
347 | } else { | ||
348 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, | ||
349 | "BG_%d : GET_PORT_NAME ret 0x%x status 0x%x\n", | ||
350 | ret, ioctl->h.resp_hdr.status); | ||
351 | } | ||
352 | |||
353 | if (phba->port_name == 0) | ||
354 | phba->port_name = '?'; | ||
355 | |||
356 | mutex_unlock(&ctrl->mbox_lock); | ||
357 | return ret; | ||
358 | } | ||
359 | |||
360 | /** | ||
319 | * mgmt_get_fw_config()- Get the FW config for the function | 361 | * mgmt_get_fw_config()- Get the FW config for the function |
320 | * @ctrl: ptr to Ctrl Info | 362 | * @ctrl: ptr to Ctrl Info |
321 | * @phba: ptr to the dev priv structure | 363 | * @phba: ptr to the dev priv structure |
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h index c1dbb690ee27..f3a48a04b2ca 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.h +++ b/drivers/scsi/be2iscsi/be_mgmt.h | |||
@@ -268,6 +268,8 @@ struct beiscsi_endpoint { | |||
268 | 268 | ||
269 | int mgmt_get_fw_config(struct be_ctrl_info *ctrl, | 269 | int mgmt_get_fw_config(struct be_ctrl_info *ctrl, |
270 | struct beiscsi_hba *phba); | 270 | struct beiscsi_hba *phba); |
271 | int mgmt_get_port_name(struct be_ctrl_info *ctrl, | ||
272 | struct beiscsi_hba *phba); | ||
271 | 273 | ||
272 | unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba, | 274 | unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba, |
273 | struct beiscsi_endpoint *beiscsi_ep, | 275 | struct beiscsi_endpoint *beiscsi_ep, |