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

Configure Feed

Select the types of activity you want to include in your feed.

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.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

James Smart and committed by
Martin K. Petersen
a6269f83 7dd2e2a9

+22 -15
+1
drivers/scsi/lpfc/lpfc.h
··· 1602 1602 #define LPFC_MAX_RXMONITOR_ENTRY 800 1603 1603 #define LPFC_MAX_RXMONITOR_DUMP 32 1604 1604 struct rxtable_entry { 1605 + uint64_t cmf_bytes; /* Total no of read bytes for CMF_SYNC_WQE */ 1605 1606 uint64_t total_bytes; /* Total no of read bytes requested */ 1606 1607 uint64_t rcv_bytes; /* Total no of read bytes completed */ 1607 1608 uint64_t avg_io_size;
+8 -6
drivers/scsi/lpfc/lpfc_debugfs.c
··· 5561 5561 start = tail; 5562 5562 5563 5563 len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, 5564 - " MaxBPI\t Total Data Cmd Total Data Cmpl " 5565 - " Latency(us) Avg IO Size\tMax IO Size IO cnt " 5566 - "Info BWutil(ms)\n"); 5564 + " MaxBPI Tot_Data_CMF Tot_Data_Cmd " 5565 + "Tot_Data_Cmpl Lat(us) Avg_IO Max_IO " 5566 + "Bsy IO_cnt Info BWutil(ms)\n"); 5567 5567 get_table: 5568 5568 for (i = start; i < last; i++) { 5569 5569 entry = &phba->rxtable[i]; 5570 5570 len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, 5571 - "%3d:%12lld %12lld\t%12lld\t" 5572 - "%8lldus\t%8lld\t%10lld " 5573 - "%8d %2d %2d(%2d)\n", 5571 + "%3d:%12lld %12lld %12lld %12lld " 5572 + "%7lldus %8lld %7lld " 5573 + "%2d %4d %2d %2d(%2d)\n", 5574 5574 i, entry->max_bytes_per_interval, 5575 + entry->cmf_bytes, 5575 5576 entry->total_bytes, 5576 5577 entry->rcv_bytes, 5577 5578 entry->avg_io_latency, 5578 5579 entry->avg_io_size, 5579 5580 entry->max_read_cnt, 5581 + entry->cmf_busy, 5580 5582 entry->io_cnt, 5581 5583 entry->cmf_info, 5582 5584 entry->timer_utilization,
+1 -1
drivers/scsi/lpfc/lpfc_debugfs.h
··· 282 282 void *ptr_private; 283 283 }; 284 284 285 - #define MAX_DEBUGFS_RX_TABLE_SIZE (100 * LPFC_MAX_RXMONITOR_ENTRY) 285 + #define MAX_DEBUGFS_RX_TABLE_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) 286 286 struct lpfc_rx_monitor_debug { 287 287 char *i_private; 288 288 char *buffer;
+12 -8
drivers/scsi/lpfc/lpfc_init.c
··· 5927 5927 uint32_t io_cnt; 5928 5928 uint32_t head, tail; 5929 5929 uint32_t busy, max_read; 5930 - uint64_t total, rcv, lat, mbpi, extra; 5930 + uint64_t total, rcv, lat, mbpi, extra, cnt; 5931 5931 int timer_interval = LPFC_CMF_INTERVAL; 5932 5932 uint32_t ms; 5933 5933 struct lpfc_cgn_stat *cgs; ··· 5998 5998 5999 5999 /* Calculate any extra bytes needed to account for the 6000 6000 * timer accuracy. If we are less than LPFC_CMF_INTERVAL 6001 - * add an extra 3% slop factor, equal to LPFC_CMF_INTERVAL 6002 - * add an extra 2%. The goal is to equalize total with a 6003 - * time > LPFC_CMF_INTERVAL or <= LPFC_CMF_INTERVAL + 1 6001 + * calculate the adjustment needed for total to reflect 6002 + * a full LPFC_CMF_INTERVAL. 6004 6003 */ 6005 - if (ms == LPFC_CMF_INTERVAL) 6006 - extra = div_u64(total, 50); 6007 - else if (ms < LPFC_CMF_INTERVAL) 6008 - extra = div_u64(total, 33); 6004 + if (ms && ms < LPFC_CMF_INTERVAL) { 6005 + cnt = div_u64(total, ms); /* bytes per ms */ 6006 + cnt *= LPFC_CMF_INTERVAL; /* what total should be */ 6007 + if (cnt > mbpi) 6008 + cnt = mbpi; 6009 + extra = cnt - total; 6010 + } 6009 6011 lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); 6010 6012 } else { 6011 6013 /* For Monitor mode or link down we want mbpi 6012 6014 * to be the full link speed 6013 6015 */ 6014 6016 mbpi = phba->cmf_link_byte_count; 6017 + extra = 0; 6015 6018 } 6016 6019 phba->cmf_timer_cnt++; 6017 6020 ··· 6045 6042 LPFC_RXMONITOR_TABLE_IN_USE); 6046 6043 entry = &phba->rxtable[head]; 6047 6044 entry->total_bytes = total; 6045 + entry->cmf_bytes = total + extra; 6048 6046 entry->rcv_bytes = rcv; 6049 6047 entry->cmf_busy = busy; 6050 6048 entry->cmf_info = phba->cmf_active_info;