Commit 9640d57d authored by Martin K. Petersen's avatar Martin K. Petersen
Browse files

Merge patch series "mpi3mr: Few Enhancements and minor fixes"

Ranjan Kumar <ranjan.kumar@broadcom.com> says:

Few Enhancements and minor fixes of mpi3mr driver.

Link: https://lore.kernel.org/r/20230804104248.118924-1-ranjan.kumar@broadcom.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents dded1dc3 9a9068b2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1482,7 +1482,7 @@ struct mpi3_security_page0 {
#define MPI3_SECURITY1_KEY_RECORD_MAX      1
#endif
#ifndef MPI3_SECURITY1_PAD_MAX
#define MPI3_SECURITY1_PAD_MAX      1
#define MPI3_SECURITY1_PAD_MAX      4
#endif
union mpi3_security1_key_data {
	__le32                             dword[128];
+1 −0
Original line number Diff line number Diff line
@@ -600,6 +600,7 @@ struct mpi3_event_data_pcie_error_threshold {
	__le16                                 threshold_count;
	__le16                                 attached_dev_handle;
	__le16                                 reserved12;
	__le32                                 reserved14;
};

#define MPI3_EVENT_PCI_ERROR_RC_THRESHOLD_EXCEEDED          (0x00)
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ union mpi3_version_union {

#define MPI3_VERSION_MAJOR                                              (3)
#define MPI3_VERSION_MINOR                                              (0)
#define MPI3_VERSION_UNIT                                               (27)
#define MPI3_VERSION_UNIT                                               (28)
#define MPI3_VERSION_DEV                                                (0)
#define MPI3_DEVHANDLE_INVALID                                          (0xffff)
struct mpi3_sysif_oper_queue_indexes {
+19 −4
Original line number Diff line number Diff line
@@ -55,8 +55,8 @@ extern struct list_head mrioc_list;
extern int prot_mask;
extern atomic64_t event_counter;

#define MPI3MR_DRIVER_VERSION	"8.4.1.0.0"
#define MPI3MR_DRIVER_RELDATE	"16-March-2023"
#define MPI3MR_DRIVER_VERSION	"8.5.0.0.0"
#define MPI3MR_DRIVER_RELDATE	"24-July-2023"

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

#define MPI3MR_MAX_SECTORS	2048
#define MPI3MR_DEFAULT_MAX_IO_SIZE	(1 * 1024 * 1024)

/* Definitions for internal SGL and Chain SGL buffers */
#define MPI3MR_PAGE_SIZE_4K		4096
#define MPI3MR_SG_DEPTH		(MPI3MR_PAGE_SIZE_4K / sizeof(struct mpi3_sge_common))
#define MPI3MR_DEFAULT_SGL_ENTRIES	256
#define MPI3MR_MAX_SGL_ENTRIES		2048

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

#define MPI3MR_WRITE_SAME_MAX_LEN_256_BLKS 256
#define MPI3MR_WRITE_SAME_MAX_LEN_2048_BLKS 2048

/**
 * struct mpi3mr_nvme_pt_sge -  Structure to store SGEs for NVMe
 * Encapsulated commands.
@@ -323,6 +327,7 @@ struct mpi3mr_ioc_facts {
	u16 max_perids;
	u16 max_pds;
	u16 max_sasexpanders;
	u32 max_data_length;
	u16 max_sasinitiators;
	u16 max_enclosures;
	u16 max_pcie_switches;
@@ -676,6 +681,7 @@ enum mpi3mr_dev_state {
 * @io_unit_port: IO Unit port ID
 * @non_stl: Is this device not to be attached with SAS TL
 * @io_throttle_enabled: I/O throttling needed or not
 * @wslen: Write same max length
 * @q_depth: Device specific Queue Depth
 * @wwid: World wide ID
 * @enclosure_logical_id: Enclosure logical identifier
@@ -698,6 +704,7 @@ struct mpi3mr_tgt_dev {
	u8 io_unit_port;
	u8 non_stl;
	u8 io_throttle_enabled;
	u16 wslen;
	u16 q_depth;
	u64 wwid;
	u64 enclosure_logical_id;
@@ -751,6 +758,8 @@ static inline void mpi3mr_tgtdev_put(struct mpi3mr_tgt_dev *s)
 * @dev_removed: Device removed in the Firmware
 * @dev_removedelay: Device is waiting to be removed in FW
 * @dev_type: Device type
 * @dev_nvme_dif: Device is NVMe DIF enabled
 * @wslen: Write same max length
 * @io_throttle_enabled: I/O throttling needed or not
 * @io_divert: Flag indicates io divert is on or off for the dev
 * @throttle_group: Pointer to throttle group info
@@ -767,6 +776,8 @@ struct mpi3mr_stgt_priv_data {
	u8 dev_removed;
	u8 dev_removedelay;
	u8 dev_type;
	u8 dev_nvme_dif;
	u16 wslen;
	u8 io_throttle_enabled;
	u8 io_divert;
	struct mpi3mr_throttle_group_info *throttle_group;
@@ -782,12 +793,14 @@ struct mpi3mr_stgt_priv_data {
 * @ncq_prio_enable: NCQ priority enable for SATA device
 * @pend_count: Counter to track pending I/Os during error
 *		handling
 * @wslen: Write same max length
 */
struct mpi3mr_sdev_priv_data {
	struct mpi3mr_stgt_priv_data *tgt_priv_data;
	u32 lun_id;
	u8 ncq_prio_enable;
	u32 pend_count;
	u16 wslen;
};

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

	u32 chain_buf_count;
	struct dma_pool *chain_buf_pool;
+28 −9
Original line number Diff line number Diff line
@@ -1163,6 +1163,12 @@ mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc)
		return -EPERM;
	}

