Re: [RESEND][PATCH 2/8][SCSI]mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced

2014-07-15 Thread Martin K. Petersen
> "Sreekanth" == Reddy, Sreekanth  writes:

Sreekanth> Added code to send an SEP message that turns off the
Sreekanth> Predictive Failure LED when a drive is removed (if Predictive
Sreekanth> Failure LED was turned on).

Sreekanth> Added a new flag 'pfa_led_on' per device that tracks the
Sreekanth> status of Predictive Failure LED. When the drive is removed,
Sreekanth> this flag is checked and sends an SEP message to turn off the
Sreekanth> respective Predictive Failure LED.

Reviewed-by: Martin K. Petersen 

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND][PATCH 2/8][SCSI]mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced

2014-07-15 Thread Martin K. Petersen
 Sreekanth == Reddy, Sreekanth sreekanth.re...@avagotech.com writes:

Sreekanth Added code to send an SEP message that turns off the
Sreekanth Predictive Failure LED when a drive is removed (if Predictive
Sreekanth Failure LED was turned on).

Sreekanth Added a new flag 'pfa_led_on' per device that tracks the
Sreekanth status of Predictive Failure LED. When the drive is removed,
Sreekanth this flag is checked and sends an SEP message to turn off the
Sreekanth respective Predictive Failure LED.

Reviewed-by: Martin K. Petersen martin.peter...@oracle.com

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND][PATCH 2/8][SCSI]mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced

2014-06-25 Thread Reddy, Sreekanth
Added code to send an SEP message that turns off the Predictive
Failure LED when a drive is removed (if Predictive Failure LED was turned on).

Added a new flag 'pfa_led_on' per device that tracks the status of Predictive
Failure LED. When the drive is removed, this flag is checked and
sends an SEP message to turn off the respective Predictive Failure LED.

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt3sas/mpt3sas_base.h  |5 ++-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   67 +-
 2 files changed, 61 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index b1494ce..3007521 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -272,8 +272,10 @@ struct _internal_cmd {
  * @channel: target channel
  * @slot: number number
  * @phy: phy identifier provided in sas device page 0
- * @fast_path: fast path feature enable bit
  * @responding: used in _scsih_sas_device_mark_responding
+ * @fast_path: fast path feature enable bit
+ * @pfa_led_on: flag for PFA LED status
+ *
  */
 struct _sas_device {
struct list_head list;
@@ -293,6 +295,7 @@ struct _sas_device {
u8  phy;
u8  responding;
u8  fast_path;
+   u8  pfa_led_on;
 };
 
 /**
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 1056cbf..905c82c 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -162,7 +162,7 @@ struct sense_info {
 };
 
 #define MPT3SAS_PROCESS_TRIGGER_DIAG (0xFFFB)
-#define MPT3SAS_TURN_ON_FAULT_LED (0xFFFC)
+#define MPT3SAS_TURN_ON_PFA_LED (0xFFFC)
 #define MPT3SAS_PORT_ENABLE_COMPLETE (0xFFFD)
 #define MPT3SAS_ABRT_TASK_SET (0xFFFE)
 #define MPT3SAS_REMOVE_UNRESPONDING_DEVICES (0x)
@@ -3903,7 +3903,7 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct 
scsi_cmnd *scmd,
 #endif
 
 /**
- * _scsih_turn_on_fault_led - illuminate Fault LED
+ * _scsih_turn_on_pfa_led - illuminate PFA LED
  * @ioc: per adapter object
  * @handle: device handle
  * Context: process
@@ -3911,10 +3911,15 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, 
struct scsi_cmnd *scmd,
  * Return nothing.
  */
 static void
-_scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
+_scsih_turn_on_pfa_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
 {
Mpi2SepReply_t mpi_reply;
Mpi2SepRequest_t mpi_request;
+   struct _sas_device *sas_device;
+
+   sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
+   if (!sas_device)
+   return;
 
memset(_request, 0, sizeof(Mpi2SepRequest_t));
mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
@@ -3929,6 +3934,7 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 
handle)
__FILE__, __LINE__, __func__);
return;
}
+   sas_device->pfa_led_on = 1;
 
if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
dewtprintk(ioc, pr_info(MPT3SAS_FMT
@@ -3938,9 +3944,46 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, 
u16 handle)
return;
}
 }
