Skip to contentSkip to conversation

megaraid_sas : Support for max_io_size 1MB

PATCH Superseded [email protected] 2 participants 3 messages Aug 7, 2015 – Aug 12, 2015 SCSI

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/7 megaraid_sas : Support for max_io_size 1MB

Driver will expose max sge = 256 (earlier it was 64), if firmware support extended IO size upto 1M.

---

megaraid_sas.h +7 -2
index 45500ba..5db31c6 100644
@@ -1239,7 +1239,9 @@ union megasas_sgl_frame {
 typedef union _MFI_CAPABILITIES {
 	struct {
 #if   defined(__BIG_ENDIAN_BITFIELD)
-		u32     reserved:25;
+		u32     reserved:23;
+		u32     support_ext_io_size:1;
+		u32	support_ext_queue_depth:1;
 		u32     security_protocol_cmds_fw:1;
 		u32     support_core_affinity:1;
 		u32     support_ndrive_r1_lb:1;
@@ -1255,7 +1257,9 @@ typedef union _MFI_CAPABILITIES {
 		u32     support_ndrive_r1_lb:1;
 		u32     support_core_affinity:1;
 		u32     security_protocol_cmds_fw:1;
-		u32     reserved:25;
+		u32	support_ext_queue_depth:1;
+		u32     support_ext_io_size:1;
+		u32     reserved:23;
 #endif
 	} mfi_capabilities;
 	__le32		reg;
@@ -1793,6 +1797,7 @@ struct megasas_instance {
 	char mpio;
 	u16 throttlequeuedepth;
 	u8 mask_interrupts;
+	u16 max_chain_frame_sz;
 	u8 is_imr;
 	bool dev_handle;
 };
megaraid_sas_fusion.c +53 -27

156 lines not on this page · raw message

megaraid_sas_fusion.h +8 -2
index 498d852..ead2c6a 100644
@@ -35,8 +35,12 @@
 #define _MEGARAID_SAS_FUSION_H_
 
 /* Fusion defines */
-#define MEGASAS_MAX_SZ_CHAIN_FRAME 1024
+#define MEGASAS_CHAIN_FRAME_SZ_MIN 1024
 #define MFI_FUSION_ENABLE_INTERRUPT_MASK (0x00000009)
+#define MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK	0x400000
+#define MEGASAS_MAX_CHAIN_SIZE_MASK		0x3E0
+#define MEGASAS_256K_IO				128
+#define MEGASAS_1MB_IO				(MEGASAS_256K_IO * 4)
 #define MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE 256
 #define MEGASAS_MPI2_FUNCTION_PASSTHRU_IO_REQUEST   0xF0
 #define MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST         0xF1
@@ -117,7 +121,9 @@ struct RAID_CONTEXT {
 	u8      numSGE;
 	__le16	configSeqNum;
 	u8      spanArm;
-	u8      resvd2[3];
+	u8      priority;
+	u8	numSGEExt;	/* 0x1E 1M IO support */
+	u8      resvd2;		/* 0x1F */
 };
 
 #define RAID_CTX_SPANARM_ARM_SHIFT	(0)
Signature · 1 line
1.8.3.1
#1 lore raw

Sumit,

@@ -1239,7 +1239,9 @@ union megasas_sgl_frame {
typedef union _MFI_CAPABILITIES {
struct {
#if defined(__BIG_ENDIAN_BITFIELD)

-		u32     reserved:25;
+		u32     reserved:23;
+		u32     support_ext_io_size:1;
+		u32	support_ext_queue_depth:1;
 		u32     security_protocol_cmds_fw:1;
 		u32     support_core_affinity:1;
 		u32     support_ndrive_r1_lb:1;
@@ -1255,7 +1257,9 @@ typedef union _MFI_CAPABILITIES {
 		u32     support_ndrive_r1_lb:1;
 		u32     support_core_affinity:1;
 		u32     security_protocol_cmds_fw:1;
-		u32     reserved:25;

+ u32 support_ext_queue_depth:1;
+ u32 support_ext_io_size:1;
+ u32 reserved:23;
#endif
} mfi_capabilities;
__le32 reg;

Mystery field: support_ext_queue_depth.

- fusion->sg_dma_pool = pci_pool_create("megasas sg pool fusion",

-					      instance->pdev,
-					      total_sz_chain_frame, 4,
-					      0);

+ fusion->sg_dma_pool = pci_pool_create("sg_pool_fusion", instance->pdev,
+ instance->max_chain_frame_sz,
+ 4, 0);
+

Why rename the pools? I don't particularly mind but megasas is probably more descriptive for most users than fusion is.

@@ -1096,15 +1093,40 @@ megasas_init_adapter_fusion(struct megasas_instance *instance)
(MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE *
(max_cmd + 1)); /* Extra 1 for SMID 0 */

+ scratch_pad_2 = readl(&instance->reg_set->outbound_scratch_pad_2);

scratch_pad_2 sounds like a pretty temporary thing rather than an officially exported interface. But I guess that's what it's called.

+ /* If scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK is set,
+ * Firmware support extended IO chain frame which is 4 time more

Nitpick: s/time/times/

+ if (scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK)
+ instance->max_chain_frame_sz =
+ ((scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_MASK) >> 5)
+ * MEGASAS_1MB_IO;

Magic number 5. Please define MEGASAS_MAX_CHAIN_SHIFT and use that.

@@ -117,7 +121,9 @@ struct RAID_CONTEXT {
u8 numSGE;
__le16 configSeqNum;

 	u8      spanArm;
-	u8      resvd2[3];
+	u8      priority;

+ u8 numSGEExt; /* 0x1E 1M IO support */
+ u8 resvd2; /* 0x1F */
};

Mystery priority addition.

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

-----Original Message-----
From: Martin K. Petersen [mailto:[email protected]]
Sent: Wednesday, August 12, 2015 7:29 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/7] megaraid_sas : Support for max_io_size 1MB

Sumit,

megaraid_sas.h +6 -2
@@ -1239,7 +1239,9 @@ union megasas_sgl_frame {  typedef union
 _MFI_CAPABILITIES {
 	struct {
 #if   defined(__BIG_ENDIAN_BITFIELD)
-		u32     reserved:25;
+		u32     reserved:23;
+		u32     support_ext_io_size:1;
+		u32	support_ext_queue_depth:1;
 		u32     security_protocol_cmds_fw:1;
 		u32     support_core_affinity:1;
 		u32     support_ndrive_r1_lb:1;
@@ -1255,7 +1257,9 @@ typedef union _MFI_CAPABILITIES {
 		u32     support_ndrive_r1_lb:1;
 		u32     support_core_affinity:1;
 		u32     security_protocol_cmds_fw:1;
-		u32     reserved:25;
+		u32	support_ext_queue_depth:1;
+		u32     support_ext_io_size:1;
+		u32     reserved:23;
 #endif
 	} mfi_capabilities;
 	__le32		reg;
Quoted 1 line

Mystery field: support_ext_queue_depth.

This is added to keep driver and firmware API naming in sync, will create separate patch for syncing drivers and firmware APIs changes.

Quoted 12 lines
megaraid_sas_fusion.c +1 -4
-	fusion->sg_dma_pool = pci_pool_create("megasas sg pool fusion",
-					      instance->pdev,
-					      total_sz_chain_frame, 4,
-					      0);
+	fusion->sg_dma_pool = pci_pool_create("sg_pool_fusion", instance-
Quoted 1 line

pdev,

(quoted diff) +1 -0
+						instance-
Quoted 1 line

max_chain_frame_sz,

megaraid_sas_fusion.c +2 -0
+						4, 0);
+
Quoted 1 line

Why rename the pools? I don't particularly mind but megasas is probably

more

Quoted 1 line

descriptive for most users than fusion is.

There are two types of controllers megasas drivers support- 1)MFI controllers 2)Fusion controllers so used "fusion" name here.

Quoted 9 lines
megaraid_sas_fusion.c +1 -0
@@ -1096,15 +1093,40 @@ megasas_init_adapter_fusion(struct
 megasas_instance *instance)
 		(MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE *
 		 (max_cmd + 1)); /* Extra 1 for SMID 0 */
 
+	scratch_pad_2 = readl(&instance->reg_set->outbound_scratch_pad_2);
 

scratch_pad_2 sounds like a pretty temporary thing rather than an

officially

Quoted 1 line

exported interface. But I guess that's what it's called.

Correct.

Quoted 5 lines
(quoted diff) +2 -0
+	/* If scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK is set,
+	 * Firmware support extended IO chain frame which is 4 time more

Nitpick: s/time/times/

Will rectify this:)

Quoted 8 lines
megaraid_sas_fusion.c +3 -0
+	if (scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK)
+		instance->max_chain_frame_sz =
+			((scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_MASK)
Quoted 1 line
Quoted 1 line

5)

megaraid_sas_fusion.c +1 -0
+					* MEGASAS_1MB_IO;

Magic number 5. Please define MEGASAS_MAX_CHAIN_SHIFT and use that.

Agree..will do this.

Quoted 11 lines
megaraid_sas_fusion.h +3 -1
@@ -117,7 +121,9 @@ struct RAID_CONTEXT {
 	u8      numSGE;
 	__le16	configSeqNum;
 	u8      spanArm;
-	u8      resvd2[3];
+	u8      priority;
+	u8	numSGEExt;	/* 0x1E 1M IO support */
+	u8      resvd2;		/* 0x1F */
 };
 
Quoted 1 line

Mystery priority addition.

Again this is to keep driver and firmware APIs in sync and will do all such changes in separate patch.

Quoted 3 lines

--
Martin K. Petersen Oracle Linux Engineering