Skip to contentSkip to conversation

megaraid_sas : Jbod sequence number support

PATCH Superseded [email protected] 2 participants 4 messages Aug 7, 2015 – Aug 13, 2015 SCSI

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 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).

Driver send new DCMD MR_DCMD_SYSTEM_PD_MAP_GET_INFO for this purpose.

---

megaraid_sas.h +19 -2
index 20c3754..45500ba 100644
@@ -973,7 +973,12 @@ struct megasas_ctrl_info {
 
 	struct {
 #if defined(__BIG_ENDIAN_BITFIELD)
-		u32     reserved:12;
+		u32     reserved:7;
+		u32     useSeqNumJbodFP:1;
+		u32     supportExtendedSSCSize:1;
+		u32     supportDiskCacheSettingForSysPDs:1;
+		u32     supportCPLDUpdate:1;
+		u32     supportTTYLogCompression:1;
 		u32     discardCacheDuringLDDelete:1;
 		u32     supportSecurityonJBOD:1;
 		u32     supportCacheBypassModes:1;
@@ -1013,7 +1018,12 @@ struct megasas_ctrl_info {
 		u32     supportCacheBypassModes:1;
 		u32     supportSecurityonJBOD:1;
 		u32     discardCacheDuringLDDelete:1;
-		u32     reserved:12;
+		u32     supportTTYLogCompression:1;
+		u32     supportCPLDUpdate:1;
+		u32     supportDiskCacheSettingForSysPDs:1;
+		u32     supportExtendedSSCSize:1;
+		u32     useSeqNumJbodFP:1;
+		u32     reserved:7;
 #endif
 	} adapterOperations3;
 
@@ -1690,6 +1700,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;
@@ -1769,7 +1780,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;
@@ -1985,6 +1998,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);
@@ -2000,5 +2016,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 */
megaraid_sas_base.c +104 -3

187 lines not on this page · raw message

megaraid_sas_fusion.c +113 -13

177 lines not on this page · raw message

megaraid_sas_fusion.h +18 -0
index ced6dc0..498d852 100644
@@ -486,6 +486,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
@@ -789,6 +790,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;
@@ -828,6 +844,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[2];
+	dma_addr_t pd_seq_phys[2];
 	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.8.3.1
#1 lore raw

Sumit,

@@ -973,7 +973,12 @@ struct megasas_ctrl_info {

struct {
#if defined(__BIG_ENDIAN_BITFIELD)

-		u32     reserved:12;
+		u32     reserved:7;
+		u32     useSeqNumJbodFP:1;
+		u32     supportExtendedSSCSize:1;
+		u32     supportDiskCacheSettingForSysPDs:1;
+		u32     supportCPLDUpdate:1;
+		u32     supportTTYLogCompression:1;
 		u32     discardCacheDuringLDDelete:1;
 		u32     supportSecurityonJBOD:1;
 		u32     supportCacheBypassModes:1;
@@ -1013,7 +1018,12 @@ struct megasas_ctrl_info {
 		u32     supportCacheBypassModes:1;
 		u32     supportSecurityonJBOD:1;
 		u32     discardCacheDuringLDDelete:1;
-		u32     reserved:12;
+		u32     supportTTYLogCompression:1;
+		u32     supportCPLDUpdate:1;
+		u32     supportDiskCacheSettingForSysPDs:1;
+		u32     supportExtendedSSCSize:1;
+		u32     useSeqNumJbodFP:1;
+		u32     reserved:7;

#endif
} adapterOperations3;

Looks like most of these new flags should be in a separate patch.

@@ -4482,6 +4506,62 @@ megasas_destroy_irqs(struct megasas_instance *instance) {
}

/**
+ * megasas_setup_jbod_map - setup jbod map for FP seq_number.
+ * @instance: Adapter soft state
+ * @is_probe: Driver probe check
+ *
+ * Return 0 on success.
+ */
+void
+megasas_setup_jbod_map(struct megasas_instance *instance) +{
+ int i;
+ struct fusion_context *fusion = instance->ctrl_context;
+ u32 pd_seq_map_sz;
+
+ pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
+ (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1));

Why -1 here? Presumably MAX_PHYSICAL_DEVICES is a count, not an index.

+
+ if (reset_devices || !fusion ||
+ !instance->ctrl_info->adapterOperations3.useSeqNumJbodFP) {
+ dev_info(&instance->pdev->dev,
+ "Jbod map is not supported %s %d\n",
+ __func__, __LINE__);
+ instance->use_seqnum_jbod_fp = 0;

Nitpick: It's a bool so use false. Occurs throughout the patch.

+ return;
+ }
+
+ if (fusion->pd_seq_sync[0])
+ goto skip_alloc;
+
+ for (i = 0; i < 2; i++) {

Magic number. See comment below.

@@ -5510,10 +5594,16 @@ static void megasas_shutdown_controller(struct megasas_instance *instance,

if (instance->aen_cmd)
megasas_issue_blocked_abort_cmd(instance,
- instance->aen_cmd, 30);
+ instance->aen_cmd,
+ MEGASAS_BLOCKED_CMD_TIMEOUT);
if (instance->map_update_cmd)
megasas_issue_blocked_abort_cmd(instance,
- instance->map_update_cmd, 30);
+ instance->map_update_cmd,
+ MEGASAS_BLOCKED_CMD_TIMEOUT);
+ if (instance->jbod_seq_cmd)
+ megasas_issue_blocked_abort_cmd(instance,
+ instance->jbod_seq_cmd,
+ MEGASAS_BLOCKED_CMD_TIMEOUT);
dcmd = &cmd->frame->dcmd;

Nice cleanup but ideally those non-jbod timeouts would have been in a separate patch. Please make sure your patches only do what they purport to do.

memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
@@ -5648,6 +5738,7 @@ megasas_resume(struct pci_dev *pdev)
}
if (!megasas_get_map_info(instance))
megasas_sync_map_info(instance);
+
}
break;
default:

Whitespace snafu.

@@ -5781,6 +5874,9 @@ static void megasas_detach_one(struct pci_dev *pdev)
case PCI_DEVICE_ID_LSI_INVADER:
case PCI_DEVICE_ID_LSI_FURY:
megasas_release_fusion(instance);
+ pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
+ (sizeof(struct MR_PD_CFG_SEQ) *
+ (MAX_PHYSICAL_DEVICES - 1));
for (i = 0; i < 2 ; i++) {
if (fusion->ld_map[i])
dma_free_coherent(&instance->pdev->dev,

Minus one again.

+ pd_sync = (void *)fusion->pd_seq_sync[(instance->pd_seq_map_id & 1)];
+ pd_seq_h = fusion->pd_seq_phys[(instance->pd_seq_map_id & 1)];
+ pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
+ (sizeof(struct MR_PD_CFG_SEQ) *
+ (MAX_PHYSICAL_DEVICES - 1));

Patch description could do with a description of the data structures you set up.

+ /*Want to send all IO via FW path*/

Comment needs spaces.

@@ -828,6 +844,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[2];
+ dma_addr_t pd_seq_phys[2];

Please define a suitable constant for 2 and use it in the code.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
Quoted 41 lines

-----Original Message-----
From: Martin K. Petersen [mailto:[email protected]]
Sent: Wednesday, August 12, 2015 6:59 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/7] megaraid_sas : Jbod sequence number support

Sumit,

megaraid_sas.h +12 -2
@@ -973,7 +973,12 @@ struct megasas_ctrl_info {
 
 	struct {
 #if defined(__BIG_ENDIAN_BITFIELD)
-		u32     reserved:12;
+		u32     reserved:7;
+		u32     useSeqNumJbodFP:1;
+		u32     supportExtendedSSCSize:1;
+		u32     supportDiskCacheSettingForSysPDs:1;
+		u32     supportCPLDUpdate:1;
+		u32     supportTTYLogCompression:1;
 		u32     discardCacheDuringLDDelete:1;
 		u32     supportSecurityonJBOD:1;
 		u32     supportCacheBypassModes:1;
@@ -1013,7 +1018,12 @@ struct megasas_ctrl_info {
 		u32     supportCacheBypassModes:1;
 		u32     supportSecurityonJBOD:1;
 		u32     discardCacheDuringLDDelete:1;
-		u32     reserved:12;
+		u32     supportTTYLogCompression:1;
+		u32     supportCPLDUpdate:1;
+		u32     supportDiskCacheSettingForSysPDs:1;
+		u32     supportExtendedSSCSize:1;
+		u32     useSeqNumJbodFP:1;
+		u32     reserved:7;
 #endif
 	} adapterOperations3;
 
Quoted 1 line

Looks like most of these new flags should be in a separate patch.

I will create separate patch for these new flags which are not related to JBOD sequence support. These flags are created to keep APIs in sync across driver and firmware.

Quoted 21 lines
megaraid_sas_base.c +14 -0
@@ -4482,6 +4506,62 @@ megasas_destroy_irqs(struct megasas_instance
 *instance) {  }
 
 /**
+ * megasas_setup_jbod_map -	setup jbod map for FP seq_number.
+ * @instance:				Adapter soft state
+ * @is_probe:				Driver probe check
+ *
+ * Return 0 on success.
+ */
+void
+megasas_setup_jbod_map(struct megasas_instance *instance) {
+	int i;
+	struct fusion_context *fusion = instance->ctrl_context;
+	u32 pd_seq_map_sz;
+
+	pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
+		(sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES -
 1));
 
Quoted 1 line

Why -1 here? Presumably MAX_PHYSICAL_DEVICES is a count, not an index.

Yes it is count only. struct MR_PD_CFG_SEQ_NUM_SYNC has "struct MR_PD_CFG_SEQ" as one of its member so struct MR_PD_CFG_SEQ corresponding to PD index "0" is embedded inside struct MR_PD_CFG_SEQ_NUM_SYNC. That's why -1 here.

megaraid_sas_base.c megasas_destroy_irqs(struct megasas_instance *instance) {

Quoted 4 lines
megaraid_sas_base.c +3 -0
+
+	if (reset_devices || !fusion ||
+		!instance->ctrl_info->adapterOperations3.useSeqNumJbodFP)

{

Quoted 6 lines
megaraid_sas_base.c +4 -0
+		dev_info(&instance->pdev->dev,
+			"Jbod map is not supported %s %d\n",
+			__func__, __LINE__);
+		instance->use_seqnum_jbod_fp = 0;

Nitpick: It's a bool so use false. Occurs throughout the patch.

Agree, will do this.

Quoted 30 lines
megaraid_sas_base.c +7 -0
+		return;
+	}
+
+	if (fusion->pd_seq_sync[0])
+		goto skip_alloc;
+
+	for (i = 0; i < 2; i++) {

Magic number. See comment below.

megaraid_sas_base.c +8 -2
@@ -5510,10 +5594,16 @@ static void megasas_shutdown_controller(struct
 megasas_instance *instance,
 
 	if (instance->aen_cmd)
 		megasas_issue_blocked_abort_cmd(instance,
-			instance->aen_cmd, 30);
+			instance->aen_cmd,
+			MEGASAS_BLOCKED_CMD_TIMEOUT);
 	if (instance->map_update_cmd)
 		megasas_issue_blocked_abort_cmd(instance,
-			instance->map_update_cmd, 30);
+			instance->map_update_cmd,
+			MEGASAS_BLOCKED_CMD_TIMEOUT);
+	if (instance->jbod_seq_cmd)
+		megasas_issue_blocked_abort_cmd(instance,
+			instance->jbod_seq_cmd,
+			MEGASAS_BLOCKED_CMD_TIMEOUT);
 	dcmd = &cmd->frame->dcmd;
 
Quoted 1 line

Nice cleanup but ideally those non-jbod timeouts would have been in a

separate

Quoted 1 line

patch. Please make sure your patches only do what they purport to do.

Agree, will create separate patch.

Quoted 12 lines

memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); @@ -5648,6 +5738,7 @@
megasas_resume(struct pci_dev *pdev)

megaraid_sas_base.c +1 -0
 		}
 		if (!megasas_get_map_info(instance))
 			megasas_sync_map_info(instance);
+
 	}
 	break;
 	default:
Quoted 1 line

Whitespace snafu.

Oops.. My bad. Will work on it.

Quoted 14 lines
megaraid_sas_base.c +1 -0
@@ -5781,6 +5874,9 @@ static void megasas_detach_one(struct pci_dev
 *pdev)
 	case PCI_DEVICE_ID_LSI_INVADER:
 	case PCI_DEVICE_ID_LSI_FURY:
 		megasas_release_fusion(instance);
+			pd_seq_map_sz = sizeof(struct

MR_PD_CFG_SEQ_NUM_SYNC) +

megaraid_sas_base.c +2 -0
+				(sizeof(struct MR_PD_CFG_SEQ) *
+					(MAX_PHYSICAL_DEVICES - 1));
 		for (i = 0; i < 2 ; i++) {
 			if (fusion->ld_map[i])
 				dma_free_coherent(&instance->pdev->dev,
Quoted 1 line

Minus one again.

Explained above.

Quoted 9 lines
(quoted diff) +1 -0
+	pd_sync = (void *)fusion->pd_seq_sync[(instance->pd_seq_map_id &

1)];

megaraid_sas_fusion.c +4 -0
+	pd_seq_h = fusion->pd_seq_phys[(instance->pd_seq_map_id & 1)];
+	pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
+			(sizeof(struct MR_PD_CFG_SEQ) *
+			(MAX_PHYSICAL_DEVICES - 1));

Patch description could do with a description of the data structures you

set up.
Had given high level description of what patch does. Will rework to provide description of data structures used in patch as well.

Quoted 5 lines
megaraid_sas_fusion.c +1 -0
+		/*Want to send all IO via FW path*/

Comment needs spaces.

I will work on this.

Quoted 9 lines
megaraid_sas_fusion.h +2 -0
@@ -828,6 +844,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[2];
+	dma_addr_t pd_seq_phys[2];
 

Please define a suitable constant for 2 and use it in the code.

Sure, will use a suitable macro for 2 and resend patch.

Quoted 3 lines

--
Martin K. Petersen Oracle Linux Engineering

#3 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Sumit" == Sumit Saxena <[email protected]> writes:

Sumit> I will create separate patch for these new flags which are not Sumit> related to JBOD sequence support. These flags are created to keep Sumit> APIs in sync across driver and firmware.

*nod*

Quoted 2 lines
Quoted 2 lines

Why -1 here? Presumably MAX_PHYSICAL_DEVICES is a count, not an index.

Sumit> Yes it is count only. struct MR_PD_CFG_SEQ_NUM_SYNC has "struct Sumit> MR_PD_CFG_SEQ" as one of its member so struct MR_PD_CFG_SEQ Sumit> corresponding to PD index "0" is embedded inside struct Sumit> MR_PD_CFG_SEQ_NUM_SYNC. That's why -1 here.

OK. Just checking.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering