aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2011-07-21 15:43:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-08 14:26:31 -0400
commit49fee69204035247fd2a5828863fc6f633e829f2 (patch)
treecce5ce952f0e484e8251a331252a9cd13b9501bb /drivers
parent04b0c5c6995103eef56391c163e970ab1f03b59f (diff)
libertas: link mesh device to wiphy
The mesh device is now exposed as an interface of the wiphy. This exposes the mesh device to the cfg80211 interface, allowing mesh channel selection to be reimplemented, and available to NetworkManager as it was before. Some header tweaking was needed in order to implement lbs_mesh_activated(). Signed-off-by: Daniel Drake <dsd@laptop.org> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/libertas/cfg.c36
-rw-r--r--drivers/net/wireless/libertas/dev.h12
-rw-r--r--drivers/net/wireless/libertas/ethtool.c1
-rw-r--r--drivers/net/wireless/libertas/main.c14
-rw-r--r--drivers/net/wireless/libertas/mesh.c68
-rw-r--r--drivers/net/wireless/libertas/mesh.h27
-rw-r--r--drivers/net/wireless/libertas/rx.c1
-rw-r--r--drivers/net/wireless/libertas/tx.c1
8 files changed, 117 insertions, 43 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index b456a53b64b1..63009c7eb2f1 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -19,6 +19,7 @@
19#include "decl.h" 19#include "decl.h"
20#include "cfg.h" 20#include "cfg.h"
21#include "cmd.h" 21#include "cmd.h"
22#include "mesh.h"
22 23
23 24
24#define CHAN2G(_channel, _freq, _flags) { \ 25#define CHAN2G(_channel, _freq, _flags) { \
@@ -442,13 +443,16 @@ static int lbs_cfg_set_channel(struct wiphy *wiphy,
442 struct lbs_private *priv = wiphy_priv(wiphy); 443 struct lbs_private *priv = wiphy_priv(wiphy);
443 int ret = -ENOTSUPP; 444 int ret = -ENOTSUPP;
444 445
445 lbs_deb_enter_args(LBS_DEB_CFG80211, "freq %d, type %d", 446 lbs_deb_enter_args(LBS_DEB_CFG80211, "iface %s freq %d, type %d",
446 channel->center_freq, channel_type); 447 netdev_name(netdev), channel->center_freq, channel_type);
447 448
448 if (channel_type != NL80211_CHAN_NO_HT) 449 if (channel_type != NL80211_CHAN_NO_HT)
449 goto out; 450 goto out;
450 451
451 ret = lbs_set_channel(priv, channel->hw_value); 452 if (netdev == priv->mesh_dev)
453 ret = lbs_mesh_set_channel(priv, channel->hw_value);
454 else
455 ret = lbs_set_channel(priv, channel->hw_value);
452 456
453 out: 457 out:
454 lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); 458 lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret);
@@ -1292,6 +1296,9 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
1292 int ret = 0; 1296 int ret = 0;
1293 u8 preamble = RADIO_PREAMBLE_SHORT; 1297 u8 preamble = RADIO_PREAMBLE_SHORT;
1294 1298
1299 if (dev == priv->mesh_dev)
1300 return -EOPNOTSUPP;
1301
1295 lbs_deb_enter(LBS_DEB_CFG80211); 1302 lbs_deb_enter(LBS_DEB_CFG80211);
1296 1303
1297 if (!sme->bssid) { 1304 if (!sme->bssid) {
@@ -1408,6 +1415,9 @@ static int lbs_cfg_disconnect(struct wiphy *wiphy, struct net_device *dev,
1408 struct lbs_private *priv = wiphy_priv(wiphy); 1415 struct lbs_private *priv = wiphy_priv(wiphy);
1409 struct cmd_ds_802_11_deauthenticate cmd; 1416 struct cmd_ds_802_11_deauthenticate cmd;
1410 1417
1418 if (dev == priv->mesh_dev)
1419 return -EOPNOTSUPP;
1420
1411 lbs_deb_enter_args(LBS_DEB_CFG80211, "reason_code %d", reason_code); 1421 lbs_deb_enter_args(LBS_DEB_CFG80211, "reason_code %d", reason_code);
1412 1422
1413 /* store for lbs_cfg_ret_disconnect() */ 1423 /* store for lbs_cfg_ret_disconnect() */
@@ -1439,6 +1449,9 @@ static int lbs_cfg_set_default_key(struct wiphy *wiphy,
1439{ 1449{
1440 struct lbs_private *priv = wiphy_priv(wiphy); 1450 struct lbs_private *priv = wiphy_priv(wiphy);
1441 1451
1452 if (netdev == priv->mesh_dev)
1453 return -EOPNOTSUPP;
1454
1442 lbs_deb_enter(LBS_DEB_CFG80211); 1455 lbs_deb_enter(LBS_DEB_CFG80211);
1443 1456
1444 if (key_index != priv->wep_tx_key) { 1457 if (key_index != priv->wep_tx_key) {
@@ -1460,6 +1473,9 @@ static int lbs_cfg_add_key(struct wiphy *wiphy, struct net_device *netdev,
1460 u16 key_type; 1473 u16 key_type;
1461 int ret = 0; 1474 int ret = 0;
1462 1475
1476 if (netdev == priv->mesh_dev)
1477 return -EOPNOTSUPP;
1478
1463 lbs_deb_enter(LBS_DEB_CFG80211); 1479 lbs_deb_enter(LBS_DEB_CFG80211);
1464 1480
1465 lbs_deb_assoc("add_key: cipher 0x%x, mac_addr %pM\n", 1481 lbs_deb_assoc("add_key: cipher 0x%x, mac_addr %pM\n",
@@ -1603,6 +1619,9 @@ static int lbs_get_survey(struct wiphy *wiphy, struct net_device *dev,
1603 s8 signal, noise; 1619 s8 signal, noise;
1604 int ret; 1620 int ret;
1605 1621
1622 if (dev == priv->mesh_dev)
1623 return -EOPNOTSUPP;
1624
1606 if (idx != 0) 1625 if (idx != 0)
1607 ret = -ENOENT; 1626 ret = -ENOENT;
1608 1627
@@ -1636,6 +1655,9 @@ static int lbs_change_intf(struct wiphy *wiphy, struct net_device *dev,
1636 struct lbs_private *priv = wiphy_priv(wiphy); 1655 struct lbs_private *priv = wiphy_priv(wiphy);
1637 int ret = 0; 1656 int ret = 0;
1638 1657
1658 if (dev == priv->mesh_dev)
1659 return -EOPNOTSUPP;
1660
1639 lbs_deb_enter(LBS_DEB_CFG80211); 1661 lbs_deb_enter(LBS_DEB_CFG80211);
1640 1662
1641 switch (type) { 1663 switch (type) {
@@ -1959,6 +1981,9 @@ static int lbs_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1959 struct cfg80211_bss *bss; 1981 struct cfg80211_bss *bss;
1960 DECLARE_SSID_BUF(ssid_buf); 1982 DECLARE_SSID_BUF(ssid_buf);
1961 1983
1984 if (dev == priv->mesh_dev)
1985 return -EOPNOTSUPP;
1986
1962 lbs_deb_enter(LBS_DEB_CFG80211); 1987 lbs_deb_enter(LBS_DEB_CFG80211);
1963 1988
1964 if (!params->channel) { 1989 if (!params->channel) {
@@ -1995,6 +2020,9 @@ static int lbs_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1995 struct cmd_ds_802_11_ad_hoc_stop cmd; 2020 struct cmd_ds_802_11_ad_hoc_stop cmd;
1996 int ret = 0; 2021 int ret = 0;
1997 2022
2023 if (dev == priv->mesh_dev)
2024 return -EOPNOTSUPP;
2025
1998 lbs_deb_enter(LBS_DEB_CFG80211); 2026 lbs_deb_enter(LBS_DEB_CFG80211);
1999 2027
2000 memset(&cmd, 0, sizeof(cmd)); 2028 memset(&cmd, 0, sizeof(cmd));
@@ -2117,6 +2145,8 @@ int lbs_cfg_register(struct lbs_private *priv)
2117 BIT(NL80211_IFTYPE_ADHOC); 2145 BIT(NL80211_IFTYPE_ADHOC);
2118 if (lbs_rtap_supported(priv)) 2146 if (lbs_rtap_supported(priv))
2119 wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); 2147 wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
2148 if (lbs_mesh_activated(priv))
2149 wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MESH_POINT);
2120 2150
2121 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &lbs_band_2ghz; 2151 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &lbs_band_2ghz;
2122 2152
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index adb3490e3cf5..133ff1cac524 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -6,7 +6,6 @@
6#ifndef _LBS_DEV_H_ 6#ifndef _LBS_DEV_H_
7#define _LBS_DEV_H_ 7#define _LBS_DEV_H_
8 8
9#include "mesh.h"
10#include "defs.h" 9#include "defs.h"
11#include "host.h" 10#include "host.h"
12 11
@@ -22,6 +21,17 @@ struct sleep_params {
22 uint16_t sp_reserved; 21 uint16_t sp_reserved;
23}; 22};
24 23
24/* Mesh statistics */
25struct lbs_mesh_stats {
26 u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
27 u32 fwd_unicast_cnt; /* Fwd: Unicast counter */
28 u32 fwd_drop_ttl; /* Fwd: TTL zero */
29 u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */
30 u32 fwd_drop_noroute; /* Fwd: No route to Destination */
31 u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
32 u32 drop_blind; /* Rx: Dropped by blinding table */
33 u32 tx_failed_cnt; /* Tx: Failed transmissions */
34};
25 35
26/* Private structure for the MV device */ 36/* Private structure for the MV device */
27struct lbs_private { 37struct lbs_private {
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 4dfb3bfd2cf3..885ddc1c4fed 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -5,6 +5,7 @@
5 5
6#include "decl.h" 6#include "decl.h"
7#include "cmd.h" 7#include "cmd.h"
8#include "mesh.h"
8 9
9 10
10static void lbs_ethtool_get_drvinfo(struct net_device *dev, 11static void lbs_ethtool_get_drvinfo(struct net_device *dev,
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 94652c5a25de..ee28ae510935 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -23,6 +23,7 @@
23#include "cfg.h" 23#include "cfg.h"
24#include "debugfs.h" 24#include "debugfs.h"
25#include "cmd.h" 25#include "cmd.h"
26#include "mesh.h"
26 27
27#define DRIVER_RELEASE_VERSION "323.p0" 28#define DRIVER_RELEASE_VERSION "323.p0"
28const char lbs_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION 29const char lbs_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION
@@ -950,17 +951,20 @@ int lbs_start_card(struct lbs_private *priv)
950 if (ret) 951 if (ret)
951 goto done; 952 goto done;
952 953
954 if (!lbs_disablemesh)
955 lbs_init_mesh(priv);
956 else
957 pr_info("%s: mesh disabled\n", dev->name);
958
953 if (lbs_cfg_register(priv)) { 959 if (lbs_cfg_register(priv)) {
954 pr_err("cannot register device\n"); 960 pr_err("cannot register device\n");
955 goto done; 961 goto done;
956 } 962 }
957 963
958 lbs_update_channel(priv); 964 if (lbs_mesh_activated(priv))
965 lbs_start_mesh(priv);
959 966
960 if (!lbs_disablemesh) 967 lbs_update_channel(priv);
961 lbs_init_mesh(priv);
962 else
963 pr_info("%s: mesh disabled\n", dev->name);
964 968
965 lbs_debugfs_init_one(priv, dev); 969 lbs_debugfs_init_one(priv, dev);
966 970
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c
index be72c08ea2a7..2a635d279ffe 100644
--- a/drivers/net/wireless/libertas/mesh.c
+++ b/drivers/net/wireless/libertas/mesh.c
@@ -129,6 +129,19 @@ static int lbs_mesh_config(struct lbs_private *priv, uint16_t action,
129 return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv); 129 return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv);
130} 130}
131 131
132int lbs_mesh_set_channel(struct lbs_private *priv, u8 channel)
133{
134 return lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, channel);
135}
136
137static uint16_t lbs_mesh_get_channel(struct lbs_private *priv)
138{
139 struct wireless_dev *mesh_wdev = priv->mesh_dev->ieee80211_ptr;
140 if (mesh_wdev->channel)
141 return mesh_wdev->channel->hw_value;
142 else
143 return 1;
144}
132 145
133/*************************************************************************** 146/***************************************************************************
134 * Mesh sysfs support 147 * Mesh sysfs support
@@ -812,7 +825,6 @@ static void lbs_persist_config_remove(struct net_device *dev)
812 */ 825 */
813int lbs_init_mesh(struct lbs_private *priv) 826int lbs_init_mesh(struct lbs_private *priv)
814{ 827{
815 struct net_device *dev = priv->dev;
816 int ret = 0; 828 int ret = 0;
817 829
818 lbs_deb_enter(LBS_DEB_MESH); 830 lbs_deb_enter(LBS_DEB_MESH);
@@ -837,11 +849,9 @@ int lbs_init_mesh(struct lbs_private *priv)
837 useful */ 849 useful */
838 850
839 priv->mesh_tlv = TLV_TYPE_OLD_MESH_ID; 851 priv->mesh_tlv = TLV_TYPE_OLD_MESH_ID;
840 if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 852 if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 1)) {
841 priv->channel)) {
842 priv->mesh_tlv = TLV_TYPE_MESH_ID; 853 priv->mesh_tlv = TLV_TYPE_MESH_ID;
843 if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 854 if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 1))
844 priv->channel))
845 priv->mesh_tlv = 0; 855 priv->mesh_tlv = 0;
846 } 856 }
847 } else 857 } else
@@ -851,23 +861,16 @@ int lbs_init_mesh(struct lbs_private *priv)
851 * 0x100+37; Do not invoke command with old TLV. 861 * 0x100+37; Do not invoke command with old TLV.
852 */ 862 */
853 priv->mesh_tlv = TLV_TYPE_MESH_ID; 863 priv->mesh_tlv = TLV_TYPE_MESH_ID;
854 if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 864 if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 1))
855 priv->channel))
856 priv->mesh_tlv = 0; 865 priv->mesh_tlv = 0;
857 } 866 }
858 867
859 /* Stop meshing until interface is brought up */ 868 /* Stop meshing until interface is brought up */
860 lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, priv->channel); 869 lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, 1);
861 870
862 if (priv->mesh_tlv) { 871 if (priv->mesh_tlv) {
863 sprintf(priv->mesh_ssid, "mesh"); 872 sprintf(priv->mesh_ssid, "mesh");
864 priv->mesh_ssid_len = 4; 873 priv->mesh_ssid_len = 4;
865
866 lbs_add_mesh(priv);
867
868 if (device_create_file(&dev->dev, &dev_attr_lbs_mesh))
869 netdev_err(dev, "cannot register lbs_mesh attribute\n");
870
871 ret = 1; 874 ret = 1;
872 } 875 }
873 876
@@ -875,6 +878,13 @@ int lbs_init_mesh(struct lbs_private *priv)
875 return ret; 878 return ret;
876} 879}
877 880
881void lbs_start_mesh(struct lbs_private *priv)
882{
883 lbs_add_mesh(priv);
884
885 if (device_create_file(&priv->dev->dev, &dev_attr_lbs_mesh))
886 netdev_err(priv->dev, "cannot register lbs_mesh attribute\n");
887}
878 888
879int lbs_deinit_mesh(struct lbs_private *priv) 889int lbs_deinit_mesh(struct lbs_private *priv)
880{ 890{
@@ -904,7 +914,8 @@ static int lbs_mesh_stop(struct net_device *dev)
904 struct lbs_private *priv = dev->ml_priv; 914 struct lbs_private *priv = dev->ml_priv;
905 915
906 lbs_deb_enter(LBS_DEB_MESH); 916 lbs_deb_enter(LBS_DEB_MESH);
907 lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, priv->channel); 917 lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP,
918 lbs_mesh_get_channel(priv));
908 919
909 spin_lock_irq(&priv->driver_lock); 920 spin_lock_irq(&priv->driver_lock);
910 921
@@ -947,7 +958,8 @@ static int lbs_mesh_dev_open(struct net_device *dev)
947 958
948 spin_unlock_irq(&priv->driver_lock); 959 spin_unlock_irq(&priv->driver_lock);
949 960
950 ret = lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, priv->channel); 961 ret = lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START,
962 lbs_mesh_get_channel(priv));
951 963
952out: 964out:
953 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); 965 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
@@ -971,18 +983,32 @@ static const struct net_device_ops mesh_netdev_ops = {
971static int lbs_add_mesh(struct lbs_private *priv) 983static int lbs_add_mesh(struct lbs_private *priv)
972{ 984{
973 struct net_device *mesh_dev = NULL; 985 struct net_device *mesh_dev = NULL;
986 struct wireless_dev *mesh_wdev;
974 int ret = 0; 987 int ret = 0;
975 988
976 lbs_deb_enter(LBS_DEB_MESH); 989 lbs_deb_enter(LBS_DEB_MESH);
977 990
978 /* Allocate a virtual mesh device */ 991 /* Allocate a virtual mesh device */
992 mesh_wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
993 if (!mesh_wdev) {
994 lbs_deb_mesh("init mshX wireless device failed\n");
995 ret = -ENOMEM;
996 goto done;
997 }
998
979 mesh_dev = alloc_netdev(0, "msh%d", ether_setup); 999 mesh_dev = alloc_netdev(0, "msh%d", ether_setup);
980 if (!mesh_dev) { 1000 if (!mesh_dev) {
981 lbs_deb_mesh("init mshX device failed\n"); 1001 lbs_deb_mesh("init mshX device failed\n");
982 ret = -ENOMEM; 1002 ret = -ENOMEM;
983 goto done; 1003 goto err_free_wdev;
984 } 1004 }
1005
1006 mesh_wdev->iftype = NL80211_IFTYPE_MESH_POINT;
1007 mesh_wdev->wiphy = priv->wdev->wiphy;
1008 mesh_wdev->netdev = mesh_dev;
1009
985 mesh_dev->ml_priv = priv; 1010 mesh_dev->ml_priv = priv;
1011 mesh_dev->ieee80211_ptr = mesh_wdev;
986 priv->mesh_dev = mesh_dev; 1012 priv->mesh_dev = mesh_dev;
987 1013
988 mesh_dev->netdev_ops = &mesh_netdev_ops; 1014 mesh_dev->netdev_ops = &mesh_netdev_ops;
@@ -996,7 +1022,7 @@ static int lbs_add_mesh(struct lbs_private *priv)
996 ret = register_netdev(mesh_dev); 1022 ret = register_netdev(mesh_dev);
997 if (ret) { 1023 if (ret) {
998 pr_err("cannot register mshX virtual interface\n"); 1024 pr_err("cannot register mshX virtual interface\n");
999 goto err_free; 1025 goto err_free_netdev;
1000 } 1026 }
1001 1027
1002 ret = sysfs_create_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); 1028 ret = sysfs_create_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group);
@@ -1012,9 +1038,12 @@ static int lbs_add_mesh(struct lbs_private *priv)
1012err_unregister: 1038err_unregister:
1013 unregister_netdev(mesh_dev); 1039 unregister_netdev(mesh_dev);
1014 1040
1015err_free: 1041err_free_netdev:
1016 free_netdev(mesh_dev); 1042 free_netdev(mesh_dev);
1017 1043
1044err_free_wdev:
1045 kfree(mesh_wdev);
1046
1018done: 1047done:
1019 lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); 1048 lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
1020 return ret; 1049 return ret;
@@ -1035,6 +1064,7 @@ void lbs_remove_mesh(struct lbs_private *priv)
1035 lbs_persist_config_remove(mesh_dev); 1064 lbs_persist_config_remove(mesh_dev);
1036 unregister_netdev(mesh_dev); 1065 unregister_netdev(mesh_dev);
1037 priv->mesh_dev = NULL; 1066 priv->mesh_dev = NULL;
1067 kfree(mesh_dev->ieee80211_ptr);
1038 free_netdev(mesh_dev); 1068 free_netdev(mesh_dev);
1039 lbs_deb_leave(LBS_DEB_MESH); 1069 lbs_deb_leave(LBS_DEB_MESH);
1040} 1070}
diff --git a/drivers/net/wireless/libertas/mesh.h b/drivers/net/wireless/libertas/mesh.h
index 50144913f2ab..6603f341c874 100644
--- a/drivers/net/wireless/libertas/mesh.h
+++ b/drivers/net/wireless/libertas/mesh.h
@@ -9,30 +9,25 @@
9#include <net/lib80211.h> 9#include <net/lib80211.h>
10 10
11#include "host.h" 11#include "host.h"
12#include "dev.h"
12 13
13#ifdef CONFIG_LIBERTAS_MESH 14#ifdef CONFIG_LIBERTAS_MESH
14 15
15/* Mesh statistics */
16struct lbs_mesh_stats {
17 u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
18 u32 fwd_unicast_cnt; /* Fwd: Unicast counter */
19 u32 fwd_drop_ttl; /* Fwd: TTL zero */
20 u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */
21 u32 fwd_drop_noroute; /* Fwd: No route to Destination */
22 u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
23 u32 drop_blind; /* Rx: Dropped by blinding table */
24 u32 tx_failed_cnt; /* Tx: Failed transmissions */
25};
26
27
28struct net_device; 16struct net_device;
29struct lbs_private;
30 17
31int lbs_init_mesh(struct lbs_private *priv); 18int lbs_init_mesh(struct lbs_private *priv);
19void lbs_start_mesh(struct lbs_private *priv);
32int lbs_deinit_mesh(struct lbs_private *priv); 20int lbs_deinit_mesh(struct lbs_private *priv);
33 21
34void lbs_remove_mesh(struct lbs_private *priv); 22void lbs_remove_mesh(struct lbs_private *priv);
35 23
24static inline bool lbs_mesh_activated(struct lbs_private *priv)
25{
26 /* Mesh SSID is only programmed after successful init */
27 return priv->mesh_ssid_len != 0;
28}
29
30int lbs_mesh_set_channel(struct lbs_private *priv, u8 channel);
36 31
37/* Sending / Receiving */ 32/* Sending / Receiving */
38 33
@@ -67,11 +62,13 @@ void lbs_mesh_ethtool_get_strings(struct net_device *dev,
67 62
68#define lbs_init_mesh(priv) 63#define lbs_init_mesh(priv)
69#define lbs_deinit_mesh(priv) 64#define lbs_deinit_mesh(priv)
65#define lbs_start_mesh(priv)
70#define lbs_add_mesh(priv) 66#define lbs_add_mesh(priv)
71#define lbs_remove_mesh(priv) 67#define lbs_remove_mesh(priv)
72#define lbs_mesh_set_dev(priv, dev, rxpd) (dev) 68#define lbs_mesh_set_dev(priv, dev, rxpd) (dev)
73#define lbs_mesh_set_txpd(priv, dev, txpd) 69#define lbs_mesh_set_txpd(priv, dev, txpd)
74#define lbs_mesh_config(priv, enable, chan) 70#define lbs_mesh_set_channel(priv, channel) (0)
71#define lbs_mesh_activated(priv) (false)
75 72
76#endif 73#endif
77 74
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index bfb8898ae518..62e10eeadd7e 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -15,6 +15,7 @@
15#include "radiotap.h" 15#include "radiotap.h"
16#include "decl.h" 16#include "decl.h"
17#include "dev.h" 17#include "dev.h"
18#include "mesh.h"
18 19
19struct eth803hdr { 20struct eth803hdr {
20 u8 dest_addr[6]; 21 u8 dest_addr[6];
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index a6e85134cfe1..8f127520d786 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -12,6 +12,7 @@
12#include "decl.h" 12#include "decl.h"
13#include "defs.h" 13#include "defs.h"
14#include "dev.h" 14#include "dev.h"
15#include "mesh.h"
15 16
16/** 17/**
17 * convert_radiotap_rate_to_mv - converts Tx/Rx rates from IEEE80211_RADIOTAP_RATE 18 * convert_radiotap_rate_to_mv - converts Tx/Rx rates from IEEE80211_RADIOTAP_RATE