diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2011-07-20 19:59:13 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-07-27 06:41:24 -0400 |
commit | 7826f304b1efa5ab839cf029742290f51c4fa009 (patch) | |
tree | 90b5271779b889c9b503cef0abf05e29286ade64 /drivers/scsi/bfa | |
parent | a53becc9a9dbe4f2961b2bba129b3b2624401021 (diff) |
[SCSI] bfa: Add FC-transport based Asynchronous Event Notification support.
- Added support to post vendor unique events on fc_host.
- Supports adapter, port, ioc, flash and remote port based AEN events.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r-- | drivers/scsi/bfa/bfa_defs.h | 143 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_defs_svc.h | 48 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs.c | 26 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs.h | 1 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs_fcpim.c | 37 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs_lport.c | 74 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs_rport.c | 49 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.c | 176 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.h | 2 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_modules.h | 1 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_svc.c | 48 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 8 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.c | 1 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_drv.h | 4 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_im.c | 26 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_im.h | 22 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfi.h | 20 |
17 files changed, 668 insertions, 18 deletions
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h index ed8d31b0188b..73e36de4451e 100644 --- a/drivers/scsi/bfa/bfa_defs.h +++ b/drivers/scsi/bfa/bfa_defs.h | |||
@@ -164,6 +164,8 @@ enum bfa_status { | |||
164 | BFA_STATUS_INVALID_MAC = 134, /* Invalid MAC address */ | 164 | BFA_STATUS_INVALID_MAC = 134, /* Invalid MAC address */ |
165 | BFA_STATUS_PBC = 154, /* Operation not allowed for pre-boot | 165 | BFA_STATUS_PBC = 154, /* Operation not allowed for pre-boot |
166 | * configuration */ | 166 | * configuration */ |
167 | BFA_STATUS_BAD_FWCFG = 156, /* Bad firmware configuration */ | ||
168 | BFA_STATUS_INVALID_VENDOR = 158, /* Invalid switch vendor */ | ||
167 | BFA_STATUS_SFP_NOT_READY = 159, /* SFP info is not ready. Retry */ | 169 | BFA_STATUS_SFP_NOT_READY = 159, /* SFP info is not ready. Retry */ |
168 | BFA_STATUS_TRUNK_ENABLED = 164, /* Trunk is already enabled on | 170 | BFA_STATUS_TRUNK_ENABLED = 164, /* Trunk is already enabled on |
169 | * this adapter */ | 171 | * this adapter */ |
@@ -359,6 +361,139 @@ struct bfa_ioc_attr_s { | |||
359 | }; | 361 | }; |
360 | 362 | ||
361 | /* | 363 | /* |
364 | * AEN related definitions | ||
365 | */ | ||
366 | enum bfa_aen_category { | ||
367 | BFA_AEN_CAT_ADAPTER = 1, | ||
368 | BFA_AEN_CAT_PORT = 2, | ||
369 | BFA_AEN_CAT_LPORT = 3, | ||
370 | BFA_AEN_CAT_RPORT = 4, | ||
371 | BFA_AEN_CAT_ITNIM = 5, | ||
372 | BFA_AEN_CAT_AUDIT = 8, | ||
373 | BFA_AEN_CAT_IOC = 9, | ||
374 | }; | ||
375 | |||
376 | /* BFA adapter level events */ | ||
377 | enum bfa_adapter_aen_event { | ||
378 | BFA_ADAPTER_AEN_ADD = 1, /* New Adapter found event */ | ||
379 | BFA_ADAPTER_AEN_REMOVE = 2, /* Adapter removed event */ | ||
380 | }; | ||
381 | |||
382 | struct bfa_adapter_aen_data_s { | ||
383 | char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN]; | ||
384 | u32 nports; /* Number of NPorts */ | ||
385 | wwn_t pwwn; /* WWN of one of its physical port */ | ||
386 | }; | ||
387 | |||
388 | /* BFA physical port Level events */ | ||
389 | enum bfa_port_aen_event { | ||
390 | BFA_PORT_AEN_ONLINE = 1, /* Physical Port online event */ | ||
391 | BFA_PORT_AEN_OFFLINE = 2, /* Physical Port offline event */ | ||
392 | BFA_PORT_AEN_RLIR = 3, /* RLIR event, not supported */ | ||
393 | BFA_PORT_AEN_SFP_INSERT = 4, /* SFP inserted event */ | ||
394 | BFA_PORT_AEN_SFP_REMOVE = 5, /* SFP removed event */ | ||
395 | BFA_PORT_AEN_SFP_POM = 6, /* SFP POM event */ | ||
396 | BFA_PORT_AEN_ENABLE = 7, /* Physical Port enable event */ | ||
397 | BFA_PORT_AEN_DISABLE = 8, /* Physical Port disable event */ | ||
398 | BFA_PORT_AEN_AUTH_ON = 9, /* Physical Port auth success event */ | ||
399 | BFA_PORT_AEN_AUTH_OFF = 10, /* Physical Port auth fail event */ | ||
400 | BFA_PORT_AEN_DISCONNECT = 11, /* Physical Port disconnect event */ | ||
401 | BFA_PORT_AEN_QOS_NEG = 12, /* Base Port QOS negotiation event */ | ||
402 | BFA_PORT_AEN_FABRIC_NAME_CHANGE = 13, /* Fabric Name/WWN change */ | ||
403 | BFA_PORT_AEN_SFP_ACCESS_ERROR = 14, /* SFP read error event */ | ||
404 | BFA_PORT_AEN_SFP_UNSUPPORT = 15, /* Unsupported SFP event */ | ||
405 | }; | ||
406 | |||
407 | enum bfa_port_aen_sfp_pom { | ||
408 | BFA_PORT_AEN_SFP_POM_GREEN = 1, /* Normal */ | ||
409 | BFA_PORT_AEN_SFP_POM_AMBER = 2, /* Warning */ | ||
410 | BFA_PORT_AEN_SFP_POM_RED = 3, /* Critical */ | ||
411 | BFA_PORT_AEN_SFP_POM_MAX = BFA_PORT_AEN_SFP_POM_RED | ||
412 | }; | ||
413 | |||
414 | struct bfa_port_aen_data_s { | ||
415 | wwn_t pwwn; /* WWN of the physical port */ | ||
416 | wwn_t fwwn; /* WWN of the fabric port */ | ||
417 | u32 phy_port_num; /* For SFP related events */ | ||
418 | u16 ioc_type; | ||
419 | u16 level; /* Only transitions will be informed */ | ||
420 | mac_t mac; /* MAC address of the ethernet port */ | ||
421 | u16 rsvd; | ||
422 | }; | ||
423 | |||
424 | /* BFA AEN logical port events */ | ||
425 | enum bfa_lport_aen_event { | ||
426 | BFA_LPORT_AEN_NEW = 1, /* LPort created event */ | ||
427 | BFA_LPORT_AEN_DELETE = 2, /* LPort deleted event */ | ||
428 | BFA_LPORT_AEN_ONLINE = 3, /* LPort online event */ | ||
429 | BFA_LPORT_AEN_OFFLINE = 4, /* LPort offline event */ | ||
430 | BFA_LPORT_AEN_DISCONNECT = 5, /* LPort disconnect event */ | ||
431 | BFA_LPORT_AEN_NEW_PROP = 6, /* VPort created event */ | ||
432 | BFA_LPORT_AEN_DELETE_PROP = 7, /* VPort deleted event */ | ||
433 | BFA_LPORT_AEN_NEW_STANDARD = 8, /* VPort created event */ | ||
434 | BFA_LPORT_AEN_DELETE_STANDARD = 9, /* VPort deleted event */ | ||
435 | BFA_LPORT_AEN_NPIV_DUP_WWN = 10, /* VPort with duplicate WWN */ | ||
436 | BFA_LPORT_AEN_NPIV_FABRIC_MAX = 11, /* Max NPIV in fabric/fport */ | ||
437 | BFA_LPORT_AEN_NPIV_UNKNOWN = 12, /* Unknown NPIV Error code */ | ||
438 | }; | ||
439 | |||
440 | struct bfa_lport_aen_data_s { | ||
441 | u16 vf_id; /* vf_id of this logical port */ | ||
442 | u16 roles; /* Logical port mode,IM/TM/IP etc */ | ||
443 | u32 rsvd; | ||
444 | wwn_t ppwwn; /* WWN of its physical port */ | ||
445 | wwn_t lpwwn; /* WWN of this logical port */ | ||
446 | }; | ||
447 | |||
448 | /* BFA ITNIM events */ | ||
449 | enum bfa_itnim_aen_event { | ||
450 | BFA_ITNIM_AEN_ONLINE = 1, /* Target online */ | ||
451 | BFA_ITNIM_AEN_OFFLINE = 2, /* Target offline */ | ||
452 | BFA_ITNIM_AEN_DISCONNECT = 3, /* Target disconnected */ | ||
453 | }; | ||
454 | |||
455 | struct bfa_itnim_aen_data_s { | ||
456 | u16 vf_id; /* vf_id of the IT nexus */ | ||
457 | u16 rsvd[3]; | ||
458 | wwn_t ppwwn; /* WWN of its physical port */ | ||
459 | wwn_t lpwwn; /* WWN of logical port */ | ||
460 | wwn_t rpwwn; /* WWN of remote(target) port */ | ||
461 | }; | ||
462 | |||
463 | /* BFA audit events */ | ||
464 | enum bfa_audit_aen_event { | ||
465 | BFA_AUDIT_AEN_AUTH_ENABLE = 1, | ||
466 | BFA_AUDIT_AEN_AUTH_DISABLE = 2, | ||
467 | BFA_AUDIT_AEN_FLASH_ERASE = 3, | ||
468 | BFA_AUDIT_AEN_FLASH_UPDATE = 4, | ||
469 | }; | ||
470 | |||
471 | struct bfa_audit_aen_data_s { | ||
472 | wwn_t pwwn; | ||
473 | int partition_inst; | ||
474 | int partition_type; | ||
475 | }; | ||
476 | |||
477 | /* BFA IOC level events */ | ||
478 | enum bfa_ioc_aen_event { | ||
479 | BFA_IOC_AEN_HBGOOD = 1, /* Heart Beat restore event */ | ||
480 | BFA_IOC_AEN_HBFAIL = 2, /* Heart Beat failure event */ | ||
481 | BFA_IOC_AEN_ENABLE = 3, /* IOC enabled event */ | ||
482 | BFA_IOC_AEN_DISABLE = 4, /* IOC disabled event */ | ||
483 | BFA_IOC_AEN_FWMISMATCH = 5, /* IOC firmware mismatch */ | ||
484 | BFA_IOC_AEN_FWCFG_ERROR = 6, /* IOC firmware config error */ | ||
485 | BFA_IOC_AEN_INVALID_VENDOR = 7, | ||
486 | BFA_IOC_AEN_INVALID_NWWN = 8, /* Zero NWWN */ | ||
487 | BFA_IOC_AEN_INVALID_PWWN = 9 /* Zero PWWN */ | ||
488 | }; | ||
489 | |||
490 | struct bfa_ioc_aen_data_s { | ||
491 | wwn_t pwwn; | ||
492 | u16 ioc_type; | ||
493 | mac_t mac; | ||
494 | }; | ||
495 | |||
496 | /* | ||
362 | * ---------------------- mfg definitions ------------ | 497 | * ---------------------- mfg definitions ------------ |
363 | */ | 498 | */ |
364 | 499 | ||
@@ -587,6 +722,14 @@ struct bfa_ablk_cfg_s { | |||
587 | */ | 722 | */ |
588 | #define SFP_DIAGMON_SIZE 10 /* num bytes of diag monitor data */ | 723 | #define SFP_DIAGMON_SIZE 10 /* num bytes of diag monitor data */ |
589 | 724 | ||
725 | /* SFP state change notification event */ | ||
726 | #define BFA_SFP_SCN_REMOVED 0 | ||
727 | #define BFA_SFP_SCN_INSERTED 1 | ||
728 | #define BFA_SFP_SCN_POM 2 | ||
729 | #define BFA_SFP_SCN_FAILED 3 | ||
730 | #define BFA_SFP_SCN_UNSUPPORT 4 | ||
731 | #define BFA_SFP_SCN_VALID 5 | ||
732 | |||
590 | enum bfa_defs_sfp_media_e { | 733 | enum bfa_defs_sfp_media_e { |
591 | BFA_SFP_MEDIA_UNKNOWN = 0x00, | 734 | BFA_SFP_MEDIA_UNKNOWN = 0x00, |
592 | BFA_SFP_MEDIA_CU = 0x01, | 735 | BFA_SFP_MEDIA_CU = 0x01, |
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h index 0b97525803fb..52866d87b24d 100644 --- a/drivers/scsi/bfa/bfa_defs_svc.h +++ b/drivers/scsi/bfa/bfa_defs_svc.h | |||
@@ -1228,4 +1228,52 @@ struct bfa_cee_stats_s { | |||
1228 | 1228 | ||
1229 | #pragma pack() | 1229 | #pragma pack() |
1230 | 1230 | ||
1231 | /* | ||
1232 | * AEN related definitions | ||
1233 | */ | ||
1234 | #define BFAD_NL_VENDOR_ID (((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) \ | ||
1235 | | BFA_PCI_VENDOR_ID_BROCADE) | ||
1236 | |||
1237 | /* BFA remote port events */ | ||
1238 | enum bfa_rport_aen_event { | ||
1239 | BFA_RPORT_AEN_ONLINE = 1, /* RPort online event */ | ||
1240 | BFA_RPORT_AEN_OFFLINE = 2, /* RPort offline event */ | ||
1241 | BFA_RPORT_AEN_DISCONNECT = 3, /* RPort disconnect event */ | ||
1242 | BFA_RPORT_AEN_QOS_PRIO = 4, /* QOS priority change event */ | ||
1243 | BFA_RPORT_AEN_QOS_FLOWID = 5, /* QOS flow Id change event */ | ||
1244 | }; | ||
1245 | |||
1246 | struct bfa_rport_aen_data_s { | ||
1247 | u16 vf_id; /* vf_id of this logical port */ | ||
1248 | u16 rsvd[3]; | ||
1249 | wwn_t ppwwn; /* WWN of its physical port */ | ||
1250 | wwn_t lpwwn; /* WWN of this logical port */ | ||
1251 | wwn_t rpwwn; /* WWN of this remote port */ | ||
1252 | union { | ||
1253 | struct bfa_rport_qos_attr_s qos; | ||
1254 | } priv; | ||
1255 | }; | ||
1256 | |||
1257 | union bfa_aen_data_u { | ||
1258 | struct bfa_adapter_aen_data_s adapter; | ||
1259 | struct bfa_port_aen_data_s port; | ||
1260 | struct bfa_lport_aen_data_s lport; | ||
1261 | struct bfa_rport_aen_data_s rport; | ||
1262 | struct bfa_itnim_aen_data_s itnim; | ||
1263 | struct bfa_audit_aen_data_s audit; | ||
1264 | struct bfa_ioc_aen_data_s ioc; | ||
1265 | }; | ||
1266 | |||
1267 | #define BFA_AEN_MAX_ENTRY 512 | ||
1268 | |||
1269 | struct bfa_aen_entry_s { | ||
1270 | struct list_head qe; | ||
1271 | enum bfa_aen_category aen_category; | ||
1272 | u32 aen_type; | ||
1273 | union bfa_aen_data_u aen_data; | ||
1274 | struct timeval aen_tv; | ||
1275 | u32 seq_num; | ||
1276 | u32 bfad_num; | ||
1277 | }; | ||
1278 | |||
1231 | #endif /* __BFA_DEFS_SVC_H__ */ | 1279 | #endif /* __BFA_DEFS_SVC_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index a9b22bc48bc3..eaac57e1ddec 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "bfad_drv.h" | 22 | #include "bfad_drv.h" |
23 | #include "bfad_im.h" | ||
23 | #include "bfa_fcs.h" | 24 | #include "bfa_fcs.h" |
24 | #include "bfa_fcbuild.h" | 25 | #include "bfa_fcbuild.h" |
25 | 26 | ||
@@ -1327,6 +1328,29 @@ bfa_fcs_fabric_flogiacc_comp(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg, | |||
1327 | bfa_trc(fabric->fcs, status); | 1328 | bfa_trc(fabric->fcs, status); |
1328 | } | 1329 | } |
1329 | 1330 | ||
1331 | |||
1332 | /* | ||
1333 | * Send AEN notification | ||
1334 | */ | ||
1335 | static void | ||
1336 | bfa_fcs_fabric_aen_post(struct bfa_fcs_lport_s *port, | ||
1337 | enum bfa_port_aen_event event) | ||
1338 | { | ||
1339 | struct bfad_s *bfad = (struct bfad_s *)port->fabric->fcs->bfad; | ||
1340 | struct bfa_aen_entry_s *aen_entry; | ||
1341 | |||
1342 | bfad_get_aen_entry(bfad, aen_entry); | ||
1343 | if (!aen_entry) | ||
1344 | return; | ||
1345 | |||
1346 | aen_entry->aen_data.port.pwwn = bfa_fcs_lport_get_pwwn(port); | ||
1347 | aen_entry->aen_data.port.fwwn = bfa_fcs_lport_get_fabric_name(port); | ||
1348 | |||
1349 | /* Send the AEN notification */ | ||
1350 | bfad_im_post_vendor_event(aen_entry, bfad, ++port->fcs->fcs_aen_seq, | ||
1351 | BFA_AEN_CAT_PORT, event); | ||
1352 | } | ||
1353 | |||
1330 | /* | 1354 | /* |
1331 | * | 1355 | * |
1332 | * @param[in] fabric - fabric | 1356 | * @param[in] fabric - fabric |
@@ -1358,6 +1382,8 @@ bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, | |||
1358 | BFA_LOG(KERN_WARNING, bfad, bfa_log_level, | 1382 | BFA_LOG(KERN_WARNING, bfad, bfa_log_level, |
1359 | "Base port WWN = %s Fabric WWN = %s\n", | 1383 | "Base port WWN = %s Fabric WWN = %s\n", |
1360 | pwwn_ptr, fwwn_ptr); | 1384 | pwwn_ptr, fwwn_ptr); |
1385 | bfa_fcs_fabric_aen_post(&fabric->bport, | ||
1386 | BFA_PORT_AEN_FABRIC_NAME_CHANGE); | ||
1361 | } | 1387 | } |
1362 | } | 1388 | } |
1363 | 1389 | ||
diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h index a5f1faf335a7..e75e07d25915 100644 --- a/drivers/scsi/bfa/bfa_fcs.h +++ b/drivers/scsi/bfa/bfa_fcs.h | |||
@@ -675,6 +675,7 @@ struct bfa_fcs_s { | |||
675 | struct bfa_fcs_fabric_s fabric; /* base fabric state machine */ | 675 | struct bfa_fcs_fabric_s fabric; /* base fabric state machine */ |
676 | struct bfa_fcs_stats_s stats; /* FCS statistics */ | 676 | struct bfa_fcs_stats_s stats; /* FCS statistics */ |
677 | struct bfa_wc_s wc; /* waiting counter */ | 677 | struct bfa_wc_s wc; /* waiting counter */ |
678 | int fcs_aen_seq; | ||
678 | }; | 679 | }; |
679 | 680 | ||
680 | /* | 681 | /* |
diff --git a/drivers/scsi/bfa/bfa_fcs_fcpim.c b/drivers/scsi/bfa/bfa_fcs_fcpim.c index 29b4108be269..9272840a2409 100644 --- a/drivers/scsi/bfa/bfa_fcs_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcs_fcpim.c | |||
@@ -37,6 +37,8 @@ static void bfa_fcs_itnim_prli_response(void *fcsarg, | |||
37 | struct bfa_fcxp_s *fcxp, void *cbarg, | 37 | struct bfa_fcxp_s *fcxp, void *cbarg, |
38 | bfa_status_t req_status, u32 rsp_len, | 38 | bfa_status_t req_status, u32 rsp_len, |
39 | u32 resid_len, struct fchs_s *rsp_fchs); | 39 | u32 resid_len, struct fchs_s *rsp_fchs); |
40 | static void bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim, | ||
41 | enum bfa_itnim_aen_event event); | ||
40 | 42 | ||
41 | /* | 43 | /* |
42 | * fcs_itnim_sm FCS itnim state machine events | 44 | * fcs_itnim_sm FCS itnim state machine events |
@@ -269,6 +271,7 @@ bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim, | |||
269 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 271 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
270 | "Target (WWN = %s) is online for initiator (WWN = %s)\n", | 272 | "Target (WWN = %s) is online for initiator (WWN = %s)\n", |
271 | rpwwn_buf, lpwwn_buf); | 273 | rpwwn_buf, lpwwn_buf); |
274 | bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_ONLINE); | ||
272 | break; | 275 | break; |
273 | 276 | ||
274 | case BFA_FCS_ITNIM_SM_OFFLINE: | 277 | case BFA_FCS_ITNIM_SM_OFFLINE: |
@@ -305,14 +308,17 @@ bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim, | |||
305 | bfa_itnim_offline(itnim->bfa_itnim); | 308 | bfa_itnim_offline(itnim->bfa_itnim); |
306 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port)); | 309 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port)); |
307 | wwn2str(rpwwn_buf, itnim->rport->pwwn); | 310 | wwn2str(rpwwn_buf, itnim->rport->pwwn); |
308 | if (bfa_fcs_lport_is_online(itnim->rport->port) == BFA_TRUE) | 311 | if (bfa_fcs_lport_is_online(itnim->rport->port) == BFA_TRUE) { |
309 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, | 312 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
310 | "Target (WWN = %s) connectivity lost for " | 313 | "Target (WWN = %s) connectivity lost for " |
311 | "initiator (WWN = %s)\n", rpwwn_buf, lpwwn_buf); | 314 | "initiator (WWN = %s)\n", rpwwn_buf, lpwwn_buf); |
312 | else | 315 | bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_DISCONNECT); |
316 | } else { | ||
313 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 317 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
314 | "Target (WWN = %s) offlined by initiator (WWN = %s)\n", | 318 | "Target (WWN = %s) offlined by initiator (WWN = %s)\n", |
315 | rpwwn_buf, lpwwn_buf); | 319 | rpwwn_buf, lpwwn_buf); |
320 | bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_OFFLINE); | ||
321 | } | ||
316 | break; | 322 | break; |
317 | 323 | ||
318 | case BFA_FCS_ITNIM_SM_DELETE: | 324 | case BFA_FCS_ITNIM_SM_DELETE: |
@@ -382,6 +388,33 @@ bfa_fcs_itnim_sm_initiator(struct bfa_fcs_itnim_s *itnim, | |||
382 | } | 388 | } |
383 | 389 | ||
384 | static void | 390 | static void |
391 | bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim, | ||
392 | enum bfa_itnim_aen_event event) | ||
393 | { | ||
394 | struct bfa_fcs_rport_s *rport = itnim->rport; | ||
395 | struct bfad_s *bfad = (struct bfad_s *)itnim->fcs->bfad; | ||
396 | struct bfa_aen_entry_s *aen_entry; | ||
397 | |||
398 | /* Don't post events for well known addresses */ | ||
399 | if (BFA_FCS_PID_IS_WKA(rport->pid)) | ||
400 | return; | ||
401 | |||
402 | bfad_get_aen_entry(bfad, aen_entry); | ||
403 | if (!aen_entry) | ||
404 | return; | ||
405 | |||
406 | aen_entry->aen_data.itnim.vf_id = rport->port->fabric->vf_id; | ||
407 | aen_entry->aen_data.itnim.ppwwn = bfa_fcs_lport_get_pwwn( | ||
408 | bfa_fcs_get_base_port(itnim->fcs)); | ||
409 | aen_entry->aen_data.itnim.lpwwn = bfa_fcs_lport_get_pwwn(rport->port); | ||
410 | aen_entry->aen_data.itnim.rpwwn = rport->pwwn; | ||
411 | |||
412 | /* Send the AEN notification */ | ||
413 | bfad_im_post_vendor_event(aen_entry, bfad, ++rport->fcs->fcs_aen_seq, | ||
414 | BFA_AEN_CAT_ITNIM, event); | ||
415 | } | ||
416 | |||
417 | static void | ||
385 | bfa_fcs_itnim_send_prli(void *itnim_cbarg, struct bfa_fcxp_s *fcxp_alloced) | 418 | bfa_fcs_itnim_send_prli(void *itnim_cbarg, struct bfa_fcxp_s *fcxp_alloced) |
386 | { | 419 | { |
387 | struct bfa_fcs_itnim_s *itnim = itnim_cbarg; | 420 | struct bfa_fcs_itnim_s *itnim = itnim_cbarg; |
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index f8251a91ba91..d4f951fe753e 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | 18 | #include "bfad_drv.h" |
19 | #include "bfad_im.h" | ||
19 | #include "bfa_fcs.h" | 20 | #include "bfa_fcs.h" |
20 | #include "bfa_fcbuild.h" | 21 | #include "bfa_fcbuild.h" |
21 | #include "bfa_fc.h" | 22 | #include "bfa_fc.h" |
@@ -300,6 +301,31 @@ bfa_fcs_lport_sm_deleting( | |||
300 | */ | 301 | */ |
301 | 302 | ||
302 | /* | 303 | /* |
304 | * Send AEN notification | ||
305 | */ | ||
306 | static void | ||
307 | bfa_fcs_lport_aen_post(struct bfa_fcs_lport_s *port, | ||
308 | enum bfa_lport_aen_event event) | ||
309 | { | ||
310 | struct bfad_s *bfad = (struct bfad_s *)port->fabric->fcs->bfad; | ||
311 | struct bfa_aen_entry_s *aen_entry; | ||
312 | |||
313 | bfad_get_aen_entry(bfad, aen_entry); | ||
314 | if (!aen_entry) | ||
315 | return; | ||
316 | |||
317 | aen_entry->aen_data.lport.vf_id = port->fabric->vf_id; | ||
318 | aen_entry->aen_data.lport.roles = port->port_cfg.roles; | ||
319 | aen_entry->aen_data.lport.ppwwn = bfa_fcs_lport_get_pwwn( | ||
320 | bfa_fcs_get_base_port(port->fcs)); | ||
321 | aen_entry->aen_data.lport.lpwwn = bfa_fcs_lport_get_pwwn(port); | ||
322 | |||
323 | /* Send the AEN notification */ | ||
324 | bfad_im_post_vendor_event(aen_entry, bfad, ++port->fcs->fcs_aen_seq, | ||
325 | BFA_AEN_CAT_LPORT, event); | ||
326 | } | ||
327 | |||
328 | /* | ||
303 | * Send a LS reject | 329 | * Send a LS reject |
304 | */ | 330 | */ |
305 | static void | 331 | static void |
@@ -593,6 +619,7 @@ bfa_fcs_lport_online_actions(struct bfa_fcs_lport_s *port) | |||
593 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 619 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
594 | "Logical port online: WWN = %s Role = %s\n", | 620 | "Logical port online: WWN = %s Role = %s\n", |
595 | lpwwn_buf, "Initiator"); | 621 | lpwwn_buf, "Initiator"); |
622 | bfa_fcs_lport_aen_post(port, BFA_LPORT_AEN_ONLINE); | ||
596 | 623 | ||
597 | bfad->bfad_flags |= BFAD_PORT_ONLINE; | 624 | bfad->bfad_flags |= BFAD_PORT_ONLINE; |
598 | } | 625 | } |
@@ -611,14 +638,17 @@ bfa_fcs_lport_offline_actions(struct bfa_fcs_lport_s *port) | |||
611 | 638 | ||
612 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 639 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
613 | if (bfa_sm_cmp_state(port->fabric, | 640 | if (bfa_sm_cmp_state(port->fabric, |
614 | bfa_fcs_fabric_sm_online) == BFA_TRUE) | 641 | bfa_fcs_fabric_sm_online) == BFA_TRUE) { |
615 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, | 642 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
616 | "Logical port lost fabric connectivity: WWN = %s Role = %s\n", | 643 | "Logical port lost fabric connectivity: WWN = %s Role = %s\n", |
617 | lpwwn_buf, "Initiator"); | 644 | lpwwn_buf, "Initiator"); |
618 | else | 645 | bfa_fcs_lport_aen_post(port, BFA_LPORT_AEN_DISCONNECT); |
646 | } else { | ||
619 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 647 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
620 | "Logical port taken offline: WWN = %s Role = %s\n", | 648 | "Logical port taken offline: WWN = %s Role = %s\n", |
621 | lpwwn_buf, "Initiator"); | 649 | lpwwn_buf, "Initiator"); |
650 | bfa_fcs_lport_aen_post(port, BFA_LPORT_AEN_OFFLINE); | ||
651 | } | ||
622 | 652 | ||
623 | list_for_each_safe(qe, qen, &port->rport_q) { | 653 | list_for_each_safe(qe, qen, &port->rport_q) { |
624 | rport = (struct bfa_fcs_rport_s *) qe; | 654 | rport = (struct bfa_fcs_rport_s *) qe; |
@@ -676,6 +706,7 @@ bfa_fcs_lport_deleted(struct bfa_fcs_lport_s *port) | |||
676 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 706 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
677 | "Logical port deleted: WWN = %s Role = %s\n", | 707 | "Logical port deleted: WWN = %s Role = %s\n", |
678 | lpwwn_buf, "Initiator"); | 708 | lpwwn_buf, "Initiator"); |
709 | bfa_fcs_lport_aen_post(port, BFA_LPORT_AEN_DELETE); | ||
679 | 710 | ||
680 | /* Base port will be deleted by the OS driver */ | 711 | /* Base port will be deleted by the OS driver */ |
681 | if (port->vport) { | 712 | if (port->vport) { |
@@ -973,6 +1004,7 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport, | |||
973 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 1004 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
974 | "New logical port created: WWN = %s Role = %s\n", | 1005 | "New logical port created: WWN = %s Role = %s\n", |
975 | lpwwn_buf, "Initiator"); | 1006 | lpwwn_buf, "Initiator"); |
1007 | bfa_fcs_lport_aen_post(lport, BFA_LPORT_AEN_NEW); | ||
976 | 1008 | ||
977 | bfa_sm_set_state(lport, bfa_fcs_lport_sm_uninit); | 1009 | bfa_sm_set_state(lport, bfa_fcs_lport_sm_uninit); |
978 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); | 1010 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); |
@@ -5559,6 +5591,31 @@ bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport, | |||
5559 | * fcs_vport_private FCS virtual port private functions | 5591 | * fcs_vport_private FCS virtual port private functions |
5560 | */ | 5592 | */ |
5561 | /* | 5593 | /* |
5594 | * Send AEN notification | ||
5595 | */ | ||
5596 | static void | ||
5597 | bfa_fcs_vport_aen_post(struct bfa_fcs_lport_s *port, | ||
5598 | enum bfa_lport_aen_event event) | ||
5599 | { | ||
5600 | struct bfad_s *bfad = (struct bfad_s *)port->fabric->fcs->bfad; | ||
5601 | struct bfa_aen_entry_s *aen_entry; | ||
5602 | |||
5603 | bfad_get_aen_entry(bfad, aen_entry); | ||
5604 | if (!aen_entry) | ||
5605 | return; | ||
5606 | |||
5607 | aen_entry->aen_data.lport.vf_id = port->fabric->vf_id; | ||
5608 | aen_entry->aen_data.lport.roles = port->port_cfg.roles; | ||
5609 | aen_entry->aen_data.lport.ppwwn = bfa_fcs_lport_get_pwwn( | ||
5610 | bfa_fcs_get_base_port(port->fcs)); | ||
5611 | aen_entry->aen_data.lport.lpwwn = bfa_fcs_lport_get_pwwn(port); | ||
5612 | |||
5613 | /* Send the AEN notification */ | ||
5614 | bfad_im_post_vendor_event(aen_entry, bfad, ++port->fcs->fcs_aen_seq, | ||
5615 | BFA_AEN_CAT_LPORT, event); | ||
5616 | } | ||
5617 | |||
5618 | /* | ||
5562 | * This routine will be called to send a FDISC command. | 5619 | * This routine will be called to send a FDISC command. |
5563 | */ | 5620 | */ |
5564 | static void | 5621 | static void |
@@ -5585,8 +5642,11 @@ bfa_fcs_vport_fdisc_rejected(struct bfa_fcs_vport_s *vport) | |||
5585 | case FC_LS_RJT_EXP_INVALID_NPORT_ID: /* by Cisco */ | 5642 | case FC_LS_RJT_EXP_INVALID_NPORT_ID: /* by Cisco */ |
5586 | if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) | 5643 | if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) |
5587 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); | 5644 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); |
5588 | else | 5645 | else { |
5646 | bfa_fcs_vport_aen_post(&vport->lport, | ||
5647 | BFA_LPORT_AEN_NPIV_DUP_WWN); | ||
5589 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_DUP_WWN); | 5648 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_DUP_WWN); |
5649 | } | ||
5590 | break; | 5650 | break; |
5591 | 5651 | ||
5592 | case FC_LS_RJT_EXP_INSUFF_RES: | 5652 | case FC_LS_RJT_EXP_INSUFF_RES: |
@@ -5596,11 +5656,17 @@ bfa_fcs_vport_fdisc_rejected(struct bfa_fcs_vport_s *vport) | |||
5596 | */ | 5656 | */ |
5597 | if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) | 5657 | if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) |
5598 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); | 5658 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); |
5599 | else | 5659 | else { |
5660 | bfa_fcs_vport_aen_post(&vport->lport, | ||
5661 | BFA_LPORT_AEN_NPIV_FABRIC_MAX); | ||
5600 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_FAILED); | 5662 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_FAILED); |
5663 | } | ||
5601 | break; | 5664 | break; |
5602 | 5665 | ||
5603 | default: | 5666 | default: |
5667 | if (vport->fdisc_retries == 0) | ||
5668 | bfa_fcs_vport_aen_post(&vport->lport, | ||
5669 | BFA_LPORT_AEN_NPIV_UNKNOWN); | ||
5604 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); | 5670 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_ERROR); |
5605 | } | 5671 | } |
5606 | } | 5672 | } |
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index 2c514458a6b4..52628d5d3c9b 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "bfad_drv.h" | 22 | #include "bfad_drv.h" |
23 | #include "bfad_im.h" | ||
23 | #include "bfa_fcs.h" | 24 | #include "bfa_fcs.h" |
24 | #include "bfa_fcbuild.h" | 25 | #include "bfa_fcbuild.h" |
25 | 26 | ||
@@ -2041,6 +2042,35 @@ bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport) | |||
2041 | } | 2042 | } |
2042 | 2043 | ||
2043 | static void | 2044 | static void |
2045 | bfa_fcs_rport_aen_post(struct bfa_fcs_rport_s *rport, | ||
2046 | enum bfa_rport_aen_event event, | ||
2047 | struct bfa_rport_aen_data_s *data) | ||
2048 | { | ||
2049 | struct bfa_fcs_lport_s *port = rport->port; | ||
2050 | struct bfad_s *bfad = (struct bfad_s *)port->fcs->bfad; | ||
2051 | struct bfa_aen_entry_s *aen_entry; | ||
2052 | |||
2053 | bfad_get_aen_entry(bfad, aen_entry); | ||
2054 | if (!aen_entry) | ||
2055 | return; | ||
2056 | |||
2057 | if (event == BFA_RPORT_AEN_QOS_PRIO) | ||
2058 | aen_entry->aen_data.rport.priv.qos = data->priv.qos; | ||
2059 | else if (event == BFA_RPORT_AEN_QOS_FLOWID) | ||
2060 | aen_entry->aen_data.rport.priv.qos = data->priv.qos; | ||
2061 | |||
2062 | aen_entry->aen_data.rport.vf_id = rport->port->fabric->vf_id; | ||
2063 | aen_entry->aen_data.rport.ppwwn = bfa_fcs_lport_get_pwwn( | ||
2064 | bfa_fcs_get_base_port(rport->fcs)); | ||
2065 | aen_entry->aen_data.rport.lpwwn = bfa_fcs_lport_get_pwwn(rport->port); | ||
2066 | aen_entry->aen_data.rport.rpwwn = rport->pwwn; | ||
2067 | |||
2068 | /* Send the AEN notification */ | ||
2069 | bfad_im_post_vendor_event(aen_entry, bfad, ++rport->fcs->fcs_aen_seq, | ||
2070 | BFA_AEN_CAT_RPORT, event); | ||
2071 | } | ||
2072 | |||
2073 | static void | ||
2044 | bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport) | 2074 | bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport) |
2045 | { | 2075 | { |
2046 | struct bfa_fcs_lport_s *port = rport->port; | 2076 | struct bfa_fcs_lport_s *port = rport->port; |
@@ -2063,10 +2093,12 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport) | |||
2063 | 2093 | ||
2064 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 2094 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
2065 | wwn2str(rpwwn_buf, rport->pwwn); | 2095 | wwn2str(rpwwn_buf, rport->pwwn); |
2066 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) | 2096 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) { |
2067 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2097 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2068 | "Remote port (WWN = %s) online for logical port (WWN = %s)\n", | 2098 | "Remote port (WWN = %s) online for logical port (WWN = %s)\n", |
2069 | rpwwn_buf, lpwwn_buf); | 2099 | rpwwn_buf, lpwwn_buf); |
2100 | bfa_fcs_rport_aen_post(rport, BFA_RPORT_AEN_ONLINE, NULL); | ||
2101 | } | ||
2070 | } | 2102 | } |
2071 | 2103 | ||
2072 | static void | 2104 | static void |
@@ -2083,16 +2115,21 @@ bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport) | |||
2083 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 2115 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
2084 | wwn2str(rpwwn_buf, rport->pwwn); | 2116 | wwn2str(rpwwn_buf, rport->pwwn); |
2085 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) { | 2117 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) { |
2086 | if (bfa_fcs_lport_is_online(rport->port) == BFA_TRUE) | 2118 | if (bfa_fcs_lport_is_online(rport->port) == BFA_TRUE) { |
2087 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, | 2119 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
2088 | "Remote port (WWN = %s) connectivity lost for " | 2120 | "Remote port (WWN = %s) connectivity lost for " |
2089 | "logical port (WWN = %s)\n", | 2121 | "logical port (WWN = %s)\n", |
2090 | rpwwn_buf, lpwwn_buf); | 2122 | rpwwn_buf, lpwwn_buf); |
2091 | else | 2123 | bfa_fcs_rport_aen_post(rport, |
2124 | BFA_RPORT_AEN_DISCONNECT, NULL); | ||
2125 | } else { | ||
2092 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2126 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2093 | "Remote port (WWN = %s) offlined by " | 2127 | "Remote port (WWN = %s) offlined by " |
2094 | "logical port (WWN = %s)\n", | 2128 | "logical port (WWN = %s)\n", |
2095 | rpwwn_buf, lpwwn_buf); | 2129 | rpwwn_buf, lpwwn_buf); |
2130 | bfa_fcs_rport_aen_post(rport, | ||
2131 | BFA_RPORT_AEN_OFFLINE, NULL); | ||
2132 | } | ||
2096 | } | 2133 | } |
2097 | 2134 | ||
2098 | if (bfa_fcs_lport_is_initiator(port)) { | 2135 | if (bfa_fcs_lport_is_initiator(port)) { |
@@ -2366,8 +2403,11 @@ bfa_cb_rport_qos_scn_flowid(void *cbarg, | |||
2366 | struct bfa_rport_qos_attr_s new_qos_attr) | 2403 | struct bfa_rport_qos_attr_s new_qos_attr) |
2367 | { | 2404 | { |
2368 | struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg; | 2405 | struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg; |
2406 | struct bfa_rport_aen_data_s aen_data; | ||
2369 | 2407 | ||
2370 | bfa_trc(rport->fcs, rport->pwwn); | 2408 | bfa_trc(rport->fcs, rport->pwwn); |
2409 | aen_data.priv.qos = new_qos_attr; | ||
2410 | bfa_fcs_rport_aen_post(rport, BFA_RPORT_AEN_QOS_FLOWID, &aen_data); | ||
2371 | } | 2411 | } |
2372 | 2412 | ||
2373 | /* | 2413 | /* |
@@ -2390,8 +2430,11 @@ bfa_cb_rport_qos_scn_prio(void *cbarg, | |||
2390 | struct bfa_rport_qos_attr_s new_qos_attr) | 2430 | struct bfa_rport_qos_attr_s new_qos_attr) |
2391 | { | 2431 | { |
2392 | struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg; | 2432 | struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg; |
2433 | struct bfa_rport_aen_data_s aen_data; | ||
2393 | 2434 | ||
2394 | bfa_trc(rport->fcs, rport->pwwn); | 2435 | bfa_trc(rport->fcs, rport->pwwn); |
2436 | aen_data.priv.qos = new_qos_attr; | ||
2437 | bfa_fcs_rport_aen_post(rport, BFA_RPORT_AEN_QOS_PRIO, &aen_data); | ||
2395 | } | 2438 | } |
2396 | 2439 | ||
2397 | /* | 2440 | /* |
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index d6c2bf3865d2..27c5565ba2c3 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | 18 | #include "bfad_drv.h" |
19 | #include "bfad_im.h" | ||
19 | #include "bfa_ioc.h" | 20 | #include "bfa_ioc.h" |
20 | #include "bfi_reg.h" | 21 | #include "bfi_reg.h" |
21 | #include "bfa_defs.h" | 22 | #include "bfa_defs.h" |
@@ -458,6 +459,7 @@ bfa_ioc_sm_op_entry(struct bfa_ioc_s *ioc) | |||
458 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_OK); | 459 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_OK); |
459 | bfa_ioc_event_notify(ioc, BFA_IOC_E_ENABLED); | 460 | bfa_ioc_event_notify(ioc, BFA_IOC_E_ENABLED); |
460 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC enabled\n"); | 461 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC enabled\n"); |
462 | bfa_ioc_aen_post(ioc, BFA_IOC_AEN_ENABLE); | ||
461 | } | 463 | } |
462 | 464 | ||
463 | static void | 465 | static void |
@@ -502,6 +504,7 @@ bfa_ioc_sm_disabling_entry(struct bfa_ioc_s *ioc) | |||
502 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; | 504 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; |
503 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_DISABLE); | 505 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_DISABLE); |
504 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC disabled\n"); | 506 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC disabled\n"); |
507 | bfa_ioc_aen_post(ioc, BFA_IOC_AEN_DISABLE); | ||
505 | } | 508 | } |
506 | 509 | ||
507 | /* | 510 | /* |
@@ -1966,6 +1969,7 @@ bfa_ioc_fail_notify(struct bfa_ioc_s *ioc) | |||
1966 | 1969 | ||
1967 | BFA_LOG(KERN_CRIT, bfad, bfa_log_level, | 1970 | BFA_LOG(KERN_CRIT, bfad, bfa_log_level, |
1968 | "Heart Beat of IOC has failed\n"); | 1971 | "Heart Beat of IOC has failed\n"); |
1972 | bfa_ioc_aen_post(ioc, BFA_IOC_AEN_HBFAIL); | ||
1969 | 1973 | ||
1970 | } | 1974 | } |
1971 | 1975 | ||
@@ -1980,6 +1984,7 @@ bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc) | |||
1980 | BFA_LOG(KERN_WARNING, bfad, bfa_log_level, | 1984 | BFA_LOG(KERN_WARNING, bfad, bfa_log_level, |
1981 | "Running firmware version is incompatible " | 1985 | "Running firmware version is incompatible " |
1982 | "with the driver version\n"); | 1986 | "with the driver version\n"); |
1987 | bfa_ioc_aen_post(ioc, BFA_IOC_AEN_FWMISMATCH); | ||
1983 | } | 1988 | } |
1984 | 1989 | ||
1985 | bfa_status_t | 1990 | bfa_status_t |
@@ -2679,6 +2684,43 @@ bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc) | |||
2679 | } | 2684 | } |
2680 | 2685 | ||
2681 | /* | 2686 | /* |
2687 | * Send AEN notification | ||
2688 | */ | ||
2689 | void | ||
2690 | bfa_ioc_aen_post(struct bfa_ioc_s *ioc, enum bfa_ioc_aen_event event) | ||
2691 | { | ||
2692 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; | ||
2693 | struct bfa_aen_entry_s *aen_entry; | ||
2694 | enum bfa_ioc_type_e ioc_type; | ||
2695 | |||
2696 | bfad_get_aen_entry(bfad, aen_entry); | ||
2697 | if (!aen_entry) | ||
2698 | return; | ||
2699 | |||
2700 | ioc_type = bfa_ioc_get_type(ioc); | ||
2701 | switch (ioc_type) { | ||
2702 | case BFA_IOC_TYPE_FC: | ||
2703 | aen_entry->aen_data.ioc.pwwn = ioc->attr->pwwn; | ||
2704 | break; | ||
2705 | case BFA_IOC_TYPE_FCoE: | ||
2706 | aen_entry->aen_data.ioc.pwwn = ioc->attr->pwwn; | ||
2707 | aen_entry->aen_data.ioc.mac = bfa_ioc_get_mac(ioc); | ||
2708 | break; | ||
2709 | case BFA_IOC_TYPE_LL: | ||
2710 | aen_entry->aen_data.ioc.mac = bfa_ioc_get_mac(ioc); | ||
2711 | break; | ||
2712 | default: | ||
2713 | WARN_ON(ioc_type != BFA_IOC_TYPE_FC); | ||
2714 | break; | ||
2715 | } | ||
2716 | |||
2717 | /* Send the AEN notification */ | ||
2718 | aen_entry->aen_data.ioc.ioc_type = ioc_type; | ||
2719 | bfad_im_post_vendor_event(aen_entry, bfad, ++ioc->ioc_aen_seq, | ||
2720 | BFA_AEN_CAT_IOC, event); | ||
2721 | } | ||
2722 | |||
2723 | /* | ||
2682 | * Retrieve saved firmware trace from a prior IOC failure. | 2724 | * Retrieve saved firmware trace from a prior IOC failure. |
2683 | */ | 2725 | */ |
2684 | bfa_status_t | 2726 | bfa_status_t |
@@ -2879,6 +2921,10 @@ bfa_ioc_check_attr_wwns(struct bfa_ioc_s *ioc) | |||
2879 | { | 2921 | { |
2880 | if (bfa_ioc_get_type(ioc) == BFA_IOC_TYPE_LL) | 2922 | if (bfa_ioc_get_type(ioc) == BFA_IOC_TYPE_LL) |
2881 | return; | 2923 | return; |
2924 | if (ioc->attr->nwwn == 0) | ||
2925 | bfa_ioc_aen_post(ioc, BFA_IOC_AEN_INVALID_NWWN); | ||
2926 | if (ioc->attr->pwwn == 0) | ||
2927 | bfa_ioc_aen_post(ioc, BFA_IOC_AEN_INVALID_PWWN); | ||
2882 | } | 2928 | } |
2883 | 2929 | ||
2884 | /* | 2930 | /* |
@@ -3443,6 +3489,54 @@ bfa_sfp_notify(void *sfp_arg, enum bfa_ioc_event_e event) | |||
3443 | } | 3489 | } |
3444 | 3490 | ||
3445 | /* | 3491 | /* |
3492 | * SFP's State Change Notification post to AEN | ||
3493 | */ | ||
3494 | static void | ||
3495 | bfa_sfp_scn_aen_post(struct bfa_sfp_s *sfp, struct bfi_sfp_scn_s *rsp) | ||
3496 | { | ||
3497 | struct bfad_s *bfad = (struct bfad_s *)sfp->ioc->bfa->bfad; | ||
3498 | struct bfa_aen_entry_s *aen_entry; | ||
3499 | enum bfa_port_aen_event aen_evt = 0; | ||
3500 | |||
3501 | bfa_trc(sfp, (((u64)rsp->pomlvl) << 16) | (((u64)rsp->sfpid) << 8) | | ||
3502 | ((u64)rsp->event)); | ||
3503 | |||
3504 | bfad_get_aen_entry(bfad, aen_entry); | ||
3505 | if (!aen_entry) | ||
3506 | return; | ||
3507 | |||
3508 | aen_entry->aen_data.port.ioc_type = bfa_ioc_get_type(sfp->ioc); | ||
3509 | aen_entry->aen_data.port.pwwn = sfp->ioc->attr->pwwn; | ||
3510 | aen_entry->aen_data.port.mac = bfa_ioc_get_mac(sfp->ioc); | ||
3511 | |||
3512 | switch (rsp->event) { | ||
3513 | case BFA_SFP_SCN_INSERTED: | ||
3514 | aen_evt = BFA_PORT_AEN_SFP_INSERT; | ||
3515 | break; | ||
3516 | case BFA_SFP_SCN_REMOVED: | ||
3517 | aen_evt = BFA_PORT_AEN_SFP_REMOVE; | ||
3518 | break; | ||
3519 | case BFA_SFP_SCN_FAILED: | ||
3520 | aen_evt = BFA_PORT_AEN_SFP_ACCESS_ERROR; | ||
3521 | break; | ||
3522 | case BFA_SFP_SCN_UNSUPPORT: | ||
3523 | aen_evt = BFA_PORT_AEN_SFP_UNSUPPORT; | ||
3524 | break; | ||
3525 | case BFA_SFP_SCN_POM: | ||
3526 | aen_evt = BFA_PORT_AEN_SFP_POM; | ||
3527 | aen_entry->aen_data.port.level = rsp->pomlvl; | ||
3528 | break; | ||
3529 | default: | ||
3530 | bfa_trc(sfp, rsp->event); | ||
3531 | WARN_ON(1); | ||
3532 | } | ||
3533 | |||
3534 | /* Send the AEN notification */ | ||
3535 | bfad_im_post_vendor_event(aen_entry, bfad, ++sfp->ioc->ioc_aen_seq, | ||
3536 | BFA_AEN_CAT_PORT, aen_evt); | ||
3537 | } | ||
3538 | |||
3539 | /* | ||
3446 | * SFP get data send | 3540 | * SFP get data send |
3447 | */ | 3541 | */ |
3448 | static void | 3542 | static void |
@@ -3482,6 +3576,50 @@ bfa_sfp_getdata(struct bfa_sfp_s *sfp, enum bfi_sfp_mem_e memtype) | |||
3482 | } | 3576 | } |
3483 | 3577 | ||
3484 | /* | 3578 | /* |
3579 | * SFP scn handler | ||
3580 | */ | ||
3581 | static void | ||
3582 | bfa_sfp_scn(struct bfa_sfp_s *sfp, struct bfi_mbmsg_s *msg) | ||
3583 | { | ||
3584 | struct bfi_sfp_scn_s *rsp = (struct bfi_sfp_scn_s *) msg; | ||
3585 | |||
3586 | switch (rsp->event) { | ||
3587 | case BFA_SFP_SCN_INSERTED: | ||
3588 | sfp->state = BFA_SFP_STATE_INSERTED; | ||
3589 | sfp->data_valid = 0; | ||
3590 | bfa_sfp_scn_aen_post(sfp, rsp); | ||
3591 | break; | ||
3592 | case BFA_SFP_SCN_REMOVED: | ||
3593 | sfp->state = BFA_SFP_STATE_REMOVED; | ||
3594 | sfp->data_valid = 0; | ||
3595 | bfa_sfp_scn_aen_post(sfp, rsp); | ||
3596 | break; | ||
3597 | case BFA_SFP_SCN_FAILED: | ||
3598 | sfp->state = BFA_SFP_STATE_FAILED; | ||
3599 | sfp->data_valid = 0; | ||
3600 | bfa_sfp_scn_aen_post(sfp, rsp); | ||
3601 | break; | ||
3602 | case BFA_SFP_SCN_UNSUPPORT: | ||
3603 | sfp->state = BFA_SFP_STATE_UNSUPPORT; | ||
3604 | bfa_sfp_scn_aen_post(sfp, rsp); | ||
3605 | if (!sfp->lock) | ||
3606 | bfa_sfp_getdata(sfp, BFI_SFP_MEM_ALL); | ||
3607 | break; | ||
3608 | case BFA_SFP_SCN_POM: | ||
3609 | bfa_sfp_scn_aen_post(sfp, rsp); | ||
3610 | break; | ||
3611 | case BFA_SFP_SCN_VALID: | ||
3612 | sfp->state = BFA_SFP_STATE_VALID; | ||
3613 | if (!sfp->lock) | ||
3614 | bfa_sfp_getdata(sfp, BFI_SFP_MEM_ALL); | ||
3615 | break; | ||
3616 | default: | ||
3617 | bfa_trc(sfp, rsp->event); | ||
3618 | WARN_ON(1); | ||
3619 | } | ||
3620 | } | ||
3621 | |||
3622 | /* | ||
3485 | * SFP show complete | 3623 | * SFP show complete |
3486 | */ | 3624 | */ |
3487 | static void | 3625 | static void |
@@ -3645,7 +3783,7 @@ bfa_sfp_intr(void *sfparg, struct bfi_mbmsg_s *msg) | |||
3645 | break; | 3783 | break; |
3646 | 3784 | ||
3647 | case BFI_SFP_I2H_SCN: | 3785 | case BFI_SFP_I2H_SCN: |
3648 | bfa_trc(sfp, msg->mh.msg_id); | 3786 | bfa_sfp_scn(sfp, msg); |
3649 | break; | 3787 | break; |
3650 | 3788 | ||
3651 | default: | 3789 | default: |
@@ -3838,6 +3976,26 @@ bfa_sfp_speed(struct bfa_sfp_s *sfp, enum bfa_port_speed portspeed, | |||
3838 | BFA_ROUNDUP(0x010000 + sizeof(struct bfa_mfg_block_s), BFA_FLASH_SEG_SZ) | 3976 | BFA_ROUNDUP(0x010000 + sizeof(struct bfa_mfg_block_s), BFA_FLASH_SEG_SZ) |
3839 | 3977 | ||
3840 | static void | 3978 | static void |
3979 | bfa_flash_aen_audit_post(struct bfa_ioc_s *ioc, enum bfa_audit_aen_event event, | ||
3980 | int inst, int type) | ||
3981 | { | ||
3982 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; | ||
3983 | struct bfa_aen_entry_s *aen_entry; | ||
3984 | |||
3985 | bfad_get_aen_entry(bfad, aen_entry); | ||
3986 | if (!aen_entry) | ||
3987 | return; | ||
3988 | |||
3989 | aen_entry->aen_data.audit.pwwn = ioc->attr->pwwn; | ||
3990 | aen_entry->aen_data.audit.partition_inst = inst; | ||
3991 | aen_entry->aen_data.audit.partition_type = type; | ||
3992 | |||
3993 | /* Send the AEN notification */ | ||
3994 | bfad_im_post_vendor_event(aen_entry, bfad, ++ioc->ioc_aen_seq, | ||
3995 | BFA_AEN_CAT_AUDIT, event); | ||
3996 | } | ||
3997 | |||
3998 | static void | ||
3841 | bfa_flash_cb(struct bfa_flash_s *flash) | 3999 | bfa_flash_cb(struct bfa_flash_s *flash) |
3842 | { | 4000 | { |
3843 | flash->op_busy = 0; | 4001 | flash->op_busy = 0; |
@@ -3978,6 +4136,7 @@ bfa_flash_intr(void *flasharg, struct bfi_mbmsg_s *msg) | |||
3978 | struct bfi_flash_erase_rsp_s *erase; | 4136 | struct bfi_flash_erase_rsp_s *erase; |
3979 | struct bfi_flash_write_rsp_s *write; | 4137 | struct bfi_flash_write_rsp_s *write; |
3980 | struct bfi_flash_read_rsp_s *read; | 4138 | struct bfi_flash_read_rsp_s *read; |
4139 | struct bfi_flash_event_s *event; | ||
3981 | struct bfi_mbmsg_s *msg; | 4140 | struct bfi_mbmsg_s *msg; |
3982 | } m; | 4141 | } m; |
3983 | 4142 | ||
@@ -4061,8 +4220,19 @@ bfa_flash_intr(void *flasharg, struct bfi_mbmsg_s *msg) | |||
4061 | } | 4220 | } |
4062 | break; | 4221 | break; |
4063 | case BFI_FLASH_I2H_BOOT_VER_RSP: | 4222 | case BFI_FLASH_I2H_BOOT_VER_RSP: |
4223 | break; | ||
4064 | case BFI_FLASH_I2H_EVENT: | 4224 | case BFI_FLASH_I2H_EVENT: |
4065 | bfa_trc(flash, msg->mh.msg_id); | 4225 | status = be32_to_cpu(m.event->status); |
4226 | bfa_trc(flash, status); | ||
4227 | if (status == BFA_STATUS_BAD_FWCFG) | ||
4228 | bfa_ioc_aen_post(flash->ioc, BFA_IOC_AEN_FWCFG_ERROR); | ||
4229 | else if (status == BFA_STATUS_INVALID_VENDOR) { | ||
4230 | u32 param; | ||
4231 | param = be32_to_cpu(m.event->param); | ||
4232 | bfa_trc(flash, param); | ||
4233 | bfa_ioc_aen_post(flash->ioc, | ||
4234 | BFA_IOC_AEN_INVALID_VENDOR); | ||
4235 | } | ||
4066 | break; | 4236 | break; |
4067 | 4237 | ||
4068 | default: | 4238 | default: |
@@ -4204,6 +4374,8 @@ bfa_flash_erase_part(struct bfa_flash_s *flash, enum bfa_flash_part_type type, | |||
4204 | flash->instance = instance; | 4374 | flash->instance = instance; |
4205 | 4375 | ||
4206 | bfa_flash_erase_send(flash); | 4376 | bfa_flash_erase_send(flash); |
4377 | bfa_flash_aen_audit_post(flash->ioc, BFA_AUDIT_AEN_FLASH_ERASE, | ||
4378 | instance, type); | ||
4207 | return BFA_STATUS_OK; | 4379 | return BFA_STATUS_OK; |
4208 | } | 4380 | } |
4209 | 4381 | ||
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index c5ecd2edc95d..28bf6e18f33e 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -327,6 +327,7 @@ struct bfa_ioc_s { | |||
327 | enum bfa_mode_s port_mode; | 327 | enum bfa_mode_s port_mode; |
328 | u8 ad_cap_bm; /* adapter cap bit mask */ | 328 | u8 ad_cap_bm; /* adapter cap bit mask */ |
329 | u8 port_mode_cfg; /* config port mode */ | 329 | u8 port_mode_cfg; /* config port mode */ |
330 | int ioc_aen_seq; | ||
330 | }; | 331 | }; |
331 | 332 | ||
332 | struct bfa_ioc_hwif_s { | 333 | struct bfa_ioc_hwif_s { |
@@ -803,6 +804,7 @@ void bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, | |||
803 | struct bfi_ioc_image_hdr_s *fwhdr); | 804 | struct bfi_ioc_image_hdr_s *fwhdr); |
804 | bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, | 805 | bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, |
805 | struct bfi_ioc_image_hdr_s *fwhdr); | 806 | struct bfi_ioc_image_hdr_s *fwhdr); |
807 | void bfa_ioc_aen_post(struct bfa_ioc_s *ioc, enum bfa_ioc_aen_event event); | ||
806 | bfa_status_t bfa_ioc_fw_stats_get(struct bfa_ioc_s *ioc, void *stats); | 808 | bfa_status_t bfa_ioc_fw_stats_get(struct bfa_ioc_s *ioc, void *stats); |
807 | bfa_status_t bfa_ioc_fw_stats_clear(struct bfa_ioc_s *ioc); | 809 | bfa_status_t bfa_ioc_fw_stats_clear(struct bfa_ioc_s *ioc); |
808 | 810 | ||
diff --git a/drivers/scsi/bfa/bfa_modules.h b/drivers/scsi/bfa/bfa_modules.h index 1c6efd40a673..cd51ddf64ae5 100644 --- a/drivers/scsi/bfa/bfa_modules.h +++ b/drivers/scsi/bfa/bfa_modules.h | |||
@@ -119,6 +119,7 @@ struct bfa_s { | |||
119 | struct list_head reqq_waitq[BFI_IOC_MAX_CQS]; | 119 | struct list_head reqq_waitq[BFI_IOC_MAX_CQS]; |
120 | bfa_boolean_t fcs; /* FCS is attached to BFA */ | 120 | bfa_boolean_t fcs; /* FCS is attached to BFA */ |
121 | struct bfa_msix_s msix; | 121 | struct bfa_msix_s msix; |
122 | int bfa_aen_seq; | ||
122 | }; | 123 | }; |
123 | 124 | ||
124 | extern bfa_boolean_t bfa_auto_recover; | 125 | extern bfa_boolean_t bfa_auto_recover; |
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index 21caaefce99f..136f5f922cd3 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | 18 | #include "bfad_drv.h" |
19 | #include "bfad_im.h" | ||
19 | #include "bfa_plog.h" | 20 | #include "bfa_plog.h" |
20 | #include "bfa_cs.h" | 21 | #include "bfa_cs.h" |
21 | #include "bfa_modules.h" | 22 | #include "bfa_modules.h" |
@@ -2007,6 +2008,24 @@ bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
2007 | } | 2008 | } |
2008 | } | 2009 | } |
2009 | 2010 | ||
2011 | static void | ||
2012 | bfa_fcport_aen_post(struct bfa_fcport_s *fcport, enum bfa_port_aen_event event) | ||
2013 | { | ||
2014 | struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad; | ||
2015 | struct bfa_aen_entry_s *aen_entry; | ||
2016 | |||
2017 | bfad_get_aen_entry(bfad, aen_entry); | ||
2018 | if (!aen_entry) | ||
2019 | return; | ||
2020 | |||
2021 | aen_entry->aen_data.port.ioc_type = bfa_get_type(fcport->bfa); | ||
2022 | aen_entry->aen_data.port.pwwn = fcport->pwwn; | ||
2023 | |||
2024 | /* Send the AEN notification */ | ||
2025 | bfad_im_post_vendor_event(aen_entry, bfad, ++fcport->bfa->bfa_aen_seq, | ||
2026 | BFA_AEN_CAT_PORT, event); | ||
2027 | } | ||
2028 | |||
2010 | /* | 2029 | /* |
2011 | * FC PORT state machine functions | 2030 | * FC PORT state machine functions |
2012 | */ | 2031 | */ |
@@ -2095,6 +2114,7 @@ bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport, | |||
2095 | wwn2str(pwwn_buf, fcport->pwwn); | 2114 | wwn2str(pwwn_buf, fcport->pwwn); |
2096 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2115 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2097 | "Base port disabled: WWN = %s\n", pwwn_buf); | 2116 | "Base port disabled: WWN = %s\n", pwwn_buf); |
2117 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); | ||
2098 | break; | 2118 | break; |
2099 | 2119 | ||
2100 | case BFA_FCPORT_SM_LINKUP: | 2120 | case BFA_FCPORT_SM_LINKUP: |
@@ -2155,6 +2175,7 @@ bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport, | |||
2155 | wwn2str(pwwn_buf, fcport->pwwn); | 2175 | wwn2str(pwwn_buf, fcport->pwwn); |
2156 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2176 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2157 | "Base port disabled: WWN = %s\n", pwwn_buf); | 2177 | "Base port disabled: WWN = %s\n", pwwn_buf); |
2178 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); | ||
2158 | break; | 2179 | break; |
2159 | 2180 | ||
2160 | case BFA_FCPORT_SM_STOP: | 2181 | case BFA_FCPORT_SM_STOP: |
@@ -2208,6 +2229,7 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, | |||
2208 | wwn2str(pwwn_buf, fcport->pwwn); | 2229 | wwn2str(pwwn_buf, fcport->pwwn); |
2209 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2230 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2210 | "Base port online: WWN = %s\n", pwwn_buf); | 2231 | "Base port online: WWN = %s\n", pwwn_buf); |
2232 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ONLINE); | ||
2211 | break; | 2233 | break; |
2212 | 2234 | ||
2213 | case BFA_FCPORT_SM_LINKDOWN: | 2235 | case BFA_FCPORT_SM_LINKDOWN: |
@@ -2234,6 +2256,7 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, | |||
2234 | wwn2str(pwwn_buf, fcport->pwwn); | 2256 | wwn2str(pwwn_buf, fcport->pwwn); |
2235 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2257 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2236 | "Base port disabled: WWN = %s\n", pwwn_buf); | 2258 | "Base port disabled: WWN = %s\n", pwwn_buf); |
2259 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); | ||
2237 | break; | 2260 | break; |
2238 | 2261 | ||
2239 | case BFA_FCPORT_SM_STOP: | 2262 | case BFA_FCPORT_SM_STOP: |
@@ -2279,8 +2302,10 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, | |||
2279 | wwn2str(pwwn_buf, fcport->pwwn); | 2302 | wwn2str(pwwn_buf, fcport->pwwn); |
2280 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2303 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2281 | "Base port offline: WWN = %s\n", pwwn_buf); | 2304 | "Base port offline: WWN = %s\n", pwwn_buf); |
2305 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE); | ||
2282 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2306 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2283 | "Base port disabled: WWN = %s\n", pwwn_buf); | 2307 | "Base port disabled: WWN = %s\n", pwwn_buf); |
2308 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); | ||
2284 | break; | 2309 | break; |
2285 | 2310 | ||
2286 | case BFA_FCPORT_SM_LINKDOWN: | 2311 | case BFA_FCPORT_SM_LINKDOWN: |
@@ -2290,26 +2315,32 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, | |||
2290 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | 2315 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
2291 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); | 2316 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); |
2292 | wwn2str(pwwn_buf, fcport->pwwn); | 2317 | wwn2str(pwwn_buf, fcport->pwwn); |
2293 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) | 2318 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) { |
2294 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2319 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2295 | "Base port offline: WWN = %s\n", pwwn_buf); | 2320 | "Base port offline: WWN = %s\n", pwwn_buf); |
2296 | else | 2321 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE); |
2322 | } else { | ||
2297 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, | 2323 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
2298 | "Base port (WWN = %s) " | 2324 | "Base port (WWN = %s) " |
2299 | "lost fabric connectivity\n", pwwn_buf); | 2325 | "lost fabric connectivity\n", pwwn_buf); |
2326 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); | ||
2327 | } | ||
2300 | break; | 2328 | break; |
2301 | 2329 | ||
2302 | case BFA_FCPORT_SM_STOP: | 2330 | case BFA_FCPORT_SM_STOP: |
2303 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); | 2331 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); |
2304 | bfa_fcport_reset_linkinfo(fcport); | 2332 | bfa_fcport_reset_linkinfo(fcport); |
2305 | wwn2str(pwwn_buf, fcport->pwwn); | 2333 | wwn2str(pwwn_buf, fcport->pwwn); |
2306 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) | 2334 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) { |
2307 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2335 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2308 | "Base port offline: WWN = %s\n", pwwn_buf); | 2336 | "Base port offline: WWN = %s\n", pwwn_buf); |
2309 | else | 2337 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE); |
2338 | } else { | ||
2310 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, | 2339 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
2311 | "Base port (WWN = %s) " | 2340 | "Base port (WWN = %s) " |
2312 | "lost fabric connectivity\n", pwwn_buf); | 2341 | "lost fabric connectivity\n", pwwn_buf); |
2342 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); | ||
2343 | } | ||
2313 | break; | 2344 | break; |
2314 | 2345 | ||
2315 | case BFA_FCPORT_SM_HWFAIL: | 2346 | case BFA_FCPORT_SM_HWFAIL: |
@@ -2317,13 +2348,16 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, | |||
2317 | bfa_fcport_reset_linkinfo(fcport); | 2348 | bfa_fcport_reset_linkinfo(fcport); |
2318 | bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE); | 2349 | bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE); |
2319 | wwn2str(pwwn_buf, fcport->pwwn); | 2350 | wwn2str(pwwn_buf, fcport->pwwn); |
2320 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) | 2351 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) { |
2321 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2352 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2322 | "Base port offline: WWN = %s\n", pwwn_buf); | 2353 | "Base port offline: WWN = %s\n", pwwn_buf); |
2323 | else | 2354 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE); |
2355 | } else { | ||
2324 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, | 2356 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
2325 | "Base port (WWN = %s) " | 2357 | "Base port (WWN = %s) " |
2326 | "lost fabric connectivity\n", pwwn_buf); | 2358 | "lost fabric connectivity\n", pwwn_buf); |
2359 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); | ||
2360 | } | ||
2327 | break; | 2361 | break; |
2328 | 2362 | ||
2329 | default: | 2363 | default: |
@@ -2454,6 +2488,7 @@ bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport, | |||
2454 | wwn2str(pwwn_buf, fcport->pwwn); | 2488 | wwn2str(pwwn_buf, fcport->pwwn); |
2455 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2489 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2456 | "Base port enabled: WWN = %s\n", pwwn_buf); | 2490 | "Base port enabled: WWN = %s\n", pwwn_buf); |
2491 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE); | ||
2457 | break; | 2492 | break; |
2458 | 2493 | ||
2459 | case BFA_FCPORT_SM_STOP: | 2494 | case BFA_FCPORT_SM_STOP: |
@@ -2508,6 +2543,7 @@ bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport, | |||
2508 | wwn2str(pwwn_buf, fcport->pwwn); | 2543 | wwn2str(pwwn_buf, fcport->pwwn); |
2509 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, | 2544 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2510 | "Base port enabled: WWN = %s\n", pwwn_buf); | 2545 | "Base port enabled: WWN = %s\n", pwwn_buf); |
2546 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE); | ||
2511 | break; | 2547 | break; |
2512 | 2548 | ||
2513 | case BFA_FCPORT_SM_DISABLE: | 2549 | case BFA_FCPORT_SM_DISABLE: |
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index beb30a748ea5..66fb72531b34 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -1348,7 +1348,7 @@ int | |||
1348 | bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) | 1348 | bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) |
1349 | { | 1349 | { |
1350 | struct bfad_s *bfad; | 1350 | struct bfad_s *bfad; |
1351 | int error = -ENODEV, retval; | 1351 | int error = -ENODEV, retval, i; |
1352 | 1352 | ||
1353 | /* For single port cards - only claim function 0 */ | 1353 | /* For single port cards - only claim function 0 */ |
1354 | if ((pdev->device == BFA_PCI_DEVICE_ID_FC_8G1P) && | 1354 | if ((pdev->device == BFA_PCI_DEVICE_ID_FC_8G1P) && |
@@ -1372,6 +1372,12 @@ bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1372 | bfa_trc_init(bfad->trcmod); | 1372 | bfa_trc_init(bfad->trcmod); |
1373 | bfa_trc(bfad, bfad_inst); | 1373 | bfa_trc(bfad, bfad_inst); |
1374 | 1374 | ||
1375 | /* AEN INIT */ | ||
1376 | INIT_LIST_HEAD(&bfad->free_aen_q); | ||
1377 | INIT_LIST_HEAD(&bfad->active_aen_q); | ||
1378 | for (i = 0; i < BFA_AEN_MAX_ENTRY; i++) | ||
1379 | list_add_tail(&bfad->aen_list[i].qe, &bfad->free_aen_q); | ||
1380 | |||
1375 | if (!(bfad_load_fwimg(pdev))) { | 1381 | if (!(bfad_load_fwimg(pdev))) { |
1376 | kfree(bfad->trcmod); | 1382 | kfree(bfad->trcmod); |
1377 | goto out_alloc_trace_failure; | 1383 | goto out_alloc_trace_failure; |
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 89f863ed2334..88bfa92af740 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c | |||
@@ -90,6 +90,7 @@ bfad_iocmd_ioc_get_info(struct bfad_s *bfad, void *cmd) | |||
90 | bfa_get_adapter_serial_num(&bfad->bfa, iocmd->serialnum); | 90 | bfa_get_adapter_serial_num(&bfad->bfa, iocmd->serialnum); |
91 | iocmd->factorynwwn = pattr.factorynwwn; | 91 | iocmd->factorynwwn = pattr.factorynwwn; |
92 | iocmd->factorypwwn = pattr.factorypwwn; | 92 | iocmd->factorypwwn = pattr.factorypwwn; |
93 | iocmd->bfad_num = bfad->inst_no; | ||
93 | im_port = bfad->pport.im_port; | 94 | im_port = bfad->pport.im_port; |
94 | iocmd->host = im_port->shost->host_no; | 95 | iocmd->host = im_port->shost->host_no; |
95 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 96 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index 48661a2726d7..e00aa03d240f 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h | |||
@@ -224,6 +224,10 @@ struct bfad_s { | |||
224 | char *regdata; | 224 | char *regdata; |
225 | u32 reglen; | 225 | u32 reglen; |
226 | struct dentry *bfad_dentry_files[5]; | 226 | struct dentry *bfad_dentry_files[5]; |
227 | struct list_head free_aen_q; | ||
228 | struct list_head active_aen_q; | ||
229 | struct bfa_aen_entry_s aen_list[BFA_AEN_MAX_ENTRY]; | ||
230 | spinlock_t bfad_aen_spinlock; | ||
227 | }; | 231 | }; |
228 | 232 | ||
229 | /* BFAD state machine events */ | 233 | /* BFAD state machine events */ |
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index f2bf81265ae5..01312381639f 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -656,6 +656,31 @@ bfad_im_port_clean(struct bfad_im_port_s *im_port) | |||
656 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 656 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
657 | } | 657 | } |
658 | 658 | ||
659 | static void bfad_aen_im_notify_handler(struct work_struct *work) | ||
660 | { | ||
661 | struct bfad_im_s *im = | ||
662 | container_of(work, struct bfad_im_s, aen_im_notify_work); | ||
663 | struct bfa_aen_entry_s *aen_entry; | ||
664 | struct bfad_s *bfad = im->bfad; | ||
665 | struct Scsi_Host *shost = bfad->pport.im_port->shost; | ||
666 | void *event_data; | ||
667 | unsigned long flags; | ||
668 | |||
669 | while (!list_empty(&bfad->active_aen_q)) { | ||
670 | spin_lock_irqsave(&bfad->bfad_aen_spinlock, flags); | ||
671 | bfa_q_deq(&bfad->active_aen_q, &aen_entry); | ||
672 | spin_unlock_irqrestore(&bfad->bfad_aen_spinlock, flags); | ||
673 | event_data = (char *)aen_entry + sizeof(struct list_head); | ||
674 | fc_host_post_vendor_event(shost, fc_get_event_number(), | ||
675 | sizeof(struct bfa_aen_entry_s) - | ||
676 | sizeof(struct list_head), | ||
677 | (char *)event_data, BFAD_NL_VENDOR_ID); | ||
678 | spin_lock_irqsave(&bfad->bfad_aen_spinlock, flags); | ||
679 | list_add_tail(&aen_entry->qe, &bfad->free_aen_q); | ||
680 | spin_unlock_irqrestore(&bfad->bfad_aen_spinlock, flags); | ||
681 | } | ||
682 | } | ||
683 | |||
659 | bfa_status_t | 684 | bfa_status_t |
660 | bfad_im_probe(struct bfad_s *bfad) | 685 | bfad_im_probe(struct bfad_s *bfad) |
661 | { | 686 | { |
@@ -676,6 +701,7 @@ bfad_im_probe(struct bfad_s *bfad) | |||
676 | rc = BFA_STATUS_FAILED; | 701 | rc = BFA_STATUS_FAILED; |
677 | } | 702 | } |
678 | 703 | ||
704 | INIT_WORK(&im->aen_im_notify_work, bfad_aen_im_notify_handler); | ||
679 | ext: | 705 | ext: |
680 | return rc; | 706 | return rc; |
681 | } | 707 | } |
diff --git a/drivers/scsi/bfa/bfad_im.h b/drivers/scsi/bfa/bfad_im.h index 4fe34d576b05..004b6cf848d9 100644 --- a/drivers/scsi/bfa/bfad_im.h +++ b/drivers/scsi/bfa/bfad_im.h | |||
@@ -115,8 +115,30 @@ struct bfad_im_s { | |||
115 | struct bfad_s *bfad; | 115 | struct bfad_s *bfad; |
116 | struct workqueue_struct *drv_workq; | 116 | struct workqueue_struct *drv_workq; |
117 | char drv_workq_name[KOBJ_NAME_LEN]; | 117 | char drv_workq_name[KOBJ_NAME_LEN]; |
118 | struct work_struct aen_im_notify_work; | ||
118 | }; | 119 | }; |
119 | 120 | ||
121 | #define bfad_get_aen_entry(_drv, _entry) do { \ | ||
122 | unsigned long _flags; \ | ||
123 | spin_lock_irqsave(&(_drv)->bfad_aen_spinlock, _flags); \ | ||
124 | bfa_q_deq(&(_drv)->free_aen_q, &(_entry)); \ | ||
125 | if (_entry) \ | ||
126 | list_add_tail(&(_entry)->qe, &(_drv)->active_aen_q); \ | ||
127 | spin_unlock_irqrestore(&(_drv)->bfad_aen_spinlock, _flags); \ | ||
128 | } while (0) | ||
129 | |||
130 | /* post fc_host vendor event */ | ||
131 | #define bfad_im_post_vendor_event(_entry, _drv, _cnt, _cat, _evt) do { \ | ||
132 | do_gettimeofday(&(_entry)->aen_tv); \ | ||
133 | (_entry)->bfad_num = (_drv)->inst_no; \ | ||
134 | (_entry)->seq_num = (_cnt); \ | ||
135 | (_entry)->aen_category = (_cat); \ | ||
136 | (_entry)->aen_type = (_evt); \ | ||
137 | if ((_drv)->bfad_flags & BFAD_FC4_PROBE_DONE) \ | ||
138 | queue_work((_drv)->im->drv_workq, \ | ||
139 | &(_drv)->im->aen_im_notify_work); \ | ||
140 | } while (0) | ||
141 | |||
120 | struct Scsi_Host *bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, | 142 | struct Scsi_Host *bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, |
121 | struct bfad_s *); | 143 | struct bfad_s *); |
122 | bfa_status_t bfad_thread_workq(struct bfad_s *bfad); | 144 | bfa_status_t bfad_thread_workq(struct bfad_s *bfad); |
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h index 1e258d5f8aec..b2ba0b2e91b2 100644 --- a/drivers/scsi/bfa/bfi.h +++ b/drivers/scsi/bfa/bfi.h | |||
@@ -784,6 +784,17 @@ enum bfi_sfp_i2h_e { | |||
784 | }; | 784 | }; |
785 | 785 | ||
786 | /* | 786 | /* |
787 | * SFP state change notification | ||
788 | */ | ||
789 | struct bfi_sfp_scn_s { | ||
790 | struct bfi_mhdr_s mhr; /* host msg header */ | ||
791 | u8 event; | ||
792 | u8 sfpid; | ||
793 | u8 pomlvl; /* pom level: normal/warning/alarm */ | ||
794 | u8 is_elb; /* e-loopback */ | ||
795 | }; | ||
796 | |||
797 | /* | ||
787 | * SFP state | 798 | * SFP state |
788 | */ | 799 | */ |
789 | enum bfa_sfp_stat_e { | 800 | enum bfa_sfp_stat_e { |
@@ -926,6 +937,15 @@ struct bfi_flash_erase_rsp_s { | |||
926 | }; | 937 | }; |
927 | 938 | ||
928 | /* | 939 | /* |
940 | * Flash event notification | ||
941 | */ | ||
942 | struct bfi_flash_event_s { | ||
943 | struct bfi_mhdr_s mh; /* Common msg header */ | ||
944 | bfa_status_t status; | ||
945 | u32 param; | ||
946 | }; | ||
947 | |||
948 | /* | ||
929 | *---------------------------------------------------------------------- | 949 | *---------------------------------------------------------------------- |
930 | * DIAG | 950 | * DIAG |
931 | *---------------------------------------------------------------------- | 951 | *---------------------------------------------------------------------- |