aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_vport.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2008-09-07 11:52:10 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-10-13 09:28:57 -0400
commitea2151b4e142fa2de0319d9dd80413a997bf435a (patch)
tree1daa395a0b8584431c1b739af2761a840d013985 /drivers/scsi/lpfc/lpfc_vport.c
parent977b5a0af6d22a1a0170057c19cde37eeac68acd (diff)
[SCSI] lpfc 8.2.8 v2 : Add statistical reporting control and additional fc vendor events
Added support for new sysfs attributes: lpfc_stat_data_ctrl and lpfc_max_scsicmpl_time. The attributes control statistical reporting of io load. Added support for new fc vendor events for error reporting. Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_vport.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 2578d5fd9537..a7de1cc02b40 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -34,6 +34,7 @@
34#include <scsi/scsi_transport_fc.h> 34#include <scsi/scsi_transport_fc.h>
35#include "lpfc_hw.h" 35#include "lpfc_hw.h"
36#include "lpfc_sli.h" 36#include "lpfc_sli.h"
37#include "lpfc_nl.h"
37#include "lpfc_disc.h" 38#include "lpfc_disc.h"
38#include "lpfc_scsi.h" 39#include "lpfc_scsi.h"
39#include "lpfc.h" 40#include "lpfc.h"
@@ -745,3 +746,82 @@ lpfc_destroy_vport_work_array(struct lpfc_hba *phba, struct lpfc_vport **vports)
745 scsi_host_put(lpfc_shost_from_vport(vports[i])); 746 scsi_host_put(lpfc_shost_from_vport(vports[i]));
746 kfree(vports); 747 kfree(vports);
747} 748}
749
750
751/**
752 * lpfc_vport_reset_stat_data: Reset the statistical data for the vport.
753 * @vport: Pointer to vport object.
754 *
755 * This function resets the statistical data for the vport. This function
756 * is called with the host_lock held
757 **/
758void
759lpfc_vport_reset_stat_data(struct lpfc_vport *vport)
760{
761 struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL;
762
763 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
764 if (!NLP_CHK_NODE_ACT(ndlp))
765 continue;
766 if (ndlp->lat_data)
767 memset(ndlp->lat_data, 0, LPFC_MAX_BUCKET_COUNT *
768 sizeof(struct lpfc_scsicmd_bkt));
769 }
770}
771
772
773/**
774 * lpfc_alloc_bucket: Allocate data buffer required for collecting
775 * statistical data.
776 * @vport: Pointer to vport object.
777 *
778 * This function allocates data buffer required for all the FC
779 * nodes of the vport to collect statistical data.
780 **/
781void
782lpfc_alloc_bucket(struct lpfc_vport *vport)
783{
784 struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL;
785
786 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
787 if (!NLP_CHK_NODE_ACT(ndlp))
788 continue;
789
790 kfree(ndlp->lat_data);
791 ndlp->lat_data = NULL;
792
793 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE) {
794 ndlp->lat_data = kcalloc(LPFC_MAX_BUCKET_COUNT,
795 sizeof(struct lpfc_scsicmd_bkt),
796 GFP_ATOMIC);
797
798 if (!ndlp->lat_data)
799 lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE,
800 "0287 lpfc_alloc_bucket failed to "
801 "allocate statistical data buffer DID "
802 "0x%x\n", ndlp->nlp_DID);
803 }
804 }
805}
806
807/**
808 * lpfc_free_bucket: Free data buffer required for collecting
809 * statistical data.
810 * @vport: Pointer to vport object.
811 *
812 * Th function frees statistical data buffer of all the FC
813 * nodes of the vport.
814 **/
815void
816lpfc_free_bucket(struct lpfc_vport *vport)
817{
818 struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL;
819
820 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
821 if (!NLP_CHK_NODE_ACT(ndlp))
822 continue;
823
824 kfree(ndlp->lat_data);
825 ndlp->lat_data = NULL;
826 }
827}