Skip to contentSkip to conversation

megaraid_sas: Updates for scsi-next

PATCH Superseded Sasikumar Chandrasekaran 3 participants 19 messages Dec 23, 2016

Subsystems (2)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover megaraid_sas: Updates for scsi-next

Sasikumar Chandrasekaran (11):
megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: 128 MSIX Support
megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and
IO Coalescing
megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID

    1/10 Writes

megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers
Capabilities
megaraid_sas: Enable or Disable Fast path based on the PCI Threshold
Bandwidth
megaraid_sas: ldio_outstanding variable is not decremented in
completion path
megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: driver version upgrade

 drivers/scsi/megaraid/megaraid_sas.h        | 139 ++++--
 drivers/scsi/megaraid/megaraid_sas_base.c   | 240 +++++++--
 drivers/scsi/megaraid/megaraid_sas_fp.c     | 341 +++++++++++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 750 +++++++++++++++++++++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 364 ++++++++++++--
 5 files changed, 1557 insertions(+), 277 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v6 1/11 megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid Controllers

This patch contains new pci device ids for SAS3.5 Generic Megaraid Controllers

This Pacth is Same as V5

---
 drivers/scsi/megaraid/megaraid_sas.h        | 12 +++++++++---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 14 +++++++++++++-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 30 ++++++++++++++++++++++-------
 3 files changed, 45 insertions(+), 11 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +9 -3
index fdd519c..cb82195 100644
@@ -56,6 +56,11 @@
 #define PCI_DEVICE_ID_LSI_INTRUDER_24		0x00cf
 #define PCI_DEVICE_ID_LSI_CUTLASS_52		0x0052
 #define PCI_DEVICE_ID_LSI_CUTLASS_53		0x0053
+#define PCI_DEVICE_ID_LSI_VENTURA		    0x0014
+#define PCI_DEVICE_ID_LSI_HARPOON		    0x0016
+#define PCI_DEVICE_ID_LSI_TOMCAT		    0x0017
+#define PCI_DEVICE_ID_LSI_VENTURA_4PORT		0x001B
+#define PCI_DEVICE_ID_LSI_CRUSADER_4PORT	0x001C
 
 /*
  * Intel HBA SSDIDs
@@ -100,7 +105,7 @@
  */
 
 /*
- * MFI stands for  MegaRAID SAS FW Interface. This is just a moniker for 
+ * MFI stands for  MegaRAID SAS FW Interface. This is just a moniker for
  * protocol between the software and firmware. Commands are issued using
  * "message frames"
  */
@@ -1435,7 +1440,7 @@ enum FW_BOOT_CONTEXT {
 * register set for both 1068 and 1078 controllers
 * structure extended for 1078 registers
 */
- 
+
 struct megasas_register_set {
 	u32	doorbell;                       /*0000h*/
 	u32	fusion_seq_offset;		/*0004h*/
@@ -1478,7 +1483,7 @@ struct megasas_register_set {
 
 	u32 	inbound_high_queue_port ;	/*00C4h*/
 
-	u32 	reserved_5;			/*00C8h*/
+	u32 inbound_single_queue_port;	/*00C8h*/
 	u32	res_6[11];			/*CCh*/
 	u32	host_diag;
 	u32	seq_offset;
@@ -2142,6 +2147,7 @@ struct megasas_instance {
 	u8 is_rdpq;
 	bool dev_handle;
 	bool fw_sync_cache_support;
+	bool is_ventura;
 };
 struct MR_LD_VF_MAP {
 	u32 size;
drivers/scsi/megaraid/megaraid_sas_base.c +13 -1
index 6484c38..ea04fce 100644
@@ -155,6 +155,12 @@ static int megasas_register_aen(struct megasas_instance *instance,
 	/* Intruder 24 port*/
 	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CUTLASS_52)},
 	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CUTLASS_53)},
+	/* VENTURA */
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VENTURA)},
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_HARPOON)},
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_TOMCAT)},
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VENTURA_4PORT)},
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CRUSADER_4PORT)},
 	{}
 };
 
@@ -5714,6 +5720,12 @@ static int megasas_probe_one(struct pci_dev *pdev,
 	instance->pdev = pdev;
 
 	switch (instance->pdev->device) {
+	case PCI_DEVICE_ID_LSI_VENTURA:
+	case PCI_DEVICE_ID_LSI_HARPOON:
+	case PCI_DEVICE_ID_LSI_TOMCAT:
+	case PCI_DEVICE_ID_LSI_VENTURA_4PORT:
+	case PCI_DEVICE_ID_LSI_CRUSADER_4PORT:
+	     instance->is_ventura = true;
 	case PCI_DEVICE_ID_LSI_FUSION:
 	case PCI_DEVICE_ID_LSI_PLASMA:
 	case PCI_DEVICE_ID_LSI_INVADER:
@@ -5738,7 +5750,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 		if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) ||
 			(instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA))
 			fusion->adapter_type = THUNDERBOLT_SERIES;
-		else
+		else if (!instance->is_ventura)
 			fusion->adapter_type = INVADER_SERIES;
 	}
 	break;
drivers/scsi/megaraid/megaraid_sas_fusion.c +23 -7
index 24778ba..8d7a397 100644
@@ -189,15 +189,29 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance,
  */
 static void
 megasas_fire_cmd_fusion(struct megasas_instance *instance,
-		union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc)
+	union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc, bool is_32bit)
 {
+	struct megasas_register_set __iomem *regs = instance->reg_set;
+	unsigned long flags;
+
+	if (is_32bit)
+		writel(le32_to_cpu(req_desc->u.low),
+			&(regs)->inbound_single_queue_port);
+	else if (instance->is_ventura) {
+		spin_lock_irqsave(&instance->hba_lock, flags);
+		writel(le32_to_cpu(req_desc->u.low),
+			&(regs)->inbound_low_queue_port);
+		writel(le32_to_cpu(req_desc->u.high),
+			&(regs)->inbound_high_queue_port);
+		mmiowb();
+		spin_unlock_irqrestore(&instance->hba_lock, flags);
+	} else {
 #if defined(writeq) && defined(CONFIG_64BIT)
 	u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) |
 			le32_to_cpu(req_desc->u.low));
 
 	writeq(req_data, &instance->reg_set->inbound_low_queue_port);
 #else
-	unsigned long flags;
 
 	spin_lock_irqsave(&instance->hba_lock, flags);
 	writel(le32_to_cpu(req_desc->u.low),
@@ -207,6 +221,7 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance,
 	mmiowb();
 	spin_unlock_irqrestore(&instance->hba_lock, flags);
 #endif
+	}
 }
 
 /**
@@ -850,7 +865,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
 			break;
 	}
 
-	megasas_fire_cmd_fusion(instance, &req_desc);
+	megasas_fire_cmd_fusion(instance, &req_desc, false);
 
 	wait_and_poll(instance, cmd, MFI_POLL_TIMEOUT_SECS);
 
@@ -2224,7 +2239,7 @@ static void megasas_build_ld_nonrw_fusion(struct megasas_instance *instance,
 	 */
 	atomic_inc(&instance->fw_outstanding);
 
