Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: lpfc: Enhance congestion statistics collection

Various improvements are made for collecting congestion statistics:

- Pre-existing logic is replaced with use of an hrtimer for increased
reporting accuracy.

- Congestion timestamp information is reorganized into a single struct.

- Common statistic collection logic is refactored into a helper routine.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230523183206.7728-8-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Justin Tee and committed by
Martin K. Petersen
93190ac1 6a84d015

+81 -208
+19 -44
drivers/scsi/lpfc/lpfc.h
··· 429 429 /* Max number of days of congestion data */ 430 430 #define LPFC_MAX_CGN_DAYS 10 431 431 432 + struct lpfc_cgn_ts { 433 + uint8_t month; 434 + uint8_t day; 435 + uint8_t year; 436 + uint8_t hour; 437 + uint8_t minute; 438 + uint8_t second; 439 + }; 440 + 432 441 /* Format of congestion buffer info 433 442 * This structure defines memory thats allocated and registered with 434 443 * the HBA firmware. When adding or removing fields from this structure ··· 451 442 #define LPFC_CGN_INFO_V1 1 452 443 #define LPFC_CGN_INFO_V2 2 453 444 #define LPFC_CGN_INFO_V3 3 445 + #define LPFC_CGN_INFO_V4 4 454 446 uint8_t cgn_info_mode; /* 0=off 1=managed 2=monitor only */ 455 447 uint8_t cgn_info_detect; 456 448 uint8_t cgn_info_action; ··· 460 450 uint8_t cgn_info_level2; 461 451 462 452 /* Start Time */ 463 - uint8_t cgn_info_month; 464 - uint8_t cgn_info_day; 465 - uint8_t cgn_info_year; 466 - uint8_t cgn_info_hour; 467 - uint8_t cgn_info_minute; 468 - uint8_t cgn_info_second; 453 + struct lpfc_cgn_ts base_time; 469 454 470 455 /* minute / hours / daily indices */ 471 456 uint8_t cgn_index_minute; ··· 501 496 uint8_t cgn_stat_npm; /* Notifications per minute */ 502 497 503 498 /* Start Time */ 504 - uint8_t cgn_stat_month; 505 - uint8_t cgn_stat_day; 506 - uint8_t cgn_stat_year; 507 - uint8_t cgn_stat_hour; 508 - uint8_t cgn_stat_minute; 509 - uint8_t cgn_pad2[2]; 499 + struct lpfc_cgn_ts stat_start; /* Base time */ 500 + uint8_t cgn_pad2; 510 501 511 502 __le32 cgn_notification; 512 503 __le32 cgn_peer_notification; 513 504 __le32 link_integ_notification; 514 505 __le32 delivery_notification; 515 - 516 - uint8_t cgn_stat_cgn_month; /* Last congestion notification FPIN */ 517 - uint8_t cgn_stat_cgn_day; 518 - uint8_t cgn_stat_cgn_year; 519 - uint8_t cgn_stat_cgn_hour; 520 - uint8_t cgn_stat_cgn_min; 521 - uint8_t cgn_stat_cgn_sec; 522 - 523 - uint8_t cgn_stat_peer_month; /* Last peer congestion FPIN */ 524 - uint8_t cgn_stat_peer_day; 525 - uint8_t cgn_stat_peer_year; 526 - uint8_t cgn_stat_peer_hour; 527 - uint8_t cgn_stat_peer_min; 528 - uint8_t cgn_stat_peer_sec; 529 - 530 - uint8_t cgn_stat_lnk_month; /* Last link integrity FPIN */ 531 - uint8_t cgn_stat_lnk_day; 532 - uint8_t cgn_stat_lnk_year; 533 - uint8_t cgn_stat_lnk_hour; 534 - uint8_t cgn_stat_lnk_min; 535 - uint8_t cgn_stat_lnk_sec; 536 - 537 - uint8_t cgn_stat_del_month; /* Last delivery notification FPIN */ 538 - uint8_t cgn_stat_del_day; 539 - uint8_t cgn_stat_del_year; 540 - uint8_t cgn_stat_del_hour; 541 - uint8_t cgn_stat_del_min; 542 - uint8_t cgn_stat_del_sec; 506 + struct lpfc_cgn_ts stat_fpin; /* Last congestion notification FPIN */ 507 + struct lpfc_cgn_ts stat_peer; /* Last peer congestion FPIN */ 508 + struct lpfc_cgn_ts stat_lnk; /* Last link integrity FPIN */ 509 + struct lpfc_cgn_ts stat_delivery; /* Last delivery notification FPIN */ 543 510 ); 544 511 545 512 __le32 cgn_info_crc; ··· 1020 1043 * capability 1021 1044 */ 1022 1045 #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ 1023 - #define HBA_SHORT_CMF 0x200000 /* shorter CMF timer routine */ 1024 - #define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */ 1025 1046 #define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */ 1026 1047 #define HBA_SETUP 0x1000000 /* Signifies HBA setup is completed */ 1027 1048 #define HBA_NEEDS_CFG_PORT 0x2000000 /* SLI3 - needs a CONFIG_PORT mbox */ ··· 1502 1527 uint64_t cmf_last_sync_bw; 1503 1528 #define LPFC_CMF_BLK_SIZE 512 1504 1529 struct hrtimer cmf_timer; 1530 + struct hrtimer cmf_stats_timer; /* 1 minute stats timer */ 1505 1531 atomic_t cmf_bw_wait; 1506 1532 atomic_t cmf_busy; 1507 1533 atomic_t cmf_stop_io; /* To block request and stop IO's */ ··· 1550 1574 atomic_t cgn_sync_alarm_cnt; /* Total alarm events for SYNC wqe */ 1551 1575 atomic_t cgn_driver_evt_cnt; /* Total driver cgn events for fmw */ 1552 1576 atomic_t cgn_latency_evt_cnt; 1553 - struct timespec64 cgn_daily_ts; 1554 1577 atomic64_t cgn_latency_evt; /* Avg latency per minute */ 1555 1578 unsigned long cgn_evt_timestamp; 1556 1579 #define LPFC_CGN_TIMER_TO_MIN 60000 /* ms in a minute */ 1557 1580 uint32_t cgn_evt_minute; 1558 - #define LPFC_SEC_MIN 60 1581 + #define LPFC_SEC_MIN 60UL 1559 1582 #define LPFC_MIN_HOUR 60 1560 1583 #define LPFC_HOUR_DAY 24 1561 1584 #define LPFC_MIN_DAY (LPFC_MIN_HOUR * LPFC_HOUR_DAY)
+62 -164
drivers/scsi/lpfc/lpfc_init.c
··· 101 101 static DEFINE_IDR(lpfc_hba_index); 102 102 #define LPFC_NVMET_BUF_POST 254 103 103 static int lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport); 104 + static void lpfc_cgn_update_tstamp(struct lpfc_hba *phba, struct lpfc_cgn_ts *ts); 104 105 105 106 /** 106 107 * lpfc_config_port_prep - Perform lpfc initialization prior to config port ··· 3198 3197 "6221 Stop CMF / Cancel Timer\n"); 3199 3198 3200 3199 /* Cancel the CMF timer */ 3200 + hrtimer_cancel(&phba->cmf_stats_timer); 3201 3201 hrtimer_cancel(&phba->cmf_timer); 3202 3202 3203 3203 /* Zero CMF counters */ ··· 3285 3283 3286 3284 phba->cmf_timer_cnt = 0; 3287 3285 hrtimer_start(&phba->cmf_timer, 3288 - ktime_set(0, LPFC_CMF_INTERVAL * 1000000), 3286 + ktime_set(0, LPFC_CMF_INTERVAL * NSEC_PER_MSEC), 3287 + HRTIMER_MODE_REL); 3288 + hrtimer_start(&phba->cmf_stats_timer, 3289 + ktime_set(0, LPFC_SEC_MIN * NSEC_PER_SEC), 3289 3290 HRTIMER_MODE_REL); 3290 3291 /* Setup for latency check in IO cmpl routines */ 3291 3292 ktime_get_real_ts64(&phba->cmf_latency); ··· 5600 5595 lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag) 5601 5596 { 5602 5597 struct lpfc_cgn_info *cp; 5603 - struct tm broken; 5604 - struct timespec64 cur_time; 5605 - u32 cnt; 5606 5598 u32 value; 5607 5599 5608 5600 /* Make sure we have a congestion info buffer */ 5609 5601 if (!phba->cgn_i) 5610 5602 return; 5611 5603 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; 5612 - ktime_get_real_ts64(&cur_time); 5613 - time64_to_tm(cur_time.tv_sec, 0, &broken); 5614 5604 5615 5605 /* Update congestion statistics */ 5616 5606 switch (dtag) { 5617 5607 case ELS_DTAG_LNK_INTEGRITY: 5618 - cnt = le32_to_cpu(cp->link_integ_notification); 5619 - cnt++; 5620 - cp->link_integ_notification = cpu_to_le32(cnt); 5621 - 5622 - cp->cgn_stat_lnk_month = broken.tm_mon + 1; 5623 - cp->cgn_stat_lnk_day = broken.tm_mday; 5624 - cp->cgn_stat_lnk_year = broken.tm_year - 100; 5625 - cp->cgn_stat_lnk_hour = broken.tm_hour; 5626 - cp->cgn_stat_lnk_min = broken.tm_min; 5627 - cp->cgn_stat_lnk_sec = broken.tm_sec; 5608 + le32_add_cpu(&cp->link_integ_notification, 1); 5609 + lpfc_cgn_update_tstamp(phba, &cp->stat_lnk); 5628 5610 break; 5629 5611 case ELS_DTAG_DELIVERY: 5630 - cnt = le32_to_cpu(cp->delivery_notification); 5631 - cnt++; 5632 - cp->delivery_notification = cpu_to_le32(cnt); 5633 - 5634 - cp->cgn_stat_del_month = broken.tm_mon + 1; 5635 - cp->cgn_stat_del_day = broken.tm_mday; 5636 - cp->cgn_stat_del_year = broken.tm_year - 100; 5637 - cp->cgn_stat_del_hour = broken.tm_hour; 5638 - cp->cgn_stat_del_min = broken.tm_min; 5639 - cp->cgn_stat_del_sec = broken.tm_sec; 5612 + le32_add_cpu(&cp->delivery_notification, 1); 5613 + lpfc_cgn_update_tstamp(phba, &cp->stat_delivery); 5640 5614 break; 5641 5615 case ELS_DTAG_PEER_CONGEST: 5642 - cnt = le32_to_cpu(cp->cgn_peer_notification); 5643 - cnt++; 5644 - cp->cgn_peer_notification = cpu_to_le32(cnt); 5645 - 5646 - cp->cgn_stat_peer_month = broken.tm_mon + 1; 5647 - cp->cgn_stat_peer_day = broken.tm_mday; 5648 - cp->cgn_stat_peer_year = broken.tm_year - 100; 5649 - cp->cgn_stat_peer_hour = broken.tm_hour; 5650 - cp->cgn_stat_peer_min = broken.tm_min; 5651 - cp->cgn_stat_peer_sec = broken.tm_sec; 5616 + le32_add_cpu(&cp->cgn_peer_notification, 1); 5617 + lpfc_cgn_update_tstamp(phba, &cp->stat_peer); 5652 5618 break; 5653 5619 case ELS_DTAG_CONGESTION: 5654 - cnt = le32_to_cpu(cp->cgn_notification); 5655 - cnt++; 5656 - cp->cgn_notification = cpu_to_le32(cnt); 5657 - 5658 - cp->cgn_stat_cgn_month = broken.tm_mon + 1; 5659 - cp->cgn_stat_cgn_day = broken.tm_mday; 5660 - cp->cgn_stat_cgn_year = broken.tm_year - 100; 5661 - cp->cgn_stat_cgn_hour = broken.tm_hour; 5662 - cp->cgn_stat_cgn_min = broken.tm_min; 5663 - cp->cgn_stat_cgn_sec = broken.tm_sec; 5620 + le32_add_cpu(&cp->cgn_notification, 1); 5621 + lpfc_cgn_update_tstamp(phba, &cp->stat_fpin); 5664 5622 } 5665 5623 if (phba->cgn_fpin_frequency && 5666 5624 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { 5667 5625 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; 5668 5626 cp->cgn_stat_npm = value; 5669 5627 } 5628 + 5670 5629 value = lpfc_cgn_calc_crc32(cp, LPFC_CGN_INFO_SZ, 5671 5630 LPFC_CGN_CRC32_SEED); 5672 5631 cp->cgn_info_crc = cpu_to_le32(value); 5673 5632 } 5674 5633 5675 5634 /** 5676 - * lpfc_cgn_save_evt_cnt - Save data into registered congestion buffer 5635 + * lpfc_cgn_update_tstamp - Update cmf timestamp 5677 5636 * @phba: pointer to lpfc hba data structure. 5637 + * @ts: structure to write the timestamp to. 5638 + */ 5639 + void 5640 + lpfc_cgn_update_tstamp(struct lpfc_hba *phba, struct lpfc_cgn_ts *ts) 5641 + { 5642 + struct timespec64 cur_time; 5643 + struct tm tm_val; 5644 + 5645 + ktime_get_real_ts64(&cur_time); 5646 + time64_to_tm(cur_time.tv_sec, 0, &tm_val); 5647 + 5648 + ts->month = tm_val.tm_mon + 1; 5649 + ts->day = tm_val.tm_mday; 5650 + ts->year = tm_val.tm_year - 100; 5651 + ts->hour = tm_val.tm_hour; 5652 + ts->minute = tm_val.tm_min; 5653 + ts->second = tm_val.tm_sec; 5654 + 5655 + lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, 5656 + "2646 Updated CMF timestamp : " 5657 + "%u/%u/%u %u:%u:%u\n", 5658 + ts->day, ts->month, 5659 + ts->year, ts->hour, 5660 + ts->minute, ts->second); 5661 + } 5662 + 5663 + /** 5664 + * lpfc_cmf_stats_timer - Save data into registered congestion buffer 5665 + * @timer: Timer cookie to access lpfc private data 5678 5666 * 5679 5667 * Save the congestion event data every minute. 5680 5668 * On the hour collapse all the minute data into hour data. Every day ··· 5675 5677 * and fabrc congestion event counters that will be saved out 5676 5678 * to the registered congestion buffer every minute. 5677 5679 */ 5678 - static void 5679 - lpfc_cgn_save_evt_cnt(struct lpfc_hba *phba) 5680 + static enum hrtimer_restart 5681 + lpfc_cmf_stats_timer(struct hrtimer *timer) 5680 5682 { 5683 + struct lpfc_hba *phba; 5681 5684 struct lpfc_cgn_info *cp; 5682 - struct tm broken; 5683 - struct timespec64 cur_time; 5684 5685 uint32_t i, index; 5685 5686 uint16_t value, mvalue; 5686 5687 uint64_t bps; ··· 5690 5693 __le32 *lptr; 5691 5694 __le16 *mptr; 5692 5695 5696 + phba = container_of(timer, struct lpfc_hba, cmf_stats_timer); 5693 5697 /* Make sure we have a congestion info buffer */ 5694 5698 if (!phba->cgn_i) 5695 - return; 5699 + return HRTIMER_NORESTART; 5696 5700 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; 5697 5701 5698 - if (time_before(jiffies, phba->cgn_evt_timestamp)) 5699 - return; 5700 5702 phba->cgn_evt_timestamp = jiffies + 5701 5703 msecs_to_jiffies(LPFC_CGN_TIMER_TO_MIN); 5702 5704 phba->cgn_evt_minute++; 5703 5705 5704 5706 /* We should get to this point in the routine on 1 minute intervals */ 5705 - 5706 - ktime_get_real_ts64(&cur_time); 5707 - time64_to_tm(cur_time.tv_sec, 0, &broken); 5707 + lpfc_cgn_update_tstamp(phba, &cp->base_time); 5708 5708 5709 5709 if (phba->cgn_fpin_frequency && 5710 5710 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { ··· 5854 5860 index = 0; 5855 5861 } 5856 5862 5857 - /* Anytime we overwrite daily index 0, after we wrap, 5858 - * we will be overwriting the oldest day, so we must 5859 - * update the congestion data start time for that day. 5860 - * That start time should have previously been saved after 5861 - * we wrote the last days worth of data. 5862 - */ 5863 - if ((phba->hba_flag & HBA_CGN_DAY_WRAP) && index == 0) { 5864 - time64_to_tm(phba->cgn_daily_ts.tv_sec, 0, &broken); 5865 - 5866 - cp->cgn_info_month = broken.tm_mon + 1; 5867 - cp->cgn_info_day = broken.tm_mday; 5868 - cp->cgn_info_year = broken.tm_year - 100; 5869 - cp->cgn_info_hour = broken.tm_hour; 5870 - cp->cgn_info_minute = broken.tm_min; 5871 - cp->cgn_info_second = broken.tm_sec; 5872 - 5873 - lpfc_printf_log 5874 - (phba, KERN_INFO, LOG_CGN_MGMT, 5875 - "2646 CGNInfo idx0 Start Time: " 5876 - "%d/%d/%d %d:%d:%d\n", 5877 - cp->cgn_info_day, cp->cgn_info_month, 5878 - cp->cgn_info_year, cp->cgn_info_hour, 5879 - cp->cgn_info_minute, cp->cgn_info_second); 5880 - } 5881 - 5882 5863 dvalue = 0; 5883 5864 wvalue = 0; 5884 5865 lvalue = 0; ··· 5887 5918 "2420 Congestion Info - daily (%d): " 5888 5919 "%d %d %d %d %d\n", 5889 5920 index, dvalue, wvalue, lvalue, mvalue, avalue); 5890 - 5891 - /* We just wrote LPFC_MAX_CGN_DAYS of data, 5892 - * so we are wrapped on any data after this. 5893 - * Save this as the start time for the next day. 5894 - */ 5895 - if (index == (LPFC_MAX_CGN_DAYS - 1)) { 5896 - phba->hba_flag |= HBA_CGN_DAY_WRAP; 5897 - ktime_get_real_ts64(&phba->cgn_daily_ts); 5898 - } 5899 5921 } 5900 5922 5901 5923 /* Use the frequency found in the last rcv'ed FPIN */ ··· 5897 5937 lvalue = lpfc_cgn_calc_crc32(cp, LPFC_CGN_INFO_SZ, 5898 5938 LPFC_CGN_CRC32_SEED); 5899 5939 cp->cgn_info_crc = cpu_to_le32(lvalue); 5940 + 5941 + hrtimer_forward_now(timer, ktime_set(0, LPFC_SEC_MIN * NSEC_PER_SEC)); 5942 + 5943 + return HRTIMER_RESTART; 5900 5944 } 5901 5945 5902 5946 /** ··· 6031 6067 if (ms && ms < LPFC_CMF_INTERVAL) { 6032 6068 cnt = div_u64(total, ms); /* bytes per ms */ 6033 6069 cnt *= LPFC_CMF_INTERVAL; /* what total should be */ 6034 - 6035 - /* If the timeout is scheduled to be shorter, 6036 - * this value may skew the data, so cap it at mbpi. 6037 - */ 6038 - if ((phba->hba_flag & HBA_SHORT_CMF) && cnt > mbpi) 6039 - cnt = mbpi; 6040 - 6041 6070 extra = cnt - total; 6042 6071 } 6043 6072 lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); ··· 6099 6142 atomic_inc(&phba->cgn_driver_evt_cnt); 6100 6143 } 6101 6144 phba->rx_block_cnt += div_u64(rcv, 512); /* save 512 byte block cnt */ 6102 - 6103 - /* Each minute save Fabric and Driver congestion information */ 6104 - lpfc_cgn_save_evt_cnt(phba); 6105 - 6106 - phba->hba_flag &= ~HBA_SHORT_CMF; 6107 - 6108 - /* Since we need to call lpfc_cgn_save_evt_cnt every minute, on the 6109 - * minute, adjust our next timer interval, if needed, to ensure a 6110 - * 1 minute granularity when we get the next timer interrupt. 6111 - */ 6112 - if (time_after(jiffies + msecs_to_jiffies(LPFC_CMF_INTERVAL), 6113 - phba->cgn_evt_timestamp)) { 6114 - timer_interval = jiffies_to_msecs(phba->cgn_evt_timestamp - 6115 - jiffies); 6116 - if (timer_interval <= 0) 6117 - timer_interval = LPFC_CMF_INTERVAL; 6118 - else 6119 - phba->hba_flag |= HBA_SHORT_CMF; 6120 - 6121 - /* If we adjust timer_interval, max_bytes_per_interval 6122 - * needs to be adjusted as well. 6123 - */ 6124 - phba->cmf_link_byte_count = div_u64(phba->cmf_max_line_rate * 6125 - timer_interval, 1000); 6126 - if (phba->cmf_active_mode == LPFC_CFG_MONITOR) 6127 - phba->cmf_max_bytes_per_interval = 6128 - phba->cmf_link_byte_count; 6129 - } 6130 6145 6131 6146 /* Since total_bytes has already been zero'ed, its okay to unblock 6132 6147 * after max_bytes_per_interval is setup. ··· 7945 8016 /* CMF congestion timer */ 7946 8017 hrtimer_init(&phba->cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 7947 8018 phba->cmf_timer.function = lpfc_cmf_timer; 8019 + /* CMF 1 minute stats collection timer */ 8020 + hrtimer_init(&phba->cmf_stats_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 8021 + phba->cmf_stats_timer.function = lpfc_cmf_stats_timer; 7948 8022 7949 8023 /* 7950 8024 * Control structure for handling external multi-buffer mailbox ··· 13457 13525 struct pci_dev *pdev = phba->pcidev; 13458 13526 13459 13527 lpfc_stop_hba_timers(phba); 13528 + hrtimer_cancel(&phba->cmf_stats_timer); 13460 13529 hrtimer_cancel(&phba->cmf_timer); 13461 13530 13462 13531 if (phba->pport) ··· 13582 13649 lpfc_init_congestion_buf(struct lpfc_hba *phba) 13583 13650 { 13584 13651 struct lpfc_cgn_info *cp; 13585 - struct timespec64 cmpl_time; 13586 - struct tm broken; 13587 13652 uint16_t size; 13588 13653 uint32_t crc; 13589 13654 ··· 13601 13670 atomic_set(&phba->cgn_latency_evt_cnt, 0); 13602 13671 atomic64_set(&phba->cgn_latency_evt, 0); 13603 13672 phba->cgn_evt_minute = 0; 13604 - phba->hba_flag &= ~HBA_CGN_DAY_WRAP; 13605 13673 13606 13674 memset(cp, 0xff, offsetof(struct lpfc_cgn_info, cgn_stat)); 13607 13675 cp->cgn_info_size = cpu_to_le16(LPFC_CGN_INFO_SZ); 13608 - cp->cgn_info_version = LPFC_CGN_INFO_V3; 13676 + cp->cgn_info_version = LPFC_CGN_INFO_V4; 13609 13677 13610 13678 /* cgn parameters */ 13611 13679 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; ··· 13612 13682 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; 13613 13683 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; 13614 13684 13615 - ktime_get_real_ts64(&cmpl_time); 13616 - time64_to_tm(cmpl_time.tv_sec, 0, &broken); 13617 - 13618 - cp->cgn_info_month = broken.tm_mon + 1; 13619 - cp->cgn_info_day = broken.tm_mday; 13620 - cp->cgn_info_year = broken.tm_year - 100; /* relative to 2000 */ 13621 - cp->cgn_info_hour = broken.tm_hour; 13622 - cp->cgn_info_minute = broken.tm_min; 13623 - cp->cgn_info_second = broken.tm_sec; 13624 - 13625 - lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, 13626 - "2643 CGNInfo Init: Start Time " 13627 - "%d/%d/%d %d:%d:%d\n", 13628 - cp->cgn_info_day, cp->cgn_info_month, 13629 - cp->cgn_info_year, cp->cgn_info_hour, 13630 - cp->cgn_info_minute, cp->cgn_info_second); 13685 + lpfc_cgn_update_tstamp(phba, &cp->base_time); 13631 13686 13632 13687 /* Fill in default LUN qdepth */ 13633 13688 if (phba->pport) { ··· 13635 13720 lpfc_init_congestion_stat(struct lpfc_hba *phba) 13636 13721 { 13637 13722 struct lpfc_cgn_info *cp; 13638 - struct timespec64 cmpl_time; 13639 - struct tm broken; 13640 13723 uint32_t crc; 13641 13724 13642 13725 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, ··· 13646 13733 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; 13647 13734 memset(&cp->cgn_stat, 0, sizeof(cp->cgn_stat)); 13648 13735 13649 - ktime_get_real_ts64(&cmpl_time); 13650 - time64_to_tm(cmpl_time.tv_sec, 0, &broken); 13651 - 13652 - cp->cgn_stat_month = broken.tm_mon + 1; 13653 - cp->cgn_stat_day = broken.tm_mday; 13654 - cp->cgn_stat_year = broken.tm_year - 100; /* relative to 2000 */ 13655 - cp->cgn_stat_hour = broken.tm_hour; 13656 - cp->cgn_stat_minute = broken.tm_min; 13657 - 13658 - lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, 13659 - "2647 CGNstat Init: Start Time " 13660 - "%d/%d/%d %d:%d\n", 13661 - cp->cgn_stat_day, cp->cgn_stat_month, 13662 - cp->cgn_stat_year, cp->cgn_stat_hour, 13663 - cp->cgn_stat_minute); 13664 - 13736 + lpfc_cgn_update_tstamp(phba, &cp->stat_start); 13665 13737 crc = lpfc_cgn_calc_crc32(cp, LPFC_CGN_INFO_SZ, LPFC_CGN_CRC32_SEED); 13666 13738 cp->cgn_info_crc = cpu_to_le32(crc); 13667 13739 }