diff options
author | Brian King <brking@linux.vnet.ibm.com> | 2010-09-09 17:20:42 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-09-16 22:54:13 -0400 |
commit | d99e5f488ae28d9dfccc84435f4fd29bd1fe1b9b (patch) | |
tree | 5ffe7c2218d2ffd563505bd9612656f223f6dbb1 /drivers/scsi/ibmvscsi | |
parent | e6a4202aa920a25db76f0e02dabe133179293ec0 (diff) |
[SCSI] ibmvfc: Log link up/down events
By default, ibmvfc does not log any async events in order
to avoid flooding the log with them. Improve on this by
logging by default events that are not likely to flood the
log, such as link up/down. Having these events in the log
will improve the ability to debug issues with ibmvfc.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/ibmvscsi')
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvfc.c | 74 | ||||
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvfc.h | 6 |
2 files changed, 56 insertions, 24 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index a5dd9b4a0ae8..b1512e9d1b9d 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -2501,41 +2501,66 @@ static void ibmvfc_terminate_rport_io(struct fc_rport *rport) | |||
2501 | LEAVE; | 2501 | LEAVE; |
2502 | } | 2502 | } |
2503 | 2503 | ||
2504 | static const struct { | 2504 | static const struct ibmvfc_async_desc ae_desc [] = { |
2505 | enum ibmvfc_async_event ae; | 2505 | { IBMVFC_AE_ELS_PLOGI, "PLOGI", IBMVFC_DEFAULT_LOG_LEVEL + 1 }, |
2506 | const char *desc; | 2506 | { IBMVFC_AE_ELS_LOGO, "LOGO", IBMVFC_DEFAULT_LOG_LEVEL + 1 }, |
2507 | } ae_desc [] = { | 2507 | { IBMVFC_AE_ELS_PRLO, "PRLO", IBMVFC_DEFAULT_LOG_LEVEL + 1 }, |
2508 | { IBMVFC_AE_ELS_PLOGI, "PLOGI" }, | 2508 | { IBMVFC_AE_SCN_NPORT, "N-Port SCN", IBMVFC_DEFAULT_LOG_LEVEL + 1 }, |
2509 | { IBMVFC_AE_ELS_LOGO, "LOGO" }, | 2509 | { IBMVFC_AE_SCN_GROUP, "Group SCN", IBMVFC_DEFAULT_LOG_LEVEL + 1 }, |
2510 | { IBMVFC_AE_ELS_PRLO, "PRLO" }, | 2510 | { IBMVFC_AE_SCN_DOMAIN, "Domain SCN", IBMVFC_DEFAULT_LOG_LEVEL }, |
2511 | { IBMVFC_AE_SCN_NPORT, "N-Port SCN" }, | 2511 | { IBMVFC_AE_SCN_FABRIC, "Fabric SCN", IBMVFC_DEFAULT_LOG_LEVEL }, |
2512 | { IBMVFC_AE_SCN_GROUP, "Group SCN" }, | 2512 | { IBMVFC_AE_LINK_UP, "Link Up", IBMVFC_DEFAULT_LOG_LEVEL }, |
2513 | { IBMVFC_AE_SCN_DOMAIN, "Domain SCN" }, | 2513 | { IBMVFC_AE_LINK_DOWN, "Link Down", IBMVFC_DEFAULT_LOG_LEVEL }, |
2514 | { IBMVFC_AE_SCN_FABRIC, "Fabric SCN" }, | 2514 | { IBMVFC_AE_LINK_DEAD, "Link Dead", IBMVFC_DEFAULT_LOG_LEVEL }, |
2515 | { IBMVFC_AE_LINK_UP, "Link Up" }, | 2515 | { IBMVFC_AE_HALT, "Halt", IBMVFC_DEFAULT_LOG_LEVEL }, |
2516 | { IBMVFC_AE_LINK_DOWN, "Link Down" }, | 2516 | { IBMVFC_AE_RESUME, "Resume", IBMVFC_DEFAULT_LOG_LEVEL }, |
2517 | { IBMVFC_AE_LINK_DEAD, "Link Dead" }, | 2517 | { IBMVFC_AE_ADAPTER_FAILED, "Adapter Failed", IBMVFC_DEFAULT_LOG_LEVEL }, |
2518 | { IBMVFC_AE_HALT, "Halt" }, | ||
2519 | { IBMVFC_AE_RESUME, "Resume" }, | ||
2520 | { IBMVFC_AE_ADAPTER_FAILED, "Adapter Failed" }, | ||
2521 | }; | 2518 | }; |
2522 | 2519 | ||
2523 | static const char *unknown_ae = "Unknown async"; | 2520 | static const struct ibmvfc_async_desc unknown_ae = { |
2521 | 0, "Unknown async", IBMVFC_DEFAULT_LOG_LEVEL | ||
2522 | }; | ||
2524 | 2523 | ||
2525 | /** | 2524 | /** |
2526 | * ibmvfc_get_ae_desc - Get text description for async event | 2525 | * ibmvfc_get_ae_desc - Get text description for async event |
2527 | * @ae: async event | 2526 | * @ae: async event |
2528 | * | 2527 | * |
2529 | **/ | 2528 | **/ |
2530 | static const char *ibmvfc_get_ae_desc(u64 ae) | 2529 | static const struct ibmvfc_async_desc *ibmvfc_get_ae_desc(u64 ae) |
2531 | { | 2530 | { |
2532 | int i; | 2531 | int i; |
2533 | 2532 | ||
2534 | for (i = 0; i < ARRAY_SIZE(ae_desc); i++) | 2533 | for (i = 0; i < ARRAY_SIZE(ae_desc); i++) |
2535 | if (ae_desc[i].ae == ae) | 2534 | if (ae_desc[i].ae == ae) |
2536 | return ae_desc[i].desc; | 2535 | return &ae_desc[i]; |
2536 | |||
2537 | return &unknown_ae; | ||
2538 | } | ||
2539 | |||
2540 | static const struct { | ||
2541 | enum ibmvfc_ae_link_state state; | ||
2542 | const char *desc; | ||
2543 | } link_desc [] = { | ||
2544 | { IBMVFC_AE_LS_LINK_UP, " link up" }, | ||
2545 | { IBMVFC_AE_LS_LINK_BOUNCED, " link bounced" }, | ||
2546 | { IBMVFC_AE_LS_LINK_DOWN, " link down" }, | ||
2547 | { IBMVFC_AE_LS_LINK_DEAD, " link dead" }, | ||
2548 | }; | ||
2549 | |||
2550 | /** | ||
2551 | * ibmvfc_get_link_state - Get text description for link state | ||
2552 | * @state: link state | ||
2553 | * | ||
2554 | **/ | ||
2555 | static const char *ibmvfc_get_link_state(enum ibmvfc_ae_link_state state) | ||
2556 | { | ||
2557 | int i; | ||
2558 | |||
2559 | for (i = 0; i < ARRAY_SIZE(link_desc); i++) | ||
2560 | if (link_desc[i].state == state) | ||
2561 | return link_desc[i].desc; | ||
2537 | 2562 | ||
2538 | return unknown_ae; | 2563 | return ""; |
2539 | } | 2564 | } |
2540 | 2565 | ||
2541 | /** | 2566 | /** |
@@ -2547,11 +2572,12 @@ static const char *ibmvfc_get_ae_desc(u64 ae) | |||
2547 | static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, | 2572 | static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, |
2548 | struct ibmvfc_host *vhost) | 2573 | struct ibmvfc_host *vhost) |
2549 | { | 2574 | { |
2550 | const char *desc = ibmvfc_get_ae_desc(crq->event); | 2575 | const struct ibmvfc_async_desc *desc = ibmvfc_get_ae_desc(crq->event); |
2551 | struct ibmvfc_target *tgt; | 2576 | struct ibmvfc_target *tgt; |
2552 | 2577 | ||
2553 | ibmvfc_log(vhost, 3, "%s event received. scsi_id: %llx, wwpn: %llx," | 2578 | ibmvfc_log(vhost, desc->log_level, "%s event received. scsi_id: %llx, wwpn: %llx," |
2554 | " node_name: %llx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name); | 2579 | " node_name: %llx%s\n", desc->desc, crq->scsi_id, crq->wwpn, crq->node_name, |
2580 | ibmvfc_get_link_state(crq->link_state)); | ||
2555 | 2581 | ||
2556 | switch (crq->event) { | 2582 | switch (crq->event) { |
2557 | case IBMVFC_AE_RESUME: | 2583 | case IBMVFC_AE_RESUME: |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 608af394c8cf..ef663e7c9bbc 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h | |||
@@ -541,6 +541,12 @@ enum ibmvfc_async_event { | |||
541 | IBMVFC_AE_ADAPTER_FAILED = 0x1000, | 541 | IBMVFC_AE_ADAPTER_FAILED = 0x1000, |
542 | }; | 542 | }; |
543 | 543 | ||
544 | struct ibmvfc_async_desc { | ||
545 | enum ibmvfc_async_event ae; | ||
546 | const char *desc; | ||
547 | int log_level; | ||
548 | }; | ||
549 | |||
544 | struct ibmvfc_crq { | 550 | struct ibmvfc_crq { |
545 | volatile u8 valid; | 551 | volatile u8 valid; |
546 | volatile u8 format; | 552 | volatile u8 format; |