mpi3mr: add BSG interface support for controller management
Subsystems (2)
Sumit Saxena
maintainercover mpi3mr: add BSG interface support for controller management
This patchset adds BSG interface support for controller management. BSG layer faciliates communication/data exchange between application and driver/firmware over BSG device node.
Sumit Saxena (7):
mpi3mr: add BSG device support for controller management
mpi3mr: add support for driver commands
mpi3mr: add support for MPT commands
mpi3mr: add support for PEL commands
mpi3mr: expose adapter state to sysfs
mpi3mr: add support for nvme pass-through
mpi3mr: update driver version to 8.0.0.69.0
drivers/scsi/mpi3mr/Kconfig | 1 + drivers/scsi/mpi3mr/Makefile | 1 + drivers/scsi/mpi3mr/mpi3mr.h | 81 +- drivers/scsi/mpi3mr/mpi3mr_app.c | 1610 ++++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_app.h | 490 +++++++++ drivers/scsi/mpi3mr/mpi3mr_debug.h | 37 +- drivers/scsi/mpi3mr/mpi3mr_fw.c | 331 +++++- drivers/scsi/mpi3mr/mpi3mr_os.c | 52 +- 8 files changed, 2585 insertions(+), 18 deletions(-) create mode 100644 drivers/scsi/mpi3mr/mpi3mr_app.c create mode 100644 drivers/scsi/mpi3mr/mpi3mr_app.h
Signature · 1 line
2.27.0
Sumit Saxena
maintainerPATCH 1/7 mpi3mr: add BSG device support for controller management
This patch creates BSG device per controller during load and destroys during unload. BSG Device nodes will be named as /dev/bsg/mpi3mrctl0, /dev/bsg/mpi3mrctl1...
--- drivers/scsi/mpi3mr/Kconfig | 1 + drivers/scsi/mpi3mr/Makefile | 1 + drivers/scsi/mpi3mr/mpi3mr.h | 8 +++ drivers/scsi/mpi3mr/mpi3mr_app.c | 106 +++++++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_app.h | 20 ++++++ drivers/scsi/mpi3mr/mpi3mr_os.c | 2 + 6 files changed, 138 insertions(+) create mode 100644 drivers/scsi/mpi3mr/mpi3mr_app.c create mode 100644 drivers/scsi/mpi3mr/mpi3mr_app.h
drivers/scsi/mpi3mr/Kconfig +1 -0
@@ -3,5 +3,6 @@ config SCSI_MPI3MR tristate "Broadcom MPI3 Storage Controller Device Driver" depends on PCI && SCSI + select BLK_DEV_BSGLIB help MPI3 based Storage & RAID Controllers Driver.
drivers/scsi/mpi3mr/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-m += mpi3mr.o mpi3mr-y += mpi3mr_os.o \ mpi3mr_fw.o \ + mpi3mr_app.o \
drivers/scsi/mpi3mr/mpi3mr.h +8 -0
@@ -148,6 +148,7 @@ extern int prot_mask;#define MPI3MR_DEFAULT_MDTS (128 * 1024)#define MPI3MR_DEFAULT_PGSZEXP (12) +/* Command retry count definitions */ #define MPI3MR_DEV_RMHS_RETRY_COUNT 3
@@ -714,6 +715,8 @@ struct scmd_priv {* @default_qcount: Total Default queues * @active_poll_qcount: Currently active poll queue count * @requested_poll_qcount: User requested poll queue count +* @bsg_dev: BSG device structure +* @bsg_queue: Request queue for BSG device */ struct mpi3mr_ioc {struct list_head list;
@@ -854,6 +857,9 @@ struct mpi3mr_ioc {u16 default_qcount;u16 active_poll_qcount;u16 requested_poll_qcount; + +struct device *bsg_dev; +struct request_queue *bsg_queue; };/**
@@ -962,5 +968,7 @@ void mpi3mr_check_rh_fault_ioc(struct mpi3mr_ioc *mrioc, u32 reason_code);int mpi3mr_process_op_reply_q (struct mpi3mr_ioc *mrioc,struct op_reply_qinfo *op_reply_q);int mpi3mr_blk_mq_poll (struct Scsi_Host *shost,unsigned int queue_num); +void mpi3mr_bsg_init (struct mpi3mr_ioc *mrioc); +void mpi3mr_bsg_exit (struct mpi3mr_ioc *mrioc);#endif /*MPI3MR_H_INCLUDED*/
drivers/scsi/mpi3mr/mpi3mr_app.c new file +106 -0
106 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_app.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Driver for Broadcom MPI3 Storage Controllers +* +* Copyright (C) 2017-2022 Broadcom Inc. +* (mailto: [email protected]) +* +*/ + +#ifndef MPI3MR_APP_H_INCLUDED +#define MPI3MR_APP_H_INCLUDED + +/* +* Maximum data transfer size definitions for management +* application commands +*/ +#define MPI3MR_MAX_APP_XFER_SIZE (1 * 1024 * 1024) +#define MPI3MR_MAX_APP_XFER_SECTORS 2048 + +#endif
drivers/scsi/mpi3mr/mpi3mr_os.c +2 -0
@@ -4345,6 +4345,7 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) }scsi_scan_host (shost); +mpi3mr_bsg_init (mrioc);return retval; addhost_failed:
@@ -4389,6 +4390,7 @@ static void mpi3mr_remove(struct pci_dev *pdev)while (mrioc->reset_in_progress || mrioc->is_driver_loading)ssleep (1 ); +mpi3mr_bsg_exit (mrioc); mrioc->stop_drv_processing =1 ;mpi3mr_cleanup_fwevt_list (mrioc);spin_lock_irqsave (&mrioc->fwevt_lock, flags);
Signature · 1 line
2.27.0
Sumit Saxena
maintainerPATCH 2/7 mpi3mr: add support for driver commands
In reply to Sumit SaxenaThere are certain BSG commands which is to be completed by driver without involving firmware. These requests are termed as driver commands. This patch adds support for the same.
--- drivers/scsi/mpi3mr/mpi3mr.h | 16 +- drivers/scsi/mpi3mr/mpi3mr_app.c | 394 ++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_app.h | 470 +++++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_debug.h | 12 +- drivers/scsi/mpi3mr/mpi3mr_fw.c | 21 +- drivers/scsi/mpi3mr/mpi3mr_os.c | 3 + 6 files changed, 904 insertions(+), 12 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +13 -3
@@ -89,7 +89,7 @@ extern int prot_mask;/* Reserved Host Tag definitions */ #define MPI3MR_HOSTTAG_INVALID 0xFFFF#define MPI3MR_HOSTTAG_INITCMDS 1 -#define MPI3MR_HOSTTAG_IOCTLCMDS 2 +#define MPI3MR_HOSTTAG_BSG_CMDS 2#define MPI3MR_HOSTTAG_BLK_TMS 5#define MPI3MR_NUM_DEVRMCMD 16
@@ -190,10 +190,10 @@ enum mpi3mr_iocstate {enum mpi3mr_reset_reason {MPI3MR_RESET_FROM_BRINGUP =1 ,MPI3MR_RESET_FROM_FAULT_WATCH =2 , -MPI3MR_RESET_FROM_IOCTL =3 , +MPI3MR_RESET_FROM_APP =3 ,MPI3MR_RESET_FROM_EH_HOS =4 ,MPI3MR_RESET_FROM_TM_TIMEOUT =5 , -MPI3MR_RESET_FROM_IOCTL_TIMEOUT =6 , +MPI3MR_RESET_FROM_APP_TIMEOUT =6 ,MPI3MR_RESET_FROM_MUR_FAILURE =7 ,MPI3MR_RESET_FROM_CTLR_CLEANUP =8 ,MPI3MR_RESET_FROM_CIACTIV_FAULT =9 ,
@@ -686,6 +686,7 @@ struct scmd_priv {* @chain_bitmap_sz: Chain buffer allocator bitmap size * @chain_bitmap: Chain buffer allocator bitmap * @chain_buf_lock: Chain buffer list lock +* @bsg_cmds: Command tracker for BSG command * @host_tm_cmds: Command tracker for task management commands * @dev_rmhs_cmds: Command tracker for device removal commands * @evtack_cmds: Command tracker for event ack commands
@@ -717,6 +718,10 @@ struct scmd_priv {* @requested_poll_qcount: User requested poll queue count * @bsg_dev: BSG device structure * @bsg_queue: Request queue for BSG device +* @stop_bsgs: Stop BSG request flag +* @logdata_buf: Circular buffer to store log data entries +* @logdata_buf_idx: Index of entry in buffer to store +* @logdata_entry_sz: log data entry size */ struct mpi3mr_ioc {struct list_head list;
@@ -823,6 +828,7 @@ struct mpi3mr_ioc {void *chain_bitmap;spinlock_t chain_buf_lock; +struct mpi3mr_drv_cmd bsg_cmds;struct mpi3mr_drv_cmd host_tm_cmds;struct mpi3mr_drv_cmd dev_rmhs_cmds[MPI3MR_NUM_DEVRMCMD ];struct mpi3mr_drv_cmd evtack_cmds[MPI3MR_NUM_EVTACKCMD ];
@@ -860,6 +866,10 @@ struct mpi3mr_ioc {struct device *bsg_dev;struct request_queue *bsg_queue; +u8 stop_bsgs; +u8 *logdata_buf; +u16 logdata_buf_idx; +u16 logdata_entry_sz; };/**
drivers/scsi/mpi3mr/mpi3mr_app.c +394 -0
406 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_app.h +470 -0
476 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_debug.h +6 -6
@@ -23,8 +23,8 @@#define MPI3_DEBUG_RESET 0x00000020#define MPI3_DEBUG_SCSI_ERROR 0x00000040#define MPI3_DEBUG_REPLY 0x00000080 -#define MPI3_DEBUG_IOCTL_ERROR 0x00008000 -#define MPI3_DEBUG_IOCTL_INFO 0x00010000 +#define MPI3_DEBUG_BSG_ERROR 0x00008000 +#define MPI3_DEBUG_BSG_INFO 0x00010000#define MPI3_DEBUG_SCSI_INFO 0x00020000#define MPI3_DEBUG 0x01000000#define MPI3_DEBUG_SG 0x02000000
@@ -110,15 +110,15 @@ } while (0) -#define dprint_ioctl_info (ioc, fmt, ...) \ +#define dprint_bsg_info (ioc, fmt, ...) \ do { \ - if (ioc->logging_level & MPI3_DEBUG_IOCTL_INFO) \ + if (ioc->logging_level & MPI3_DEBUG_BSG_INFO) \ pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \ } while (0) -#define dprint_ioctl_err (ioc, fmt, ...) \ +#define dprint_bsg_err (ioc, fmt, ...) \ do { \ - if (ioc->logging_level & MPI3_DEBUG_IOCTL_ERROR) \ + if (ioc->logging_level & MPI3_DEBUG_BSG_ERROR) \ pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \ } while (0)
drivers/scsi/mpi3mr/mpi3mr_fw.c +18 -3
@@ -297,6 +297,8 @@ mpi3mr_get_drv_cmd(struct mpi3mr_ioc *mrioc, u16 host_tag,switch (host_tag) {case MPI3MR_HOSTTAG_INITCMDS :return &mrioc->init_cmds; +case MPI3MR_HOSTTAG_BSG_CMDS : +return &mrioc->bsg_cmds;case MPI3MR_HOSTTAG_BLK_TMS :return &mrioc->host_tm_cmds;case MPI3MR_HOSTTAG_INVALID :
@@ -865,10 +867,10 @@ static const struct { } mpi3mr_reset_reason_codes[] = { { MPI3MR_RESET_FROM_BRINGUP, "timeout in bringup" }, { MPI3MR_RESET_FROM_FAULT_WATCH, "fault" }, - { MPI3MR_RESET_FROM_IOCTL, "application invocation" }, + { MPI3MR_RESET_FROM_APP, "application invocation" }, { MPI3MR_RESET_FROM_EH_HOS, "error handling" }, { MPI3MR_RESET_FROM_TM_TIMEOUT, "TM timeout" }, - { MPI3MR_RESET_FROM_IOCTL_TIMEOUT, "IOCTL timeout" }, + { MPI3MR_RESET_FROM_APP_TIMEOUT, "application command timeout" }, { MPI3MR_RESET_FROM_MUR_FAILURE, "MUR failure" }, { MPI3MR_RESET_FROM_CTLR_CLEANUP, "timeout in controller cleanup" }, { MPI3MR_RESET_FROM_CIACTIV_FAULT, "component image activation fault" },
@@ -2813,6 +2815,10 @@ static int mpi3mr_alloc_reply_sense_bufs(struct mpi3mr_ioc *mrioc)if (!mrioc->init_cmds.reply) goto out_failed; + mrioc->bsg_cmds.reply =kzalloc (mrioc->reply_sz,GFP_KERNEL ); +if (!mrioc->bsg_cmds.reply) + goto out_failed; +for (i =0 ; i <MPI3MR_NUM_DEVRMCMD ; i++) { mrioc->dev_rmhs_cmds[i].reply =kzalloc (mrioc->reply_sz,GFP_KERNEL );
@@ -3948,6 +3954,8 @@ void mpi3mr_memset_buffers(struct mpi3mr_ioc *mrioc)if (mrioc->init_cmds.reply) {memset (mrioc->init_cmds.reply,0 ,sizeof (*mrioc->init_cmds.reply)); +memset (mrioc->bsg_cmds.reply,0 , +sizeof (*mrioc->bsg_cmds.reply));memset (mrioc->host_tm_cmds.reply,0 ,sizeof (*mrioc->host_tm_cmds.reply));for (i =0 ; i <MPI3MR_NUM_DEVRMCMD ; i++)
@@ -4050,6 +4058,9 @@ void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc)kfree (mrioc->init_cmds.reply); mrioc->init_cmds.reply =NULL ; +kfree (mrioc->bsg_cmds.reply); + mrioc->bsg_cmds.reply =NULL ; +kfree (mrioc->host_tm_cmds.reply); mrioc->host_tm_cmds.reply =NULL ;
@@ -4235,6 +4246,8 @@ static void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc) cmdptr = &mrioc->init_cmds;mpi3mr_drv_cmd_comp_reset (mrioc, cmdptr); + cmdptr = &mrioc->bsg_cmds; +mpi3mr_drv_cmd_comp_reset (mrioc, cmdptr); cmdptr = &mrioc->host_tm_cmds;mpi3mr_drv_cmd_comp_reset (mrioc, cmdptr);
@@ -4258,7 +4271,7 @@ static void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc)* This is an handler for recovering controller by issuing soft * reset are diag fault reset. This is a blocking function and * when one reset is executed if any other resets they will be -* blocked. All IOCTLs/IO will be blocked during the reset. If +* blocked. All BSG requests will be blocked during the reset. If * controller reset is successful then the controller will be * reinitalized, otherwise the controller will be marked as not * recoverable
@@ -4305,6 +4318,7 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc, mpi3mr_reset_rc_name(reset_reason)); mrioc->reset_in_progress =1 ; + mrioc->stop_bsgs =1 ; mrioc->prev_reset_result =-1 ; if ((!snapdump) && (reset_reason != MPI3MR_RESET_FROM_FAULT_WATCH) &&
@@ -4377,6 +4391,7 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc, &mrioc->watchdog_work, msecs_to_jiffies(MPI3MR_WATCHDOG_INTERVAL));spin_unlock_irqrestore (&mrioc->watchdog_lock, flags); + mrioc->stop_bsgs =0 ; }else {mpi3mr_issue_reset (mrioc,MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT , reset_reason);
drivers/scsi/mpi3mr/mpi3mr_os.c +3 -0
@@ -3589,6 +3589,7 @@ static int mpi3mr_scan_finished(struct Scsi_Host *shost,mpi3mr_start_watchdog (mrioc); mrioc->is_driver_loading =0 ; + mrioc->stop_bsgs =0 ;return 1 ; }
@@ -4259,6 +4260,7 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)mutex_init (&mrioc->reset_mutex);mpi3mr_init_drv_cmd (&mrioc->init_cmds,MPI3MR_HOSTTAG_INITCMDS );mpi3mr_init_drv_cmd (&mrioc->host_tm_cmds,MPI3MR_HOSTTAG_BLK_TMS ); +mpi3mr_init_drv_cmd (&mrioc->bsg_cmds,MPI3MR_HOSTTAG_BSG_CMDS );for (i =0 ; i <MPI3MR_NUM_DEVRMCMD ; i++) mpi3mr_init_drv_cmd(&mrioc->dev_rmhs_cmds[i],
@@ -4271,6 +4273,7 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) mrioc->logging_level = logging_level; mrioc->shost = shost; mrioc->pdev = pdev; + mrioc->stop_bsgs =1 ;/* init shost parameters */ shost->max_cmd_len =MPI3MR_MAX_CDB_LENGTH ;
Signature · 1 line
2.27.0
Re: [PATCH 2/7] mpi3mr: add support for driver commands
Quoted 32 lines · Sumit Saxena
drivers/scsi/mpi3mr/mpi3mr_app.h +24
-0@@ -10,6 +10,476 @@#ifndef MPI3MR_APP_H_INCLUDED #define MPI3MR_APP_H_INCLUDED + +/* Definitions for BSG commands */ +#define MPI3MR_IOCTL_VERSION 0x06 + +#define MPI3MR_APP_DEFAULT_TIMEOUT (60)/*seconds*/ + +#define MPI3MR_BSG_ADPTYPE_UNKNOWN 0 +#define MPI3MR_BSG_ADPTYPE_AVGFAMILY 1 + +#define MPI3MR_BSG_ADPSTATE_UNKNOWN 0 +#define MPI3MR_BSG_ADPSTATE_OPERATIONAL 1 +#define MPI3MR_BSG_ADPSTATE_FAULT 2 +#define MPI3MR_BSG_ADPSTATE_IN_RESET 3 +#define MPI3MR_BSG_ADPSTATE_UNRECOVERABLE 4 + +#define MPI3MR_BSG_ADPRESET_UNKNOWN 0 +#define MPI3MR_BSG_ADPRESET_SOFT 1 +#define MPI3MR_BSG_ADPRESET_DIAG_FAULT 2 + +#define MPI3MR_BSG_LOGDATA_MAX_ENTRIES 400 +#define MPI3MR_BSG_LOGDATA_ENTRY_HEADER_SZ 4 + +#define MPI3MR_DRVBSG_OPCODE_UNKNOWN 0 +#define MPI3MR_DRVBSG_OPCODE_ADPINFO 1
drivers/scsi/mpi3mr/mpi3mr_app.h line 46
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_app.h +10
-0+#define MPI3MR_DRVBSG_OPCODE_ADPRESET 2 +#define MPI3MR_DRVBSG_OPCODE_ALLTGTDEVINFO 4 +#define MPI3MR_DRVBSG_OPCODE_GETCHGCNT 5 +#define MPI3MR_DRVBSG_OPCODE_LOGDATAENABLE 6 +#define MPI3MR_DRVBSG_OPCODE_PELENABLE 7 +#define MPI3MR_DRVBSG_OPCODE_GETLOGDATA 8 +#define MPI3MR_DRVBSG_OPCODE_QUERY_HDB 9 +#define MPI3MR_DRVBSG_OPCODE_REPOST_HDB 10 +#define MPI3MR_DRVBSG_OPCODE_UPLOAD_HDB 11 +#define MPI3MR_DRVBSG_OPCODE_REFRESH_HDB_TRIGGERS 12
Most if not all definitions in this file are needed by user space applications that use the new BSG interface. Please move the definitions from this file that are used by user space applications into a header file under include/uapi/.
Thanks,
Bart.
Sumit Saxena
maintainerRe: [PATCH 2/7] mpi3mr: add support for driver commands
Quoted 5 lines · Bart Van Assche
Most if not all definitions in this file are needed by user space applications that use the new BSG interface. Please move the definitions from this file that are used by user space applications into a header file under
include/uapi/.
I will fix it in v2.
Thanks,
Sumit
Quoted 4 lines
Thanks,
Bart.
Sumit Saxena
maintainerPATCH 3/7 mpi3mr: add support for MPT commands
In reply to Sumit SaxenaThere are certain management commands requiring firmware intervention. These commands are termed as MPT commands. This patch adds support for the same.
--- drivers/scsi/mpi3mr/mpi3mr.h | 8 + drivers/scsi/mpi3mr/mpi3mr_app.c | 519 ++++++++++++++++++++++++++++- drivers/scsi/mpi3mr/mpi3mr_debug.h | 25 ++ drivers/scsi/mpi3mr/mpi3mr_os.c | 4 +- 4 files changed, 553 insertions(+), 3 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +8 -0
@@ -544,6 +544,7 @@ struct mpi3mr_sdev_priv_data {* @ioc_status: IOC status from the firmware * @ioc_loginfo:IOC log info from the firmware * @is_waiting: Is the command issued in block mode +* @is_sense: Is Sense data present * @retry_count: Retry count for retriable commands * @host_tag: Host tag used by the command * @callback: Callback for non blocking commands
@@ -559,6 +560,7 @@ struct mpi3mr_drv_cmd {u16 ioc_status;u32 ioc_loginfo;u8 is_waiting; +u8 is_sense;u8 retry_count;u16 host_tag;
@@ -980,5 +982,11 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,int mpi3mr_blk_mq_poll (struct Scsi_Host *shost,unsigned int queue_num);void mpi3mr_bsg_init (struct mpi3mr_ioc *mrioc);void mpi3mr_bsg_exit (struct mpi3mr_ioc *mrioc); +int mpi3mr_issue_tm (struct mpi3mr_ioc *mrioc,u8 tm_type, +u16 handle,uint lun,u16 htag,ulong timeout, +struct mpi3mr_drv_cmd *drv_cmd, +u8 *resp_code,struct scsi_cmnd *scmd); +struct mpi3mr_tgt_dev *mpi3mr_get_tgtdev_by_handle ( +struct mpi3mr_ioc *mrioc,u16 handle);#endif /*MPI3MR_H_INCLUDED*/
drivers/scsi/mpi3mr/mpi3mr_app.c +518 -1
537 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_debug.h +25 -0
@@ -124,6 +124,31 @@#endif /* MPT3SAS_DEBUG_H_INCLUDED */ +/** +* dprint_dump - print contents of a memory buffer +* @req: Pointer to a memory buffer +* @sz: Memory buffer size +* @namestr: Name String to identify the buffer type +*/ +static inline void +dprint_dump (void *req,int sz,const char *name_string) +{ +int i; +__le32 *mfp = (__le32 *)req; + + sz = sz/4 ; +if (name_string) +pr_info ("%s:\n\t" , name_string); +else +pr_info ("request:\n\t" ); +for (i =0 ; i < sz; i++) { +if (i && ((i %8 ) ==0 )) +pr_info ("\n\t" ); +pr_info ("%08x " ,le32_to_cpu (mfp[i])); + } +pr_info ("\n" ); +} +/** * dprint_dump_req - print message frame contents * @req: pointer to message frame
drivers/scsi/mpi3mr/mpi3mr_os.c +2 -2
@@ -634,7 +634,7 @@ static struct mpi3mr_tgt_dev *__mpi3mr_get_tgtdev_by_handle(* * Return: Target device reference. */ -static struct mpi3mr_tgt_dev *mpi3mr_get_tgtdev_by_handle ( +struct mpi3mr_tgt_dev *mpi3mr_get_tgtdev_by_handle (struct mpi3mr_ioc *mrioc,u16 handle) {struct mpi3mr_tgt_dev *tgtdev;
@@ -2996,7 +2996,7 @@ inline void mpi3mr_poll_pend_io_completions(struct mpi3mr_ioc *mrioc)* * Return: 0 on success, non-zero on errors */ -static int mpi3mr_issue_tm (struct mpi3mr_ioc *mrioc,u8 tm_type, +int mpi3mr_issue_tm (struct mpi3mr_ioc *mrioc,u8 tm_type,u16 handle,uint lun,u16 htag,ulong timeout,struct mpi3mr_drv_cmd *drv_cmd,u8 *resp_code,struct scsi_cmnd *scmd)
Signature · 1 line
2.27.0
Sumit Saxena
maintainerPATCH 4/7 mpi3mr: add support for PEL commands
In reply to Sumit SaxenaThis patch includes driver support for the management applications to enable the persistent event log(PEL) notification. Upon receipt of events, driver will increment sysfs variable named as event_counter. Application would poll for event_counter value and any change in it would signal the applications about events.
--- drivers/scsi/mpi3mr/mpi3mr.h | 36 +++- drivers/scsi/mpi3mr/mpi3mr_app.c | 205 ++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 310 +++++++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_os.c | 42 +++++ 4 files changed, 592 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr.h +35 -1
@@ -52,6 +52,7 @@extern spinlock_t mrioc_list_lock;extern struct list_head mrioc_list;extern int prot_mask; +extern atomic64_t event_counter;#define MPI3MR_DRIVER_VERSION "8.0.0.68.0"#define MPI3MR_DRIVER_RELDATE "10-February-2022"
@@ -90,6 +91,8 @@ extern int prot_mask;#define MPI3MR_HOSTTAG_INVALID 0xFFFF#define MPI3MR_HOSTTAG_INITCMDS 1#define MPI3MR_HOSTTAG_BSG_CMDS 2 +#define MPI3MR_HOSTTAG_PEL_ABORT 3 +#define MPI3MR_HOSTTAG_PEL_WAIT 4#define MPI3MR_HOSTTAG_BLK_TMS 5#define MPI3MR_NUM_DEVRMCMD 16
@@ -151,6 +154,7 @@ extern int prot_mask;/* Command retry count definitions */ #define MPI3MR_DEV_RMHS_RETRY_COUNT 3 +#define MPI3MR_PEL_RETRY_COUNT 3/* Default target device queue depth */ #define MPI3MR_DEFAULT_SDEV_QD 32
@@ -714,6 +718,16 @@ struct scmd_priv {* @current_event: Firmware event currently in process * @driver_info: Driver, Kernel, OS information to firmware * @change_count: Topology change count +* @pel_enabled: Persistent Event Log(PEL) enabled or not +* @pel_abort_requested: PEL abort is requested or not +* @pel_class: PEL Class identifier +* @pel_locale: PEL Locale identifier +* @pel_cmds: Command tracker for PEL wait command +* @pel_abort_cmd: Command tracker for PEL abort command +* @pel_newest_seqnum: Newest PEL sequenece number +* @pel_seqnum_virt: PEL sequence number virtual address +* @pel_seqnum_dma: PEL sequence number DMA address +* @pel_seqnum_sz: PEL sequenece number size * @op_reply_q_offset: Operational reply queue offset with MSIx * @default_qcount: Total Default queues * @active_poll_qcount: Currently active poll queue count
@@ -860,8 +874,20 @@ struct mpi3mr_ioc {struct mpi3mr_fwevt *current_event;struct mpi3_driver_info_layout driver_info;u16 change_count; -u16 op_reply_q_offset; +u8 pel_enabled; +u8 pel_abort_requested; +u8 pel_class; +u16 pel_locale; +struct mpi3mr_drv_cmd pel_cmds; +struct mpi3mr_drv_cmd pel_abort_cmd; + +u32 pel_newest_seqnum; +void *pel_seqnum_virt; +dma_addr_t pel_seqnum_dma; +u32 pel_seqnum_sz; + +u16 op_reply_q_offset;u16 default_qcount;u16 active_poll_qcount;u16 requested_poll_qcount;
@@ -884,6 +910,7 @@ struct mpi3mr_ioc {* @send_ack: Event acknowledgment required or not * @process_evt: Bottomhalf processing required or not * @evt_ctx: Event context to send in Ack +* @event_data_size: size of the event data in bytes * @pending_at_sml: waiting for device add/remove API to complete * @discard: discard this event * @ref_count: kref count
@@ -897,6 +924,7 @@ struct mpi3mr_fwevt {bool send_ack;bool process_evt;u32 evt_ctx; +u16 event_data_size;bool pending_at_sml;bool discard;struct kref ref_count;
@@ -988,5 +1016,11 @@ int mpi3mr_issue_tm(struct mpi3mr_ioc *mrioc, u8 tm_type, u8 *resp_code, struct scsi_cmnd *scmd);struct mpi3mr_tgt_dev *mpi3mr_get_tgtdev_by_handle (struct mpi3mr_ioc *mrioc,u16 handle); +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, +u16 event_data_size);#endif /*MPI3MR_H_INCLUDED*/
drivers/scsi/mpi3mr/mpi3mr_app.c +205 -0
229 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_fw.c +310 -0
376 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_os.c +42 -0
84 lines not on this page · raw message
Signature · 1 line
2.27.0
Sumit Saxena
maintainerPATCH 5/7 mpi3mr: expose adapter state to sysfs
In reply to Sumit Saxena--- drivers/scsi/mpi3mr/mpi3mr.h | 2 +- drivers/scsi/mpi3mr/mpi3mr_app.c | 46 ++++++++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_os.c | 1 + 3 files changed, 48 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr.h +1 -1
@@ -1022,5 +1022,5 @@ 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,u16 event_data_size); - +extern const struct attribute_group *mpi3mr_host_groups[];#endif /*MPI3MR_H_INCLUDED*/
drivers/scsi/mpi3mr/mpi3mr_app.c +46 -0
49 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_os.c +1 -0
@@ -4134,6 +4134,7 @@ static struct scsi_host_template mpi3mr_driver_template = { .max_segment_size = 0xffffffff, .track_queue_depth = 1, .cmd_size = sizeof(struct scmd_priv), + .shost_groups = mpi3mr_host_groups, };/**
Signature · 1 line
2.27.0
Sumit Saxena
maintainerPATCH 6/7 mpi3mr: add support for nvme pass-through
In reply to Sumit SaxenaThis patch adds support for management applications to send an MPI3 Encapsulated NVMe passthru commands to the NVMe devices attached to the Avenger controller. Since the NVMe drives are exposed as SCSI devices by the controller the standard NVMe applications cannot be used to interact with the drives and the command sets supported is also limited by the controller firmware. Special handling is required for MPI3 Encapsulated NVMe passthru commands for PRP/SGL setup in the commands hence the additional changes.
--- drivers/scsi/mpi3mr/mpi3mr.h | 7 + drivers/scsi/mpi3mr/mpi3mr_app.c | 348 ++++++++++++++++++++++++++++++- 2 files changed, 352 insertions(+), 3 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +7 -0
@@ -712,6 +712,9 @@ struct scmd_priv {* @reset_waitq: Controller reset wait queue * @prepare_for_reset: Prepare for reset event received * @prepare_for_reset_timeout_counter: Prepare for reset timeout +* @prp_list_virt: NVMe encapsulated PRP list virtual base +* @prp_list_dma: NVMe encapsulated PRP list DMA +* @prp_sz: NVME encapsulated PRP list size * @diagsave_timeout: Diagnostic information save timeout * @logging_level: Controller debug logging level * @flush_io_count: I/O count to flush after reset
@@ -867,6 +870,10 @@ struct mpi3mr_ioc {u8 prepare_for_reset;u16 prepare_for_reset_timeout_counter; +void *prp_list_virt; +dma_addr_t prp_list_dma; +u32 prp_sz; +u16 diagsave_timeout;int logging_level;u16 flush_io_count;
drivers/scsi/mpi3mr/mpi3mr_app.c +345 -3
378 lines not on this page · raw message
Signature · 1 line
2.27.0
Sumit Saxena
maintainerPATCH 7/7 mpi3mr: update driver version to 8.0.0.69.0
In reply to Sumit Saxena--- drivers/scsi/mpi3mr/mpi3mr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +2 -2
@@ -54,8 +54,8 @@ extern struct list_head mrioc_list;extern int prot_mask;extern atomic64_t event_counter; -#define MPI3MR_DRIVER_VERSION "8.0.0.68.0" -#define MPI3MR_DRIVER_RELDATE "10-February-2022" +#define MPI3MR_DRIVER_VERSION "8.0.0.69.0" +#define MPI3MR_DRIVER_RELDATE "16-March-2022"#define MPI3MR_DRIVER_NAME "mpi3mr"#define MPI3MR_DRIVER_LICENSE "GPL"
Signature · 1 line
2.27.0