Commit e844adb1 authored by Kashyap Desai's avatar Kashyap Desai Committed by Martin K. Petersen

scsi: mpi3mr: Implement SCSI error handler hooks

Link: https://lore.kernel.org/r/20210520152545.2710479-14-kashyap.desai@broadcom.com
Cc: sathya.prakash@broadcom.com
Cc: hare@suse.de
Cc: thenzl@redhat.com
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Signed-off-by: default avatarKashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8f9c6173
...@@ -102,6 +102,7 @@ extern struct list_head mrioc_list; ...@@ -102,6 +102,7 @@ extern struct list_head mrioc_list;
/* command/controller interaction timeout definitions in seconds */ /* command/controller interaction timeout definitions in seconds */
#define MPI3MR_INTADMCMD_TIMEOUT 10 #define MPI3MR_INTADMCMD_TIMEOUT 10
#define MPI3MR_PORTENABLE_TIMEOUT 300 #define MPI3MR_PORTENABLE_TIMEOUT 300
#define MPI3MR_ABORTTM_TIMEOUT 30
#define MPI3MR_RESETTM_TIMEOUT 30 #define MPI3MR_RESETTM_TIMEOUT 30
#define MPI3MR_RESET_HOST_IOWAIT_TIMEOUT 5 #define MPI3MR_RESET_HOST_IOWAIT_TIMEOUT 5
#define MPI3MR_TSUPDATE_INTERVAL 900 #define MPI3MR_TSUPDATE_INTERVAL 900
...@@ -631,6 +632,7 @@ struct scmd_priv { ...@@ -631,6 +632,7 @@ struct scmd_priv {
* @chain_bitmap_sz: Chain buffer allocator bitmap size * @chain_bitmap_sz: Chain buffer allocator bitmap size
* @chain_bitmap: Chain buffer allocator bitmap * @chain_bitmap: Chain buffer allocator bitmap
* @chain_buf_lock: Chain buffer list lock * @chain_buf_lock: Chain buffer list lock
* @host_tm_cmds: Command tracker for task management commands
* @dev_rmhs_cmds: Command tracker for device removal commands * @dev_rmhs_cmds: Command tracker for device removal commands
* @devrem_bitmap_sz: Device removal bitmap size * @devrem_bitmap_sz: Device removal bitmap size
* @devrem_bitmap: Device removal bitmap * @devrem_bitmap: Device removal bitmap
...@@ -753,6 +755,7 @@ struct mpi3mr_ioc { ...@@ -753,6 +755,7 @@ struct mpi3mr_ioc {
void *chain_bitmap; void *chain_bitmap;
spinlock_t chain_buf_lock; spinlock_t chain_buf_lock;
struct mpi3mr_drv_cmd host_tm_cmds;
struct mpi3mr_drv_cmd dev_rmhs_cmds[MPI3MR_NUM_DEVRMCMD]; struct mpi3mr_drv_cmd dev_rmhs_cmds[MPI3MR_NUM_DEVRMCMD];
u16 devrem_bitmap_sz; u16 devrem_bitmap_sz;
void *devrem_bitmap; void *devrem_bitmap;
......
...@@ -172,6 +172,8 @@ mpi3mr_get_drv_cmd(struct mpi3mr_ioc *mrioc, u16 host_tag, ...@@ -172,6 +172,8 @@ mpi3mr_get_drv_cmd(struct mpi3mr_ioc *mrioc, u16 host_tag,
switch (host_tag) { switch (host_tag) {
case MPI3MR_HOSTTAG_INITCMDS: case MPI3MR_HOSTTAG_INITCMDS:
return &mrioc->init_cmds; return &mrioc->init_cmds;
case MPI3MR_HOSTTAG_BLK_TMS:
return &mrioc->host_tm_cmds;
case MPI3MR_HOSTTAG_INVALID: case MPI3MR_HOSTTAG_INVALID:
if (def_reply && def_reply->function == if (def_reply && def_reply->function ==
MPI3_FUNCTION_EVENT_NOTIFICATION) MPI3_FUNCTION_EVENT_NOTIFICATION)
...@@ -2033,6 +2035,26 @@ static int mpi3mr_alloc_reply_sense_bufs(struct mpi3mr_ioc *mrioc) ...@@ -2033,6 +2035,26 @@ static int mpi3mr_alloc_reply_sense_bufs(struct mpi3mr_ioc *mrioc)
goto out_failed; goto out_failed;
} }
mrioc->host_tm_cmds.reply = kzalloc(mrioc->facts.reply_sz, GFP_KERNEL);
if (!mrioc->host_tm_cmds.reply)
goto out_failed;
mrioc->dev_handle_bitmap_sz = mrioc->facts.max_devhandle / 8;
if (mrioc->facts.max_devhandle % 8)
mrioc->dev_handle_bitmap_sz++;
mrioc->removepend_bitmap = kzalloc(mrioc->dev_handle_bitmap_sz,
GFP_KERNEL);
if (!mrioc->removepend_bitmap)
goto out_failed;
mrioc->devrem_bitmap_sz = MPI3MR_NUM_DEVRMCMD / 8;
if (MPI3MR_NUM_DEVRMCMD % 8)
mrioc->devrem_bitmap_sz++;
mrioc->devrem_bitmap = kzalloc(mrioc->devrem_bitmap_sz,
GFP_KERNEL);
if (!mrioc->devrem_bitmap)
goto out_failed;
mrioc->num_reply_bufs = mrioc->facts.max_reqs + MPI3MR_NUM_EVT_REPLIES; mrioc->num_reply_bufs = mrioc->facts.max_reqs + MPI3MR_NUM_EVT_REPLIES;
mrioc->reply_free_qsz = mrioc->num_reply_bufs + 1; mrioc->reply_free_qsz = mrioc->num_reply_bufs + 1;
mrioc->num_sense_bufs = mrioc->facts.max_reqs / MPI3MR_SENSEBUF_FACTOR; mrioc->num_sense_bufs = mrioc->facts.max_reqs / MPI3MR_SENSEBUF_FACTOR;
...@@ -3046,6 +3068,8 @@ static void mpi3mr_memset_buffers(struct mpi3mr_ioc *mrioc) ...@@ -3046,6 +3068,8 @@ static void mpi3mr_memset_buffers(struct mpi3mr_ioc *mrioc)
memset(mrioc->admin_reply_base, 0, mrioc->admin_reply_q_sz); memset(mrioc->admin_reply_base, 0, mrioc->admin_reply_q_sz);
memset(mrioc->init_cmds.reply, 0, sizeof(*mrioc->init_cmds.reply)); memset(mrioc->init_cmds.reply, 0, sizeof(*mrioc->init_cmds.reply));
memset(mrioc->host_tm_cmds.reply, 0,
sizeof(*mrioc->host_tm_cmds.reply));
for (i = 0; i < MPI3MR_NUM_DEVRMCMD; i++) for (i = 0; i < MPI3MR_NUM_DEVRMCMD; i++)
memset(mrioc->dev_rmhs_cmds[i].reply, 0, memset(mrioc->dev_rmhs_cmds[i].reply, 0,
sizeof(*mrioc->dev_rmhs_cmds[i].reply)); sizeof(*mrioc->dev_rmhs_cmds[i].reply));
...@@ -3139,6 +3163,15 @@ static void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc) ...@@ -3139,6 +3163,15 @@ static void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc)
kfree(mrioc->init_cmds.reply); kfree(mrioc->init_cmds.reply);
mrioc->init_cmds.reply = NULL; mrioc->init_cmds.reply = NULL;
kfree(mrioc->host_tm_cmds.reply);
mrioc->host_tm_cmds.reply = NULL;
kfree(mrioc->removepend_bitmap);
mrioc->removepend_bitmap = NULL;
kfree(mrioc->devrem_bitmap);
mrioc->devrem_bitmap = NULL;
kfree(mrioc->chain_bitmap); kfree(mrioc->chain_bitmap);
mrioc->chain_bitmap = NULL; mrioc->chain_bitmap = NULL;
...@@ -3317,6 +3350,8 @@ static void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc) ...@@ -3317,6 +3350,8 @@ static void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc)
cmdptr = &mrioc->init_cmds; cmdptr = &mrioc->init_cmds;
mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr); mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr);
cmdptr = &mrioc->host_tm_cmds;
mpi3mr_drv_cmd_comp_reset(mrioc, cmdptr);
for (i = 0; i < MPI3MR_NUM_DEVRMCMD; i++) { for (i = 0; i < MPI3MR_NUM_DEVRMCMD; i++) {
cmdptr = &mrioc->dev_rmhs_cmds[i]; cmdptr = &mrioc->dev_rmhs_cmds[i];
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment