Skip to content

Commit 9640d57

Browse files
Merge patch series "mpi3mr: Few Enhancements and minor fixes"
Ranjan Kumar <[email protected]> says: Few Enhancements and minor fixes of mpi3mr driver. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents dded1dc + 9a9068b commit 9640d57

File tree

6 files changed

+177
-43
lines changed

6 files changed

+177
-43
lines changed

drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ struct mpi3_security_page0 {
14821482
#define MPI3_SECURITY1_KEY_RECORD_MAX 1
14831483
#endif
14841484
#ifndef MPI3_SECURITY1_PAD_MAX
1485-
#define MPI3_SECURITY1_PAD_MAX 1
1485+
#define MPI3_SECURITY1_PAD_MAX 4
14861486
#endif
14871487
union mpi3_security1_key_data {
14881488
__le32 dword[128];

drivers/scsi/mpi3mr/mpi/mpi30_ioc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ struct mpi3_event_data_pcie_error_threshold {
600600
__le16 threshold_count;
601601
__le16 attached_dev_handle;
602602
__le16 reserved12;
603+
__le32 reserved14;
603604
};
604605

605606
#define MPI3_EVENT_PCI_ERROR_RC_THRESHOLD_EXCEEDED (0x00)

drivers/scsi/mpi3mr/mpi/mpi30_transport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ union mpi3_version_union {
1818

1919
#define MPI3_VERSION_MAJOR (3)
2020
#define MPI3_VERSION_MINOR (0)
21-
#define MPI3_VERSION_UNIT (27)
21+
#define MPI3_VERSION_UNIT (28)
2222
#define MPI3_VERSION_DEV (0)
2323
#define MPI3_DEVHANDLE_INVALID (0xffff)
2424
struct mpi3_sysif_oper_queue_indexes {

drivers/scsi/mpi3mr/mpi3mr.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ extern struct list_head mrioc_list;
5555
extern int prot_mask;
5656
extern atomic64_t event_counter;
5757

58-
#define MPI3MR_DRIVER_VERSION "8.4.1.0.0"
59-
#define MPI3MR_DRIVER_RELDATE "16-March-2023"
58+
#define MPI3MR_DRIVER_VERSION "8.5.0.0.0"
59+
#define MPI3MR_DRIVER_RELDATE "24-July-2023"
6060

6161
#define MPI3MR_DRIVER_NAME "mpi3mr"
6262
#define MPI3MR_DRIVER_LICENSE "GPL"
@@ -66,11 +66,12 @@ extern atomic64_t event_counter;
6666
#define MPI3MR_NAME_LENGTH 32
6767
#define IOCNAME "%s: "
6868

69-
#define MPI3MR_MAX_SECTORS 2048
69+
#define MPI3MR_DEFAULT_MAX_IO_SIZE (1 * 1024 * 1024)
7070

7171
/* Definitions for internal SGL and Chain SGL buffers */
7272
#define MPI3MR_PAGE_SIZE_4K 4096
73-
#define MPI3MR_SG_DEPTH (MPI3MR_PAGE_SIZE_4K / sizeof(struct mpi3_sge_common))
73+
#define MPI3MR_DEFAULT_SGL_ENTRIES 256
74+
#define MPI3MR_MAX_SGL_ENTRIES 2048
7475

7576
/* Definitions for MAX values for shost */
7677
#define MPI3MR_MAX_CMDS_LUN 128
@@ -206,6 +207,9 @@ extern atomic64_t event_counter;
206207
*/
207208
#define MPI3MR_MAX_APP_XFER_SECTORS (2048 + 512)
208209

210+
#define MPI3MR_WRITE_SAME_MAX_LEN_256_BLKS 256
211+
#define MPI3MR_WRITE_SAME_MAX_LEN_2048_BLKS 2048
212+
209213
/**
210214
* struct mpi3mr_nvme_pt_sge - Structure to store SGEs for NVMe
211215
* Encapsulated commands.
@@ -323,6 +327,7 @@ struct mpi3mr_ioc_facts {
323327
u16 max_perids;
324328
u16 max_pds;
325329
u16 max_sasexpanders;
330+
u32 max_data_length;
326331
u16 max_sasinitiators;
327332
u16 max_enclosures;
328333
u16 max_pcie_switches;
@@ -676,6 +681,7 @@ enum mpi3mr_dev_state {
676681
* @io_unit_port: IO Unit port ID
677682
* @non_stl: Is this device not to be attached with SAS TL
678683
* @io_throttle_enabled: I/O throttling needed or not
684+
* @wslen: Write same max length
679685
* @q_depth: Device specific Queue Depth
680686
* @wwid: World wide ID
681687
* @enclosure_logical_id: Enclosure logical identifier
@@ -698,6 +704,7 @@ struct mpi3mr_tgt_dev {
698704
u8 io_unit_port;
699705
u8 non_stl;
700706
u8 io_throttle_enabled;
707+
u16 wslen;
701708
u16 q_depth;
702709
u64 wwid;
703710
u64 enclosure_logical_id;
@@ -751,6 +758,8 @@ static inline void mpi3mr_tgtdev_put(struct mpi3mr_tgt_dev *s)
751758
* @dev_removed: Device removed in the Firmware
752759
* @dev_removedelay: Device is waiting to be removed in FW
753760
* @dev_type: Device type
761+
* @dev_nvme_dif: Device is NVMe DIF enabled
762+
* @wslen: Write same max length
754763
* @io_throttle_enabled: I/O throttling needed or not
755764
* @io_divert: Flag indicates io divert is on or off for the dev
756765
* @throttle_group: Pointer to throttle group info
@@ -767,6 +776,8 @@ struct mpi3mr_stgt_priv_data {
767776
u8 dev_removed;
768777
u8 dev_removedelay;
769778
u8 dev_type;
779+
u8 dev_nvme_dif;
780+
u16 wslen;
770781
u8 io_throttle_enabled;
771782
u8 io_divert;
772783
struct mpi3mr_throttle_group_info *throttle_group;
@@ -782,12 +793,14 @@ struct mpi3mr_stgt_priv_data {
782793
* @ncq_prio_enable: NCQ priority enable for SATA device
783794
* @pend_count: Counter to track pending I/Os during error
784795
* handling
796+
* @wslen: Write same max length
785797
*/
786798
struct mpi3mr_sdev_priv_data {
787799
struct mpi3mr_stgt_priv_data *tgt_priv_data;
788800
u32 lun_id;
789801
u8 ncq_prio_enable;
790802
u32 pend_count;
803+
u16 wslen;
791804
};
792805

793806
/**
@@ -959,6 +972,7 @@ struct scmd_priv {
959972
* @stop_drv_processing: Stop all command processing
960973
* @device_refresh_on: Don't process the events until devices are refreshed
961974
* @max_host_ios: Maximum host I/O count
975+
* @max_sgl_entries: Max SGL entries per I/O
962976
* @chain_buf_count: Chain buffer count
963977
* @chain_buf_pool: Chain buffer pool
964978
* @chain_sgl_list: Chain SGL list
@@ -1129,6 +1143,7 @@ struct mpi3mr_ioc {
11291143
u16 max_host_ios;
11301144
spinlock_t tgtdev_lock;
11311145
struct list_head tgtdev_list;
1146+
u16 max_sgl_entries;
11321147

11331148
u32 chain_buf_count;
11341149
struct dma_pool *chain_buf_pool;

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,12 @@ mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc)
11631163
return -EPERM;
11641164
}
11651165

1166+
if (mrioc->shost->max_sectors != (mrioc->facts.max_data_length / 512))
1167+
ioc_err(mrioc, "Warning: The maximum data transfer length\n"
1168+
"\tchanged after reset: previous(%d), new(%d),\n"
1169+
"the driver cannot change this at run time\n",
1170+
mrioc->shost->max_sectors * 512, mrioc->facts.max_data_length);
1171+
11661172
if ((mrioc->sas_transport_enabled) && (mrioc->facts.ioc_capabilities &
11671173
MPI3_IOCFACTS_CAPABILITY_MULTIPATH_ENABLED))
11681174
ioc_err(mrioc,
@@ -2343,8 +2349,8 @@ static int mpi3mr_sync_timestamp(struct mpi3mr_ioc *mrioc)
23432349
ioc_err(mrioc, "Issue IOUCTL time_stamp: command timed out\n");
23442350
mrioc->init_cmds.is_waiting = 0;
23452351
if (!(mrioc->init_cmds.state & MPI3MR_CMD_RESET))
2346-
mpi3mr_soft_reset_handler(mrioc,
2347-
MPI3MR_RESET_FROM_TSU_TIMEOUT, 1);
2352+
mpi3mr_check_rh_fault_ioc(mrioc,
2353+
MPI3MR_RESET_FROM_TSU_TIMEOUT);
23482354
retval = -1;
23492355
goto out_unlock;
23502356
}
@@ -2856,6 +2862,7 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
28562862
le16_to_cpu(facts_data->max_pcie_switches);
28572863
mrioc->facts.max_sasexpanders =
28582864
le16_to_cpu(facts_data->max_sas_expanders);
2865+
mrioc->facts.max_data_length = le16_to_cpu(facts_data->max_data_length);
28592866
mrioc->facts.max_sasinitiators =
28602867
le16_to_cpu(facts_data->max_sas_initiators);
28612868
mrioc->facts.max_enclosures = le16_to_cpu(facts_data->max_enclosures);
@@ -2893,13 +2900,18 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
28932900
mrioc->facts.io_throttle_high =
28942901
le16_to_cpu(facts_data->io_throttle_high);
28952902

2903+
if (mrioc->facts.max_data_length ==
2904+
MPI3_IOCFACTS_MAX_DATA_LENGTH_NOT_REPORTED)
2905+
mrioc->facts.max_data_length = MPI3MR_DEFAULT_MAX_IO_SIZE;
2906+
else
2907+
mrioc->facts.max_data_length *= MPI3MR_PAGE_SIZE_4K;
28962908
/* Store in 512b block count */
28972909
if (mrioc->facts.io_throttle_data_length)
28982910
mrioc->io_throttle_data_length =
28992911
(mrioc->facts.io_throttle_data_length * 2 * 4);
29002912
else
29012913
/* set the length to 1MB + 1K to disable throttle */
2902-
mrioc->io_throttle_data_length = MPI3MR_MAX_SECTORS + 2;
2914+
mrioc->io_throttle_data_length = (mrioc->facts.max_data_length / 512) + 2;
29032915

29042916
mrioc->io_throttle_high = (mrioc->facts.io_throttle_high * 2 * 1024);
29052917
mrioc->io_throttle_low = (mrioc->facts.io_throttle_low * 2 * 1024);
@@ -2914,9 +2926,9 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
29142926
ioc_info(mrioc, "SGEModMask 0x%x SGEModVal 0x%x SGEModShift 0x%x ",
29152927
mrioc->facts.sge_mod_mask, mrioc->facts.sge_mod_value,
29162928
mrioc->facts.sge_mod_shift);
2917-
ioc_info(mrioc, "DMA mask %d InitialPE status 0x%x\n",
2929+
ioc_info(mrioc, "DMA mask %d InitialPE status 0x%x max_data_len (%d)\n",
29182930
mrioc->facts.dma_mask, (facts_flags &
2919-
MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK));
2931+
MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK), mrioc->facts.max_data_length);
29202932
ioc_info(mrioc,
29212933
"max_dev_per_throttle_group(%d), max_throttle_groups(%d)\n",
29222934
mrioc->facts.max_dev_per_tg, mrioc->facts.max_io_throttle_group);
@@ -3359,8 +3371,8 @@ int mpi3mr_process_event_ack(struct mpi3mr_ioc *mrioc, u8 event,
33593371
if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) {
33603372
ioc_err(mrioc, "Issue EvtNotify: command timed out\n");
33613373
if (!(mrioc->init_cmds.state & MPI3MR_CMD_RESET))
3362-
mpi3mr_soft_reset_handler(mrioc,
3363-
MPI3MR_RESET_FROM_EVTACK_TIMEOUT, 1);
3374+
mpi3mr_check_rh_fault_ioc(mrioc,
3375+
MPI3MR_RESET_FROM_EVTACK_TIMEOUT);
33643376
retval = -1;
33653377
goto out_unlock;
33663378
}
@@ -3414,7 +3426,14 @@ static int mpi3mr_alloc_chain_bufs(struct mpi3mr_ioc *mrioc)
34143426
if (!mrioc->chain_sgl_list)
34153427
goto out_failed;
34163428

3417-
sz = MPI3MR_PAGE_SIZE_4K;
3429+
if (mrioc->max_sgl_entries > (mrioc->facts.max_data_length /
3430+
MPI3MR_PAGE_SIZE_4K))
3431+
mrioc->max_sgl_entries = mrioc->facts.max_data_length /
3432+
MPI3MR_PAGE_SIZE_4K;
3433+
sz = mrioc->max_sgl_entries * sizeof(struct mpi3_sge_common);
3434+
ioc_info(mrioc, "number of sgl entries=%d chain buffer size=%dKB\n",
3435+
mrioc->max_sgl_entries, sz/1024);
3436+
34183437
mrioc->chain_buf_pool = dma_pool_create("chain_buf pool",
34193438
&mrioc->pdev->dev, sz, 16, 0);
34203439
if (!mrioc->chain_buf_pool) {
@@ -3813,7 +3832,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
38133832
}
38143833

38153834
mrioc->max_host_ios = mrioc->facts.max_reqs - MPI3MR_INTERNAL_CMDS_RESVD;
3816-
3835+
mrioc->shost->max_sectors = mrioc->facts.max_data_length / 512;
38173836
mrioc->num_io_throttle_group = mrioc->facts.max_io_throttle_group;
38183837
atomic_set(&mrioc->pend_large_data_sz, 0);
38193838

0 commit comments

Comments
 (0)