diff options
author | Holger Schurig <hs4233@mail.mn-solutions.de> | 2009-10-06 10:31:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:47 -0400 |
commit | ff9fc791940f9ff51387c35f9332efe5007154f1 (patch) | |
tree | 49aa914b7d4162312ca7a0d42fde15cfede079a4 /drivers/net/wireless/libertas/main.c | |
parent | 0465af8e03bdc6cd0b49dc5548671387a8674b69 (diff) |
libertas: first stab at cfg80211 support
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 9b2a9174a017..e6da1dfa8131 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -14,11 +14,13 @@ | |||
14 | #include <linux/stddef.h> | 14 | #include <linux/stddef.h> |
15 | #include <linux/ieee80211.h> | 15 | #include <linux/ieee80211.h> |
16 | #include <net/iw_handler.h> | 16 | #include <net/iw_handler.h> |
17 | #include <net/cfg80211.h> | ||
17 | 18 | ||
18 | #include "host.h" | 19 | #include "host.h" |
19 | #include "decl.h" | 20 | #include "decl.h" |
20 | #include "dev.h" | 21 | #include "dev.h" |
21 | #include "wext.h" | 22 | #include "wext.h" |
23 | #include "cfg.h" | ||
22 | #include "debugfs.h" | 24 | #include "debugfs.h" |
23 | #include "scan.h" | 25 | #include "scan.h" |
24 | #include "assoc.h" | 26 | #include "assoc.h" |
@@ -1245,31 +1247,42 @@ static const struct net_device_ops lbs_netdev_ops = { | |||
1245 | */ | 1247 | */ |
1246 | struct lbs_private *lbs_add_card(void *card, struct device *dmdev) | 1248 | struct lbs_private *lbs_add_card(void *card, struct device *dmdev) |
1247 | { | 1249 | { |
1248 | struct net_device *dev = NULL; | 1250 | struct net_device *dev; |
1251 | struct wireless_dev *wdev; | ||
1249 | struct lbs_private *priv = NULL; | 1252 | struct lbs_private *priv = NULL; |
1250 | 1253 | ||
1251 | lbs_deb_enter(LBS_DEB_MAIN); | 1254 | lbs_deb_enter(LBS_DEB_MAIN); |
1252 | 1255 | ||
1253 | /* Allocate an Ethernet device and register it */ | 1256 | /* Allocate an Ethernet device and register it */ |
1254 | dev = alloc_etherdev(sizeof(struct lbs_private)); | 1257 | wdev = lbs_cfg_alloc(dmdev); |
1255 | if (!dev) { | 1258 | if (IS_ERR(wdev)) { |
1256 | lbs_pr_err("init wlanX device failed\n"); | 1259 | lbs_pr_err("cfg80211 init failed\n"); |
1257 | goto done; | 1260 | goto done; |
1258 | } | 1261 | } |
1259 | priv = netdev_priv(dev); | 1262 | /* TODO? */ |
1260 | dev->ml_priv = priv; | 1263 | wdev->iftype = NL80211_IFTYPE_STATION; |
1264 | priv = wdev_priv(wdev); | ||
1265 | priv->wdev = wdev; | ||
1261 | 1266 | ||
1262 | if (lbs_init_adapter(priv)) { | 1267 | if (lbs_init_adapter(priv)) { |
1263 | lbs_pr_err("failed to initialize adapter structure.\n"); | 1268 | lbs_pr_err("failed to initialize adapter structure.\n"); |
1264 | goto err_init_adapter; | 1269 | goto err_wdev; |
1270 | } | ||
1271 | |||
1272 | //TODO? dev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES); | ||
1273 | dev = alloc_netdev(0, "wlan%d", ether_setup); | ||
1274 | if (!dev) { | ||
1275 | dev_err(dmdev, "no memory for network device instance\n"); | ||
1276 | goto err_adapter; | ||
1265 | } | 1277 | } |
1266 | 1278 | ||
1279 | dev->netdev_ops = &lbs_netdev_ops; | ||
1280 | dev->ieee80211_ptr = wdev; | ||
1281 | dev->ml_priv = priv; | ||
1282 | SET_NETDEV_DEV(dev, dmdev); | ||
1283 | wdev->netdev = dev; | ||
1267 | priv->dev = dev; | 1284 | priv->dev = dev; |
1268 | priv->card = card; | ||
1269 | priv->mesh_open = 0; | ||
1270 | priv->infra_open = 0; | ||
1271 | 1285 | ||
1272 | /* Setup the OS Interface to our functions */ | ||
1273 | dev->netdev_ops = &lbs_netdev_ops; | 1286 | dev->netdev_ops = &lbs_netdev_ops; |
1274 | dev->watchdog_timeo = 5 * HZ; | 1287 | dev->watchdog_timeo = 5 * HZ; |
1275 | dev->ethtool_ops = &lbs_ethtool_ops; | 1288 | dev->ethtool_ops = &lbs_ethtool_ops; |
@@ -1278,7 +1291,14 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) | |||
1278 | #endif | 1291 | #endif |
1279 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; | 1292 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; |
1280 | 1293 | ||
1281 | SET_NETDEV_DEV(dev, dmdev); | 1294 | |
1295 | // TODO: kzalloc + iwm_init_default_profile(iwm, iwm->umac_profile); ?? | ||
1296 | |||
1297 | |||
1298 | priv->card = card; | ||
1299 | priv->mesh_open = 0; | ||
1300 | priv->infra_open = 0; | ||
1301 | |||
1282 | 1302 | ||
1283 | priv->rtap_net_dev = NULL; | 1303 | priv->rtap_net_dev = NULL; |
1284 | strcpy(dev->name, "wlan%d"); | 1304 | strcpy(dev->name, "wlan%d"); |
@@ -1288,7 +1308,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) | |||
1288 | priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main"); | 1308 | priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main"); |
1289 | if (IS_ERR(priv->main_thread)) { | 1309 | if (IS_ERR(priv->main_thread)) { |
1290 | lbs_deb_thread("Error creating main thread.\n"); | 1310 | lbs_deb_thread("Error creating main thread.\n"); |
1291 | goto err_init_adapter; | 1311 | goto err_ndev; |
1292 | } | 1312 | } |
1293 | 1313 | ||
1294 | priv->work_thread = create_singlethread_workqueue("lbs_worker"); | 1314 | priv->work_thread = create_singlethread_workqueue("lbs_worker"); |
@@ -1305,9 +1325,15 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) | |||
1305 | 1325 | ||
1306 | goto done; | 1326 | goto done; |
1307 | 1327 | ||
1308 | err_init_adapter: | 1328 | err_ndev: |
1309 | lbs_free_adapter(priv); | ||
1310 | free_netdev(dev); | 1329 | free_netdev(dev); |
1330 | |||
1331 | err_adapter: | ||
1332 | lbs_free_adapter(priv); | ||
1333 | |||
1334 | err_wdev: | ||
1335 | lbs_cfg_free(priv); | ||
1336 | |||
1311 | priv = NULL; | 1337 | priv = NULL; |
1312 | 1338 | ||
1313 | done: | 1339 | done: |
@@ -1359,6 +1385,7 @@ void lbs_remove_card(struct lbs_private *priv) | |||
1359 | kthread_stop(priv->main_thread); | 1385 | kthread_stop(priv->main_thread); |
1360 | 1386 | ||
1361 | lbs_free_adapter(priv); | 1387 | lbs_free_adapter(priv); |
1388 | lbs_cfg_free(priv); | ||
1362 | 1389 | ||
1363 | priv->dev = NULL; | 1390 | priv->dev = NULL; |
1364 | free_netdev(dev); | 1391 | free_netdev(dev); |
@@ -1383,8 +1410,8 @@ int lbs_start_card(struct lbs_private *priv) | |||
1383 | /* init 802.11d */ | 1410 | /* init 802.11d */ |
1384 | lbs_init_11d(priv); | 1411 | lbs_init_11d(priv); |
1385 | 1412 | ||
1386 | if (register_netdev(dev)) { | 1413 | if (lbs_cfg_register(priv)) { |
1387 | lbs_pr_err("cannot register ethX device\n"); | 1414 | lbs_pr_err("cannot register device\n"); |
1388 | goto done; | 1415 | goto done; |
1389 | } | 1416 | } |
1390 | 1417 | ||