Skip to contentSkip to conversation

megaraid_sas : Jbod sequence number support

PATCH In review [email protected] 1 participant 1 message Aug 31, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 3/10 megaraid_sas : Jbod sequence number support

Implemented JBOD map which will provide quick access for JBOD path and also provide sequence number. This will help hardware to fail command to the FW in case of any sequence mismatch.

Fast Path IO for JBOD will refer JBOD map (which has sequence number per JBOD devices)
instead of Raid map. Earlier, driver use Raid map to get device handle for fast path IO,
which does not have sequence number information. Now, driver will use JBOD map for the same purpose. As part of error handling, if JBOD map is failed/not supported by firmware; driver will continue legacy behavior.

Now there will be three IO path for JBOD (syspd)

JBOD map with sequence number (Fast Path)
Raid map without sequence number (Fast Path)
FW path via h/w exceptional queue deliberately setup devhandle 0xFFFF (FW path).

Relevant data structures:
-Driver send new DCMD MR_DCMD_SYSTEM_PD_MAP_GET_INFO for this purpose.
-struct MR_PD_CFG_SEQ- This structure represent map of single physical device.
-struct MR_PD_CFG_SEQ_NUM_SYNC- This structure represent whole JBOD map in general(size, count of sysPDs configured,
struct MR_PD_CFG_SEQ of syspD with 0 index).

-JBOD sequnce map size is: sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1))
which is allocated while setting up JBOD map at driver load time.

---
 drivers/scsi/megaraid/megaraid_sas.h        |   13 +++-
 drivers/scsi/megaraid/megaraid_sas_base.c   |  100 +++++++++++++++++++++-
 drivers/scsi/megaraid/megaraid_sas_fusion.c |  126 ++++++++++++++++++++++++---
 drivers/scsi/megaraid/megaraid_sas_fusion.h |   19 ++++
 4 files changed, 242 insertions(+), 16 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +11 -2
index b0d373d..811fc4a 100644
@@ -973,7 +973,8 @@ struct megasas_ctrl_info {
 
 	struct {
 #if defined(__BIG_ENDIAN_BITFIELD)
-		u32     reserved:8;
+		u32     reserved:7;
+		u32     useSeqNumJbodFP:1;
 		u32     supportExtendedSSCSize:1;
 		u32     supportDiskCacheSettingForSysPDs:1;
 		u32     supportCPLDUpdate:1;
@@ -1021,7 +1022,8 @@ struct megasas_ctrl_info {
 		u32     supportCPLDUpdate:1;
 		u32     supportDiskCacheSettingForSysPDs:1;
 		u32     supportExtendedSSCSize:1;
-		u32     reserved:8;
+		u32     useSeqNumJbodFP:1;
+		u32     reserved:7;
 #endif
 	} adapterOperations3;
 
@@ -1700,6 +1702,7 @@ struct megasas_instance {
 	u32 crash_dump_drv_support;
 	u32 crash_dump_app_support;
 	u32 secure_jbod_support;
+	bool use_seqnum_jbod_fp;   /* Added for PD sequence */
 	spinlock_t crashdump_lock;
 
 	struct megasas_register_set __iomem *reg_set;
@@ -1779,7 +1782,9 @@ struct megasas_instance {
 	struct msix_entry msixentry[MEGASAS_MAX_MSIX_QUEUES];
 	struct megasas_irq_context irq_context[MEGASAS_MAX_MSIX_QUEUES];
 	u64 map_id;
+	u64 pd_seq_map_id;
 	struct megasas_cmd *map_update_cmd;
+	struct megasas_cmd *jbod_seq_cmd;
 	unsigned long bar;
 	long reset_flags;
 	struct mutex reset_mutex;
@@ -1995,6 +2000,9 @@ __le16 get_updated_dev_handle(struct megasas_instance *instance,
 void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *map,
 	struct LD_LOAD_BALANCE_INFO *lbInfo);
 int megasas_get_ctrl_info(struct megasas_instance *instance);
+/* PD sequence */
+int
+megasas_sync_pd_seq_num(struct megasas_instance *instance, bool pend);
 int megasas_set_crash_dump_params(struct megasas_instance *instance,
 	u8 crash_buf_state);
 void megasas_free_host_crash_buffer(struct megasas_instance *instance);
@@ -2010,5 +2018,6 @@ void __megasas_return_cmd(struct megasas_instance *instance,
 void megasas_return_mfi_mpt_pthr(struct megasas_instance *instance,
 	struct megasas_cmd *cmd_mfi, struct megasas_cmd_fusion *cmd_fusion);
 int megasas_cmd_type(struct scsi_cmnd *cmd);
+void megasas_setup_jbod_map(struct megasas_instance *instance);
 
 #endif				/*LSI_MEGARAID_SAS_H */
drivers/scsi/megaraid/megaraid_sas_base.c +99 -1

172 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fusion.c +113 -13

177 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fusion.h +19 -0
index be1be8e..41f3d8b 100644
@@ -89,6 +89,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE {
 #define MEGASAS_FP_CMD_LEN	16
 #define MEGASAS_FUSION_IN_RESET 0
 #define THRESHOLD_REPLY_COUNT 50
+#define JBOD_MAPS_COUNT	2
 
 /*
  * Raid Context structure which describes MegaRAID specific IO Parameters
@@ -487,6 +488,7 @@ struct MPI2_IOC_INIT_REQUEST {
 #define MAX_PHYSICAL_DEVICES 256
 #define MAX_RAIDMAP_PHYSICAL_DEVICES (MAX_PHYSICAL_DEVICES)
 #define MR_DCMD_LD_MAP_GET_INFO             0x0300e101
+#define MR_DCMD_SYSTEM_PD_MAP_GET_INFO      0x0200e102
 #define MR_DCMD_CTRL_SHARED_HOST_MEM_ALLOC  0x010e8485   /* SR-IOV HB alloc*/
 #define MR_DCMD_LD_VF_MAP_GET_ALL_LDS_111   0x03200200
 #define MR_DCMD_LD_VF_MAP_GET_ALL_LDS       0x03150200
@@ -790,6 +792,21 @@ struct MR_FW_RAID_MAP_EXT {
 	struct MR_LD_SPAN_MAP      ldSpanMap[MAX_LOGICAL_DRIVES_EXT];
 };
 
+/*
+ *  * define MR_PD_CFG_SEQ structure for system PDs
+ *   */
+struct MR_PD_CFG_SEQ {
+	__le16 seqNum;
+	__le16 devHandle;
+	u8  reserved[4];
+} __packed;
+
+struct MR_PD_CFG_SEQ_NUM_SYNC {
+	__le32 size;
+	__le32 count;
+	struct MR_PD_CFG_SEQ seq[1];
+} __packed;
+
 struct fusion_context {
 	struct megasas_cmd_fusion **cmd_list;
 	dma_addr_t req_frames_desc_phys;
@@ -829,6 +846,8 @@ struct fusion_context {
 	u32 current_map_sz;
 	u32 drv_map_sz;
 	u32 drv_map_pages;
+	struct MR_PD_CFG_SEQ_NUM_SYNC	*pd_seq_sync[JBOD_MAPS_COUNT];
+	dma_addr_t pd_seq_phys[JBOD_MAPS_COUNT];
 	u8 fast_path_io;
 	struct LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES_EXT];
 	LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES_EXT];
Signature · 1 line
1.7.1