+/**
+ * _scsih_turn_off_pfa_led - turn off Fault LED
+ * @ioc: per adapter object
+ * @sas_device: sas device whose PFA LED has to turned off
+ * Context: process
+ *
+ * Return nothing.
+ */
+static void
+_scsih_turn_off_pfa_led(struct MPT3SAS_ADAPTER *ioc,
+   struct _sas_device *sas_device)
+{
+   Mpi2SepReply_t mpi_reply;
+   Mpi2SepRequest_t mpi_request;
 
+   memset(_request, 0, sizeof(Mpi2SepRequest_t));
+   mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
+   mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS;
+   mpi_request.SlotStatus = 0;
+   mpi_request.Slot = cpu_to_le16(sas_device->slot);
+   mpi_request.DevHandle = 0;
+   mpi_request.EnclosureHandle = cpu_to_le16(sas_device->enclosure_handle);
+   mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
+   if ((mpt3sas_base_scsi_enclosure_processor(ioc, _reply,
+   _request)) != 0) {
+   printk(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,
+   __FILE__, __LINE__, __func__);
+   return;
+   }
+
+   if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
+   dewtprintk(ioc, printk(MPT3SAS_FMT
+"enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
+ioc->name, le16_to_cpu(mpi_reply.IOCStatus),
+le32_to_cpu(mpi_reply.IOCLogInfo)));
+   return;
+   }
+}
 /**
- * _scsih_send_event_to_turn_on_fault_led - fire delayed event
+ * _scsih_send_event_to_turn_on_pfa_led - fire delayed event
  * @ioc: per adapter object
  * @handle: device handle
  * Context: interrupt.
@@ -3948,14 +3991,14 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, 
u16 handle)
  * Return 

[RESEND][PATCH 2/8][SCSI]mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced

2014-06-25 Thread Reddy, Sreekanth
Added code to send an SEP message that turns off the Predictive
Failure LED when a drive is removed (if Predictive Failure LED was turned on).

Added a new flag 'pfa_led_on' per device that tracks the status of Predictive
Failure LED. When the drive is removed, this flag is checked and
sends an SEP message to turn off the respective Predictive Failure LED.

Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com
---
 drivers/scsi/mpt3sas/mpt3sas_base.h  |5 ++-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   67 +-
 2 files changed, 61 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index b1494ce..3007521 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -272,8 +272,10 @@ struct _internal_cmd {
  * @channel: target channel
  * @slot: number number
  * @phy: phy identifier provided in sas device page 0
- * @fast_path: fast path feature enable bit
  * @responding: used in _scsih_sas_device_mark_responding
+ * @fast_path: fast path feature enable bit
+ * @pfa_led_on: flag for PFA LED status
+ *
  */
 struct _sas_device {
struct list_head list;
@@ -293,6 +295,7 @@ struct _sas_device {
u8  phy;
u8  responding;
u8  fast_path;
+   u8  pfa_led_on;
 };
 
 /**
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 1056cbf..905c82c 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -162,7 +162,7 @@ struct sense_info {
 };
 
 #define MPT3SAS_PROCESS_TRIGGER_DIAG (0xFFFB)
-#define MPT3SAS_TURN_ON_FAULT_LED (0xFFFC)
+#define MPT3SAS_TURN_ON_PFA_LED (0xFFFC)
 #define MPT3SAS_PORT_ENABLE_COMPLETE (0xFFFD)
 #define MPT3SAS_ABRT_TASK_SET (0xFFFE)
 #define MPT3SAS_REMOVE_UNRESPONDING_DEVICES (0x)
@@ -3903,7 +3903,7 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct 
scsi_cmnd *scmd,
 #endif
 
 /**
- * _scsih_turn_on_fault_led - illuminate Fault LED
+ * _scsih_turn_on_pfa_led - illuminate PFA LED
  * @ioc: per adapter object
  * @handle: device handle
  * Context: process
@@ -3911,10 +3911,15 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, 
struct scsi_cmnd *scmd,
  * Return nothing.
  */
 static void
-_scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
+_scsih_turn_on_pfa_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
 {
Mpi2SepReply_t mpi_reply;
Mpi2SepRequest_t mpi_request;
+   struct _sas_device *sas_device;
+
+   sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
+   if (!sas_device)
+   return;
 
memset(mpi_request, 0, sizeof(Mpi2SepRequest_t));
mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
@@ -3929,6 +3934,7 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 
handle)
__FILE__, __LINE__, __func__);
return;
}
+   sas_device-pfa_led_on = 1;
 
if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
dewtprintk(ioc, pr_info(MPT3SAS_FMT
@@ -3938,9 +3944,46 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, 
u16 handle)
return;
}
 }
+/**
+ * _scsih_turn_off_pfa_led - turn off Fault LED
+ * @ioc: per adapter object
+ * @sas_device: sas device whose PFA LED has to turned off
+ * Context: process
+ *
+ * Return nothing.
+ */
+static void
+_scsih_turn_off_pfa_led(struct MPT3SAS_ADAPTER *ioc,
+   struct _sas_device *sas_device)
+{
+   Mpi2SepReply_t mpi_reply;
+   Mpi2SepRequest_t mpi_request;
 
+   memset(mpi_request, 0, sizeof(Mpi2SepRequest_t));
+   mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
+   mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS;
+   mpi_request.SlotStatus = 0;
+   mpi_request.Slot = cpu_to_le16(sas_device-slot);
+   mpi_request.DevHandle = 0;
+   mpi_request.EnclosureHandle = cpu_to_le16(sas_device-enclosure_handle);
+   mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
+   if ((mpt3sas_base_scsi_enclosure_processor(ioc, mpi_reply,
+   mpi_request)) != 0) {
+   printk(MPT3SAS_FMT failure at %s:%d/%s()!\n, ioc-name,
+   __FILE__, __LINE__, __func__);
+   return;
+   }
+
+   if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
+   dewtprintk(ioc, printk(MPT3SAS_FMT
+enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n,
+ioc-name, le16_to_cpu(mpi_reply.IOCStatus),
+le32_to_cpu(mpi_reply.IOCLogInfo)));
+   return;
+   }
+}
 /**
- * _scsih_send_event_to_turn_on_fault_led - fire delayed event
+ * _scsih_send_event_to_turn_on_pfa_led - fire delayed event
  * @ioc: per adapter object
  * @handle: device handle
  * Context: interrupt.
@@ -3948,14 +3991,14 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER