diff options
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 56 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 73 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 127 |
3 files changed, 226 insertions, 30 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index f419965f3a6d..a7e2f7453b90 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -607,6 +607,7 @@ struct qlcnic_recv_context { | |||
607 | #define QLCNIC_CDRP_CMD_CONFIG_PORT 0x0000002E | 607 | #define QLCNIC_CDRP_CMD_CONFIG_PORT 0x0000002E |
608 | #define QLCNIC_CDRP_CMD_TEMP_SIZE 0x0000002f | 608 | #define QLCNIC_CDRP_CMD_TEMP_SIZE 0x0000002f |
609 | #define QLCNIC_CDRP_CMD_GET_TEMP_HDR 0x00000030 | 609 | #define QLCNIC_CDRP_CMD_GET_TEMP_HDR 0x00000030 |
610 | #define QLCNIC_CDRP_CMD_GET_MAC_STATS 0x00000037 | ||
610 | 611 | ||
611 | #define QLCNIC_RCODE_SUCCESS 0 | 612 | #define QLCNIC_RCODE_SUCCESS 0 |
612 | #define QLCNIC_RCODE_NOT_SUPPORTED 9 | 613 | #define QLCNIC_RCODE_NOT_SUPPORTED 9 |
@@ -1180,18 +1181,62 @@ struct qlcnic_esw_func_cfg { | |||
1180 | #define QLCNIC_STATS_ESWITCH 2 | 1181 | #define QLCNIC_STATS_ESWITCH 2 |
1181 | #define QLCNIC_QUERY_RX_COUNTER 0 | 1182 | #define QLCNIC_QUERY_RX_COUNTER 0 |
1182 | #define QLCNIC_QUERY_TX_COUNTER 1 | 1183 | #define QLCNIC_QUERY_TX_COUNTER 1 |
1183 | #define QLCNIC_ESW_STATS_NOT_AVAIL 0xffffffffffffffffULL | 1184 | #define QLCNIC_STATS_NOT_AVAIL 0xffffffffffffffffULL |
1185 | #define QLCNIC_FILL_STATS(VAL1) \ | ||
1186 | (((VAL1) == QLCNIC_STATS_NOT_AVAIL) ? 0 : VAL1) | ||
1187 | #define QLCNIC_MAC_STATS 1 | ||
1188 | #define QLCNIC_ESW_STATS 2 | ||
1184 | 1189 | ||
1185 | #define QLCNIC_ADD_ESW_STATS(VAL1, VAL2)\ | 1190 | #define QLCNIC_ADD_ESW_STATS(VAL1, VAL2)\ |
1186 | do { \ | 1191 | do { \ |
1187 | if (((VAL1) == QLCNIC_ESW_STATS_NOT_AVAIL) && \ | 1192 | if (((VAL1) == QLCNIC_STATS_NOT_AVAIL) && \ |
1188 | ((VAL2) != QLCNIC_ESW_STATS_NOT_AVAIL)) \ | 1193 | ((VAL2) != QLCNIC_STATS_NOT_AVAIL)) \ |
1189 | (VAL1) = (VAL2); \ | 1194 | (VAL1) = (VAL2); \ |
1190 | else if (((VAL1) != QLCNIC_ESW_STATS_NOT_AVAIL) && \ | 1195 | else if (((VAL1) != QLCNIC_STATS_NOT_AVAIL) && \ |
1191 | ((VAL2) != QLCNIC_ESW_STATS_NOT_AVAIL)) \ | 1196 | ((VAL2) != QLCNIC_STATS_NOT_AVAIL)) \ |
1192 | (VAL1) += (VAL2); \ | 1197 | (VAL1) += (VAL2); \ |
1193 | } while (0) | 1198 | } while (0) |
1194 | 1199 | ||
1200 | struct qlcnic_mac_statistics{ | ||
1201 | __le64 mac_tx_frames; | ||
1202 | __le64 mac_tx_bytes; | ||
1203 | __le64 mac_tx_mcast_pkts; | ||
1204 | __le64 mac_tx_bcast_pkts; | ||
1205 | __le64 mac_tx_pause_cnt; | ||
1206 | __le64 mac_tx_ctrl_pkt; | ||
1207 | __le64 mac_tx_lt_64b_pkts; | ||
1208 | __le64 mac_tx_lt_127b_pkts; | ||
1209 | __le64 mac_tx_lt_255b_pkts; | ||
1210 | __le64 mac_tx_lt_511b_pkts; | ||
1211 | __le64 mac_tx_lt_1023b_pkts; | ||
1212 | __le64 mac_tx_lt_1518b_pkts; | ||
1213 | __le64 mac_tx_gt_1518b_pkts; | ||
1214 | __le64 rsvd1[3]; | ||
1215 | |||
1216 | __le64 mac_rx_frames; | ||
1217 | __le64 mac_rx_bytes; | ||
1218 | __le64 mac_rx_mcast_pkts; | ||
1219 | __le64 mac_rx_bcast_pkts; | ||
1220 | __le64 mac_rx_pause_cnt; | ||
1221 | __le64 mac_rx_ctrl_pkt; | ||
1222 | __le64 mac_rx_lt_64b_pkts; | ||
1223 | __le64 mac_rx_lt_127b_pkts; | ||
1224 | __le64 mac_rx_lt_255b_pkts; | ||
1225 | __le64 mac_rx_lt_511b_pkts; | ||
1226 | __le64 mac_rx_lt_1023b_pkts; | ||
1227 | __le64 mac_rx_lt_1518b_pkts; | ||
1228 | __le64 mac_rx_gt_1518b_pkts; | ||
1229 | __le64 rsvd2[3]; | ||
1230 | |||
1231 | __le64 mac_rx_length_error; | ||
1232 | __le64 mac_rx_length_small; | ||
1233 | __le64 mac_rx_length_large; | ||
1234 | __le64 mac_rx_jabber; | ||
1235 | __le64 mac_rx_dropped; | ||
1236 | __le64 mac_rx_crc_error; | ||
1237 | __le64 mac_align_error; | ||
1238 | } __packed; | ||
1239 | |||
1195 | struct __qlcnic_esw_statistics { | 1240 | struct __qlcnic_esw_statistics { |
1196 | __le16 context_id; | 1241 | __le16 context_id; |
1197 | __le16 version; | 1242 | __le16 version; |
@@ -1512,6 +1557,7 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *, const u8, const u8, | |||
1512 | int qlcnic_get_eswitch_stats(struct qlcnic_adapter *, const u8, u8, | 1557 | int qlcnic_get_eswitch_stats(struct qlcnic_adapter *, const u8, u8, |
1513 | struct __qlcnic_esw_statistics *); | 1558 | struct __qlcnic_esw_statistics *); |
1514 | int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, u8, u8, u8); | 1559 | int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, u8, u8, u8); |
1560 | int qlcnic_get_mac_stats(struct qlcnic_adapter *, struct qlcnic_mac_statistics *); | ||
1515 | extern int qlcnic_config_tso; | 1561 | extern int qlcnic_config_tso; |
1516 | 1562 | ||
1517 | /* | 1563 | /* |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 569a837d2ac4..8db85244e8ad 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -905,6 +905,65 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | |||
905 | return err; | 905 | return err; |
906 | } | 906 | } |
907 | 907 | ||
908 | /* This routine will retrieve the MAC statistics from firmware */ | ||
909 | int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter, | ||
910 | struct qlcnic_mac_statistics *mac_stats) | ||
911 | { | ||
912 | struct qlcnic_mac_statistics *stats; | ||
913 | struct qlcnic_cmd_args cmd; | ||
914 | size_t stats_size = sizeof(struct qlcnic_mac_statistics); | ||
915 | dma_addr_t stats_dma_t; | ||
916 | void *stats_addr; | ||
917 | int err; | ||
918 | |||
919 | stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size, | ||
920 | &stats_dma_t, GFP_KERNEL); | ||
921 | if (!stats_addr) { | ||
922 | dev_err(&adapter->pdev->dev, | ||
923 | "%s: Unable to allocate memory.\n", __func__); | ||
924 | return -ENOMEM; | ||
925 | } | ||
926 | memset(stats_addr, 0, stats_size); | ||
927 | memset(&cmd, 0, sizeof(cmd)); | ||
928 | cmd.req.cmd = QLCNIC_CDRP_CMD_GET_MAC_STATS; | ||
929 | cmd.req.arg1 = stats_size << 16; | ||
930 | cmd.req.arg2 = MSD(stats_dma_t); | ||
931 | cmd.req.arg3 = LSD(stats_dma_t); | ||
932 | |||
933 | qlcnic_issue_cmd(adapter, &cmd); | ||
934 | err = cmd.rsp.cmd; | ||
935 | |||
936 | if (!err) { | ||
937 | stats = stats_addr; | ||
938 | mac_stats->mac_tx_frames = le64_to_cpu(stats->mac_tx_frames); | ||
939 | mac_stats->mac_tx_bytes = le64_to_cpu(stats->mac_tx_bytes); | ||
940 | mac_stats->mac_tx_mcast_pkts = | ||
941 | le64_to_cpu(stats->mac_tx_mcast_pkts); | ||
942 | mac_stats->mac_tx_bcast_pkts = | ||
943 | le64_to_cpu(stats->mac_tx_bcast_pkts); | ||
944 | mac_stats->mac_rx_frames = le64_to_cpu(stats->mac_rx_frames); | ||
945 | mac_stats->mac_rx_bytes = le64_to_cpu(stats->mac_rx_bytes); | ||
946 | mac_stats->mac_rx_mcast_pkts = | ||
947 | le64_to_cpu(stats->mac_rx_mcast_pkts); | ||
948 | mac_stats->mac_rx_length_error = | ||
949 | le64_to_cpu(stats->mac_rx_length_error); | ||
950 | mac_stats->mac_rx_length_small = | ||
951 | le64_to_cpu(stats->mac_rx_length_small); | ||
952 | mac_stats->mac_rx_length_large = | ||
953 | le64_to_cpu(stats->mac_rx_length_large); | ||
954 | mac_stats->mac_rx_jabber = le64_to_cpu(stats->mac_rx_jabber); | ||
955 | mac_stats->mac_rx_dropped = le64_to_cpu(stats->mac_rx_dropped); | ||
956 | mac_stats->mac_rx_crc_error = le64_to_cpu(stats->mac_rx_crc_error); | ||
957 | } else { | ||
958 | dev_info(&adapter->pdev->dev, | ||
959 | "%s: Get mac stats failed =%d.\n", __func__, err); | ||
960 | } | ||
961 | |||
962 | dma_free_coherent(&adapter->pdev->dev, stats_size, stats_addr, | ||
963 | stats_dma_t); | ||
964 | return err; | ||
965 | } | ||
966 | |||
908 | int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch, | 967 | int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch, |
909 | const u8 rx_tx, struct __qlcnic_esw_statistics *esw_stats) { | 968 | const u8 rx_tx, struct __qlcnic_esw_statistics *esw_stats) { |
910 | 969 | ||
@@ -920,13 +979,13 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch, | |||
920 | return -EIO; | 979 | return -EIO; |
921 | 980 | ||
922 | memset(esw_stats, 0, sizeof(u64)); | 981 | memset(esw_stats, 0, sizeof(u64)); |
923 | esw_stats->unicast_frames = QLCNIC_ESW_STATS_NOT_AVAIL; | 982 | esw_stats->unicast_frames = QLCNIC_STATS_NOT_AVAIL; |
924 | esw_stats->multicast_frames = QLCNIC_ESW_STATS_NOT_AVAIL; | 983 | esw_stats->multicast_frames = QLCNIC_STATS_NOT_AVAIL; |
925 | esw_stats->broadcast_frames = QLCNIC_ESW_STATS_NOT_AVAIL; | 984 | esw_stats->broadcast_frames = QLCNIC_STATS_NOT_AVAIL; |
926 | esw_stats->dropped_frames = QLCNIC_ESW_STATS_NOT_AVAIL; | 985 | esw_stats->dropped_frames = QLCNIC_STATS_NOT_AVAIL; |
927 | esw_stats->errors = QLCNIC_ESW_STATS_NOT_AVAIL; | 986 | esw_stats->errors = QLCNIC_STATS_NOT_AVAIL; |
928 | esw_stats->local_frames = QLCNIC_ESW_STATS_NOT_AVAIL; | 987 | esw_stats->local_frames = QLCNIC_STATS_NOT_AVAIL; |
929 | esw_stats->numbytes = QLCNIC_ESW_STATS_NOT_AVAIL; | 988 | esw_stats->numbytes = QLCNIC_STATS_NOT_AVAIL; |
930 | esw_stats->context_id = eswitch; | 989 | esw_stats->context_id = eswitch; |
931 | 990 | ||
932 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { | 991 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index f19e11ed7b09..5f2ad819a517 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -78,8 +78,46 @@ static const char qlcnic_device_gstrings_stats[][ETH_GSTRING_LEN] = { | |||
78 | "tx numbytes", | 78 | "tx numbytes", |
79 | }; | 79 | }; |
80 | 80 | ||
81 | #define QLCNIC_STATS_LEN ARRAY_SIZE(qlcnic_gstrings_stats) | 81 | static const char qlcnic_mac_stats_strings [][ETH_GSTRING_LEN] = { |
82 | "mac_tx_frames", | ||
83 | "mac_tx_bytes", | ||
84 | "mac_tx_mcast_pkts", | ||
85 | "mac_tx_bcast_pkts", | ||
86 | "mac_tx_pause_cnt", | ||
87 | "mac_tx_ctrl_pkt", | ||
88 | "mac_tx_lt_64b_pkts", | ||
89 | "mac_tx_lt_127b_pkts", | ||
90 | "mac_tx_lt_255b_pkts", | ||
91 | "mac_tx_lt_511b_pkts", | ||
92 | "mac_tx_lt_1023b_pkts", | ||
93 | "mac_tx_lt_1518b_pkts", | ||
94 | "mac_tx_gt_1518b_pkts", | ||
95 | "mac_rx_frames", | ||
96 | "mac_rx_bytes", | ||
97 | "mac_rx_mcast_pkts", | ||
98 | "mac_rx_bcast_pkts", | ||
99 | "mac_rx_pause_cnt", | ||
100 | "mac_rx_ctrl_pkt", | ||
101 | "mac_rx_lt_64b_pkts", | ||
102 | "mac_rx_lt_127b_pkts", | ||
103 | "mac_rx_lt_255b_pkts", | ||
104 | "mac_rx_lt_511b_pkts", | ||
105 | "mac_rx_lt_1023b_pkts", | ||
106 | "mac_rx_lt_1518b_pkts", | ||
107 | "mac_rx_gt_1518b_pkts", | ||
108 | "mac_rx_length_error", | ||
109 | "mac_rx_length_small", | ||
110 | "mac_rx_length_large", | ||
111 | "mac_rx_jabber", | ||
112 | "mac_rx_dropped", | ||
113 | "mac_rx_crc_error", | ||
114 | "mac_align_error", | ||
115 | }; | ||
116 | |||
117 | #define QLCNIC_STATS_LEN ARRAY_SIZE(qlcnic_gstrings_stats) | ||
118 | #define QLCNIC_MAC_STATS_LEN ARRAY_SIZE(qlcnic_mac_stats_strings) | ||
82 | #define QLCNIC_DEVICE_STATS_LEN ARRAY_SIZE(qlcnic_device_gstrings_stats) | 119 | #define QLCNIC_DEVICE_STATS_LEN ARRAY_SIZE(qlcnic_device_gstrings_stats) |
120 | #define QLCNIC_TOTAL_STATS_LEN QLCNIC_STATS_LEN + QLCNIC_MAC_STATS_LEN | ||
83 | 121 | ||
84 | static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { | 122 | static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { |
85 | "Register_Test_on_offline", | 123 | "Register_Test_on_offline", |
@@ -644,8 +682,8 @@ static int qlcnic_get_sset_count(struct net_device *dev, int sset) | |||
644 | return QLCNIC_TEST_LEN; | 682 | return QLCNIC_TEST_LEN; |
645 | case ETH_SS_STATS: | 683 | case ETH_SS_STATS: |
646 | if (adapter->flags & QLCNIC_ESWITCH_ENABLED) | 684 | if (adapter->flags & QLCNIC_ESWITCH_ENABLED) |
647 | return QLCNIC_STATS_LEN + QLCNIC_DEVICE_STATS_LEN; | 685 | return QLCNIC_TOTAL_STATS_LEN + QLCNIC_DEVICE_STATS_LEN; |
648 | return QLCNIC_STATS_LEN; | 686 | return QLCNIC_TOTAL_STATS_LEN; |
649 | default: | 687 | default: |
650 | return -EOPNOTSUPP; | 688 | return -EOPNOTSUPP; |
651 | } | 689 | } |
@@ -851,7 +889,7 @@ static void | |||
851 | qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 * data) | 889 | qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 * data) |
852 | { | 890 | { |
853 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 891 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
854 | int index, i; | 892 | int index, i, j; |
855 | 893 | ||
856 | switch (stringset) { | 894 | switch (stringset) { |
857 | case ETH_SS_TEST: | 895 | case ETH_SS_TEST: |
@@ -864,6 +902,11 @@ qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 * data) | |||
864 | qlcnic_gstrings_stats[index].stat_string, | 902 | qlcnic_gstrings_stats[index].stat_string, |
865 | ETH_GSTRING_LEN); | 903 | ETH_GSTRING_LEN); |
866 | } | 904 | } |
905 | for (j = 0; j < QLCNIC_MAC_STATS_LEN; index++, j++) { | ||
906 | memcpy(data + index * ETH_GSTRING_LEN, | ||
907 | qlcnic_mac_stats_strings[j], | ||
908 | ETH_GSTRING_LEN); | ||
909 | } | ||
867 | if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) | 910 | if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) |
868 | return; | 911 | return; |
869 | for (i = 0; i < QLCNIC_DEVICE_STATS_LEN; index++, i++) { | 912 | for (i = 0; i < QLCNIC_DEVICE_STATS_LEN; index++, i++) { |
@@ -874,22 +917,64 @@ qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 * data) | |||
874 | } | 917 | } |
875 | } | 918 | } |
876 | 919 | ||
877 | #define QLCNIC_FILL_ESWITCH_STATS(VAL1) \ | ||
878 | (((VAL1) == QLCNIC_ESW_STATS_NOT_AVAIL) ? 0 : VAL1) | ||
879 | |||
880 | static void | 920 | static void |
881 | qlcnic_fill_device_stats(int *index, u64 *data, | 921 | qlcnic_fill_stats(int *index, u64 *data, void *stats, int type) |
882 | struct __qlcnic_esw_statistics *stats) | ||
883 | { | 922 | { |
884 | int ind = *index; | 923 | int ind = *index; |
885 | 924 | ||
886 | data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->unicast_frames); | 925 | if (type == QLCNIC_MAC_STATS) { |
887 | data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->multicast_frames); | 926 | struct qlcnic_mac_statistics *mac_stats = |
888 | data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->broadcast_frames); | 927 | (struct qlcnic_mac_statistics *)stats; |
889 | data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->dropped_frames); | 928 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_frames); |
890 | data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->errors); | 929 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_bytes); |
891 | data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->local_frames); | 930 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_mcast_pkts); |
892 | data[ind++] = QLCNIC_FILL_ESWITCH_STATS(stats->numbytes); | 931 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_bcast_pkts); |
932 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_pause_cnt); | ||
933 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_ctrl_pkt); | ||
934 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_lt_64b_pkts); | ||
935 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_lt_127b_pkts); | ||
936 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_lt_255b_pkts); | ||
937 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_tx_lt_511b_pkts); | ||
938 | data[ind++] = | ||
939 | QLCNIC_FILL_STATS(mac_stats->mac_tx_lt_1023b_pkts); | ||
940 | data[ind++] = | ||
941 | QLCNIC_FILL_STATS(mac_stats->mac_tx_lt_1518b_pkts); | ||
942 | data[ind++] = | ||
943 | QLCNIC_FILL_STATS(mac_stats->mac_tx_gt_1518b_pkts); | ||
944 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_frames); | ||
945 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_bytes); | ||
946 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_mcast_pkts); | ||
947 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_bcast_pkts); | ||
948 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_pause_cnt); | ||
949 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_ctrl_pkt); | ||
950 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_lt_64b_pkts); | ||
951 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_lt_127b_pkts); | ||
952 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_lt_255b_pkts); | ||
953 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_lt_511b_pkts); | ||
954 | data[ind++] = | ||
955 | QLCNIC_FILL_STATS(mac_stats->mac_rx_lt_1023b_pkts); | ||
956 | data[ind++] = | ||
957 | QLCNIC_FILL_STATS(mac_stats->mac_rx_lt_1518b_pkts); | ||
958 | data[ind++] = | ||
959 | QLCNIC_FILL_STATS(mac_stats->mac_rx_gt_1518b_pkts); | ||
960 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_length_error); | ||
961 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_length_small); | ||
962 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_length_large); | ||
963 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_jabber); | ||
964 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_dropped); | ||
965 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_rx_crc_error); | ||
966 | data[ind++] = QLCNIC_FILL_STATS(mac_stats->mac_align_error); | ||
967 | } else if (type == QLCNIC_ESW_STATS) { | ||
968 | struct __qlcnic_esw_statistics *esw_stats = | ||
969 | (struct __qlcnic_esw_statistics *)stats; | ||
970 | data[ind++] = QLCNIC_FILL_STATS(esw_stats->unicast_frames); | ||
971 | data[ind++] = QLCNIC_FILL_STATS(esw_stats->multicast_frames); | ||
972 | data[ind++] = QLCNIC_FILL_STATS(esw_stats->broadcast_frames); | ||
973 | data[ind++] = QLCNIC_FILL_STATS(esw_stats->dropped_frames); | ||
974 | data[ind++] = QLCNIC_FILL_STATS(esw_stats->errors); | ||
975 | data[ind++] = QLCNIC_FILL_STATS(esw_stats->local_frames); | ||
976 | data[ind++] = QLCNIC_FILL_STATS(esw_stats->numbytes); | ||
977 | } | ||
893 | 978 | ||
894 | *index = ind; | 979 | *index = ind; |
895 | } | 980 | } |
@@ -900,6 +985,7 @@ qlcnic_get_ethtool_stats(struct net_device *dev, | |||
900 | { | 985 | { |
901 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 986 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
902 | struct qlcnic_esw_statistics port_stats; | 987 | struct qlcnic_esw_statistics port_stats; |
988 | struct qlcnic_mac_statistics mac_stats; | ||
903 | int index, ret; | 989 | int index, ret; |
904 | 990 | ||
905 | for (index = 0; index < QLCNIC_STATS_LEN; index++) { | 991 | for (index = 0; index < QLCNIC_STATS_LEN; index++) { |
@@ -911,6 +997,11 @@ qlcnic_get_ethtool_stats(struct net_device *dev, | |||
911 | sizeof(u64)) ? *(u64 *)p:(*(u32 *)p); | 997 | sizeof(u64)) ? *(u64 *)p:(*(u32 *)p); |
912 | } | 998 | } |
913 | 999 | ||
1000 | /* Retrieve MAC statistics from firmware */ | ||
1001 | memset(&mac_stats, 0, sizeof(struct qlcnic_mac_statistics)); | ||
1002 | qlcnic_get_mac_stats(adapter, &mac_stats); | ||
1003 | qlcnic_fill_stats(&index, data, &mac_stats, QLCNIC_MAC_STATS); | ||
1004 | |||
914 | if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) | 1005 | if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) |
915 | return; | 1006 | return; |
916 | 1007 | ||
@@ -920,14 +1011,14 @@ qlcnic_get_ethtool_stats(struct net_device *dev, | |||
920 | if (ret) | 1011 | if (ret) |
921 | return; | 1012 | return; |
922 | 1013 | ||
923 | qlcnic_fill_device_stats(&index, data, &port_stats.rx); | 1014 | qlcnic_fill_stats(&index, data, &port_stats.rx, QLCNIC_ESW_STATS); |
924 | 1015 | ||
925 | ret = qlcnic_get_port_stats(adapter, adapter->ahw->pci_func, | 1016 | ret = qlcnic_get_port_stats(adapter, adapter->ahw->pci_func, |
926 | QLCNIC_QUERY_TX_COUNTER, &port_stats.tx); | 1017 | QLCNIC_QUERY_TX_COUNTER, &port_stats.tx); |
927 | if (ret) | 1018 | if (ret) |
928 | return; | 1019 | return; |
929 | 1020 | ||
930 | qlcnic_fill_device_stats(&index, data, &port_stats.tx); | 1021 | qlcnic_fill_stats(&index, data, &port_stats.tx, QLCNIC_ESW_STATS); |
931 | } | 1022 | } |
932 | 1023 | ||
933 | static int qlcnic_set_led(struct net_device *dev, | 1024 | static int qlcnic_set_led(struct net_device *dev, |