	if (mrioc->shost->max_sectors != (mrioc->facts.max_data_length / 512))
		ioc_err(mrioc, "Warning: The maximum data transfer length\n"
			    "\tchanged after reset: previous(%d), new(%d),\n"
			    "the driver cannot change this at run time\n",
			    mrioc->shost->max_sectors * 512, mrioc->facts.max_data_length);

	if ((mrioc->sas_transport_enabled) && (mrioc->facts.ioc_capabilities &
	    MPI3_IOCFACTS_CAPABILITY_MULTIPATH_ENABLED))
		ioc_err(mrioc,
@@ -2343,8 +2349,8 @@ static int mpi3mr_sync_timestamp(struct mpi3mr_ioc *mrioc)
		ioc_err(mrioc, "Issue IOUCTL time_stamp: command timed out\n");
		mrioc->init_cmds.is_waiting = 0;
		if (!(mrioc->init_cmds.state & MPI3MR_CMD_RESET))
			mpi3mr_soft_reset_handler(mrioc,
			    MPI3MR_RESET_FROM_TSU_TIMEOUT, 1);
			mpi3mr_check_rh_fault_ioc(mrioc,
			    MPI3MR_RESET_FROM_TSU_TIMEOUT);
		retval = -1;
		goto out_unlock;
	}
@@ -2856,6 +2862,7 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
	    le16_to_cpu(facts_data->max_pcie_switches);
	mrioc->facts.max_sasexpanders =
	    le16_to_cpu(facts_data->max_sas_expanders);
	mrioc->facts.max_data_length = le16_to_cpu(facts_data->max_data_length);
	mrioc->facts.max_sasinitiators =
	    le16_to_cpu(facts_data->max_sas_initiators);
	mrioc->facts.max_enclosures = le16_to_cpu(facts_data->max_enclosures);
@@ -2893,13 +2900,18 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
	mrioc->facts.io_throttle_high =
	    le16_to_cpu(facts_data->io_throttle_high);

	if (mrioc->facts.max_data_length ==
	    MPI3_IOCFACTS_MAX_DATA_LENGTH_NOT_REPORTED)
		mrioc->facts.max_data_length = MPI3MR_DEFAULT_MAX_IO_SIZE;
	else
		mrioc->facts.max_data_length *= MPI3MR_PAGE_SIZE_4K;
	/* Store in 512b block count */
	if (mrioc->facts.io_throttle_data_length)
		mrioc->io_throttle_data_length =
		    (mrioc->facts.io_throttle_data_length * 2 * 4);
	else
		/* set the length to 1MB + 1K to disable throttle */
		mrioc->io_throttle_data_length = MPI3MR_MAX_SECTORS + 2;
		mrioc->io_throttle_data_length = (mrioc->facts.max_data_length / 512) + 2;

	mrioc->io_throttle_high = (mrioc->facts.io_throttle_high * 2 * 1024);
	mrioc->io_throttle_low = (mrioc->facts.io_throttle_low * 2 * 1024);
@@ -2914,9 +2926,9 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
	ioc_info(mrioc, "SGEModMask 0x%x SGEModVal 0x%x SGEModShift 0x%x ",
	    mrioc->facts.sge_mod_mask, mrioc->facts.sge_mod_value,
	    mrioc->facts.sge_mod_shift);
	ioc_info(mrioc, "DMA mask %d InitialPE status 0x%x\n",
	ioc_info(mrioc, "DMA mask %d InitialPE status 0x%x max_data_len (%d)\n",
	    mrioc->facts.dma_mask, (facts_flags &
	    MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK));
	    MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK), mrioc->facts.max_data_length);
	ioc_info(mrioc,
	    "max_dev_per_throttle_group(%d), max_throttle_groups(%d)\n",
	    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,
	if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) {
		ioc_err(mrioc, "Issue EvtNotify: command timed out\n");
		if (!(mrioc->init_cmds.state & MPI3MR_CMD_RESET))
			mpi3mr_soft_reset_handler(mrioc,
			    MPI3MR_RESET_FROM_EVTACK_TIMEOUT, 1);
			mpi3mr_check_rh_fault_ioc(mrioc,
			    MPI3MR_RESET_FROM_EVTACK_TIMEOUT);
		retval = -1;
		goto out_unlock;
	}
@@ -3414,7 +3426,14 @@ static int mpi3mr_alloc_chain_bufs(struct mpi3mr_ioc *mrioc)
	if (!mrioc->chain_sgl_list)
		goto out_failed;

	sz = MPI3MR_PAGE_SIZE_4K;
	if (mrioc->max_sgl_entries > (mrioc->facts.max_data_length /
		MPI3MR_PAGE_SIZE_4K))
		mrioc->max_sgl_entries = mrioc->facts.max_data_length /
			MPI3MR_PAGE_SIZE_4K;
	sz = mrioc->max_sgl_entries * sizeof(struct mpi3_sge_common);
	ioc_info(mrioc, "number of sgl entries=%d chain buffer size=%dKB\n",
			mrioc->max_sgl_entries, sz/1024);

	mrioc->chain_buf_pool = dma_pool_create("chain_buf pool",
	    &mrioc->pdev->dev, sz, 16, 0);
	if (!mrioc->chain_buf_pool) {
@@ -3813,7 +3832,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
	}

	mrioc->max_host_ios = mrioc->facts.max_reqs - MPI3MR_INTERNAL_CMDS_RESVD;

	mrioc->shost->max_sectors = mrioc->facts.max_data_length / 512;
	mrioc->num_io_throttle_group = mrioc->facts.max_io_throttle_group;
	atomic_set(&mrioc->pend_large_data_sz, 0);

Loading