aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorHolger Schurig <holgerschurig@gmail.com>2009-11-25 07:10:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-28 15:04:58 -0500
commitc7fe64cf4a08561a9e8f57e6018a504881236e34 (patch)
tree0589e95cb97133fca3fa3a6461524b5814443dc6 /drivers/net
parente0e42da3a4df6f487b59dad608db56e25001bcdb (diff)
libertas: move mesh-only ethtool operations into mesh.c
Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/libertas/ethtool.c84
-rw-r--r--drivers/net/wireless/libertas/mesh.c84
-rw-r--r--drivers/net/wireless/libertas/mesh.h11
3 files changed, 99 insertions, 80 deletions
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 53d56ab83c0..63d020374c2 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -8,17 +8,8 @@
8#include "dev.h" 8#include "dev.h"
9#include "wext.h" 9#include "wext.h"
10#include "cmd.h" 10#include "cmd.h"
11#include "mesh.h"
11 12
12static const char * mesh_stat_strings[]= {
13 "drop_duplicate_bcast",
14 "drop_ttl_zero",
15 "drop_no_fwd_route",
16 "drop_no_buffers",
17 "fwded_unicast_cnt",
18 "fwded_bcast_cnt",
19 "drop_blind_table",
20 "tx_failed_cnt"
21};
22 13
23static void lbs_ethtool_get_drvinfo(struct net_device *dev, 14static void lbs_ethtool_get_drvinfo(struct net_device *dev,
24 struct ethtool_drvinfo *info) 15 struct ethtool_drvinfo *info)
@@ -73,73 +64,6 @@ out:
73 return ret; 64 return ret;
74} 65}
75 66
76static void lbs_ethtool_get_stats(struct net_device *dev,
77 struct ethtool_stats *stats, uint64_t *data)
78{
79 struct lbs_private *priv = dev->ml_priv;
80 struct cmd_ds_mesh_access mesh_access;
81 int ret;
82
83 lbs_deb_enter(LBS_DEB_ETHTOOL);
84
85 /* Get Mesh Statistics */
86 ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access);
87
88 if (ret) {
89 memset(data, 0, MESH_STATS_NUM*(sizeof(uint64_t)));
90 return;
91 }
92
93 priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
94 priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
95 priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
96 priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
97 priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
98 priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
99 priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
100 priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
101
102 data[0] = priv->mstats.fwd_drop_rbt;
103 data[1] = priv->mstats.fwd_drop_ttl;
104 data[2] = priv->mstats.fwd_drop_noroute;
105 data[3] = priv->mstats.fwd_drop_nobuf;
106 data[4] = priv->mstats.fwd_unicast_cnt;
107 data[5] = priv->mstats.fwd_bcast_cnt;
108 data[6] = priv->mstats.drop_blind;
109 data[7] = priv->mstats.tx_failed_cnt;
110
111 lbs_deb_enter(LBS_DEB_ETHTOOL);
112}
113
114static int lbs_ethtool_get_sset_count(struct net_device *dev, int sset)
115{
116 struct lbs_private *priv = dev->ml_priv;
117
118 if (sset == ETH_SS_STATS && dev == priv->mesh_dev)
119 return MESH_STATS_NUM;
120
121 return -EOPNOTSUPP;
122}
123
124static void lbs_ethtool_get_strings(struct net_device *dev,
125 uint32_t stringset, uint8_t *s)
126{
127 int i;
128
129 lbs_deb_enter(LBS_DEB_ETHTOOL);
130
131 switch (stringset) {
132 case ETH_SS_STATS:
133 for (i=0; i < MESH_STATS_NUM; i++) {
134 memcpy(s + i * ETH_GSTRING_LEN,
135 mesh_stat_strings[i],
136 ETH_GSTRING_LEN);
137 }
138 break;
139 }
140 lbs_deb_enter(LBS_DEB_ETHTOOL);
141}
142
143static void lbs_ethtool_get_wol(struct net_device *dev, 67static void lbs_ethtool_get_wol(struct net_device *dev,
144 struct ethtool_wolinfo *wol) 68 struct ethtool_wolinfo *wol)
145{ 69{
@@ -190,9 +114,9 @@ const struct ethtool_ops lbs_ethtool_ops = {
190 .get_drvinfo = lbs_ethtool_get_drvinfo, 114 .get_drvinfo = lbs_ethtool_get_drvinfo,
191 .get_eeprom = lbs_ethtool_get_eeprom, 115 .get_eeprom = lbs_ethtool_get_eeprom,
192 .get_eeprom_len = lbs_ethtool_get_eeprom_len, 116 .get_eeprom_len = lbs_ethtool_get_eeprom_len,
193 .get_sset_count = lbs_ethtool_get_sset_count, 117 .get_sset_count = lbs_mesh_ethtool_get_sset_count,
194 .get_ethtool_stats = lbs_ethtool_get_stats, 118 .get_ethtool_stats = lbs_mesh_ethtool_get_stats,
195 .get_strings = lbs_ethtool_get_strings, 119 .get_strings = lbs_mesh_ethtool_get_strings,
196 .get_wol = lbs_ethtool_get_wol, 120 .get_wol = lbs_ethtool_get_wol,
197 .set_wol = lbs_ethtool_set_wol, 121 .set_wol = lbs_ethtool_set_wol,
198}; 122};
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c
index 80c2c7a31c8..3e12060a647 100644
--- a/drivers/net/wireless/libertas/mesh.c
+++ b/drivers/net/wireless/libertas/mesh.c
@@ -880,3 +880,87 @@ void lbs_persist_config_remove(struct net_device *dev)
880 sysfs_remove_group(&(dev->dev.kobj), &boot_opts_group); 880 sysfs_remove_group(&(dev->dev.kobj), &boot_opts_group);
881 sysfs_remove_group(&(dev->dev.kobj), &mesh_ie_group); 881 sysfs_remove_group(&(dev->dev.kobj), &mesh_ie_group);
882} 882}
883
884
885
886/***************************************************************************
887 * Ethtool related
888 */
889
890static const char *mesh_stat_strings[] = {
891 "drop_duplicate_bcast",
892 "drop_ttl_zero",
893 "drop_no_fwd_route",
894 "drop_no_buffers",
895 "fwded_unicast_cnt",
896 "fwded_bcast_cnt",
897 "drop_blind_table",
898 "tx_failed_cnt"
899};
900
901void lbs_mesh_ethtool_get_stats(struct net_device *dev,
902 struct ethtool_stats *stats, uint64_t *data)
903{
904 struct lbs_private *priv = dev->ml_priv;
905 struct cmd_ds_mesh_access mesh_access;
906 int ret;
907
908 lbs_deb_enter(LBS_DEB_ETHTOOL);
909
910 /* Get Mesh Statistics */
911 ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access);
912
913 if (ret) {
914 memset(data, 0, MESH_STATS_NUM*(sizeof(uint64_t)));
915 return;
916 }
917
918 priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
919 priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
920 priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
921 priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
922 priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
923 priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
924 priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
925 priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
926
927 data[0] = priv->mstats.fwd_drop_rbt;
928 data[1] = priv->mstats.fwd_drop_ttl;
929 data[2] = priv->mstats.fwd_drop_noroute;
930 data[3] = priv->mstats.fwd_drop_nobuf;
931 data[4] = priv->mstats.fwd_unicast_cnt;
932 data[5] = priv->mstats.fwd_bcast_cnt;
933 data[6] = priv->mstats.drop_blind;
934 data[7] = priv->mstats.tx_failed_cnt;
935
936 lbs_deb_enter(LBS_DEB_ETHTOOL);
937}
938
939int lbs_mesh_ethtool_get_sset_count(struct net_device *dev, int sset)
940{
941 struct lbs_private *priv = dev->ml_priv;
942
943 if (sset == ETH_SS_STATS && dev == priv->mesh_dev)
944 return MESH_STATS_NUM;
945
946 return -EOPNOTSUPP;
947}
948
949void lbs_mesh_ethtool_get_strings(struct net_device *dev,
950 uint32_t stringset, uint8_t *s)
951{
952 int i;
953
954 lbs_deb_enter(LBS_DEB_ETHTOOL);
955
956 switch (stringset) {
957 case ETH_SS_STATS:
958 for (i = 0; i < MESH_STATS_NUM; i++) {
959 memcpy(s + i * ETH_GSTRING_LEN,
960 mesh_stat_strings[i],
961 ETH_GSTRING_LEN);
962 }
963 break;
964 }
965 lbs_deb_enter(LBS_DEB_ETHTOOL);
966}
diff --git a/drivers/net/wireless/libertas/mesh.h b/drivers/net/wireless/libertas/mesh.h
index d683c6eef83..23b38ba26cd 100644
--- a/drivers/net/wireless/libertas/mesh.h
+++ b/drivers/net/wireless/libertas/mesh.h
@@ -53,4 +53,15 @@ void lbs_persist_config_remove(struct net_device *net);
53extern struct iw_handler_def mesh_handler_def; 53extern struct iw_handler_def mesh_handler_def;
54 54
55 55
56/* Ethtool statistics */
57
58struct ethtool_stats;
59
60void lbs_mesh_ethtool_get_stats(struct net_device *dev,
61 struct ethtool_stats *stats, uint64_t *data);
62int lbs_mesh_ethtool_get_sset_count(struct net_device *dev, int sset);
63void lbs_mesh_ethtool_get_strings(struct net_device *dev,
64 uint32_t stringset, uint8_t *s);
65
66
56#endif 67#endif