libertas: move mesh-only ethtool operations into mesh.c
authorHolger Schurig <holgerschurig@gmail.com>
Wed, 25 Nov 2009 12:10:49 +0000 (13:10 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Sat, 28 Nov 2009 20:04:58 +0000 (15:04 -0500)
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/ethtool.c
drivers/net/wireless/libertas/mesh.c
drivers/net/wireless/libertas/mesh.h

index 53d56ab83c03cb54411885b5f26e67e943030b46..63d020374c2bda16b4176c7e5996628de2e7fedc 100644 (file)
@@ -8,17 +8,8 @@
 #include "dev.h"
 #include "wext.h"
 #include "cmd.h"
+#include "mesh.h"
 
-static const char * mesh_stat_strings[]= {
-                       "drop_duplicate_bcast",
-                       "drop_ttl_zero",
-                       "drop_no_fwd_route",
-                       "drop_no_buffers",
-                       "fwded_unicast_cnt",
-                       "fwded_bcast_cnt",
-                       "drop_blind_table",
-                       "tx_failed_cnt"
-};
 
 static void lbs_ethtool_get_drvinfo(struct net_device *dev,
                                         struct ethtool_drvinfo *info)
@@ -73,73 +64,6 @@ out:
         return ret;
 }
 
-static void lbs_ethtool_get_stats(struct net_device *dev,
-                                 struct ethtool_stats *stats, uint64_t *data)
-{
-       struct lbs_private *priv = dev->ml_priv;
-       struct cmd_ds_mesh_access mesh_access;
-       int ret;
-
-       lbs_deb_enter(LBS_DEB_ETHTOOL);
-
-       /* Get Mesh Statistics */
-       ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access);
-
-       if (ret) {
-               memset(data, 0, MESH_STATS_NUM*(sizeof(uint64_t)));
-               return;
-       }
-
-       priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
-       priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
-       priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
-       priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
-       priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
-       priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
-       priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
-       priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
-
-       data[0] = priv->mstats.fwd_drop_rbt;
-       data[1] = priv->mstats.fwd_drop_ttl;
-       data[2] = priv->mstats.fwd_drop_noroute;
-       data[3] = priv->mstats.fwd_drop_nobuf;
-       data[4] = priv->mstats.fwd_unicast_cnt;
-       data[5] = priv->mstats.fwd_bcast_cnt;
-       data[6] = priv->mstats.drop_blind;
-       data[7] = priv->mstats.tx_failed_cnt;
-
-       lbs_deb_enter(LBS_DEB_ETHTOOL);
-}
-
-static int lbs_ethtool_get_sset_count(struct net_device *dev, int sset)
-{
-       struct lbs_private *priv = dev->ml_priv;
-
-       if (sset == ETH_SS_STATS && dev == priv->mesh_dev)
-               return MESH_STATS_NUM;
-
-       return -EOPNOTSUPP;
-}
-
-static void lbs_ethtool_get_strings(struct net_device *dev,
-                                   uint32_t stringset, uint8_t *s)
-{
-       int i;
-
-       lbs_deb_enter(LBS_DEB_ETHTOOL);
-
-       switch (stringset) {
-        case ETH_SS_STATS:
-               for (i=0; i < MESH_STATS_NUM; i++) {
-                       memcpy(s + i * ETH_GSTRING_LEN,
-                                       mesh_stat_strings[i],
-                                       ETH_GSTRING_LEN);
-               }
-               break;
-        }
-       lbs_deb_enter(LBS_DEB_ETHTOOL);
-}
-
 static void lbs_ethtool_get_wol(struct net_device *dev,
                                struct ethtool_wolinfo *wol)
 {
@@ -190,9 +114,9 @@ const struct ethtool_ops lbs_ethtool_ops = {
        .get_drvinfo = lbs_ethtool_get_drvinfo,
        .get_eeprom =  lbs_ethtool_get_eeprom,
        .get_eeprom_len = lbs_ethtool_get_eeprom_len,
-       .get_sset_count = lbs_ethtool_get_sset_count,
-       .get_ethtool_stats = lbs_ethtool_get_stats,
-       .get_strings = lbs_ethtool_get_strings,
+       .get_sset_count = lbs_mesh_ethtool_get_sset_count,
+       .get_ethtool_stats = lbs_mesh_ethtool_get_stats,
+       .get_strings = lbs_mesh_ethtool_get_strings,
        .get_wol = lbs_ethtool_get_wol,
        .set_wol = lbs_ethtool_set_wol,
 };
index 80c2c7a31c8e2b77862715b4a9d52a75447a4815..3e12060a64706627a45a52a3a76308b26c0c10b4 100644 (file)
@@ -880,3 +880,87 @@ void lbs_persist_config_remove(struct net_device *dev)
        sysfs_remove_group(&(dev->dev.kobj), &boot_opts_group);
        sysfs_remove_group(&(dev->dev.kobj), &mesh_ie_group);
 }
