Skip to content

Commit fc1ddda

Browse files
Ranjan Kumarmartinkpetersen
authored andcommitted
scsi: mpi3mr: Use firmware-provided timestamp update interval
Make driver use the timestamp update interval value provided by firmware in the driver page 1. If firmware fails to provide non-zero value, then the driver will fall back to the driver defined macro. Signed-off-by: Prayas Patel <[email protected]> Signed-off-by: Ranjan Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 9634bb0 commit fc1ddda

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,7 @@ struct mpi3_driver_page0 {
13271327
struct mpi3_driver_page1 {
13281328
struct mpi3_config_page_header header;
13291329
__le32 flags;
1330+
u8 time_stamp_update;
13301331
__le32 reserved0c;
13311332
__le16 host_diag_trace_max_size;
13321333
__le16 host_diag_trace_min_size;

drivers/scsi/mpi3mr/mpi3mr.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,7 @@ struct scmd_priv {
10901090
* @evtack_cmds_bitmap: Event Ack bitmap
10911091
* @delayed_evtack_cmds_list: Delayed event acknowledgment list
10921092
* @ts_update_counter: Timestamp update counter
1093+
* @ts_update_interval: Timestamp update interval
10931094
* @reset_in_progress: Reset in progress flag
10941095
* @unrecoverable: Controller unrecoverable flag
10951096
* @prev_reset_result: Result of previous reset
@@ -1277,7 +1278,8 @@ struct mpi3mr_ioc {
12771278
unsigned long *evtack_cmds_bitmap;
12781279
struct list_head delayed_evtack_cmds_list;
12791280

1280-
u32 ts_update_counter;
1281+
u16 ts_update_counter;
1282+
u16 ts_update_interval;
12811283
u8 reset_in_progress;
12821284
u8 unrecoverable;
12831285
int prev_reset_result;

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2694,7 +2694,7 @@ static void mpi3mr_watchdog_work(struct work_struct *work)
26942694
return;
26952695
}
26962696

2697-
if (mrioc->ts_update_counter++ >= MPI3MR_TSUPDATE_INTERVAL) {
2697+
if (mrioc->ts_update_counter++ >= mrioc->ts_update_interval) {
26982698
mrioc->ts_update_counter = 0;
26992699
mpi3mr_sync_timestamp(mrioc);
27002700
}
@@ -3867,6 +3867,29 @@ static int mpi3mr_repost_diag_bufs(struct mpi3mr_ioc *mrioc)
38673867
return retval;
38683868
}
38693869

3870+
/**
3871+
* mpi3mr_read_tsu_interval - Update time stamp interval
3872+
* @mrioc: Adapter instance reference
3873+
*
3874+
* Update time stamp interval if its defined in driver page 1,
3875+
* otherwise use default value.
3876+
*
3877+
* Return: Nothing
3878+
*/
3879+
static void
3880+
mpi3mr_read_tsu_interval(struct mpi3mr_ioc *mrioc)
3881+
{
3882+
struct mpi3_driver_page1 driver_pg1;
3883+
u16 pg_sz = sizeof(driver_pg1);
3884+
int retval = 0;
3885+
3886+
mrioc->ts_update_interval = MPI3MR_TSUPDATE_INTERVAL;
3887+
3888+
retval = mpi3mr_cfg_get_driver_pg1(mrioc, &driver_pg1, pg_sz);
3889+
if (!retval && driver_pg1.time_stamp_update)
3890+
mrioc->ts_update_interval = (driver_pg1.time_stamp_update * 60);
3891+
}
3892+
38703893
/**
38713894
* mpi3mr_print_ioc_info - Display controller information
38723895
* @mrioc: Adapter instance reference
@@ -4163,6 +4186,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
41634186
goto out_failed_noretry;
41644187
}
41654188

4189+
mpi3mr_read_tsu_interval(mrioc);
41664190
mpi3mr_print_ioc_info(mrioc);
41674191

41684192
if (!mrioc->cfg_page) {
@@ -4344,6 +4368,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)
43444368
goto out_failed_noretry;
43454369
}
43464370

4371+
mpi3mr_read_tsu_interval(mrioc);
43474372
mpi3mr_print_ioc_info(mrioc);
43484373

43494374
if (is_resume) {

0 commit comments

Comments
 (0)