-	megasas_fire_cmd_fusion(instance, req_desc);
+	megasas_fire_cmd_fusion(instance, req_desc, instance->is_ventura);
 
 	return 0;
 }
@@ -2595,7 +2610,7 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
 		return DCMD_NOT_FIRED;
 	}
 
-	megasas_fire_cmd_fusion(instance, req_desc);
+	megasas_fire_cmd_fusion(instance, req_desc, instance->is_ventura);
 	return DCMD_SUCCESS;
 }
 
@@ -2888,7 +2903,8 @@ void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
 				cpu_to_le32(MR_DCMD_SYSTEM_PD_MAP_GET_INFO)))
 				&& !(cmd_mfi->flags & DRV_DCMD_SKIP_REFIRE);
 		if (refire_cmd)
-			megasas_fire_cmd_fusion(instance, req_desc);
+			megasas_fire_cmd_fusion(instance, req_desc,
+							instance->is_ventura);
 		else
 			megasas_return_cmd(instance, cmd_mfi);
 	}
@@ -3067,7 +3083,7 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
 		mr_request->tmReqFlags.isTMForLD = 1;
 
 	init_completion(&cmd_fusion->done);
-	megasas_fire_cmd_fusion(instance, req_desc);
+	megasas_fire_cmd_fusion(instance, req_desc, instance->is_ventura);
 
 	timeleft = wait_for_completion_timeout(&cmd_fusion->done, 50 * HZ);
 
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v6 2/11 megaraid_sas: 128 MSIX Support

In reply to Sasikumar Chandrasekaran

SAS3.5 Generic Megaraid based Controllers will have the support for 128 MSI-X vectors, resulting in the need to support 128 reply queues

This patch is depending on patch 1 and same as V5

---
 drivers/scsi/megaraid/megaraid_sas.h        |  1 +
 drivers/scsi/megaraid/megaraid_sas_base.c   | 25 ++++++++++++++++++-------
 drivers/scsi/megaraid/megaraid_sas_fusion.c |  4 ++--
 3 files changed, 21 insertions(+), 9 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +1 -0
index cb82195..36aac88 100644
@@ -2148,6 +2148,7 @@ struct megasas_instance {
 	bool dev_handle;
 	bool fw_sync_cache_support;
 	bool is_ventura;
+	bool msix_combined;
 };
 struct MR_LD_VF_MAP {
 	u32 size;
drivers/scsi/megaraid/megaraid_sas_base.c +18 -7
index ea04fce..5a1a53b 100644
@@ -5072,13 +5072,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 			goto fail_ready_state;
 	}
 
-	/*
-	 * MSI-X host index 0 is common for all adapter.
-	 * It is used for all MPT based Adapters.
-	 */
-	instance->reply_post_host_index_addr[0] =
-		(u32 __iomem *)((u8 __iomem *)instance->reg_set +
-		MPI2_REPLY_POST_HOST_INDEX_OFFSET);
+
 
 	/* Check if MSI-X is supported while in ready state */
 	msix_enable = (instance->instancet->read_fw_status_reg(reg_set) &
@@ -5098,6 +5092,9 @@ static int megasas_init_fw(struct megasas_instance *instance)
 				instance->msix_vectors = ((scratch_pad_2
 					& MR_MAX_REPLY_QUEUES_EXT_OFFSET)
 					>> MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT) + 1;
+				if (instance->msix_vectors > 16)
+					instance->msix_combined = true;
+
 				if (rdpq_enable)
 					instance->is_rdpq = (scratch_pad_2 & MR_RDPQ_MODE_OFFSET) ?
 								1 : 0;
@@ -5131,6 +5128,20 @@ static int megasas_init_fw(struct megasas_instance *instance)
 		else
 			instance->msix_vectors = 0;
 	}
+	/*
+	 * MSI-X host index 0 is common for all adapter.
+	 * It is used for all MPT based Adapters.
+	 */
+	if (instance->msix_combined) {
+		instance->reply_post_host_index_addr[0] =
+				(u32 *)((u8 *)instance->reg_set +
+				MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET);
+	} else {
+		instance->reply_post_host_index_addr[0] =
+			(u32 *)((u8 *)instance->reg_set +
+			MPI2_REPLY_POST_HOST_INDEX_OFFSET);
+	}
+
 	i = pci_alloc_irq_vectors(instance->pdev, 1, 1, PCI_IRQ_LEGACY);
 	if (i < 0)
 		goto fail_setup_irqs;
drivers/scsi/megaraid/megaraid_sas_fusion.c +2 -2
index 8d7a397..413e2030 100644
@@ -2391,7 +2391,7 @@ static void megasas_build_ld_nonrw_fusion(struct megasas_instance *instance,
 		 * pending to be completed
 		 */
 		if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) {
-			if (fusion->adapter_type == INVADER_SERIES)
+			if (instance->msix_combined)
 				writel(((MSIxIndex & 0x7) << 24) |
 					fusion->last_reply_idx[MSIxIndex],
 					instance->reply_post_host_index_addr[MSIxIndex/8]);
@@ -2407,7 +2407,7 @@ static void megasas_build_ld_nonrw_fusion(struct megasas_instance *instance,
 		return IRQ_NONE;
 
 	wmb();
-	if (fusion->adapter_type == INVADER_SERIES)
+	if (instance->msix_combined)
 		writel(((MSIxIndex & 0x7) << 24) |
 			fusion->last_reply_idx[MSIxIndex],
 			instance->reply_post_host_index_addr[MSIxIndex/8]);
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v6 3/11 megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid Controllers

In reply to Sasikumar Chandrasekaran

An UNMAP command on a PI formatted device will leave the Logical Block Application Tag and Logical Block Reference Tag as all F's (for those LBAs that are unmapped). To avoid IO errors if those LBAs are subsequently read before they are written with valid tag fields, the MPI SCSI IO requests need to set the EEDPFlags element EEDP Escape Mode field, Bits [7:6] appropriately. A value of 2 should be set to disable all PI checks if the Logical Block Application Tag is 0xFFFF for PI types 1 and 2. A value of 3 should be set to disable all PI checks if the Logical Block Application Tag is 0xFFFF and the Logical Block Reference Tag is 0xFFFFFFFF for PI type 3.

This patch is depending on patch 2 and same as V5

---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 1 +
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 ++
 2 files changed, 3 insertions(+)
drivers/scsi/megaraid/megaraid_sas_fusion.c +1 -0
index 413e2030..fe69c4a 100644
@@ -1589,6 +1589,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
 				MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
 				MPI2_SCSIIO_EEDPFLAGS_CHECK_REMOVE_OP |
 				MPI2_SCSIIO_EEDPFLAGS_CHECK_APPTAG |
+				MPI25_SCSIIO_EEDPFLAGS_DO_NOT_DISABLE_MODE |
 				MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD);
 		} else {
 			io_request->EEDPFlags = cpu_to_le16(
drivers/scsi/megaraid/megaraid_sas_fusion.h +2 -0
index e3bee04..9d22ade 100644
@@ -175,6 +175,8 @@ enum REGION_TYPE {
 #define MPI2_SCSIIO_EEDPFLAGS_CHECK_APPTAG          (0x0200)
 #define MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD           (0x0100)
 #define MPI2_SCSIIO_EEDPFLAGS_INSERT_OP             (0x0004)
+/* EEDP escape mode */
+#define MPI25_SCSIIO_EEDPFLAGS_DO_NOT_DISABLE_MODE  (0x0040)
 #define MPI2_FUNCTION_SCSI_IO_REQUEST               (0x00) /* SCSI IO */
 #define MPI2_FUNCTION_SCSI_TASK_MGMT                (0x01)
 #define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY       (0x03)
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v6 4/11 megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and IO Coalescing

In reply to Sasikumar Chandrasekaran

Detect sequential IO streams and pass those IOs directly to FW.

This patch is depending on patch 3

Few code indentation issues fixed

---
 drivers/scsi/megaraid/megaraid_sas.h        |   1 +
 drivers/scsi/megaraid/megaraid_sas_base.c   |  43 +++++++-
 drivers/scsi/megaraid/megaraid_sas_fp.c     |   2 +
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 164 +++++++++++++++++++++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 117 +++++++++++++++++++-
 5 files changed, 296 insertions(+), 31 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +1 -0
index 36aac88..3d86bc6 100644
@@ -2070,6 +2070,7 @@ struct megasas_instance {
 	/* used to sync fire the cmd to fw */
 	spinlock_t hba_lock;
 	/* used to synch producer, consumer ptrs in dpc */
+	spinlock_t stream_lock;
 	spinlock_t completion_lock;
 	struct dma_pool *frame_dma_pool;
 	struct dma_pool *sense_dma_pool;
drivers/scsi/megaraid/megaraid_sas_base.c +42 -1

73 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fp.c +2 -0
index f237d00..a4e213b 100644
@@ -935,6 +935,8 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 
 	ld = MR_TargetIdToLdGet(ldTgtId, map);
 	raid = MR_LdRaidGet(ld, map);
+	/*check read ahead bit*/
+	io_info->ra_capable = raid->capability.ra_capable;
 
 	/*
 	 * if rowDataSize @RAID map and spanRowDataSize @SPAN INFO are zero
drivers/scsi/megaraid/megaraid_sas_fusion.c +137 -27

279 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fusion.h +114 -3

162 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#6 lore raw

Re: [PATCH V6 04/11] megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and IO Coalescing

reproduce:

Hi Sasikumar,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on next-20161223]
[cannot apply to v4.9]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sasikumar-Chandrasekaran/megaraid_sas-Updates-for-scsi-next/20161223-103256
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-ne0-12231250 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from drivers/scsi/megaraid/megaraid_sas_fusion.c:34:
drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 'megasas_stream_detect':
include/linux/compiler.h:149:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]

     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
>> drivers/scsi/megaraid/megaraid_sas_fusion.c:1744:3: note: in expansion of macro 'if'
      if ((io_info->ldStartBlock != current_sd->next_seq_lba)
      ^~
   drivers/scsi/megaraid/megaraid_sas_fusion.c:1751:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
       cmd->io_request->RaidContext.raid_context_g35.stream_detected = true;
       ^~~

vim +/if +1744 drivers/scsi/megaraid/megaraid_sas_fusion.c

1728 struct STREAM_DETECT *current_sd;
1729 /* find possible stream */
1730 for (i = 0; i < MAX_STREAMS_TRACKED; ++i) {
1731 stream_num =
1732 (*track_stream >> (i * BITS_PER_INDEX_STREAM)) &
1733 STREAM_MASK;
1734 current_sd = &current_ld_sd->stream_track[stream_num];
1735 /* if we found a stream, update the raid
1736 * context and also update the mruBitMap
1737 */
1738 /* boundary condition */
1739 if ((current_sd->next_seq_lba) &&
1740 (io_info->ldStartBlock >= current_sd->next_seq_lba) &&
1741 (io_info->ldStartBlock <= (current_sd->next_seq_lba+32)) &&
1742 (current_sd->is_read == io_info->isRead)) {
1743

> 1744			if ((io_info->ldStartBlock != current_sd->next_seq_lba)

1745 && ((!io_info->isRead) || (!is_read_ahead)))
1746 /*
1747 * Once the API availible we need to change this.
1748 * At this point we are not allowing any gap
1749 */
1750 continue;
1751 cmd->io_request->RaidContext.raid_context_g35.stream_detected = true;
1752 current_sd->next_seq_lba =

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#7 lore raw

PATCH v6 5/11 megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID 1/10 Writes

In reply to Sasikumar Chandrasekaran

To improve RAID 1/10 Write performance, OS drivers need to issue the required Write IOs as Fast Path IOs (after the appropriate checks allowing Fast Path to be used) to the appropriate physical drives (translated from the OS logical IO) and wait for all Write IOs to complete. If any of the Write IOs fail or time out, the IO will be re issued to FW as an LD IO so FW can perform the error handling.

This patch is depending on patch 4 and same as V5

---
 drivers/scsi/megaraid/megaraid_sas.h        |   1 +
 drivers/scsi/megaraid/megaraid_sas_fp.c     |  31 ++-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 335 ++++++++++++++++++++++++----
 drivers/scsi/megaraid/megaraid_sas_fusion.h |  15 +-
 4 files changed, 329 insertions(+), 53 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +1 -0
index 3d86bc6..a96889c 100644
@@ -2056,6 +2056,7 @@ struct megasas_instance {
 
 	u16 max_num_sge;
 	u16 max_fw_cmds;
+	u16 max_mpt_cmds;
 	u16 max_mfi_cmds;
 	u16 max_scsi_cmds;
 	u16 ldio_threshold;
drivers/scsi/megaraid/megaraid_sas_fp.c +25 -6
index a4e213b..eb9ff44 100644
@@ -737,7 +737,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
 		struct MR_DRV_RAID_MAP_ALL *map)
 {
 	struct MR_LD_RAID  *raid = MR_LdRaidGet(ld, map);
-	u32     pd, arRef;
+	u32     pd, arRef, r1_alt_pd;
 	u8      physArm, span;
 	u64     row;
 	u8	retval = TRUE;
@@ -772,9 +772,16 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
 	arRef       = MR_LdSpanArrayGet(ld, span, map);
 	pd          = MR_ArPdGet(arRef, physArm, map);
 
-	if (pd != MR_PD_INVALID)
+	if (pd != MR_PD_INVALID) {
 		*pDevHandle = MR_PdDevHandleGet(pd, map);
-	else {
+		/* get second pd also for raid 1/10 fast path writes*/
+		if (raid->level == 1) {
+			r1_alt_pd = MR_ArPdGet(arRef, physArm + 1, map);
+			if (r1_alt_pd != MR_PD_INVALID)
+				io_info->r1_alt_dev_handle =
+				MR_PdDevHandleGet(r1_alt_pd, map);
+		}
+	} else {
 		*pDevHandle = cpu_to_le16(MR_PD_INVALID);
 		if ((raid->level >= 5) &&
 			((fusion->adapter_type == THUNDERBOLT_SERIES)  ||
@@ -819,7 +826,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 		struct MR_DRV_RAID_MAP_ALL *map)
 {
 	struct MR_LD_RAID  *raid = MR_LdRaidGet(ld, map);
-	u32         pd, arRef;
+	u32         pd, arRef, r1_alt_pd;
 	u8          physArm, span;
 	u64         row;
 	u8	    retval = TRUE;
@@ -867,10 +874,17 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 	arRef       = MR_LdSpanArrayGet(ld, span, map);
 	pd          = MR_ArPdGet(arRef, physArm, map); /* Get the pd */
 
-	if (pd != MR_PD_INVALID)
+	if (pd != MR_PD_INVALID) {
 		/* Get dev handle from Pd. */
 		*pDevHandle = MR_PdDevHandleGet(pd, map);
-	else {
+		/* get second pd also for raid 1/10 fast path writes*/
+		if (raid->level == 1) {
+			r1_alt_pd = MR_ArPdGet(arRef, physArm + 1, map);
+			if (r1_alt_pd != MR_PD_INVALID)
+				io_info->r1_alt_dev_handle =
+				MR_PdDevHandleGet(r1_alt_pd, map);
+		}
+	} else {
 		/* set dev handle as invalid. */
 		*pDevHandle = cpu_to_le16(MR_PD_INVALID);
 		if ((raid->level >= 5) &&
@@ -1126,6 +1140,11 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 		/* If IO on an invalid Pd, then FP is not possible.*/
 		if (io_info->devHandle == cpu_to_le16(MR_PD_INVALID))
 			io_info->fpOkForIo = FALSE;
+		/* set raid 1/10 fast path write capable bit in io_info */
+		if (io_info->fpOkForIo &&
+		    (io_info->r1_alt_dev_handle != MR_PD_INVALID) &&
+		    (raid->level == 1) && !isRead)
+			io_info->is_raid_1_fp_write = 1;
 		return retval;
 	} else if (isRead) {
 		uint stripIdx;
drivers/scsi/megaraid/megaraid_sas_fusion.c +290 -45

566 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fusion.h +13 -2
index 80bb302..96a1cf2 100644
@@ -94,6 +94,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 RAID_1_10_RMW_CMDS 3
 #define JBOD_MAPS_COUNT	2
 
 enum MR_FUSION_ADAPTER_TYPE {
@@ -728,7 +729,9 @@ struct MR_SPAN_BLOCK_INFO {
 struct MR_LD_RAID {
 	struct {
 #if   defined(__BIG_ENDIAN_BITFIELD)
-		u32     reserved4:5;
+		u32     reserved4:3;
+		u32     fp_cache_bypass_capable:1;
+		u32     fp_rmw_capable:1;
 		u32     fpBypassRegionLock:1;
 		u32     tmCapable:1;
 		u32	fpNonRWCapable:1;
@@ -756,7 +759,9 @@ struct MR_LD_RAID {
 		u32	fpNonRWCapable:1;
 		u32     tmCapable:1;
 		u32     fpBypassRegionLock:1;
-		u32     reserved4:5;
+		u32     fp_rmw_capable:1;
+		u32     fp_cache_bypass_capable:1;
+		u32     reserved4:3;
 #endif
 	} capability;
 	__le32     reserved6;
@@ -830,6 +835,8 @@ struct IO_REQUEST_INFO {
 	u64 start_row;
 	u8  span_arm;	/* span[7:5], arm[4:0] */
 	u8  pd_after_lb;
+	u16 r1_alt_dev_handle; /* raid 1/10 only */
+	bool is_raid_1_fp_write;
 	bool ra_capable;
 };
 
@@ -883,6 +890,10 @@ struct megasas_cmd_fusion {
 	u32 index;
 	u8 pd_r1_lb;
 	struct completion done;
+	bool is_raid_1_fp_write;
+	u16 r1_alt_dev_handle; /* raid 1/10 only*/
+	bool cmd_completed;  /* raid 1/10 fp writes status holder */
+
 };
 
 struct LD_LOAD_BALANCE_INFO {
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH v6 6/11 megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers

In reply to Sasikumar Chandrasekaran

SAS3.5 Generic Megaraid Controllers FW will support new dynamic RaidMap to have different sizes for different number of supported VDs.

This patch is depending on patch 5

80 chars per line limit is taken care around VD_EXT_DEBUG macro. NULL pointer check for desc_table has been removed. Few code indentation issues fixed.

---
 drivers/scsi/megaraid/megaraid_sas.h        |   7 +
 drivers/scsi/megaraid/megaraid_sas_base.c   |  60 ++++--
 drivers/scsi/megaraid/megaraid_sas_fp.c     | 301 ++++++++++++++++++++++++----
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 226 ++++++++++++++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 240 ++++++++++++++++++----
 5 files changed, 696 insertions(+), 138 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +7 -0
index a96889c..6ddf994 100644
@@ -1434,6 +1434,12 @@ enum FW_BOOT_CONTEXT {
 #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT    14
 #define MR_MAX_MSIX_REG_ARRAY                   16
 #define MR_RDPQ_MODE_OFFSET			0X00800000
+
+#define MR_MAX_RAID_MAP_SIZE_OFFSET_SHIFT	16
+#define MR_MAX_RAID_MAP_SIZE_MASK		0x1FF
+#define MR_MIN_MAP_SIZE				0x10000
+/* 64k */
+
 #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET		0X01000000
 
 /*
@@ -2151,6 +2157,7 @@ struct megasas_instance {
 	bool fw_sync_cache_support;
 	bool is_ventura;
 	bool msix_combined;
+	u16 max_raid_mapsize;
 };
 struct MR_LD_VF_MAP {
 	u32 size;
drivers/scsi/megaraid/megaraid_sas_base.c +43 -17

86 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fp.c +261 -40

397 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fusion.c +179 -47

412 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fusion.h +206 -34

331 lines not on this page · raw message

Signature · 1 line
1.8.3.1
Reviewed-by on v6 6/11
#9 lore raw

Re: [PATCH V6 06/11] megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers

Quoted 10 lines · Sasikumar Chandrasekaran

SAS3.5 Generic Megaraid Controllers FW will support new dynamic RaidMap to have different sizes for different number of supported VDs.

This patch is depending on patch 5

80 chars per line limit is taken care around VD_EXT_DEBUG macro. NULL pointer check for desc_table has been removed. Few code indentation issues fixed.

#10 lore raw

PATCH v6 7/11 megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers Capabilities

In reply to Sasikumar Chandrasekaran

The Megaraid driver has to support the SAS3.5 Generic Megaraid Controllers Firmware functionality.

This patch is depending on patch 6 and same as V5

---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 53 ++++++++++++++---------------
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 19 ++++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.h |  1 +
 3 files changed, 37 insertions(+), 36 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +25 -28
index 403bbef..9f0253f 100644
@@ -5042,34 +5042,29 @@ static int megasas_init_fw(struct megasas_instance *instance)
 
 	reg_set = instance->reg_set;
 
-	switch (instance->pdev->device) {
-	case PCI_DEVICE_ID_LSI_FUSION:
-	case PCI_DEVICE_ID_LSI_PLASMA:
-	case PCI_DEVICE_ID_LSI_INVADER:
-	case PCI_DEVICE_ID_LSI_FURY:
-	case PCI_DEVICE_ID_LSI_INTRUDER:
-	case PCI_DEVICE_ID_LSI_INTRUDER_24:
-	case PCI_DEVICE_ID_LSI_CUTLASS_52:
-	case PCI_DEVICE_ID_LSI_CUTLASS_53:
+	if (fusion)
 		instance->instancet = &megasas_instance_template_fusion;
-		break;
-	case PCI_DEVICE_ID_LSI_SAS1078R:
-	case PCI_DEVICE_ID_LSI_SAS1078DE:
-		instance->instancet = &megasas_instance_template_ppc;
-		break;
-	case PCI_DEVICE_ID_LSI_SAS1078GEN2:
-	case PCI_DEVICE_ID_LSI_SAS0079GEN2:
-		instance->instancet = &megasas_instance_template_gen2;
-		break;
-	case PCI_DEVICE_ID_LSI_SAS0073SKINNY:
-	case PCI_DEVICE_ID_LSI_SAS0071SKINNY:
-		instance->instancet = &megasas_instance_template_skinny;
-		break;
-	case PCI_DEVICE_ID_LSI_SAS1064R:
-	case PCI_DEVICE_ID_DELL_PERC5:
-	default:
-		instance->instancet = &megasas_instance_template_xscale;
-		break;
+	else {
+		switch (instance->pdev->device) {
+		case PCI_DEVICE_ID_LSI_SAS1078R:
+		case PCI_DEVICE_ID_LSI_SAS1078DE:
+			instance->instancet = &megasas_instance_template_ppc;
+			break;
+		case PCI_DEVICE_ID_LSI_SAS1078GEN2:
+		case PCI_DEVICE_ID_LSI_SAS0079GEN2:
+			instance->instancet = &megasas_instance_template_gen2;
+			break;
+		case PCI_DEVICE_ID_LSI_SAS0073SKINNY:
+		case PCI_DEVICE_ID_LSI_SAS0071SKINNY:
+			instance->instancet = &megasas_instance_template_skinny;
+			break;
+		case PCI_DEVICE_ID_LSI_SAS1064R:
+		case PCI_DEVICE_ID_DELL_PERC5:
+		default:
+			instance->instancet = &megasas_instance_template_xscale;
+			instance->pd_list_not_supported = 1;
+			break;
+		}
 	}
 
 	if (megasas_transition_to_ready(instance, 0)) {
@@ -5819,7 +5814,9 @@ static int megasas_probe_one(struct pci_dev *pdev,
 		if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) ||
 			(instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA))
 			fusion->adapter_type = THUNDERBOLT_SERIES;
-		else if (!instance->is_ventura)
+		else if (instance->is_ventura)
+			fusion->adapter_type = VENTURA_SERIES;
+		else
 			fusion->adapter_type = INVADER_SERIES;
 	}
 	break;
drivers/scsi/megaraid/megaraid_sas_fusion.c +11 -8
index 46f7e16..97a0008 100644
@@ -244,7 +244,10 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance,
 
 	reg_set = instance->reg_set;
 
-	cur_max_fw_cmds = readl(&instance->reg_set->outbound_scratch_pad_3) & 0x00FFFF;
+	/* ventura FW does not fill outbound_scratch_pad_3 with queue depth */
+	if (!instance->is_ventura)
+		cur_max_fw_cmds =
+		readl(&instance->reg_set->outbound_scratch_pad_3) & 0x00FFFF;
 
 	if (dual_qdepth_disable || !cur_max_fw_cmds)
 		cur_max_fw_cmds = instance->instancet->read_fw_status_reg(reg_set) & 0x00FFFF;
@@ -837,7 +840,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
 	drv_ops = (MFI_CAPABILITIES *) &(init_frame->driver_operations);
 
 	/* driver support Extended MSIX */
-	if (fusion->adapter_type == INVADER_SERIES)
+	if (fusion->adapter_type >= INVADER_SERIES)
 		drv_ops->mfi_capabilities.support_additional_msix = 1;
 	/* driver supports HA / Remote LUN over Fast Path interface */
 	drv_ops->mfi_capabilities.support_fp_remote_lun = 1;
@@ -1491,7 +1494,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
 
 	fusion = instance->ctrl_context;
 
-	if (fusion->adapter_type == INVADER_SERIES) {
+	if (fusion->adapter_type >= INVADER_SERIES) {
 		struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = sgl_ptr;
 		sgl_ptr_end += fusion->max_sge_in_main_msg - 1;
 		sgl_ptr_end->Flags = 0;
@@ -1508,7 +1511,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
 		sgl_ptr->Length = cpu_to_le32(sg_dma_len(os_sgl));
 		sgl_ptr->Address = cpu_to_le64(sg_dma_address(os_sgl));
 		sgl_ptr->Flags = 0;
-		if (fusion->adapter_type == INVADER_SERIES)
+		if (fusion->adapter_type >= INVADER_SERIES)
 			if (i == sge_count - 1)
 				sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST;
 		sgl_ptr++;
@@ -1519,7 +1522,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
 		    (sge_count > fusion->max_sge_in_main_msg)) {
 
 			struct MPI25_IEEE_SGE_CHAIN64 *sg_chain;
-			if (fusion->adapter_type == INVADER_SERIES) {
+			if (fusion->adapter_type >= INVADER_SERIES) {
 				if ((le16_to_cpu(cmd->io_request->IoFlags) &
 					MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) !=
 					MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH)
@@ -1535,7 +1538,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
 			sg_chain = sgl_ptr;
 			/* Prepare chain element */
 			sg_chain->NextChainOffset = 0;
-			if (fusion->adapter_type == INVADER_SERIES)
+			if (fusion->adapter_type >= INVADER_SERIES)
 				sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT;
 			else
 				sg_chain->Flags =
@@ -2285,7 +2288,7 @@ static void megasas_build_ld_nonrw_fusion(struct megasas_instance *instance,
 		pRAID_Context->timeout_value =
 			cpu_to_le16((os_timeout_value > timeout_limit) ?
 			timeout_limit : os_timeout_value);
-		if (fusion->adapter_type == INVADER_SERIES)
+		if (fusion->adapter_type >= INVADER_SERIES)
 			io_request->IoFlags |=
 				cpu_to_le16(MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH);
 
@@ -2998,7 +3001,7 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
 
 	io_req = cmd->io_request;
 
-	if (fusion->adapter_type == INVADER_SERIES) {
+	if (fusion->adapter_type >= INVADER_SERIES) {
 		struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end =
 			(struct MPI25_IEEE_SGE_CHAIN64 *)&io_req->SGL;
 		sgl_ptr_end += fusion->max_sge_in_main_msg - 1;
drivers/scsi/megaraid/megaraid_sas_fusion.h +1 -0
index ccbb571..1994207 100644
@@ -107,6 +107,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE {
 enum MR_FUSION_ADAPTER_TYPE {
 	THUNDERBOLT_SERIES = 0,
 	INVADER_SERIES = 1,
+	VENTURA_SERIES = 2,
 };
 
 /*
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH v6 8/11 megaraid_sas: Enable or Disable Fast path based on the PCI Threshold Bandwidth

In reply to Sasikumar Chandrasekaran

Large SEQ IO workload should sent as non fast path commands

This patch is depending on patch 7

80 chars per line limit is taken care around VD_EXT_DEBUG macro.

---
 drivers/scsi/megaraid/megaraid_sas.h        |  8 +++++
 drivers/scsi/megaraid/megaraid_sas_base.c   | 48 +++++++++++++++++++++++++++++
 drivers/scsi/megaraid/megaraid_sas_fp.c     |  7 +++++
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 20 +++++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.h |  2 +-
 5 files changed, 76 insertions(+), 9 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +8 -0
index 6ddf994..0696903 100644
@@ -1429,6 +1429,8 @@ enum FW_BOOT_CONTEXT {
 #define MFI_1068_FW_HANDSHAKE_OFFSET		0x64
 #define MFI_1068_FW_READY			0xDDDD0000
 
+#define MEGASAS_RAID1_FAST_PATH_STATUS_CHECK_INTERVAL HZ
+
 #define MR_MAX_REPLY_QUEUES_OFFSET              0X0000001F
 #define MR_MAX_REPLY_QUEUES_EXT_OFFSET          0X003FC000
 #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT    14
@@ -2101,6 +2103,10 @@ struct megasas_instance {
 	atomic_t ldio_outstanding;
 	atomic_t fw_reset_no_pci_access;
 
+	atomic64_t bytes_wrote; /* used for raid1 fast path enable or disable */
+	atomic_t r1_write_fp_capable;
+
+
 	struct megasas_instance_template *instancet;
 	struct tasklet_struct isr_tasklet;
 	struct work_struct work_init;
@@ -2142,6 +2148,7 @@ struct megasas_instance {
 	long reset_flags;
 	struct mutex reset_mutex;
 	struct timer_list sriov_heartbeat_timer;
+	struct timer_list r1_fp_hold_timer;
 	char skip_heartbeat_timer_del;
 	u8 requestorId;
 	char PlasmaFW111;
@@ -2158,6 +2165,7 @@ struct megasas_instance {
 	bool is_ventura;
 	bool msix_combined;
 	u16 max_raid_mapsize;
+	u64 pci_threshold_bandwidth; /* used to control the fp writes */
 };
 struct MR_LD_VF_MAP {
 	u32 size;
drivers/scsi/megaraid/megaraid_sas_base.c +48 -0

84 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fp.c +7 -0
index c51432e..d8a095e 100644
@@ -197,6 +197,9 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
 
 	if (instance->max_raid_mapsize) {
 		fw_map_dyn = fusion->ld_map[(instance->map_id & 1)];
+		if (fw_map_dyn->pci_threshold_bandwidth)
+			instance->pci_threshold_bandwidth =
+			le64_to_cpu(fw_map_dyn->pci_threshold_bandwidth);
 #if VD_EXT_DEBUG
 		dev_dbg(&instance->pdev->dev, "raidMapSize 0x%x fw_map_dyn->descTableOffset 0x%x\n",
 			le32_to_cpu(fw_map_dyn->raid_map_size),
@@ -204,6 +207,8 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
 		dev_dbg(&instance->pdev->dev, "descTableSize 0x%x descTableNumElements 0x%x\n",
 			le32_to_cpu(fw_map_dyn->desc_table_size),
 			le32_to_cpu(fw_map_dyn->desc_table_num_elements));
+		dev_dbg(&instance->pdev->dev, "PCIThreasholdBandwidth %llu\n",
+			instance->pci_threshold_bandwidth);
 		dev_dbg(&instance->pdev->dev, "drv map %p ldCount %d\n",
 			drv_map, fw_map_dyn->ld_count);
 #endif
@@ -434,6 +439,8 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
 			sizeof(struct MR_DEV_HANDLE_INFO) *
 			MAX_RAIDMAP_PHYSICAL_DEVICES);
 	}
+	if (instance->is_ventura && !instance->pci_threshold_bandwidth)
+		instance->pci_threshold_bandwidth = ULLONG_MAX;
 }
 
 /*
drivers/scsi/megaraid/megaraid_sas_fusion.c +12 -8
index 97a0008..aa508b3 100644
@@ -95,6 +95,7 @@ void megasas_start_timer(struct megasas_instance *instance,
 extern unsigned int dual_qdepth_disable;
 static void megasas_free_rdpq_fusion(struct megasas_instance *instance);
 static void megasas_free_reply_fusion(struct megasas_instance *instance);
+void megasas_change_r1_fp_status(unsigned long instance_addr);
 
 
 
@@ -2628,8 +2629,9 @@ void megasas_prepare_secondRaid1_IO(struct megasas_instance *instance,
 	*	to get new command
 	*/
 	if (cmd->is_raid_1_fp_write &&
-		atomic_inc_return(&instance->fw_outstanding) >
-			(instance->host->can_queue)) {
+		(atomic_inc_return(&instance->fw_outstanding) >
+			(instance->host->can_queue) ||
+		(!atomic_read(&instance->r1_write_fp_capable)))) {
 		megasas_fpio_to_ldio(instance, cmd, cmd->scmd);
 		atomic_dec(&instance->fw_outstanding);
 	} else if (cmd->is_raid_1_fp_write) {
@@ -2638,17 +2640,19 @@ void megasas_prepare_secondRaid1_IO(struct megasas_instance *instance,
 		megasas_prepare_secondRaid1_IO(instance, cmd, r1_cmd);
 	}
 
-
 	/*
-	 * Issue the command to the FW
-	 */
+	* Issue the command to the FW
+	*/
+	if (scmd->sc_data_direction == PCI_DMA_TODEVICE && instance->is_ventura)
+		atomic64_add(scsi_bufflen(scmd), &instance->bytes_wrote);
 
 	megasas_fire_cmd_fusion(instance, req_desc, instance->is_ventura);
 
-	if (r1_cmd)
+	if (r1_cmd) {
+		atomic64_add(scsi_bufflen(scmd), &instance->bytes_wrote);
 		megasas_fire_cmd_fusion(instance, r1_cmd->request_desc,
-				instance->is_ventura);
-
+			instance->is_ventura);
+	}
 
 	return 0;
 }
drivers/scsi/megaraid/megaraid_sas_fusion.h +1 -1
index 1994207..915af59 100644
@@ -977,7 +977,7 @@ struct MR_FW_RAID_MAP_DYNAMIC {
 	u32 desc_table_size;  /* Total Size of desc table */
 	/* Total Number of elements in the desc table */
 	u32 desc_table_num_elements;
-	u64	reserved1;
+	u64	pci_threshold_bandwidth;
 	u32	reserved2[3];	/*future use */
 	/* timeout value used by driver in FP IOs */
 	u8 fp_pd_io_timeout_sec;
Signature · 1 line
1.8.3.1
#13 lore raw

PATCH v6 9/11 megaraid_sas: ldio_outstanding variable is not decremented in completion path

In reply to Sasikumar Chandrasekaran

ldio outstanding variable needs to be decremented in io completion path for iMR dual queue depth

This patch is depending on patch 8 and same as V5

---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +5 -2
index aa508b3..a3382cf 100644
@@ -2579,7 +2579,6 @@ void megasas_prepare_secondRaid1_IO(struct megasas_instance *instance,
 
 	if (atomic_inc_return(&instance->fw_outstanding) >
 			instance->host->can_queue) {
-		dev_err(&instance->pdev->dev, "Throttle IOs beyond Controller queue depth\n");
 		atomic_dec(&instance->fw_outstanding);
 		return SCSI_MLQUEUE_HOST_BUSY;
 	}
@@ -2811,6 +2810,9 @@ void megasas_prepare_secondRaid1_IO(struct megasas_instance *instance,
 					extStatus, data_length, sense);
 				scsi_io_req->RaidContext.raid_context.status = 0;
 				scsi_io_req->RaidContext.raid_context.ex_status = 0;
+				if (instance->ldio_threshold
+					&& megasas_cmd_type(scmd_local) == READ_WRITE_LDIO)
+					atomic_dec(&instance->ldio_outstanding);
 				megasas_return_cmd_fusion(instance, cmd_fusion);
 				scsi_dma_unmap(scmd_local);
 				scmd_local->scsi_done(scmd_local);
@@ -3959,7 +3961,8 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 				scmd_local->result =
 					megasas_check_mpio_paths(instance,
 							scmd_local);
-				if (megasas_cmd_type(scmd_local) == READ_WRITE_LDIO)
+				if (instance->ldio_threshold &&
+					megasas_cmd_type(scmd_local) == READ_WRITE_LDIO)
 					atomic_dec(&instance->ldio_outstanding);
 				megasas_return_cmd_fusion(instance, cmd_fusion);
 				scsi_dma_unmap(scmd_local);
Signature · 1 line
1.8.3.1
#14 lore raw

PATCH v6 10/11 megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid Controllers

In reply to Sasikumar Chandrasekaran

Update Linux driver to use new pdTargetId field for JBOD target ID

This patch is depending on patch 9 and same as V5

---
 drivers/scsi/megaraid/megaraid_sas.h        | 105 +++++++++++++++++++++-------
 drivers/scsi/megaraid/megaraid_sas_base.c   |   3 +
 drivers/scsi/megaraid/megaraid_sas_fusion.c |   6 ++
 drivers/scsi/megaraid/megaraid_sas_fusion.h |   3 +-
 4 files changed, 89 insertions(+), 28 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +78 -27
index 0696903..d2dc340 100644
@@ -1317,7 +1317,55 @@ struct megasas_ctrl_info {
 #endif
 	} adapterOperations3;
 
-	u8          pad[0x800-0x7EC];
+	struct {
+#if defined(__BIG_ENDIAN_BITFIELD)
+	u8 reserved:7;
+	/* Indicates whether the CPLD image is part of
+	*  the package and stored in flash
+	*/
+	u8 cpld_in_flash:1;
+#else
+	u8 cpld_in_flash:1;
+	u8 reserved:7;
+#endif
+	u8 reserved1[3];
+	/* Null terminated string. Has the version
+	*  information if cpld_in_flash = FALSE
+	*/
+	u8 userCodeDefinition[12];
+	} cpld;  /* Valid only if upgradableCPLD is TRUE */
+
+	struct {
+	#if defined(__BIG_ENDIAN_BITFIELD)
+		u16 reserved:8;
+		u16 fw_swaps_bbu_vpd_info:1;
+		u16 support_pd_map_target_id:1;
+		u16 support_ses_ctrl_in_multipathcfg:1;
+		u16 image_upload_supported:1;
+		u16 support_encrypted_mfc:1;
+		u16 supported_enc_algo:1;
+		u16 support_ibutton_less:1;
+		u16 ctrl_info_ext_supported:1;
+	#else
+
+		u16 ctrl_info_ext_supported:1;
+		u16 support_ibutton_less:1;
+		u16 supported_enc_algo:1;
+		u16 support_encrypted_mfc:1;
+		u16 image_upload_supported:1;
+		/* FW supports LUN based association and target port based */
+		u16 support_ses_ctrl_in_multipathcfg:1;
+		/* association for the SES device connected in multipath mode */
+		 /* FW defines Jbod target Id within MR_PD_CFG_SEQ */
+		u16 support_pd_map_target_id:1;
+		/* FW swaps relevant fields in MR_BBU_VPD_INFO_FIXED to
+		*  provide the data in little endian order
+		*/
+		u16 fw_swaps_bbu_vpd_info:1;
+		u16 reserved:8;
+	#endif
+		} adapter_operations4;
+	u8 pad[0x800-0x7FE]; /* 0x7FE pad to 2K for expansion */
 } __packed;
 
 /*
@@ -1557,33 +1605,35 @@ struct megasas_header {
 typedef union _MFI_CAPABILITIES {
 	struct {
 #if   defined(__BIG_ENDIAN_BITFIELD)
-		u32     reserved:20;
-		u32     support_qd_throttling:1;
-		u32     support_fp_rlbypass:1;
-		u32     support_vfid_in_ioframe:1;
-		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;
-		u32	support_max_255lds:1;
-		u32	support_fastpath_wb:1;
-		u32     support_additional_msix:1;
-		u32     support_fp_remote_lun:1;
+	u32     reserved:19;
+	u32 support_pd_map_target_id:1;
+	u32     support_qd_throttling:1;
+	u32     support_fp_rlbypass:1;
+	u32     support_vfid_in_ioframe:1;
+	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;
+	u32		support_max_255lds:1;
+	u32		support_fastpath_wb:1;
+	u32     support_additional_msix:1;
+	u32     support_fp_remote_lun:1;
 #else
-		u32     support_fp_remote_lun:1;
-		u32     support_additional_msix:1;
-		u32	support_fastpath_wb:1;
-		u32	support_max_255lds:1;
-		u32     support_ndrive_r1_lb:1;
-		u32     support_core_affinity:1;
-		u32     security_protocol_cmds_fw:1;
-		u32	support_ext_queue_depth:1;
-		u32     support_ext_io_size:1;
-		u32     support_vfid_in_ioframe:1;
-		u32     support_fp_rlbypass:1;
-		u32     support_qd_throttling:1;
-		u32     reserved:20;
+	u32     support_fp_remote_lun:1;
+	u32     support_additional_msix:1;
+	u32		support_fastpath_wb:1;
+	u32		support_max_255lds:1;
+	u32     support_ndrive_r1_lb:1;
+	u32     support_core_affinity:1;
+	u32     security_protocol_cmds_fw:1;
+	u32		support_ext_queue_depth:1;
+	u32     support_ext_io_size:1;
+	u32     support_vfid_in_ioframe:1;
+	u32     support_fp_rlbypass:1;
+	u32     support_qd_throttling:1;
+	u32	support_pd_map_target_id:1;
+	u32     reserved:19;
 #endif
 	} mfi_capabilities;
 	__le32		reg;
@@ -2052,6 +2102,7 @@ struct megasas_instance {
 	u32 crash_dump_drv_support;
 	u32 crash_dump_app_support;
 	u32 secure_jbod_support;
+	u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */
 	bool use_seqnum_jbod_fp;   /* Added for PD sequence */
 	spinlock_t crashdump_lock;
 
drivers/scsi/megaraid/megaraid_sas_base.c +3 -0
index fd3bc6d..2889eb5 100644
@@ -4576,6 +4576,7 @@ static void megasas_update_ext_vd_details(struct megasas_instance *instance)
 		le32_to_cpus((u32 *)&ctrl_info->properties.OnOffProperties);
 		le32_to_cpus((u32 *)&ctrl_info->adapterOperations2);
 		le32_to_cpus((u32 *)&ctrl_info->adapterOperations3);
+		le16_to_cpus((u16 *)&ctrl_info->adapter_operations4);
 
 		/* Update the latest Ext VD info.
 		 * From Init path, store current firmware details.
@@ -4585,6 +4586,8 @@ static void megasas_update_ext_vd_details(struct megasas_instance *instance)
 		megasas_update_ext_vd_details(instance);
 		instance->use_seqnum_jbod_fp =
 			ctrl_info->adapterOperations3.useSeqNumJbodFP;
+		instance->support_morethan256jbod =
+			ctrl_info->adapter_operations4.support_pd_map_target_id;
 
 		/*Check whether controller is iMR or MR */
 		instance->is_imr = (ctrl_info->memory_size ? 0 : 1);
drivers/scsi/megaraid/megaraid_sas_fusion.c +6 -0
index a3382cf..f0b18ed 100644
@@ -858,6 +858,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
 		drv_ops->mfi_capabilities.support_ext_queue_depth = 1;
 
 	drv_ops->mfi_capabilities.support_qd_throttling = 1;
+	drv_ops->mfi_capabilities.support_pd_map_target_id = 1;
 	/* Convert capability to LE32 */
 	cpu_to_le32s((u32 *)&init_frame->driver_operations.mfi_capabilities);
 
@@ -2243,6 +2244,11 @@ static void megasas_build_ld_nonrw_fusion(struct megasas_instance *instance,
 		/* TgtId must be incremented by 255 as jbod seq number is index
 		 * below raid map
 		 */
+		 /* More than 256 PD/JBOD support for Ventura */
+		if (instance->support_morethan256jbod)
+			pRAID_Context->virtual_disk_tgt_id =
+				pd_sync->seq[pd_index].pd_target_id;
+		else
 		pRAID_Context->virtual_disk_tgt_id =
 			cpu_to_le16(device_id + (MAX_PHYSICAL_DEVICES - 1));
 		pRAID_Context->config_seq_num = pd_sync->seq[pd_index].seqNum;
drivers/scsi/megaraid/megaraid_sas_fusion.h +2 -1
index 915af59..e4fe394 100644
@@ -1189,7 +1189,8 @@ struct MR_PD_CFG_SEQ {
 		u8     reserved:7;
 #endif
 	} capability;
-	u8  reserved[3];
+	u8  reserved;
+	u16 pd_target_id;
 } __packed;
 
 struct MR_PD_CFG_SEQ_NUM_SYNC {
Signature · 1 line
1.8.3.1
#16 lore raw

PATCH v6 11/11 megaraid_sas: driver version upgrade

In reply to Sasikumar Chandrasekaran

Upgrade driver version.

This patch is depending on patch 10 and same as V5

---
 drivers/scsi/megaraid/megaraid_sas.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +2 -2
index d2dc340..5412759 100644
@@ -35,8 +35,8 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION				"06.812.07.00-rc1"
-#define MEGASAS_RELDATE				"August 22, 2016"
+#define MEGASAS_VERSION				"07.700.00.00-rc1"
+#define MEGASAS_RELDATE				"November 29, 2016"
 
 /*
  * Device IDs
Signature · 1 line
1.8.3.1
#17 lore raw
In reply to Sasikumar Chandrasekaran
Quoted 22 lines · Sasikumar Chandrasekaran

Sasikumar Chandrasekaran (11):
megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: 128 MSIX Support
megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and
IO Coalescing
megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID

    1/10 Writes

megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers
Capabilities
megaraid_sas: Enable or Disable Fast path based on the PCI Threshold
Bandwidth
megaraid_sas: ldio_outstanding variable is not decremented in
completion path
megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: driver version upgrade

Quoted 7 lines
 drivers/scsi/megaraid/megaraid_sas.h        | 139 ++++--
 drivers/scsi/megaraid/megaraid_sas_base.c   | 240 +++++++--
 drivers/scsi/megaraid/megaraid_sas_fp.c     | 341 +++++++++++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 750 +++++++++++++++++++++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 364 ++++++++++++--
 5 files changed, 1557 insertions(+), 277 deletions(-)

I finished review of this set and ack-ed it.
There still is a large amount (~1600) of checkpatch errors,
ERROR: DOS line endings
ERROR: trailing whitespace
...
I complained about this several times and was hoping that Sasi would fix all that in V6 but for some reason it hasn't been fixed.
I don't want to stop the series only because of formatting issues,
so well ok
-tm

#18 lore raw
Quoted 30 lines · Tomas Henzl
Quoted 22 lines · Sasikumar Chandrasekaran

Sasikumar Chandrasekaran (11):
megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: 128 MSIX Support
megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and
IO Coalescing
megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID

    1/10 Writes

megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers
Capabilities
megaraid_sas: Enable or Disable Fast path based on the PCI Threshold
Bandwidth
megaraid_sas: ldio_outstanding variable is not decremented in
completion path
megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid
Controllers
megaraid_sas: driver version upgrade

Quoted 7 lines
 drivers/scsi/megaraid/megaraid_sas.h        | 139 ++++--
 drivers/scsi/megaraid/megaraid_sas_base.c   | 240 +++++++--
 drivers/scsi/megaraid/megaraid_sas_fp.c     | 341 +++++++++++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 750 +++++++++++++++++++++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 364 ++++++++++++--
 5 files changed, 1557 insertions(+), 277 deletions(-)
Quoted 10 lines

I finished review of this set and ack-ed it.
There still is a large amount (~1600) of checkpatch errors,
ERROR: DOS line endings
ERROR: trailing whitespace
...
I complained about this several times and was hoping that Sasi would fix all that in V6 but for some reason it hasn't been fixed.
I don't want to stop the series only because of formatting issues,
so well ok
-tm

I looked into this once again and I think now, that the issue with the 'line endings' is an issue on my side.
I'm sorry for that and please ignore my previous comment. -tm

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html