aboutsummaryrefslogtreecommitdiffstats
path: root/include/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2011-03-14 07:06:11 -0400
committerJames Bottomley <James.Bottomley@suse.de>2011-03-23 12:36:50 -0400
commit12d233842987d9972957419e427987b94f7bd7b4 (patch)
treeb3d08872b37f08aac3a9ec66e3fef49fbedb0f19 /include/target
parent15fb48cc40be170423fe8ddd17666aa6175315e3 (diff)
[SCSI] target: add initial statistics
This patch adds a target_core_mib.c statistics conversion for backend context struct se_subsystem_dev + struct se_device config_group based statistics in target_core_device.c using CONFIGFS_EATTR() based struct config_item_types from target_core_stat.c code. The conversion from backend /proc/scsi_target/mib/ context output to configfs default groups+attributes include scsi_dev, scsi_lu, and scsi_tgt_dev output from within individual: /sys/kernel/config/target/core/$HBA/DEV/ The legacy procfs output now appear as individual configfs attributes under: *) $HBA/$DEV/statistics/scsi_dev: |-- indx |-- inst |-- ports `-- role *) $HBA/$DEV/statistics/scsi_lu: |-- creation_time |-- dev |-- dev_type |-- full_stat |-- hs_num_cmds |-- indx |-- inst |-- lu_name |-- lun |-- num_cmds |-- prod |-- read_mbytes |-- resets |-- rev |-- state_bit |-- status |-- vend `-- write_mbytes *) $HBA/$DEV/statistics/scsi_tgt_dev: |-- indx |-- inst |-- non_access_lus |-- num_lus |-- resets `-- status The conversion from backend /proc/scsi_target/mib/ context output to configfs default groups+attributes include scsi_port, scsi_tgt_port and scsi_transport output from within individual: /sys/kernel/config/target/fabric/$WWN/tpgt_$TPGT/lun/lun_$LUN_ID/statistics/ The legacy procfs output now appear as individual configfs attributes under: *) fabric/$WWN/tpgt_$TPGT/lun/lun_$LUN_ID/statistics/scsi_port |-- busy_count |-- dev |-- indx |-- inst `-- role *) fabric/$WWN/tpgt_$TPGT/lun/lun_$LUN_ID/statistics/scsi_tgt_port |-- dev |-- hs_in_cmds |-- in_cmds |-- indx |-- inst |-- name |-- port_index |-- read_mbytes `-- write_mbytes *) fabric/$WWN/tpgt_$TPGT/lun/lun_$LUN_ID/statistics/scsi_transport |-- dev_name |-- device |-- indx `-- inst The conversion from backend /proc/scsi_target/mib/ context output to configfs default groups+attributes include scsi_att_intr_port and scsi_auth_intr output from within individual: /sys/kernel/config/target/fabric/$WWN/tpgt_$TPGT/acls/$INITIATOR_WWN/lun_$LUN_ID/statistics/ The legacy procfs output now appear as individual configfs attributes under: *) acls/$INITIATOR_WWN/lun_$LUN_ID/statistics/scsi_att_intr_port |-- dev |-- indx |-- inst |-- port |-- port_auth_indx `-- port_ident *) acls/$INITIATOR_WWN/lun_$LUN_ID/statistics/scsi_auth_intr |-- att_count |-- creation_time |-- dev |-- dev_or_port |-- hs_num_cmds |-- indx |-- inst |-- intr_name |-- map_indx |-- num_cmds |-- port |-- read_mbytes |-- row_status `-- write_mbytes Also, this includes adding struct target_fabric_configfs_template-> tfc_wwn_fabric_stats_cit and ->tfc_tpg_nacl_stat_cit respectively for use during target_core_fabric_configfs.c:target_fabric_setup_cits() Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/target')
-rw-r--r--include/target/target_core_base.h35
-rw-r--r--include/target/target_core_configfs.h4
2 files changed, 37 insertions, 2 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 79f2e0a30dc8..c15ed5026fb5 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -601,7 +601,8 @@ struct se_node_acl {
601 struct config_group acl_attrib_group; 601 struct config_group acl_attrib_group;
602 struct config_group acl_auth_group; 602 struct config_group acl_auth_group;
603 struct config_group acl_param_group; 603 struct config_group acl_param_group;
604 struct config_group *acl_default_groups[4]; 604 struct config_group acl_fabric_stat_group;
605 struct config_group *acl_default_groups[5];
605 struct list_head acl_list; 606 struct list_head acl_list;
606 struct list_head acl_sess_list; 607 struct list_head acl_sess_list;
607} ____cacheline_aligned; 608} ____cacheline_aligned;
@@ -622,6 +623,12 @@ struct se_device;
622struct se_transform_info; 623struct se_transform_info;
623struct scatterlist; 624struct scatterlist;
624 625
626struct se_ml_stat_grps {
627 struct config_group stat_group;
628 struct config_group scsi_auth_intr_group;
629 struct config_group scsi_att_intr_port_group;
630};
631
625struct se_lun_acl { 632struct se_lun_acl {
626 char initiatorname[TRANSPORT_IQN_LEN]; 633 char initiatorname[TRANSPORT_IQN_LEN];
627 u32 mapped_lun; 634 u32 mapped_lun;
@@ -629,8 +636,11 @@ struct se_lun_acl {
629 struct se_lun *se_lun; 636 struct se_lun *se_lun;
630 struct list_head lacl_list; 637 struct list_head lacl_list;
631 struct config_group se_lun_group; 638 struct config_group se_lun_group;
639 struct se_ml_stat_grps ml_stat_grps;
632} ____cacheline_aligned; 640} ____cacheline_aligned;
633 641
642#define ML_STAT_GRPS(lacl) (&(lacl)->ml_stat_grps)
643
634struct se_dev_entry { 644struct se_dev_entry {
635 bool def_pr_registered; 645 bool def_pr_registered;
636 /* See transport_lunflags_table */ 646 /* See transport_lunflags_table */
@@ -693,6 +703,13 @@ struct se_dev_attrib {
693 struct config_group da_group; 703 struct config_group da_group;
694} ____cacheline_aligned; 704} ____cacheline_aligned;
695 705
706struct se_dev_stat_grps {
707 struct config_group stat_group;
708 struct config_group scsi_dev_group;
709 struct config_group scsi_tgt_dev_group;
710 struct config_group scsi_lu_group;
711};
712
696struct se_subsystem_dev { 713struct se_subsystem_dev {
697/* Used for struct se_subsystem_dev-->se_dev_alias, must be less than PAGE_SIZE */ 714/* Used for struct se_subsystem_dev-->se_dev_alias, must be less than PAGE_SIZE */
698#define SE_DEV_ALIAS_LEN 512 715#define SE_DEV_ALIAS_LEN 512
@@ -716,11 +733,14 @@ struct se_subsystem_dev {
716 struct config_group se_dev_group; 733 struct config_group se_dev_group;
717 /* For T10 Reservations */ 734 /* For T10 Reservations */
718 struct config_group se_dev_pr_group; 735 struct config_group se_dev_pr_group;
736 /* For target_core_stat.c groups */
737 struct se_dev_stat_grps dev_stat_grps;
719} ____cacheline_aligned; 738} ____cacheline_aligned;
720 739
721#define T10_ALUA(su_dev) (&(su_dev)->t10_alua) 740#define T10_ALUA(su_dev) (&(su_dev)->t10_alua)
722#define T10_RES(su_dev) (&(su_dev)->t10_reservation) 741#define T10_RES(su_dev) (&(su_dev)->t10_reservation)
723#define T10_PR_OPS(su_dev) (&(su_dev)->t10_reservation.pr_ops) 742#define T10_PR_OPS(su_dev) (&(su_dev)->t10_reservation.pr_ops)
743#define DEV_STAT_GRP(dev) (&(dev)->dev_stat_grps)
724 744
725struct se_device { 745struct se_device {
726 /* Set to 1 if thread is NOT sleeping on thread_sem */ 746 /* Set to 1 if thread is NOT sleeping on thread_sem */
@@ -834,6 +854,13 @@ struct se_hba {
834 854
835#define SE_HBA(dev) ((dev)->se_hba) 855#define SE_HBA(dev) ((dev)->se_hba)
836 856
857struct se_port_stat_grps {
858 struct config_group stat_group;
859 struct config_group scsi_port_group;
860 struct config_group scsi_tgt_port_group;
861 struct config_group scsi_transport_group;
862};
863
837struct se_lun { 864struct se_lun {
838 /* See transport_lun_status_table */ 865 /* See transport_lun_status_table */
839 enum transport_lun_status_table lun_status; 866 enum transport_lun_status_table lun_status;
@@ -848,11 +875,13 @@ struct se_lun {
848 struct list_head lun_cmd_list; 875 struct list_head lun_cmd_list;
849 struct list_head lun_acl_list; 876 struct list_head lun_acl_list;
850 struct se_device *lun_se_dev; 877 struct se_device *lun_se_dev;
878 struct se_port *lun_sep;
851 struct config_group lun_group; 879 struct config_group lun_group;
852 struct se_port *lun_sep; 880 struct se_port_stat_grps port_stat_grps;
853} ____cacheline_aligned; 881} ____cacheline_aligned;
854 882
855#define SE_LUN(cmd) ((cmd)->se_lun) 883#define SE_LUN(cmd) ((cmd)->se_lun)
884#define PORT_STAT_GRP(lun) (&(lun)->port_stat_grps)
856 885
857struct scsi_port_stats { 886struct scsi_port_stats {
858 u64 cmd_pdus; 887 u64 cmd_pdus;
@@ -924,6 +953,8 @@ struct se_portal_group {
924struct se_wwn { 953struct se_wwn {
925 struct target_fabric_configfs *wwn_tf; 954 struct target_fabric_configfs *wwn_tf;
926 struct config_group wwn_group; 955 struct config_group wwn_group;
956 struct config_group *wwn_default_groups[2];
957 struct config_group fabric_stat_group;
927} ____cacheline_aligned; 958} ____cacheline_aligned;
928 959
929struct se_global { 960struct se_global {
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index 40e6e740527c..612509592ffd 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -14,10 +14,12 @@ extern void target_fabric_configfs_deregister(struct target_fabric_configfs *);
14struct target_fabric_configfs_template { 14struct target_fabric_configfs_template {
15 struct config_item_type tfc_discovery_cit; 15 struct config_item_type tfc_discovery_cit;
16 struct config_item_type tfc_wwn_cit; 16 struct config_item_type tfc_wwn_cit;
17 struct config_item_type tfc_wwn_fabric_stats_cit;
17 struct config_item_type tfc_tpg_cit; 18 struct config_item_type tfc_tpg_cit;
18 struct config_item_type tfc_tpg_base_cit; 19 struct config_item_type tfc_tpg_base_cit;
19 struct config_item_type tfc_tpg_lun_cit; 20 struct config_item_type tfc_tpg_lun_cit;
20 struct config_item_type tfc_tpg_port_cit; 21 struct config_item_type tfc_tpg_port_cit;
22 struct config_item_type tfc_tpg_port_stat_cit;
21 struct config_item_type tfc_tpg_np_cit; 23 struct config_item_type tfc_tpg_np_cit;
22 struct config_item_type tfc_tpg_np_base_cit; 24 struct config_item_type tfc_tpg_np_base_cit;
23 struct config_item_type tfc_tpg_attrib_cit; 25 struct config_item_type tfc_tpg_attrib_cit;
@@ -27,7 +29,9 @@ struct target_fabric_configfs_template {
27 struct config_item_type tfc_tpg_nacl_attrib_cit; 29 struct config_item_type tfc_tpg_nacl_attrib_cit;
28 struct config_item_type tfc_tpg_nacl_auth_cit; 30 struct config_item_type tfc_tpg_nacl_auth_cit;
29 struct config_item_type tfc_tpg_nacl_param_cit; 31 struct config_item_type tfc_tpg_nacl_param_cit;
32 struct config_item_type tfc_tpg_nacl_stat_cit;
30 struct config_item_type tfc_tpg_mappedlun_cit; 33 struct config_item_type tfc_tpg_mappedlun_cit;
34 struct config_item_type tfc_tpg_mappedlun_stat_cit;
31}; 35};
32 36
33struct target_fabric_configfs { 37struct target_fabric_configfs {