mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Add support for General Statistics and Performance log page.
CTL already collects most of statistics reported there, so why not. MFC after: 2 weeks
This commit is contained in:
parent
56af34a743
commit
2c8cab2a4e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=278584
@ -4483,6 +4483,8 @@ ctl_init_log_page_index(struct ctl_lun *lun)
|
|||||||
lun->log_pages.index[1].page_len = k * 2;
|
lun->log_pages.index[1].page_len = k * 2;
|
||||||
lun->log_pages.index[2].page_data = &lun->log_pages.lbp_page[0];
|
lun->log_pages.index[2].page_data = &lun->log_pages.lbp_page[0];
|
||||||
lun->log_pages.index[2].page_len = 12*CTL_NUM_LBP_PARAMS;
|
lun->log_pages.index[2].page_len = 12*CTL_NUM_LBP_PARAMS;
|
||||||
|
lun->log_pages.index[3].page_data = (uint8_t *)&lun->log_pages.stat_page;
|
||||||
|
lun->log_pages.index[3].page_len = sizeof(lun->log_pages.stat_page);
|
||||||
|
|
||||||
return (CTL_RETVAL_COMPLETE);
|
return (CTL_RETVAL_COMPLETE);
|
||||||
}
|
}
|
||||||
@ -4720,6 +4722,9 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun,
|
|||||||
lun->serseq = CTL_LUN_SERSEQ_OFF;
|
lun->serseq = CTL_LUN_SERSEQ_OFF;
|
||||||
|
|
||||||
lun->ctl_softc = ctl_softc;
|
lun->ctl_softc = ctl_softc;
|
||||||
|
#ifdef CTL_TIME_IO
|
||||||
|
lun->last_busy = getsbinuptime();
|
||||||
|
#endif
|
||||||
TAILQ_INIT(&lun->ooa_queue);
|
TAILQ_INIT(&lun->ooa_queue);
|
||||||
TAILQ_INIT(&lun->blocked_queue);
|
TAILQ_INIT(&lun->blocked_queue);
|
||||||
STAILQ_INIT(&lun->error_list);
|
STAILQ_INIT(&lun->error_list);
|
||||||
@ -7084,6 +7089,67 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ctl_sap_log_sense_handler(struct ctl_scsiio *ctsio,
|
||||||
|
struct ctl_page_index *page_index,
|
||||||
|
int pc)
|
||||||
|
{
|
||||||
|
struct ctl_lun *lun;
|
||||||
|
struct stat_page *data;
|
||||||
|
uint64_t rn, wn, rb, wb;
|
||||||
|
struct bintime rt, wt;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
|
||||||
|
data = (struct stat_page *)page_index->page_data;
|
||||||
|
|
||||||
|
scsi_ulto2b(SLP_SAP, data->sap.hdr.param_code);
|
||||||
|
data->sap.hdr.param_control = SLP_LBIN;
|
||||||
|
data->sap.hdr.param_len = sizeof(struct scsi_log_stat_and_perf) -
|
||||||
|
sizeof(struct scsi_log_param_header);
|
||||||
|
rn = wn = rb = wb = 0;
|
||||||
|
bintime_clear(&rt);
|
||||||
|
bintime_clear(&wt);
|
||||||
|
for (i = 0; i < CTL_MAX_PORTS; i++) {
|
||||||
|
rn += lun->stats.ports[i].operations[CTL_STATS_READ];
|
||||||
|
wn += lun->stats.ports[i].operations[CTL_STATS_WRITE];
|
||||||
|
rb += lun->stats.ports[i].bytes[CTL_STATS_READ];
|
||||||
|
wb += lun->stats.ports[i].bytes[CTL_STATS_WRITE];
|
||||||
|
bintime_add(&rt, &lun->stats.ports[i].time[CTL_STATS_READ]);
|
||||||
|
bintime_add(&wt, &lun->stats.ports[i].time[CTL_STATS_WRITE]);
|
||||||
|
}
|
||||||
|
scsi_u64to8b(rn, data->sap.read_num);
|
||||||
|
scsi_u64to8b(wn, data->sap.write_num);
|
||||||
|
if (lun->stats.blocksize > 0) {
|
||||||
|
scsi_u64to8b(wb / lun->stats.blocksize,
|
||||||
|
data->sap.recvieved_lba);
|
||||||
|
scsi_u64to8b(rb / lun->stats.blocksize,
|
||||||
|
data->sap.transmitted_lba);
|
||||||
|
}
|
||||||
|
scsi_u64to8b((uint64_t)rt.sec * 1000 + rt.frac / (UINT64_MAX / 1000),
|
||||||
|
data->sap.read_int);
|
||||||
|
scsi_u64to8b((uint64_t)wt.sec * 1000 + wt.frac / (UINT64_MAX / 1000),
|
||||||
|
data->sap.write_int);
|
||||||
|
scsi_u64to8b(0, data->sap.weighted_num);
|
||||||
|
scsi_u64to8b(0, data->sap.weighted_int);
|
||||||
|
scsi_ulto2b(SLP_IT, data->it.hdr.param_code);
|
||||||
|
data->it.hdr.param_control = SLP_LBIN;
|
||||||
|
data->it.hdr.param_len = sizeof(struct scsi_log_idle_time) -
|
||||||
|
sizeof(struct scsi_log_param_header);
|
||||||
|
#ifdef CTL_TIME_IO
|
||||||
|
scsi_u64to8b(lun->idle_time / SBT_1MS, data->it.idle_int);
|
||||||
|
#endif
|
||||||
|
scsi_ulto2b(SLP_TI, data->ti.hdr.param_code);
|
||||||
|
data->it.hdr.param_control = SLP_LBIN;
|
||||||
|
data->ti.hdr.param_len = sizeof(struct scsi_log_time_interval) -
|
||||||
|
sizeof(struct scsi_log_param_header);
|
||||||
|
scsi_ulto4b(3, data->ti.exponent);
|
||||||
|
scsi_ulto4b(1, data->ti.integer);
|
||||||
|
|
||||||
|
page_index->page_len = sizeof(*data);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ctl_log_sense(struct ctl_scsiio *ctsio)
|
ctl_log_sense(struct ctl_scsiio *ctsio)
|
||||||
{
|
{
|
||||||
@ -11689,6 +11755,12 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio)
|
|||||||
* Every I/O goes into the OOA queue for a
|
* Every I/O goes into the OOA queue for a
|
||||||
* particular LUN, and stays there until completion.
|
* particular LUN, and stays there until completion.
|
||||||
*/
|
*/
|
||||||
|
#ifdef CTL_TIME_IO
|
||||||
|
if (TAILQ_EMPTY(&lun->ooa_queue)) {
|
||||||
|
lun->idle_time += getsbinuptime() -
|
||||||
|
lun->last_busy;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr,
|
TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr,
|
||||||
ooa_links);
|
ooa_links);
|
||||||
}
|
}
|
||||||
@ -13735,6 +13807,10 @@ ctl_process_done(union ctl_io *io)
|
|||||||
* Remove this from the OOA queue.
|
* Remove this from the OOA queue.
|
||||||
*/
|
*/
|
||||||
TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links);
|
TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links);
|
||||||
|
#ifdef CTL_TIME_IO
|
||||||
|
if (TAILQ_EMPTY(&lun->ooa_queue))
|
||||||
|
lun->last_busy = getsbinuptime();
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run through the blocked queue on this LUN and see if anything
|
* Run through the blocked queue on this LUN and see if anything
|
||||||
|
@ -181,6 +181,9 @@ int ctl_debugconf_sp_select_handler(struct ctl_scsiio *ctsio,
|
|||||||
int ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
|
int ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
|
||||||
struct ctl_page_index *page_index,
|
struct ctl_page_index *page_index,
|
||||||
int pc);
|
int pc);
|
||||||
|
int ctl_sap_log_sense_handler(struct ctl_scsiio *ctsio,
|
||||||
|
struct ctl_page_index *page_index,
|
||||||
|
int pc);
|
||||||
int ctl_config_move_done(union ctl_io *io);
|
int ctl_config_move_done(union ctl_io *io);
|
||||||
void ctl_datamove(union ctl_io *io);
|
void ctl_datamove(union ctl_io *io);
|
||||||
void ctl_done(union ctl_io *io);
|
void ctl_done(union ctl_io *io);
|
||||||
|
@ -342,6 +342,8 @@ static const struct ctl_page_index log_page_index_template[] = {
|
|||||||
CTL_PAGE_FLAG_NONE, NULL, NULL},
|
CTL_PAGE_FLAG_NONE, NULL, NULL},
|
||||||
{SLS_LOGICAL_BLOCK_PROVISIONING, 0, 0, NULL,
|
{SLS_LOGICAL_BLOCK_PROVISIONING, 0, 0, NULL,
|
||||||
CTL_PAGE_FLAG_NONE, ctl_lbp_log_sense_handler, NULL},
|
CTL_PAGE_FLAG_NONE, ctl_lbp_log_sense_handler, NULL},
|
||||||
|
{SLS_STAT_AND_PERF, 0, 0, NULL,
|
||||||
|
CTL_PAGE_FLAG_NONE, ctl_sap_log_sense_handler, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CTL_NUM_LOG_PAGES sizeof(log_page_index_template)/ \
|
#define CTL_NUM_LOG_PAGES sizeof(log_page_index_template)/ \
|
||||||
@ -351,6 +353,11 @@ struct ctl_log_pages {
|
|||||||
uint8_t pages_page[CTL_NUM_LOG_PAGES];
|
uint8_t pages_page[CTL_NUM_LOG_PAGES];
|
||||||
uint8_t subpages_page[CTL_NUM_LOG_PAGES * 2];
|
uint8_t subpages_page[CTL_NUM_LOG_PAGES * 2];
|
||||||
uint8_t lbp_page[12*CTL_NUM_LBP_PARAMS];
|
uint8_t lbp_page[12*CTL_NUM_LBP_PARAMS];
|
||||||
|
struct stat_page {
|
||||||
|
struct scsi_log_stat_and_perf sap;
|
||||||
|
struct scsi_log_idle_time it;
|
||||||
|
struct scsi_log_time_interval ti;
|
||||||
|
} stat_page;
|
||||||
struct ctl_page_index index[CTL_NUM_LOG_PAGES];
|
struct ctl_page_index index[CTL_NUM_LOG_PAGES];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -403,6 +410,10 @@ struct ctl_lun {
|
|||||||
struct ctl_lun_delay_info delay_info;
|
struct ctl_lun_delay_info delay_info;
|
||||||
int sync_interval;
|
int sync_interval;
|
||||||
int sync_count;
|
int sync_count;
|
||||||
|
#ifdef CTL_TIME_IO
|
||||||
|
sbintime_t idle_time;
|
||||||
|
sbintime_t last_busy;
|
||||||
|
#endif
|
||||||
TAILQ_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue;
|
TAILQ_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue;
|
||||||
TAILQ_HEAD(ctl_blockq,ctl_io_hdr) blocked_queue;
|
TAILQ_HEAD(ctl_blockq,ctl_io_hdr) blocked_queue;
|
||||||
STAILQ_ENTRY(ctl_lun) links;
|
STAILQ_ENTRY(ctl_lun) links;
|
||||||
|
@ -561,6 +561,7 @@ struct scsi_log_sense
|
|||||||
#define SLS_ERROR_LASTN_PAGE 0x07
|
#define SLS_ERROR_LASTN_PAGE 0x07
|
||||||
#define SLS_LOGICAL_BLOCK_PROVISIONING 0x0c
|
#define SLS_LOGICAL_BLOCK_PROVISIONING 0x0c
|
||||||
#define SLS_SELF_TEST_PAGE 0x10
|
#define SLS_SELF_TEST_PAGE 0x10
|
||||||
|
#define SLS_STAT_AND_PERF 0x19
|
||||||
#define SLS_IE_PAGE 0x2f
|
#define SLS_IE_PAGE 0x2f
|
||||||
#define SLS_PAGE_CTRL_MASK 0xC0
|
#define SLS_PAGE_CTRL_MASK 0xC0
|
||||||
#define SLS_PAGE_CTRL_THRESHOLD 0x00
|
#define SLS_PAGE_CTRL_THRESHOLD 0x00
|
||||||
@ -619,6 +620,45 @@ struct scsi_log_param_header {
|
|||||||
u_int8_t param_len;
|
u_int8_t param_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct scsi_log_stat_and_perf {
|
||||||
|
struct scsi_log_param_header hdr;
|
||||||
|
#define SLP_SAP 0x0001
|
||||||
|
uint8_t read_num[8];
|
||||||
|
uint8_t write_num[8];
|
||||||
|
uint8_t recvieved_lba[8];
|
||||||
|
uint8_t transmitted_lba[8];
|
||||||
|
uint8_t read_int[8];
|
||||||
|
uint8_t write_int[8];
|
||||||
|
uint8_t weighted_num[8];
|
||||||
|
uint8_t weighted_int[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct scsi_log_idle_time {
|
||||||
|
struct scsi_log_param_header hdr;
|
||||||
|
#define SLP_IT 0x0002
|
||||||
|
uint8_t idle_int[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct scsi_log_time_interval {
|
||||||
|
struct scsi_log_param_header hdr;
|
||||||
|
#define SLP_TI 0x0003
|
||||||
|
uint8_t exponent[4];
|
||||||
|
uint8_t integer[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct scsi_log_fua_stat_and_perf {
|
||||||
|
struct scsi_log_param_header hdr;
|
||||||
|
#define SLP_FUA_SAP 0x0004
|
||||||
|
uint8_t fua_read_num[8];
|
||||||
|
uint8_t fua_write_num[8];
|
||||||
|
uint8_t fuanv_read_num[8];
|
||||||
|
uint8_t fuanv_write_num[8];
|
||||||
|
uint8_t fua_read_int[8];
|
||||||
|
uint8_t fua_write_int[8];
|
||||||
|
uint8_t fuanv_read_int[8];
|
||||||
|
uint8_t fuanv_write_int[8];
|
||||||
|
};
|
||||||
|
|
||||||
struct scsi_control_page {
|
struct scsi_control_page {
|
||||||
u_int8_t page_code;
|
u_int8_t page_code;
|
||||||
u_int8_t page_length;
|
u_int8_t page_length;
|
||||||
|
Loading…
Reference in New Issue
Block a user