diff options
author | Avinash Patil <patila@marvell.com> | 2014-11-05 09:08:11 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-11-17 15:32:13 -0500 |
commit | 0013c7cebed676ea47d108176db138fe867ee401 (patch) | |
tree | ffeee696a5f7e90fdb5cf51d93f803d1cfebb77a /drivers/net/wireless/mwifiex | |
parent | 325e188176681bdce0584154075e02c373794749 (diff) |
mwifiex: module load parameter for interface creation
This patch adds module load parameter driver_mode for mwifiex
which would enable driver to create AP or P2P client interface while loading
module. driver_mode is bitmap of interface modes for station, AP and
P2P client.
Station interface is created by default and is unaffected by driver_mode
parameter.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/main.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 5 |
2 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 2a5a59bec124..2de8a6a84620 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -28,6 +28,11 @@ const char driver_version[] = "mwifiex " VERSION " (%s) "; | |||
28 | static char *cal_data_cfg; | 28 | static char *cal_data_cfg; |
29 | module_param(cal_data_cfg, charp, 0); | 29 | module_param(cal_data_cfg, charp, 0); |
30 | 30 | ||
31 | static unsigned short driver_mode; | ||
32 | module_param(driver_mode, ushort, 0); | ||
33 | MODULE_PARM_DESC(driver_mode, | ||
34 | "station=0x1(default), ap-sta=0x3, station-p2p=0x5, ap-sta-p2p=0x7"); | ||
35 | |||
31 | /* | 36 | /* |
32 | * This function registers the device and performs all the necessary | 37 | * This function registers the device and performs all the necessary |
33 | * initializations. | 38 | * initializations. |
@@ -449,6 +454,11 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) | |||
449 | goto err_init_fw; | 454 | goto err_init_fw; |
450 | } | 455 | } |
451 | 456 | ||
457 | if (driver_mode) { | ||
458 | driver_mode &= MWIFIEX_DRIVER_MODE_BITMASK; | ||
459 | driver_mode |= MWIFIEX_DRIVER_MODE_STA; | ||
460 | } | ||
461 | |||
452 | rtnl_lock(); | 462 | rtnl_lock(); |
453 | /* Create station interface by default */ | 463 | /* Create station interface by default */ |
454 | wdev = mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d", | 464 | wdev = mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d", |
@@ -458,6 +468,28 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) | |||
458 | rtnl_unlock(); | 468 | rtnl_unlock(); |
459 | goto err_add_intf; | 469 | goto err_add_intf; |
460 | } | 470 | } |
471 | |||
472 | if (driver_mode & MWIFIEX_DRIVER_MODE_UAP) { | ||
473 | wdev = mwifiex_add_virtual_intf(adapter->wiphy, "uap%d", | ||
474 | NL80211_IFTYPE_AP, NULL, NULL); | ||
475 | if (IS_ERR(wdev)) { | ||
476 | dev_err(adapter->dev, "cannot create AP interface\n"); | ||
477 | rtnl_unlock(); | ||
478 | goto err_add_intf; | ||
479 | } | ||
480 | } | ||
481 | |||
482 | if (driver_mode & MWIFIEX_DRIVER_MODE_P2P) { | ||
483 | wdev = mwifiex_add_virtual_intf(adapter->wiphy, "p2p%d", | ||
484 | NL80211_IFTYPE_P2P_CLIENT, NULL, | ||
485 | NULL); | ||
486 | if (IS_ERR(wdev)) { | ||
487 | dev_err(adapter->dev, | ||
488 | "cannot create p2p client interface\n"); | ||
489 | rtnl_unlock(); | ||
490 | goto err_add_intf; | ||
491 | } | ||
492 | } | ||
461 | rtnl_unlock(); | 493 | rtnl_unlock(); |
462 | 494 | ||
463 | mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); | 495 | mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index eced41ef1967..fa84888cf092 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -48,6 +48,11 @@ enum { | |||
48 | MWIFIEX_SYNC_CMD | 48 | MWIFIEX_SYNC_CMD |
49 | }; | 49 | }; |
50 | 50 | ||
51 | #define MWIFIEX_DRIVER_MODE_STA BIT(0) | ||
52 | #define MWIFIEX_DRIVER_MODE_UAP BIT(1) | ||
53 | #define MWIFIEX_DRIVER_MODE_P2P BIT(2) | ||
54 | #define MWIFIEX_DRIVER_MODE_BITMASK (BIT(0) | BIT(1) | BIT(2)) | ||
55 | |||
51 | #define MWIFIEX_MAX_AP 64 | 56 | #define MWIFIEX_MAX_AP 64 |
52 | 57 | ||
53 | #define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ) | 58 | #define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ) |