- struct i2o_device *d = (struct i2o_device*)data;
- int token;
-
- struct
- {
- u64 tx_packets;
- u64 tx_bytes;
- u64 rx_packets;
- u64 rx_bytes;
- u64 tx_errors;
- u64 rx_errors;
- u64 rx_dropped;
- u64 adapter_resets;
- u64 adapter_suspends;
- } stats; // 0x0100
-
- static u64 supp_groups[4]; // 0x0180
-
- struct
- {
- u64 tx_retries;
- u64 tx_directed_bytes;
- u64 tx_directed_packets;
- u64 tx_multicast_bytes;
- u64 tx_multicast_packets;
- u64 tx_broadcast_bytes;
- u64 tx_broadcast_packets;
- u64 tx_group_addr_packets;
- u64 tx_short_packets;
- } tx_stats; // 0x0182
-
- struct
- {
- u64 rx_crc_errors;
- u64 rx_directed_bytes;
- u64 rx_directed_packets;
- u64 rx_multicast_bytes;
- u64 rx_multicast_packets;
- u64 rx_broadcast_bytes;
- u64 rx_broadcast_packets;
- u64 rx_group_addr_packets;
- u64 rx_short_packets;
- u64 rx_long_packets;
- u64 rx_runt_packets;
- } rx_stats; // 0x0183
-
- struct
- {
- u64 ipv4_generate;
- u64 ipv4_validate_success;
- u64 ipv4_validate_errors;
- u64 tcp_generate;
- u64 tcp_validate_success;
- u64 tcp_validate_errors;
- u64 udp_generate;
- u64 udp_validate_success;
- u64 udp_validate_errors;
- u64 rsvp_generate;
- u64 rsvp_validate_success;
- u64 rsvp_validate_errors;
- u64 icmp_generate;
- u64 icmp_validate_success;
- u64 icmp_validate_errors;
- } chksum_stats; // 0x0184
-
- spin_lock(&i2o_proc_lock);
- len = 0;
-
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0100, -1, &stats, sizeof(stats));
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x100 LAN Statistics");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf+len, "Tx packets : " FMT_U64_HEX "\n",
- U64_VAL(&stats.tx_packets));
- len += sprintf(buf+len, "Tx bytes : " FMT_U64_HEX "\n",
- U64_VAL(&stats.tx_bytes));
- len += sprintf(buf+len, "Rx packets : " FMT_U64_HEX "\n",
- U64_VAL(&stats.rx_packets));
- len += sprintf(buf+len, "Rx bytes : " FMT_U64_HEX "\n",
- U64_VAL(&stats.rx_bytes));
- len += sprintf(buf+len, "Tx errors : " FMT_U64_HEX "\n",
- U64_VAL(&stats.tx_errors));
- len += sprintf(buf+len, "Rx errors : " FMT_U64_HEX "\n",
- U64_VAL(&stats.rx_errors));
- len += sprintf(buf+len, "Rx dropped : " FMT_U64_HEX "\n",
- U64_VAL(&stats.rx_dropped));
- len += sprintf(buf+len, "Adapter resets : " FMT_U64_HEX "\n",
- U64_VAL(&stats.adapter_resets));
- len += sprintf(buf+len, "Adapter suspends : " FMT_U64_HEX "\n",
- U64_VAL(&stats.adapter_suspends));
-
- /* Optional statistics follows */
- /* Get 0x0180 to see which optional groups/fields are supported */
-
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0180, -1, &supp_groups, sizeof(supp_groups));
-
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token, "0x180 LAN Supported Optional Statistics");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- if (supp_groups[1]) /* 0x0182 */
- {
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0182, -1, &tx_stats, sizeof(tx_stats));
-
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x182 LAN Optional Tx Historical Statistics");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf+len, "==== Optional TX statistics (group 0182h)\n");
-
- len += i2o_report_opt_field(buf+len, "Tx RetryCount",
- 0, supp_groups[1], &tx_stats.tx_retries);
- len += i2o_report_opt_field(buf+len, "Tx DirectedBytes",
- 1, supp_groups[1], &tx_stats.tx_directed_bytes);
- len += i2o_report_opt_field(buf+len, "Tx DirectedPackets",
- 2, supp_groups[1], &tx_stats.tx_directed_packets);
- len += i2o_report_opt_field(buf+len, "Tx MulticastBytes",
- 3, supp_groups[1], &tx_stats.tx_multicast_bytes);
- len += i2o_report_opt_field(buf+len, "Tx MulticastPackets",
- 4, supp_groups[1], &tx_stats.tx_multicast_packets);
- len += i2o_report_opt_field(buf+len, "Tx BroadcastBytes",
- 5, supp_groups[1], &tx_stats.tx_broadcast_bytes);
- len += i2o_report_opt_field(buf+len, "Tx BroadcastPackets",
- 6, supp_groups[1], &tx_stats.tx_broadcast_packets);
- len += i2o_report_opt_field(buf+len, "Tx TotalGroupAddrPackets",
- 7, supp_groups[1], &tx_stats.tx_group_addr_packets);
- len += i2o_report_opt_field(buf+len, "Tx TotalPacketsTooShort",
- 8, supp_groups[1], &tx_stats.tx_short_packets);
- }
-
- if (supp_groups[2]) /* 0x0183 */
- {
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0183, -1, &rx_stats, sizeof(rx_stats));
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x183 LAN Optional Rx Historical Stats");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf+len, "==== Optional RX statistics (group 0183h)\n");
-
- len += i2o_report_opt_field(buf+len, "Rx CRCErrorCount",
- 0, supp_groups[2], &rx_stats.rx_crc_errors);
- len += i2o_report_opt_field(buf+len, "Rx DirectedBytes",
- 1, supp_groups[2], &rx_stats.rx_directed_bytes);
- len += i2o_report_opt_field(buf+len, "Rx DirectedPackets",
- 2, supp_groups[2], &rx_stats.rx_directed_packets);
- len += i2o_report_opt_field(buf+len, "Rx MulticastBytes",
- 3, supp_groups[2], &rx_stats.rx_multicast_bytes);
- len += i2o_report_opt_field(buf+len, "Rx MulticastPackets",
- 4, supp_groups[2], &rx_stats.rx_multicast_packets);
- len += i2o_report_opt_field(buf+len, "Rx BroadcastBytes",
- 5, supp_groups[2], &rx_stats.rx_broadcast_bytes);
- len += i2o_report_opt_field(buf+len, "Rx BroadcastPackets",
- 6, supp_groups[2], &rx_stats.rx_broadcast_packets);
- len += i2o_report_opt_field(buf+len, "Rx TotalGroupAddrPackets",
- 7, supp_groups[2], &rx_stats.rx_group_addr_packets);
- len += i2o_report_opt_field(buf+len, "Rx TotalPacketsTooShort",
- 8, supp_groups[2], &rx_stats.rx_short_packets);
- len += i2o_report_opt_field(buf+len, "Rx TotalPacketsTooLong",
- 9, supp_groups[2], &rx_stats.rx_long_packets);
- len += i2o_report_opt_field(buf+len, "Rx TotalPacketsRunt",
- 10, supp_groups[2], &rx_stats.rx_runt_packets);
- }
-
- if (supp_groups[3]) /* 0x0184 */
- {
- token = i2o_query_scalar(d->controller, d->lct_data.tid,
- 0x0184, -1, &chksum_stats, sizeof(chksum_stats));
-
- if (token < 0) {
- len += i2o_report_query_status(buf+len, token,"0x184 LAN Optional Chksum Historical Stats");
- spin_unlock(&i2o_proc_lock);
- return len;
- }
-
- len += sprintf(buf+len, "==== Optional CHKSUM statistics (group 0x0184)\n");
-
- len += i2o_report_opt_field(buf+len, "IPv4 Generate",
- 0, supp_groups[3], &chksum_stats.ipv4_generate);
- len += i2o_report_opt_field(buf+len, "IPv4 ValidateSuccess",
- 1, supp_groups[3], &chksum_stats.ipv4_validate_success);
- len += i2o_report_opt_field(buf+len, "IPv4 ValidateError",
- 2, supp_groups[3], &chksum_stats.ipv4_validate_errors);
- len += i2o_report_opt_field(buf+len, "TCP Generate",
- 3, supp_groups[3], &chksum_stats.tcp_generate);
- len += i2o_report_opt_field(buf+len, "TCP ValidateSuccess",
- 4, supp_groups[3], &chksum_stats.tcp_validate_success);
- len += i2o_report_opt_field(buf+len, "TCP ValidateError",
- 5, supp_groups[3], &chksum_stats.tcp_validate_errors);
- len += i2o_report_opt_field(buf+len, "UDP Generate",
- 6, supp_groups[3], &chksum_stats.udp_generate);
- len += i2o_report_opt_field(buf+len, "UDP ValidateSuccess",
- 7, supp_groups[3], &chksum_stats.udp_validate_success);
- len += i2o_report_opt_field(buf+len, "UDP ValidateError",
- 8, supp_groups[3], &chksum_stats.udp_validate_errors);
- len += i2o_report_opt_field(buf+len, "RSVP Generate",
- 9, supp_groups[3], &chksum_stats.rsvp_generate);
- len += i2o_report_opt_field(buf+len, "RSVP ValidateSuccess",
- 10, supp_groups[3], &chksum_stats.rsvp_validate_success);
- len += i2o_report_opt_field(buf+len, "RSVP ValidateError",
- 11, supp_groups[3], &chksum_stats.rsvp_validate_errors);
- len += i2o_report_opt_field(buf+len, "ICMP Generate",
- 12, supp_groups[3], &chksum_stats.icmp_generate);
- len += i2o_report_opt_field(buf+len, "ICMP ValidateSuccess",
- 13, supp_groups[3], &chksum_stats.icmp_validate_success);
- len += i2o_report_opt_field(buf+len, "ICMP ValidateError",
- 14, supp_groups[3], &chksum_stats.icmp_validate_errors);