aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorLalit Chandivade <lalit.chandivade@qlogic.com>2013-11-22 05:28:19 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-12-19 23:56:26 -0500
commit4161cee52df8628c7cac1b25d404d40c4fb57363 (patch)
treeebbc6d365b39c7691e2b40fc5a5cc7ea150496b9 /drivers/scsi
parent6fa7c554386d391d1d0f46bc298e57d2eda76e78 (diff)
[SCSI] qla4xxx: Add host statistics support
The statistics include MAC, TCP/IP & iSCSI statistics. Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla4xxx/ql4_fw.h83
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c205
2 files changed, 287 insertions, 1 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index fef311d9caa3..8d4092b33c07 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -1297,7 +1297,88 @@ struct response {
1297}; 1297};
1298 1298
1299struct ql_iscsi_stats { 1299struct ql_iscsi_stats {
1300 uint8_t reserved1[656]; /* 0000-028F */ 1300 uint64_t mac_tx_frames; /* 0000–0007 */
1301 uint64_t mac_tx_bytes; /* 0008–000F */
1302 uint64_t mac_tx_multicast_frames; /* 0010–0017 */
1303 uint64_t mac_tx_broadcast_frames; /* 0018–001F */
1304 uint64_t mac_tx_pause_frames; /* 0020–0027 */
1305 uint64_t mac_tx_control_frames; /* 0028–002F */
1306 uint64_t mac_tx_deferral; /* 0030–0037 */
1307 uint64_t mac_tx_excess_deferral; /* 0038–003F */
1308 uint64_t mac_tx_late_collision; /* 0040–0047 */
1309 uint64_t mac_tx_abort; /* 0048–004F */
1310 uint64_t mac_tx_single_collision; /* 0050–0057 */
1311 uint64_t mac_tx_multiple_collision; /* 0058–005F */
1312 uint64_t mac_tx_collision; /* 0060–0067 */
1313 uint64_t mac_tx_frames_dropped; /* 0068–006F */
1314 uint64_t mac_tx_jumbo_frames; /* 0070–0077 */
1315 uint64_t mac_rx_frames; /* 0078–007F */
1316 uint64_t mac_rx_bytes; /* 0080–0087 */
1317 uint64_t mac_rx_unknown_control_frames; /* 0088–008F */
1318 uint64_t mac_rx_pause_frames; /* 0090–0097 */
1319 uint64_t mac_rx_control_frames; /* 0098–009F */
1320 uint64_t mac_rx_dribble; /* 00A0–00A7 */
1321 uint64_t mac_rx_frame_length_error; /* 00A8–00AF */
1322 uint64_t mac_rx_jabber; /* 00B0–00B7 */
1323 uint64_t mac_rx_carrier_sense_error; /* 00B8–00BF */
1324 uint64_t mac_rx_frame_discarded; /* 00C0–00C7 */
1325 uint64_t mac_rx_frames_dropped; /* 00C8–00CF */
1326 uint64_t mac_crc_error; /* 00D0–00D7 */
1327 uint64_t mac_encoding_error; /* 00D8–00DF */
1328 uint64_t mac_rx_length_error_large; /* 00E0–00E7 */
1329 uint64_t mac_rx_length_error_small; /* 00E8–00EF */
1330 uint64_t mac_rx_multicast_frames; /* 00F0–00F7 */
1331 uint64_t mac_rx_broadcast_frames; /* 00F8–00FF */
1332 uint64_t ip_tx_packets; /* 0100–0107 */
1333 uint64_t ip_tx_bytes; /* 0108–010F */
1334 uint64_t ip_tx_fragments; /* 0110–0117 */
1335 uint64_t ip_rx_packets; /* 0118–011F */
1336 uint64_t ip_rx_bytes; /* 0120–0127 */
1337 uint64_t ip_rx_fragments; /* 0128–012F */
1338 uint64_t ip_datagram_reassembly; /* 0130–0137 */
1339 uint64_t ip_invalid_address_error; /* 0138–013F */
1340 uint64_t ip_error_packets; /* 0140–0147 */
1341 uint64_t ip_fragrx_overlap; /* 0148–014F */
1342 uint64_t ip_fragrx_outoforder; /* 0150–0157 */
1343 uint64_t ip_datagram_reassembly_timeout; /* 0158–015F */
1344 uint64_t ipv6_tx_packets; /* 0160–0167 */
1345 uint64_t ipv6_tx_bytes; /* 0168–016F */
1346 uint64_t ipv6_tx_fragments; /* 0170–0177 */
1347 uint64_t ipv6_rx_packets; /* 0178–017F */
1348 uint64_t ipv6_rx_bytes; /* 0180–0187 */
1349 uint64_t ipv6_rx_fragments; /* 0188–018F */
1350 uint64_t ipv6_datagram_reassembly; /* 0190–0197 */
1351 uint64_t ipv6_invalid_address_error; /* 0198–019F */
1352 uint64_t ipv6_error_packets; /* 01A0–01A7 */
1353 uint64_t ipv6_fragrx_overlap; /* 01A8–01AF */
1354 uint64_t ipv6_fragrx_outoforder; /* 01B0–01B7 */
1355 uint64_t ipv6_datagram_reassembly_timeout; /* 01B8–01BF */
1356 uint64_t tcp_tx_segments; /* 01C0–01C7 */
1357 uint64_t tcp_tx_bytes; /* 01C8–01CF */
1358 uint64_t tcp_rx_segments; /* 01D0–01D7 */
1359 uint64_t tcp_rx_byte; /* 01D8–01DF */
1360 uint64_t tcp_duplicate_ack_retx; /* 01E0–01E7 */
1361 uint64_t tcp_retx_timer_expired; /* 01E8–01EF */
1362 uint64_t tcp_rx_duplicate_ack; /* 01F0–01F7 */
1363 uint64_t tcp_rx_pure_ackr; /* 01F8–01FF */
1364 uint64_t tcp_tx_delayed_ack; /* 0200–0207 */
1365 uint64_t tcp_tx_pure_ack; /* 0208–020F */
1366 uint64_t tcp_rx_segment_error; /* 0210–0217 */
1367 uint64_t tcp_rx_segment_outoforder; /* 0218–021F */
1368 uint64_t tcp_rx_window_probe; /* 0220–0227 */
1369 uint64_t tcp_rx_window_update; /* 0228–022F */
1370 uint64_t tcp_tx_window_probe_persist; /* 0230–0237 */
1371 uint64_t ecc_error_correction; /* 0238–023F */
1372 uint64_t iscsi_pdu_tx; /* 0240-0247 */
1373 uint64_t iscsi_data_bytes_tx; /* 0248-024F */
1374 uint64_t iscsi_pdu_rx; /* 0250-0257 */
1375 uint64_t iscsi_data_bytes_rx; /* 0258-025F */
1376 uint64_t iscsi_io_completed; /* 0260-0267 */
1377 uint64_t iscsi_unexpected_io_rx; /* 0268-026F */
1378 uint64_t iscsi_format_error; /* 0270-0277 */
1379 uint64_t iscsi_hdr_digest_error; /* 0278-027F */
1380 uint64_t iscsi_data_digest_error; /* 0280-0287 */
1381 uint64_t iscsi_sequence_error; /* 0288-028F */
1301 uint32_t tx_cmd_pdu; /* 0290-0293 */ 1382 uint32_t tx_cmd_pdu; /* 0290-0293 */
1302 uint32_t tx_resp_pdu; /* 0294-0297 */ 1383 uint32_t tx_resp_pdu; /* 0294-0297 */
1303 uint32_t rx_cmd_pdu; /* 0298-029B */ 1384 uint32_t rx_cmd_pdu; /* 0298-029B */
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 1d86f5bbd1d0..295b8d401bc4 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -151,6 +151,7 @@ static int qla4xxx_get_chap_list(struct Scsi_Host *shost, uint16_t chap_tbl_idx,
151static int qla4xxx_delete_chap(struct Scsi_Host *shost, uint16_t chap_tbl_idx); 151static int qla4xxx_delete_chap(struct Scsi_Host *shost, uint16_t chap_tbl_idx);
152static int qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data, 152static int qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data,
153 int len); 153 int len);
154static int qla4xxx_get_host_stats(struct Scsi_Host *shost, char *buf, int len);
154 155
155/* 156/*
156 * SCSI host template entry points 157 * SCSI host template entry points
@@ -262,6 +263,7 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
262 .login_flashnode = qla4xxx_sysfs_ddb_login, 263 .login_flashnode = qla4xxx_sysfs_ddb_login,
263 .logout_flashnode = qla4xxx_sysfs_ddb_logout, 264 .logout_flashnode = qla4xxx_sysfs_ddb_logout,
264 .logout_flashnode_sid = qla4xxx_sysfs_ddb_logout_sid, 265 .logout_flashnode_sid = qla4xxx_sysfs_ddb_logout_sid,
266 .get_host_stats = qla4xxx_get_host_stats,
265}; 267};
266 268
267static struct scsi_transport_template *qla4xxx_scsi_transport; 269static struct scsi_transport_template *qla4xxx_scsi_transport;
@@ -950,6 +952,209 @@ exit_set_chap:
950 return rc; 952 return rc;
951} 953}
952 954
955
956static int qla4xxx_get_host_stats(struct Scsi_Host *shost, char *buf, int len)
957{
958 struct scsi_qla_host *ha = to_qla_host(shost);
959 struct iscsi_offload_host_stats *host_stats = NULL;
960 int host_stats_size;
961 int ret = 0;
962 int ddb_idx = 0;
963 struct ql_iscsi_stats *ql_iscsi_stats = NULL;
964 int stats_size;
965 dma_addr_t iscsi_stats_dma;
966
967 DEBUG2(ql4_printk(KERN_INFO, ha, "Func: %s\n", __func__));
968
969 host_stats_size = sizeof(struct iscsi_offload_host_stats);
970
971 if (host_stats_size != len) {
972 ql4_printk(KERN_INFO, ha, "%s: host_stats size mismatch expected = %d, is = %d\n",
973 __func__, len, host_stats_size);
974 ret = -EINVAL;
975 goto exit_host_stats;
976 }
977 host_stats = (struct iscsi_offload_host_stats *)buf;
978
979 if (!buf) {
980 ret = -ENOMEM;
981 goto exit_host_stats;
982 }
983
984 stats_size = PAGE_ALIGN(sizeof(struct ql_iscsi_stats));
985
986 ql_iscsi_stats = dma_alloc_coherent(&ha->pdev->dev, stats_size,
987 &iscsi_stats_dma, GFP_KERNEL);
988 if (!ql_iscsi_stats) {
989 ql4_printk(KERN_ERR, ha,
990 "Unable to allocate memory for iscsi stats\n");
991 goto exit_host_stats;
992 }
993
994 ret = qla4xxx_get_mgmt_data(ha, ddb_idx, stats_size,
995 iscsi_stats_dma);
996 if (ret != QLA_SUCCESS) {
997 ql4_printk(KERN_ERR, ha,
998 "Unable to retrieve iscsi stats\n");
999 goto exit_host_stats;
1000 }
1001 host_stats->mactx_frames = le64_to_cpu(ql_iscsi_stats->mac_tx_frames);
1002 host_stats->mactx_bytes = le64_to_cpu(ql_iscsi_stats->mac_tx_bytes);
1003 host_stats->mactx_multicast_frames =
1004 le64_to_cpu(ql_iscsi_stats->mac_tx_multicast_frames);
1005 host_stats->mactx_broadcast_frames =
1006 le64_to_cpu(ql_iscsi_stats->mac_tx_broadcast_frames);
1007 host_stats->mactx_pause_frames =
1008 le64_to_cpu(ql_iscsi_stats->mac_tx_pause_frames);
1009 host_stats->mactx_control_frames =
1010 le64_to_cpu(ql_iscsi_stats->mac_tx_control_frames);
1011 host_stats->mactx_deferral =
1012 le64_to_cpu(ql_iscsi_stats->mac_tx_deferral);
1013 host_stats->mactx_excess_deferral =
1014 le64_to_cpu(ql_iscsi_stats->mac_tx_excess_deferral);
1015 host_stats->mactx_late_collision =
1016 le64_to_cpu(ql_iscsi_stats->mac_tx_late_collision);
1017 host_stats->mactx_abort = le64_to_cpu(ql_iscsi_stats->mac_tx_abort);
1018 host_stats->mactx_single_collision =
1019 le64_to_cpu(ql_iscsi_stats->mac_tx_single_collision);
1020 host_stats->mactx_multiple_collision =
1021 le64_to_cpu(ql_iscsi_stats->mac_tx_multiple_collision);
1022 host_stats->mactx_collision =
1023 le64_to_cpu(ql_iscsi_stats->mac_tx_collision);
1024 host_stats->mactx_frames_dropped =
1025 le64_to_cpu(ql_iscsi_stats->mac_tx_frames_dropped);
1026 host_stats->mactx_jumbo_frames =
1027 le64_to_cpu(ql_iscsi_stats->mac_tx_jumbo_frames);
1028 host_stats->macrx_frames = le64_to_cpu(ql_iscsi_stats->mac_rx_frames);
1029 host_stats->macrx_bytes = le64_to_cpu(ql_iscsi_stats->mac_rx_bytes);
1030 host_stats->macrx_unknown_control_frames =
1031 le64_to_cpu(ql_iscsi_stats->mac_rx_unknown_control_frames);
1032 host_stats->macrx_pause_frames =
1033 le64_to_cpu(ql_iscsi_stats->mac_rx_pause_frames);
1034 host_stats->macrx_control_frames =
1035 le64_to_cpu(ql_iscsi_stats->mac_rx_control_frames);
1036 host_stats->macrx_dribble =
1037 le64_to_cpu(ql_iscsi_stats->mac_rx_dribble);
1038 host_stats->macrx_frame_length_error =
1039 le64_to_cpu(ql_iscsi_stats->mac_rx_frame_length_error);
1040 host_stats->macrx_jabber = le64_to_cpu(ql_iscsi_stats->mac_rx_jabber);
1041 host_stats->macrx_carrier_sense_error =
1042 le64_to_cpu(ql_iscsi_stats->mac_rx_carrier_sense_error);
1043 host_stats->macrx_frame_discarded =
1044 le64_to_cpu(ql_iscsi_stats->mac_rx_frame_discarded);
1045 host_stats->macrx_frames_dropped =
1046 le64_to_cpu(ql_iscsi_stats->mac_rx_frames_dropped);
1047 host_stats->mac_crc_error = le64_to_cpu(ql_iscsi_stats->mac_crc_error);
1048 host_stats->mac_encoding_error =
1049 le64_to_cpu(ql_iscsi_stats->mac_encoding_error);
1050 host_stats->macrx_length_error_large =
1051 le64_to_cpu(ql_iscsi_stats->mac_rx_length_error_large);
1052 host_stats->macrx_length_error_small =
1053 le64_to_cpu(ql_iscsi_stats->mac_rx_length_error_small);
1054 host_stats->macrx_multicast_frames =
1055 le64_to_cpu(ql_iscsi_stats->mac_rx_multicast_frames);
1056 host_stats->macrx_broadcast_frames =
1057 le64_to_cpu(ql_iscsi_stats->mac_rx_broadcast_frames);
1058 host_stats->iptx_packets = le64_to_cpu(ql_iscsi_stats->ip_tx_packets);
1059 host_stats->iptx_bytes = le64_to_cpu(ql_iscsi_stats->ip_tx_bytes);
1060 host_stats->iptx_fragments =
1061 le64_to_cpu(ql_iscsi_stats->ip_tx_fragments);
1062 host_stats->iprx_packets = le64_to_cpu(ql_iscsi_stats->ip_rx_packets);
1063 host_stats->iprx_bytes = le64_to_cpu(ql_iscsi_stats->ip_rx_bytes);
1064 host_stats->iprx_fragments =
1065 le64_to_cpu(ql_iscsi_stats->ip_rx_fragments);
1066 host_stats->ip_datagram_reassembly =
1067 le64_to_cpu(ql_iscsi_stats->ip_datagram_reassembly);
1068 host_stats->ip_invalid_address_error =
1069 le64_to_cpu(ql_iscsi_stats->ip_invalid_address_error);
1070 host_stats->ip_error_packets =
1071 le64_to_cpu(ql_iscsi_stats->ip_error_packets);
1072 host_stats->ip_fragrx_overlap =
1073 le64_to_cpu(ql_iscsi_stats->ip_fragrx_overlap);
1074 host_stats->ip_fragrx_outoforder =
1075 le64_to_cpu(ql_iscsi_stats->ip_fragrx_outoforder);
1076 host_stats->ip_datagram_reassembly_timeout =
1077 le64_to_cpu(ql_iscsi_stats->ip_datagram_reassembly_timeout);
1078 host_stats->ipv6tx_packets =
1079 le64_to_cpu(ql_iscsi_stats->ipv6_tx_packets);
1080 host_stats->ipv6tx_bytes = le64_to_cpu(ql_iscsi_stats->ipv6_tx_bytes);
1081 host_stats->ipv6tx_fragments =
1082 le64_to_cpu(ql_iscsi_stats->ipv6_tx_fragments);
1083 host_stats->ipv6rx_packets =
1084 le64_to_cpu(ql_iscsi_stats->ipv6_rx_packets);
1085 host_stats->ipv6rx_bytes = le64_to_cpu(ql_iscsi_stats->ipv6_rx_bytes);
1086 host_stats->ipv6rx_fragments =
1087 le64_to_cpu(ql_iscsi_stats->ipv6_rx_fragments);
1088 host_stats->ipv6_datagram_reassembly =
1089 le64_to_cpu(ql_iscsi_stats->ipv6_datagram_reassembly);
1090 host_stats->ipv6_invalid_address_error =
1091 le64_to_cpu(ql_iscsi_stats->ipv6_invalid_address_error);
1092 host_stats->ipv6_error_packets =
1093 le64_to_cpu(ql_iscsi_stats->ipv6_error_packets);
1094 host_stats->ipv6_fragrx_overlap =
1095 le64_to_cpu(ql_iscsi_stats->ipv6_fragrx_overlap);
1096 host_stats->ipv6_fragrx_outoforder =
1097 le64_to_cpu(ql_iscsi_stats->ipv6_fragrx_outoforder);
1098 host_stats->ipv6_datagram_reassembly_timeout =
1099 le64_to_cpu(ql_iscsi_stats->ipv6_datagram_reassembly_timeout);
1100 host_stats->tcptx_segments =
1101 le64_to_cpu(ql_iscsi_stats->tcp_tx_segments);
1102 host_stats->tcptx_bytes = le64_to_cpu(ql_iscsi_stats->tcp_tx_bytes);
1103 host_stats->tcprx_segments =
1104 le64_to_cpu(ql_iscsi_stats->tcp_rx_segments);
1105 host_stats->tcprx_byte = le64_to_cpu(ql_iscsi_stats->tcp_rx_byte);
1106 host_stats->tcp_duplicate_ack_retx =
1107 le64_to_cpu(ql_iscsi_stats->tcp_duplicate_ack_retx);
1108 host_stats->tcp_retx_timer_expired =
1109 le64_to_cpu(ql_iscsi_stats->tcp_retx_timer_expired);
1110 host_stats->tcprx_duplicate_ack =
1111 le64_to_cpu(ql_iscsi_stats->tcp_rx_duplicate_ack);
1112 host_stats->tcprx_pure_ackr =
1113 le64_to_cpu(ql_iscsi_stats->tcp_rx_pure_ackr);
1114 host_stats->tcptx_delayed_ack =
1115 le64_to_cpu(ql_iscsi_stats->tcp_tx_delayed_ack);
1116 host_stats->tcptx_pure_ack =
1117 le64_to_cpu(ql_iscsi_stats->tcp_tx_pure_ack);
1118 host_stats->tcprx_segment_error =
1119 le64_to_cpu(ql_iscsi_stats->tcp_rx_segment_error);
1120 host_stats->tcprx_segment_outoforder =
1121 le64_to_cpu(ql_iscsi_stats->tcp_rx_segment_outoforder);
1122 host_stats->tcprx_window_probe =
1123 le64_to_cpu(ql_iscsi_stats->tcp_rx_window_probe);
1124 host_stats->tcprx_window_update =
1125 le64_to_cpu(ql_iscsi_stats->tcp_rx_window_update);
1126 host_stats->tcptx_window_probe_persist =
1127 le64_to_cpu(ql_iscsi_stats->tcp_tx_window_probe_persist);
1128 host_stats->ecc_error_correction =
1129 le64_to_cpu(ql_iscsi_stats->ecc_error_correction);
1130 host_stats->iscsi_pdu_tx = le64_to_cpu(ql_iscsi_stats->iscsi_pdu_tx);
1131 host_stats->iscsi_data_bytes_tx =
1132 le64_to_cpu(ql_iscsi_stats->iscsi_data_bytes_tx);
1133 host_stats->iscsi_pdu_rx = le64_to_cpu(ql_iscsi_stats->iscsi_pdu_rx);
1134 host_stats->iscsi_data_bytes_rx =
1135 le64_to_cpu(ql_iscsi_stats->iscsi_data_bytes_rx);
1136 host_stats->iscsi_io_completed =
1137 le64_to_cpu(ql_iscsi_stats->iscsi_io_completed);
1138 host_stats->iscsi_unexpected_io_rx =
1139 le64_to_cpu(ql_iscsi_stats->iscsi_unexpected_io_rx);
1140 host_stats->iscsi_format_error =
1141 le64_to_cpu(ql_iscsi_stats->iscsi_format_error);
1142 host_stats->iscsi_hdr_digest_error =
1143 le64_to_cpu(ql_iscsi_stats->iscsi_hdr_digest_error);
1144 host_stats->iscsi_data_digest_error =
1145 le64_to_cpu(ql_iscsi_stats->iscsi_data_digest_error);
1146 host_stats->iscsi_sequence_error =
1147 le64_to_cpu(ql_iscsi_stats->iscsi_sequence_error);
1148exit_host_stats:
1149 if (ql_iscsi_stats)
1150 dma_free_coherent(&ha->pdev->dev, host_stats_size,
1151 ql_iscsi_stats, iscsi_stats_dma);
1152
1153 ql4_printk(KERN_INFO, ha, "%s: Get host stats done\n",
1154 __func__);
1155 return ret;
1156}
1157
953static int qla4xxx_get_iface_param(struct iscsi_iface *iface, 1158static int qla4xxx_get_iface_param(struct iscsi_iface *iface,
954 enum iscsi_param_type param_type, 1159 enum iscsi_param_type param_type,
955 int param, char *buf) 1160 int param, char *buf)