[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>
This commit is contained in:
Lalit Chandivade 2013-11-22 05:28:19 -05:00 committed by James Bottomley
parent 6fa7c55438
commit 4161cee52d
2 changed files with 287 additions and 1 deletions

View File

@ -1297,7 +1297,88 @@ struct response {
};
struct ql_iscsi_stats {
uint8_t reserved1[656]; /* 0000-028F */
uint64_t mac_tx_frames; /* 00000007 */
uint64_t mac_tx_bytes; /* 0008000F */
uint64_t mac_tx_multicast_frames; /* 00100017 */
uint64_t mac_tx_broadcast_frames; /* 0018001F */
uint64_t mac_tx_pause_frames; /* 00200027 */
uint64_t mac_tx_control_frames; /* 0028002F */
uint64_t mac_tx_deferral; /* 00300037 */
uint64_t mac_tx_excess_deferral; /* 0038003F */
uint64_t mac_tx_late_collision; /* 00400047 */
uint64_t mac_tx_abort; /* 0048004F */
uint64_t mac_tx_single_collision; /* 00500057 */
uint64_t mac_tx_multiple_collision; /* 0058005F */
uint64_t mac_tx_collision; /* 00600067 */
uint64_t mac_tx_frames_dropped; /* 0068006F */
uint64_t mac_tx_jumbo_frames; /* 00700077 */
uint64_t mac_rx_frames; /* 0078007F */
uint64_t mac_rx_bytes; /* 00800087 */
uint64_t mac_rx_unknown_control_frames; /* 0088008F */
uint64_t mac_rx_pause_frames; /* 00900097 */
uint64_t mac_rx_control_frames; /* 0098009F */
uint64_t mac_rx_dribble; /* 00A000A7 */
uint64_t mac_rx_frame_length_error; /* 00A800AF */
uint64_t mac_rx_jabber; /* 00B000B7 */
uint64_t mac_rx_carrier_sense_error; /* 00B800BF */
uint64_t mac_rx_frame_discarded; /* 00C000C7 */
uint64_t mac_rx_frames_dropped; /* 00C800CF */
uint64_t mac_crc_error; /* 00D000D7 */
uint64_t mac_encoding_error; /* 00D800DF */
uint64_t mac_rx_length_error_large; /* 00E000E7 */
uint64_t mac_rx_length_error_small; /* 00E800EF */
uint64_t mac_rx_multicast_frames; /* 00F000F7 */
uint64_t mac_rx_broadcast_frames; /* 00F800FF */
uint64_t ip_tx_packets; /* 01000107 */
uint64_t ip_tx_bytes; /* 0108010F */
uint64_t ip_tx_fragments; /* 01100117 */
uint64_t ip_rx_packets; /* 0118011F */
uint64_t ip_rx_bytes; /* 01200127 */
uint64_t ip_rx_fragments; /* 0128012F */
uint64_t ip_datagram_reassembly; /* 01300137 */
uint64_t ip_invalid_address_error; /* 0138013F */
uint64_t ip_error_packets; /* 01400147 */
uint64_t ip_fragrx_overlap; /* 0148014F */
uint64_t ip_fragrx_outoforder; /* 01500157 */
uint64_t ip_datagram_reassembly_timeout; /* 0158015F */
uint64_t ipv6_tx_packets; /* 01600167 */
uint64_t ipv6_tx_bytes; /* 0168016F */
uint64_t ipv6_tx_fragments; /* 01700177 */
uint64_t ipv6_rx_packets; /* 0178017F */
uint64_t ipv6_rx_bytes; /* 01800187 */
uint64_t ipv6_rx_fragments; /* 0188018F */
uint64_t ipv6_datagram_reassembly; /* 01900197 */
uint64_t ipv6_invalid_address_error; /* 0198019F */
uint64_t ipv6_error_packets; /* 01A001A7 */
uint64_t ipv6_fragrx_overlap; /* 01A801AF */
uint64_t ipv6_fragrx_outoforder; /* 01B001B7 */
uint64_t ipv6_datagram_reassembly_timeout; /* 01B801BF */
uint64_t tcp_tx_segments; /* 01C001C7 */
uint64_t tcp_tx_bytes; /* 01C801CF */
uint64_t tcp_rx_segments; /* 01D001D7 */
uint64_t tcp_rx_byte; /* 01D801DF */
uint64_t tcp_duplicate_ack_retx; /* 01E001E7 */
uint64_t tcp_retx_timer_expired; /* 01E801EF */
uint64_t tcp_rx_duplicate_ack; /* 01F001F7 */
uint64_t tcp_rx_pure_ackr; /* 01F801FF */
uint64_t tcp_tx_delayed_ack; /* 02000207 */
uint64_t tcp_tx_pure_ack; /* 0208020F */
uint64_t tcp_rx_segment_error; /* 02100217 */
uint64_t tcp_rx_segment_outoforder; /* 0218021F */
uint64_t tcp_rx_window_probe; /* 02200227 */
uint64_t tcp_rx_window_update; /* 0228022F */
uint64_t tcp_tx_window_probe_persist; /* 02300237 */
uint64_t ecc_error_correction; /* 0238023F */
uint64_t iscsi_pdu_tx; /* 0240-0247 */
uint64_t iscsi_data_bytes_tx; /* 0248-024F */
uint64_t iscsi_pdu_rx; /* 0250-0257 */
uint64_t iscsi_data_bytes_rx; /* 0258-025F */
uint64_t iscsi_io_completed; /* 0260-0267 */
uint64_t iscsi_unexpected_io_rx; /* 0268-026F */
uint64_t iscsi_format_error; /* 0270-0277 */
uint64_t iscsi_hdr_digest_error; /* 0278-027F */
uint64_t iscsi_data_digest_error; /* 0280-0287 */
uint64_t iscsi_sequence_error; /* 0288-028F */
uint32_t tx_cmd_pdu; /* 0290-0293 */
uint32_t tx_resp_pdu; /* 0294-0297 */
uint32_t rx_cmd_pdu; /* 0298-029B */

View File

@ -151,6 +151,7 @@ static int qla4xxx_get_chap_list(struct Scsi_Host *shost, uint16_t chap_tbl_idx,
static int qla4xxx_delete_chap(struct Scsi_Host *shost, uint16_t chap_tbl_idx);
static int qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data,
int len);
static int qla4xxx_get_host_stats(struct Scsi_Host *shost, char *buf, int len);
/*
* SCSI host template entry points
@ -262,6 +263,7 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
.login_flashnode = qla4xxx_sysfs_ddb_login,
.logout_flashnode = qla4xxx_sysfs_ddb_logout,
.logout_flashnode_sid = qla4xxx_sysfs_ddb_logout_sid,
.get_host_stats = qla4xxx_get_host_stats,
};
static struct scsi_transport_template *qla4xxx_scsi_transport;
@ -950,6 +952,209 @@ exit_set_chap:
return rc;
}
static int qla4xxx_get_host_stats(struct Scsi_Host *shost, char *buf, int len)
{
struct scsi_qla_host *ha = to_qla_host(shost);
struct iscsi_offload_host_stats *host_stats = NULL;
int host_stats_size;
int ret = 0;
int ddb_idx = 0;
struct ql_iscsi_stats *ql_iscsi_stats = NULL;
int stats_size;
dma_addr_t iscsi_stats_dma;
DEBUG2(ql4_printk(KERN_INFO, ha, "Func: %s\n", __func__));
host_stats_size = sizeof(struct iscsi_offload_host_stats);
if (host_stats_size != len) {
ql4_printk(KERN_INFO, ha, "%s: host_stats size mismatch expected = %d, is = %d\n",
__func__, len, host_stats_size);
ret = -EINVAL;
goto exit_host_stats;
}
host_stats = (struct iscsi_offload_host_stats *)buf;
if (!buf) {
ret = -ENOMEM;
goto exit_host_stats;
}
stats_size = PAGE_ALIGN(sizeof(struct ql_iscsi_stats));
ql_iscsi_stats = dma_alloc_coherent(&ha->pdev->dev, stats_size,
&iscsi_stats_dma, GFP_KERNEL);
if (!ql_iscsi_stats) {
ql4_printk(KERN_ERR, ha,
"Unable to allocate memory for iscsi stats\n");
goto exit_host_stats;
}
ret = qla4xxx_get_mgmt_data(ha, ddb_idx, stats_size,
iscsi_stats_dma);
if (ret != QLA_SUCCESS) {
ql4_printk(KERN_ERR, ha,
"Unable to retrieve iscsi stats\n");
goto exit_host_stats;
}
host_stats->mactx_frames = le64_to_cpu(ql_iscsi_stats->mac_tx_frames);
host_stats->mactx_bytes = le64_to_cpu(ql_iscsi_stats->mac_tx_bytes);
host_stats->mactx_multicast_frames =
le64_to_cpu(ql_iscsi_stats->mac_tx_multicast_frames);
host_stats->mactx_broadcast_frames =
le64_to_cpu(ql_iscsi_stats->mac_tx_broadcast_frames);
host_stats->mactx_pause_frames =
le64_to_cpu(ql_iscsi_stats->mac_tx_pause_frames);
host_stats->mactx_control_frames =
le64_to_cpu(ql_iscsi_stats->mac_tx_control_frames);
host_stats->mactx_deferral =
le64_to_cpu(ql_iscsi_stats->mac_tx_deferral);
host_stats->mactx_excess_deferral =
le64_to_cpu(ql_iscsi_stats->mac_tx_excess_deferral);
host_stats->mactx_late_collision =
le64_to_cpu(ql_iscsi_stats->mac_tx_late_collision);
host_stats->mactx_abort = le64_to_cpu(ql_iscsi_stats->mac_tx_abort);
host_stats->mactx_single_collision =
le64_to_cpu(ql_iscsi_stats->mac_tx_single_collision);
host_stats->mactx_multiple_collision =
le64_to_cpu(ql_iscsi_stats->mac_tx_multiple_collision);
host_stats->mactx_collision =
le64_to_cpu(ql_iscsi_stats->mac_tx_collision);
host_stats->mactx_frames_dropped =
le64_to_cpu(ql_iscsi_stats->mac_tx_frames_dropped);
host_stats->mactx_jumbo_frames =
le64_to_cpu(ql_iscsi_stats->mac_tx_jumbo_frames);
host_stats->macrx_frames = le64_to_cpu(ql_iscsi_stats->mac_rx_frames);
host_stats->macrx_bytes = le64_to_cpu(ql_iscsi_stats->mac_rx_bytes);
host_stats->macrx_unknown_control_frames =
le64_to_cpu(ql_iscsi_stats->mac_rx_unknown_control_frames);
host_stats->macrx_pause_frames =
le64_to_cpu(ql_iscsi_stats->mac_rx_pause_frames);
host_stats->macrx_control_frames =
le64_to_cpu(ql_iscsi_stats->mac_rx_control_frames);
host_stats->macrx_dribble =
le64_to_cpu(ql_iscsi_stats->mac_rx_dribble);
host_stats->macrx_frame_length_error =
le64_to_cpu(ql_iscsi_stats->mac_rx_frame_length_error);
host_stats->macrx_jabber = le64_to_cpu(ql_iscsi_stats->mac_rx_jabber);
host_stats->macrx_carrier_sense_error =
le64_to_cpu(ql_iscsi_stats->mac_rx_carrier_sense_error);
host_stats->macrx_frame_discarded =
le64_to_cpu(ql_iscsi_stats->mac_rx_frame_discarded);
host_stats->macrx_frames_dropped =
le64_to_cpu(ql_iscsi_stats->mac_rx_frames_dropped);
host_stats->mac_crc_error = le64_to_cpu(ql_iscsi_stats->mac_crc_error);
host_stats->mac_encoding_error =
le64_to_cpu(ql_iscsi_stats->mac_encoding_error);
host_stats->macrx_length_error_large =
le64_to_cpu(ql_iscsi_stats->mac_rx_length_error_large);
host_stats->macrx_length_error_small =
le64_to_cpu(ql_iscsi_stats->mac_rx_length_error_small);
host_stats->macrx_multicast_frames =
le64_to_cpu(ql_iscsi_stats->mac_rx_multicast_frames);
host_stats->macrx_broadcast_frames =
le64_to_cpu(ql_iscsi_stats->mac_rx_broadcast_frames);
host_stats->iptx_packets = le64_to_cpu(ql_iscsi_stats->ip_tx_packets);
host_stats->iptx_bytes = le64_to_cpu(ql_iscsi_stats->ip_tx_bytes);
host_stats->iptx_fragments =
le64_to_cpu(ql_iscsi_stats->ip_tx_fragments);
host_stats->iprx_packets = le64_to_cpu(ql_iscsi_stats->ip_rx_packets);
host_stats->iprx_bytes = le64_to_cpu(ql_iscsi_stats->ip_rx_bytes);
host_stats->iprx_fragments =
le64_to_cpu(ql_iscsi_stats->ip_rx_fragments);
host_stats->ip_datagram_reassembly =
le64_to_cpu(ql_iscsi_stats->ip_datagram_reassembly);
host_stats->ip_invalid_address_error =
le64_to_cpu(ql_iscsi_stats->ip_invalid_address_error);
host_stats->ip_error_packets =
le64_to_cpu(ql_iscsi_stats->ip_error_packets);
host_stats->ip_fragrx_overlap =
le64_to_cpu(ql_iscsi_stats->ip_fragrx_overlap);
host_stats->ip_fragrx_outoforder =
le64_to_cpu(ql_iscsi_stats->ip_fragrx_outoforder);
host_stats->ip_datagram_reassembly_timeout =
le64_to_cpu(ql_iscsi_stats->ip_datagram_reassembly_timeout);
host_stats->ipv6tx_packets =
le64_to_cpu(ql_iscsi_stats->ipv6_tx_packets);
host_stats->ipv6tx_bytes = le64_to_cpu(ql_iscsi_stats->ipv6_tx_bytes);
host_stats->ipv6tx_fragments =
le64_to_cpu(ql_iscsi_stats->ipv6_tx_fragments);
host_stats->ipv6rx_packets =
le64_to_cpu(ql_iscsi_stats->ipv6_rx_packets);
host_stats->ipv6rx_bytes = le64_to_cpu(ql_iscsi_stats->ipv6_rx_bytes);
host_stats->ipv6rx_fragments =
le64_to_cpu(ql_iscsi_stats->ipv6_rx_fragments);
host_stats->ipv6_datagram_reassembly =
le64_to_cpu(ql_iscsi_stats->ipv6_datagram_reassembly);
host_stats->ipv6_invalid_address_error =
le64_to_cpu(ql_iscsi_stats->ipv6_invalid_address_error);
host_stats->ipv6_error_packets =
le64_to_cpu(ql_iscsi_stats->ipv6_error_packets);
host_stats->ipv6_fragrx_overlap =
le64_to_cpu(ql_iscsi_stats->ipv6_fragrx_overlap);
host_stats->ipv6_fragrx_outoforder =
le64_to_cpu(ql_iscsi_stats->ipv6_fragrx_outoforder);
host_stats->ipv6_datagram_reassembly_timeout =
le64_to_cpu(ql_iscsi_stats->ipv6_datagram_reassembly_timeout);
host_stats->tcptx_segments =
le64_to_cpu(ql_iscsi_stats->tcp_tx_segments);
host_stats->tcptx_bytes = le64_to_cpu(ql_iscsi_stats->tcp_tx_bytes);
host_stats->tcprx_segments =
le64_to_cpu(ql_iscsi_stats->tcp_rx_segments);
host_stats->tcprx_byte = le64_to_cpu(ql_iscsi_stats->tcp_rx_byte);
host_stats->tcp_duplicate_ack_retx =
le64_to_cpu(ql_iscsi_stats->tcp_duplicate_ack_retx);
host_stats->tcp_retx_timer_expired =
le64_to_cpu(ql_iscsi_stats->tcp_retx_timer_expired);
host_stats->tcprx_duplicate_ack =
le64_to_cpu(ql_iscsi_stats->tcp_rx_duplicate_ack);
host_stats->tcprx_pure_ackr =
le64_to_cpu(ql_iscsi_stats->tcp_rx_pure_ackr);
host_stats->tcptx_delayed_ack =
le64_to_cpu(ql_iscsi_stats->tcp_tx_delayed_ack);
host_stats->tcptx_pure_ack =
le64_to_cpu(ql_iscsi_stats->tcp_tx_pure_ack);
host_stats->tcprx_segment_error =
le64_to_cpu(ql_iscsi_stats->tcp_rx_segment_error);
host_stats->tcprx_segment_outoforder =
le64_to_cpu(ql_iscsi_stats->tcp_rx_segment_outoforder);
host_stats->tcprx_window_probe =
le64_to_cpu(ql_iscsi_stats->tcp_rx_window_probe);
host_stats->tcprx_window_update =
le64_to_cpu(ql_iscsi_stats->tcp_rx_window_update);
host_stats->tcptx_window_probe_persist =
le64_to_cpu(ql_iscsi_stats->tcp_tx_window_probe_persist);
host_stats->ecc_error_correction =
le64_to_cpu(ql_iscsi_stats->ecc_error_correction);
host_stats->iscsi_pdu_tx = le64_to_cpu(ql_iscsi_stats->iscsi_pdu_tx);
host_stats->iscsi_data_bytes_tx =
le64_to_cpu(ql_iscsi_stats->iscsi_data_bytes_tx);
host_stats->iscsi_pdu_rx = le64_to_cpu(ql_iscsi_stats->iscsi_pdu_rx);
host_stats->iscsi_data_bytes_rx =
le64_to_cpu(ql_iscsi_stats->iscsi_data_bytes_rx);
host_stats->iscsi_io_completed =
le64_to_cpu(ql_iscsi_stats->iscsi_io_completed);
host_stats->iscsi_unexpected_io_rx =
le64_to_cpu(ql_iscsi_stats->iscsi_unexpected_io_rx);
host_stats->iscsi_format_error =
le64_to_cpu(ql_iscsi_stats->iscsi_format_error);
host_stats->iscsi_hdr_digest_error =
le64_to_cpu(ql_iscsi_stats->iscsi_hdr_digest_error);
host_stats->iscsi_data_digest_error =
le64_to_cpu(ql_iscsi_stats->iscsi_data_digest_error);
host_stats->iscsi_sequence_error =
le64_to_cpu(ql_iscsi_stats->iscsi_sequence_error);
exit_host_stats:
if (ql_iscsi_stats)
dma_free_coherent(&ha->pdev->dev, host_stats_size,
ql_iscsi_stats, iscsi_stats_dma);
ql4_printk(KERN_INFO, ha, "%s: Get host stats done\n",
__func__);
return ret;
}
static int qla4xxx_get_iface_param(struct iscsi_iface *iface,
enum iscsi_param_type param_type,
int param, char *buf)