Commit a6269f83 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Adjust CMF total bytes and rxmonitor

Calculate any extra bytes needed to account for timer accuracy. If we are
less than LPFC_CMF_INTERVAL, then calculate the adjustment needed for total
to reflect a full LPFC_CMF_INTERVAL.

Add additional info to rxmonitor, and adjust some log formatting.

Link: https://lore.kernel.org/r/20211204002644.116455-7-jsmart2021@gmail.comCo-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 7dd2e2a9
...@@ -1602,6 +1602,7 @@ struct lpfc_hba { ...@@ -1602,6 +1602,7 @@ struct lpfc_hba {
#define LPFC_MAX_RXMONITOR_ENTRY 800 #define LPFC_MAX_RXMONITOR_ENTRY 800
#define LPFC_MAX_RXMONITOR_DUMP 32 #define LPFC_MAX_RXMONITOR_DUMP 32
struct rxtable_entry { struct rxtable_entry {
uint64_t cmf_bytes; /* Total no of read bytes for CMF_SYNC_WQE */
uint64_t total_bytes; /* Total no of read bytes requested */ uint64_t total_bytes; /* Total no of read bytes requested */
uint64_t rcv_bytes; /* Total no of read bytes completed */ uint64_t rcv_bytes; /* Total no of read bytes completed */
uint64_t avg_io_size; uint64_t avg_io_size;
......
...@@ -5561,22 +5561,24 @@ lpfc_rx_monitor_read(struct file *file, char __user *buf, size_t nbytes, ...@@ -5561,22 +5561,24 @@ lpfc_rx_monitor_read(struct file *file, char __user *buf, size_t nbytes,
start = tail; start = tail;
len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len,
" MaxBPI\t Total Data Cmd Total Data Cmpl " " MaxBPI Tot_Data_CMF Tot_Data_Cmd "
" Latency(us) Avg IO Size\tMax IO Size IO cnt " "Tot_Data_Cmpl Lat(us) Avg_IO Max_IO "
"Info BWutil(ms)\n"); "Bsy IO_cnt Info BWutil(ms)\n");
get_table: get_table:
for (i = start; i < last; i++) { for (i = start; i < last; i++) {
entry = &phba->rxtable[i]; entry = &phba->rxtable[i];
len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len,
"%3d:%12lld %12lld\t%12lld\t" "%3d:%12lld %12lld %12lld %12lld "
"%8lldus\t%8lld\t%10lld " "%7lldus %8lld %7lld "
"%8d %2d %2d(%2d)\n", "%2d %4d %2d %2d(%2d)\n",
i, entry->max_bytes_per_interval, i, entry->max_bytes_per_interval,
entry->cmf_bytes,
entry->total_bytes, entry->total_bytes,
entry->rcv_bytes, entry->rcv_bytes,
entry->avg_io_latency, entry->avg_io_latency,
entry->avg_io_size, entry->avg_io_size,
entry->max_read_cnt, entry->max_read_cnt,
entry->cmf_busy,
entry->io_cnt, entry->io_cnt,
entry->cmf_info, entry->cmf_info,
entry->timer_utilization, entry->timer_utilization,
......
...@@ -282,7 +282,7 @@ struct lpfc_idiag { ...@@ -282,7 +282,7 @@ struct lpfc_idiag {
void *ptr_private; void *ptr_private;
}; };
#define MAX_DEBUGFS_RX_TABLE_SIZE (100 * LPFC_MAX_RXMONITOR_ENTRY) #define MAX_DEBUGFS_RX_TABLE_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY)
struct lpfc_rx_monitor_debug { struct lpfc_rx_monitor_debug {
char *i_private; char *i_private;
char *buffer; char *buffer;
......
...@@ -5927,7 +5927,7 @@ lpfc_cmf_timer(struct hrtimer *timer) ...@@ -5927,7 +5927,7 @@ lpfc_cmf_timer(struct hrtimer *timer)
uint32_t io_cnt; uint32_t io_cnt;
uint32_t head, tail; uint32_t head, tail;
uint32_t busy, max_read; uint32_t busy, max_read;
uint64_t total, rcv, lat, mbpi, extra; uint64_t total, rcv, lat, mbpi, extra, cnt;
int timer_interval = LPFC_CMF_INTERVAL; int timer_interval = LPFC_CMF_INTERVAL;
uint32_t ms; uint32_t ms;
struct lpfc_cgn_stat *cgs; struct lpfc_cgn_stat *cgs;
...@@ -5998,20 +5998,23 @@ lpfc_cmf_timer(struct hrtimer *timer) ...@@ -5998,20 +5998,23 @@ lpfc_cmf_timer(struct hrtimer *timer)
/* Calculate any extra bytes needed to account for the /* Calculate any extra bytes needed to account for the
* timer accuracy. If we are less than LPFC_CMF_INTERVAL * timer accuracy. If we are less than LPFC_CMF_INTERVAL
* add an extra 3% slop factor, equal to LPFC_CMF_INTERVAL * calculate the adjustment needed for total to reflect
* add an extra 2%. The goal is to equalize total with a * a full LPFC_CMF_INTERVAL.
* time > LPFC_CMF_INTERVAL or <= LPFC_CMF_INTERVAL + 1
*/ */
if (ms == LPFC_CMF_INTERVAL) if (ms && ms < LPFC_CMF_INTERVAL) {
extra = div_u64(total, 50); cnt = div_u64(total, ms); /* bytes per ms */
else if (ms < LPFC_CMF_INTERVAL) cnt *= LPFC_CMF_INTERVAL; /* what total should be */
extra = div_u64(total, 33); if (cnt > mbpi)
cnt = mbpi;
extra = cnt - total;
}
lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra);
} else { } else {
/* For Monitor mode or link down we want mbpi /* For Monitor mode or link down we want mbpi
* to be the full link speed * to be the full link speed
*/ */
mbpi = phba->cmf_link_byte_count; mbpi = phba->cmf_link_byte_count;
extra = 0;
} }
phba->cmf_timer_cnt++; phba->cmf_timer_cnt++;
...@@ -6042,6 +6045,7 @@ lpfc_cmf_timer(struct hrtimer *timer) ...@@ -6042,6 +6045,7 @@ lpfc_cmf_timer(struct hrtimer *timer)
LPFC_RXMONITOR_TABLE_IN_USE); LPFC_RXMONITOR_TABLE_IN_USE);
entry = &phba->rxtable[head]; entry = &phba->rxtable[head];
entry->total_bytes = total; entry->total_bytes = total;
entry->cmf_bytes = total + extra;
entry->rcv_bytes = rcv; entry->rcv_bytes = rcv;
entry->cmf_busy = busy; entry->cmf_busy = busy;
entry->cmf_info = phba->cmf_active_info; entry->cmf_info = phba->cmf_active_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment