mpi3mr: Enhancements for mpi3mr
Subsystems (2)
cover mpi3mr: Enhancements for mpi3mr
Enhancements for mpi3mr driver
Ranjan Kumar (7):
mpi3mr: Add module parameter to control threaded IRQ polling
mpi3mr: Rename log data save helper to reflect threaded/BH context
mpi3mr: Avoid redundant diag-fault resets
mpi3mr: Use negotiated link rate from DevicePage0
mpi3mr: Update MPI Headers to revision 39
mpi3mr: Record and report controller firmware faults
mpi3mr: Driver version update to 8.17.0.3.50
drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 92 +++++++++++++++++- drivers/scsi/mpi3mr/mpi/mpi30_image.h | 102 +++++++++++++++++++- drivers/scsi/mpi3mr/mpi/mpi30_init.h | 2 +- drivers/scsi/mpi3mr/mpi/mpi30_ioc.h | 9 +- drivers/scsi/mpi3mr/mpi/mpi30_pci.h | 2 +- drivers/scsi/mpi3mr/mpi/mpi30_sas.h | 2 +- drivers/scsi/mpi3mr/mpi/mpi30_tool.h | 6 +- drivers/scsi/mpi3mr/mpi/mpi30_transport.h | 4 +- drivers/scsi/mpi3mr/mpi3mr.h | 16 +++- drivers/scsi/mpi3mr/mpi3mr_app.c | 28 +++++- drivers/scsi/mpi3mr/mpi3mr_fw.c | 109 +++++++++++++++++++++- drivers/scsi/mpi3mr/mpi3mr_os.c | 96 ++++++++++++++++++- drivers/scsi/mpi3mr/mpi3mr_transport.c | 30 +++--- 13 files changed, 459 insertions(+), 39 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/7 mpi3mr: Add module parameter to control threaded IRQ polling
Add a module parameter to enable or disable threaded IRQ polling in the driver. The default behavior remains unchanged with polling enabled.
When disabled, completion processing is kept entirely in the hard IRQ context, avoiding the threaded polling path.
--- drivers/scsi/mpi3mr/mpi3mr_fw.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +7 -2
@@ -21,6 +21,10 @@ static int mpi3mr_check_op_admin_proc(struct mpi3mr_ioc *mrioc);static int poll_queues;module_param (poll_queues, int,0444 );MODULE_PARM_DESC (poll_queues,"Number of queues for io_uring poll mode. (Range 1 - 126)" ); +static bool threaded_isr_poll = true; +module_param (threaded_isr_poll, bool,0444 ); +MODULE_PARM_DESC (threaded_isr_poll, +"Enablement of IRQ polling thread (default=true)" );#if defined(writeq) && defined(CONFIG_64BIT ) static inline void mpi3mr_writeq(__u64 b, void __iomem *addr,
@@ -595,7 +599,8 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,* Exit completion loop to avoid CPU lockup * Ensure remaining completion happens from threaded ISR. */ -if (num_op_reply > mrioc->max_host_ios) { +if ((num_op_reply > mrioc->max_host_ios) && + (threaded_isr_poll == true)) { op_reply_q->enable_irq_poll = true;break ; }
@@ -692,7 +697,7 @@ static irqreturn_t mpi3mr_isr(int irq, void *privdata)* If more IOs are expected, schedule IRQ polling thread. * Otherwise exit from ISR. */ -if (!intr_info->op_reply_q) +if ((threaded_isr_poll == false) || !intr_info->op_reply_q)return ret; if (!intr_info->op_reply_q->enable_irq_poll ||
Signature · 1 line
2.47.3
Re: [PATCH v1 1/7] mpi3mr: Add module parameter to control threaded IRQ polling
Quoted 6 lines · Ranjan Kumar
Add a module parameter to enable or disable threaded IRQ polling in the driver. The default behavior remains unchanged with polling enabled.
When disabled, completion processing is kept entirely in the hard IRQ context, avoiding the threaded polling path.
What does that bring ? Better throughput ? Lower latency ? please tell us more about the benefits of this change.
Quoted 40 lines
Signed-off-by Ranjan Kumar <[email protected]>--- drivers/scsi/mpi3mr/mpi3mr_fw.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/scsi/mpi3mr/mpi3mr_fw.c +7
-2@@ -21,6 +21,10 @@ static int mpi3mr_check_op_admin_proc(struct mpi3mr_ioc *mrioc);static int poll_queues;module_param (poll_queues, int,0444 );MODULE_PARM_DESC (poll_queues,"Number of queues for io_uring poll mode. (Range 1 - 126)" ); +static bool threaded_isr_poll = true; +module_param (threaded_isr_poll, bool,0444 ); +MODULE_PARM_DESC (threaded_isr_poll, +"Enablement of IRQ polling thread (default=true)" );#if defined(writeq) && defined(CONFIG_64BIT ) static inline void mpi3mr_writeq(__u64 b, void __iomem *addr,@@ -595,7 +599,8 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,* Exit completion loop to avoid CPU lockup * Ensure remaining completion happens from threaded ISR. */ -if (num_op_reply > mrioc->max_host_ios) { +if ((num_op_reply > mrioc->max_host_ios) && + (threaded_isr_poll == true)) { op_reply_q->enable_irq_poll = true;break ; }@@ -692,7 +697,7 @@ static irqreturn_t mpi3mr_isr(int irq, void *privdata)* If more IOs are expected, schedule IRQ polling thread. * Otherwise exit from ISR. */ -if (!intr_info->op_reply_q) +if ((threaded_isr_poll == false) || !intr_info->op_reply_q)return ret; if (!intr_info->op_reply_q->enable_irq_poll ||
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH v1 1/7] mpi3mr: Add module parameter to control threaded IRQ polling
Hi Damien,
Quoted 6 lines · Damien Le Moal
Quoted 4 lines · Ranjan Kumar
Add a module parameter to enable or disable threaded IRQ polling in the driver. The default behavior remains unchanged with polling enabled.
Quoted 6 lines
Quoted 2 lines
When disabled, completion processing is kept entirely in the hard IRQ context, avoiding the threaded polling path.
What does that bring ? Better throughput ? Lower latency ? please tell us more about the benefits of this change.
[Ranjan]: SAS/SATA completes IOs slowly, so IO polling would increase CPU utilization, and interrupt-driven
completions are useful whereas for NVMe devices, IO polling is beneficial as the device completes IOs fast.
Quoted 45 lines
Quoted 32 lines
Signed-off-by Ranjan Kumar <[email protected]>--- drivers/scsi/mpi3mr/mpi3mr_fw.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/scsi/mpi3mr/mpi3mr_fw.c +6
-1@@ -21,6 +21,10 @@ static int mpi3mr_check_op_admin_proc(struct mpi3mr_ioc *mrioc);static int poll_queues;module_param (poll_queues, int,0444 );MODULE_PARM_DESC (poll_queues,"Number of queues for io_uring poll mode. (Range 1 - 126)" ); +static bool threaded_isr_poll = true; +module_param (threaded_isr_poll, bool,0444 ); +MODULE_PARM_DESC (threaded_isr_poll, +"Enablement of IRQ polling thread (default=true)" );#if defined(writeq) && defined(CONFIG_64BIT ) static inline void mpi3mr_writeq(__u64 b, void __iomem *addr,@@ -595,7 +599,8 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,* Exit completion loop to avoid CPU lockup * Ensure remaining completion happens from threaded ISR. */ -if (num_op_reply > mrioc->max_host_ios) { +if ((num_op_reply > mrioc->max_host_ios) && + (threaded_isr_poll == true)) { op_reply_q->enable_irq_poll = true;break ; }drivers/scsi/mpi3mr/mpi3mr_fw.c static irqreturn_t mpi3mr_isr(int irq, void *privdata) · line 703
Quoted 8 lines
drivers/scsi/mpi3mr/mpi3mr_fw.c +1
-1@@ -692,7 +697,7 @@ static irqreturn_t mpi3mr_isr(int irq, void *privdata)* If more IOs are expected, schedule IRQ polling thread. * Otherwise exit from ISR. */ -if (!intr_info->op_reply_q) +if ((threaded_isr_poll == false) || !intr_info->op_reply_q)return ret; if (!intr_info->op_reply_q->enable_irq_poll ||--
Damien Le Moal
Western Digital Research
PATCH 2/7 mpi3mr: Rename log data save helper to reflect threaded/BH context
In reply to Ranjan KumarLog data events can be processed from BH and threaded contexts. Rename the save helper to document its intended usage and improve readability of the event handling flow.
--- drivers/scsi/mpi3mr/mpi3mr.h | 2 +- drivers/scsi/mpi3mr/mpi3mr_app.c | 4 ++-- drivers/scsi/mpi3mr/mpi3mr_os.c | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +1 -1
@@ -1508,7 +1508,7 @@ void mpi3mr_pel_get_seqnum_complete(struct mpi3mr_ioc *mrioc, struct mpi3mr_drv_cmd *drv_cmd);int mpi3mr_pel_get_seqnum_post (struct mpi3mr_ioc *mrioc,struct mpi3mr_drv_cmd *drv_cmd); -void mpi3mr_app_save_logdata (struct mpi3mr_ioc *mrioc,char *event_data, +void mpi3mr_app_save_logdata_th (struct mpi3mr_ioc *mrioc,char *event_data,u16 event_data_size);struct mpi3mr_enclosure_node *mpi3mr_enclosure_find_by_handle (struct mpi3mr_ioc *mrioc,u16 handle);
drivers/scsi/mpi3mr/mpi3mr_app.c +2 -2
@@ -2920,7 +2920,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job) }/** -* mpi3mr_app_save_logdata - Save Log Data events +* mpi3mr_app_save_logdata_th - Save Log Data events * @mrioc: Adapter instance reference * @event_data: event data associated with log data event * @event_data_size: event data size to copy
@@ -2932,7 +2932,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)* * Return:Nothing */ -void mpi3mr_app_save_logdata (struct mpi3mr_ioc *mrioc,char *event_data, +void mpi3mr_app_save_logdata_th (struct mpi3mr_ioc *mrioc,char *event_data,u16 event_data_size) {u32 index = mrioc->logdata_buf_idx, sz;
drivers/scsi/mpi3mr/mpi3mr_os.c +7 -1
@@ -1962,7 +1962,7 @@ static void mpi3mr_pcietopochg_evt_bh(struct mpi3mr_ioc *mrioc,static void mpi3mr_logdata_evt_bh (struct mpi3mr_ioc *mrioc,struct mpi3mr_fwevt *fwevt) { -mpi3mr_app_save_logdata (mrioc, fwevt->event_data, +mpi3mr_app_save_logdata_th (mrioc, fwevt->event_data, fwevt->event_data_size); }
@@ -3058,6 +3058,12 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, }case MPI3_EVENT_DEVICE_INFO_CHANGED :case MPI3_EVENT_LOG_DATA : + { + sz = event_reply->event_data_length *4 ; +mpi3mr_app_save_logdata_th (mrioc, + (char *)event_reply->event_data, sz); +break ; + }case MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE :case MPI3_EVENT_ENCL_DEVICE_ADDED : {
Signature · 1 line
2.47.3
Re: [PATCH v1 2/7] mpi3mr: Rename log data save helper to reflect threaded/BH context
Quoted 60 lines · Ranjan Kumar
Log data events can be processed from BH and threaded contexts. Rename the save helper to document its intended usage and improve readability of the event handling flow.
Signed-off-by Ranjan Kumar <[email protected]>--- drivers/scsi/mpi3mr/mpi3mr.h | 2 +- drivers/scsi/mpi3mr/mpi3mr_app.c | 4 ++-- drivers/scsi/mpi3mr/mpi3mr_os.c | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-)drivers/scsi/mpi3mr/mpi3mr.h +1
-1@@ -1508,7 +1508,7 @@ void mpi3mr_pel_get_seqnum_complete(struct mpi3mr_ioc *mrioc, struct mpi3mr_drv_cmd *drv_cmd);int mpi3mr_pel_get_seqnum_post (struct mpi3mr_ioc *mrioc,struct mpi3mr_drv_cmd *drv_cmd); -void mpi3mr_app_save_logdata (struct mpi3mr_ioc *mrioc,char *event_data, +void mpi3mr_app_save_logdata_th (struct mpi3mr_ioc *mrioc,char *event_data,u16 event_data_size);struct mpi3mr_enclosure_node *mpi3mr_enclosure_find_by_handle (struct mpi3mr_ioc *mrioc,u16 handle);drivers/scsi/mpi3mr/mpi3mr_app.c +2
-2@@ -2920,7 +2920,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job) }/** -* mpi3mr_app_save_logdata - Save Log Data events +* mpi3mr_app_save_logdata_th - Save Log Data events * @mrioc: Adapter instance reference * @event_data: event data associated with log data event * @event_data_size: event data size to copy @@ -2932,7 +2932,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)* * Return:Nothing */ -void mpi3mr_app_save_logdata (struct mpi3mr_ioc *mrioc,char *event_data, +void mpi3mr_app_save_logdata_th (struct mpi3mr_ioc *mrioc,char *event_data,u16 event_data_size) {u32 index = mrioc->logdata_buf_idx, sz;drivers/scsi/mpi3mr/mpi3mr_os.c +1
-1@@ -1962,7 +1962,7 @@ static void mpi3mr_pcietopochg_evt_bh(struct mpi3mr_ioc *mrioc,static void mpi3mr_logdata_evt_bh (struct mpi3mr_ioc *mrioc,struct mpi3mr_fwevt *fwevt) { -mpi3mr_app_save_logdata (mrioc, fwevt->event_data, +mpi3mr_app_save_logdata_th (mrioc, fwevt->event_data, fwevt->event_data_size); }
drivers/scsi/mpi3mr/mpi3mr_os.c void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, · line 3061
Quoted 4 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +1
-0@@ -3058,6 +3058,12 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, }case MPI3_EVENT_DEVICE_INFO_CHANGED :case MPI3_EVENT_LOG_DATA : + {
The curly brackets are not necessary.
drivers/scsi/mpi3mr/mpi3mr_os.c void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, · line 3064
Quoted 3 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0+ sz = event_reply->event_data_length *4 ; +mpi3mr_app_save_logdata_th (mrioc, + (char *)event_reply->event_data, sz);
Do you really need the cast here ?
Quoted 5 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-0+break ; + }case MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE :case MPI3_EVENT_ENCL_DEVICE_ADDED : {
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH v1 2/7] mpi3mr: Rename log data save helper to reflect threaded/BH context
Hi Damien,
Quoted 61 lines · Damien Le Moal
Quoted 59 lines · Ranjan Kumar
Log data events can be processed from BH and threaded contexts. Rename the save helper to document its intended usage and improve readability of the event handling flow.
Signed-off-by Ranjan Kumar <[email protected]>--- drivers/scsi/mpi3mr/mpi3mr.h | 2 +- drivers/scsi/mpi3mr/mpi3mr_app.c | 4 ++-- drivers/scsi/mpi3mr/mpi3mr_os.c | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-)drivers/scsi/mpi3mr/mpi3mr.h +1
-1@@ -1508,7 +1508,7 @@ void mpi3mr_pel_get_seqnum_complete(struct mpi3mr_ioc *mrioc, struct mpi3mr_drv_cmd *drv_cmd);int mpi3mr_pel_get_seqnum_post (struct mpi3mr_ioc *mrioc,struct mpi3mr_drv_cmd *drv_cmd); -void mpi3mr_app_save_logdata (struct mpi3mr_ioc *mrioc,char *event_data, +void mpi3mr_app_save_logdata_th (struct mpi3mr_ioc *mrioc,char *event_data,u16 event_data_size);struct mpi3mr_enclosure_node *mpi3mr_enclosure_find_by_handle (struct mpi3mr_ioc *mrioc,u16 handle);drivers/scsi/mpi3mr/mpi3mr_app.c +2
-2@@ -2920,7 +2920,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job) }/** -* mpi3mr_app_save_logdata - Save Log Data events +* mpi3mr_app_save_logdata_th - Save Log Data events * @mrioc: Adapter instance reference * @event_data: event data associated with log data event * @event_data_size: event data size to copy @@ -2932,7 +2932,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)* * Return:Nothing */ -void mpi3mr_app_save_logdata (struct mpi3mr_ioc *mrioc,char *event_data, +void mpi3mr_app_save_logdata_th (struct mpi3mr_ioc *mrioc,char *event_data,u16 event_data_size) {u32 index = mrioc->logdata_buf_idx, sz;drivers/scsi/mpi3mr/mpi3mr_os.c +1
-1@@ -1962,7 +1962,7 @@ static void mpi3mr_pcietopochg_evt_bh(struct mpi3mr_ioc *mrioc,static void mpi3mr_logdata_evt_bh (struct mpi3mr_ioc *mrioc,struct mpi3mr_fwevt *fwevt) { -mpi3mr_app_save_logdata (mrioc, fwevt->event_data, +mpi3mr_app_save_logdata_th (mrioc, fwevt->event_data, fwevt->event_data_size); }
Quoted 7 lines
drivers/scsi/mpi3mr/mpi3mr_os.c void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, · line 3061
Quoted 5 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +1
-0@@ -3058,6 +3058,12 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, }case MPI3_EVENT_DEVICE_INFO_CHANGED :case MPI3_EVENT_LOG_DATA : + {The curly brackets are not necessary.
[Ranjan] : The extra braces around the MPI3_EVENT_LOG_DATA case are unnecessary.
I’ll remove them in the next revision.
Quoted 6 lines
drivers/scsi/mpi3mr/mpi3mr_os.c void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, · line 3064
Quoted 4 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0+ sz = event_reply->event_data_length *4 ; +mpi3mr_app_save_logdata_th (mrioc, + (char *)event_reply->event_data, sz);Do you really need the cast here ?
[Ranjan]:
The cast to (char *) is not required since event_reply->event_data is already compatible with the helper prototype.
I’ll drop the cast as well.
I’ll address these and resend in v2.
Quoted 11 lines
drivers/scsi/mpi3mr/mpi3mr_os.c void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, · line 3069
Quoted 6 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-0+break ; + }case MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE :case MPI3_EVENT_ENCL_DEVICE_ADDED : {--
Damien Le Moal
Western Digital Research
Thanks,
Ranjan
Re: [PATCH v1 2/7] mpi3mr: Rename log data save helper to reflect threaded/BH context
Hi Damien,
Quoted 80 lines · Ranjan Kumar
Hi Damien,
Quoted 61 lines · Damien Le Moal
Quoted 59 lines · Ranjan Kumar
Log data events can be processed from BH and threaded contexts. Rename the save helper to document its intended usage and improve readability of the event handling flow.
Signed-off-by Ranjan Kumar <[email protected]>--- drivers/scsi/mpi3mr/mpi3mr.h | 2 +- drivers/scsi/mpi3mr/mpi3mr_app.c | 4 ++-- drivers/scsi/mpi3mr/mpi3mr_os.c | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-)drivers/scsi/mpi3mr/mpi3mr.h +1
-1@@ -1508,7 +1508,7 @@ void mpi3mr_pel_get_seqnum_complete(struct mpi3mr_ioc *mrioc, struct mpi3mr_drv_cmd *drv_cmd);int mpi3mr_pel_get_seqnum_post (struct mpi3mr_ioc *mrioc,struct mpi3mr_drv_cmd *drv_cmd); -void mpi3mr_app_save_logdata (struct mpi3mr_ioc *mrioc,char *event_data, +void mpi3mr_app_save_logdata_th (struct mpi3mr_ioc *mrioc,char *event_data,u16 event_data_size);struct mpi3mr_enclosure_node *mpi3mr_enclosure_find_by_handle (struct mpi3mr_ioc *mrioc,u16 handle);drivers/scsi/mpi3mr/mpi3mr_app.c +2
-2@@ -2920,7 +2920,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job) }/** -* mpi3mr_app_save_logdata - Save Log Data events +* mpi3mr_app_save_logdata_th - Save Log Data events * @mrioc: Adapter instance reference * @event_data: event data associated with log data event * @event_data_size: event data size to copy @@ -2932,7 +2932,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)* * Return:Nothing */ -void mpi3mr_app_save_logdata (struct mpi3mr_ioc *mrioc,char *event_data, +void mpi3mr_app_save_logdata_th (struct mpi3mr_ioc *mrioc,char *event_data,u16 event_data_size) {u32 index = mrioc->logdata_buf_idx, sz;drivers/scsi/mpi3mr/mpi3mr_os.c +1
-1@@ -1962,7 +1962,7 @@ static void mpi3mr_pcietopochg_evt_bh(struct mpi3mr_ioc *mrioc,static void mpi3mr_logdata_evt_bh (struct mpi3mr_ioc *mrioc,struct mpi3mr_fwevt *fwevt) { -mpi3mr_app_save_logdata (mrioc, fwevt->event_data, +mpi3mr_app_save_logdata_th (mrioc, fwevt->event_data, fwevt->event_data_size); }Quoted 7 lines
drivers/scsi/mpi3mr/mpi3mr_os.c void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, · line 3061
Quoted 5 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +1
-0@@ -3058,6 +3058,12 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, }case MPI3_EVENT_DEVICE_INFO_CHANGED :case MPI3_EVENT_LOG_DATA : + {The curly brackets are not necessary.
[Ranjan] : The extra braces around the
MPI3_EVENT_LOG_DATAcase are unnecessary.
I’ll remove them in the next revision.Quoted 5 lines
Quoted 4 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0+ sz = event_reply->event_data_length *4 ; +mpi3mr_app_save_logdata_th (mrioc, + (char *)event_reply->event_data, sz);
Quoted 7 lines
Quoted 1 line
Do you really need the cast here ?
[Ranjan]:
The cast to (char *) is not required sinceevent_reply->event_datais already compatible with the helper prototype.
I’ll drop the cast as well.
I’ll address these and resend in v2.
[Ranjan]: The cast is required here since event_data is __le32 * and the existing helper takes a byte buffer.
Removing it results in an incompatible pointer type build error. I’ll keep the cast and remove curly brackets and will resend v2.
Quoted 14 lines
Quoted 11 lines
drivers/scsi/mpi3mr/mpi3mr_os.c void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, · line 3069
Quoted 6 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-0+break ; + }case MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE :case MPI3_EVENT_ENCL_DEVICE_ADDED : {--
Damien Le Moal
Western Digital ResearchThanks,
Ranjan
PATCH 3/7 mpi3mr: Avoid redundant diag-fault resets
In reply to Ranjan KumarUpdate reset handling to invoke diag-save only for diag-fault resets. Skip issuing a diagnostic reset if the IOC is already in FAULT state, preventing repeated fault handling and improving reset stability.
--- drivers/scsi/mpi3mr/mpi3mr_fw.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +10 -3
@@ -1707,6 +1707,8 @@ static int mpi3mr_issue_reset(struct mpi3mr_ioc *mrioc, u16 reset_type, MPI3MR_RESET_REASON_OSTYPE_SHIFT) | (mrioc->facts.ioc_num << MPI3MR_RESET_REASON_IOCNUM_SHIFT) | reset_reason);writel (reset_reason, &mrioc->sysif_regs->scratchpad[0 ]); +if (reset_type ==MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT ) +mpi3mr_set_diagsave (mrioc);writel (host_diagnostic | reset_type, &mrioc->sysif_regs->host_diagnostic);switch (reset_type) {
@@ -5404,6 +5406,7 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc, {int retval =0 , i;unsigned long flags; +enum mpi3mr_iocstate ioc_state;u32 host_diagnostic, timeout =MPI3_SYSIF_DIAG_SAVE_TIMEOUT *10 ;union mpi3mr_trigger_data trigger_data;
@@ -5462,7 +5465,6 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc, mrioc->io_admin_reset_sync =1 ;if (snapdump) { -mpi3mr_set_diagsave (mrioc); retval =mpi3mr_issue_reset (mrioc,MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT , reset_reason);if (!retval) {
@@ -5564,8 +5566,13 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc,if (mrioc->pel_enabled)atomic64_inc (&event_counter); }else { -mpi3mr_issue_reset (mrioc, -MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT , reset_reason); +dprint_reset (mrioc, +"soft_reset_handler failed, marking controller as unrecoverable\n" ); + ioc_state =mpi3mr_get_iocstate (mrioc); + +if (ioc_state !=MRIOC_STATE_FAULT ) +mpi3mr_issue_reset (mrioc, +MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT , reset_reason); mrioc->device_refresh_on =0 ; mrioc->unrecoverable =1 ; mrioc->reset_in_progress =0 ;
Signature · 1 line
2.47.3
PATCH 4/7 mpi3mr: Use negotiated link rate from DevicePage0
In reply to Ranjan KumarFirmware populates the negotiated SAS link rate in DevicePage0 during device discovery. Update mpi3mr to cache this value while initializing the target device.
When available, the cached link rate is used instead of issuing additional SAS PHY or expander PHY page reads.
If the DevicePage0 value is missing or invalid, the driver falls back to the existing PHY-based mechanism.
--- drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 2 + drivers/scsi/mpi3mr/mpi3mr.h | 2 + drivers/scsi/mpi3mr/mpi3mr_os.c | 88 ++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_transport.c | 30 +++++---- 4 files changed, 110 insertions(+), 12 deletions(-)
drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +2 -0
@@ -2314,6 +2314,8 @@ struct mpi3_device0_sas_sata_format {u8 attached_phy_identifier;u8 max_port_connections;u8 zone_group; +u8 reserved10[3 ]; +u8 negotiated_link_rate; };#define MPI3_DEVICE0_SASSATA_FLAGS_WRITE_SAME_UNMAP_NCQ (0x0400)
drivers/scsi/mpi3mr/mpi3mr.h +2 -0
@@ -643,6 +643,7 @@ struct mpi3mr_enclosure_node {* @dev_info: Device information bits * @phy_id: Phy identifier provided in device page 0 * @attached_phy_id: Attached phy identifier provided in device page 0 +* @negotiated_link_rate: Negotiated link rate from device page 0 * @sas_transport_attached: Is this device exposed to transport * @pend_sas_rphy_add: Flag to check device is in process of add * @hba_port: HBA port entry
@@ -654,6 +655,7 @@ struct tgt_dev_sas_sata {u16 dev_info;u8 phy_id;u8 attached_phy_id; +u8 negotiated_link_rate;u8 sas_transport_attached;u8 pend_sas_rphy_add;struct mpi3mr_hba_port *hba_port;
drivers/scsi/mpi3mr/mpi3mr_os.c +88 -0
106 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_transport.c +18 -12
@@ -2284,11 +2284,11 @@ void mpi3mr_expander_remove(struct mpi3mr_ioc *mrioc, u64 sas_address,* @mrioc: Adapter instance reference * @tgtdev: Target device * -* This function identifies whether the target device is -* attached directly or through expander and issues sas phy -* page0 or expander phy page1 and gets the link rate, if there -* is any failure in reading the pages then this returns link -* rate of 1.5. +* This function first tries to use the link rate from DevicePage0 +* (populated by firmware during device discovery). If the cached +* value is not available or invalid, it falls back to reading from +* sas phy page0 or expander phy page1. +* * * Return: logical link rate. */
@@ -2301,6 +2301,14 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc,u32 phynum_handle;u16 ioc_status; +/* First, try to use link rate from DevicePage0 (populated by firmware) */ +if (tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate >= +MPI3_SAS_NEG_LINK_RATE_1_5 ) { + link_rate = tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate; + goto out; + } + +/* Fallback to reading from phy pages if DevicePage0 value not available */ phy_number = tgtdev->dev_spec.sas_sata_inf.phy_id;if (!(tgtdev->devpg0_flag &MPI3_DEVICE0_FLAGS_ATT_METHOD_DIR_ATTACHED )) { phynum_handle = ((phy_number<<MPI3_SAS_EXPAND_PGAD_PHYNUM_SHIFT)
@@ -2318,9 +2326,7 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc, __FILE__, __LINE__, __func__); goto out; } - link_rate = (expander_pg1.negotiated_link_rate & -MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> -MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ; + link_rate = expander_pg1.negotiated_link_rate; goto out; } if (mpi3mr_cfg_get_sas_phy_pg0(mrioc, &ioc_status, &phy_pg0,
@@ -2335,11 +2341,11 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc, __FILE__, __LINE__, __func__); goto out; } - link_rate = (phy_pg0.negotiated_link_rate & -MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> -MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ; + link_rate = phy_pg0.negotiated_link_rate; + out: -return link_rate; +return ((link_rate &MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> +MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ); }/**
Signature · 1 line
2.47.3
Re: [PATCH v1 4/7] mpi3mr: Use negotiated link rate from DevicePage0
Quoted 61 lines · Ranjan Kumar
Firmware populates the negotiated SAS link rate in DevicePage0 during device discovery. Update mpi3mr to cache this value while initializing the target device.
When available, the cached link rate is used instead of issuing additional SAS PHY or expander PHY page reads.
If the DevicePage0 value is missing or invalid, the driver falls back to the existing PHY-based mechanism.Signed-off-by Ranjan Kumar <[email protected]>--- drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 2 + drivers/scsi/mpi3mr/mpi3mr.h | 2 + drivers/scsi/mpi3mr/mpi3mr_os.c | 88 ++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_transport.c | 30 +++++---- 4 files changed, 110 insertions(+), 12 deletions(-)drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +2
-0@@ -2314,6 +2314,8 @@ struct mpi3_device0_sas_sata_format {u8 attached_phy_identifier;u8 max_port_connections;u8 zone_group; +u8 reserved10[3 ]; +u8 negotiated_link_rate; };#define MPI3_DEVICE0_SASSATA_FLAGS_WRITE_SAME_UNMAP_NCQ (0x0400)drivers/scsi/mpi3mr/mpi3mr.h +2
-0@@ -643,6 +643,7 @@ struct mpi3mr_enclosure_node {* @dev_info: Device information bits * @phy_id: Phy identifier provided in device page 0 * @attached_phy_id: Attached phy identifier provided in device page 0 +* @negotiated_link_rate: Negotiated link rate from device page 0 * @sas_transport_attached: Is this device exposed to transport * @pend_sas_rphy_add: Flag to check device is in process of add * @hba_port: HBA port entry @@ -654,6 +655,7 @@ struct tgt_dev_sas_sata {u16 dev_info;u8 phy_id;u8 attached_phy_id; +u8 negotiated_link_rate;u8 sas_transport_attached;u8 pend_sas_rphy_add;struct mpi3mr_hba_port *hba_port;drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0@@ -1138,6 +1138,90 @@ static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) } } +/** +* mpi3mr_debug_dump_devpg0 - Dump device page0 +* @mrioc: Adapter instance reference
drivers/scsi/mpi3mr/mpi3mr_os.c static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) · line 1153
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +10
-0+* @dev_pg0: Device page 0. +* +* Prints pertinent details of the device page 0. +* +* Return: Nothing. +*/ +static void +mpi3mr_debug_dump_devpg0 (struct mpi3mr_ioc *mrioc,struct mpi3_device_page0 *dev_pg0) +{ +
No need for this blank line.
drivers/scsi/mpi3mr/mpi3mr_os.c static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) · line 1156
Quoted 3 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0+if (!(mrioc->logging_level & + (MPI3_DEBUG_EVENT |MPI3_DEBUG_EVENT_WORK_TASK ))) +return ;
Please move this test in the caller so that we can avoid a function call for nothing if debug is not enabled.
Quoted 8 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +8
-0+ +ioc_info (mrioc, +"device_pg0: handle(0x%04x), perst_id(%d), wwid(0x%016llx), encl_handle(0x%04x), slot(%d)\n" , +le16_to_cpu (dev_pg0->dev_handle), +le16_to_cpu (dev_pg0->persistent_id), +le64_to_cpu (dev_pg0->wwid),le16_to_cpu (dev_pg0->enclosure_handle), +le16_to_cpu (dev_pg0->slot)); + ioc_info(mrioc, "device_pg0: access_status(0x%02x), flags(0x%04x), device_form(0x%02x), queue_depth(%d)\n",
drivers/scsi/mpi3mr/mpi3mr_os.c static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) · line 1174
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +10
-0+ dev_pg0->access_status,le16_to_cpu (dev_pg0->flags), + dev_pg0->device_form, le16_to_cpu(dev_pg0->queue_depth)); +ioc_info (mrioc,"device_pg0: parent_handle(0x%04x), iounit_port(%d)\n" , +le16_to_cpu (dev_pg0->parent_dev_handle), dev_pg0->io_unit_port); + +switch (dev_pg0->device_form) { +case MPI3_DEVICE_DEVFORM_SAS_SATA : + { +struct mpi3_device0_sas_sata_format *sasinf = + &dev_pg0->device_specific.sas_sata_format;
Please add a blank line after declarations. Same comment applies to other cases below.
Quoted 134 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +54
-0+ioc_info (mrioc, +"device_pg0: sas_sata: sas_address(0x%016llx),flags(0x%04x),\n" +"device_info(0x%04x), phy_num(%d), attached_phy_id(%d),negotiated_link_rate(0x%02x)\n" , +le64_to_cpu (sasinf->sas_address), +le16_to_cpu (sasinf->flags), +le16_to_cpu (sasinf->device_info), sasinf->phy_num, + sasinf->attached_phy_identifier, sasinf->negotiated_link_rate); +break ; + } +case MPI3_DEVICE_DEVFORM_PCIE : + { +struct mpi3_device0_pcie_format *pcieinf = + &dev_pg0->device_specific.pcie_format; +ioc_info (mrioc, +"device_pg0: pcie: port_num(%d), device_info(0x%04x), mdts(%d), page_sz(0x%02x)\n" , + pcieinf->port_num,le16_to_cpu (pcieinf->device_info), +le32_to_cpu (pcieinf->maximum_data_transfer_size), + pcieinf->page_size); +ioc_info (mrioc, +"device_pg0: pcie: abort_timeout(%d), reset_timeout(%d) capabilities (0x%08x)\n" , + pcieinf->nvme_abort_to, pcieinf->controller_reset_to, +le32_to_cpu (pcieinf->capabilities)); +break ; + } +case MPI3_DEVICE_DEVFORM_VD : + { +struct mpi3_device0_vd_format *vdinf = + &dev_pg0->device_specific.vd_format; + +ioc_info (mrioc, +"device_pg0: vd: state(0x%02x), raid_level(%d), flags(0x%04x),\n" +"device_info(0x%04x) abort_timeout(%d), reset_timeout(%d)\n" , + vdinf->vd_state, vdinf->raid_level, +le16_to_cpu (vdinf->flags), +le16_to_cpu (vdinf->device_info), + vdinf->vd_abort_to, vdinf->vd_reset_to); +ioc_info (mrioc, +"device_pg0: vd: tg_id(%d), high(%dMiB), low(%dMiB), qd_reduction_factor(%d)\n" , + vdinf->io_throttle_group, +le16_to_cpu (vdinf->io_throttle_group_high), +le16_to_cpu (vdinf->io_throttle_group_low), + ((le16_to_cpu (vdinf->flags) & +MPI3_DEVICE0_VD_FLAGS_IO_THROTTLE_GROUP_QD_MASK ) >>12 )); + + } +default : +break ; + } +} +/** * mpi3mr_update_tgtdev - DevStatusChange evt bottomhalf * @mrioc: Adapter instance reference @@ -1159,6 +1243,8 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc,struct mpi3mr_enclosure_node *enclosure_dev =NULL ;u8 prot_mask =0 ; +mpi3mr_debug_dump_devpg0 (mrioc, dev_pg0); + tgtdev->perst_id =le16_to_cpu (dev_pg0->persistent_id); tgtdev->dev_handle =le16_to_cpu (dev_pg0->dev_handle); tgtdev->dev_type = dev_pg0->device_form;@@ -1237,6 +1323,8 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, tgtdev->dev_spec.sas_sata_inf.phy_id = sasinf->phy_num; tgtdev->dev_spec.sas_sata_inf.attached_phy_id = sasinf->attached_phy_identifier; + tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate = + sasinf->negotiated_link_rate;if ((dev_info &MPI3_SAS_DEVICE_INFO_DEVICE_TYPE_MASK ) !=MPI3_SAS_DEVICE_INFO_DEVICE_TYPE_END_DEVICE ) tgtdev->is_hidden =1 ;drivers/scsi/mpi3mr/mpi3mr_transport.c +18
-12@@ -2284,11 +2284,11 @@ void mpi3mr_expander_remove(struct mpi3mr_ioc *mrioc, u64 sas_address,* @mrioc: Adapter instance reference * @tgtdev: Target device * -* This function identifies whether the target device is -* attached directly or through expander and issues sas phy -* page0 or expander phy page1 and gets the link rate, if there -* is any failure in reading the pages then this returns link -* rate of 1.5. +* This function first tries to use the link rate from DevicePage0 +* (populated by firmware during device discovery). If the cached +* value is not available or invalid, it falls back to reading from +* sas phy page0 or expander phy page1. +* * * Return: logical link rate. */ @@ -2301,6 +2301,14 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc,u32 phynum_handle;u16 ioc_status; +/* First, try to use link rate from DevicePage0 (populated by firmware) */ +if (tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate >= +MPI3_SAS_NEG_LINK_RATE_1_5 ) { + link_rate = tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate; + goto out; + } + +/* Fallback to reading from phy pages if DevicePage0 value not available */ phy_number = tgtdev->dev_spec.sas_sata_inf.phy_id;if (!(tgtdev->devpg0_flag &MPI3_DEVICE0_FLAGS_ATT_METHOD_DIR_ATTACHED )) { phynum_handle = ((phy_number<<MPI3_SAS_EXPAND_PGAD_PHYNUM_SHIFT)@@ -2318,9 +2326,7 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc, __FILE__, __LINE__, __func__); goto out; } - link_rate = (expander_pg1.negotiated_link_rate & -MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> -MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ; + link_rate = expander_pg1.negotiated_link_rate; goto out; } if (mpi3mr_cfg_get_sas_phy_pg0(mrioc, &ioc_status, &phy_pg0,@@ -2335,11 +2341,11 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc, __FILE__, __LINE__, __func__); goto out; } - link_rate = (phy_pg0.negotiated_link_rate & -MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> -MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ; + link_rate = phy_pg0.negotiated_link_rate; + out: -return link_rate; +return ((link_rate &MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> +MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ); }/**
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH v1 4/7] mpi3mr: Use negotiated link rate from DevicePage0
Hi Damien,
Quoted 238 lines · Damien Le Moal
Quoted 61 lines · Ranjan Kumar
Firmware populates the negotiated SAS link rate in DevicePage0 during device discovery. Update mpi3mr to cache this value while initializing the target device.
When available, the cached link rate is used instead of issuing additional SAS PHY or expander PHY page reads.
If the DevicePage0 value is missing or invalid, the driver falls back to the existing PHY-based mechanism.Signed-off-by Ranjan Kumar <[email protected]>--- drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 2 + drivers/scsi/mpi3mr/mpi3mr.h | 2 + drivers/scsi/mpi3mr/mpi3mr_os.c | 88 ++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_transport.c | 30 +++++---- 4 files changed, 110 insertions(+), 12 deletions(-)drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +2
-0@@ -2314,6 +2314,8 @@ struct mpi3_device0_sas_sata_format {u8 attached_phy_identifier;u8 max_port_connections;u8 zone_group; +u8 reserved10[3 ]; +u8 negotiated_link_rate; };#define MPI3_DEVICE0_SASSATA_FLAGS_WRITE_SAME_UNMAP_NCQ (0x0400)drivers/scsi/mpi3mr/mpi3mr.h +2
-0@@ -643,6 +643,7 @@ struct mpi3mr_enclosure_node {* @dev_info: Device information bits * @phy_id: Phy identifier provided in device page 0 * @attached_phy_id: Attached phy identifier provided in device page 0 +* @negotiated_link_rate: Negotiated link rate from device page 0 * @sas_transport_attached: Is this device exposed to transport * @pend_sas_rphy_add: Flag to check device is in process of add * @hba_port: HBA port entry @@ -654,6 +655,7 @@ struct tgt_dev_sas_sata {u16 dev_info;u8 phy_id;u8 attached_phy_id; +u8 negotiated_link_rate;u8 sas_transport_attached;u8 pend_sas_rphy_add;struct mpi3mr_hba_port *hba_port;drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0@@ -1138,6 +1138,90 @@ static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) } } +/** +* mpi3mr_debug_dump_devpg0 - Dump device page0 +* @mrioc: Adapter instance reference drivers/scsi/mpi3mr/mpi3mr_os.c static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) · line 1153
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +10
-0+* @dev_pg0: Device page 0. +* +* Prints pertinent details of the device page 0. +* +* Return: Nothing. +*/ +static void +mpi3mr_debug_dump_devpg0 (struct mpi3mr_ioc *mrioc,struct mpi3_device_page0 *dev_pg0) +{ +No need for this blank line.
drivers/scsi/mpi3mr/mpi3mr_os.c static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) · line 1156
Quoted 3 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0+if (!(mrioc->logging_level & + (MPI3_DEBUG_EVENT |MPI3_DEBUG_EVENT_WORK_TASK ))) +return ;Please move this test in the caller so that we can avoid a function call for nothing if debug is not enabled.
Quoted 8 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +8
-0+ +ioc_info (mrioc, +"device_pg0: handle(0x%04x), perst_id(%d), wwid(0x%016llx), encl_handle(0x%04x), slot(%d)\n" , +le16_to_cpu (dev_pg0->dev_handle), +le16_to_cpu (dev_pg0->persistent_id), +le64_to_cpu (dev_pg0->wwid),le16_to_cpu (dev_pg0->enclosure_handle), +le16_to_cpu (dev_pg0->slot)); + ioc_info(mrioc, "device_pg0: access_status(0x%02x), flags(0x%04x), device_form(0x%02x), queue_depth(%d)\n",drivers/scsi/mpi3mr/mpi3mr_os.c static void mpi3mr_refresh_tgtdevs(struct mpi3mr_ioc *mrioc) · line 1174
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +10
-0+ dev_pg0->access_status,le16_to_cpu (dev_pg0->flags), + dev_pg0->device_form, le16_to_cpu(dev_pg0->queue_depth)); +ioc_info (mrioc,"device_pg0: parent_handle(0x%04x), iounit_port(%d)\n" , +le16_to_cpu (dev_pg0->parent_dev_handle), dev_pg0->io_unit_port); + +switch (dev_pg0->device_form) { +case MPI3_DEVICE_DEVFORM_SAS_SATA : + { +struct mpi3_device0_sas_sata_format *sasinf = + &dev_pg0->device_specific.sas_sata_format;Please add a blank line after declarations. Same comment applies to other cases below.
Quoted 133 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +54
-0+ioc_info (mrioc, +"device_pg0: sas_sata: sas_address(0x%016llx),flags(0x%04x),\n" +"device_info(0x%04x), phy_num(%d), attached_phy_id(%d),negotiated_link_rate(0x%02x)\n" , +le64_to_cpu (sasinf->sas_address), +le16_to_cpu (sasinf->flags), +le16_to_cpu (sasinf->device_info), sasinf->phy_num, + sasinf->attached_phy_identifier, sasinf->negotiated_link_rate); +break ; + } +case MPI3_DEVICE_DEVFORM_PCIE : + { +struct mpi3_device0_pcie_format *pcieinf = + &dev_pg0->device_specific.pcie_format; +ioc_info (mrioc, +"device_pg0: pcie: port_num(%d), device_info(0x%04x), mdts(%d), page_sz(0x%02x)\n" , + pcieinf->port_num,le16_to_cpu (pcieinf->device_info), +le32_to_cpu (pcieinf->maximum_data_transfer_size), + pcieinf->page_size); +ioc_info (mrioc, +"device_pg0: pcie: abort_timeout(%d), reset_timeout(%d) capabilities (0x%08x)\n" , + pcieinf->nvme_abort_to, pcieinf->controller_reset_to, +le32_to_cpu (pcieinf->capabilities)); +break ; + } +case MPI3_DEVICE_DEVFORM_VD : + { +struct mpi3_device0_vd_format *vdinf = + &dev_pg0->device_specific.vd_format; + +ioc_info (mrioc, +"device_pg0: vd: state(0x%02x), raid_level(%d), flags(0x%04x),\n" +"device_info(0x%04x) abort_timeout(%d), reset_timeout(%d)\n" , + vdinf->vd_state, vdinf->raid_level, +le16_to_cpu (vdinf->flags), +le16_to_cpu (vdinf->device_info), + vdinf->vd_abort_to, vdinf->vd_reset_to); +ioc_info (mrioc, +"device_pg0: vd: tg_id(%d), high(%dMiB), low(%dMiB), qd_reduction_factor(%d)\n" , + vdinf->io_throttle_group, +le16_to_cpu (vdinf->io_throttle_group_high), +le16_to_cpu (vdinf->io_throttle_group_low), + ((le16_to_cpu (vdinf->flags) & +MPI3_DEVICE0_VD_FLAGS_IO_THROTTLE_GROUP_QD_MASK ) >>12 )); + + } +default : +break ; + } +} +/** * mpi3mr_update_tgtdev - DevStatusChange evt bottomhalf * @mrioc: Adapter instance reference @@ -1159,6 +1243,8 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc,struct mpi3mr_enclosure_node *enclosure_dev =NULL ;u8 prot_mask =0 ; +mpi3mr_debug_dump_devpg0 (mrioc, dev_pg0); + tgtdev->perst_id =le16_to_cpu (dev_pg0->persistent_id); tgtdev->dev_handle =le16_to_cpu (dev_pg0->dev_handle); tgtdev->dev_type = dev_pg0->device_form;@@ -1237,6 +1323,8 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, tgtdev->dev_spec.sas_sata_inf.phy_id = sasinf->phy_num; tgtdev->dev_spec.sas_sata_inf.attached_phy_id = sasinf->attached_phy_identifier; + tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate = + sasinf->negotiated_link_rate;if ((dev_info &MPI3_SAS_DEVICE_INFO_DEVICE_TYPE_MASK ) !=MPI3_SAS_DEVICE_INFO_DEVICE_TYPE_END_DEVICE ) tgtdev->is_hidden =1 ;drivers/scsi/mpi3mr/mpi3mr_transport.c +18
-12@@ -2284,11 +2284,11 @@ void mpi3mr_expander_remove(struct mpi3mr_ioc *mrioc, u64 sas_address,* @mrioc: Adapter instance reference * @tgtdev: Target device * -* This function identifies whether the target device is -* attached directly or through expander and issues sas phy -* page0 or expander phy page1 and gets the link rate, if there -* is any failure in reading the pages then this returns link -* rate of 1.5. +* This function first tries to use the link rate from DevicePage0 +* (populated by firmware during device discovery). If the cached +* value is not available or invalid, it falls back to reading from +* sas phy page0 or expander phy page1. +* * * Return: logical link rate. */ @@ -2301,6 +2301,14 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc,u32 phynum_handle;u16 ioc_status; +/* First, try to use link rate from DevicePage0 (populated by firmware) */ +if (tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate >= +MPI3_SAS_NEG_LINK_RATE_1_5 ) { + link_rate = tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate; + goto out; + } + +/* Fallback to reading from phy pages if DevicePage0 value not available */ phy_number = tgtdev->dev_spec.sas_sata_inf.phy_id;if (!(tgtdev->devpg0_flag &MPI3_DEVICE0_FLAGS_ATT_METHOD_DIR_ATTACHED )) { phynum_handle = ((phy_number<<MPI3_SAS_EXPAND_PGAD_PHYNUM_SHIFT)@@ -2318,9 +2326,7 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc, __FILE__, __LINE__, __func__); goto out; } - link_rate = (expander_pg1.negotiated_link_rate & -MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> -MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ; + link_rate = expander_pg1.negotiated_link_rate; goto out; } if (mpi3mr_cfg_get_sas_phy_pg0(mrioc, &ioc_status, &phy_pg0,@@ -2335,11 +2341,11 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc, __FILE__, __LINE__, __func__); goto out; } - link_rate = (phy_pg0.negotiated_link_rate & -MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> -MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ; + link_rate = phy_pg0.negotiated_link_rate; + out: -return link_rate; +return ((link_rate &MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK ) >> +MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT ); }
Quoted 2 lines
drivers/scsi/mpi3mr/mpi3mr_transport.c static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc, · line 2351
Quoted 1 line
drivers/scsi/mpi3mr/mpi3mr_transport.c +0
-0/**
[Ranja]: Thanks for the review. I will do the changes and will resend v2.
Quoted 4 lines
--
Damien Le Moal
Western Digital Research
kernel test robot
build botRe: [PATCH v1 4/7] mpi3mr: Use negotiated link rate from DevicePage0
In reply to Ranjan Kumarkernel test robot noticed the following build warnings:
Hi Ranjan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next linus/master v6.19-rc5 next-20260109] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpi3mr-Add-module-parameter-to-control-threaded-IRQ-polling/20260112-162241 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next patch link: https://lore.kernel.org/r/20260112081037.74376-5-ranjan.kumar%40broadcom.com patch subject: [PATCH v1 4/7] mpi3mr: Use negotiated link rate from DevicePage0 config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260113/[email protected]/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) rustc: rustc 1.88.0 (6b00bc388 2025-06-23) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260113/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/scsi/mpi3mr/mpi3mr_os.c:1220:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
1220 | default:
| ^
drivers/scsi/mpi3mr/mpi3mr_os.c:1220:2: note: insert 'break;' to avoid fall-through
1220 | default:
| ^
| break; 1 warning generated.
vim +1220 drivers/scsi/mpi3mr/mpi3mr_os.c
1153
1154 if (!(mrioc->logging_level &
1155 (MPI3_DEBUG_EVENT | MPI3_DEBUG_EVENT_WORK_TASK)))
1156 return;
1157
1158 ioc_info(mrioc,
1159 "device_pg0: handle(0x%04x), perst_id(%d), wwid(0x%016llx), encl_handle(0x%04x), slot(%d)\n",
1160 le16_to_cpu(dev_pg0->dev_handle),
1161 le16_to_cpu(dev_pg0->persistent_id),
1162 le64_to_cpu(dev_pg0->wwid), le16_to_cpu(dev_pg0->enclosure_handle),
1163 le16_to_cpu(dev_pg0->slot));
1164 ioc_info(mrioc, "device_pg0: access_status(0x%02x), flags(0x%04x), device_form(0x%02x), queue_depth(%d)\n",
1165 dev_pg0->access_status, le16_to_cpu(dev_pg0->flags),
1166 dev_pg0->device_form, le16_to_cpu(dev_pg0->queue_depth));
1167 ioc_info(mrioc, "device_pg0: parent_handle(0x%04x), iounit_port(%d)\n",
1168 le16_to_cpu(dev_pg0->parent_dev_handle), dev_pg0->io_unit_port);
1169
1170 switch (dev_pg0->device_form) {
1171 case MPI3_DEVICE_DEVFORM_SAS_SATA:
1172 {
1173 struct mpi3_device0_sas_sata_format *sasinf =
1174 &dev_pg0->device_specific.sas_sata_format;
1175 ioc_info(mrioc,
1176 "device_pg0: sas_sata: sas_address(0x%016llx),flags(0x%04x),\n"
1177 "device_info(0x%04x), phy_num(%d), attached_phy_id(%d),negotiated_link_rate(0x%02x)\n",
1178 le64_to_cpu(sasinf->sas_address),
1179 le16_to_cpu(sasinf->flags),
1180 le16_to_cpu(sasinf->device_info), sasinf->phy_num,
1181 sasinf->attached_phy_identifier, sasinf->negotiated_link_rate);
1182 break;
1183 }
1184 case MPI3_DEVICE_DEVFORM_PCIE:
1185 {
1186 struct mpi3_device0_pcie_format *pcieinf =
1187 &dev_pg0->device_specific.pcie_format;
1188 ioc_info(mrioc,
1189 "device_pg0: pcie: port_num(%d), device_info(0x%04x), mdts(%d), page_sz(0x%02x)\n",
1190 pcieinf->port_num, le16_to_cpu(pcieinf->device_info),
1191 le32_to_cpu(pcieinf->maximum_data_transfer_size),
1192 pcieinf->page_size);
1193 ioc_info(mrioc,
1194 "device_pg0: pcie: abort_timeout(%d), reset_timeout(%d) capabilities (0x%08x)\n",
1195 pcieinf->nvme_abort_to, pcieinf->controller_reset_to,
1196 le32_to_cpu(pcieinf->capabilities));
1197 break;
1198 }
1199 case MPI3_DEVICE_DEVFORM_VD:
1200 {
1201 struct mpi3_device0_vd_format *vdinf =
1202 &dev_pg0->device_specific.vd_format;
1203
1204 ioc_info(mrioc,
1205 "device_pg0: vd: state(0x%02x), raid_level(%d), flags(0x%04x),\n"
1206 "device_info(0x%04x) abort_timeout(%d), reset_timeout(%d)\n",
1207 vdinf->vd_state, vdinf->raid_level,
1208 le16_to_cpu(vdinf->flags),
1209 le16_to_cpu(vdinf->device_info),
1210 vdinf->vd_abort_to, vdinf->vd_reset_to);
1211 ioc_info(mrioc,
1212 "device_pg0: vd: tg_id(%d), high(%dMiB), low(%dMiB), qd_reduction_factor(%d)\n",
1213 vdinf->io_throttle_group,
1214 le16_to_cpu(vdinf->io_throttle_group_high),
1215 le16_to_cpu(vdinf->io_throttle_group_low),
1216 ((le16_to_cpu(vdinf->flags) &
1217 MPI3_DEVICE0_VD_FLAGS_IO_THROTTLE_GROUP_QD_MASK) >> 12));
1218
1219 }
> 1220 default: 1221 break;
1222 }
1223 }
1224
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 5/7 mpi3mr: Update MPI Headers to revision 39
In reply to Ranjan KumarUpdate MPI Headers to revision 39
--- drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 90 ++++++++++++++++++- drivers/scsi/mpi3mr/mpi/mpi30_image.h | 102 +++++++++++++++++++++- drivers/scsi/mpi3mr/mpi/mpi30_init.h | 2 +- drivers/scsi/mpi3mr/mpi/mpi30_ioc.h | 9 +- drivers/scsi/mpi3mr/mpi/mpi30_pci.h | 2 +- drivers/scsi/mpi3mr/mpi/mpi30_sas.h | 2 +- drivers/scsi/mpi3mr/mpi/mpi30_tool.h | 6 +- drivers/scsi/mpi3mr/mpi/mpi30_transport.h | 4 +- 8 files changed, 201 insertions(+), 16 deletions(-)
drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +87 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Copyright 2017-2023 Broadcom Inc. All rights reserved. +* Copyright 2017-2026 Broadcom Inc. All rights reserved. */ #ifndef MPI30_CNFG_H #define MPI30_CNFG_H 1
@@ -1037,6 +1037,7 @@ struct mpi3_io_unit_page5 {#define MPI3_IOUNIT5_DEVICE_SHUTDOWN_SATA_SSD_SHIFT (2)#define MPI3_IOUNIT5_DEVICE_SHUTDOWN_SAS_SSD_MASK (0x0003)#define MPI3_IOUNIT5_DEVICE_SHUTDOWN_SAS_SSD_SHIFT (0) +#define MPI3_IOUNIT5_DEVICE_SHUTDOWN_HDD_SPINDOWN_ENABLE (0x8000)#define MPI3_IOUNIT5_FLAGS_SATAPUIS_MASK (0x0c)#define MPI3_IOUNIT5_FLAGS_SATAPUIS_NOT_SUPPORTED (0x00)#define MPI3_IOUNIT5_FLAGS_SATAPUIS_OS_CONTROLLED (0x04)
@@ -1074,7 +1075,8 @@ struct mpi3_io_unit_page8 {u8 current_key_encryption_algo;u8 key_digest_hash_algo;union mpi3_version_union current_svn; -__le32 reserved14; +__le16 pending_svn_time; +__le16 reserved16;__le32 current_key[128 ];union mpi3_iounit8_digest digest[MPI3_IOUNIT8_DIGEST_MAX ]; };
@@ -1406,6 +1408,7 @@ struct mpi3_driver_page1 { };#define MPI3_DRIVER1_PAGEVERSION (0x00) +#define MPI3_DRIVER1_FLAGS_DEVICE_SHUTDOWN_ON_UNLOAD_DISABLE (0x0001)#ifndef MPI3_DRIVER2_TRIGGER_MAX #define MPI3_DRIVER2_TRIGGER_MAX (1)#endif
@@ -1561,7 +1564,9 @@ struct mpi3_security1_key_record {u8 consumer;__le16 key_data_size;__le32 additional_key_data; -__le32 reserved08[2 ]; +u8 library_version; +u8 reserved09[3 ]; +__le32 reserved0c;union mpi3_security1_key_data key_data; };
@@ -1614,6 +1619,85 @@ struct mpi3_security_page2 {u8 reserved9d[3 ];struct mpi3_security2_trusted_root trusted_root[MPI3_SECURITY2_TRUSTED_ROOT_MAX ]; }; + +struct mpi3_security_page3 { +struct mpi3_config_page_header header; +__le16 key_data_length; +__le16 reserved0a; +u8 key_number; +u8 reserved0d[3 ]; +union mpi3_security_mac mac; +union mpi3_security_nonce nonce; +__le32 reserved90[12 ]; +u8 flags; +u8 consumer; +__le16 key_data_size; +__le32 additional_key_data; +u8 library_version; +u8 reserved_c9[3 ]; +__le32 reserved_cc; +u8 key_data[]; +}; + +#define MPI3_SECURITY3_PAGEVERSION (0x00) +#define MPI3_SECURITY3_FLAGS_TYPE_MASK (0x0f) +#define MPI3_SECURITY3_FLAGS_TYPE_SHIFT (0) +#define MPI3_SECURITY3_FLAGS_TYPE_NOT_VALID (0) +#define MPI3_SECURITY3_FLAGS_TYPE_MLDSA_PRIVATE (1) +#define MPI3_SECURITY3_FLAGS_TYPE_MLDSA_PUBLIC (2) +struct mpi3_security_page10 { +struct mpi3_config_page_header header; +__le32 reserved08[2 ]; +union mpi3_security_mac mac; +union mpi3_security_nonce nonce; +__le64 current_token_nonce; +__le64 previous_token_nonce; +__le32 reserved_a0[8 ]; +u8 diagnostic_auth_id[64 ]; +}; +#define MPI3_SECURITY10_PAGEVERSION (0x00) + +struct mpi3_security_page11 { +struct mpi3_config_page_header header; +u8 flags; +u8 reserved09[3 ]; +__le32 reserved0c; +__le32 diagnostic_token_length; +__le32 reserved14[3 ]; +u8 diagnostic_token[]; +}; +#define MPI3_SECURITY11_PAGEVERSION (0x00) +#define MPI3_SECURITY11_FLAGS_TOKEN_ENABLED (0x01) + +struct mpi3_security12_diag_feature { +__le32 feature_identifier; +u8 feature_size; +u8 feature_type; +__le16 reserved06; +u8 status; +u8 section; +__le16 reserved0a; +__le32 reserved0c; +u8 feature_data[64 ]; +}; +#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_MASK (0x03) +#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_SHIFT (0) +#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_UNKNOWN (0x00) +#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_DISABLED (0x01) +#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_ENABLED (0x02) +#define MPI3_SECURITY12_DIAG_FEATURE_SECTION_PROTECTED (0x00) +#define MPI3_SECURITY12_DIAG_FEATURE_SECTION_UNPROTECTED (0x01) +#define MPI3_SECURITY12_DIAG_FEATURE_SECTION_PAYLOAD (0x02) +#define MPI3_SECURITY12_DIAG_FEATURE_SECTION_SIGNATURE (0x03) +struct mpi3_security_page12 { +struct mpi3_config_page_header header; +__le32 reserved08[2 ]; +u8 num_diag_features; +u8 reserved11[3 ]; +__le32 reserved14[3 ]; +struct mpi3_security12_diag_feature diag_feature[]; +}; +#define MPI3_SECURITY2_PAGEVERSION (0x00)struct mpi3_sas_io_unit0_phy_data {u8 io_unit_port;
drivers/scsi/mpi3mr/mpi/mpi30_image.h +99 -3
128 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi/mpi30_init.h +1 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Copyright 2016-2023 Broadcom Inc. All rights reserved. +* Copyright 2016-2026 Broadcom Inc. All rights reserved. */ #ifndef MPI30_INIT_H #define MPI30_INIT_H 1
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +5 -4
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Copyright 2016-2023 Broadcom Inc. All rights reserved. +* Copyright 2016-2026 Broadcom Inc. All rights reserved. */ #ifndef MPI30_IOC_H #define MPI30_IOC_H 1
@@ -658,9 +658,10 @@ struct mpi3_event_data_diag_buffer_status_change {__le32 reserved04; }; -#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RELEASED (0x01) -#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_PAUSED (0x02) -#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RESUMED (0x03) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RELEASED (0x01) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_PAUSED (0x02) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RESUMED (0x03) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_CLEARED (0x04)#define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT (0x0200)#define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT (0x0100)#define MPI3_PEL_LOCALE_FLAGS_PCIE (0x0080)
drivers/scsi/mpi3mr/mpi/mpi30_pci.h +1 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Copyright 2016-2023 Broadcom Inc. All rights reserved. +* Copyright 2016-2026 Broadcom Inc. All rights reserved. * */ #ifndef MPI30_PCI_H
drivers/scsi/mpi3mr/mpi/mpi30_sas.h +1 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Copyright 2016-2023 Broadcom Inc. All rights reserved. +* Copyright 2016-2026 Broadcom Inc. All rights reserved. */ #ifndef MPI30_SAS_H #define MPI30_SAS_H 1
drivers/scsi/mpi3mr/mpi/mpi30_tool.h +5 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Copyright 2016-2024 Broadcom Inc. All rights reserved. +* Copyright 2016-2026 Broadcom Inc. All rights reserved. */ #ifndef MPI30_TOOL_H #define MPI30_TOOL_H 1
@@ -8,6 +8,10 @@#define MPI3_DIAG_BUFFER_TYPE_TRACE (0x01)#define MPI3_DIAG_BUFFER_TYPE_FW (0x02)#define MPI3_DIAG_BUFFER_ACTION_RELEASE (0x01) +#define MPI3_DIAG_BUFFER_ACTION_PAUSE (0x02) +#define MPI3_DIAG_BUFFER_ACTION_RESUME (0x03) +#define MPI3_DIAG_BUFFER_ACTION_CLEAR (0x04) +#define MPI3_DIAG_BUFFER_POST_MSGFLAGS_SEGMENTED (0x01)struct mpi3_diag_buffer_post_request {
drivers/scsi/mpi3mr/mpi/mpi30_transport.h +2 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Copyright 2016-2023 Broadcom Inc. All rights reserved. +* Copyright 2016-2026 Broadcom Inc. All rights reserved. */ #ifndef MPI30_TRANSPORT_H #define MPI30_TRANSPORT_H 1
@@ -18,7 +18,7 @@ union mpi3_version_union {#define MPI3_VERSION_MAJOR (3)#define MPI3_VERSION_MINOR (0) -#define MPI3_VERSION_UNIT (37) +#define MPI3_VERSION_UNIT (39)#define MPI3_VERSION_DEV (0)#define MPI3_DEVHANDLE_INVALID (0xffff)struct mpi3_sysif_oper_queue_indexes {
Signature · 1 line
2.47.3
Re: [PATCH v1 5/7] mpi3mr: Update MPI Headers to revision 39
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h struct mpi3_event_data_diag_buffer_status_change { · line 661
Quoted 4 lines · Ranjan Kumar
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +1
-3-#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RELEASED (0x01) -#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_PAUSED (0x02) -#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RESUMED (0x03) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RELEASED (0x01)
Why the alignment change ?
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h struct mpi3_event_data_diag_buffer_status_change { · line 664
Quoted 3 lines
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +3
-0+#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_PAUSED (0x02) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RESUMED (0x03) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_CLEARED (0x04)
A white line here would be nice to separate things.
Quoted 3 lines
#define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT (0x0200) #define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT (0x0100) #define MPI3_PEL_LOCALE_FLAGS_PCIE (0x0080)
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH v1 5/7] mpi3mr: Update MPI Headers to revision 39
Hi Damien,
Quoted 24 lines · Damien Le Moal
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h struct mpi3_event_data_diag_buffer_status_change { · line 661
Quoted 4 lines · Ranjan Kumar
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +1
-3-#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RELEASED (0x01) -#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_PAUSED (0x02) -#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RESUMED (0x03) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RELEASED (0x01)Why the alignment change ?
[Ranjan]: unintentional, will restore original alignment.drivers/scsi/mpi3mr/mpi/mpi30_ioc.h struct mpi3_event_data_diag_buffer_status_change { · line 664
Quoted 3 lines
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +3
-0+#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_PAUSED (0x02) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RESUMED (0x03) +#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_CLEARED (0x04)A white line here would be nice to separate things.
Quoted 3 lines
#define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT (0x0200) #define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT (0x0100) #define MPI3_PEL_LOCALE_FLAGS_PCIE (0x0080)--
Damien Le Moal
Western Digital Research
PATCH 6/7 mpi3mr: Record and report controller firmware faults
In reply to Ranjan KumarCapture and retain firmware fault codes and extended fault information whenever the controller enters a fault state.
Maintain a persistent firmware fault counter, expose it via sysfs, and generate uevents to aid userspace diagnostics and failure analysis.
--- drivers/scsi/mpi3mr/mpi3mr.h | 8 +++ drivers/scsi/mpi3mr/mpi3mr_app.c | 24 +++++++++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 87 ++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+)
drivers/scsi/mpi3mr/mpi3mr.h +8 -0
@@ -1137,6 +1137,10 @@ struct scmd_priv {* @default_qcount: Total Default queues * @active_poll_qcount: Currently active poll queue count * @requested_poll_qcount: User requested poll queue count +* @fault_during_init: Indicates a firmware fault occurred during initialization +* @saved_fault_code: Firmware fault code captured at the time of failure +* @saved_fault_info: Additional firmware-provided fault information +* @fwfault_counter: Count of firmware faults detected by the driver * @bsg_dev: BSG device structure * @bsg_queue: Request queue for BSG device * @stop_bsgs: Stop BSG request flag
@@ -1340,6 +1344,10 @@ struct mpi3mr_ioc {u16 default_qcount;u16 active_poll_qcount;u16 requested_poll_qcount; +u8 fault_during_init; +u32 saved_fault_code; +u32 saved_fault_info[3 ]; +u64 fwfault_counter;struct device bsg_dev;struct request_queue *bsg_queue;
drivers/scsi/mpi3mr/mpi3mr_app.c +24 -0
@@ -3255,6 +3255,29 @@ adp_state_show(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RO (adp_state); +/** +* fwfault_count_show() - SysFS callback to show firmware fault count +* @dev: class device +* @attr: Device attribute +* @buf: Buffer to copy data into +* +* Displays the total number of firmware faults detected by the driver +* since the controller was initialized. +* +* Return: Number of bytes written to @buf +*/ + +static ssize_t +fwfault_count_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct Scsi_Host *shost =class_to_shost (dev); +struct mpi3mr_ioc *mrioc =shost_priv (shost); + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , mrioc->fwfault_counter); +} +static DEVICE_ATTR_RO (fwfault_count); +static struct attribute *mpi3mr_host_attrs[] = { &dev_attr_version_fw.attr, &dev_attr_fw_queue_depth.attr,
@@ -3263,6 +3286,7 @@ static struct attribute *mpi3mr_host_attrs[] = { &dev_attr_reply_qfull_count.attr, &dev_attr_logging_level.attr, &dev_attr_adp_state.attr, + &dev_attr_fwfault_count.attr, NULL, };
drivers/scsi/mpi3mr/mpi3mr_fw.c +87 -0
135 lines not on this page · raw message
Signature · 1 line
2.47.3
Re: [PATCH v1 6/7] mpi3mr: Record and report controller firmware faults
drivers/scsi/mpi3mr/mpi3mr_fw.c static void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_ioc *mrioc) · line 1295
Quoted 10 lines · Ranjan Kumar
drivers/scsi/mpi3mr/mpi3mr_fw.c +10
-0+static void mpi3mr_fault_uevent_emit (struct mpi3mr_ioc *mrioc) +{ +struct kobj_uevent_env *env; + + env =kzalloc (sizeof (*env),GFP_KERNEL ); +if (!env) +return ; + +if (add_uevent_var (env,"DRIVER=%s" , mrioc->driver_name)) +return ;
All the returns in this function are leaking env...
Quoted 6 lines
drivers/scsi/mpi3mr/mpi3mr_fw.c +6
-0+if (add_uevent_var (env,"IOC_ID=%u" , mrioc->id)) +return ; +if (add_uevent_var (env,"FAULT_CODE=0x%08x" , mrioc->saved_fault_code)) +return ; +if (add_uevent_var (env,"FAULT_INFO0=0x%08x" , + mrioc->saved_fault_info[0 ]))
drivers/scsi/mpi3mr/mpi3mr_fw.c static void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_ioc *mrioc) · line 1311
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_fw.c +10
-0+return ; +if (add_uevent_var (env,"FAULT_INFO1=0x%08x" , + mrioc->saved_fault_info[1 ])) +return ; +if (add_uevent_var (env,"FAULT_INFO2=0x%08x" , + mrioc->saved_fault_info[2 ])) +return ; + +kobject_uevent_env (&mrioc->shost->shost_gendev.kobj, +KOBJ_CHANGE , env->envp);
Please align the arguments after the "(".
Quoted 2 lines
drivers/scsi/mpi3mr/mpi3mr_fw.c +2
-0+kfree (env); +}
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH v1 6/7] mpi3mr: Record and report controller firmware faults
Hi Damien,
Quoted 32 lines · Damien Le Moal
drivers/scsi/mpi3mr/mpi3mr_fw.c static void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_ioc *mrioc) · line 1295
Quoted 10 lines · Ranjan Kumar
drivers/scsi/mpi3mr/mpi3mr_fw.c +10
-0+static void mpi3mr_fault_uevent_emit (struct mpi3mr_ioc *mrioc) +{ +struct kobj_uevent_env *env; + + env =kzalloc (sizeof (*env),GFP_KERNEL ); +if (!env) +return ; + +if (add_uevent_var (env,"DRIVER=%s" , mrioc->driver_name)) +return ;All the returns in this function are leaking env...
Quoted 6 lines
drivers/scsi/mpi3mr/mpi3mr_fw.c +6
-0+if (add_uevent_var (env,"IOC_ID=%u" , mrioc->id)) +return ; +if (add_uevent_var (env,"FAULT_CODE=0x%08x" , mrioc->saved_fault_code)) +return ; +if (add_uevent_var (env,"FAULT_INFO0=0x%08x" , + mrioc->saved_fault_info[0 ]))drivers/scsi/mpi3mr/mpi3mr_fw.c static void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_ioc *mrioc) · line 1311
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_fw.c +10
-0+return ; +if (add_uevent_var (env,"FAULT_INFO1=0x%08x" , + mrioc->saved_fault_info[1 ])) +return ; +if (add_uevent_var (env,"FAULT_INFO2=0x%08x" , + mrioc->saved_fault_info[2 ])) +return ; + +kobject_uevent_env (&mrioc->shost->shost_gendev.kobj, +KOBJ_CHANGE , env->envp);
Quoted 5 lines
Please align the arguments after the "(".
Quoted 2 lines
drivers/scsi/mpi3mr/mpi3mr_fw.c +2
-0+kfree (env); +}
[Ranjan]: I will resend v2 by fixing the leak and alignment.
Quoted 4 lines
--
Damien Le Moal
Western Digital Research
PATCH 7/7 mpi3mr: Driver version update to 8.17.0.3.50
In reply to Ranjan KumarUpdate driver version to 8.17.0.3.50
--- drivers/scsi/mpi3mr/mpi3mr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +2 -2
@@ -56,8 +56,8 @@ extern struct list_head mrioc_list;extern int prot_mask;extern atomic64_t event_counter; -#define MPI3MR_DRIVER_VERSION "8.15.0.5.51" -#define MPI3MR_DRIVER_RELDATE "18-November-2025" +#define MPI3MR_DRIVER_VERSION "8.17.0.3.50" +#define MPI3MR_DRIVER_RELDATE "09-January-2026"#define MPI3MR_DRIVER_NAME "mpi3mr"#define MPI3MR_DRIVER_LICENSE "GPL"
Signature · 1 line
2.47.3