+
+
+
+/***************************************************************************
+ * Ethtool related
+ */
+
+static const char *mesh_stat_strings[] = {
+                       "drop_duplicate_bcast",
+                       "drop_ttl_zero",
+                       "drop_no_fwd_route",
+                       "drop_no_buffers",
+                       "fwded_unicast_cnt",
+                       "fwded_bcast_cnt",
+                       "drop_blind_table",
+                       "tx_failed_cnt"
+};
+
+void lbs_mesh_ethtool_get_stats(struct net_device *dev,
+       struct ethtool_stats *stats, uint64_t *data)
+{
+       struct lbs_private *priv = dev->ml_priv;
+       struct cmd_ds_mesh_access mesh_access;
+       int ret;
+
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
+
+       /* Get Mesh Statistics */
+       ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access);
+
+       if (ret) {
+               memset(data, 0, MESH_STATS_NUM*(sizeof(uint64_t)));
+               return;
+       }
+
+       priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
+       priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
+       priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
+       priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
+       priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
+       priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
+       priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
+       priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
+
+       data[0] = priv->mstats.fwd_drop_rbt;
+       data[1] = priv->mstats.fwd_drop_ttl;
+       data[2] = priv->mstats.fwd_drop_noroute;
+       data[3] = priv->mstats.fwd_drop_nobuf;
+       data[4] = priv->mstats.fwd_unicast_cnt;
+       data[5] = priv->mstats.fwd_bcast_cnt;
+       data[6] = priv->mstats.drop_blind;
+       data[7] = priv->mstats.tx_failed_cnt;
+
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
+}
+
+int lbs_mesh_ethtool_get_sset_count(struct net_device *dev, int sset)
+{
+       struct lbs_private *priv = dev->ml_priv;
+
+       if (sset == ETH_SS_STATS && dev == priv->mesh_dev)
+               return MESH_STATS_NUM;
+
+       return -EOPNOTSUPP;
+}
+
+void lbs_mesh_ethtool_get_strings(struct net_device *dev,
+       uint32_t stringset, uint8_t *s)
+{
+       int i;
+
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
+
+       switch (stringset) {
+       case ETH_SS_STATS:
+               for (i = 0; i < MESH_STATS_NUM; i++) {
+                       memcpy(s + i * ETH_GSTRING_LEN,
+                                       mesh_stat_strings[i],
+                                       ETH_GSTRING_LEN);
+               }
+               break;
+       }
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
+}
index d683c6eef83c3c110edee521dce92231f2759c53..23b38ba26cd000ce3a6cf87a7f3c35ced6dff986 100644 (file)
@@ -53,4 +53,15 @@ void lbs_persist_config_remove(struct net_device *net);
 extern struct iw_handler_def mesh_handler_def;
 
 
+/* Ethtool statistics */
+
+struct ethtool_stats;
+
+void lbs_mesh_ethtool_get_stats(struct net_device *dev,
+       struct ethtool_stats *stats, uint64_t *data);
+int lbs_mesh_ethtool_get_sset_count(struct net_device *dev, int sset);
+void lbs_mesh_ethtool_get_strings(struct net_device *dev,
+       uint32_t stringset, uint8_t *s);
+
+
 #endif