@@ -403,6 +403,127 @@ struct lpfc_trunk_link {
403403 link3 ;
404404};
405405
406+ /* Max number of days of congestion data */
407+ #define LPFC_MAX_CGN_DAYS 10
408+
409+ /* Format of congestion buffer info
410+ * This structure defines memory thats allocated and registered with
411+ * the HBA firmware. When adding or removing fields from this structure
412+ * the alignment must match the HBA firmware.
413+ */
414+
415+ struct lpfc_cgn_info {
416+ /* Header */
417+ __le16 cgn_info_size ; /* is sizeof(struct lpfc_cgn_info) */
418+ uint8_t cgn_info_version ; /* represents format of structure */
419+ #define LPFC_CGN_INFO_V1 1
420+ #define LPFC_CGN_INFO_V2 2
421+ #define LPFC_CGN_INFO_V3 3
422+ uint8_t cgn_info_mode ; /* 0=off 1=managed 2=monitor only */
423+ uint8_t cgn_info_detect ;
424+ uint8_t cgn_info_action ;
425+ uint8_t cgn_info_level0 ;
426+ uint8_t cgn_info_level1 ;
427+ uint8_t cgn_info_level2 ;
428+
429+ /* Start Time */
430+ uint8_t cgn_info_month ;
431+ uint8_t cgn_info_day ;
432+ uint8_t cgn_info_year ;
433+ uint8_t cgn_info_hour ;
434+ uint8_t cgn_info_minute ;
435+ uint8_t cgn_info_second ;
436+
437+ /* minute / hours / daily indices */
438+ uint8_t cgn_index_minute ;
439+ uint8_t cgn_index_hour ;
440+ uint8_t cgn_index_day ;
441+
442+ __le16 cgn_warn_freq ;
443+ __le16 cgn_alarm_freq ;
444+ __le16 cgn_lunq ;
445+ uint8_t cgn_pad1 [8 ];
446+
447+ /* Driver Information */
448+ __le16 cgn_drvr_min [60 ];
449+ __le32 cgn_drvr_hr [24 ];
450+ __le32 cgn_drvr_day [LPFC_MAX_CGN_DAYS ];
451+
452+ /* Congestion Warnings */
453+ __le16 cgn_warn_min [60 ];
454+ __le32 cgn_warn_hr [24 ];
455+ __le32 cgn_warn_day [LPFC_MAX_CGN_DAYS ];
456+
457+ /* Latency Information */
458+ __le32 cgn_latency_min [60 ];
459+ __le32 cgn_latency_hr [24 ];
460+ __le32 cgn_latency_day [LPFC_MAX_CGN_DAYS ];
461+
462+ /* Bandwidth Information */
463+ __le16 cgn_bw_min [60 ];
464+ __le16 cgn_bw_hr [24 ];
465+ __le16 cgn_bw_day [LPFC_MAX_CGN_DAYS ];
466+
467+ /* Congestion Alarms */
468+ __le16 cgn_alarm_min [60 ];
469+ __le32 cgn_alarm_hr [24 ];
470+ __le32 cgn_alarm_day [LPFC_MAX_CGN_DAYS ];
471+
472+ /* Start of congestion statistics */
473+ uint8_t cgn_stat_npm ; /* Notifications per minute */
474+
475+ /* Start Time */
476+ uint8_t cgn_stat_month ;
477+ uint8_t cgn_stat_day ;
478+ uint8_t cgn_stat_year ;
479+ uint8_t cgn_stat_hour ;
480+ uint8_t cgn_stat_minute ;
481+ uint8_t cgn_pad2 [2 ];
482+
483+ __le32 cgn_notification ;
484+ __le32 cgn_peer_notification ;
485+ __le32 link_integ_notification ;
486+ __le32 delivery_notification ;
487+
488+ uint8_t cgn_stat_cgn_month ; /* Last congestion notification FPIN */
489+ uint8_t cgn_stat_cgn_day ;
490+ uint8_t cgn_stat_cgn_year ;
491+ uint8_t cgn_stat_cgn_hour ;
492+ uint8_t cgn_stat_cgn_min ;
493+ uint8_t cgn_stat_cgn_sec ;
494+
495+ uint8_t cgn_stat_peer_month ; /* Last peer congestion FPIN */
496+ uint8_t cgn_stat_peer_day ;
497+ uint8_t cgn_stat_peer_year ;
498+ uint8_t cgn_stat_peer_hour ;
499+ uint8_t cgn_stat_peer_min ;
500+ uint8_t cgn_stat_peer_sec ;
501+
502+ uint8_t cgn_stat_lnk_month ; /* Last link integrity FPIN */
503+ uint8_t cgn_stat_lnk_day ;
504+ uint8_t cgn_stat_lnk_year ;
505+ uint8_t cgn_stat_lnk_hour ;
506+ uint8_t cgn_stat_lnk_min ;
507+ uint8_t cgn_stat_lnk_sec ;
508+
509+ uint8_t cgn_stat_del_month ; /* Last delivery notification FPIN */
510+ uint8_t cgn_stat_del_day ;
511+ uint8_t cgn_stat_del_year ;
512+ uint8_t cgn_stat_del_hour ;
513+ uint8_t cgn_stat_del_min ;
514+ uint8_t cgn_stat_del_sec ;
515+ #define LPFC_CGN_STAT_SIZE 48
516+ #define LPFC_CGN_DATA_SIZE (sizeof(struct lpfc_cgn_info) - \
517+ LPFC_CGN_STAT_SIZE - sizeof(uint32_t))
518+
519+ __le32 cgn_info_crc ;
520+ #define LPFC_CGN_CRC32_MAGIC_NUMBER 0x1EDC6F41
521+ #define LPFC_CGN_CRC32_SEED 0xFFFFFFFF
522+ };
523+
524+ #define LPFC_CGN_INFO_SZ (sizeof(struct lpfc_cgn_info) - \
525+ sizeof(uint32_t))
526+
406527struct lpfc_cgn_acqe_stat {
407528 atomic64_t alarm ;
408529 atomic64_t warn ;
@@ -1374,10 +1495,22 @@ struct lpfc_hba {
13741495 struct lpfc_cgn_acqe_stat cgn_acqe_stat ;
13751496
13761497 /* Congestion buffer information */
1498+ struct lpfc_dmabuf * cgn_i ; /* Congestion Info buffer */
13771499 atomic_t cgn_fabric_warn_cnt ; /* Total warning cgn events for info */
13781500 atomic_t cgn_fabric_alarm_cnt ; /* Total alarm cgn events for info */
13791501 atomic_t cgn_sync_warn_cnt ; /* Total warning events for SYNC wqe */
13801502 atomic_t cgn_sync_alarm_cnt ; /* Total alarm events for SYNC wqe */
1503+ atomic_t cgn_driver_evt_cnt ; /* Total driver cgn events for fmw */
1504+ atomic_t cgn_latency_evt_cnt ;
1505+ struct timespec64 cgn_daily_ts ;
1506+ atomic64_t cgn_latency_evt ; /* Avg latency per minute */
1507+ unsigned long cgn_evt_timestamp ;
1508+ #define LPFC_CGN_TIMER_TO_MIN 60000 /* ms in a minute */
1509+ uint32_t cgn_evt_minute ;
1510+ #define LPFC_SEC_MIN 60
1511+ #define LPFC_MIN_HOUR 60
1512+ #define LPFC_HOUR_DAY 24
1513+ #define LPFC_MIN_DAY (LPFC_MIN_HOUR * LPFC_HOUR_DAY)
13811514
13821515 struct hlist_node cpuhp ; /* used for cpuhp per hba callback */
13831516 struct timer_list cpuhp_poll_timer ;
0 commit comments