2011-03-30 00:56:36

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 00/34] ath6kl: cleanup series III

Greg,

here's my third series of cleanup on ath6kl. Worth noting is the
removal of all that ioctl and Androd crap, and in total about 10K LOC of
cleanup. It also starts focusingon the initialization aspects of the driver,
with focus on passing more error values in places where it should have. The
cleanup works seems to also have a huge impact on driver load time, the driver
scan also now feels a bit more snappier for whatever reason. My end goal
was to help with cleanup on the init for speed and also to get us to get
this thing to work on x86_64. Unfortunately I was unable to get all that
far with that but all this should help.

At this point our cleanup work will likely slow down for a bit until
further notice. Particularly our team will send in the near future
some AR6003 2.1.1 support and fix any bugs and enhancements required
to get ath6kl to work properly and as expected.

I have test compiled and load tested with a scan each patch, and tested
connectivity on the last patch. I've given our team more than enough
time to review these changes and so far no objections so I'm shooting
this out now. The only downside is I had to test all this on
wireless-testing instead of staging-next given that staging-next
is unstable at the moment. To do this I sucked in all patches for
ath6kl from staging-next and applied them to wireless-testing, then
I applied my series from staging-next.

This should apply cleanly to today's staging-next tree. Please let
me know if you have any issues.

Luis R. Rodriguez (34):
ath6kl: s|A_FREE|kfree|g
ath6kl: remove BMIENABLE_SET define
ath6kl: propagate error values on ar6000_avail_ev()
ath6kl: replace do while loop with function helpers on
ar6000_avail_ev()
ath6kl: remove SET_MODULE_OWNER usage
ath6kl: move setting netdev for non-cf80211 case
ath6kl: remove Bluetooth PAL code and WMI ACL TX/RX data support
ath6kl: kill Android specific code
ath6kl: remove all the wext and super extended private ioctl crap
ath6kl: remove define ATH_AR6K_11N_SUPPORT
ath6kl: remove dependency on LINUX and KERNEL_2_6 macros
ath6kl: remove SEND_EVENT_TO_APP define
ath6kl: remove USER_KEYS define
ath6kl: remove unused define NO_SYNC_FLUSH
ath6kl: remove define HTC_EP_STAT_PROFILING
ath6kl: remove unused define WLAN_HEADERS
ath6kl: remove INIT_MODE_DRV_ENABLED define
ath6kl: use CONFIG_AR600x_SD31_XXX
ath6kl: use CONFIG_AR600x_WB31_XXX
ath6kl: use CONFIG_AR600x_SD32_XXX
ath6kl: remove AR600x_CUSTOM_XXX define
ath6kl: use CONFIG_ATH6KL_ENABLE_COEXISTENCE
ath6kl: simplify btcoex parameter programming
ath6kl: propagate errors on module setup
ath6kl: remove useless plat_setup_power() calls
ath6kl: propagate errors on hifEnableFunc() failures
ath6kl: cleanup allocation and getting of the hif dev
ath6kl: style cleanup on struct sdio_driver components
ath6kl: remove completely pointles platform driver
ath6kl: cleanup and move the ath6kl pm ops to be assigned statically
ath6kl: rename the pm ops to something more sensible
ath6kl: remove chatty debug messages on ath6kl driver ops
ath6kl: remove ar6000_prepare_target() crap
ath6kl: remove the HTC raw interface

drivers/staging/ath6kl/Kconfig | 12 -
drivers/staging/ath6kl/Makefile | 44 +-
drivers/staging/ath6kl/bmi/src/bmi.c | 8 +-
.../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 380 +-
.../ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c | 10 +-
drivers/staging/ath6kl/htc2/AR6000/ar6k.c | 2 +-
drivers/staging/ath6kl/htc2/AR6000/ar6k.h | 3 -
.../ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c | 2 +-
drivers/staging/ath6kl/htc2/htc.c | 10 +-
drivers/staging/ath6kl/htc2/htc_internal.h | 8 -
drivers/staging/ath6kl/htc2/htc_recv.c | 6 -
drivers/staging/ath6kl/htc2/htc_send.c | 5 -
drivers/staging/ath6kl/include/a_config.h | 22 -
drivers/staging/ath6kl/include/a_debug.h | 28 -
drivers/staging/ath6kl/include/a_drv.h | 22 -
drivers/staging/ath6kl/include/a_drv_api.h | 28 -
drivers/staging/ath6kl/include/a_osapi.h | 29 -
drivers/staging/ath6kl/include/a_types.h | 26 -
drivers/staging/ath6kl/include/ar6000_api.h | 22 -
drivers/staging/ath6kl/include/athendpack.h | 52 -
drivers/staging/ath6kl/include/athstartpack.h | 55 -
.../common/AR6002/hw4.0/hw/analog_intf_reg.h | 13 -
.../include/common/AR6002/hw4.0/hw/apb_map.h | 8 -
.../include/common/AR6002/hw4.0/hw/gpio_reg.h | 8 -
.../include/common/AR6002/hw4.0/hw/mbox_host_reg.h | 13 -
.../include/common/AR6002/hw4.0/hw/mbox_reg.h | 8 -
.../include/common/AR6002/hw4.0/hw/rtc_reg.h | 8 -
.../include/common/AR6002/hw4.0/hw/umbox_reg.h | 14 -
.../include/common/AR6002/hw4.0/hw/vmc_reg.h | 8 -
drivers/staging/ath6kl/include/common/bmi_msg.h | 8 -
drivers/staging/ath6kl/include/common/dbglog.h | 8 -
.../staging/ath6kl/include/common/dset_internal.h | 8 -
drivers/staging/ath6kl/include/common/dsetid.h | 8 -
.../staging/ath6kl/include/common/epping_test.h | 9 -
drivers/staging/ath6kl/include/common/gmboxif.h | 8 -
drivers/staging/ath6kl/include/common/htc.h | 9 -
drivers/staging/ath6kl/include/common/regdump.h | 8 -
drivers/staging/ath6kl/include/common/targaddrs.h | 8 -
drivers/staging/ath6kl/include/common/wmi.h | 10 +-
drivers/staging/ath6kl/include/common/wmix.h | 7 -
drivers/staging/ath6kl/include/common_drv.h | 4 -
drivers/staging/ath6kl/miscdrv/ar3kconfig.c | 22 +-
.../staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c | 22 +-
.../staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c | 28 +-
.../staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h | 5 -
drivers/staging/ath6kl/miscdrv/common_drv.c | 34 -
drivers/staging/ath6kl/os/linux/ar6000_android.c | 388 --
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 666 +---
drivers/staging/ath6kl/os/linux/ar6000_pm.c | 77 -
drivers/staging/ath6kl/os/linux/ar6000_raw_if.c | 455 --
drivers/staging/ath6kl/os/linux/ar6k_pal.c | 479 --
drivers/staging/ath6kl/os/linux/cfg80211.c | 4 +-
drivers/staging/ath6kl/os/linux/eeprom.c | 213 -
drivers/staging/ath6kl/os/linux/hci_bridge.c | 4 +-
.../staging/ath6kl/os/linux/include/ar6000_drv.h | 103 +-
.../ath6kl/os/linux/include/ar6xapi_linux.h | 8 -
.../staging/ath6kl/os/linux/include/athdrv_linux.h | 41 +-
.../staging/ath6kl/os/linux/include/config_linux.h | 7 -
.../staging/ath6kl/os/linux/include/osapi_linux.h | 49 +-
.../staging/ath6kl/os/linux/include/wlan_config.h | 10 -
.../ath6kl/os/linux/include/wmi_filter_linux.h | 2 +-
drivers/staging/ath6kl/os/linux/ioctl.c | 4767 --------------------
drivers/staging/ath6kl/os/linux/wireless_ext.c | 2723 -----------
drivers/staging/ath6kl/reorder/rcv_aggr.c | 10 +-
drivers/staging/ath6kl/wlan/include/ieee80211.h | 4 -
drivers/staging/ath6kl/wlan/src/wlan_node.c | 6 +-
drivers/staging/ath6kl/wmi/wmi.c | 223 +-
67 files changed, 424 insertions(+), 10875 deletions(-)
delete mode 100644 drivers/staging/ath6kl/include/athendpack.h
delete mode 100644 drivers/staging/ath6kl/include/athstartpack.h
delete mode 100644 drivers/staging/ath6kl/os/linux/ar6000_android.c
delete mode 100644 drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
delete mode 100644 drivers/staging/ath6kl/os/linux/ar6k_pal.c
delete mode 100644 drivers/staging/ath6kl/os/linux/ioctl.c
delete mode 100644 drivers/staging/ath6kl/os/linux/wireless_ext.c



2011-03-31 18:04:11

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH 34/34] ath6kl: remove the HTC raw interface

On Thu, Mar 31, 2011 at 9:50 AM, Vipin Mehta <[email protected]> wrote:
> The raw HTC support is required for the tools used on the manufacturing floor
> For module calibration. Without this code, the driver and the hardware
> cannot be shipped. I suggest we keep this code until we add the support for
> nl80211 test command interface and migrate the tools to use the new interface.

Vipin, so you NACK the patch -- that's fine. Greg please drop this
one. Vipin, when do you plan on adding the nl80211 test command
support? The API already exists. I'll remind you that this is a
blocker for getting this out of staging.

Luis

2011-03-30 00:57:40

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 26/34] ath6kl: propagate errors on hifEnableFunc() failures

This will be passed along to the SDIO probe routine when
it fails. This will generate better error code to the user
when loading the module if it fails.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
.../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
index 001f993..1752b33 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
@@ -1012,7 +1012,7 @@ static int hifEnableFunc(struct hif_device *device, struct sdio_func *func)
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("AR6000: failed to enable 4-bit ASYNC IRQ mode %d \n",ret));
sdio_release_host(func);
- return A_ERROR;
+ return ret;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: 4-bit ASYNC IRQ mode enabled\n"));
}
@@ -1023,14 +1023,14 @@ static int hifEnableFunc(struct hif_device *device, struct sdio_func *func)
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), Unable to enable AR6K: 0x%X\n",
__FUNCTION__, ret));
sdio_release_host(func);
- return A_ERROR;
+ return ret;
}
ret = sdio_set_block_size(func, HIF_MBOX_BLOCK_SIZE);
sdio_release_host(func);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), Unable to set block size 0x%x AR6K: 0x%X\n",
__FUNCTION__, HIF_MBOX_BLOCK_SIZE, ret));
- return A_ERROR;
+ return ret;
}
device->is_disabled = false;
/* create async I/O thread */
@@ -1041,7 +1041,7 @@ static int hifEnableFunc(struct hif_device *device, struct sdio_func *func)
"AR6K Async");
if (IS_ERR(device->async_task)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), to create async task\n", __FUNCTION__));
- return A_ERROR;
+ return -ENOMEM;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: start async task\n"));
wake_up_process(device->async_task );
@@ -1056,14 +1056,14 @@ static int hifEnableFunc(struct hif_device *device, struct sdio_func *func)
} else {
taskFunc = enable_task;
taskName = "AR6K enable";
- ret = A_PENDING;
+ ret = -ENOMEM;
#endif /* CONFIG_PM */
}
/* create resume thread */
pTask = kthread_create(taskFunc, (void *)device, taskName);
if (IS_ERR(pTask)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), to create enabel task\n", __FUNCTION__));
- return A_ERROR;
+ return -ENOMEM;
}
wake_up_process(pTask);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifEnableFunc\n"));
--
1.7.0.4


2011-03-30 00:56:40

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 02/34] ath6kl: remove BMIENABLE_SET define

Leave the code in place as this is always defined statically.

Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 1 -
drivers/staging/ath6kl/os/linux/ar6000_android.c | 2 -
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 66 ++++++++------------
.../staging/ath6kl/os/linux/include/ar6000_drv.h | 6 --
drivers/staging/ath6kl/os/linux/ioctl.c | 14 +---
5 files changed, 28 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index ab68078..50c1db0 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -126,7 +126,6 @@ ccflags-y += -DWAPI_ENABLE
ccflags-y += -DCHECKSUM_OFFLOAD
ccflags-y += -DWLAN_HEADERS
ccflags-y += -DINIT_MODE_DRV_ENABLED
-ccflags-y += -DBMIENABLE_SET

obj-$(CONFIG_ATH6K_LEGACY) := ath6kl.o
ath6kl-y += htc2/AR6000/ar6k.o
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_android.c b/drivers/staging/ath6kl/os/linux/ar6000_android.c
index c96f6e9..03352b0 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_android.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_android.c
@@ -37,7 +37,6 @@ char fwpath[256] = "/system/wifi";
int wowledon;
unsigned int enablelogcat;

-extern int bmienable;
extern struct net_device *ar6000_devices[];
extern char ifname[];

@@ -309,7 +308,6 @@ static void android_late_resume(struct early_suspend *h)

void android_module_init(OSDRV_CALLBACKS *osdrvCallbacks)
{
- bmienable = 1;
if (ifname[0] == '\0')
strcpy(ifname, def_ifname);
#ifdef CONFIG_HAS_EARLYSUSPEND
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 6ca147f..6248c6d 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -118,7 +118,6 @@ struct hci_transport_callbacks ar6kHciTransCallbacks = { NULL };
#endif

unsigned int processDot11Hdr = 0;
-int bmienable = BMIENABLE_DEFAULT;

char ifname[IFNAMSIZ] = {0,};

@@ -164,7 +163,6 @@ unsigned int eppingtest=0;

module_param_string(ifname, ifname, sizeof(ifname), 0644);
module_param(wlaninitmode, int, 0644);
-module_param(bmienable, int, 0644);
module_param(bypasswmi, bool, 0644);
module_param(debuglevel, uint, 0644);
module_param(tspecCompliance, int, 0644);
@@ -1719,9 +1717,7 @@ ar6000_avail_ev(void *context, void *hif_handle)

BMIInit();

- if (bmienable) {
- ar6000_sysfs_bmi_init(ar);
- }
+ ar6000_sysfs_bmi_init(ar);

{
struct bmi_target_info targ_info;
@@ -1791,38 +1787,31 @@ ar6000_avail_ev(void *context, void *hif_handle)
/* when the module is unloaded. */
ar6000_devices[device_index] = dev;

- /* Don't install the init function if BMI is requested */
- if (!bmienable) {
- ar6000_netdev_ops.ndo_init = ar6000_init;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode));
- if ((wlaninitmode == WLAN_INIT_MODE_UDEV) ||
- (wlaninitmode == WLAN_INIT_MODE_DRV))
- {
- int status = 0;
- do {
- if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0)
- {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n"));
- break;
- }
+ AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode));
+ if ((wlaninitmode == WLAN_INIT_MODE_UDEV) ||
+ (wlaninitmode == WLAN_INIT_MODE_DRV)) {
+ int status = 0;
+ do {
+ if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0) {
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n"));
+ break;
+ }
#ifdef HTC_RAW_INTERFACE
- if (!eppingtest && bypasswmi) {
- break; /* Don't call ar6000_init for ART */
- }
+ if (!eppingtest && bypasswmi) {
+ break; /* Don't call ar6000_init for ART */
+ }
#endif
- rtnl_lock();
- status = (ar6000_init(dev)==0) ? 0 : A_ERROR;
- rtnl_unlock();
- if (status) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n"));
- }
- } while (false);
-
+ rtnl_lock();
+ status = (ar6000_init(dev)==0) ? 0 : A_ERROR;
+ rtnl_unlock();
if (status) {
- init_status = status;
- goto avail_ev_failed;
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n"));
}
+ } while (false);
+
+ if (status) {
+ init_status = status;
+ goto avail_ev_failed;
}
}

@@ -1843,11 +1832,8 @@ ar6000_avail_ev(void *context, void *hif_handle)
(unsigned long)ar));

avail_ev_failed :
- if (init_status) {
- if (bmienable) {
- ar6000_sysfs_bmi_deinit(ar);
- }
- }
+ if (init_status)
+ ar6000_sysfs_bmi_deinit(ar);

return init_status;
}
@@ -2120,9 +2106,7 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister)
/* cleanup any allocated AMSDU buffers */
ar6000_cleanup_amsdu_rxbufs(ar);

- if (bmienable) {
- ar6000_sysfs_bmi_deinit(ar);
- }
+ ar6000_sysfs_bmi_deinit(ar);

/* Cleanup BMI */
BMICleanup();
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
index 89fd80a..dc27860 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
@@ -227,12 +227,6 @@ typedef enum _AR6K_BIN_FILE {
#define SETUPBTDEV_DEFAULT 0
#endif /* SETUPBTDEV_ENABLED */

-#ifdef BMIENABLE_SET
-#define BMIENABLE_DEFAULT 1
-#else
-#define BMIENABLE_DEFAULT 0
-#endif /* BMIENABLE_SET */
-
#ifdef ENABLEUARTPRINT_SET
#define ENABLEUARTPRINT_DEFAULT 1
#else
diff --git a/drivers/staging/ath6kl/os/linux/ioctl.c b/drivers/staging/ath6kl/os/linux/ioctl.c
index 159a64c..f2acc68 100644
--- a/drivers/staging/ath6kl/os/linux/ioctl.c
+++ b/drivers/staging/ath6kl/os/linux/ioctl.c
@@ -33,7 +33,6 @@ u32 tcmdRxFreq;
extern unsigned int wmitimeout;
extern A_WAITQUEUE_HEAD arEvent;
extern int tspecCompliance;
-extern int bmienable;
extern int loghci;

static int
@@ -2105,16 +2104,9 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
#endif /* CONFIG_HOST_TCMD_SUPPORT */

case AR6000_XIOCTL_BMI_DONE:
- if(bmienable)
- {
- rtnl_lock(); /* ar6000_init expects to be called holding rtnl lock */
- ret = ar6000_init(dev);
- rtnl_unlock();
- }
- else
- {
- ret = BMIDone(hifDevice);
- }
+ rtnl_lock(); /* ar6000_init expects to be called holding rtnl lock */
+ ret = ar6000_init(dev);
+ rtnl_unlock();
break;

case AR6000_XIOCTL_BMI_READ_MEMORY:
--
1.7.0.4


2011-03-30 00:57:56

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 33/34] ath6kl: remove ar6000_prepare_target() crap

This was empty code, WTF^pi.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/include/common_drv.h | 4 ---
drivers/staging/ath6kl/miscdrv/common_drv.c | 34 --------------------------
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 8 ------
3 files changed, 0 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/ath6kl/include/common_drv.h b/drivers/staging/ath6kl/include/common_drv.h
index b606334..34db299 100644
--- a/drivers/staging/ath6kl/include/common_drv.h
+++ b/drivers/staging/ath6kl/include/common_drv.h
@@ -81,10 +81,6 @@ int ar6000_set_htc_params(struct hif_device *hifDevice,
u32 MboxIsrYieldValue,
u8 HtcControlBuffers);

-int ar6000_prepare_target(struct hif_device *hifDevice,
- u32 TargetType,
- u32 TargetVersion);
-
int ar6000_set_hci_bridge_flags(struct hif_device *hifDevice,
u32 TargetType,
u32 Flags);
diff --git a/drivers/staging/ath6kl/miscdrv/common_drv.c b/drivers/staging/ath6kl/miscdrv/common_drv.c
index a23a524..2be2ea4 100644
--- a/drivers/staging/ath6kl/miscdrv/common_drv.c
+++ b/drivers/staging/ath6kl/miscdrv/common_drv.c
@@ -683,40 +683,6 @@ int ar6000_set_htc_params(struct hif_device *hifDevice,
return status;
}

-
-static int prepare_ar6002(struct hif_device *hifDevice, u32 TargetVersion)
-{
- int status = 0;
-
- /* placeholder */
-
- return status;
-}
-
-static int prepare_ar6003(struct hif_device *hifDevice, u32 TargetVersion)
-{
- int status = 0;
-
- /* placeholder */
-
- return status;
-}
-
-/* this function assumes the caller has already initialized the BMI APIs */
-int ar6000_prepare_target(struct hif_device *hifDevice,
- u32 TargetType,
- u32 TargetVersion)
-{
- if (TargetType == TARGET_TYPE_AR6002) {
- /* do any preparations for AR6002 devices */
- return prepare_ar6002(hifDevice,TargetVersion);
- } else if (TargetType == TARGET_TYPE_AR6003) {
- return prepare_ar6003(hifDevice,TargetVersion);
- }
-
- return 0;
-}
-
#if defined(CONFIG_AR6002_REV1_FORCE_HOST)
/*
* Call this function just before the call to BMIInit
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index e3c1f58..666d5e6 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -1698,14 +1698,6 @@ ar6000_avail_ev(void *context, void *hif_handle)

ar->arVersion.target_ver = targ_info.target_ver;
ar->arTargetType = targ_info.target_type;
-
- /* do any target-specific preparation that can be done through BMI */
- r = ar6000_prepare_target(ar->arHifDevice,
- targ_info.target_type,
- targ_info.target_ver);
- if (r)
- goto avail_ev_failed;
-
}

r = ar6000_configure_target(ar);
--
1.7.0.4


2011-03-30 00:57:42

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 27/34] ath6kl: cleanup allocation and getting of the hif dev

Removes verbose debug messages and checks that are just
not needed, and renames the functions to something more
sensible. While we clean this up, just move the routines
above and remove the forward declarations.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
.../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 65 +++++++++-----------
1 files changed, 28 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
index 1752b33..c862a19 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
@@ -58,8 +58,6 @@ static int hifDeviceResume(struct device *dev);
#endif /* CONFIG_PM */
static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id);
static void hifDeviceRemoved(struct sdio_func *func);
-static struct hif_device *addHifDevice(struct sdio_func *func);
-static struct hif_device *getHifDevice(struct sdio_func *func);
static void delHifDevice(struct hif_device * device);
static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte);
static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsigned char *byte);
@@ -69,6 +67,26 @@ module_param(reset_sdio_on_unload, int, 0644);

extern u32 nohifscattersupport;

+static struct hif_device *ath6kl_alloc_hifdev(struct sdio_func *func)
+{
+ struct hif_device *hifdevice;
+
+ hifdevice = kzalloc(sizeof(struct hif_device), GFP_KERNEL);
+
+#if HIF_USE_DMA_BOUNCE_BUFFER
+ hifdevice->dma_buffer = kmalloc(HIF_DMA_BUFFER_SIZE, GFP_KERNEL);
+#endif
+ hifdevice->func = func;
+ hifdevice->powerConfig = HIF_DEVICE_POWER_UP;
+ sdio_set_drvdata(func, hifdevice);
+
+ return hifdevice;
+}
+
+static struct hif_device *ath6kl_get_hifdev(struct sdio_func *func)
+{
+ return (struct hif_device *) sdio_get_drvdata(func);
+}

/* ------ Static Variables ------ */
static const struct sdio_device_id ar6k_id_table[] = {
@@ -774,7 +792,7 @@ hifIRQHandler(struct sdio_func *func)
struct hif_device *device;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifIRQHandler\n"));

- device = getHifDevice(func);
+ device = ath6kl_get_hifdev(func);
atomic_set(&device->irqHandling, 1);
/* release the host during ints so we can pick it back up when we process cmds */
sdio_release_host(device->func);
@@ -829,8 +847,8 @@ static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id
("AR6000: hifDeviceInserted, Function: 0x%X, Vendor ID: 0x%X, Device ID: 0x%X, block size: 0x%X/0x%X\n",
func->num, func->vendor, func->device, func->max_blksize, func->cur_blksize));

- addHifDevice(func);
- device = getHifDevice(func);
+ ath6kl_alloc_hifdev(func);
+ device = ath6kl_get_hifdev(func);

device->id = id;
device->is_disabled = true;
@@ -951,7 +969,7 @@ static int hifDisableFunc(struct hif_device *device, struct sdio_func *func)
int status = 0;

AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDisableFunc\n"));
- device = getHifDevice(func);
+ device = ath6kl_get_hifdev(func);
if (!IS_ERR(device->async_task)) {
init_completion(&device->async_completion);
device->async_shutdown = 1;
@@ -1000,7 +1018,7 @@ static int hifEnableFunc(struct hif_device *device, struct sdio_func *func)
int ret = 0;

AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifEnableFunc\n"));
- device = getHifDevice(func);
+ device = ath6kl_get_hifdev(func);

if (device->is_disabled) {
/* enable the SDIO function */
@@ -1079,7 +1097,7 @@ static int hifDeviceSuspend(struct device *dev)
int status = 0;
struct hif_device *device;

- device = getHifDevice(func);
+ device = ath6kl_get_hifdev(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceSuspend\n"));
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
device->is_suspend = true; /* set true first for PowerStateChangeNotify(..) */
@@ -1107,7 +1125,7 @@ static int hifDeviceResume(struct device *dev)
int status = 0;
struct hif_device *device;

- device = getHifDevice(func);
+ device = ath6kl_get_hifdev(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceResume\n"));
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
status = osdrvCallbacks.deviceResumeHandler(device->claimedContext);
@@ -1128,7 +1146,7 @@ static void hifDeviceRemoved(struct sdio_func *func)
AR_DEBUG_ASSERT(func != NULL);

AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n"));
- device = getHifDevice(func);
+ device = ath6kl_get_hifdev(func);
if (device->claimedContext != NULL) {
status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device);
}
@@ -1178,33 +1196,6 @@ int hifWaitForPendingRecv(struct hif_device *device)
return 0;
}

-
-static struct hif_device *
-addHifDevice(struct sdio_func *func)
-{
- struct hif_device *hifdevice;
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: addHifDevice\n"));
- AR_DEBUG_ASSERT(func != NULL);
- hifdevice = kzalloc(sizeof(struct hif_device), GFP_KERNEL);
- AR_DEBUG_ASSERT(hifdevice != NULL);
-#if HIF_USE_DMA_BOUNCE_BUFFER
- hifdevice->dma_buffer = kmalloc(HIF_DMA_BUFFER_SIZE, GFP_KERNEL);
- AR_DEBUG_ASSERT(hifdevice->dma_buffer != NULL);
-#endif
- hifdevice->func = func;
- hifdevice->powerConfig = HIF_DEVICE_POWER_UP;
- sdio_set_drvdata(func, hifdevice);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: addHifDevice; 0x%p\n", hifdevice));
- return hifdevice;
-}
-
-static struct hif_device *
-getHifDevice(struct sdio_func *func)
-{
- AR_DEBUG_ASSERT(func != NULL);
- return (struct hif_device *)sdio_get_drvdata(func);
-}
-
static void
delHifDevice(struct hif_device * device)
{
--
1.7.0.4


2011-03-30 00:57:38

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 25/34] ath6kl: remove useless plat_setup_power() calls

These map to do nothing.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 3 ---
drivers/staging/ath6kl/os/linux/ar6000_pm.c | 6 ------
.../staging/ath6kl/os/linux/include/wlan_config.h | 6 ------
3 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 5f73182..056acae 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -2017,9 +2017,6 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister)
if (ar->arWlanPowerState != WLAN_POWER_STATE_CUT_PWR) {
/* only stop endpoint if we are not stop it in suspend_ev */
ar6000_stop_endpoint(dev, false, true);
- } else {
- /* clear up the platform power state before rmmod */
- plat_setup_power(1,0);
}

ar->arWlanState = WLAN_DISABLED;
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_pm.c b/drivers/staging/ath6kl/os/linux/ar6000_pm.c
index be401aa..eeb3807 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_pm.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_pm.c
@@ -304,13 +304,11 @@ int ar6000_power_change_ev(void *context, u32 config)

static int ar6000_pm_probe(struct platform_device *pdev)
{
- plat_setup_power(1,1);
return 0;
}

static int ar6000_pm_remove(struct platform_device *pdev)
{
- plat_setup_power(0,1);
return 0;
}

@@ -352,8 +350,6 @@ ar6000_setup_cut_power_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
break;
}

- plat_setup_power(1,0);
-
/* Change the state to ON */
ar->arWlanPowerState = WLAN_POWER_STATE_ON;

@@ -385,8 +381,6 @@ ar6000_setup_cut_power_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
&config,
sizeof(HIF_DEVICE_POWER_CHANGE_TYPE));

- plat_setup_power(0,0);
-
ar->arWlanPowerState = WLAN_POWER_STATE_CUT_PWR;
}
} while (0);
diff --git a/drivers/staging/ath6kl/os/linux/include/wlan_config.h b/drivers/staging/ath6kl/os/linux/include/wlan_config.h
index 98951bb..c1fe0c6 100644
--- a/drivers/staging/ath6kl/os/linux/include/wlan_config.h
+++ b/drivers/staging/ath6kl/os/linux/include/wlan_config.h
@@ -105,10 +105,4 @@
*/
#define WLAN_CONFIG_DISABLE_TX_BURSTING 0

-/*
- * Platform specific function to power ON/OFF AR6000
- * and enable/disable SDIO card detection
- */
-#define plat_setup_power(on, detect)
-
#endif /* _HOST_WLAN_CONFIG_H_ */
--
1.7.0.4


2011-03-30 00:56:52

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 07/34] ath6kl: remove Bluetooth PAL code and WMI ACL TX/RX data support

ath6kl used to have an internal PAL for Bluetooth 3.0 support
but this is no longer supported. The target used a WMI with an
ACL header for supporting these frames. Userspace would use
the ioctl AR6000_XIOCTL_ACL_DATA to send data to the target
and the firmware would generate ACL frames.

Remove both the parsing of the frames and the ioctl support.
We leave a warning for now for if the target generates some
sort of ACL data frame, later on we can remove this warning
once we have proven the target is no longer generating these
frames. It should be noted this also provides a fix for the
processing of spurious ACL data frames from the target,
previously they would not be dropped if they were generated
by the target but EXPORT_HCI_PAL_INTERFACE was not compiled
in.

Cc: Naveen Singh <[email protected]>
Cc: Prerepa (Dham) Viswanadham <[email protected]>
Cc: Shanmugamkamatchi Balashanmugam <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 1 -
drivers/staging/ath6kl/include/common/wmi.h | 2 +-
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 59 +--
drivers/staging/ath6kl/os/linux/ar6k_pal.c | 479 --------------------
.../staging/ath6kl/os/linux/include/ar6000_drv.h | 7 -
.../staging/ath6kl/os/linux/include/athdrv_linux.h | 2 +-
.../ath6kl/os/linux/include/wmi_filter_linux.h | 2 +-
drivers/staging/ath6kl/os/linux/ioctl.c | 68 ---
8 files changed, 22 insertions(+), 598 deletions(-)
delete mode 100644 drivers/staging/ath6kl/os/linux/ar6k_pal.c

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index 50c1db0..025027a 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -142,7 +142,6 @@ ath6kl-y += os/linux/netbuf.o
ath6kl-y += os/linux/wireless_ext.o
ath6kl-y += os/linux/ioctl.o
ath6kl-y += os/linux/hci_bridge.o
-ath6kl-y += os/linux/ar6k_pal.o
ath6kl-y += miscdrv/common_drv.o
ath6kl-y += miscdrv/credit_dist.o
ath6kl-y += wmi/wmi.o
diff --git a/drivers/staging/ath6kl/include/common/wmi.h b/drivers/staging/ath6kl/include/common/wmi.h
index c645af3..d3de3cc 100644
--- a/drivers/staging/ath6kl/include/common/wmi.h
+++ b/drivers/staging/ath6kl/include/common/wmi.h
@@ -118,7 +118,7 @@ typedef enum {
typedef enum {
WMI_DATA_HDR_DATA_TYPE_802_3 = 0,
WMI_DATA_HDR_DATA_TYPE_802_11,
- WMI_DATA_HDR_DATA_TYPE_ACL,
+ WMI_DATA_HDR_DATA_TYPE_ACL, /* used to be used for the PAL */
} WMI_DATA_HDR_DATA_TYPE;

#define WMI_DATA_HDR_DATA_TYPE_MASK 0x3
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 94b9132..3dfbb0d 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -147,7 +147,6 @@ unsigned int panic_on_assert = 1;
unsigned int nohifscattersupport = NOHIFSCATTERSUPPORT_DEFAULT;

unsigned int setuphci = SETUPHCI_DEFAULT;
-unsigned int setuphcipal = SETUPHCIPAL_DEFAULT;
unsigned int loghci = 0;
unsigned int setupbtdev = SETUPBTDEV_DEFAULT;
#ifndef EXPORT_HCI_BRIDGE_INTERFACE
@@ -190,7 +189,6 @@ module_param(irqprocmode, uint, 0644);
module_param(nohifscattersupport, uint, 0644);
module_param(panic_on_assert, uint, 0644);
module_param(setuphci, uint, 0644);
-module_param(setuphcipal, uint, 0644);
module_param(loghci, uint, 0644);
module_param(setupbtdev, uint, 0644);
#ifndef EXPORT_HCI_BRIDGE_INTERFACE
@@ -344,8 +342,6 @@ ar6000_sysfs_bmi_write(struct file *fp, struct kobject *kobj,
static int
ar6000_sysfs_bmi_init(struct ar6_softc *ar);

-/* HCI PAL callback function declarations */
-int ar6k_setup_hci_pal(struct ar6_softc *ar);
void ar6k_cleanup_hci_pal(struct ar6_softc *ar);

static void
@@ -2028,15 +2024,6 @@ ar6000_stop_endpoint(struct net_device *dev, bool keepprofile, bool getdbglogs)
if (setuphci)
ar6000_cleanup_hci(ar);
#endif
-#ifdef EXPORT_HCI_PAL_INTERFACE
- if (setuphcipal && (NULL != ar6kHciPalCallbacks_g.cleanupTransport)) {
- ar6kHciPalCallbacks_g.cleanupTransport(ar);
- }
-#else
- /* cleanup hci pal driver data structures */
- if(setuphcipal)
- ar6k_cleanup_hci_pal(ar);
-#endif
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Shutting down HTC .... \n"));
/* stop HTC */
HTCStop(ar->arHtcTarget);
@@ -2737,13 +2724,6 @@ int ar6000_init(struct net_device *dev)
status = ar6000_setup_hci(ar);
}
#endif
-#ifdef EXPORT_HCI_PAL_INTERFACE
- if (setuphcipal && (NULL != ar6kHciPalCallbacks_g.setupTransport))
- status = ar6kHciPalCallbacks_g.setupTransport(ar);
-#else
- if(setuphcipal)
- status = ar6k_setup_hci_pal(ar);
-#endif

} while (false);

@@ -3705,8 +3685,23 @@ ar6000_rx(void *Context, struct htc_packet *pPacket)
WMI_DATA_HDR *dhdr = (WMI_DATA_HDR *)A_NETBUF_DATA(skb);
bool is_amsdu;
u8 tid;
- bool is_acl_data_frame;
- is_acl_data_frame = WMI_DATA_HDR_GET_DATA_TYPE(dhdr) == WMI_DATA_HDR_DATA_TYPE_ACL;
+
+ /*
+ * This check can be removed if after a while we do not
+ * see the warning. For now we leave it to ensure
+ * we drop these frames accordingly in case the
+ * target generates them for some reason. These
+ * were used for an internal PAL but that's not
+ * used or supported anymore. These frames should
+ * not come up from the target.
+ */
+ if (WARN_ON(WMI_DATA_HDR_GET_DATA_TYPE(dhdr) ==
+ WMI_DATA_HDR_DATA_TYPE_ACL)) {
+ AR6000_STAT_INC(ar, rx_errors);
+ A_NETBUF_FREE(skb);
+ return;
+ }
+
#ifdef CONFIG_PM
ar6000_check_wow_status(ar, NULL, false);
#endif /* CONFIG_PM */
@@ -3728,7 +3723,7 @@ ar6000_rx(void *Context, struct htc_packet *pPacket)
* ACL data frames don't follow ethernet frame bounds for
* min length
*/
- if (ar->arNetworkType != AP_NETWORK && !is_acl_data_frame &&
+ if (ar->arNetworkType != AP_NETWORK &&
((pPacket->ActualLength < minHdrLen) ||
(pPacket->ActualLength > AR6000_MAX_RX_MESSAGE_SIZE)))
{
@@ -3863,7 +3858,7 @@ ar6000_rx(void *Context, struct htc_packet *pPacket)
/* NWF: print the 802.11 hdr bytes */
if(containsDot11Hdr) {
status = wmi_dot11_hdr_remove(ar->arWmi,skb);
- } else if(!is_amsdu && !is_acl_data_frame) {
+ } else if(!is_amsdu) {
status = wmi_dot3_2_dix(skb);
}

@@ -3873,16 +3868,6 @@ ar6000_rx(void *Context, struct htc_packet *pPacket)
goto rx_done;
}

- if (is_acl_data_frame) {
- A_NETBUF_PUSH(skb, sizeof(int));
- *((short *)A_NETBUF_DATA(skb)) = WMI_ACL_DATA_EVENTID;
- /* send the data packet to PAL driver */
- if(ar6k_pal_config_g.fpar6k_pal_recv_pkt) {
- if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(ar->hcipal_info, skb) == true)
- goto rx_done;
- }
- }
-
if ((ar->arNetDev->flags & IFF_UP) == IFF_UP) {
if (ar->arNetworkType == AP_NETWORK) {
struct sk_buff *skb1 = NULL;
@@ -4829,12 +4814,6 @@ ar6000_hci_event_rcv_evt(struct ar6_softc *ar, WMI_HCI_EVENT *cmd)
buf += sizeof(int);
memcpy(buf, cmd->buf, cmd->evt_buf_sz);

- if(ar6k_pal_config_g.fpar6k_pal_recv_pkt)
- {
- /* pass the cmd packet to PAL driver */
- if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(ar->hcipal_info, osbuf) == true)
- return;
- }
ar6000_deliver_frames_to_nw_stack(ar->arNetDev, osbuf);
if(loghci) {
A_PRINTF_LOG("HCI Event From PAL <-- \n");
diff --git a/drivers/staging/ath6kl/os/linux/ar6k_pal.c b/drivers/staging/ath6kl/os/linux/ar6k_pal.c
deleted file mode 100644
index 7e6279f..0000000
--- a/drivers/staging/ath6kl/os/linux/ar6k_pal.c
+++ /dev/null
@@ -1,479 +0,0 @@
-//------------------------------------------------------------------------------
-// Copyright (c) 2004-2010 Atheros Communications Inc.
-// All rights reserved.
-//
-//
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//
-// Author(s): ="Atheros"
-//------------------------------------------------------------------------------
-
-#include "ar6000_drv.h"
-#ifdef AR6K_ENABLE_HCI_PAL
-#include <net/bluetooth/bluetooth.h>
-#include <net/bluetooth/hci_core.h>
-#include <ar6k_pal.h>
-
-extern unsigned int setupbtdev;
-#define bt_check_bit(val, bit) (val & bit)
-#define bt_set_bit(val, bit) (val |= bit)
-#define bt_clear_bit(val, bit) (val &= ~bit)
-
-/* export ATH_AR6K_DEBUG_HCI_PAL=yes in host/localmake.linux.inc
- * to enable debug information */
-#ifdef HCIPAL_DEBUG
-#define PRIN_LOG(format, args...) printk(KERN_ALERT "%s:%d - %s Msg:" format "\n",__FUNCTION__, __LINE__, __FILE__, ## args)
-#else
-#define PRIN_LOG(format, args...)
-#endif
-
-/**********************************
- * HCI PAL private info structure
- *********************************/
-typedef struct ar6k_hci_pal_info_s{
-
- unsigned long ulFlags;
-#define HCI_NORMAL_MODE (1)
-#define HCI_REGISTERED (1<<1)
- struct hci_dev *hdev; /* BT Stack HCI dev */
- struct ar6_softc *ar;
-
-}ar6k_hci_pal_info_t;
-
-/*** BT Stack Entrypoints *******/
-/***************************************
- * bt_open - open a handle to the device
- ***************************************/
-static int bt_open(struct hci_dev *hdev)
-{
- PRIN_LOG("HCI PAL: bt_open - enter - x\n");
- set_bit(HCI_RUNNING, &hdev->flags);
- set_bit(HCI_UP, &hdev->flags);
- set_bit(HCI_INIT, &hdev->flags);
- return 0;
-}
-
-/***************************************
- * bt_close - close handle to the device
- ***************************************/
-static int bt_close(struct hci_dev *hdev)
-{
- PRIN_LOG("HCI PAL: bt_close - enter\n");
- clear_bit(HCI_RUNNING, &hdev->flags);
- return 0;
-}
-
-/*****************************
- * bt_ioctl - ioctl processing
- *****************************/
-static int bt_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
-{
- PRIN_LOG("HCI PAL: bt_ioctl - enter\n");
- return -ENOIOCTLCMD;
-}
-
-/**************************************
- * bt_flush - flush outstanding packets
- **************************************/
-static int bt_flush(struct hci_dev *hdev)
-{
- PRIN_LOG("HCI PAL: bt_flush - enter\n");
- return 0;
-}
-
-/***************
- * bt_destruct
- ***************/
-static void bt_destruct(struct hci_dev *hdev)
-{
- PRIN_LOG("HCI PAL: bt_destruct - enter\n");
- /* nothing to do here */
-}
-
-/****************************************************
- * Invoked from bluetooth stack via hdev->send()
- * to send the packet out via ar6k to PAL firmware.
- *
- * For HCI command packet wmi_send_hci_cmd() is invoked.
- * wmi_send_hci_cmd adds WMI_CMD_HDR and sends the packet
- * to PAL firmware.
- *
- * For HCI ACL data packet wmi_data_hdr_add is invoked
- * to add WMI_DATA_HDR to the packet. ar6000_acl_data_tx
- * is then invoked to send the packet to PAL firmware.
- ******************************************************/
-static int btpal_send_frame(struct sk_buff *skb)
-{
- struct hci_dev *hdev = (struct hci_dev *)skb->dev;
- HCI_TRANSPORT_PACKET_TYPE type;
- ar6k_hci_pal_info_t *pHciPalInfo;
- int status = 0;
- struct sk_buff *txSkb = NULL;
- struct ar6_softc *ar;
-
- if (!hdev) {
- PRIN_LOG("HCI PAL: btpal_send_frame - no device\n");
- return -ENODEV;
- }
-
- if (!test_bit(HCI_RUNNING, &hdev->flags)) {
- PRIN_LOG("HCI PAL: btpal_send_frame - not open\n");
- return -EBUSY;
- }
-
- pHciPalInfo = (ar6k_hci_pal_info_t *)hdev->driver_data;
- A_ASSERT(pHciPalInfo != NULL);
- ar = pHciPalInfo->ar;
-
- PRIN_LOG("+btpal_send_frame type: %d \n",bt_cb(skb)->pkt_type);
- type = HCI_COMMAND_TYPE;
-
- switch (bt_cb(skb)->pkt_type) {
- case HCI_COMMAND_PKT:
- type = HCI_COMMAND_TYPE;
- hdev->stat.cmd_tx++;
- break;
-
- case HCI_ACLDATA_PKT:
- type = HCI_ACL_TYPE;
- hdev->stat.acl_tx++;
- break;
-
- case HCI_SCODATA_PKT:
- /* we don't support SCO over the pal */
- kfree_skb(skb);
- return 0;
- default:
- A_ASSERT(false);
- kfree_skb(skb);
- return 0;
- }
-
- if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_HCI_DUMP)) {
- A_PRINTF(">>> Send HCI %s packet len: %d\n",
- (type == HCI_COMMAND_TYPE) ? "COMMAND" : "ACL",
- skb->len);
- if (type == HCI_COMMAND_TYPE) {
- PRIN_LOG(" HCI Command: OGF:0x%X OCF:0x%X \r\n",
- HCI_GET_OP_CODE(skb-data) >> 10, HCI_GET_OP_CODE(skb-data) & 0x3FF);
- }
- AR_DEBUG_PRINTBUF(skb->data,skb->len,"BT HCI SEND Packet Dump");
- }
-
- do {
- if(type == HCI_COMMAND_TYPE)
- {
- PRIN_LOG("HCI command");
-
- if (ar->arWmiReady == false)
- {
- PRIN_LOG("WMI not ready ");
- break;
- }
-
- if (wmi_send_hci_cmd(ar->arWmi, skb->data, skb->len) != 0)
- {
- PRIN_LOG("send hci cmd error");
- break;
- }
- }
- else if(type == HCI_ACL_TYPE)
- {
- void *osbuf;
-
- PRIN_LOG("ACL data");
- if (ar->arWmiReady == false)
- {
- PRIN_LOG("WMI not ready");
- break;
- }
-
- /* need to add WMI header so allocate a skb with more space */
- txSkb = bt_skb_alloc(TX_PACKET_RSV_OFFSET + WMI_MAX_TX_META_SZ +
- sizeof(WMI_DATA_HDR) + skb->len,
- GFP_ATOMIC);
-
- if (txSkb == NULL) {
- status = A_NO_MEMORY;
- PRIN_LOG("No memory");
- break;
- }
-
- bt_cb(txSkb)->pkt_type = bt_cb(skb)->pkt_type;
- txSkb->dev = (void *)pHciPalInfo->hdev;
- skb_reserve(txSkb, TX_PACKET_RSV_OFFSET + WMI_MAX_TX_META_SZ + sizeof(WMI_DATA_HDR));
- memcpy(txSkb->data, skb->data, skb->len);
- skb_put(txSkb,skb->len);
- /* Add WMI packet type */
- osbuf = (void *)txSkb;
-
- if (wmi_data_hdr_add(ar->arWmi, osbuf, DATA_MSGTYPE, 0, WMI_DATA_HDR_DATA_TYPE_ACL,0,NULL) != 0) {
- PRIN_LOG("XIOCTL_ACL_DATA - wmi_data_hdr_add failed\n");
- } else {
- /* Send data buffer over HTC */
- PRIN_LOG("acl data tx");
- ar6000_acl_data_tx(osbuf, ar->arNetDev);
- }
- txSkb = NULL;
- }
- } while (false);
-
- if (txSkb != NULL) {
- PRIN_LOG("Free skb");
- kfree_skb(txSkb);
- }
- kfree_skb(skb);
- return 0;
-}
-
-
-/***********************************************
- * Unregister HCI device and free HCI device info
- ***********************************************/
-static void bt_cleanup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo)
-{
- int err;
-
- if (bt_check_bit(pHciPalInfo->ulFlags, HCI_REGISTERED)) {
- bt_clear_bit(pHciPalInfo->ulFlags, HCI_REGISTERED);
- clear_bit(HCI_RUNNING, &pHciPalInfo->hdev->flags);
- clear_bit(HCI_UP, &pHciPalInfo->hdev->flags);
- clear_bit(HCI_INIT, &pHciPalInfo->hdev->flags);
- A_ASSERT(pHciPalInfo->hdev != NULL);
- /* unregister */
- PRIN_LOG("Unregister PAL device");
- if ((err = hci_unregister_dev(pHciPalInfo->hdev)) < 0) {
- PRIN_LOG("HCI PAL: failed to unregister with bluetooth %d\n",err);
- }
- }
-
- kfree(pHciPalInfo->hdev);
- pHciPalInfo->hdev = NULL;
-}
-
-/*********************************************************
- * Allocate HCI device and store in PAL private info structure.
- *********************************************************/
-static int bt_setup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo)
-{
- int status = 0;
- struct hci_dev *pHciDev = NULL;
-
- if (!setupbtdev) {
- return 0;
- }
-
- do {
- /* allocate a BT HCI struct for this device */
- pHciDev = hci_alloc_dev();
- if (NULL == pHciDev) {
- PRIN_LOG("HCI PAL driver - failed to allocate BT HCI struct \n");
- status = A_NO_MEMORY;
- break;
- }
-
- /* save the device, we'll register this later */
- pHciPalInfo->hdev = pHciDev;
- SET_HCI_BUS_TYPE(pHciDev, HCI_VIRTUAL, HCI_80211);
- pHciDev->driver_data = pHciPalInfo;
- pHciDev->open = bt_open;
- pHciDev->close = bt_close;
- pHciDev->send = btpal_send_frame;
- pHciDev->ioctl = bt_ioctl;
- pHciDev->flush = bt_flush;
- pHciDev->destruct = bt_destruct;
- pHciDev->owner = THIS_MODULE;
- /* driver is running in normal BT mode */
- PRIN_LOG("Normal mode enabled");
- bt_set_bit(pHciPalInfo->ulFlags, HCI_NORMAL_MODE);
-
- } while (false);
-
- if (status) {
- bt_cleanup_hci_pal(pHciPalInfo);
- }
- return status;
-}
-
-/**********************************************
- * Cleanup HCI device and free HCI PAL private info
- *********************************************/
-void ar6k_cleanup_hci_pal(void *ar_p)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar_p;
- ar6k_hci_pal_info_t *pHciPalInfo = (ar6k_hci_pal_info_t *)ar->hcipal_info;
-
- if (pHciPalInfo != NULL) {
- bt_cleanup_hci_pal(pHciPalInfo);
- kfree(pHciPalInfo);
- ar->hcipal_info = NULL;
- }
-}
-
-/****************************
- * Register HCI device
- ****************************/
-static bool ar6k_pal_transport_ready(void *pHciPal)
-{
- ar6k_hci_pal_info_t *pHciPalInfo = (ar6k_hci_pal_info_t *)pHciPal;
-
- PRIN_LOG("HCI device transport ready");
- if(pHciPalInfo == NULL)
- return false;
-
- if (hci_register_dev(pHciPalInfo->hdev) < 0) {
- PRIN_LOG("Can't register HCI device");
- hci_free_dev(pHciPalInfo->hdev);
- return false;
- }
- PRIN_LOG("HCI device registered");
- pHciPalInfo->ulFlags |= HCI_REGISTERED;
- return true;
-}
-
-/**************************************************
- * Called from ar6k driver when command or ACL data
- * packet is received. Pass the packet to bluetooth
- * stack via hci_recv_frame.
- **************************************************/
-bool ar6k_pal_recv_pkt(void *pHciPal, void *osbuf)
-{
- struct sk_buff *skb = (struct sk_buff *)osbuf;
- ar6k_hci_pal_info_t *pHciPalInfo;
- bool success = false;
- u8 btType = 0;
- pHciPalInfo = (ar6k_hci_pal_info_t *)pHciPal;
-
- do {
-
- /* if normal mode is not enabled pass on to the stack
- * by returning failure */
- if(!(pHciPalInfo->ulFlags & HCI_NORMAL_MODE))
- {
- PRIN_LOG("Normal mode not enabled");
- break;
- }
-
- if (!test_bit(HCI_RUNNING, &pHciPalInfo->hdev->flags)) {
- PRIN_LOG("HCI PAL: HCI - not running\n");
- break;
- }
-
- if(*((short *)A_NETBUF_DATA(skb)) == WMI_ACL_DATA_EVENTID)
- btType = HCI_ACLDATA_PKT;
- else
- btType = HCI_EVENT_PKT;
- /* pull 4 bytes which contains WMI packet type */
- A_NETBUF_PULL(skb, sizeof(int));
- bt_cb(skb)->pkt_type = btType;
- skb->dev = (void *)pHciPalInfo->hdev;
-
- /* pass the received event packet up the stack */
- if (hci_recv_frame(skb) != 0) {
- PRIN_LOG("HCI PAL: hci_recv_frame failed \n");
- break;
- } else {
- PRIN_LOG("HCI PAL: Indicated RCV of type:%d, Length:%d \n",HCI_EVENT_PKT, skb->len);
- }
- PRIN_LOG("hci recv success");
- success = true;
- }while(false);
- return success;
-}
-
-/**********************************************************
- * HCI PAL init function called from ar6k when it is loaded..
- * Allocates PAL private info, stores the same in ar6k private info.
- * Registers a HCI device.
- * Registers packet receive callback function with ar6k
- **********************************************************/
-int ar6k_setup_hci_pal(void *ar_p)
-{
- int status = 0;
- ar6k_hci_pal_info_t *pHciPalInfo;
- ar6k_pal_config_t ar6k_pal_config;
- struct ar6_softc *ar = (struct ar6_softc *)ar_p;
-
- do {
-
- pHciPalInfo = (ar6k_hci_pal_info_t *)A_MALLOC(sizeof(ar6k_hci_pal_info_t));
-
- if (NULL == pHciPalInfo) {
- status = A_NO_MEMORY;
- break;
- }
-
- A_MEMZERO(pHciPalInfo, sizeof(ar6k_hci_pal_info_t));
- ar->hcipal_info = pHciPalInfo;
- pHciPalInfo->ar = ar;
-
- status = bt_setup_hci_pal(pHciPalInfo);
- if (status) {
- break;
- }
-
- if(bt_check_bit(pHciPalInfo->ulFlags, HCI_NORMAL_MODE))
- PRIN_LOG("HCI PAL: running in normal mode... \n");
- else
- PRIN_LOG("HCI PAL: running in test mode... \n");
-
- ar6k_pal_config.fpar6k_pal_recv_pkt = ar6k_pal_recv_pkt;
- register_pal_cb(&ar6k_pal_config);
- ar6k_pal_transport_ready(ar->hcipal_info);
- } while (false);
-
- if (status) {
- ar6k_cleanup_hci_pal(ar);
- }
- return status;
-}
-#else /* AR6K_ENABLE_HCI_PAL */
-int ar6k_setup_hci_pal(void *ar_p)
-{
- return 0;
-}
-void ar6k_cleanup_hci_pal(void *ar_p)
-{
-}
-#endif /* AR6K_ENABLE_HCI_PAL */
-
-#ifdef EXPORT_HCI_PAL_INTERFACE
-/*****************************************************
- * Register init and callback function with ar6k
- * when PAL driver is a separate kernel module.
- ****************************************************/
-int ar6k_register_hci_pal(struct hci_transport_callbacks *hciTransCallbacks);
-static int __init pal_init_module(void)
-{
- struct hci_transport_callbacks hciTransCallbacks;
-
- hciTransCallbacks.setupTransport = ar6k_setup_hci_pal;
- hciTransCallbacks.cleanupTransport = ar6k_cleanup_hci_pal;
-
- if(ar6k_register_hci_pal(&hciTransCallbacks) != 0)
- return -ENODEV;
-
- return 0;
-}
-
-static void __exit pal_cleanup_module(void)
-{
-}
-
-module_init(pal_init_module);
-module_exit(pal_cleanup_module);
-MODULE_LICENSE("Dual BSD/GPL");
-#endif
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
index dc27860..781e18f 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
@@ -215,12 +215,6 @@ typedef enum _AR6K_BIN_FILE {
#define SETUPHCI_DEFAULT 0
#endif /* SETUPHCI_ENABLED */

-#ifdef SETUPHCIPAL_ENABLED
-#define SETUPHCIPAL_DEFAULT 1
-#else
-#define SETUPHCIPAL_DEFAULT 0
-#endif /* SETUPHCIPAL_ENABLED */
-
#ifdef SETUPBTDEV_ENABLED
#define SETUPBTDEV_DEFAULT 1
#else
@@ -571,7 +565,6 @@ struct ar6_softc {
#ifndef EXPORT_HCI_BRIDGE_INTERFACE
void *hcidev_info;
#endif
- void *hcipal_info;
WMI_AP_MODE_STAT arAPStats;
u8 ap_hidden_ssid;
u8 ap_country_code[3];
diff --git a/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h b/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
index 66817c2..065b09b 100644
--- a/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
+++ b/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
@@ -942,7 +942,7 @@ typedef enum {

#define AR6000_XIOCTL_HCI_CMD 132

-#define AR6000_XIOCTL_ACL_DATA 133
+#define AR6000_XIOCTL_ACL_DATA 133 /* used to be used for PAL */

#define AR6000_XIOCTL_WLAN_CONN_PRECEDENCE 134

diff --git a/drivers/staging/ath6kl/os/linux/include/wmi_filter_linux.h b/drivers/staging/ath6kl/os/linux/include/wmi_filter_linux.h
index d172625..1eb6f82 100644
--- a/drivers/staging/ath6kl/os/linux/include/wmi_filter_linux.h
+++ b/drivers/staging/ath6kl/os/linux/include/wmi_filter_linux.h
@@ -266,7 +266,7 @@ u8 xioctl_filter[] = {
(0xFF), /* AR6000_XIOCTL_DELE_AGGR 130 */
(0xFF), /* AR6000_XIOCTL_FETCH_TARGET_REGS 131 */
(0xFF), /* AR6000_XIOCTL_HCI_CMD 132 */
-(0xFF), /* AR6000_XIOCTL_ACL_DATA 133 */
+(0xFF), /* AR6000_XIOCTL_ACL_DATA(used to be used for PAL) 133 */
(0xFF), /* AR6000_XIOCTL_WLAN_CONN_PRECEDENCE 134 */
(AP_NETWORK), /* AR6000_XIOCTL_AP_SET_11BG_RATESET 135 */
(0xFF),
diff --git a/drivers/staging/ath6kl/os/linux/ioctl.c b/drivers/staging/ath6kl/os/linux/ioctl.c
index f2acc68..711f43a 100644
--- a/drivers/staging/ath6kl/os/linux/ioctl.c
+++ b/drivers/staging/ath6kl/os/linux/ioctl.c
@@ -1488,57 +1488,6 @@ prof_count_rx(u32 addr, u32 count)
}
#endif /* CONFIG_TARGET_PROFILE_SUPPORT */

-
-static int
-ar6000_create_acl_data_osbuf(struct net_device *dev, u8 *userdata, void **p_osbuf)
-{
- void *osbuf = NULL;
- u8 tmp_space[8];
- HCI_ACL_DATA_PKT *acl;
- u8 hdr_size, *datap=NULL;
- int ret = 0;
-
- /* ACL is in data path. There is a need to create pool
- * mechanism for allocating and freeing NETBUFs - ToDo later.
- */
-
- *p_osbuf = NULL;
- acl = (HCI_ACL_DATA_PKT *)tmp_space;
- hdr_size = sizeof(acl->hdl_and_flags) + sizeof(acl->data_len);
-
- do {
- if (a_copy_from_user(acl, userdata, hdr_size)) {
- ret = A_EFAULT;
- break;
- }
-
- osbuf = A_NETBUF_ALLOC(hdr_size + acl->data_len);
- if (osbuf == NULL) {
- ret = A_NO_MEMORY;
- break;
- }
- A_NETBUF_PUT(osbuf, hdr_size + acl->data_len);
- datap = (u8 *)A_NETBUF_DATA(osbuf);
-
- /* Real copy to osbuf */
- acl = (HCI_ACL_DATA_PKT *)(datap);
- memcpy(acl, tmp_space, hdr_size);
- if (a_copy_from_user(acl->data, userdata + hdr_size, acl->data_len)) {
- ret = A_EFAULT;
- break;
- }
- } while(false);
-
- if (ret == 0) {
- *p_osbuf = osbuf;
- } else {
- A_NETBUF_FREE(osbuf);
- }
- return ret;
-}
-
-
-
int
ar6000_ioctl_ap_setparam(struct ar6_softc *ar, int param, int value)
{
@@ -4411,23 +4360,6 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
break;
}
#endif
- case AR6000_XIOCTL_ACL_DATA:
- {
- void *osbuf = NULL;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (ar6000_create_acl_data_osbuf(dev, (u8 *)userdata, &osbuf) != 0) {
- ret = -EIO;
- } else {
- if (wmi_data_hdr_add(ar->arWmi, osbuf, DATA_MSGTYPE, 0, WMI_DATA_HDR_DATA_TYPE_ACL,0,NULL) != 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("XIOCTL_ACL_DATA - wmi_data_hdr_add failed\n"));
- } else {
- /* Send data buffer over HTC */
- ar6000_acl_data_tx(osbuf, ar->arNetDev);
- }
- }
- break;
- }
case AR6000_XIOCTL_HCI_CMD:
{
char tmp_buf[512];
--
1.7.0.4


2011-03-30 00:57:36

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 24/34] ath6kl: propagate errors on module setup

This propagates initial platform registration failures and
also HIF initialization failures.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
.../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 32 ++++++++-----------
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 12 ++++---
drivers/staging/ath6kl/os/linux/ar6000_pm.c | 26 +++++++++-------
.../ath6kl/os/linux/include/ar6xapi_linux.h | 2 +-
4 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
index e6d9cd8..001f993 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
@@ -125,31 +125,27 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(hif,
/* ------ Functions ------ */
int HIFInit(OSDRV_CALLBACKS *callbacks)
{
- int status;
- AR_DEBUG_ASSERT(callbacks != NULL);
+ int r;
+ AR_DEBUG_ASSERT(callbacks != NULL);
+
+ A_REGISTER_MODULE_DEBUG_INFO(hif);

- A_REGISTER_MODULE_DEBUG_INFO(hif);
+ /* store the callback handlers */
+ osdrvCallbacks = *callbacks;

- /* store the callback handlers */
- osdrvCallbacks = *callbacks;
+ /* Register with bus driver core */
+ registered = 1;

- /* Register with bus driver core */
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: HIFInit registering\n"));
- registered = 1;
#if defined(CONFIG_PM)
- if (callbacks->deviceSuspendHandler && callbacks->deviceResumeHandler) {
- ar6k_driver.drv.pm = &ar6k_device_pm_ops;
- }
+ if (callbacks->deviceSuspendHandler && callbacks->deviceResumeHandler)
+ ar6k_driver.drv.pm = &ar6k_device_pm_ops;
#endif /* CONFIG_PM */
- status = sdio_register_driver(&ar6k_driver);
- AR_DEBUG_ASSERT(status==0);

- if (status != 0) {
- return A_ERROR;
- }
-
- return 0;
+ r = sdio_register_driver(&ar6k_driver);
+ if (r < 0)
+ return r;

+ return 0;
}

static int
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index f08f165..5f73182 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -603,7 +603,7 @@ static int __init
ar6000_init_module(void)
{
static int probed = 0;
- int status;
+ int r;
OSDRV_CALLBACKS osdrvCallbacks;

a_module_debug_support_init();
@@ -636,7 +636,9 @@ ar6000_init_module(void)
osdrvCallbacks.devicePowerChangeHandler = ar6000_power_change_ev;
#endif

- ar6000_pm_init();
+ r = ar6000_pm_init();
+ if (r)
+ return r;

#ifdef DEBUG
/* Set the debug flags if specified at load time */
@@ -655,9 +657,9 @@ ar6000_init_module(void)
memset(&aptcTR, 0, sizeof(APTC_TRAFFIC_RECORD));
#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */

- status = HIFInit(&osdrvCallbacks);
- if (status)
- return -ENODEV;
+ r = HIFInit(&osdrvCallbacks);
+ if (r)
+ return r;

return 0;
}
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_pm.c b/drivers/staging/ath6kl/os/linux/ar6000_pm.c
index 1004f24..be401aa 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_pm.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_pm.c
@@ -660,24 +660,28 @@ ar6000_set_wlan_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
return status;
}

-void ar6000_pm_init()
+int ar6000_pm_init()
{
- A_REGISTER_MODULE_DEBUG_INFO(pm);
+ int r;
+ A_REGISTER_MODULE_DEBUG_INFO(pm);
+
#ifdef CONFIG_PM
- /*
- * Register ar6000_pm_device into system.
- * We should also add platform_device into the first item of array
- * of devices[] in file arch/xxx/mach-xxx/board-xxxx.c
- */
- if (platform_driver_register(&ar6000_pm_device)) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000: fail to register the power control driver.\n"));
- }
+ /*
+ * Register ar6000_pm_device into system.
+ * We should also add platform_device into the first item of array
+ * of devices[] in file arch/xxx/mach-xxx/board-xxxx.c
+ */
+ r = platform_driver_register(&ar6000_pm_device);
+ if (r < 0)
+ return -ENODEV;
#endif /* CONFIG_PM */
+
+ return 0;
}

void ar6000_pm_exit()
{
#ifdef CONFIG_PM
- platform_driver_unregister(&ar6000_pm_device);
+ platform_driver_unregister(&ar6000_pm_device);
#endif /* CONFIG_PM */
}
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h b/drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h
index dd6905c..a8e8e36 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h
@@ -178,7 +178,7 @@ int ar6000_power_change_ev(void *context, u32 config);
void ar6000_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isEvent);
#endif

-void ar6000_pm_init(void);
+int ar6000_pm_init(void);
void ar6000_pm_exit(void);

#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
--
1.7.0.4


2011-03-30 00:57:13

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 15/34] ath6kl: remove define HTC_EP_STAT_PROFILING

This is always set so just keep the code it idefs around.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 1 -
drivers/staging/ath6kl/htc2/htc.c | 6 ------
drivers/staging/ath6kl/htc2/htc_internal.h | 8 --------
drivers/staging/ath6kl/htc2/htc_recv.c | 6 ------
drivers/staging/ath6kl/htc2/htc_send.c | 5 -----
5 files changed, 0 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index 50f9be3..d79f862 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -110,7 +110,6 @@ ifeq ($(CONFIG_ATH6KL_SKIP_ABI_VERSION_CHECK),y)
ccflags-y += -DATH6KL_SKIP_ABI_VERSION_CHECK
endif

-ccflags-y += -DHTC_EP_STAT_PROFILING
ccflags-y += -DWAPI_ENABLE
ccflags-y += -DCHECKSUM_OFFLOAD
ccflags-y += -DWLAN_HEADERS
diff --git a/drivers/staging/ath6kl/htc2/htc.c b/drivers/staging/ath6kl/htc2/htc.c
index f308655..ae54e64 100644
--- a/drivers/staging/ath6kl/htc2/htc.c
+++ b/drivers/staging/ath6kl/htc2/htc.c
@@ -448,9 +448,7 @@ static void ResetEndpointStates(struct htc_target *target)
pEndpoint->ServiceID = 0;
pEndpoint->MaxMsgLength = 0;
pEndpoint->MaxTxQueueDepth = 0;
-#ifdef HTC_EP_STAT_PROFILING
A_MEMZERO(&pEndpoint->EndPointStats,sizeof(pEndpoint->EndPointStats));
-#endif
INIT_HTC_PACKET_QUEUE(&pEndpoint->RxBuffers);
INIT_HTC_PACKET_QUEUE(&pEndpoint->TxQueue);
INIT_HTC_PACKET_QUEUE(&pEndpoint->RecvIndicationQueue);
@@ -527,7 +525,6 @@ bool HTCGetEndpointStatistics(HTC_HANDLE HTCHandle,
struct htc_endpoint_stats *pStats)
{

-#ifdef HTC_EP_STAT_PROFILING
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
bool clearStats = false;
bool sample = false;
@@ -568,9 +565,6 @@ bool HTCGetEndpointStatistics(HTC_HANDLE HTCHandle,
UNLOCK_HTC_TX(target);

return true;
-#else
- return false;
-#endif
}

struct ar6k_device *HTCGetAR6KDevice(void *HTCHandle)
diff --git a/drivers/staging/ath6kl/htc2/htc_internal.h b/drivers/staging/ath6kl/htc2/htc_internal.h
index 9425ed9..1c9aeca 100644
--- a/drivers/staging/ath6kl/htc2/htc_internal.h
+++ b/drivers/staging/ath6kl/htc2/htc_internal.h
@@ -27,7 +27,6 @@
* processing errors, the last frame header is dump for comparison */
//#define HTC_CAPTURE_LAST_FRAME

-//#define HTC_EP_STAT_PROFILING

#ifdef __cplusplus
extern "C" {
@@ -82,17 +81,10 @@ struct htc_endpoint {
struct htc_target *target; /* back pointer to target */
u8 SeqNo; /* TX seq no (helpful) for debugging */
u32 LocalConnectionFlags; /* local connection flags */
-#ifdef HTC_EP_STAT_PROFILING
struct htc_endpoint_stats EndPointStats; /* endpoint statistics */
-#endif
};

-#ifdef HTC_EP_STAT_PROFILING
#define INC_HTC_EP_STAT(p,stat,count) (p)->EndPointStats.stat += (count);
-#else
-#define INC_HTC_EP_STAT(p,stat,count)
-#endif
-
#define HTC_SERVICE_TX_PACKET_TAG HTC_TX_PACKET_TAG_INTERNAL

#define NUM_CONTROL_BUFFERS 8
diff --git a/drivers/staging/ath6kl/htc2/htc_recv.c b/drivers/staging/ath6kl/htc2/htc_recv.c
index c208801..974cc8c 100644
--- a/drivers/staging/ath6kl/htc2/htc_recv.c
+++ b/drivers/staging/ath6kl/htc2/htc_recv.c
@@ -36,7 +36,6 @@
(pP)->PktInfo.AsRx.ExpectedHdr, \
(pP)->Endpoint))

-#ifdef HTC_EP_STAT_PROFILING
#define HTC_RX_STAT_PROFILE(t,ep,numLookAheads) \
{ \
INC_HTC_EP_STAT((ep), RxReceived, 1); \
@@ -46,9 +45,6 @@
INC_HTC_EP_STAT((ep), RxBundleLookAheads, 1); \
} \
}
-#else
-#define HTC_RX_STAT_PROFILE(t,ep,lookAhead)
-#endif

static void DoRecvCompletion(struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pQueueToIndicate)
@@ -931,12 +927,10 @@ static void HTCAsyncRecvScatterCompletion(struct hif_scatter_req *pScatterReq)
}

if (!status) {
-#ifdef HTC_EP_STAT_PROFILING
LOCK_HTC_RX(target);
HTC_RX_STAT_PROFILE(target,pEndpoint,numLookAheads);
INC_HTC_EP_STAT(pEndpoint, RxPacketsBundled, 1);
UNLOCK_HTC_RX(target);
-#endif
if (i == (pScatterReq->ValidScatterEntries - 1)) {
/* last packet's more packets flag is set based on the lookahead */
SET_MORE_RX_PACKET_INDICATION_FLAG(lookAheads,numLookAheads,pEndpoint,pPacket);
diff --git a/drivers/staging/ath6kl/htc2/htc_send.c b/drivers/staging/ath6kl/htc2/htc_send.c
index 6f4050a..9310d4d 100644
--- a/drivers/staging/ath6kl/htc2/htc_send.c
+++ b/drivers/staging/ath6kl/htc2/htc_send.c
@@ -776,9 +776,6 @@ void HTCProcessCreditRpt(struct htc_target *target, HTC_CREDIT_REPORT *pRpt, int
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Endpoint %d got %d credits \n",
pRpt->EndpointID, pRpt->Credits));

-
-#ifdef HTC_EP_STAT_PROFILING
-
INC_HTC_EP_STAT(pEndpoint, TxCreditRpts, 1);
INC_HTC_EP_STAT(pEndpoint, TxCreditsReturned, pRpt->Credits);

@@ -797,8 +794,6 @@ void HTCProcessCreditRpt(struct htc_target *target, HTC_CREDIT_REPORT *pRpt, int
INC_HTC_EP_STAT(pEndpoint, TxCreditRptsFromOther, 1);
}

-#endif
-
if (ENDPOINT_0 == pRpt->EndpointID) {
/* always give endpoint 0 credits back */
pEndpoint->CreditDist.TxCredits += pRpt->Credits;
--
1.7.0.4


2011-03-30 00:57:10

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 14/34] ath6kl: remove unused define NO_SYNC_FLUSH

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index d7441e7..50f9be3 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -110,7 +110,6 @@ ifeq ($(CONFIG_ATH6KL_SKIP_ABI_VERSION_CHECK),y)
ccflags-y += -DATH6KL_SKIP_ABI_VERSION_CHECK
endif

-ccflags-y += -DNO_SYNC_FLUSH
ccflags-y += -DHTC_EP_STAT_PROFILING
ccflags-y += -DWAPI_ENABLE
ccflags-y += -DCHECKSUM_OFFLOAD
--
1.7.0.4


2011-03-30 00:57:00

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 09/34] ath6kl: remove all the wext and super extended private ioctl crap

This removes all the wext and super extended ioctl crap.
The wext interfaces are already provided by cfg80211 and
the "private" ioctl stuff defined here is not even using
private wext, they are using netdev private ioctls!
This is completely unacceptable upstream. Die. Die Die.

As part of all this we end up removing the
CONFIG_HOST_GPIO_SUPPORT which ended up being heavily
abused by the internal ioctl work.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Kconfig | 6 -
drivers/staging/ath6kl/Makefile | 8 +-
drivers/staging/ath6kl/include/a_drv_api.h | 18 -
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 173 +-
.../staging/ath6kl/os/linux/include/ar6000_drv.h | 30 -
.../staging/ath6kl/os/linux/include/config_linux.h | 7 -
drivers/staging/ath6kl/os/linux/ioctl.c | 4691 --------------------
drivers/staging/ath6kl/os/linux/wireless_ext.c | 2690 -----------
drivers/staging/ath6kl/wmi/wmi.c | 187 +-
9 files changed, 25 insertions(+), 7785 deletions(-)
delete mode 100644 drivers/staging/ath6kl/os/linux/ioctl.c
delete mode 100644 drivers/staging/ath6kl/os/linux/wireless_ext.c

diff --git a/drivers/staging/ath6kl/Kconfig b/drivers/staging/ath6kl/Kconfig
index 8a5caa3..1f15e1f 100644
--- a/drivers/staging/ath6kl/Kconfig
+++ b/drivers/staging/ath6kl/Kconfig
@@ -100,12 +100,6 @@ config AR600x_BT_RESET_PIN
help
WLAN GPIO to be used for resetting BT

-config ATH6KL_CFG80211
- bool "CFG80211 support"
- depends on ATH6K_LEGACY && CFG80211
- help
- Enables support for CFG80211 APIs. The default option is to use WEXT. Even with this option enabled, WEXT is not explicitly disabled and the onus of not exercising WEXT lies on the application(s) running in the user space.
-
config ATH6KL_HTC_RAW_INTERFACE
bool "RAW HTC support"
depends on ATH6K_LEGACY
diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index 025027a..be49800 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -85,11 +85,6 @@ ifeq ($(CONFIG_ATH6KL_CONFIG_GPIO_BT_RESET),y)
ccflags-y += -DATH6KL_CONFIG_GPIO_BT_RESET
endif

-ifeq ($(CONFIG_ATH6KL_CFG80211),y)
-ccflags-y += -DATH6K_CONFIG_CFG80211
-ath6kl-y += os/linux/cfg80211.o
-endif
-
ifeq ($(CONFIG_ATH6KL_HTC_RAW_INTERFACE),y)
ccflags-y += -DHTC_RAW_INTERFACE
endif
@@ -135,12 +130,11 @@ ath6kl-y += htc2/htc_recv.o
ath6kl-y += htc2/htc_services.o
ath6kl-y += htc2/htc.o
ath6kl-y += bmi/src/bmi.o
+ath6kl-y += os/linux/cfg80211.o
ath6kl-y += os/linux/ar6000_drv.o
ath6kl-y += os/linux/ar6000_raw_if.o
ath6kl-y += os/linux/ar6000_pm.o
ath6kl-y += os/linux/netbuf.o
-ath6kl-y += os/linux/wireless_ext.o
-ath6kl-y += os/linux/ioctl.o
ath6kl-y += os/linux/hci_bridge.o
ath6kl-y += miscdrv/common_drv.o
ath6kl-y += miscdrv/credit_dist.o
diff --git a/drivers/staging/ath6kl/include/a_drv_api.h b/drivers/staging/ath6kl/include/a_drv_api.h
index 5e098cb..9814de5 100644
--- a/drivers/staging/ath6kl/include/a_drv_api.h
+++ b/drivers/staging/ath6kl/include/a_drv_api.h
@@ -130,19 +130,6 @@ extern "C" {
#define A_WMI_PEER_EVENT(devt, eventCode, bssid) \
ar6000_peer_event ((devt), (eventCode), (bssid))

-#ifdef CONFIG_HOST_GPIO_SUPPORT
-
-#define A_WMI_GPIO_INTR_RX(intr_mask, input_values) \
- ar6000_gpio_intr_rx((intr_mask), (input_values))
-
-#define A_WMI_GPIO_DATA_RX(reg_id, value) \
- ar6000_gpio_data_rx((reg_id), (value))
-
-#define A_WMI_GPIO_ACK_RX() \
- ar6000_gpio_ack_rx()
-
-#endif
-
#ifdef SEND_EVENT_TO_APP

#define A_WMI_SEND_EVENT_TO_APP(ar, eventId, datap, len) \
@@ -158,11 +145,6 @@ extern "C" {

#endif

-#ifdef CONFIG_HOST_TCMD_SUPPORT
-#define A_WMI_TCMD_RX_REPORT_EVENT(devt, results, len) \
- ar6000_tcmd_rx_report_event((devt), (results), (len))
-#endif
-
#define A_WMI_HBCHALLENGERESP_EVENT(devt, cookie, source) \
ar6000_hbChallengeResp_event((devt), (cookie), (source))

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index c938537..3b3eec1 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -27,9 +27,7 @@
*/

#include "ar6000_drv.h"
-#ifdef ATH6K_CONFIG_CFG80211
#include "cfg80211.h"
-#endif /* ATH6K_CONFIG_CFG80211 */
#include "htc.h"
#include "wmi_filter_linux.h"
#include "epping_test.h"
@@ -284,7 +282,6 @@ void ar6000_destroy(struct net_device *dev, unsigned int unregister);
static void ar6000_detect_error(unsigned long ptr);
static void ar6000_set_multicast_list(struct net_device *dev);
static struct net_device_stats *ar6000_get_stats(struct net_device *dev);
-static struct iw_statistics *ar6000_get_iwstats(struct net_device * dev);

static void disconnect_timer_handler(unsigned long ptr);

@@ -348,7 +345,6 @@ ar6000_sysfs_bmi_get_config(struct ar6_softc *ar, u32 mode);

struct net_device *ar6000_devices[MAX_AR6000];
static int is_netdev_registered;
-extern struct iw_handler_def ath_iw_handler_def;
DECLARE_WAIT_QUEUE_HEAD(arEvent);
static void ar6000_cookie_init(struct ar6_softc *ar);
static void ar6000_cookie_cleanup(struct ar6_softc *ar);
@@ -375,7 +371,6 @@ static struct net_device_ops ar6000_netdev_ops = {
.ndo_open = ar6000_open,
.ndo_stop = ar6000_close,
.ndo_get_stats = ar6000_get_stats,
- .ndo_do_ioctl = ar6000_ioctl,
.ndo_start_xmit = ar6000_data_tx,
.ndo_set_multicast_list = ar6000_set_multicast_list,
};
@@ -669,10 +664,6 @@ ar6000_init_module(void)
memset(&aptcTR, 0, sizeof(APTC_TRAFFIC_RECORD));
#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */

-#ifdef CONFIG_HOST_GPIO_SUPPORT
- ar6000_gpio_init();
-#endif /* CONFIG_HOST_GPIO_SUPPORT */
-
status = HIFInit(&osdrvCallbacks);
if (status)
return -ENODEV;
@@ -1533,9 +1524,6 @@ init_netdev(struct net_device *dev, char *name)
{
dev->netdev_ops = &ar6000_netdev_ops;
dev->watchdog_timeo = AR6000_TX_TIMEOUT;
- dev->wireless_handlers = &ath_iw_handler_def;
-
- ath_iw_handler_def.get_wireless_stats = ar6000_get_iwstats; /*Displayed via proc fs */

/*
* We need the OS to provide us with more headroom in order to
@@ -1620,9 +1608,7 @@ ar6000_avail_ev(void *context, void *hif_handle)
struct ar6_softc *ar;
int device_index = 0;
struct htc_init_info htcInfo;
-#ifdef ATH6K_CONFIG_CFG80211
struct wireless_dev *wdev;
-#endif /* ATH6K_CONFIG_CFG80211 */
int r = 0;
struct hif_device_os_device_info osDevInfo;

@@ -1650,23 +1636,12 @@ ar6000_avail_ev(void *context, void *hif_handle)
/* we use another local "i" variable below. */
device_index = i;

-#ifdef ATH6K_CONFIG_CFG80211
wdev = ar6k_cfg80211_init(osDevInfo.pOSDevice);
if (IS_ERR(wdev)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: ar6k_cfg80211_init failed\n", __func__));
return A_ERROR;
}
ar_netif = wdev_priv(wdev);
-#else
- dev = alloc_etherdev(sizeof(struct ar6_softc));
- if (dev == NULL) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_available: can't alloc etherdev\n"));
- return A_ERROR;
- }
- ether_setup(dev);
- ar_netif = ar6k_priv(dev);
- SET_NETDEV_DEV(dev, osDevInfo.pOSDevice);
-#endif /* ATH6K_CONFIG_CFG80211 */

if (ar_netif == NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Can't allocate ar6k priv memory\n", __func__));
@@ -1676,7 +1651,6 @@ ar6000_avail_ev(void *context, void *hif_handle)
A_MEMZERO(ar_netif, sizeof(struct ar6_softc));
ar = (struct ar6_softc *)ar_netif;

-#ifdef ATH6K_CONFIG_CFG80211
ar->wdev = wdev;
wdev->iftype = NL80211_IFTYPE_STATION;

@@ -1692,7 +1666,6 @@ ar6000_avail_ev(void *context, void *hif_handle)
wdev->netdev = dev;
ar->arNetworkType = INFRA_NETWORK;
ar->smeState = SME_DISCONNECTED;
-#endif /* ATH6K_CONFIG_CFG80211 */

init_netdev(dev, ifname);

@@ -2117,9 +2090,7 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister)
}
free_netdev(dev);

-#ifdef ATH6K_CONFIG_CFG80211
ar6k_cfg80211_deinit(ar);
-#endif /* ATH6K_CONFIG_CFG80211 */

#ifdef CONFIG_AP_VIRTUL_ADAPTER_SUPPORT
ar6000_remove_ap_interface();
@@ -2267,11 +2238,9 @@ ar6000_open(struct net_device *dev)

spin_lock_irqsave(&ar->arLock, flags);

-#ifdef ATH6K_CONFIG_CFG80211
if(ar->arWlanState == WLAN_DISABLED) {
ar->arWlanState = WLAN_ENABLED;
}
-#endif /* ATH6K_CONFIG_CFG80211 */

if( ar->arConnected || bypasswmi) {
netif_carrier_on(dev);
@@ -2288,12 +2257,9 @@ ar6000_open(struct net_device *dev)
static int
ar6000_close(struct net_device *dev)
{
-#ifdef ATH6K_CONFIG_CFG80211
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-#endif /* ATH6K_CONFIG_CFG80211 */
netif_stop_queue(dev);

-#ifdef ATH6K_CONFIG_CFG80211
ar6000_disconnect(ar);

if(ar->arWmiReady == true) {
@@ -2304,7 +2270,6 @@ ar6000_close(struct net_device *dev)
ar->arWlanState = WLAN_DISABLED;
}
ar6k_cfg80211_scanComplete_event(ar, A_ECANCELED);
-#endif /* ATH6K_CONFIG_CFG80211 */

return 0;
}
@@ -4116,93 +4081,6 @@ ar6000_get_stats(struct net_device *dev)
return &ar->arNetStats;
}

-static struct iw_statistics *
-ar6000_get_iwstats(struct net_device * dev)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- TARGET_STATS *pStats = &ar->arTargetStats;
- struct iw_statistics * pIwStats = &ar->arIwStats;
- int rtnllocked;
-
- if (ar->bIsDestroyProgress || ar->arWmiReady == false || ar->arWlanState == WLAN_DISABLED)
- {
- pIwStats->status = 0;
- pIwStats->qual.qual = 0;
- pIwStats->qual.level =0;
- pIwStats->qual.noise = 0;
- pIwStats->discard.code =0;
- pIwStats->discard.retries=0;
- pIwStats->miss.beacon =0;
- return pIwStats;
- }
-
- /*
- * The in_atomic function is used to determine if the scheduling is
- * allowed in the current context or not. This was introduced in 2.6
- * From what I have read on the differences between 2.4 and 2.6, the
- * 2.4 kernel did not support preemption and so this check might not
- * be required for 2.4 kernels.
- */
- if (in_atomic())
- {
- wmi_get_stats_cmd(ar->arWmi);
-
- pIwStats->status = 1 ;
- pIwStats->qual.qual = pStats->cs_aveBeacon_rssi - 161;
- pIwStats->qual.level =pStats->cs_aveBeacon_rssi; /* noise is -95 dBm */
- pIwStats->qual.noise = pStats->noise_floor_calibation;
- pIwStats->discard.code = pStats->rx_decrypt_err;
- pIwStats->discard.retries = pStats->tx_retry_cnt;
- pIwStats->miss.beacon = pStats->cs_bmiss_cnt;
- return pIwStats;
- }
-
- dev_hold(dev);
- rtnllocked = rtnl_is_locked();
- if (rtnllocked) {
- rtnl_unlock();
- }
- pIwStats->status = 0;
-
- if (down_interruptible(&ar->arSem)) {
- goto err_exit;
- }
-
- do {
-
- if (ar->bIsDestroyProgress || ar->arWlanState == WLAN_DISABLED) {
- break;
- }
-
- ar->statsUpdatePending = true;
-
- if(wmi_get_stats_cmd(ar->arWmi) != 0) {
- break;
- }
-
- wait_event_interruptible_timeout(arEvent, ar->statsUpdatePending == false, wmitimeout * HZ);
- if (signal_pending(current)) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000 : WMI get stats timeout \n"));
- break;
- }
- pIwStats->status = 1 ;
- pIwStats->qual.qual = pStats->cs_aveBeacon_rssi - 161;
- pIwStats->qual.level =pStats->cs_aveBeacon_rssi; /* noise is -95 dBm */
- pIwStats->qual.noise = pStats->noise_floor_calibation;
- pIwStats->discard.code = pStats->rx_decrypt_err;
- pIwStats->discard.retries = pStats->tx_retry_cnt;
- pIwStats->miss.beacon = pStats->cs_bmiss_cnt;
- } while (0);
- up(&ar->arSem);
-
-err_exit:
- if (rtnllocked) {
- rtnl_lock();
- }
- dev_put(dev);
- return pIwStats;
-}
-
void
ar6000_ready_event(void *devt, u8 *datap, u8 phyCap, u32 sw_ver, u32 abi_ver)
{
@@ -4224,6 +4102,29 @@ ar6000_ready_event(void *devt, u8 *datap, u8 phyCap, u32 sw_ver, u32 abi_ver)
wake_up(&arEvent);
}

+void ar6000_install_static_wep_keys(struct ar6_softc *ar)
+{
+ u8 index;
+ u8 keyUsage;
+
+ for (index = WMI_MIN_KEY_INDEX; index <= WMI_MAX_KEY_INDEX; index++) {
+ if (ar->arWepKeyList[index].arKeyLen) {
+ keyUsage = GROUP_USAGE;
+ if (index == ar->arDefTxKeyIndex) {
+ keyUsage |= TX_USAGE;
+ }
+ wmi_addKey_cmd(ar->arWmi,
+ index,
+ WEP_CRYPT,
+ keyUsage,
+ ar->arWepKeyList[index].arKeyLen,
+ NULL,
+ ar->arWepKeyList[index].arKey, KEY_OP_INIT_VAL, NULL,
+ NO_SYNC_WMIFLAG);
+ }
+ }
+}
+
void
add_new_sta(struct ar6_softc *ar, u8 *mac, u16 aid, u8 *wpaie,
u8 ielen, u8 keymgmt, u8 ucipher, u8 auth)
@@ -4362,13 +4263,11 @@ skip_key:
return;
}

-#ifdef ATH6K_CONFIG_CFG80211
ar6k_cfg80211_connect_event(ar, channel, bssid,
listenInterval, beaconInterval,
networkType, beaconIeLen,
assocReqLen, assocRespLen,
assocInfo);
-#endif /* ATH6K_CONFIG_CFG80211 */

memcpy(ar->arBssid, bssid, sizeof(ar->arBssid));
ar->arBssChannel = channel;
@@ -4482,26 +4381,6 @@ skip_key:

netif_wake_queue(ar->arNetDev);

- /* For CFG80211 the key configuration and the default key comes in after connect so no point in plumbing invalid keys */
-#ifndef ATH6K_CONFIG_CFG80211
- if ((networkType & ADHOC_NETWORK) &&
- (OPEN_AUTH == ar->arDot11AuthMode) &&
- (NONE_AUTH == ar->arAuthMode) &&
- (WEP_CRYPT == ar->arPairwiseCrypto))
- {
- if (!ar->arConnected) {
- wmi_addKey_cmd(ar->arWmi,
- ar->arDefTxKeyIndex,
- WEP_CRYPT,
- GROUP_USAGE | TX_USAGE,
- ar->arWepKeyList[ar->arDefTxKeyIndex].arKeyLen,
- NULL,
- ar->arWepKeyList[ar->arDefTxKeyIndex].arKey, KEY_OP_INIT_VAL, NULL,
- NO_SYNC_WMIFLAG);
- }
- }
-#endif /* ATH6K_CONFIG_CFG80211 */
-
/* Update connect & link status atomically */
spin_lock_irqsave(&ar->arLock, flags);
ar->arConnected = true;
@@ -4631,11 +4510,9 @@ ar6000_disconnect_event(struct ar6_softc *ar, u8 reason, u8 *bssid,
return;
}

-#ifdef ATH6K_CONFIG_CFG80211
ar6k_cfg80211_disconnect_event(ar, reason, bssid,
assocRespLen, assocInfo,
protocolReasonStatus);
-#endif /* ATH6K_CONFIG_CFG80211 */

/* Send disconnect event to supplicant */
A_MEMZERO(&wrqu, sizeof(wrqu));
@@ -4882,9 +4759,7 @@ ar6000_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast)
tag, s->mac[0],s->mac[1],s->mac[2],s->mac[3],s->mac[4],s->mac[5]);
} else {

-#ifdef ATH6K_CONFIG_CFG80211
ar6k_cfg80211_tkip_micerr_event(ar, keyid, ismcast);
-#endif /* ATH6K_CONFIG_CFG80211 */

A_PRINTF("AR6000 TKIP MIC error received for keyid %d %scast\n",
keyid & 0x3, ismcast ? "multi": "uni");
@@ -4901,9 +4776,7 @@ void
ar6000_scanComplete_event(struct ar6_softc *ar, int status)
{

-#ifdef ATH6K_CONFIG_CFG80211
ar6k_cfg80211_scanComplete_event(ar, status);
-#endif /* ATH6K_CONFIG_CFG80211 */

if (!ar->arUserBssFilter) {
wmi_bssfilter_cmd(ar->arWmi, NONE_BSS_FILTER, 0);
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
index 781e18f..5b053ab 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
@@ -33,9 +33,7 @@
#include <linux/if_arp.h>
#include <linux/ip.h>
#include <linux/wireless.h>
-#ifdef ATH6K_CONFIG_CFG80211
#include <net/cfg80211.h>
-#endif /* ATH6K_CONFIG_CFG80211 */
#include <linux/module.h>
#include <asm/io.h>

@@ -373,7 +371,6 @@ struct ar_wep_key {
u8 arKey[64];
} ;

-#ifdef ATH6K_CONFIG_CFG80211
struct ar_key {
u8 key[WLAN_MAX_KEY_LEN];
u8 key_len;
@@ -387,8 +384,6 @@ enum {
SME_CONNECTING,
SME_CONNECTED
};
-#endif /* ATH6K_CONFIG_CFG80211 */
-

struct ar_node_mapping {
u8 macAddress[6];
@@ -584,12 +579,10 @@ struct ar6_softc {
WMI_BTCOEX_STATS_EVENT arBtcoexStats;
s32 (*exitCallback)(void *config); /* generic callback at AR6K exit */
struct hif_device_os_device_info osDevInfo;
-#ifdef ATH6K_CONFIG_CFG80211
struct wireless_dev *wdev;
struct cfg80211_scan_request *scan_request;
struct ar_key keys[WMI_MAX_KEY_INDEX + 1];
u32 smeState;
-#endif /* ATH6K_CONFIG_CFG80211 */
u16 arWlanPowerState;
bool arWlanOff;
#ifdef CONFIG_PM
@@ -619,30 +612,10 @@ struct ar_virtual_interface {
};
#endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */

-#ifdef ATH6K_CONFIG_CFG80211
static inline void *ar6k_priv(struct net_device *dev)
{
return (wdev_priv(dev->ieee80211_ptr));
}
-#else
-#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
-static inline void *ar6k_priv(struct net_device *dev)
-{
- extern struct net_device *arApNetDev;
-
- if (arApNetDev == dev) {
- /* return arDev saved in virtual interface context */
- struct ar_virtual_interface *arVirDev;
- arVirDev = netdev_priv(dev);
- return arVirDev->arDev;
- } else {
- return netdev_priv(dev);
- }
-}
-#else
-#define ar6k_priv netdev_priv
-#endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
-#endif /* ATH6K_CONFIG_CFG80211 */

#define SET_HCI_BUS_TYPE(pHciDev, __bus, __type) do { \
(pHciDev)->bus = (__bus); \
@@ -688,9 +661,6 @@ struct ar_giwscan_param {
spin_unlock_bh(lock); \
} while (0)

-int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
-int ar6000_ioctl_dispatcher(struct net_device *dev, struct ifreq *rq, int cmd);
-void ar6000_gpio_init(void);
void ar6000_init_profile_info(struct ar6_softc *ar);
void ar6000_install_static_wep_keys(struct ar6_softc *ar);
int ar6000_init(struct net_device *dev);
diff --git a/drivers/staging/ath6kl/os/linux/include/config_linux.h b/drivers/staging/ath6kl/os/linux/include/config_linux.h
index 50f53d3..d4030e2 100644
--- a/drivers/staging/ath6kl/os/linux/include/config_linux.h
+++ b/drivers/staging/ath6kl/os/linux/include/config_linux.h
@@ -31,13 +31,6 @@ extern "C" {
#include <linux/version.h>

/*
- * Host-side GPIO support is optional.
- * If run-time access to GPIO pins is not required, then
- * this should be changed to #undef.
- */
-#define CONFIG_HOST_GPIO_SUPPORT
-
-/*
* Host side Test Command support
*/
#define CONFIG_HOST_TCMD_SUPPORT
diff --git a/drivers/staging/ath6kl/os/linux/ioctl.c b/drivers/staging/ath6kl/os/linux/ioctl.c
deleted file mode 100644
index 711f43a..0000000
--- a/drivers/staging/ath6kl/os/linux/ioctl.c
+++ /dev/null
@@ -1,4691 +0,0 @@
-//------------------------------------------------------------------------------
-// Copyright (c) 2004-2010 Atheros Communications Inc.
-// All rights reserved.
-//
-//
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//
-// Author(s): ="Atheros"
-//------------------------------------------------------------------------------
-
-#include "ar6000_drv.h"
-#include "ieee80211_ioctl.h"
-#include "ar6kap_common.h"
-#include "targaddrs.h"
-#include "a_hci.h"
-#include "wlan_config.h"
-
-extern int enablerssicompensation;
-u32 tcmdRxFreq;
-extern unsigned int wmitimeout;
-extern A_WAITQUEUE_HEAD arEvent;
-extern int tspecCompliance;
-extern int loghci;
-
-static int
-ar6000_ioctl_get_roam_tbl(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if(wmi_get_roam_tbl_cmd(ar->arWmi) != 0) {
- return -EIO;
- }
-
- return 0;
-}
-
-static int
-ar6000_ioctl_get_roam_data(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
-
- /* currently assume only roam times are required */
- if(wmi_get_roam_data_cmd(ar->arWmi, ROAM_DATA_TIME) != 0) {
- return -EIO;
- }
-
-
- return 0;
-}
-
-static int
-ar6000_ioctl_set_roam_ctrl(struct net_device *dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_ROAM_CTRL_CMD cmd;
- u8 size = sizeof(cmd);
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
-
- if (copy_from_user(&cmd, userdata, size)) {
- return -EFAULT;
- }
-
- if (cmd.roamCtrlType == WMI_SET_HOST_BIAS) {
- if (cmd.info.bssBiasInfo.numBss > 1) {
- size += (cmd.info.bssBiasInfo.numBss - 1) * sizeof(WMI_BSS_BIAS);
- }
- }
-
- if (copy_from_user(&cmd, userdata, size)) {
- return -EFAULT;
- }
-
- if(wmi_set_roam_ctrl_cmd(ar->arWmi, &cmd, size) != 0) {
- return -EIO;
- }
-
- return 0;
-}
-
-static int
-ar6000_ioctl_set_powersave_timers(struct net_device *dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_POWERSAVE_TIMERS_POLICY_CMD cmd;
- u8 size = sizeof(cmd);
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, size)) {
- return -EFAULT;
- }
-
- if (copy_from_user(&cmd, userdata, size)) {
- return -EFAULT;
- }
-
- if(wmi_set_powersave_timers_cmd(ar->arWmi, &cmd, size) != 0) {
- return -EIO;
- }
-
- return 0;
-}
-
-static int
-ar6000_ioctl_set_qos_supp(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_QOS_SUPP_CMD cmd;
- int ret;
-
- if ((dev->flags & IFF_UP) != IFF_UP) {
- return -EIO;
- }
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1),
- sizeof(cmd)))
- {
- return -EFAULT;
- }
-
- ret = wmi_set_qos_supp_cmd(ar->arWmi, cmd.status);
-
- switch (ret) {
- case 0:
- return 0;
- case A_EBUSY :
- return -EBUSY;
- case A_NO_MEMORY:
- return -ENOMEM;
- case A_EINVAL:
- default:
- return -EFAULT;
- }
-}
-
-static int
-ar6000_ioctl_set_wmm(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_WMM_CMD cmd;
- int ret;
-
- if ((dev->flags & IFF_UP) != IFF_UP) {
- return -EIO;
- }
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1),
- sizeof(cmd)))
- {
- return -EFAULT;
- }
-
- if (cmd.status == WMI_WMM_ENABLED) {
- ar->arWmmEnabled = true;
- } else {
- ar->arWmmEnabled = false;
- }
-
- ret = wmi_set_wmm_cmd(ar->arWmi, cmd.status);
-
- switch (ret) {
- case 0:
- return 0;
- case A_EBUSY :
- return -EBUSY;
- case A_NO_MEMORY:
- return -ENOMEM;
- case A_EINVAL:
- default:
- return -EFAULT;
- }
-}
-
-static int
-ar6000_ioctl_set_txop(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_WMM_TXOP_CMD cmd;
- int ret;
-
- if ((dev->flags & IFF_UP) != IFF_UP) {
- return -EIO;
- }
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1),
- sizeof(cmd)))
- {
- return -EFAULT;
- }
-
- ret = wmi_set_wmm_txop(ar->arWmi, cmd.txopEnable);
-
- switch (ret) {
- case 0:
- return 0;
- case A_EBUSY :
- return -EBUSY;
- case A_NO_MEMORY:
- return -ENOMEM;
- case A_EINVAL:
- default:
- return -EFAULT;
- }
-}
-
-static int
-ar6000_ioctl_get_rd(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- int ret = 0;
-
- if ((dev->flags & IFF_UP) != IFF_UP || ar->arWmiReady == false) {
- return -EIO;
- }
-
- if(copy_to_user((char *)((unsigned int*)rq->ifr_data + 1),
- &ar->arRegCode, sizeof(ar->arRegCode)))
- ret = -EFAULT;
-
- return ret;
-}
-
-static int
-ar6000_ioctl_set_country(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_AP_SET_COUNTRY_CMD cmd;
- int ret;
-
- if ((dev->flags & IFF_UP) != IFF_UP) {
- return -EIO;
- }
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1),
- sizeof(cmd)))
- {
- return -EFAULT;
- }
-
- ar->ap_profile_flag = 1; /* There is a change in profile */
-
- ret = wmi_set_country(ar->arWmi, cmd.countryCode);
- memcpy(ar->ap_country_code, cmd.countryCode, 3);
-
- switch (ret) {
- case 0:
- return 0;
- case A_EBUSY :
- return -EBUSY;
- case A_NO_MEMORY:
- return -ENOMEM;
- case A_EINVAL:
- default:
- return -EFAULT;
- }
-}
-
-
-/* Get power mode command */
-static int
-ar6000_ioctl_get_power_mode(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_POWER_MODE_CMD power_mode;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- power_mode.powerMode = wmi_get_power_mode_cmd(ar->arWmi);
- if (copy_to_user(rq->ifr_data, &power_mode, sizeof(WMI_POWER_MODE_CMD))) {
- ret = -EFAULT;
- }
-
- return ret;
-}
-
-
-static int
-ar6000_ioctl_set_channelParams(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_CHANNEL_PARAMS_CMD cmd, *cmdp;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if( (ar->arNextMode == AP_NETWORK) && (cmd.numChannels || cmd.scanParam) ) {
- A_PRINTF("ERROR: Only wmode is allowed in AP mode\n");
- return -EIO;
- }
-
- if (cmd.numChannels > 1) {
- cmdp = A_MALLOC(130);
- if (copy_from_user(cmdp, rq->ifr_data,
- sizeof (*cmdp) +
- ((cmd.numChannels - 1) * sizeof(u16))))
- {
- kfree(cmdp);
- return -EFAULT;
- }
- } else {
- cmdp = &cmd;
- }
-
- if ((ar->arPhyCapability == WMI_11G_CAPABILITY) &&
- ((cmdp->phyMode == WMI_11A_MODE) || (cmdp->phyMode == WMI_11AG_MODE)))
- {
- ret = -EINVAL;
- }
-
- if (!ret &&
- (wmi_set_channelParams_cmd(ar->arWmi, cmdp->scanParam, cmdp->phyMode,
- cmdp->numChannels, cmdp->channelList)
- != 0))
- {
- ret = -EIO;
- }
-
- if (cmd.numChannels > 1) {
- kfree(cmdp);
- }
-
- ar->ap_wmode = cmdp->phyMode;
- /* Set the profile change flag to allow a commit cmd */
- ar->ap_profile_flag = 1;
-
- return ret;
-}
-
-
-static int
-ar6000_ioctl_set_snr_threshold(struct net_device *dev, struct ifreq *rq)
-{
-
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SNR_THRESHOLD_PARAMS_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if( wmi_set_snr_threshold_params(ar->arWmi, &cmd) != 0 ) {
- ret = -EIO;
- }
-
- return ret;
-}
-
-static int
-ar6000_ioctl_set_rssi_threshold(struct net_device *dev, struct ifreq *rq)
-{
-#define SWAP_THOLD(thold1, thold2) do { \
- USER_RSSI_THOLD tmpThold; \
- tmpThold.tag = thold1.tag; \
- tmpThold.rssi = thold1.rssi; \
- thold1.tag = thold2.tag; \
- thold1.rssi = thold2.rssi; \
- thold2.tag = tmpThold.tag; \
- thold2.rssi = tmpThold.rssi; \
-} while (0)
-
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_RSSI_THRESHOLD_PARAMS_CMD cmd;
- USER_RSSI_PARAMS rssiParams;
- s32 i, j;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user((char *)&rssiParams, (char *)((unsigned int *)rq->ifr_data + 1), sizeof(USER_RSSI_PARAMS))) {
- return -EFAULT;
- }
- cmd.weight = rssiParams.weight;
- cmd.pollTime = rssiParams.pollTime;
-
- memcpy(ar->rssi_map, &rssiParams.tholds, sizeof(ar->rssi_map));
- /*
- * only 6 elements, so use bubble sorting, in ascending order
- */
- for (i = 5; i > 0; i--) {
- for (j = 0; j < i; j++) { /* above tholds */
- if (ar->rssi_map[j+1].rssi < ar->rssi_map[j].rssi) {
- SWAP_THOLD(ar->rssi_map[j+1], ar->rssi_map[j]);
- } else if (ar->rssi_map[j+1].rssi == ar->rssi_map[j].rssi) {
- return -EFAULT;
- }
- }
- }
- for (i = 11; i > 6; i--) {
- for (j = 6; j < i; j++) { /* below tholds */
- if (ar->rssi_map[j+1].rssi < ar->rssi_map[j].rssi) {
- SWAP_THOLD(ar->rssi_map[j+1], ar->rssi_map[j]);
- } else if (ar->rssi_map[j+1].rssi == ar->rssi_map[j].rssi) {
- return -EFAULT;
- }
- }
- }
-
-#ifdef DEBUG
- for (i = 0; i < 12; i++) {
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("thold[%d].tag: %d, thold[%d].rssi: %d \n",
- i, ar->rssi_map[i].tag, i, ar->rssi_map[i].rssi));
- }
-#endif
-
- if (enablerssicompensation) {
- for (i = 0; i < 6; i++)
- ar->rssi_map[i].rssi = rssi_compensation_reverse_calc(ar, ar->rssi_map[i].rssi, true);
- for (i = 6; i < 12; i++)
- ar->rssi_map[i].rssi = rssi_compensation_reverse_calc(ar, ar->rssi_map[i].rssi, false);
- }
-
- cmd.thresholdAbove1_Val = ar->rssi_map[0].rssi;
- cmd.thresholdAbove2_Val = ar->rssi_map[1].rssi;
- cmd.thresholdAbove3_Val = ar->rssi_map[2].rssi;
- cmd.thresholdAbove4_Val = ar->rssi_map[3].rssi;
- cmd.thresholdAbove5_Val = ar->rssi_map[4].rssi;
- cmd.thresholdAbove6_Val = ar->rssi_map[5].rssi;
- cmd.thresholdBelow1_Val = ar->rssi_map[6].rssi;
- cmd.thresholdBelow2_Val = ar->rssi_map[7].rssi;
- cmd.thresholdBelow3_Val = ar->rssi_map[8].rssi;
- cmd.thresholdBelow4_Val = ar->rssi_map[9].rssi;
- cmd.thresholdBelow5_Val = ar->rssi_map[10].rssi;
- cmd.thresholdBelow6_Val = ar->rssi_map[11].rssi;
-
- if( wmi_set_rssi_threshold_params(ar->arWmi, &cmd) != 0 ) {
- ret = -EIO;
- }
-
- return ret;
-}
-
-static int
-ar6000_ioctl_set_lq_threshold(struct net_device *dev, struct ifreq *rq)
-{
-
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_LQ_THRESHOLD_PARAMS_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, (char *)((unsigned int *)rq->ifr_data + 1), sizeof(cmd))) {
- return -EFAULT;
- }
-
- if( wmi_set_lq_threshold_params(ar->arWmi, &cmd) != 0 ) {
- ret = -EIO;
- }
-
- return ret;
-}
-
-
-static int
-ar6000_ioctl_set_probedSsid(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_PROBED_SSID_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_probedSsid_cmd(ar->arWmi, cmd.entryIndex, cmd.flag, cmd.ssidLength,
- cmd.ssid) != 0)
- {
- ret = -EIO;
- }
-
- return ret;
-}
-
-static int
-ar6000_ioctl_set_badAp(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_ADD_BAD_AP_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (cmd.badApIndex > WMI_MAX_BAD_AP_INDEX) {
- return -EIO;
- }
-
- if (memcmp(cmd.bssid, null_mac, AR6000_ETH_ADDR_LEN) == 0) {
- /*
- * This is a delete badAP.
- */
- if (wmi_deleteBadAp_cmd(ar->arWmi, cmd.badApIndex) != 0) {
- ret = -EIO;
- }
- } else {
- if (wmi_addBadAp_cmd(ar->arWmi, cmd.badApIndex, cmd.bssid) != 0) {
- ret = -EIO;
- }
- }
-
- return ret;
-}
-
-static int
-ar6000_ioctl_create_qos(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_CREATE_PSTREAM_CMD cmd;
- int ret;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- ret = wmi_verify_tspec_params(&cmd, tspecCompliance);
- if (ret == 0)
- ret = wmi_create_pstream_cmd(ar->arWmi, &cmd);
-
- switch (ret) {
- case 0:
- return 0;
- case A_EBUSY :
- return -EBUSY;
- case A_NO_MEMORY:
- return -ENOMEM;
- case A_EINVAL:
- default:
- return -EFAULT;
- }
-}
-
-static int
-ar6000_ioctl_delete_qos(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_DELETE_PSTREAM_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- ret = wmi_delete_pstream_cmd(ar->arWmi, cmd.trafficClass, cmd.tsid);
-
- switch (ret) {
- case 0:
- return 0;
- case A_EBUSY :
- return -EBUSY;
- case A_NO_MEMORY:
- return -ENOMEM;
- case A_EINVAL:
- default:
- return -EFAULT;
- }
-}
-
-static int
-ar6000_ioctl_get_qos_queue(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- struct ar6000_queuereq qreq;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if( copy_from_user(&qreq, rq->ifr_data,
- sizeof(struct ar6000_queuereq)))
- return -EFAULT;
-
- qreq.activeTsids = wmi_get_mapped_qos_queue(ar->arWmi, qreq.trafficClass);
-
- if (copy_to_user(rq->ifr_data, &qreq,
- sizeof(struct ar6000_queuereq)))
- {
- ret = -EFAULT;
- }
-
- return ret;
-}
-
-#ifdef CONFIG_HOST_TCMD_SUPPORT
-static int
-ar6000_ioctl_tcmd_get_rx_report(struct net_device *dev,
- struct ifreq *rq, u8 *data, u32 len)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- u32 buf[4+TCMD_MAX_RATES];
- int ret = 0;
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- return -EBUSY;
- }
-
- ar->tcmdRxReport = 0;
- if (wmi_test_cmd(ar->arWmi, data, len) != 0) {
- up(&ar->arSem);
- return -EIO;
- }
-
- wait_event_interruptible_timeout(arEvent, ar->tcmdRxReport != 0, wmitimeout * HZ);
-
- if (signal_pending(current)) {
- ret = -EINTR;
- }
-
- buf[0] = ar->tcmdRxTotalPkt;
- buf[1] = ar->tcmdRxRssi;
- buf[2] = ar->tcmdRxcrcErrPkt;
- buf[3] = ar->tcmdRxsecErrPkt;
- memcpy(((u8 *)buf)+(4*sizeof(u32)), ar->tcmdRateCnt, sizeof(ar->tcmdRateCnt));
- memcpy(((u8 *)buf)+(4*sizeof(u32))+(TCMD_MAX_RATES *sizeof(u16)), ar->tcmdRateCntShortGuard, sizeof(ar->tcmdRateCntShortGuard));
-
- if (!ret && copy_to_user(rq->ifr_data, buf, sizeof(buf))) {
- ret = -EFAULT;
- }
-
- up(&ar->arSem);
-
- return ret;
-}
-
-void
-ar6000_tcmd_rx_report_event(void *devt, u8 *results, int len)
-{
- struct ar6_softc *ar = (struct ar6_softc *)devt;
- TCMD_CONT_RX * rx_rep = (TCMD_CONT_RX *)results;
-
- if (enablerssicompensation) {
- rx_rep->u.report.rssiInDBm = rssi_compensation_calc_tcmd(tcmdRxFreq, rx_rep->u.report.rssiInDBm,rx_rep->u.report.totalPkt);
- }
-
-
- ar->tcmdRxTotalPkt = rx_rep->u.report.totalPkt;
- ar->tcmdRxRssi = rx_rep->u.report.rssiInDBm;
- ar->tcmdRxcrcErrPkt = rx_rep->u.report.crcErrPkt;
- ar->tcmdRxsecErrPkt = rx_rep->u.report.secErrPkt;
- ar->tcmdRxReport = 1;
- A_MEMZERO(ar->tcmdRateCnt, sizeof(ar->tcmdRateCnt));
- A_MEMZERO(ar->tcmdRateCntShortGuard, sizeof(ar->tcmdRateCntShortGuard));
- memcpy(ar->tcmdRateCnt, rx_rep->u.report.rateCnt, sizeof(ar->tcmdRateCnt));
- memcpy(ar->tcmdRateCntShortGuard, rx_rep->u.report.rateCntShortGuard, sizeof(ar->tcmdRateCntShortGuard));
-
- wake_up(&arEvent);
-}
-#endif /* CONFIG_HOST_TCMD_SUPPORT*/
-
-static int
-ar6000_ioctl_set_error_report_bitmask(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_TARGET_ERROR_REPORT_BITMASK cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- ret = wmi_set_error_report_bitmask(ar->arWmi, cmd.bitmask);
-
- return (ret==0 ? ret : -EINVAL);
-}
-
-static int
-ar6000_clear_target_stats(struct net_device *dev)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- TARGET_STATS *pStats = &ar->arTargetStats;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
- AR6000_SPIN_LOCK(&ar->arLock, 0);
- A_MEMZERO(pStats, sizeof(TARGET_STATS));
- AR6000_SPIN_UNLOCK(&ar->arLock, 0);
- return ret;
-}
-
-static int
-ar6000_ioctl_get_target_stats(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- TARGET_STATS_CMD cmd;
- TARGET_STATS *pStats = &ar->arTargetStats;
- int ret = 0;
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
- if (ar->arWmiReady == false) {
- return -EIO;
- }
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- return -EBUSY;
- }
-
- ar->statsUpdatePending = true;
-
- if(wmi_get_stats_cmd(ar->arWmi) != 0) {
- up(&ar->arSem);
- return -EIO;
- }
-
- wait_event_interruptible_timeout(arEvent, ar->statsUpdatePending == false, wmitimeout * HZ);
-
- if (signal_pending(current)) {
- ret = -EINTR;
- }
-
- if (!ret && copy_to_user(rq->ifr_data, pStats, sizeof(*pStats))) {
- ret = -EFAULT;
- }
-
- if (cmd.clearStats == 1) {
- ret = ar6000_clear_target_stats(dev);
- }
-
- up(&ar->arSem);
-
- return ret;
-}
-
-static int
-ar6000_ioctl_get_ap_stats(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- u32 action; /* Allocating only the desired space on the frame. Declaring is as a WMI_AP_MODE_STAT variable results in exceeding the compiler imposed limit on the maximum frame size */
- WMI_AP_MODE_STAT *pStats = &ar->arAPStats;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
- if (copy_from_user(&action, (char *)((unsigned int*)rq->ifr_data + 1),
- sizeof(u32)))
- {
- return -EFAULT;
- }
- if (action == AP_CLEAR_STATS) {
- u8 i;
- AR6000_SPIN_LOCK(&ar->arLock, 0);
- for(i = 0; i < AP_MAX_NUM_STA; i++) {
- pStats->sta[i].tx_bytes = 0;
- pStats->sta[i].tx_pkts = 0;
- pStats->sta[i].tx_error = 0;
- pStats->sta[i].tx_discard = 0;
- pStats->sta[i].rx_bytes = 0;
- pStats->sta[i].rx_pkts = 0;
- pStats->sta[i].rx_error = 0;
- pStats->sta[i].rx_discard = 0;
- }
- AR6000_SPIN_UNLOCK(&ar->arLock, 0);
- return ret;
- }
-
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- ar->statsUpdatePending = true;
-
- if(wmi_get_stats_cmd(ar->arWmi) != 0) {
- up(&ar->arSem);
- return -EIO;
- }
-
- wait_event_interruptible_timeout(arEvent, ar->statsUpdatePending == false, wmitimeout * HZ);
-
- if (signal_pending(current)) {
- ret = -EINTR;
- }
-
- if (!ret && copy_to_user(rq->ifr_data, pStats, sizeof(*pStats))) {
- ret = -EFAULT;
- }
-
- up(&ar->arSem);
-
- return ret;
-}
-
-static int
-ar6000_ioctl_set_access_params(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_ACCESS_PARAMS_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_access_params_cmd(ar->arWmi, cmd.ac, cmd.txop, cmd.eCWmin, cmd.eCWmax,
- cmd.aifsn) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return (ret);
-}
-
-static int
-ar6000_ioctl_set_disconnect_timeout(struct net_device *dev, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_DISC_TIMEOUT_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_disctimeout_cmd(ar->arWmi, cmd.disconnectTimeout) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return (ret);
-}
-
-static int
-ar6000_xioctl_set_voice_pkt_size(struct net_device *dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_VOICE_PKT_SIZE_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_voice_pkt_size_cmd(ar->arWmi, cmd.voicePktSize) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
-
- return (ret);
-}
-
-static int
-ar6000_xioctl_set_max_sp_len(struct net_device *dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_MAX_SP_LEN_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_max_sp_len_cmd(ar->arWmi, cmd.maxSPLen) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return (ret);
-}
-
-
-static int
-ar6000_xioctl_set_bt_status_cmd(struct net_device *dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BT_STATUS_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_bt_status_cmd(ar->arWmi, cmd.streamType, cmd.status) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return (ret);
-}
-
-static int
-ar6000_xioctl_set_bt_params_cmd(struct net_device *dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BT_PARAMS_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_bt_params_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return (ret);
-}
-
-static int
-ar6000_xioctl_set_btcoex_fe_ant_cmd(struct net_device * dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BTCOEX_FE_ANT_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_btcoex_fe_ant_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return(ret);
-}
-
-static int
-ar6000_xioctl_set_btcoex_colocated_bt_dev_cmd(struct net_device * dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_btcoex_colocated_bt_dev_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return(ret);
-}
-
-static int
-ar6000_xioctl_set_btcoex_btinquiry_page_config_cmd(struct net_device * dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_btcoex_btinquiry_page_config_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return(ret);
-}
-
-static int
-ar6000_xioctl_set_btcoex_sco_config_cmd(struct net_device * dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BTCOEX_SCO_CONFIG_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_btcoex_sco_config_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return(ret);
-}
-
-static int
-ar6000_xioctl_set_btcoex_a2dp_config_cmd(struct net_device * dev,
- char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BTCOEX_A2DP_CONFIG_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_btcoex_a2dp_config_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return(ret);
-}
-
-static int
-ar6000_xioctl_set_btcoex_aclcoex_config_cmd(struct net_device * dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_btcoex_aclcoex_config_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return(ret);
-}
-
-static int
-ar60000_xioctl_set_btcoex_debug_cmd(struct net_device * dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BTCOEX_DEBUG_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_btcoex_debug_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
- return(ret);
-}
-
-static int
-ar6000_xioctl_set_btcoex_bt_operating_status_cmd(struct net_device * dev, char *userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_btcoex_bt_operating_status_cmd(ar->arWmi, &cmd) == 0)
- {
- ret = 0;
- } else {
- ret = -EINVAL;
- }
- return(ret);
-}
-
-static int
-ar6000_xioctl_get_btcoex_config_cmd(struct net_device * dev, char *userdata,
- struct ifreq *rq)
-{
-
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- AR6000_BTCOEX_CONFIG btcoexConfig;
- WMI_BTCOEX_CONFIG_EVENT *pbtcoexConfigEv = &ar->arBtcoexConfig;
-
- int ret = 0;
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
- if (ar->arWmiReady == false) {
- return -EIO;
- }
- if (copy_from_user(&btcoexConfig.configCmd, userdata, sizeof(AR6000_BTCOEX_CONFIG))) {
- return -EFAULT;
- }
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- if (wmi_get_btcoex_config_cmd(ar->arWmi, (WMI_GET_BTCOEX_CONFIG_CMD *)&btcoexConfig.configCmd) != 0)
- {
- up(&ar->arSem);
- return -EIO;
- }
-
- ar->statsUpdatePending = true;
-
- wait_event_interruptible_timeout(arEvent, ar->statsUpdatePending == false, wmitimeout * HZ);
-
- if (signal_pending(current)) {
- ret = -EINTR;
- }
-
- if (!ret && copy_to_user(btcoexConfig.configEvent, pbtcoexConfigEv, sizeof(WMI_BTCOEX_CONFIG_EVENT))) {
- ret = -EFAULT;
- }
- up(&ar->arSem);
- return ret;
-}
-
-static int
-ar6000_xioctl_get_btcoex_stats_cmd(struct net_device * dev, char *userdata, struct ifreq *rq)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- AR6000_BTCOEX_STATS btcoexStats;
- WMI_BTCOEX_STATS_EVENT *pbtcoexStats = &ar->arBtcoexStats;
- int ret = 0;
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- if (copy_from_user(&btcoexStats.statsEvent, userdata, sizeof(AR6000_BTCOEX_CONFIG))) {
- return -EFAULT;
- }
-
- if (wmi_get_btcoex_stats_cmd(ar->arWmi) != 0)
- {
- up(&ar->arSem);
- return -EIO;
- }
-
- ar->statsUpdatePending = true;
-
- wait_event_interruptible_timeout(arEvent, ar->statsUpdatePending == false, wmitimeout * HZ);
-
- if (signal_pending(current)) {
- ret = -EINTR;
- }
-
- if (!ret && copy_to_user(btcoexStats.statsEvent, pbtcoexStats, sizeof(WMI_BTCOEX_STATS_EVENT))) {
- ret = -EFAULT;
- }
-
-
- up(&ar->arSem);
-
- return(ret);
-}
-
-static int
-ar6000_xioctl_set_excess_tx_retry_thres_cmd(struct net_device * dev, char * userdata)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_SET_EXCESS_TX_RETRY_THRES_CMD cmd;
- int ret = 0;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- return -EFAULT;
- }
-
- if (wmi_set_excess_tx_retry_thres_cmd(ar->arWmi, &cmd) != 0)
- {
- ret = -EINVAL;
- }
- return(ret);
-}
-
-#ifdef CONFIG_HOST_GPIO_SUPPORT
-struct ar6000_gpio_intr_wait_cmd_s gpio_intr_results;
-/* gpio_reg_results and gpio_data_available are protected by arSem */
-static struct ar6000_gpio_register_cmd_s gpio_reg_results;
-static bool gpio_data_available; /* Requested GPIO data available */
-static bool gpio_intr_available; /* GPIO interrupt info available */
-static bool gpio_ack_received; /* GPIO ack was received */
-
-/* Host-side initialization for General Purpose I/O support */
-void ar6000_gpio_init(void)
-{
- gpio_intr_available = false;
- gpio_data_available = false;
- gpio_ack_received = false;
-}
-
-/*
- * Called when a GPIO interrupt is received from the Target.
- * intr_values shows which GPIO pins have interrupted.
- * input_values shows a recent value of GPIO pins.
- */
-void
-ar6000_gpio_intr_rx(u32 intr_mask, u32 input_values)
-{
- gpio_intr_results.intr_mask = intr_mask;
- gpio_intr_results.input_values = input_values;
- *((volatile bool *)&gpio_intr_available) = true;
- wake_up(&arEvent);
-}
-
-/*
- * This is called when a response is received from the Target
- * for a previous or ar6000_gpio_input_get or ar6000_gpio_register_get
- * call.
- */
-void
-ar6000_gpio_data_rx(u32 reg_id, u32 value)
-{
- gpio_reg_results.gpioreg_id = reg_id;
- gpio_reg_results.value = value;
- *((volatile bool *)&gpio_data_available) = true;
- wake_up(&arEvent);
-}
-
-/*
- * This is called when an acknowledgement is received from the Target
- * for a previous or ar6000_gpio_output_set or ar6000_gpio_register_set
- * call.
- */
-void
-ar6000_gpio_ack_rx(void)
-{
- gpio_ack_received = true;
- wake_up(&arEvent);
-}
-
-int
-ar6000_gpio_output_set(struct net_device *dev,
- u32 set_mask,
- u32 clear_mask,
- u32 enable_mask,
- u32 disable_mask)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- gpio_ack_received = false;
- return wmi_gpio_output_set(ar->arWmi,
- set_mask, clear_mask, enable_mask, disable_mask);
-}
-
-static int
-ar6000_gpio_input_get(struct net_device *dev)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- *((volatile bool *)&gpio_data_available) = false;
- return wmi_gpio_input_get(ar->arWmi);
-}
-
-static int
-ar6000_gpio_register_set(struct net_device *dev,
- u32 gpioreg_id,
- u32 value)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- gpio_ack_received = false;
- return wmi_gpio_register_set(ar->arWmi, gpioreg_id, value);
-}
-
-static int
-ar6000_gpio_register_get(struct net_device *dev,
- u32 gpioreg_id)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- *((volatile bool *)&gpio_data_available) = false;
- return wmi_gpio_register_get(ar->arWmi, gpioreg_id);
-}
-
-static int
-ar6000_gpio_intr_ack(struct net_device *dev,
- u32 ack_mask)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- gpio_intr_available = false;
- return wmi_gpio_intr_ack(ar->arWmi, ack_mask);
-}
-#endif /* CONFIG_HOST_GPIO_SUPPORT */
-
-#if defined(CONFIG_TARGET_PROFILE_SUPPORT)
-static struct prof_count_s prof_count_results;
-static bool prof_count_available; /* Requested GPIO data available */
-
-static int
-prof_count_get(struct net_device *dev)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- *((volatile bool *)&prof_count_available) = false;
- return wmi_prof_count_get_cmd(ar->arWmi);
-}
-
-/*
- * This is called when a response is received from the Target
- * for a previous prof_count_get call.
- */
-void
-prof_count_rx(u32 addr, u32 count)
-{
- prof_count_results.addr = addr;
- prof_count_results.count = count;
- *((volatile bool *)&prof_count_available) = true;
- wake_up(&arEvent);
-}
-#endif /* CONFIG_TARGET_PROFILE_SUPPORT */
-
-int
-ar6000_ioctl_ap_setparam(struct ar6_softc *ar, int param, int value)
-{
- int ret=0;
-
- switch(param) {
- case IEEE80211_PARAM_WPA:
- switch (value) {
- case WPA_MODE_WPA1:
- ar->arAuthMode = WPA_AUTH;
- break;
- case WPA_MODE_WPA2:
- ar->arAuthMode = WPA2_AUTH;
- break;
- case WPA_MODE_AUTO:
- ar->arAuthMode = WPA_AUTH | WPA2_AUTH;
- break;
- case WPA_MODE_NONE:
- ar->arAuthMode = NONE_AUTH;
- break;
- }
- break;
- case IEEE80211_PARAM_AUTHMODE:
- if(value == IEEE80211_AUTH_WPA_PSK) {
- if (WPA_AUTH == ar->arAuthMode) {
- ar->arAuthMode = WPA_PSK_AUTH;
- } else if (WPA2_AUTH == ar->arAuthMode) {
- ar->arAuthMode = WPA2_PSK_AUTH;
- } else if ((WPA_AUTH | WPA2_AUTH) == ar->arAuthMode) {
- ar->arAuthMode = WPA_PSK_AUTH | WPA2_PSK_AUTH;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Error - Setting PSK "\
- "mode when WPA param was set to %d\n",
- ar->arAuthMode));
- ret = -EIO;
- }
- }
- break;
- case IEEE80211_PARAM_UCASTCIPHER:
- ar->arPairwiseCrypto = 0;
- if(value & (1<<IEEE80211_CIPHER_AES_CCM)) {
- ar->arPairwiseCrypto |= AES_CRYPT;
- }
- if(value & (1<<IEEE80211_CIPHER_TKIP)) {
- ar->arPairwiseCrypto |= TKIP_CRYPT;
- }
- if(!ar->arPairwiseCrypto) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("Error - Invalid cipher in WPA \n"));
- ret = -EIO;
- }
- break;
- case IEEE80211_PARAM_PRIVACY:
- if(value == 0) {
- ar->arDot11AuthMode = OPEN_AUTH;
- ar->arAuthMode = NONE_AUTH;
- ar->arPairwiseCrypto = NONE_CRYPT;
- ar->arPairwiseCryptoLen = 0;
- ar->arGroupCrypto = NONE_CRYPT;
- ar->arGroupCryptoLen = 0;
- }
- break;
-#ifdef WAPI_ENABLE
- case IEEE80211_PARAM_WAPI:
- A_PRINTF("WAPI Policy: %d\n", value);
- ar->arDot11AuthMode = OPEN_AUTH;
- ar->arAuthMode = NONE_AUTH;
- if(value & 0x1) {
- ar->arPairwiseCrypto = WAPI_CRYPT;
- ar->arGroupCrypto = WAPI_CRYPT;
- } else {
- ar->arPairwiseCrypto = NONE_CRYPT;
- ar->arGroupCrypto = NONE_CRYPT;
- }
- break;
-#endif
- }
- return ret;
-}
-
-int
-ar6000_ioctl_setparam(struct ar6_softc *ar, int param, int value)
-{
- bool profChanged = false;
- int ret=0;
-
- if(ar->arNextMode == AP_NETWORK) {
- ar->ap_profile_flag = 1; /* There is a change in profile */
- switch (param) {
- case IEEE80211_PARAM_WPA:
- case IEEE80211_PARAM_AUTHMODE:
- case IEEE80211_PARAM_UCASTCIPHER:
- case IEEE80211_PARAM_PRIVACY:
- case IEEE80211_PARAM_WAPI:
- ret = ar6000_ioctl_ap_setparam(ar, param, value);
- return ret;
- }
- }
-
- switch (param) {
- case IEEE80211_PARAM_WPA:
- switch (value) {
- case WPA_MODE_WPA1:
- ar->arAuthMode = WPA_AUTH;
- profChanged = true;
- break;
- case WPA_MODE_WPA2:
- ar->arAuthMode = WPA2_AUTH;
- profChanged = true;
- break;
- case WPA_MODE_NONE:
- ar->arAuthMode = NONE_AUTH;
- profChanged = true;
- break;
- }
- break;
- case IEEE80211_PARAM_AUTHMODE:
- switch(value) {
- case IEEE80211_AUTH_WPA_PSK:
- if (WPA_AUTH == ar->arAuthMode) {
- ar->arAuthMode = WPA_PSK_AUTH;
- profChanged = true;
- } else if (WPA2_AUTH == ar->arAuthMode) {
- ar->arAuthMode = WPA2_PSK_AUTH;
- profChanged = true;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Error - Setting PSK "\
- "mode when WPA param was set to %d\n",
- ar->arAuthMode));
- ret = -EIO;
- }
- break;
- case IEEE80211_AUTH_WPA_CCKM:
- if (WPA2_AUTH == ar->arAuthMode) {
- ar->arAuthMode = WPA2_AUTH_CCKM;
- } else {
- ar->arAuthMode = WPA_AUTH_CCKM;
- }
- break;
- default:
- break;
- }
- break;
- case IEEE80211_PARAM_UCASTCIPHER:
- switch (value) {
- case IEEE80211_CIPHER_AES_CCM:
- ar->arPairwiseCrypto = AES_CRYPT;
- profChanged = true;
- break;
- case IEEE80211_CIPHER_TKIP:
- ar->arPairwiseCrypto = TKIP_CRYPT;
- profChanged = true;
- break;
- case IEEE80211_CIPHER_WEP:
- ar->arPairwiseCrypto = WEP_CRYPT;
- profChanged = true;
- break;
- case IEEE80211_CIPHER_NONE:
- ar->arPairwiseCrypto = NONE_CRYPT;
- profChanged = true;
- break;
- }
- break;
- case IEEE80211_PARAM_UCASTKEYLEN:
- if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(value)) {
- ret = -EIO;
- } else {
- ar->arPairwiseCryptoLen = value;
- }
- break;
- case IEEE80211_PARAM_MCASTCIPHER:
- switch (value) {
- case IEEE80211_CIPHER_AES_CCM:
- ar->arGroupCrypto = AES_CRYPT;
- profChanged = true;
- break;
- case IEEE80211_CIPHER_TKIP:
- ar->arGroupCrypto = TKIP_CRYPT;
- profChanged = true;
- break;
- case IEEE80211_CIPHER_WEP:
- ar->arGroupCrypto = WEP_CRYPT;
- profChanged = true;
- break;
- case IEEE80211_CIPHER_NONE:
- ar->arGroupCrypto = NONE_CRYPT;
- profChanged = true;
- break;
- }
- break;
- case IEEE80211_PARAM_MCASTKEYLEN:
- if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(value)) {
- ret = -EIO;
- } else {
- ar->arGroupCryptoLen = value;
- }
- break;
- case IEEE80211_PARAM_COUNTERMEASURES:
- if (ar->arWmiReady == false) {
- return -EIO;
- }
- wmi_set_tkip_countermeasures_cmd(ar->arWmi, value);
- break;
- default:
- break;
- }
- if ((ar->arNextMode != AP_NETWORK) && (profChanged == true)) {
- /*
- * profile has changed. Erase ssid to signal change
- */
- A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
- }
-
- return ret;
-}
-
-int
-ar6000_ioctl_setkey(struct ar6_softc *ar, struct ieee80211req_key *ik)
-{
- KEY_USAGE keyUsage;
- int status;
- CRYPTO_TYPE keyType = NONE_CRYPT;
-
-#ifdef USER_KEYS
- ar->user_saved_keys.keyOk = false;
-#endif
- if ( (0 == memcmp(ik->ik_macaddr, null_mac, IEEE80211_ADDR_LEN)) ||
- (0 == memcmp(ik->ik_macaddr, bcast_mac, IEEE80211_ADDR_LEN)) ) {
- keyUsage = GROUP_USAGE;
- if(ar->arNextMode == AP_NETWORK) {
- memcpy(&ar->ap_mode_bkey, ik,
- sizeof(struct ieee80211req_key));
-#ifdef WAPI_ENABLE
- if(ar->arPairwiseCrypto == WAPI_CRYPT) {
- return ap_set_wapi_key(ar, ik);
- }
-#endif
- }
-#ifdef USER_KEYS
- memcpy(&ar->user_saved_keys.bcast_ik, ik,
- sizeof(struct ieee80211req_key));
-#endif
- } else {
- keyUsage = PAIRWISE_USAGE;
-#ifdef USER_KEYS
- memcpy(&ar->user_saved_keys.ucast_ik, ik,
- sizeof(struct ieee80211req_key));
-#endif
-#ifdef WAPI_ENABLE
- if(ar->arNextMode == AP_NETWORK) {
- if(ar->arPairwiseCrypto == WAPI_CRYPT) {
- return ap_set_wapi_key(ar, ik);
- }
- }
-#endif
- }
-
- switch (ik->ik_type) {
- case IEEE80211_CIPHER_WEP:
- keyType = WEP_CRYPT;
- break;
- case IEEE80211_CIPHER_TKIP:
- keyType = TKIP_CRYPT;
- break;
- case IEEE80211_CIPHER_AES_CCM:
- keyType = AES_CRYPT;
- break;
- default:
- break;
- }
-#ifdef USER_KEYS
- ar->user_saved_keys.keyType = keyType;
-#endif
- if (IEEE80211_CIPHER_CCKM_KRK != ik->ik_type) {
- if (NONE_CRYPT == keyType) {
- return -EIO;
- }
-
- if ((WEP_CRYPT == keyType)&&(!ar->arConnected)) {
- int index = ik->ik_keyix;
-
- if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(ik->ik_keylen)) {
- return -EIO;
- }
-
- A_MEMZERO(ar->arWepKeyList[index].arKey,
- sizeof(ar->arWepKeyList[index].arKey));
- memcpy(ar->arWepKeyList[index].arKey, ik->ik_keydata, ik->ik_keylen);
- ar->arWepKeyList[index].arKeyLen = ik->ik_keylen;
-
- if(ik->ik_flags & IEEE80211_KEY_DEFAULT){
- ar->arDefTxKeyIndex = index;
- }
-
- return 0;
- }
-
- if (((WPA_PSK_AUTH == ar->arAuthMode) || (WPA2_PSK_AUTH == ar->arAuthMode)) &&
- (GROUP_USAGE & keyUsage))
- {
- A_UNTIMEOUT(&ar->disconnect_timer);
- }
-
- status = wmi_addKey_cmd(ar->arWmi, ik->ik_keyix, keyType, keyUsage,
- ik->ik_keylen, (u8 *)&ik->ik_keyrsc,
- ik->ik_keydata, KEY_OP_INIT_VAL, ik->ik_macaddr,
- SYNC_BOTH_WMIFLAG);
-
- if (status) {
- return -EIO;
- }
- } else {
- status = wmi_add_krk_cmd(ar->arWmi, ik->ik_keydata);
- }
-
-#ifdef USER_KEYS
- ar->user_saved_keys.keyOk = true;
-#endif
-
- return 0;
-}
-
-int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- struct hif_device *hifDevice = ar->arHifDevice;
- int ret = 0, param;
- unsigned int address = 0;
- unsigned int length = 0;
- unsigned char *buffer;
- char *userdata;
- u32 connectCtrlFlags;
-
-
- WMI_SET_AKMP_PARAMS_CMD akmpParams;
- WMI_SET_PMKID_LIST_CMD pmkidInfo;
-
- WMI_SET_HT_CAP_CMD htCap;
- WMI_SET_HT_OP_CMD htOp;
-
- /*
- * ioctl operations may have to wait for the Target, so we cannot hold rtnl.
- * Prevent the device from disappearing under us and release the lock during
- * the ioctl operation.
- */
- dev_hold(dev);
- rtnl_unlock();
-
- if (cmd == AR6000_IOCTL_EXTENDED) {
- /*
- * This allows for many more wireless ioctls than would otherwise
- * be available. Applications embed the actual ioctl command in
- * the first word of the parameter block, and use the command
- * AR6000_IOCTL_EXTENDED_CMD on the ioctl call.
- */
- if (get_user(cmd, (int *)rq->ifr_data)) {
- ret = -EFAULT;
- goto ioctl_done;
- }
- userdata = (char *)(((unsigned int *)rq->ifr_data)+1);
- if(is_xioctl_allowed(ar->arNextMode, cmd) != 0) {
- A_PRINTF("xioctl: cmd=%d not allowed in this mode\n",cmd);
- ret = -EOPNOTSUPP;
- goto ioctl_done;
- }
- } else {
- int ret = is_iwioctl_allowed(ar->arNextMode, cmd);
- if(ret == A_ENOTSUP) {
- A_PRINTF("iwioctl: cmd=0x%x not allowed in this mode\n", cmd);
- ret = -EOPNOTSUPP;
- goto ioctl_done;
- } else if (ret == A_ERROR) {
- /* It is not our ioctl (out of range ioctl) */
- ret = -EOPNOTSUPP;
- goto ioctl_done;
- }
- userdata = (char *)rq->ifr_data;
- }
-
- if ((ar->arWlanState == WLAN_DISABLED) &&
- ((cmd != AR6000_XIOCTRL_WMI_SET_WLAN_STATE) &&
- (cmd != AR6000_XIOCTL_GET_WLAN_SLEEP_STATE) &&
- (cmd != AR6000_XIOCTL_DIAG_READ) &&
- (cmd != AR6000_XIOCTL_DIAG_WRITE) &&
- (cmd != AR6000_XIOCTL_SET_BT_HW_POWER_STATE) &&
- (cmd != AR6000_XIOCTL_GET_BT_HW_POWER_STATE) &&
- (cmd != AR6000_XIOCTL_ADD_AP_INTERFACE) &&
- (cmd != AR6000_XIOCTL_REMOVE_AP_INTERFACE) &&
- (cmd != AR6000_IOCTL_WMI_GETREV)))
- {
- ret = -EIO;
- goto ioctl_done;
- }
-
- ret = 0;
- switch(cmd)
- {
- case IEEE80211_IOCTL_SETPARAM:
- {
- int param, value;
- int *ptr = (int *)rq->ifr_ifru.ifru_newname;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else {
- param = *ptr++;
- value = *ptr;
- ret = ar6000_ioctl_setparam(ar,param,value);
- }
- break;
- }
- case IEEE80211_IOCTL_SETKEY:
- {
- struct ieee80211req_key keydata;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&keydata, userdata,
- sizeof(struct ieee80211req_key))) {
- ret = -EFAULT;
- } else {
- ar6000_ioctl_setkey(ar, &keydata);
- }
- break;
- }
- case IEEE80211_IOCTL_DELKEY:
- case IEEE80211_IOCTL_SETOPTIE:
- {
- //ret = -EIO;
- break;
- }
- case IEEE80211_IOCTL_SETMLME:
- {
- struct ieee80211req_mlme mlme;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&mlme, userdata,
- sizeof(struct ieee80211req_mlme))) {
- ret = -EFAULT;
- } else {
- switch (mlme.im_op) {
- case IEEE80211_MLME_AUTHORIZE:
- A_PRINTF("setmlme AUTHORIZE %02X:%02X\n",
- mlme.im_macaddr[4], mlme.im_macaddr[5]);
- break;
- case IEEE80211_MLME_UNAUTHORIZE:
- A_PRINTF("setmlme UNAUTHORIZE %02X:%02X\n",
- mlme.im_macaddr[4], mlme.im_macaddr[5]);
- break;
- case IEEE80211_MLME_DEAUTH:
- A_PRINTF("setmlme DEAUTH %02X:%02X\n",
- mlme.im_macaddr[4], mlme.im_macaddr[5]);
- //remove_sta(ar, mlme.im_macaddr);
- break;
- case IEEE80211_MLME_DISASSOC:
- A_PRINTF("setmlme DISASSOC %02X:%02X\n",
- mlme.im_macaddr[4], mlme.im_macaddr[5]);
- //remove_sta(ar, mlme.im_macaddr);
- break;
- default:
- ret = 0;
- goto ioctl_done;
- }
-
- wmi_ap_set_mlme(ar->arWmi, mlme.im_op, mlme.im_macaddr,
- mlme.im_reason);
- }
- break;
- }
- case IEEE80211_IOCTL_ADDPMKID:
- {
- struct ieee80211req_addpmkid req;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&req, userdata, sizeof(struct ieee80211req_addpmkid))) {
- ret = -EFAULT;
- } else {
- int status;
-
- AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("Add pmkid for %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x en=%d\n",
- req.pi_bssid[0], req.pi_bssid[1], req.pi_bssid[2],
- req.pi_bssid[3], req.pi_bssid[4], req.pi_bssid[5],
- req.pi_enable));
-
- status = wmi_setPmkid_cmd(ar->arWmi, req.pi_bssid, req.pi_pmkid,
- req.pi_enable);
-
- if (status) {
- ret = -EIO;
- goto ioctl_done;
- }
- }
- break;
- }
-#ifdef CONFIG_HOST_TCMD_SUPPORT
- case AR6000_XIOCTL_TCMD_CONT_TX:
- {
- TCMD_CONT_TX txCmd;
-
- if ((ar->tcmdPm == TCMD_PM_SLEEP) ||
- (ar->tcmdPm == TCMD_PM_DEEPSLEEP))
- {
- A_PRINTF("Can NOT send tx tcmd when target is asleep! \n");
- ret = -EFAULT;
- goto ioctl_done;
- }
-
- if(copy_from_user(&txCmd, userdata, sizeof(TCMD_CONT_TX))) {
- ret = -EFAULT;
- goto ioctl_done;
- } else {
- wmi_test_cmd(ar->arWmi,(u8 *)&txCmd, sizeof(TCMD_CONT_TX));
- }
- }
- break;
- case AR6000_XIOCTL_TCMD_CONT_RX:
- {
- TCMD_CONT_RX rxCmd;
-
- if ((ar->tcmdPm == TCMD_PM_SLEEP) ||
- (ar->tcmdPm == TCMD_PM_DEEPSLEEP))
- {
- A_PRINTF("Can NOT send rx tcmd when target is asleep! \n");
- ret = -EFAULT;
- goto ioctl_done;
- }
- if(copy_from_user(&rxCmd, userdata, sizeof(TCMD_CONT_RX))) {
- ret = -EFAULT;
- goto ioctl_done;
- }
-
- switch(rxCmd.act)
- {
- case TCMD_CONT_RX_PROMIS:
- case TCMD_CONT_RX_FILTER:
- case TCMD_CONT_RX_SETMAC:
- case TCMD_CONT_RX_SET_ANT_SWITCH_TABLE:
- wmi_test_cmd(ar->arWmi,(u8 *)&rxCmd,
- sizeof(TCMD_CONT_RX));
- tcmdRxFreq = rxCmd.u.para.freq;
- break;
- case TCMD_CONT_RX_REPORT:
- ar6000_ioctl_tcmd_get_rx_report(dev, rq,
- (u8 *)&rxCmd, sizeof(TCMD_CONT_RX));
- break;
- default:
- A_PRINTF("Unknown Cont Rx mode: %d\n",rxCmd.act);
- ret = -EINVAL;
- goto ioctl_done;
- }
- }
- break;
- case AR6000_XIOCTL_TCMD_PM:
- {
- TCMD_PM pmCmd;
-
- if(copy_from_user(&pmCmd, userdata, sizeof(TCMD_PM))) {
- ret = -EFAULT;
- goto ioctl_done;
- }
- ar->tcmdPm = pmCmd.mode;
- wmi_test_cmd(ar->arWmi, (u8 *)&pmCmd, sizeof(TCMD_PM));
- }
- break;
-#endif /* CONFIG_HOST_TCMD_SUPPORT */
-
- case AR6000_XIOCTL_BMI_DONE:
- rtnl_lock(); /* ar6000_init expects to be called holding rtnl lock */
- ret = ar6000_init(dev);
- rtnl_unlock();
- break;
-
- case AR6000_XIOCTL_BMI_READ_MEMORY:
- if (get_user(address, (unsigned int *)userdata) ||
- get_user(length, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
-
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Read Memory (address: 0x%x, length: %d)\n",
- address, length));
- if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) {
- A_MEMZERO(buffer, length);
- ret = BMIReadMemory(hifDevice, address, buffer, length);
- if (copy_to_user(rq->ifr_data, buffer, length)) {
- ret = -EFAULT;
- }
- kfree(buffer);
- } else {
- ret = -ENOMEM;
- }
- break;
-
- case AR6000_XIOCTL_BMI_WRITE_MEMORY:
- if (get_user(address, (unsigned int *)userdata) ||
- get_user(length, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Write Memory (address: 0x%x, length: %d)\n",
- address, length));
- if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) {
- A_MEMZERO(buffer, length);
- if (copy_from_user(buffer, &userdata[sizeof(address) +
- sizeof(length)], length))
- {
- ret = -EFAULT;
- } else {
- ret = BMIWriteMemory(hifDevice, address, buffer, length);
- }
- kfree(buffer);
- } else {
- ret = -ENOMEM;
- }
- break;
-
- case AR6000_XIOCTL_BMI_TEST:
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("No longer supported\n"));
- ret = -EOPNOTSUPP;
- break;
-
- case AR6000_XIOCTL_BMI_EXECUTE:
- if (get_user(address, (unsigned int *)userdata) ||
- get_user(param, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Execute (address: 0x%x, param: %d)\n",
- address, param));
- ret = BMIExecute(hifDevice, address, (u32 *)&param);
- /* return value */
- if (put_user(param, (unsigned int *)rq->ifr_data)) {
- ret = -EFAULT;
- break;
- }
- break;
-
- case AR6000_XIOCTL_BMI_SET_APP_START:
- if (get_user(address, (unsigned int *)userdata)) {
- ret = -EFAULT;
- break;
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Set App Start (address: 0x%x)\n", address));
- ret = BMISetAppStart(hifDevice, address);
- break;
-
- case AR6000_XIOCTL_BMI_READ_SOC_REGISTER:
- if (get_user(address, (unsigned int *)userdata)) {
- ret = -EFAULT;
- break;
- }
- ret = BMIReadSOCRegister(hifDevice, address, (u32 *)&param);
- /* return value */
- if (put_user(param, (unsigned int *)rq->ifr_data)) {
- ret = -EFAULT;
- break;
- }
- break;
-
- case AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER:
- if (get_user(address, (unsigned int *)userdata) ||
- get_user(param, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
- ret = BMIWriteSOCRegister(hifDevice, address, param);
- break;
-
-#ifdef HTC_RAW_INTERFACE
- case AR6000_XIOCTL_HTC_RAW_OPEN:
- ret = 0;
- if (!arRawIfEnabled(ar)) {
- /* make sure block size is set in case the target was reset since last
- * BMI phase (i.e. flashup downloads) */
- ret = ar6000_set_htc_params(ar->arHifDevice,
- ar->arTargetType,
- 0, /* use default yield */
- 0 /* use default number of HTC ctrl buffers */
- );
- if (ret) {
- break;
- }
- /* Terminate the BMI phase */
- ret = BMIDone(hifDevice);
- if (ret == 0) {
- ret = ar6000_htc_raw_open(ar);
- }
- }
- break;
-
- case AR6000_XIOCTL_HTC_RAW_CLOSE:
- if (arRawIfEnabled(ar)) {
- ret = ar6000_htc_raw_close(ar);
- arRawIfEnabled(ar) = false;
- } else {
- ret = A_ERROR;
- }
- break;
-
- case AR6000_XIOCTL_HTC_RAW_READ:
- if (arRawIfEnabled(ar)) {
- unsigned int streamID;
- if (get_user(streamID, (unsigned int *)userdata) ||
- get_user(length, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
- buffer = (unsigned char*)rq->ifr_data + sizeof(length);
- ret = ar6000_htc_raw_read(ar, (HTC_RAW_STREAM_ID)streamID,
- (char*)buffer, length);
- if (put_user(ret, (unsigned int *)rq->ifr_data)) {
- ret = -EFAULT;
- break;
- }
- } else {
- ret = A_ERROR;
- }
- break;
-
- case AR6000_XIOCTL_HTC_RAW_WRITE:
- if (arRawIfEnabled(ar)) {
- unsigned int streamID;
- if (get_user(streamID, (unsigned int *)userdata) ||
- get_user(length, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
- buffer = (unsigned char*)userdata + sizeof(streamID) + sizeof(length);
- ret = ar6000_htc_raw_write(ar, (HTC_RAW_STREAM_ID)streamID,
- (char*)buffer, length);
- if (put_user(ret, (unsigned int *)rq->ifr_data)) {
- ret = -EFAULT;
- break;
- }
- } else {
- ret = A_ERROR;
- }
- break;
-#endif /* HTC_RAW_INTERFACE */
-
- case AR6000_XIOCTL_BMI_LZ_STREAM_START:
- if (get_user(address, (unsigned int *)userdata)) {
- ret = -EFAULT;
- break;
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Start Compressed Stream (address: 0x%x)\n", address));
- ret = BMILZStreamStart(hifDevice, address);
- break;
-
- case AR6000_XIOCTL_BMI_LZ_DATA:
- if (get_user(length, (unsigned int *)userdata)) {
- ret = -EFAULT;
- break;
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Send Compressed Data (length: %d)\n", length));
- if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) {
- A_MEMZERO(buffer, length);
- if (copy_from_user(buffer, &userdata[sizeof(length)], length))
- {
- ret = -EFAULT;
- } else {
- ret = BMILZData(hifDevice, buffer, length);
- }
- kfree(buffer);
- } else {
- ret = -ENOMEM;
- }
- break;
-
-#if defined(CONFIG_TARGET_PROFILE_SUPPORT)
- /*
- * Optional support for Target-side profiling.
- * Not needed in production.
- */
-
- /* Configure Target-side profiling */
- case AR6000_XIOCTL_PROF_CFG:
- {
- u32 period;
- u32 nbins;
- if (get_user(period, (unsigned int *)userdata) ||
- get_user(nbins, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
-
- if (wmi_prof_cfg_cmd(ar->arWmi, period, nbins) != 0) {
- ret = -EIO;
- }
-
- break;
- }
-
- /* Start a profiling bucket/bin at the specified address */
- case AR6000_XIOCTL_PROF_ADDR_SET:
- {
- u32 addr;
- if (get_user(addr, (unsigned int *)userdata)) {
- ret = -EFAULT;
- break;
- }
-
- if (wmi_prof_addr_set_cmd(ar->arWmi, addr) != 0) {
- ret = -EIO;
- }
-
- break;
- }
-
- /* START Target-side profiling */
- case AR6000_XIOCTL_PROF_START:
- wmi_prof_start_cmd(ar->arWmi);
- break;
-
- /* STOP Target-side profiling */
- case AR6000_XIOCTL_PROF_STOP:
- wmi_prof_stop_cmd(ar->arWmi);
- break;
- case AR6000_XIOCTL_PROF_COUNT_GET:
- {
- if (ar->bIsDestroyProgress) {
- ret = -EBUSY;
- goto ioctl_done;
- }
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
- if (down_interruptible(&ar->arSem)) {
- ret = -ERESTARTSYS;
- goto ioctl_done;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- ret = -EBUSY;
- goto ioctl_done;
- }
-
- prof_count_available = false;
- ret = prof_count_get(dev);
- if (ret != 0) {
- up(&ar->arSem);
- ret = -EIO;
- goto ioctl_done;
- }
-
- /* Wait for Target to respond. */
- wait_event_interruptible(arEvent, prof_count_available);
- if (signal_pending(current)) {
- ret = -EINTR;
- } else {
- if (copy_to_user(userdata, &prof_count_results,
- sizeof(prof_count_results)))
- {
- ret = -EFAULT;
- }
- }
- up(&ar->arSem);
- break;
- }
-#endif /* CONFIG_TARGET_PROFILE_SUPPORT */
-
- case AR6000_IOCTL_WMI_GETREV:
- {
- if (copy_to_user(rq->ifr_data, &ar->arVersion,
- sizeof(ar->arVersion)))
- {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_IOCTL_WMI_SETPWR:
- {
- WMI_POWER_MODE_CMD pwrModeCmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&pwrModeCmd, userdata,
- sizeof(pwrModeCmd)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_powermode_cmd(ar->arWmi, pwrModeCmd.powerMode)
- != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_IOCTL_WMI_SET_IBSS_PM_CAPS:
- {
- WMI_IBSS_PM_CAPS_CMD ibssPmCaps;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&ibssPmCaps, userdata,
- sizeof(ibssPmCaps)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_ibsspmcaps_cmd(ar->arWmi, ibssPmCaps.power_saving, ibssPmCaps.ttl,
- ibssPmCaps.atim_windows, ibssPmCaps.timeout_value) != 0)
- {
- ret = -EIO;
- }
- AR6000_SPIN_LOCK(&ar->arLock, 0);
- ar->arIbssPsEnable = ibssPmCaps.power_saving;
- AR6000_SPIN_UNLOCK(&ar->arLock, 0);
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_AP_PS:
- {
- WMI_AP_PS_CMD apPsCmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&apPsCmd, userdata,
- sizeof(apPsCmd)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_apps_cmd(ar->arWmi, apPsCmd.psType, apPsCmd.idle_time,
- apPsCmd.ps_period, apPsCmd.sleep_period) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_IOCTL_WMI_SET_PMPARAMS:
- {
- WMI_POWER_PARAMS_CMD pmParams;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&pmParams, userdata,
- sizeof(pmParams)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_pmparams_cmd(ar->arWmi, pmParams.idle_period,
- pmParams.pspoll_number,
- pmParams.dtim_policy,
- pmParams.tx_wakeup_policy,
- pmParams.num_tx_to_wakeup,
-#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN
- IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN
-#else
- SEND_POWER_SAVE_FAIL_EVENT_ALWAYS
-#endif
- ) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_IOCTL_WMI_SETSCAN:
- {
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&ar->scParams, userdata,
- sizeof(ar->scParams)))
- {
- ret = -EFAULT;
- } else {
- if (CAN_SCAN_IN_CONNECT(ar->scParams.scanCtrlFlags)) {
- ar->arSkipScan = false;
- } else {
- ar->arSkipScan = true;
- }
-
- if (wmi_scanparams_cmd(ar->arWmi, ar->scParams.fg_start_period,
- ar->scParams.fg_end_period,
- ar->scParams.bg_period,
- ar->scParams.minact_chdwell_time,
- ar->scParams.maxact_chdwell_time,
- ar->scParams.pas_chdwell_time,
- ar->scParams.shortScanRatio,
- ar->scParams.scanCtrlFlags,
- ar->scParams.max_dfsch_act_time,
- ar->scParams.maxact_scan_per_ssid) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_IOCTL_WMI_SETLISTENINT:
- {
- WMI_LISTEN_INT_CMD listenCmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&listenCmd, userdata,
- sizeof(listenCmd)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_listeninterval_cmd(ar->arWmi, listenCmd.listenInterval, listenCmd.numBeacons) != 0) {
- ret = -EIO;
- } else {
- AR6000_SPIN_LOCK(&ar->arLock, 0);
- ar->arListenIntervalT = listenCmd.listenInterval;
- ar->arListenIntervalB = listenCmd.numBeacons;
- AR6000_SPIN_UNLOCK(&ar->arLock, 0);
- }
-
- }
- break;
- }
- case AR6000_IOCTL_WMI_SET_BMISS_TIME:
- {
- WMI_BMISS_TIME_CMD bmissCmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&bmissCmd, userdata,
- sizeof(bmissCmd)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_bmisstime_cmd(ar->arWmi, bmissCmd.bmissTime, bmissCmd.numBeacons) != 0) {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_IOCTL_WMI_SETBSSFILTER:
- {
- WMI_BSS_FILTER_CMD filt;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&filt, userdata,
- sizeof(filt)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_bssfilter_cmd(ar->arWmi, filt.bssFilter, filt.ieMask)
- != 0) {
- ret = -EIO;
- } else {
- ar->arUserBssFilter = filt.bssFilter;
- }
- }
- break;
- }
-
- case AR6000_IOCTL_WMI_SET_SNRTHRESHOLD:
- {
- ret = ar6000_ioctl_set_snr_threshold(dev, rq);
- break;
- }
- case AR6000_XIOCTL_WMI_SET_RSSITHRESHOLD:
- {
- ret = ar6000_ioctl_set_rssi_threshold(dev, rq);
- break;
- }
- case AR6000_XIOCTL_WMI_CLR_RSSISNR:
- {
- if (ar->arWmiReady == false) {
- ret = -EIO;
- }
- ret = wmi_clr_rssi_snr(ar->arWmi);
- break;
- }
- case AR6000_XIOCTL_WMI_SET_LQTHRESHOLD:
- {
- ret = ar6000_ioctl_set_lq_threshold(dev, rq);
- break;
- }
- case AR6000_XIOCTL_WMI_SET_LPREAMBLE:
- {
- WMI_SET_LPREAMBLE_CMD setLpreambleCmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setLpreambleCmd, userdata,
- sizeof(setLpreambleCmd)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_lpreamble_cmd(ar->arWmi, setLpreambleCmd.status,
-#if WLAN_CONFIG_DONOT_IGNORE_BARKER_IN_ERP
- WMI_DONOT_IGNORE_BARKER_IN_ERP
-#else
- WMI_IGNORE_BARKER_IN_ERP
-#endif
- ) != 0)
- {
- ret = -EIO;
- }
- }
-
- break;
- }
- case AR6000_XIOCTL_WMI_SET_RTS:
- {
- WMI_SET_RTS_CMD rtsCmd;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&rtsCmd, userdata,
- sizeof(rtsCmd)))
- {
- ret = -EFAULT;
- } else {
- ar->arRTS = rtsCmd.threshold;
- if (wmi_set_rts_cmd(ar->arWmi, rtsCmd.threshold)
- != 0)
- {
- ret = -EIO;
- }
- }
-
- break;
- }
- case AR6000_XIOCTL_WMI_SET_WMM:
- {
- ret = ar6000_ioctl_set_wmm(dev, rq);
- break;
- }
- case AR6000_XIOCTL_WMI_SET_QOS_SUPP:
- {
- ret = ar6000_ioctl_set_qos_supp(dev, rq);
- break;
- }
- case AR6000_XIOCTL_WMI_SET_TXOP:
- {
- ret = ar6000_ioctl_set_txop(dev, rq);
- break;
- }
- case AR6000_XIOCTL_WMI_GET_RD:
- {
- ret = ar6000_ioctl_get_rd(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_SET_CHANNELPARAMS:
- {
- ret = ar6000_ioctl_set_channelParams(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_SET_PROBEDSSID:
- {
- ret = ar6000_ioctl_set_probedSsid(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_SET_BADAP:
- {
- ret = ar6000_ioctl_set_badAp(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_CREATE_QOS:
- {
- ret = ar6000_ioctl_create_qos(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_DELETE_QOS:
- {
- ret = ar6000_ioctl_delete_qos(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_GET_QOS_QUEUE:
- {
- ret = ar6000_ioctl_get_qos_queue(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_GET_TARGET_STATS:
- {
- ret = ar6000_ioctl_get_target_stats(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_SET_ERROR_REPORT_BITMASK:
- {
- ret = ar6000_ioctl_set_error_report_bitmask(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_SET_ASSOC_INFO:
- {
- WMI_SET_ASSOC_INFO_CMD cmd;
- u8 assocInfo[WMI_MAX_ASSOC_INFO_LEN];
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- break;
- }
-
- if (get_user(cmd.ieType, userdata)) {
- ret = -EFAULT;
- break;
- }
- if (cmd.ieType >= WMI_MAX_ASSOC_INFO_TYPE) {
- ret = -EIO;
- break;
- }
-
- if (get_user(cmd.bufferSize, userdata + 1) ||
- (cmd.bufferSize > WMI_MAX_ASSOC_INFO_LEN) ||
- copy_from_user(assocInfo, userdata + 2, cmd.bufferSize)) {
- ret = -EFAULT;
- break;
- }
- if (wmi_associnfo_cmd(ar->arWmi, cmd.ieType,
- cmd.bufferSize, assocInfo) != 0) {
- ret = -EIO;
- break;
- }
- break;
- }
- case AR6000_IOCTL_WMI_SET_ACCESS_PARAMS:
- {
- ret = ar6000_ioctl_set_access_params(dev, rq);
- break;
- }
- case AR6000_IOCTL_WMI_SET_DISC_TIMEOUT:
- {
- ret = ar6000_ioctl_set_disconnect_timeout(dev, rq);
- break;
- }
- case AR6000_XIOCTL_FORCE_TARGET_RESET:
- {
- if (ar->arHtcTarget)
- {
-// HTCForceReset(htcTarget);
- }
- else
- {
- AR_DEBUG_PRINTF(ATH_DEBUG_WARN,("ar6000_ioctl cannot attempt reset.\n"));
- }
- break;
- }
- case AR6000_XIOCTL_TARGET_INFO:
- case AR6000_XIOCTL_CHECK_TARGET_READY: /* backwards compatibility */
- {
- /* If we made it to here, then the Target exists and is ready. */
-
- if (cmd == AR6000_XIOCTL_TARGET_INFO) {
- if (copy_to_user((u32 *)rq->ifr_data, &ar->arVersion.target_ver,
- sizeof(ar->arVersion.target_ver)))
- {
- ret = -EFAULT;
- }
- if (copy_to_user(((u32 *)rq->ifr_data)+1, &ar->arTargetType,
- sizeof(ar->arTargetType)))
- {
- ret = -EFAULT;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_HB_CHALLENGE_RESP_PARAMS:
- {
- WMI_SET_HB_CHALLENGE_RESP_PARAMS_CMD hbparam;
-
- if (copy_from_user(&hbparam, userdata, sizeof(hbparam)))
- {
- ret = -EFAULT;
- } else {
- AR6000_SPIN_LOCK(&ar->arLock, 0);
- /* Start a cyclic timer with the parameters provided. */
- if (hbparam.frequency) {
- ar->arHBChallengeResp.frequency = hbparam.frequency;
- }
- if (hbparam.threshold) {
- ar->arHBChallengeResp.missThres = hbparam.threshold;
- }
-
- /* Delete the pending timer and start a new one */
- if (timer_pending(&ar->arHBChallengeResp.timer)) {
- A_UNTIMEOUT(&ar->arHBChallengeResp.timer);
- }
- A_TIMEOUT_MS(&ar->arHBChallengeResp.timer, ar->arHBChallengeResp.frequency * 1000, 0);
- AR6000_SPIN_UNLOCK(&ar->arLock, 0);
- }
- break;
- }
- case AR6000_XIOCTL_WMI_GET_HB_CHALLENGE_RESP:
- {
- u32 cookie;
-
- if (copy_from_user(&cookie, userdata, sizeof(cookie))) {
- ret = -EFAULT;
- goto ioctl_done;
- }
-
- /* Send the challenge on the control channel */
- if (wmi_get_challenge_resp_cmd(ar->arWmi, cookie, APP_HB_CHALLENGE) != 0) {
- ret = -EIO;
- goto ioctl_done;
- }
- break;
- }
-#ifdef USER_KEYS
- case AR6000_XIOCTL_USER_SETKEYS:
- {
-
- ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_RUN;
-
- if (copy_from_user(&ar->user_key_ctrl, userdata,
- sizeof(ar->user_key_ctrl)))
- {
- ret = -EFAULT;
- goto ioctl_done;
- }
-
- A_PRINTF("ar6000 USER set key %x\n", ar->user_key_ctrl);
- break;
- }
-#endif /* USER_KEYS */
-
-#ifdef CONFIG_HOST_GPIO_SUPPORT
- case AR6000_XIOCTL_GPIO_OUTPUT_SET:
- {
- struct ar6000_gpio_output_set_cmd_s gpio_output_set_cmd;
-
- if (ar->bIsDestroyProgress) {
- ret = -EBUSY;
- goto ioctl_done;
- }
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
- if (down_interruptible(&ar->arSem)) {
- ret = -ERESTARTSYS;
- goto ioctl_done;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- ret = -EBUSY;
- goto ioctl_done;
- }
-
- if (copy_from_user(&gpio_output_set_cmd, userdata,
- sizeof(gpio_output_set_cmd)))
- {
- ret = -EFAULT;
- } else {
- ret = ar6000_gpio_output_set(dev,
- gpio_output_set_cmd.set_mask,
- gpio_output_set_cmd.clear_mask,
- gpio_output_set_cmd.enable_mask,
- gpio_output_set_cmd.disable_mask);
- if (ret != 0) {
- ret = -EIO;
- }
- }
- up(&ar->arSem);
- break;
- }
- case AR6000_XIOCTL_GPIO_INPUT_GET:
- {
- if (ar->bIsDestroyProgress) {
- ret = -EBUSY;
- goto ioctl_done;
- }
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
- if (down_interruptible(&ar->arSem)) {
- ret = -ERESTARTSYS;
- goto ioctl_done;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- ret = -EBUSY;
- goto ioctl_done;
- }
-
- ret = ar6000_gpio_input_get(dev);
- if (ret != 0) {
- up(&ar->arSem);
- ret = -EIO;
- goto ioctl_done;
- }
-
- /* Wait for Target to respond. */
- wait_event_interruptible(arEvent, gpio_data_available);
- if (signal_pending(current)) {
- ret = -EINTR;
- } else {
- A_ASSERT(gpio_reg_results.gpioreg_id == GPIO_ID_NONE);
-
- if (copy_to_user(userdata, &gpio_reg_results.value,
- sizeof(gpio_reg_results.value)))
- {
- ret = -EFAULT;
- }
- }
- up(&ar->arSem);
- break;
- }
- case AR6000_XIOCTL_GPIO_REGISTER_SET:
- {
- struct ar6000_gpio_register_cmd_s gpio_register_cmd;
-
- if (ar->bIsDestroyProgress) {
- ret = -EBUSY;
- goto ioctl_done;
- }
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
- if (down_interruptible(&ar->arSem)) {
- ret = -ERESTARTSYS;
- goto ioctl_done;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- ret = -EBUSY;
- goto ioctl_done;
- }
-
- if (copy_from_user(&gpio_register_cmd, userdata,
- sizeof(gpio_register_cmd)))
- {
- ret = -EFAULT;
- } else {
- ret = ar6000_gpio_register_set(dev,
- gpio_register_cmd.gpioreg_id,
- gpio_register_cmd.value);
- if (ret != 0) {
- ret = -EIO;
- }
-
- /* Wait for acknowledgement from Target */
- wait_event_interruptible(arEvent, gpio_ack_received);
- if (signal_pending(current)) {
- ret = -EINTR;
- }
- }
- up(&ar->arSem);
- break;
- }
- case AR6000_XIOCTL_GPIO_REGISTER_GET:
- {
- struct ar6000_gpio_register_cmd_s gpio_register_cmd;
-
- if (ar->bIsDestroyProgress) {
- ret = -EBUSY;
- goto ioctl_done;
- }
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
- if (down_interruptible(&ar->arSem)) {
- ret = -ERESTARTSYS;
- goto ioctl_done;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- ret = -EBUSY;
- goto ioctl_done;
- }
-
- if (copy_from_user(&gpio_register_cmd, userdata,
- sizeof(gpio_register_cmd)))
- {
- ret = -EFAULT;
- } else {
- ret = ar6000_gpio_register_get(dev, gpio_register_cmd.gpioreg_id);
- if (ret != 0) {
- up(&ar->arSem);
- ret = -EIO;
- goto ioctl_done;
- }
-
- /* Wait for Target to respond. */
- wait_event_interruptible(arEvent, gpio_data_available);
- if (signal_pending(current)) {
- ret = -EINTR;
- } else {
- A_ASSERT(gpio_register_cmd.gpioreg_id == gpio_reg_results.gpioreg_id);
- if (copy_to_user(userdata, &gpio_reg_results,
- sizeof(gpio_reg_results)))
- {
- ret = -EFAULT;
- }
- }
- }
- up(&ar->arSem);
- break;
- }
- case AR6000_XIOCTL_GPIO_INTR_ACK:
- {
- struct ar6000_gpio_intr_ack_cmd_s gpio_intr_ack_cmd;
-
- if (ar->bIsDestroyProgress) {
- ret = -EBUSY;
- goto ioctl_done;
- }
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
- if (down_interruptible(&ar->arSem)) {
- ret = -ERESTARTSYS;
- goto ioctl_done;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- ret = -EBUSY;
- goto ioctl_done;
- }
-
- if (copy_from_user(&gpio_intr_ack_cmd, userdata,
- sizeof(gpio_intr_ack_cmd)))
- {
- ret = -EFAULT;
- } else {
- ret = ar6000_gpio_intr_ack(dev, gpio_intr_ack_cmd.ack_mask);
- if (ret != 0) {
- ret = -EIO;
- }
- }
- up(&ar->arSem);
- break;
- }
- case AR6000_XIOCTL_GPIO_INTR_WAIT:
- {
- /* Wait for Target to report an interrupt. */
- wait_event_interruptible(arEvent, gpio_intr_available);
-
- if (signal_pending(current)) {
- ret = -EINTR;
- } else {
- if (copy_to_user(userdata, &gpio_intr_results,
- sizeof(gpio_intr_results)))
- {
- ret = -EFAULT;
- }
- }
- break;
- }
-#endif /* CONFIG_HOST_GPIO_SUPPORT */
-
- case AR6000_XIOCTL_DBGLOG_CFG_MODULE:
- {
- struct ar6000_dbglog_module_config_s config;
-
- if (copy_from_user(&config, userdata, sizeof(config))) {
- ret = -EFAULT;
- goto ioctl_done;
- }
-
- /* Send the challenge on the control channel */
- if (wmi_config_debug_module_cmd(ar->arWmi, config.mmask,
- config.tsr, config.rep,
- config.size, config.valid) != 0)
- {
- ret = -EIO;
- goto ioctl_done;
- }
- break;
- }
-
- case AR6000_XIOCTL_DBGLOG_GET_DEBUG_LOGS:
- {
- /* Send the challenge on the control channel */
- if (ar6000_dbglog_get_debug_logs(ar) != 0)
- {
- ret = -EIO;
- goto ioctl_done;
- }
- break;
- }
-
- case AR6000_XIOCTL_SET_ADHOC_BSSID:
- {
- WMI_SET_ADHOC_BSSID_CMD adhocBssid;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&adhocBssid, userdata,
- sizeof(adhocBssid)))
- {
- ret = -EFAULT;
- } else if (memcmp(adhocBssid.bssid, bcast_mac,
- AR6000_ETH_ADDR_LEN) == 0)
- {
- ret = -EFAULT;
- } else {
-
- memcpy(ar->arReqBssid, adhocBssid.bssid, sizeof(ar->arReqBssid));
- }
- break;
- }
-
- case AR6000_XIOCTL_SET_OPT_MODE:
- {
- WMI_SET_OPT_MODE_CMD optModeCmd;
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&optModeCmd, userdata,
- sizeof(optModeCmd)))
- {
- ret = -EFAULT;
- } else if (ar->arConnected && optModeCmd.optMode == SPECIAL_ON) {
- ret = -EFAULT;
-
- } else if (wmi_set_opt_mode_cmd(ar->arWmi, optModeCmd.optMode)
- != 0)
- {
- ret = -EIO;
- }
- break;
- }
-
- case AR6000_XIOCTL_OPT_SEND_FRAME:
- {
- WMI_OPT_TX_FRAME_CMD optTxFrmCmd;
- u8 data[MAX_OPT_DATA_LEN];
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- break;
- }
-
- if (copy_from_user(&optTxFrmCmd, userdata, sizeof(optTxFrmCmd))) {
- ret = -EFAULT;
- break;
- }
-
- if (optTxFrmCmd.optIEDataLen > MAX_OPT_DATA_LEN) {
- ret = -EINVAL;
- break;
- }
-
- if (copy_from_user(data, userdata+sizeof(WMI_OPT_TX_FRAME_CMD) - 1,
- optTxFrmCmd.optIEDataLen)) {
- ret = -EFAULT;
- break;
- }
-
- ret = wmi_opt_tx_frame_cmd(ar->arWmi,
- optTxFrmCmd.frmType,
- optTxFrmCmd.dstAddr,
- optTxFrmCmd.bssid,
- optTxFrmCmd.optIEDataLen,
- data);
- break;
- }
- case AR6000_XIOCTL_WMI_SETRETRYLIMITS:
- {
- WMI_SET_RETRY_LIMITS_CMD setRetryParams;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setRetryParams, userdata,
- sizeof(setRetryParams)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_retry_limits_cmd(ar->arWmi, setRetryParams.frameType,
- setRetryParams.trafficClass,
- setRetryParams.maxRetries,
- setRetryParams.enableNotify) != 0)
- {
- ret = -EIO;
- }
- AR6000_SPIN_LOCK(&ar->arLock, 0);
- ar->arMaxRetries = setRetryParams.maxRetries;
- AR6000_SPIN_UNLOCK(&ar->arLock, 0);
- }
- break;
- }
-
- case AR6000_XIOCTL_SET_BEACON_INTVAL:
- {
- WMI_BEACON_INT_CMD bIntvlCmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&bIntvlCmd, userdata,
- sizeof(bIntvlCmd)))
- {
- ret = -EFAULT;
- } else if (wmi_set_adhoc_bconIntvl_cmd(ar->arWmi, bIntvlCmd.beaconInterval)
- != 0)
- {
- ret = -EIO;
- }
- if(ret == 0) {
- ar->ap_beacon_interval = bIntvlCmd.beaconInterval;
- ar->ap_profile_flag = 1; /* There is a change in profile */
- }
- break;
- }
- case IEEE80211_IOCTL_SETAUTHALG:
- {
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- struct ieee80211req_authalg req;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&req, userdata,
- sizeof(struct ieee80211req_authalg)))
- {
- ret = -EFAULT;
- } else {
- if (req.auth_alg & AUTH_ALG_OPEN_SYSTEM) {
- ar->arDot11AuthMode |= OPEN_AUTH;
- ar->arPairwiseCrypto = NONE_CRYPT;
- ar->arGroupCrypto = NONE_CRYPT;
- }
- if (req.auth_alg & AUTH_ALG_SHARED_KEY) {
- ar->arDot11AuthMode |= SHARED_AUTH;
- ar->arPairwiseCrypto = WEP_CRYPT;
- ar->arGroupCrypto = WEP_CRYPT;
- ar->arAuthMode = NONE_AUTH;
- }
- if (req.auth_alg == AUTH_ALG_LEAP) {
- ar->arDot11AuthMode = LEAP_AUTH;
- }
- }
- break;
- }
-
- case AR6000_XIOCTL_SET_VOICE_PKT_SIZE:
- ret = ar6000_xioctl_set_voice_pkt_size(dev, userdata);
- break;
-
- case AR6000_XIOCTL_SET_MAX_SP:
- ret = ar6000_xioctl_set_max_sp_len(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_GET_ROAM_TBL:
- ret = ar6000_ioctl_get_roam_tbl(dev, rq);
- break;
- case AR6000_XIOCTL_WMI_SET_ROAM_CTRL:
- ret = ar6000_ioctl_set_roam_ctrl(dev, userdata);
- break;
- case AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS:
- ret = ar6000_ioctl_set_powersave_timers(dev, userdata);
- break;
- case AR6000_XIOCTRL_WMI_GET_POWER_MODE:
- ret = ar6000_ioctl_get_power_mode(dev, rq);
- break;
- case AR6000_XIOCTRL_WMI_SET_WLAN_STATE:
- {
- AR6000_WLAN_STATE state;
- if (get_user(state, (unsigned int *)userdata))
- ret = -EFAULT;
- else if (ar6000_set_wlan_state(ar, state) != 0)
- ret = -EIO;
- break;
- }
- case AR6000_XIOCTL_WMI_GET_ROAM_DATA:
- ret = ar6000_ioctl_get_roam_data(dev, rq);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BT_STATUS:
- ret = ar6000_xioctl_set_bt_status_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BT_PARAMS:
- ret = ar6000_xioctl_set_bt_params_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BTCOEX_FE_ANT:
- ret = ar6000_xioctl_set_btcoex_fe_ant_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BTCOEX_COLOCATED_BT_DEV:
- ret = ar6000_xioctl_set_btcoex_colocated_bt_dev_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG:
- ret = ar6000_xioctl_set_btcoex_btinquiry_page_config_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BTCOEX_SCO_CONFIG:
- ret = ar6000_xioctl_set_btcoex_sco_config_cmd( dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BTCOEX_A2DP_CONFIG:
- ret = ar6000_xioctl_set_btcoex_a2dp_config_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BTCOEX_ACLCOEX_CONFIG:
- ret = ar6000_xioctl_set_btcoex_aclcoex_config_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BTCOEX_DEBUG:
- ret = ar60000_xioctl_set_btcoex_debug_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_SET_BT_OPERATING_STATUS:
- ret = ar6000_xioctl_set_btcoex_bt_operating_status_cmd(dev, userdata);
- break;
-
- case AR6000_XIOCTL_WMI_GET_BTCOEX_CONFIG:
- ret = ar6000_xioctl_get_btcoex_config_cmd(dev, userdata, rq);
- break;
-
- case AR6000_XIOCTL_WMI_GET_BTCOEX_STATS:
- ret = ar6000_xioctl_get_btcoex_stats_cmd(dev, userdata, rq);
- break;
-
- case AR6000_XIOCTL_WMI_STARTSCAN:
- {
- WMI_START_SCAN_CMD setStartScanCmd, *cmdp;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setStartScanCmd, userdata,
- sizeof(setStartScanCmd)))
- {
- ret = -EFAULT;
- } else {
- if (setStartScanCmd.numChannels > 1) {
- cmdp = A_MALLOC(130);
- if (copy_from_user(cmdp, userdata,
- sizeof (*cmdp) +
- ((setStartScanCmd.numChannels - 1) *
- sizeof(u16))))
- {
- kfree(cmdp);
- ret = -EFAULT;
- goto ioctl_done;
- }
- } else {
- cmdp = &setStartScanCmd;
- }
-
- if (wmi_startscan_cmd(ar->arWmi, cmdp->scanType,
- cmdp->forceFgScan,
- cmdp->isLegacy,
- cmdp->homeDwellTime,
- cmdp->forceScanInterval,
- cmdp->numChannels,
- cmdp->channelList) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SETFIXRATES:
- {
- WMI_FIX_RATES_CMD setFixRatesCmd;
- int returnStatus;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setFixRatesCmd, userdata,
- sizeof(setFixRatesCmd)))
- {
- ret = -EFAULT;
- } else {
- returnStatus = wmi_set_fixrates_cmd(ar->arWmi, setFixRatesCmd.fixRateMask);
- if (returnStatus == A_EINVAL) {
- ret = -EINVAL;
- } else if(returnStatus != 0) {
- ret = -EIO;
- } else {
- ar->ap_profile_flag = 1; /* There is a change in profile */
- }
- }
- break;
- }
-
- case AR6000_XIOCTL_WMI_GETFIXRATES:
- {
- WMI_FIX_RATES_CMD getFixRatesCmd;
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- int ret = 0;
-
- if (ar->bIsDestroyProgress) {
- ret = -EBUSY;
- goto ioctl_done;
- }
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
-
- if (down_interruptible(&ar->arSem)) {
- ret = -ERESTARTSYS;
- goto ioctl_done;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- ret = -EBUSY;
- goto ioctl_done;
- }
- /* Used copy_from_user/copy_to_user to access user space data */
- if (copy_from_user(&getFixRatesCmd, userdata, sizeof(getFixRatesCmd))) {
- ret = -EFAULT;
- } else {
- ar->arRateMask = 0xFFFFFFFF;
-
- if (wmi_get_ratemask_cmd(ar->arWmi) != 0) {
- up(&ar->arSem);
- ret = -EIO;
- goto ioctl_done;
- }
-
- wait_event_interruptible_timeout(arEvent, ar->arRateMask != 0xFFFFFFFF, wmitimeout * HZ);
-
- if (signal_pending(current)) {
- ret = -EINTR;
- }
-
- if (!ret) {
- getFixRatesCmd.fixRateMask = ar->arRateMask;
- }
-
- if(copy_to_user(userdata, &getFixRatesCmd, sizeof(getFixRatesCmd))) {
- ret = -EFAULT;
- }
-
- up(&ar->arSem);
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_AUTHMODE:
- {
- WMI_SET_AUTH_MODE_CMD setAuthMode;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setAuthMode, userdata,
- sizeof(setAuthMode)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_authmode_cmd(ar->arWmi, setAuthMode.mode) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_REASSOCMODE:
- {
- WMI_SET_REASSOC_MODE_CMD setReassocMode;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setReassocMode, userdata,
- sizeof(setReassocMode)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_reassocmode_cmd(ar->arWmi, setReassocMode.mode) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_DIAG_READ:
- {
- u32 addr, data;
- if (get_user(addr, (unsigned int *)userdata)) {
- ret = -EFAULT;
- break;
- }
- addr = TARG_VTOP(ar->arTargetType, addr);
- if (ar6000_ReadRegDiag(ar->arHifDevice, &addr, &data) != 0) {
- ret = -EIO;
- }
- if (put_user(data, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
- break;
- }
- case AR6000_XIOCTL_DIAG_WRITE:
- {
- u32 addr, data;
- if (get_user(addr, (unsigned int *)userdata) ||
- get_user(data, (unsigned int *)userdata + 1)) {
- ret = -EFAULT;
- break;
- }
- addr = TARG_VTOP(ar->arTargetType, addr);
- if (ar6000_WriteRegDiag(ar->arHifDevice, &addr, &data) != 0) {
- ret = -EIO;
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_KEEPALIVE:
- {
- WMI_SET_KEEPALIVE_CMD setKeepAlive;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- } else if (copy_from_user(&setKeepAlive, userdata,
- sizeof(setKeepAlive))){
- ret = -EFAULT;
- } else {
- if (wmi_set_keepalive_cmd(ar->arWmi, setKeepAlive.keepaliveInterval) != 0) {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_PARAMS:
- {
- WMI_SET_PARAMS_CMD cmd;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- } else if (copy_from_user(&cmd, userdata,
- sizeof(cmd))){
- ret = -EFAULT;
- } else if (copy_from_user(&cmd, userdata,
- sizeof(cmd) + cmd.length))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_params_cmd(ar->arWmi, cmd.opcode, cmd.length, cmd.buffer) != 0) {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_MCAST_FILTER:
- {
- WMI_SET_MCAST_FILTER_CMD cmd;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- } else if (copy_from_user(&cmd, userdata,
- sizeof(cmd))){
- ret = -EFAULT;
- } else {
- if (wmi_set_mcast_filter_cmd(ar->arWmi, cmd.multicast_mac[0],
- cmd.multicast_mac[1],
- cmd.multicast_mac[2],
- cmd.multicast_mac[3]) != 0) {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_DEL_MCAST_FILTER:
- {
- WMI_SET_MCAST_FILTER_CMD cmd;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- } else if (copy_from_user(&cmd, userdata,
- sizeof(cmd))){
- ret = -EFAULT;
- } else {
- if (wmi_del_mcast_filter_cmd(ar->arWmi, cmd.multicast_mac[0],
- cmd.multicast_mac[1],
- cmd.multicast_mac[2],
- cmd.multicast_mac[3]) != 0) {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_MCAST_FILTER:
- {
- WMI_MCAST_FILTER_CMD cmd;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- } else if (copy_from_user(&cmd, userdata,
- sizeof(cmd))){
- ret = -EFAULT;
- } else {
- if (wmi_mcast_filter_cmd(ar->arWmi, cmd.enable) != 0) {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_GET_KEEPALIVE:
- {
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_GET_KEEPALIVE_CMD getKeepAlive;
- int ret = 0;
- if (ar->bIsDestroyProgress) {
- ret =-EBUSY;
- goto ioctl_done;
- }
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
- if (down_interruptible(&ar->arSem)) {
- ret = -ERESTARTSYS;
- goto ioctl_done;
- }
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- ret = -EBUSY;
- goto ioctl_done;
- }
- if (copy_from_user(&getKeepAlive, userdata,sizeof(getKeepAlive))) {
- ret = -EFAULT;
- } else {
- getKeepAlive.keepaliveInterval = wmi_get_keepalive_cmd(ar->arWmi);
- ar->arKeepaliveConfigured = 0xFF;
- if (wmi_get_keepalive_configured(ar->arWmi) != 0){
- up(&ar->arSem);
- ret = -EIO;
- goto ioctl_done;
- }
- wait_event_interruptible_timeout(arEvent, ar->arKeepaliveConfigured != 0xFF, wmitimeout * HZ);
- if (signal_pending(current)) {
- ret = -EINTR;
- }
-
- if (!ret) {
- getKeepAlive.configured = ar->arKeepaliveConfigured;
- }
- if (copy_to_user(userdata, &getKeepAlive, sizeof(getKeepAlive))) {
- ret = -EFAULT;
- }
- up(&ar->arSem);
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_APPIE:
- {
- WMI_SET_APPIE_CMD appIEcmd;
- u8 appIeInfo[IEEE80211_APPIE_FRAME_MAX_LEN];
- u32 fType,ieLen;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- }
- if (get_user(fType, (u32 *)userdata)) {
- ret = -EFAULT;
- break;
- }
- appIEcmd.mgmtFrmType = fType;
- if (appIEcmd.mgmtFrmType >= IEEE80211_APPIE_NUM_OF_FRAME) {
- ret = -EIO;
- } else {
- if (get_user(ieLen, (u32 *)(userdata + 4))) {
- ret = -EFAULT;
- break;
- }
- appIEcmd.ieLen = ieLen;
- A_PRINTF("WPSIE: Type-%d, Len-%d\n",appIEcmd.mgmtFrmType, appIEcmd.ieLen);
- if (appIEcmd.ieLen > IEEE80211_APPIE_FRAME_MAX_LEN) {
- ret = -EIO;
- break;
- }
- if (copy_from_user(appIeInfo, userdata + 8, appIEcmd.ieLen)) {
- ret = -EFAULT;
- } else {
- if (wmi_set_appie_cmd(ar->arWmi, appIEcmd.mgmtFrmType,
- appIEcmd.ieLen, appIeInfo) != 0)
- {
- ret = -EIO;
- }
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_MGMT_FRM_RX_FILTER:
- {
- WMI_BSS_FILTER_CMD cmd;
- u32 filterType;
-
- if (copy_from_user(&filterType, userdata, sizeof(u32)))
- {
- ret = -EFAULT;
- goto ioctl_done;
- }
- if (filterType & (IEEE80211_FILTER_TYPE_BEACON |
- IEEE80211_FILTER_TYPE_PROBE_RESP))
- {
- cmd.bssFilter = ALL_BSS_FILTER;
- } else {
- cmd.bssFilter = NONE_BSS_FILTER;
- }
- if (wmi_bssfilter_cmd(ar->arWmi, cmd.bssFilter, 0) != 0) {
- ret = -EIO;
- } else {
- ar->arUserBssFilter = cmd.bssFilter;
- }
-
- AR6000_SPIN_LOCK(&ar->arLock, 0);
- ar->arMgmtFilter = filterType;
- AR6000_SPIN_UNLOCK(&ar->arLock, 0);
- break;
- }
- case AR6000_XIOCTL_WMI_SET_WSC_STATUS:
- {
- u32 wsc_status;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- goto ioctl_done;
- } else if (copy_from_user(&wsc_status, userdata, sizeof(u32)))
- {
- ret = -EFAULT;
- goto ioctl_done;
- }
- if (wmi_set_wsc_status_cmd(ar->arWmi, wsc_status) != 0) {
- ret = -EIO;
- }
- break;
- }
- case AR6000_XIOCTL_BMI_ROMPATCH_INSTALL:
- {
- u32 ROM_addr;
- u32 RAM_addr;
- u32 nbytes;
- u32 do_activate;
- u32 rompatch_id;
-
- if (get_user(ROM_addr, (u32 *)userdata) ||
- get_user(RAM_addr, (u32 *)userdata + 1) ||
- get_user(nbytes, (u32 *)userdata + 2) ||
- get_user(do_activate, (u32 *)userdata + 3)) {
- ret = -EFAULT;
- break;
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Install rompatch from ROM: 0x%x to RAM: 0x%x length: %d\n",
- ROM_addr, RAM_addr, nbytes));
- ret = BMIrompatchInstall(hifDevice, ROM_addr, RAM_addr,
- nbytes, do_activate, &rompatch_id);
- if (ret == 0) {
- /* return value */
- if (put_user(rompatch_id, (unsigned int *)rq->ifr_data)) {
- ret = -EFAULT;
- break;
- }
- }
- break;
- }
-
- case AR6000_XIOCTL_BMI_ROMPATCH_UNINSTALL:
- {
- u32 rompatch_id;
-
- if (get_user(rompatch_id, (u32 *)userdata)) {
- ret = -EFAULT;
- break;
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("UNinstall rompatch_id %d\n", rompatch_id));
- ret = BMIrompatchUninstall(hifDevice, rompatch_id);
- break;
- }
-
- case AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE:
- case AR6000_XIOCTL_BMI_ROMPATCH_DEACTIVATE:
- {
- u32 rompatch_count;
-
- if (get_user(rompatch_count, (u32 *)userdata)) {
- ret = -EFAULT;
- break;
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Change rompatch activation count=%d\n", rompatch_count));
- length = sizeof(u32) * rompatch_count;
- if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) {
- A_MEMZERO(buffer, length);
- if (copy_from_user(buffer, &userdata[sizeof(rompatch_count)], length))
- {
- ret = -EFAULT;
- } else {
- if (cmd == AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE) {
- ret = BMIrompatchActivate(hifDevice, rompatch_count, (u32 *)buffer);
- } else {
- ret = BMIrompatchDeactivate(hifDevice, rompatch_count, (u32 *)buffer);
- }
- }
- kfree(buffer);
- } else {
- ret = -ENOMEM;
- }
-
- break;
- }
- case AR6000_XIOCTL_SET_IP:
- {
- WMI_SET_IP_CMD setIP;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setIP, userdata,
- sizeof(setIP)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_ip_cmd(ar->arWmi,
- &setIP) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
-
- case AR6000_XIOCTL_WMI_SET_HOST_SLEEP_MODE:
- {
- WMI_SET_HOST_SLEEP_MODE_CMD setHostSleepMode;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setHostSleepMode, userdata,
- sizeof(setHostSleepMode)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_host_sleep_mode_cmd(ar->arWmi,
- &setHostSleepMode) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_SET_WOW_MODE:
- {
- WMI_SET_WOW_MODE_CMD setWowMode;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&setWowMode, userdata,
- sizeof(setWowMode)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_wow_mode_cmd(ar->arWmi,
- &setWowMode) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_GET_WOW_LIST:
- {
- WMI_GET_WOW_LIST_CMD getWowList;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&getWowList, userdata,
- sizeof(getWowList)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_get_wow_list_cmd(ar->arWmi,
- &getWowList) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_ADD_WOW_PATTERN:
- {
-#define WOW_PATTERN_SIZE 64
-#define WOW_MASK_SIZE 64
-
- WMI_ADD_WOW_PATTERN_CMD cmd;
- u8 mask_data[WOW_PATTERN_SIZE]={0};
- u8 pattern_data[WOW_PATTERN_SIZE]={0};
-
- do {
- if (ar->arWmiReady == false) {
- ret = -EIO;
- break;
- }
- if(copy_from_user(&cmd, userdata,
- sizeof(WMI_ADD_WOW_PATTERN_CMD)))
- {
- ret = -EFAULT;
- break;
- }
- if (copy_from_user(pattern_data,
- userdata + 3,
- cmd.filter_size))
- {
- ret = -EFAULT;
- break;
- }
- if (copy_from_user(mask_data,
- (userdata + 3 + cmd.filter_size),
- cmd.filter_size))
- {
- ret = -EFAULT;
- break;
- }
- if (wmi_add_wow_pattern_cmd(ar->arWmi,
- &cmd, pattern_data, mask_data, cmd.filter_size) != 0)
- {
- ret = -EIO;
- }
- } while(false);
-#undef WOW_PATTERN_SIZE
-#undef WOW_MASK_SIZE
- break;
- }
- case AR6000_XIOCTL_WMI_DEL_WOW_PATTERN:
- {
- WMI_DEL_WOW_PATTERN_CMD delWowPattern;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&delWowPattern, userdata,
- sizeof(delWowPattern)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_del_wow_pattern_cmd(ar->arWmi,
- &delWowPattern) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_DUMP_HTC_CREDIT_STATE:
- if (ar->arHtcTarget != NULL) {
-#ifdef ATH_DEBUG_MODULE
- HTCDumpCreditStates(ar->arHtcTarget);
-#endif /* ATH_DEBUG_MODULE */
-#ifdef HTC_EP_STAT_PROFILING
- {
- struct htc_endpoint_stats stats;
- int i;
-
- for (i = 0; i < 5; i++) {
- if (HTCGetEndpointStatistics(ar->arHtcTarget,
- i,
- HTC_EP_STAT_SAMPLE_AND_CLEAR,
- &stats)) {
- A_PRINTF(KERN_ALERT"------- Profiling Endpoint : %d \n", i);
- A_PRINTF(KERN_ALERT"TxCreditLowIndications : %d \n", stats.TxCreditLowIndications);
- A_PRINTF(KERN_ALERT"TxIssued : %d \n", stats.TxIssued);
- A_PRINTF(KERN_ALERT"TxDropped: %d \n", stats.TxDropped);
- A_PRINTF(KERN_ALERT"TxPacketsBundled : %d \n", stats.TxPacketsBundled);
- A_PRINTF(KERN_ALERT"TxBundles : %d \n", stats.TxBundles);
- A_PRINTF(KERN_ALERT"TxCreditRpts : %d \n", stats.TxCreditRpts);
- A_PRINTF(KERN_ALERT"TxCreditsRptsFromRx : %d \n", stats.TxCreditRptsFromRx);
- A_PRINTF(KERN_ALERT"TxCreditsRptsFromOther : %d \n", stats.TxCreditRptsFromOther);
- A_PRINTF(KERN_ALERT"TxCreditsRptsFromEp0 : %d \n", stats.TxCreditRptsFromEp0);
- A_PRINTF(KERN_ALERT"TxCreditsFromRx : %d \n", stats.TxCreditsFromRx);
- A_PRINTF(KERN_ALERT"TxCreditsFromOther : %d \n", stats.TxCreditsFromOther);
- A_PRINTF(KERN_ALERT"TxCreditsFromEp0 : %d \n", stats.TxCreditsFromEp0);
- A_PRINTF(KERN_ALERT"TxCreditsConsummed : %d \n", stats.TxCreditsConsummed);
- A_PRINTF(KERN_ALERT"TxCreditsReturned : %d \n", stats.TxCreditsReturned);
- A_PRINTF(KERN_ALERT"RxReceived : %d \n", stats.RxReceived);
- A_PRINTF(KERN_ALERT"RxPacketsBundled : %d \n", stats.RxPacketsBundled);
- A_PRINTF(KERN_ALERT"RxLookAheads : %d \n", stats.RxLookAheads);
- A_PRINTF(KERN_ALERT"RxBundleLookAheads : %d \n", stats.RxBundleLookAheads);
- A_PRINTF(KERN_ALERT"RxBundleIndFromHdr : %d \n", stats.RxBundleIndFromHdr);
- A_PRINTF(KERN_ALERT"RxAllocThreshHit : %d \n", stats.RxAllocThreshHit);
- A_PRINTF(KERN_ALERT"RxAllocThreshBytes : %d \n", stats.RxAllocThreshBytes);
- A_PRINTF(KERN_ALERT"---- \n");
-
- }
- }
- }
-#endif
- }
- break;
- case AR6000_XIOCTL_TRAFFIC_ACTIVITY_CHANGE:
- if (ar->arHtcTarget != NULL) {
- struct ar6000_traffic_activity_change data;
-
- if (copy_from_user(&data, userdata, sizeof(data)))
- {
- ret = -EFAULT;
- goto ioctl_done;
- }
- /* note, this is used for testing (mbox ping testing), indicate activity
- * change using the stream ID as the traffic class */
- ar6000_indicate_tx_activity(ar,
- (u8)data.StreamID,
- data.Active ? true : false);
- }
- break;
- case AR6000_XIOCTL_WMI_SET_CONNECT_CTRL_FLAGS:
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&connectCtrlFlags, userdata,
- sizeof(connectCtrlFlags)))
- {
- ret = -EFAULT;
- } else {
- ar->arConnectCtrlFlags = connectCtrlFlags;
- }
- break;
- case AR6000_XIOCTL_WMI_SET_AKMP_PARAMS:
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&akmpParams, userdata,
- sizeof(WMI_SET_AKMP_PARAMS_CMD)))
- {
- ret = -EFAULT;
- } else {
- if (wmi_set_akmp_params_cmd(ar->arWmi, &akmpParams) != 0) {
- ret = -EIO;
- }
- }
- break;
- case AR6000_XIOCTL_WMI_SET_PMKID_LIST:
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else {
- if (copy_from_user(&pmkidInfo.numPMKID, userdata,
- sizeof(pmkidInfo.numPMKID)))
- {
- ret = -EFAULT;
- break;
- }
- if (copy_from_user(&pmkidInfo.pmkidList,
- userdata + sizeof(pmkidInfo.numPMKID),
- pmkidInfo.numPMKID * sizeof(WMI_PMKID)))
- {
- ret = -EFAULT;
- break;
- }
- if (wmi_set_pmkid_list_cmd(ar->arWmi, &pmkidInfo) != 0) {
- ret = -EIO;
- }
- }
- break;
- case AR6000_XIOCTL_WMI_GET_PMKID_LIST:
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else {
- if (wmi_get_pmkid_list_cmd(ar->arWmi) != 0) {
- ret = -EIO;
- }
- }
- break;
- case AR6000_XIOCTL_WMI_ABORT_SCAN:
- if (ar->arWmiReady == false) {
- ret = -EIO;
- }
- ret = wmi_abort_scan_cmd(ar->arWmi);
- break;
- case AR6000_XIOCTL_AP_HIDDEN_SSID:
- {
- u8 hidden_ssid;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&hidden_ssid, userdata, sizeof(hidden_ssid))) {
- ret = -EFAULT;
- } else {
- wmi_ap_set_hidden_ssid(ar->arWmi, hidden_ssid);
- ar->ap_hidden_ssid = hidden_ssid;
- ar->ap_profile_flag = 1; /* There is a change in profile */
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_STA_LIST:
- {
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else {
- u8 i;
- ap_get_sta_t temp;
- A_MEMZERO(&temp, sizeof(temp));
- for(i=0;i<AP_MAX_NUM_STA;i++) {
- memcpy(temp.sta[i].mac, ar->sta_list[i].mac, ATH_MAC_LEN);
- temp.sta[i].aid = ar->sta_list[i].aid;
- temp.sta[i].keymgmt = ar->sta_list[i].keymgmt;
- temp.sta[i].ucipher = ar->sta_list[i].ucipher;
- temp.sta[i].auth = ar->sta_list[i].auth;
- }
- if(copy_to_user((ap_get_sta_t *)rq->ifr_data, &temp,
- sizeof(ar->sta_list))) {
- ret = -EFAULT;
- }
- }
- break;
- }
- case AR6000_XIOCTL_AP_SET_NUM_STA:
- {
- u8 num_sta;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&num_sta, userdata, sizeof(num_sta))) {
- ret = -EFAULT;
- } else if(num_sta > AP_MAX_NUM_STA) {
- /* value out of range */
- ret = -EINVAL;
- } else {
- wmi_ap_set_num_sta(ar->arWmi, num_sta);
- }
- break;
- }
- case AR6000_XIOCTL_AP_SET_ACL_POLICY:
- {
- u8 policy;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&policy, userdata, sizeof(policy))) {
- ret = -EFAULT;
- } else if(policy == ar->g_acl.policy) {
- /* No change in policy */
- } else {
- if(!(policy & AP_ACL_RETAIN_LIST_MASK)) {
- /* clear ACL list */
- memset(&ar->g_acl,0,sizeof(WMI_AP_ACL));
- }
- ar->g_acl.policy = policy;
- wmi_ap_set_acl_policy(ar->arWmi, policy);
- }
- break;
- }
- case AR6000_XIOCTL_AP_SET_ACL_MAC:
- {
- WMI_AP_ACL_MAC_CMD acl;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&acl, userdata, sizeof(acl))) {
- ret = -EFAULT;
- } else {
- if(acl_add_del_mac(&ar->g_acl, &acl)) {
- wmi_ap_acl_mac_list(ar->arWmi, &acl);
- } else {
- A_PRINTF("ACL list error\n");
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_ACL_LIST:
- {
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if(copy_to_user((WMI_AP_ACL *)rq->ifr_data, &ar->g_acl,
- sizeof(WMI_AP_ACL))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_AP_COMMIT_CONFIG:
- {
- ret = ar6000_ap_mode_profile_commit(ar);
- break;
- }
- case IEEE80211_IOCTL_GETWPAIE:
- {
- struct ieee80211req_wpaie wpaie;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&wpaie, userdata, sizeof(wpaie))) {
- ret = -EFAULT;
- } else if (ar6000_ap_mode_get_wpa_ie(ar, &wpaie)) {
- ret = -EFAULT;
- } else if(copy_to_user(userdata, &wpaie, sizeof(wpaie))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_AP_CONN_INACT_TIME:
- {
- u32 period;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&period, userdata, sizeof(period))) {
- ret = -EFAULT;
- } else {
- wmi_ap_conn_inact_time(ar->arWmi, period);
- }
- break;
- }
- case AR6000_XIOCTL_AP_PROT_SCAN_TIME:
- {
- WMI_AP_PROT_SCAN_TIME_CMD bgscan;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&bgscan, userdata, sizeof(bgscan))) {
- ret = -EFAULT;
- } else {
- wmi_ap_bgscan_time(ar->arWmi, bgscan.period_min, bgscan.dwell_ms);
- }
- break;
- }
- case AR6000_XIOCTL_AP_SET_COUNTRY:
- {
- ret = ar6000_ioctl_set_country(dev, rq);
- break;
- }
- case AR6000_XIOCTL_AP_SET_DTIM:
- {
- WMI_AP_SET_DTIM_CMD d;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&d, userdata, sizeof(d))) {
- ret = -EFAULT;
- } else {
- if(d.dtim > 0 && d.dtim < 11) {
- ar->ap_dtim_period = d.dtim;
- wmi_ap_set_dtim(ar->arWmi, d.dtim);
- ar->ap_profile_flag = 1; /* There is a change in profile */
- } else {
- A_PRINTF("DTIM out of range. Valid range is [1-10]\n");
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_WMI_TARGET_EVENT_REPORT:
- {
- WMI_SET_TARGET_EVENT_REPORT_CMD evtCfgCmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- }
- if (copy_from_user(&evtCfgCmd, userdata,
- sizeof(evtCfgCmd))) {
- ret = -EFAULT;
- break;
- }
- ret = wmi_set_target_event_report_cmd(ar->arWmi, &evtCfgCmd);
- break;
- }
- case AR6000_XIOCTL_AP_INTRA_BSS_COMM:
- {
- u8 intra=0;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&intra, userdata, sizeof(intra))) {
- ret = -EFAULT;
- } else {
- ar->intra_bss = (intra?1:0);
- }
- break;
- }
- case AR6000_XIOCTL_DUMP_MODULE_DEBUG_INFO:
- {
- struct drv_debug_module_s moduleinfo;
-
- if (copy_from_user(&moduleinfo, userdata, sizeof(moduleinfo))) {
- ret = -EFAULT;
- break;
- }
-
- a_dump_module_debug_info_by_name(moduleinfo.modulename);
- ret = 0;
- break;
- }
- case AR6000_XIOCTL_MODULE_DEBUG_SET_MASK:
- {
- struct drv_debug_module_s moduleinfo;
-
- if (copy_from_user(&moduleinfo, userdata, sizeof(moduleinfo))) {
- ret = -EFAULT;
- break;
- }
-
- if (a_set_module_mask(moduleinfo.modulename, moduleinfo.mask)) {
- ret = -EFAULT;
- }
-
- break;
- }
- case AR6000_XIOCTL_MODULE_DEBUG_GET_MASK:
- {
- struct drv_debug_module_s moduleinfo;
-
- if (copy_from_user(&moduleinfo, userdata, sizeof(moduleinfo))) {
- ret = -EFAULT;
- break;
- }
-
- if (a_get_module_mask(moduleinfo.modulename, &moduleinfo.mask)) {
- ret = -EFAULT;
- break;
- }
-
- if (copy_to_user(userdata, &moduleinfo, sizeof(moduleinfo))) {
- ret = -EFAULT;
- break;
- }
-
- break;
- }
-#ifdef ATH_AR6K_11N_SUPPORT
- case AR6000_XIOCTL_DUMP_RCV_AGGR_STATS:
- {
- PACKET_LOG *copy_of_pkt_log;
-
- aggr_dump_stats(ar->aggr_cntxt, &copy_of_pkt_log);
- if (copy_to_user(rq->ifr_data, copy_of_pkt_log, sizeof(PACKET_LOG))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_SETUP_AGGR:
- {
- WMI_ADDBA_REQ_CMD cmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- ret = -EFAULT;
- } else {
- wmi_setup_aggr_cmd(ar->arWmi, cmd.tid);
- }
- }
- break;
-
- case AR6000_XIOCTL_DELE_AGGR:
- {
- WMI_DELBA_REQ_CMD cmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- ret = -EFAULT;
- } else {
- wmi_delete_aggr_cmd(ar->arWmi, cmd.tid, cmd.is_sender_initiator);
- }
- }
- break;
-
- case AR6000_XIOCTL_ALLOW_AGGR:
- {
- WMI_ALLOW_AGGR_CMD cmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- ret = -EFAULT;
- } else {
- wmi_allow_aggr_cmd(ar->arWmi, cmd.tx_allow_aggr, cmd.rx_allow_aggr);
- }
- }
- break;
-
- case AR6000_XIOCTL_SET_HT_CAP:
- {
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&htCap, userdata,
- sizeof(htCap)))
- {
- ret = -EFAULT;
- } else {
-
- if (wmi_set_ht_cap_cmd(ar->arWmi, &htCap) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_SET_HT_OP:
- {
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&htOp, userdata,
- sizeof(htOp)))
- {
- ret = -EFAULT;
- } else {
-
- if (wmi_set_ht_op_cmd(ar->arWmi, htOp.sta_chan_width) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
-#endif
- case AR6000_XIOCTL_HCI_CMD:
- {
- char tmp_buf[512];
- s8 i;
- WMI_HCI_CMD *cmd = (WMI_HCI_CMD *)tmp_buf;
- u8 size;
-
- size = sizeof(cmd->cmd_buf_sz);
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(cmd, userdata, size)) {
- ret = -EFAULT;
- } else if(copy_from_user(cmd->buf, userdata + size, cmd->cmd_buf_sz)) {
- ret = -EFAULT;
- } else {
- if (wmi_send_hci_cmd(ar->arWmi, cmd->buf, cmd->cmd_buf_sz) != 0) {
- ret = -EIO;
- }else if(loghci) {
- A_PRINTF_LOG("HCI Command To PAL --> \n");
- for(i = 0; i < cmd->cmd_buf_sz; i++) {
- A_PRINTF_LOG("0x%02x ",cmd->buf[i]);
- if((i % 10) == 0) {
- A_PRINTF_LOG("\n");
- }
- }
- A_PRINTF_LOG("\n");
- A_PRINTF_LOG("==================================\n");
- }
- }
- break;
- }
- case AR6000_XIOCTL_WLAN_CONN_PRECEDENCE:
- {
- WMI_SET_BT_WLAN_CONN_PRECEDENCE cmd;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) {
- ret = -EFAULT;
- } else {
- if (cmd.precedence == BT_WLAN_CONN_PRECDENCE_WLAN ||
- cmd.precedence == BT_WLAN_CONN_PRECDENCE_PAL) {
- if ( wmi_set_wlan_conn_precedence_cmd(ar->arWmi, cmd.precedence) != 0) {
- ret = -EIO;
- }
- } else {
- ret = -EINVAL;
- }
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_STAT:
- {
- ret = ar6000_ioctl_get_ap_stats(dev, rq);
- break;
- }
- case AR6000_XIOCTL_SET_TX_SELECT_RATES:
- {
- WMI_SET_TX_SELECT_RATES_CMD masks;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&masks, userdata,
- sizeof(masks)))
- {
- ret = -EFAULT;
- } else {
-
- if (wmi_set_tx_select_rates_cmd(ar->arWmi, masks.rateMasks) != 0)
- {
- ret = -EIO;
- }
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_HIDDEN_SSID:
- {
- WMI_AP_HIDDEN_SSID_CMD ssid;
- ssid.hidden_ssid = ar->ap_hidden_ssid;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if(copy_to_user((WMI_AP_HIDDEN_SSID_CMD *)rq->ifr_data,
- &ssid, sizeof(WMI_AP_HIDDEN_SSID_CMD))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_COUNTRY:
- {
- WMI_AP_SET_COUNTRY_CMD cty;
- memcpy(cty.countryCode, ar->ap_country_code, 3);
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if(copy_to_user((WMI_AP_SET_COUNTRY_CMD *)rq->ifr_data,
- &cty, sizeof(WMI_AP_SET_COUNTRY_CMD))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_WMODE:
- {
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if(copy_to_user((u8 *)rq->ifr_data,
- &ar->ap_wmode, sizeof(u8))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_DTIM:
- {
- WMI_AP_SET_DTIM_CMD dtim;
- dtim.dtim = ar->ap_dtim_period;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if(copy_to_user((WMI_AP_SET_DTIM_CMD *)rq->ifr_data,
- &dtim, sizeof(WMI_AP_SET_DTIM_CMD))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_BINTVL:
- {
- WMI_BEACON_INT_CMD bi;
- bi.beaconInterval = ar->ap_beacon_interval;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if(copy_to_user((WMI_BEACON_INT_CMD *)rq->ifr_data,
- &bi, sizeof(WMI_BEACON_INT_CMD))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_AP_GET_RTS:
- {
- WMI_SET_RTS_CMD rts;
- rts.threshold = ar->arRTS;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if(copy_to_user((WMI_SET_RTS_CMD *)rq->ifr_data,
- &rts, sizeof(WMI_SET_RTS_CMD))) {
- ret = -EFAULT;
- }
- break;
- }
- case AR6000_XIOCTL_FETCH_TARGET_REGS:
- {
- u32 targregs[AR6003_FETCH_TARG_REGS_COUNT];
-
- if (ar->arTargetType == TARGET_TYPE_AR6003) {
- ar6k_FetchTargetRegs(hifDevice, targregs);
- if (copy_to_user((u32 *)rq->ifr_data, &targregs, sizeof(targregs)))
- {
- ret = -EFAULT;
- }
- } else {
- ret = -EOPNOTSUPP;
- }
- break;
- }
- case AR6000_XIOCTL_AP_SET_11BG_RATESET:
- {
- WMI_AP_SET_11BG_RATESET_CMD rate;
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&rate, userdata, sizeof(rate))) {
- ret = -EFAULT;
- } else {
- wmi_ap_set_rateset(ar->arWmi, rate.rateset);
- }
- break;
- }
- case AR6000_XIOCTL_GET_WLAN_SLEEP_STATE:
- {
- WMI_REPORT_SLEEP_STATE_EVENT wmiSleepEvent ;
-
- if (ar->arWlanState == WLAN_ENABLED) {
- wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_AWAKE;
- } else {
- wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP;
- }
- rq->ifr_ifru.ifru_ivalue = ar->arWlanState; /* return value */
-
- ar6000_send_event_to_app(ar, WMI_REPORT_SLEEP_STATE_EVENTID, (u8 *)&wmiSleepEvent,
- sizeof(WMI_REPORT_SLEEP_STATE_EVENTID));
- break;
- }
-#ifdef CONFIG_PM
- case AR6000_XIOCTL_SET_BT_HW_POWER_STATE:
- {
- unsigned int state;
- if (get_user(state, (unsigned int *)userdata)) {
- ret = -EFAULT;
- break;
- }
- if (ar6000_set_bt_hw_state(ar, state)!= 0) {
- ret = -EIO;
- }
- }
- break;
- case AR6000_XIOCTL_GET_BT_HW_POWER_STATE:
- rq->ifr_ifru.ifru_ivalue = !ar->arBTOff; /* return value */
- break;
-#endif
-
- case AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM:
- {
- WMI_SET_TX_SGI_PARAM_CMD SGICmd;
-
- if (ar->arWmiReady == false) {
- ret = -EIO;
- } else if (copy_from_user(&SGICmd, userdata,
- sizeof(SGICmd))){
- ret = -EFAULT;
- } else{
- if (wmi_SGI_cmd(ar->arWmi, SGICmd.sgiMask, SGICmd.sgiPERThreshold) != 0) {
- ret = -EIO;
- }
-
- }
- break;
- }
-
- case AR6000_XIOCTL_ADD_AP_INTERFACE:
-#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
- {
- char ap_ifname[IFNAMSIZ] = {0,};
- if (copy_from_user(ap_ifname, userdata, IFNAMSIZ)) {
- ret = -EFAULT;
- } else {
- if (ar6000_add_ap_interface(ar, ap_ifname) != 0) {
- ret = -EIO;
- }
- }
- }
-#else
- ret = -EOPNOTSUPP;
-#endif
- break;
- case AR6000_XIOCTL_REMOVE_AP_INTERFACE:
-#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
- if (ar6000_remove_ap_interface(ar) != 0) {
- ret = -EIO;
- }
-#else
- ret = -EOPNOTSUPP;
-#endif
- break;
-
- case AR6000_XIOCTL_WMI_SET_EXCESS_TX_RETRY_THRES:
- {
- ret = ar6000_xioctl_set_excess_tx_retry_thres_cmd(dev, userdata);
- break;
- }
-
- default:
- ret = -EOPNOTSUPP;
- }
-
-ioctl_done:
- rtnl_lock(); /* restore rtnl state */
- dev_put(dev);
-
- return ret;
-}
-
-u8 mac_cmp_wild(u8 *mac, u8 *new_mac, u8 wild, u8 new_wild)
-{
- u8 i;
-
- for(i=0;i<ATH_MAC_LEN;i++) {
- if((wild & 1<<i) && (new_wild & 1<<i)) continue;
- if(mac[i] != new_mac[i]) return 1;
- }
- if((memcmp(new_mac, null_mac, 6)==0) && new_wild &&
- (wild != new_wild)) {
- return 1;
- }
-
- return 0;
-}
-
-u8 acl_add_del_mac(WMI_AP_ACL *a, WMI_AP_ACL_MAC_CMD *acl)
-{
- s8 already_avail=-1, free_slot=-1, i;
-
- /* To check whether this mac is already there in our list */
- for(i=AP_ACL_SIZE-1;i>=0;i--)
- {
- if(mac_cmp_wild(a->acl_mac[i], acl->mac, a->wildcard[i],
- acl->wildcard)==0)
- already_avail = i;
-
- if(!((1 << i) & a->index))
- free_slot = i;
- }
-
- if(acl->action == ADD_MAC_ADDR)
- {
- /* Dont add mac if it is already available */
- if((already_avail >= 0) || (free_slot == -1))
- return 0;
-
- memcpy(a->acl_mac[free_slot], acl->mac, ATH_MAC_LEN);
- a->index = a->index | (1 << free_slot);
- acl->index = free_slot;
- a->wildcard[free_slot] = acl->wildcard;
- return 1;
- }
- else if(acl->action == DEL_MAC_ADDR)
- {
- if(acl->index > AP_ACL_SIZE)
- return 0;
-
- if(!(a->index & (1 << acl->index)))
- return 0;
-
- A_MEMZERO(a->acl_mac[acl->index],ATH_MAC_LEN);
- a->index = a->index & ~(1 << acl->index);
- a->wildcard[acl->index] = 0;
- return 1;
- }
-
- return 0;
-}
diff --git a/drivers/staging/ath6kl/os/linux/wireless_ext.c b/drivers/staging/ath6kl/os/linux/wireless_ext.c
deleted file mode 100644
index 5af09f1..0000000
--- a/drivers/staging/ath6kl/os/linux/wireless_ext.c
+++ /dev/null
@@ -1,2690 +0,0 @@
-//------------------------------------------------------------------------------
-// Copyright (c) 2004-2010 Atheros Communications Inc.
-// All rights reserved.
-//
-//
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//
-// Author(s): ="Atheros"
-//------------------------------------------------------------------------------
-
-#include "ar6000_drv.h"
-
-#define IWE_STREAM_ADD_EVENT(p1, p2, p3, p4, p5) \
- iwe_stream_add_event((p1), (p2), (p3), (p4), (p5))
-
-#define IWE_STREAM_ADD_POINT(p1, p2, p3, p4, p5) \
- iwe_stream_add_point((p1), (p2), (p3), (p4), (p5))
-
-#define IWE_STREAM_ADD_VALUE(p1, p2, p3, p4, p5, p6) \
- iwe_stream_add_value((p1), (p2), (p3), (p4), (p5), (p6))
-
-static void ar6000_set_quality(struct iw_quality *iq, s8 rssi);
-extern unsigned int wmitimeout;
-extern A_WAITQUEUE_HEAD arEvent;
-
-#if WIRELESS_EXT > 14
-/*
- * Encode a WPA or RSN information element as a custom
- * element using the hostap format.
- */
-static u_int
-encode_ie(void *buf, size_t bufsize,
- const u_int8_t *ie, size_t ielen,
- const char *leader, size_t leader_len)
-{
- u_int8_t *p;
- int i;
-
- if (bufsize < leader_len)
- return 0;
- p = buf;
- memcpy(p, leader, leader_len);
- bufsize -= leader_len;
- p += leader_len;
- for (i = 0; i < ielen && bufsize > 2; i++)
- {
- p += sprintf((char*)p, "%02x", ie[i]);
- bufsize -= 2;
- }
- return (i == ielen ? p - (u_int8_t *)buf : 0);
-}
-#endif /* WIRELESS_EXT > 14 */
-
-static u8 get_bss_phy_capability(bss_t *bss)
-{
- u8 capability = 0;
- struct ieee80211_common_ie *cie = &bss->ni_cie;
-#define CHAN_IS_11A(x) (!((x >= 2412) && (x <= 2484)))
- if (CHAN_IS_11A(cie->ie_chan)) {
- if (cie->ie_htcap) {
- capability = WMI_11NA_CAPABILITY;
- } else {
- capability = WMI_11A_CAPABILITY;
- }
- } else if ((cie->ie_erp) || (cie->ie_xrates)) {
- if (cie->ie_htcap) {
- capability = WMI_11NG_CAPABILITY;
- } else {
- capability = WMI_11G_CAPABILITY;
- }
- }
- return capability;
-}
-
-void
-ar6000_scan_node(void *arg, bss_t *ni)
-{
- struct iw_event iwe;
-#if WIRELESS_EXT > 14
- char buf[256];
-#endif
- struct ar_giwscan_param *param;
- char *current_ev;
- char *end_buf;
- struct ieee80211_common_ie *cie;
- char *current_val;
- s32 j;
- u32 rate_len, data_len = 0;
-
- param = (struct ar_giwscan_param *)arg;
-
- current_ev = param->current_ev;
- end_buf = param->end_buf;
-
- cie = &ni->ni_cie;
-
- if ((end_buf - current_ev) > IW_EV_ADDR_LEN)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = SIOCGIWAP;
- iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
- memcpy(iwe.u.ap_addr.sa_data, ni->ni_macaddr, 6);
- current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf,
- &iwe, IW_EV_ADDR_LEN);
- }
- param->bytes_needed += IW_EV_ADDR_LEN;
-
- data_len = cie->ie_ssid[1] + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = SIOCGIWESSID;
- iwe.u.data.flags = 1;
- iwe.u.data.length = cie->ie_ssid[1];
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf,
- &iwe, (char*)&cie->ie_ssid[2]);
- }
- param->bytes_needed += data_len;
-
- if (cie->ie_capInfo & (IEEE80211_CAPINFO_ESS|IEEE80211_CAPINFO_IBSS)) {
- if ((end_buf - current_ev) > IW_EV_UINT_LEN)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = SIOCGIWMODE;
- iwe.u.mode = cie->ie_capInfo & IEEE80211_CAPINFO_ESS ?
- IW_MODE_MASTER : IW_MODE_ADHOC;
- current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf,
- &iwe, IW_EV_UINT_LEN);
- }
- param->bytes_needed += IW_EV_UINT_LEN;
- }
-
- if ((end_buf - current_ev) > IW_EV_FREQ_LEN)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = SIOCGIWFREQ;
- iwe.u.freq.m = cie->ie_chan * 100000;
- iwe.u.freq.e = 1;
- current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf,
- &iwe, IW_EV_FREQ_LEN);
- }
- param->bytes_needed += IW_EV_FREQ_LEN;
-
- if ((end_buf - current_ev) > IW_EV_QUAL_LEN)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVQUAL;
- ar6000_set_quality(&iwe.u.qual, ni->ni_snr);
- current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf,
- &iwe, IW_EV_QUAL_LEN);
- }
- param->bytes_needed += IW_EV_QUAL_LEN;
-
- if ((end_buf - current_ev) > IW_EV_POINT_LEN)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = SIOCGIWENCODE;
- if (cie->ie_capInfo & IEEE80211_CAPINFO_PRIVACY) {
- iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
- } else {
- iwe.u.data.flags = IW_ENCODE_DISABLED;
- }
- iwe.u.data.length = 0;
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf,
- &iwe, "");
- }
- param->bytes_needed += IW_EV_POINT_LEN;
-
- /* supported bit rate */
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = SIOCGIWRATE;
- iwe.u.bitrate.fixed = 0;
- iwe.u.bitrate.disabled = 0;
- iwe.u.bitrate.value = 0;
- current_val = current_ev + IW_EV_LCP_LEN;
- param->bytes_needed += IW_EV_LCP_LEN;
-
- if (cie->ie_rates != NULL) {
- rate_len = cie->ie_rates[1];
- data_len = (rate_len * (IW_EV_PARAM_LEN - IW_EV_LCP_LEN));
- if ((end_buf - current_ev) > data_len)
- {
- for (j = 0; j < rate_len; j++) {
- unsigned char val;
- val = cie->ie_rates[2 + j];
- iwe.u.bitrate.value =
- (val >= 0x80)? ((val - 0x80) * 500000): (val * 500000);
- current_val = IWE_STREAM_ADD_VALUE(param->info, current_ev,
- current_val, end_buf,
- &iwe, IW_EV_PARAM_LEN);
- }
- }
- param->bytes_needed += data_len;
- }
-
- if (cie->ie_xrates != NULL) {
- rate_len = cie->ie_xrates[1];
- data_len = (rate_len * (IW_EV_PARAM_LEN - IW_EV_LCP_LEN));
- if ((end_buf - current_ev) > data_len)
- {
- for (j = 0; j < rate_len; j++) {
- unsigned char val;
- val = cie->ie_xrates[2 + j];
- iwe.u.bitrate.value =
- (val >= 0x80)? ((val - 0x80) * 500000): (val * 500000);
- current_val = IWE_STREAM_ADD_VALUE(param->info, current_ev,
- current_val, end_buf,
- &iwe, IW_EV_PARAM_LEN);
- }
- }
- param->bytes_needed += data_len;
- }
- /* remove fixed header if no rates were added */
- if ((current_val - current_ev) > IW_EV_LCP_LEN)
- current_ev = current_val;
-
-#if WIRELESS_EXT >= 18
- /* IE */
- if (cie->ie_wpa != NULL) {
- data_len = cie->ie_wpa[1] + 2 + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVGENIE;
- iwe.u.data.length = cie->ie_wpa[1] + 2;
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf,
- &iwe, (char*)cie->ie_wpa);
- }
- param->bytes_needed += data_len;
- }
-
- if (cie->ie_rsn != NULL && cie->ie_rsn[0] == IEEE80211_ELEMID_RSN) {
- data_len = cie->ie_rsn[1] + 2 + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVGENIE;
- iwe.u.data.length = cie->ie_rsn[1] + 2;
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf,
- &iwe, (char*)cie->ie_rsn);
- }
- param->bytes_needed += data_len;
- }
-
-#endif /* WIRELESS_EXT >= 18 */
-
- if ((end_buf - current_ev) > IW_EV_CHAR_LEN)
- {
- /* protocol */
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = SIOCGIWNAME;
- switch (get_bss_phy_capability(ni)) {
- case WMI_11A_CAPABILITY:
- snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11a");
- break;
- case WMI_11G_CAPABILITY:
- snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11g");
- break;
- case WMI_11NA_CAPABILITY:
- snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11na");
- break;
- case WMI_11NG_CAPABILITY:
- snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11ng");
- break;
- default:
- snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b");
- break;
- }
- current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf,
- &iwe, IW_EV_CHAR_LEN);
- }
- param->bytes_needed += IW_EV_CHAR_LEN;
-
-#if WIRELESS_EXT > 14
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- iwe.u.data.length = snprintf(buf, sizeof(buf), "bcn_int=%d", cie->ie_beaconInt);
- data_len = iwe.u.data.length + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf,
- &iwe, buf);
- }
- param->bytes_needed += data_len;
-
-#if WIRELESS_EXT < 18
- if (cie->ie_wpa != NULL) {
- static const char wpa_leader[] = "wpa_ie=";
- data_len = (sizeof(wpa_leader) - 1) + ((cie->ie_wpa[1]+2) * 2) + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_wpa,
- cie->ie_wpa[1]+2,
- wpa_leader, sizeof(wpa_leader)-1);
-
- if (iwe.u.data.length != 0) {
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev,
- end_buf, &iwe, buf);
- }
- }
- param->bytes_needed += data_len;
- }
-
- if (cie->ie_rsn != NULL && cie->ie_rsn[0] == IEEE80211_ELEMID_RSN) {
- static const char rsn_leader[] = "rsn_ie=";
- data_len = (sizeof(rsn_leader) - 1) + ((cie->ie_rsn[1]+2) * 2) + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_rsn,
- cie->ie_rsn[1]+2,
- rsn_leader, sizeof(rsn_leader)-1);
-
- if (iwe.u.data.length != 0) {
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev,
- end_buf, &iwe, buf);
- }
- }
- param->bytes_needed += data_len;
- }
-#endif /* WIRELESS_EXT < 18 */
-
- if (cie->ie_wmm != NULL) {
- static const char wmm_leader[] = "wmm_ie=";
- data_len = (sizeof(wmm_leader) - 1) + ((cie->ie_wmm[1]+2) * 2) + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_wmm,
- cie->ie_wmm[1]+2,
- wmm_leader, sizeof(wmm_leader)-1);
- if (iwe.u.data.length != 0) {
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev,
- end_buf, &iwe, buf);
- }
- }
- param->bytes_needed += data_len;
- }
-
- if (cie->ie_ath != NULL) {
- static const char ath_leader[] = "ath_ie=";
- data_len = (sizeof(ath_leader) - 1) + ((cie->ie_ath[1]+2) * 2) + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_ath,
- cie->ie_ath[1]+2,
- ath_leader, sizeof(ath_leader)-1);
- if (iwe.u.data.length != 0) {
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev,
- end_buf, &iwe, buf);
- }
- }
- param->bytes_needed += data_len;
- }
-
-#ifdef WAPI_ENABLE
- if (cie->ie_wapi != NULL) {
- static const char wapi_leader[] = "wapi_ie=";
- data_len = (sizeof(wapi_leader) - 1) + ((cie->ie_wapi[1] + 2) * 2) + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len) {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_wapi,
- cie->ie_wapi[1] + 2,
- wapi_leader, sizeof(wapi_leader) - 1);
- if (iwe.u.data.length != 0) {
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev,
- end_buf, &iwe, buf);
- }
- }
- param->bytes_needed += data_len;
- }
-#endif /* WAPI_ENABLE */
-
-#endif /* WIRELESS_EXT > 14 */
-
-#if WIRELESS_EXT >= 18
- if (cie->ie_wsc != NULL) {
- data_len = (cie->ie_wsc[1] + 2) + IW_EV_POINT_LEN;
- if ((end_buf - current_ev) > data_len)
- {
- A_MEMZERO(&iwe, sizeof(iwe));
- iwe.cmd = IWEVGENIE;
- iwe.u.data.length = cie->ie_wsc[1] + 2;
- current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf,
- &iwe, (char*)cie->ie_wsc);
- }
- param->bytes_needed += data_len;
- }
-#endif /* WIRELESS_EXT >= 18 */
-
- param->current_ev = current_ev;
-}
-
-int
-ar6000_ioctl_giwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- struct ar_giwscan_param param;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- param.current_ev = extra;
- param.end_buf = extra + data->length;
- param.bytes_needed = 0;
- param.info = info;
-
- /* Translate data to WE format */
- wmi_iterate_nodes(ar->arWmi, ar6000_scan_node, &param);
-
- /* check if bytes needed is greater than bytes consumed */
- if (param.bytes_needed > (param.current_ev - extra))
- {
- /* Request one byte more than needed, because when "data->length" equals bytes_needed,
- it is not possible to add the last event data as all iwe_stream_add_xxxxx() functions
- checks whether (cur_ptr + ev_len) < end_ptr, due to this one more retry would happen*/
- data->length = param.bytes_needed + 1;
-
- return -E2BIG;
- }
-
- return 0;
-}
-
-extern int reconnect_flag;
-/* SIOCSIWESSID */
-static int
-ar6000_ioctl_siwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *ssid)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- int status;
- u8 arNetworkType;
- u8 prevMode = ar->arNetworkType;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
-#if defined(WIRELESS_EXT)
- if (WIRELESS_EXT >= 20) {
- data->length += 1;
- }
-#endif
-
- /*
- * iwconfig passes a null terminated string with length including this
- * so we need to account for this
- */
- if (data->flags && (!data->length || (data->length == 1) ||
- ((data->length - 1) > sizeof(ar->arSsid))))
- {
- /*
- * ssid is invalid
- */
- return -EINVAL;
- }
-
- if (ar->arNextMode == AP_NETWORK) {
- /* SSID change for AP network - Will take effect on commit */
- if(memcmp(ar->arSsid,ssid,32) != 0) {
- ar->arSsidLen = data->length - 1;
- memcpy(ar->arSsid, ssid, ar->arSsidLen);
- ar->ap_profile_flag = 1; /* There is a change in profile */
- }
- return 0;
- } else if(ar->arNetworkType == AP_NETWORK) {
- u8 ctr;
- struct sk_buff *skb;
-
- /* We are switching from AP to STA | IBSS mode, cleanup the AP state */
- for (ctr=0; ctr < AP_MAX_NUM_STA; ctr++) {
- remove_sta(ar, ar->sta_list[ctr].mac, 0);
- }
- A_MUTEX_LOCK(&ar->mcastpsqLock);
- while (!A_NETBUF_QUEUE_EMPTY(&ar->mcastpsq)) {
- skb = A_NETBUF_DEQUEUE(&ar->mcastpsq);
- A_NETBUF_FREE(skb);
- }
- A_MUTEX_UNLOCK(&ar->mcastpsqLock);
- }
-
- /* Added for bug 25178, return an IOCTL error instead of target returning
- Illegal parameter error when either the BSSID or channel is missing
- and we cannot scan during connect.
- */
- if (data->flags) {
- if (ar->arSkipScan == true &&
- (ar->arChannelHint == 0 ||
- (!ar->arReqBssid[0] && !ar->arReqBssid[1] && !ar->arReqBssid[2] &&
- !ar->arReqBssid[3] && !ar->arReqBssid[4] && !ar->arReqBssid[5])))
- {
- return -EINVAL;
- }
- }
-
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- if (ar->bIsDestroyProgress || ar->arWlanState == WLAN_DISABLED) {
- up(&ar->arSem);
- return -EBUSY;
- }
-
- if (ar->arTxPending[wmi_get_control_ep(ar->arWmi)]) {
- /*
- * sleep until the command queue drains
- */
- wait_event_interruptible_timeout(arEvent,
- ar->arTxPending[wmi_get_control_ep(ar->arWmi)] == 0, wmitimeout * HZ);
- if (signal_pending(current)) {
- return -EINTR;
- }
- }
-
- if (!data->flags) {
- arNetworkType = ar->arNetworkType;
-#ifdef ATH6K_CONFIG_CFG80211
- if (ar->arConnected) {
-#endif /* ATH6K_CONFIG_CFG80211 */
- ar6000_init_profile_info(ar);
-#ifdef ATH6K_CONFIG_CFG80211
- }
-#endif /* ATH6K_CONFIG_CFG80211 */
- ar->arNetworkType = arNetworkType;
- }
-
- /* Update the arNetworkType */
- ar->arNetworkType = ar->arNextMode;
-
- if ((prevMode != AP_NETWORK) &&
- ((ar->arSsidLen) ||
- ((ar->arSsidLen == 0) && (ar->arConnected || ar->arConnectPending)) ||
- (!data->flags)))
- {
- if ((!data->flags) ||
- (memcmp(ar->arSsid, ssid, ar->arSsidLen) != 0) ||
- (ar->arSsidLen != (data->length - 1)))
- {
- /*
- * SSID set previously or essid off has been issued.
- *
- * Disconnect Command is issued in two cases after wmi is ready
- * (1) ssid is different from the previous setting
- * (2) essid off has been issued
- *
- */
- if (ar->arWmiReady == true) {
- reconnect_flag = 0;
- status = wmi_setPmkid_cmd(ar->arWmi, ar->arBssid, NULL, 0);
- ar6000_disconnect(ar);
- A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
- ar->arSsidLen = 0;
- if (ar->arSkipScan == false) {
- A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid));
- }
- if (!data->flags) {
- up(&ar->arSem);
- return 0;
- }
- } else {
- up(&ar->arSem);
- }
- }
- else
- {
- /*
- * SSID is same, so we assume profile hasn't changed.
- * If the interface is up and wmi is ready, we issue
- * a reconnect cmd. Issue a reconnect only we are already
- * connected.
- */
- if((ar->arConnected == true) && (ar->arWmiReady == true))
- {
- reconnect_flag = true;
- status = wmi_reconnect_cmd(ar->arWmi,ar->arReqBssid,
- ar->arChannelHint);
- up(&ar->arSem);
- if (status) {
- return -EIO;
- }
- return 0;
- }
- else{
- /*
- * Dont return if connect is pending.
- */
- if(!(ar->arConnectPending)) {
- up(&ar->arSem);
- return 0;
- }
- }
- }
- }
-
- ar->arSsidLen = data->length - 1;
- memcpy(ar->arSsid, ssid, ar->arSsidLen);
-
- if (ar6000_connect_to_ap(ar)!= 0) {
- up(&ar->arSem);
- return -EIO;
- }else{
- up(&ar->arSem);
- }
- return 0;
-}
-
-/* SIOCGIWESSID */
-static int
-ar6000_ioctl_giwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *essid)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (!ar->arSsidLen) {
- return -EINVAL;
- }
-
- data->flags = 1;
- data->length = ar->arSsidLen;
- memcpy(essid, ar->arSsid, ar->arSsidLen);
-
- return 0;
-}
-
-
-void ar6000_install_static_wep_keys(struct ar6_softc *ar)
-{
- u8 index;
- u8 keyUsage;
-
- for (index = WMI_MIN_KEY_INDEX; index <= WMI_MAX_KEY_INDEX; index++) {
- if (ar->arWepKeyList[index].arKeyLen) {
- keyUsage = GROUP_USAGE;
- if (index == ar->arDefTxKeyIndex) {
- keyUsage |= TX_USAGE;
- }
- wmi_addKey_cmd(ar->arWmi,
- index,
- WEP_CRYPT,
- keyUsage,
- ar->arWepKeyList[index].arKeyLen,
- NULL,
- ar->arWepKeyList[index].arKey, KEY_OP_INIT_VAL, NULL,
- NO_SYNC_WMIFLAG);
- }
- }
-}
-
-/*
- * SIOCSIWRATE
- */
-int
-ar6000_ioctl_siwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *rrq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- u32 kbps;
- s8 rate_idx;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (rrq->fixed) {
- kbps = rrq->value / 1000; /* rrq->value is in bps */
- } else {
- kbps = -1; /* -1 indicates auto rate */
- }
- if(kbps != -1 && wmi_validate_bitrate(ar->arWmi, kbps, &rate_idx) != 0)
- {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BitRate is not Valid %d\n", kbps));
- return -EINVAL;
- }
- ar->arBitRate = kbps;
- if(ar->arWmiReady == true)
- {
- if (wmi_set_bitrate_cmd(ar->arWmi, kbps, -1, -1) != 0) {
- return -EINVAL;
- }
- }
- return 0;
-}
-
-/*
- * SIOCGIWRATE
- */
-int
-ar6000_ioctl_giwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *rrq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- int ret = 0;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if ((ar->arNextMode != AP_NETWORK && !ar->arConnected) || ar->arWmiReady == false) {
- rrq->value = 1000 * 1000;
- return 0;
- }
-
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- if (ar->bIsDestroyProgress || ar->arWlanState == WLAN_DISABLED) {
- up(&ar->arSem);
- return -EBUSY;
- }
-
- ar->arBitRate = 0xFFFF;
- if (wmi_get_bitrate_cmd(ar->arWmi) != 0) {
- up(&ar->arSem);
- return -EIO;
- }
- wait_event_interruptible_timeout(arEvent, ar->arBitRate != 0xFFFF, wmitimeout * HZ);
- if (signal_pending(current)) {
- ret = -EINTR;
- }
- /* If the interface is down or wmi is not ready or the target is not
- connected - return the value stored in the device structure */
- if (!ret) {
- if (ar->arBitRate == -1) {
- rrq->fixed = true;
- rrq->value = 0;
- } else {
- rrq->value = ar->arBitRate * 1000;
- }
- }
-
- up(&ar->arSem);
-
- return ret;
-}
-
-/*
- * SIOCSIWTXPOW
- */
-static int
-ar6000_ioctl_siwtxpow(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *rrq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- u8 dbM;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (rrq->disabled) {
- return -EOPNOTSUPP;
- }
-
- if (rrq->fixed) {
- if (rrq->flags != IW_TXPOW_DBM) {
- return -EOPNOTSUPP;
- }
- ar->arTxPwr= dbM = rrq->value;
- ar->arTxPwrSet = true;
- } else {
- ar->arTxPwr = dbM = 0;
- ar->arTxPwrSet = false;
- }
- if(ar->arWmiReady == true)
- {
- AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("Set tx pwr cmd %d dbM\n", dbM));
- wmi_set_txPwr_cmd(ar->arWmi, dbM);
- }
- return 0;
-}
-
-/*
- * SIOCGIWTXPOW
- */
-int
-ar6000_ioctl_giwtxpow(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *rrq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- int ret = 0;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- return -EBUSY;
- }
-
- if((ar->arWmiReady == true) && (ar->arConnected == true))
- {
- ar->arTxPwr = 0;
-
- if (wmi_get_txPwr_cmd(ar->arWmi) != 0) {
- up(&ar->arSem);
- return -EIO;
- }
-
- wait_event_interruptible_timeout(arEvent, ar->arTxPwr != 0, wmitimeout * HZ);
-
- if (signal_pending(current)) {
- ret = -EINTR;
- }
- }
- /* If the interace is down or wmi is not ready or target is not connected
- then return value stored in the device structure */
-
- if (!ret) {
- if (ar->arTxPwrSet == true) {
- rrq->fixed = true;
- }
- rrq->value = ar->arTxPwr;
- rrq->flags = IW_TXPOW_DBM;
- //
- // IWLIST need this flag to get TxPower
- //
- rrq->disabled = 0;
- }
-
- up(&ar->arSem);
-
- return ret;
-}
-
-/*
- * SIOCSIWRETRY
- * since iwconfig only provides us with one max retry value, we use it
- * to apply to data frames of the BE traffic class.
- */
-static int
-ar6000_ioctl_siwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *rrq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (rrq->disabled) {
- return -EOPNOTSUPP;
- }
-
- if ((rrq->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) {
- return -EOPNOTSUPP;
- }
-
- if ( !(rrq->value >= WMI_MIN_RETRIES) || !(rrq->value <= WMI_MAX_RETRIES)) {
- return - EINVAL;
- }
- if(ar->arWmiReady == true)
- {
- if (wmi_set_retry_limits_cmd(ar->arWmi, DATA_FRAMETYPE, WMM_AC_BE,
- rrq->value, 0) != 0){
- return -EINVAL;
- }
- }
- ar->arMaxRetries = rrq->value;
- return 0;
-}
-
-/*
- * SIOCGIWRETRY
- */
-static int
-ar6000_ioctl_giwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *rrq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- rrq->disabled = 0;
- switch (rrq->flags & IW_RETRY_TYPE) {
- case IW_RETRY_LIFETIME:
- return -EOPNOTSUPP;
- break;
- case IW_RETRY_LIMIT:
- rrq->flags = IW_RETRY_LIMIT;
- switch (rrq->flags & IW_RETRY_MODIFIER) {
- case IW_RETRY_MIN:
- rrq->flags |= IW_RETRY_MIN;
- rrq->value = WMI_MIN_RETRIES;
- break;
- case IW_RETRY_MAX:
- rrq->flags |= IW_RETRY_MAX;
- rrq->value = ar->arMaxRetries;
- break;
- }
- break;
- }
- return 0;
-}
-
-/*
- * SIOCSIWENCODE
- */
-static int
-ar6000_ioctl_siwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq, char *keybuf)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- int index;
- s32 auth = 0;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if(ar->arNextMode != AP_NETWORK) {
- /*
- * Static WEP Keys should be configured before setting the SSID
- */
- if (ar->arSsid[0] && erq->length) {
- return -EIO;
- }
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- index = erq->flags & IW_ENCODE_INDEX;
-
- if (index && (((index - 1) < WMI_MIN_KEY_INDEX) ||
- ((index - 1) > WMI_MAX_KEY_INDEX)))
- {
- return -EIO;
- }
-
- if (erq->flags & IW_ENCODE_DISABLED) {
- /*
- * Encryption disabled
- */
- if (index) {
- /*
- * If key index was specified then clear the specified key
- */
- index--;
- A_MEMZERO(ar->arWepKeyList[index].arKey,
- sizeof(ar->arWepKeyList[index].arKey));
- ar->arWepKeyList[index].arKeyLen = 0;
- }
- ar->arDot11AuthMode = OPEN_AUTH;
- ar->arPairwiseCrypto = NONE_CRYPT;
- ar->arGroupCrypto = NONE_CRYPT;
- ar->arAuthMode = NONE_AUTH;
- } else {
- /*
- * Enabling WEP encryption
- */
- if (index) {
- index--; /* keyindex is off base 1 in iwconfig */
- }
-
- if (erq->flags & IW_ENCODE_OPEN) {
- auth |= OPEN_AUTH;
- ar->arDefTxKeyIndex = index;
- }
- if (erq->flags & IW_ENCODE_RESTRICTED) {
- auth |= SHARED_AUTH;
- }
-
- if (!auth) {
- auth = OPEN_AUTH;
- }
-
- if (erq->length) {
- if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(erq->length)) {
- return -EIO;
- }
-
- A_MEMZERO(ar->arWepKeyList[index].arKey,
- sizeof(ar->arWepKeyList[index].arKey));
- memcpy(ar->arWepKeyList[index].arKey, keybuf, erq->length);
- ar->arWepKeyList[index].arKeyLen = erq->length;
- ar->arDot11AuthMode = auth;
- } else {
- if (ar->arWepKeyList[index].arKeyLen == 0) {
- return -EIO;
- }
- ar->arDefTxKeyIndex = index;
-
- if(ar->arSsidLen && ar->arWepKeyList[index].arKeyLen) {
- wmi_addKey_cmd(ar->arWmi,
- index,
- WEP_CRYPT,
- GROUP_USAGE | TX_USAGE,
- ar->arWepKeyList[index].arKeyLen,
- NULL,
- ar->arWepKeyList[index].arKey, KEY_OP_INIT_VAL, NULL,
- NO_SYNC_WMIFLAG);
- }
- }
-
- ar->arPairwiseCrypto = WEP_CRYPT;
- ar->arGroupCrypto = WEP_CRYPT;
- ar->arAuthMode = NONE_AUTH;
- }
-
- if(ar->arNextMode != AP_NETWORK) {
- /*
- * profile has changed. Erase ssid to signal change
- */
- A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
- ar->arSsidLen = 0;
- }
- ar->ap_profile_flag = 1; /* There is a change in profile */
- return 0;
-}
-
-static int
-ar6000_ioctl_giwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq, char *key)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- u8 keyIndex;
- struct ar_wep_key *wk;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (ar->arPairwiseCrypto == NONE_CRYPT) {
- erq->length = 0;
- erq->flags = IW_ENCODE_DISABLED;
- } else {
- if (ar->arPairwiseCrypto == WEP_CRYPT) {
- /* get the keyIndex */
- keyIndex = erq->flags & IW_ENCODE_INDEX;
- if (0 == keyIndex) {
- keyIndex = ar->arDefTxKeyIndex;
- } else if ((keyIndex - 1 < WMI_MIN_KEY_INDEX) ||
- (keyIndex - 1 > WMI_MAX_KEY_INDEX))
- {
- keyIndex = WMI_MIN_KEY_INDEX;
- } else {
- keyIndex--;
- }
- erq->flags = keyIndex + 1;
- erq->flags &= ~IW_ENCODE_DISABLED;
- wk = &ar->arWepKeyList[keyIndex];
- if (erq->length > wk->arKeyLen) {
- erq->length = wk->arKeyLen;
- }
- if (wk->arKeyLen) {
- memcpy(key, wk->arKey, erq->length);
- }
- } else {
- erq->flags &= ~IW_ENCODE_DISABLED;
- if (ar->user_saved_keys.keyOk) {
- erq->length = ar->user_saved_keys.ucast_ik.ik_keylen;
- if (erq->length) {
- memcpy(key, ar->user_saved_keys.ucast_ik.ik_keydata, erq->length);
- }
- } else {
- erq->length = 1; // not really printing any key but let iwconfig know enc is on
- }
- }
-
- if (ar->arDot11AuthMode & OPEN_AUTH) {
- erq->flags |= IW_ENCODE_OPEN;
- }
- if (ar->arDot11AuthMode & SHARED_AUTH) {
- erq->flags |= IW_ENCODE_RESTRICTED;
- }
- }
-
- return 0;
-}
-
-#if WIRELESS_EXT >= 18
-/*
- * SIOCSIWGENIE
- */
-static int
-ar6000_ioctl_siwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
-#ifdef WAPI_ENABLE
- u8 *ie = erq->pointer;
- u8 ie_type = ie[0];
- u16 ie_length = erq->length;
- u8 wapi_ie[128];
-#endif
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-#ifdef WAPI_ENABLE
- if (ie_type == IEEE80211_ELEMID_WAPI) {
- if (ie_length > 0) {
- if (copy_from_user(wapi_ie, ie, ie_length)) {
- return -EIO;
- }
- }
- wmi_set_appie_cmd(ar->arWmi, WMI_FRAME_ASSOC_REQ, ie_length, wapi_ie);
- } else if (ie_length == 0) {
- wmi_set_appie_cmd(ar->arWmi, WMI_FRAME_ASSOC_REQ, ie_length, wapi_ie);
- }
-#endif
- return 0;
-}
-
-
-/*
- * SIOCGIWGENIE
- */
-static int
-ar6000_ioctl_giwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
- erq->length = 0;
- erq->flags = 0;
-
- return 0;
-}
-
-/*
- * SIOCSIWAUTH
- */
-static int
-ar6000_ioctl_siwauth(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *data, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- bool profChanged;
- u16 param;
- s32 ret;
- s32 value;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- param = data->flags & IW_AUTH_INDEX;
- value = data->value;
- profChanged = true;
- ret = 0;
-
- switch (param) {
- case IW_AUTH_WPA_VERSION:
- if (value & IW_AUTH_WPA_VERSION_DISABLED) {
- ar->arAuthMode = NONE_AUTH;
- } else if (value & IW_AUTH_WPA_VERSION_WPA) {
- ar->arAuthMode = WPA_AUTH;
- } else if (value & IW_AUTH_WPA_VERSION_WPA2) {
- ar->arAuthMode = WPA2_AUTH;
- } else {
- ret = -1;
- profChanged = false;
- }
- break;
- case IW_AUTH_CIPHER_PAIRWISE:
- if (value & IW_AUTH_CIPHER_NONE) {
- ar->arPairwiseCrypto = NONE_CRYPT;
- ar->arPairwiseCryptoLen = 0;
- } else if (value & IW_AUTH_CIPHER_WEP40) {
- ar->arPairwiseCrypto = WEP_CRYPT;
- ar->arPairwiseCryptoLen = 5;
- } else if (value & IW_AUTH_CIPHER_TKIP) {
- ar->arPairwiseCrypto = TKIP_CRYPT;
- ar->arPairwiseCryptoLen = 0;
- } else if (value & IW_AUTH_CIPHER_CCMP) {
- ar->arPairwiseCrypto = AES_CRYPT;
- ar->arPairwiseCryptoLen = 0;
- } else if (value & IW_AUTH_CIPHER_WEP104) {
- ar->arPairwiseCrypto = WEP_CRYPT;
- ar->arPairwiseCryptoLen = 13;
- } else {
- ret = -1;
- profChanged = false;
- }
- break;
- case IW_AUTH_CIPHER_GROUP:
- if (value & IW_AUTH_CIPHER_NONE) {
- ar->arGroupCrypto = NONE_CRYPT;
- ar->arGroupCryptoLen = 0;
- } else if (value & IW_AUTH_CIPHER_WEP40) {
- ar->arGroupCrypto = WEP_CRYPT;
- ar->arGroupCryptoLen = 5;
- } else if (value & IW_AUTH_CIPHER_TKIP) {
- ar->arGroupCrypto = TKIP_CRYPT;
- ar->arGroupCryptoLen = 0;
- } else if (value & IW_AUTH_CIPHER_CCMP) {
- ar->arGroupCrypto = AES_CRYPT;
- ar->arGroupCryptoLen = 0;
- } else if (value & IW_AUTH_CIPHER_WEP104) {
- ar->arGroupCrypto = WEP_CRYPT;
- ar->arGroupCryptoLen = 13;
- } else {
- ret = -1;
- profChanged = false;
- }
- break;
- case IW_AUTH_KEY_MGMT:
- if (value & IW_AUTH_KEY_MGMT_PSK) {
- if (WPA_AUTH == ar->arAuthMode) {
- ar->arAuthMode = WPA_PSK_AUTH;
- } else if (WPA2_AUTH == ar->arAuthMode) {
- ar->arAuthMode = WPA2_PSK_AUTH;
- } else {
- ret = -1;
- }
- } else if (!(value & IW_AUTH_KEY_MGMT_802_1X)) {
- ar->arAuthMode = NONE_AUTH;
- }
- break;
- case IW_AUTH_TKIP_COUNTERMEASURES:
- wmi_set_tkip_countermeasures_cmd(ar->arWmi, value);
- profChanged = false;
- break;
- case IW_AUTH_DROP_UNENCRYPTED:
- profChanged = false;
- break;
- case IW_AUTH_80211_AUTH_ALG:
- ar->arDot11AuthMode = 0;
- if (value & IW_AUTH_ALG_OPEN_SYSTEM) {
- ar->arDot11AuthMode |= OPEN_AUTH;
- }
- if (value & IW_AUTH_ALG_SHARED_KEY) {
- ar->arDot11AuthMode |= SHARED_AUTH;
- }
- if (value & IW_AUTH_ALG_LEAP) {
- ar->arDot11AuthMode = LEAP_AUTH;
- }
- if(ar->arDot11AuthMode == 0) {
- ret = -1;
- profChanged = false;
- }
- break;
- case IW_AUTH_WPA_ENABLED:
- if (!value) {
- ar->arAuthMode = NONE_AUTH;
- /* when the supplicant is stopped, it calls this
- * handler with value=0. The followings need to be
- * reset if the STA were to connect again
- * without security
- */
- ar->arDot11AuthMode = OPEN_AUTH;
- ar->arPairwiseCrypto = NONE_CRYPT;
- ar->arPairwiseCryptoLen = 0;
- ar->arGroupCrypto = NONE_CRYPT;
- ar->arGroupCryptoLen = 0;
- }
- break;
- case IW_AUTH_RX_UNENCRYPTED_EAPOL:
- profChanged = false;
- break;
- case IW_AUTH_ROAMING_CONTROL:
- profChanged = false;
- break;
- case IW_AUTH_PRIVACY_INVOKED:
- if (!value) {
- ar->arPairwiseCrypto = NONE_CRYPT;
- ar->arPairwiseCryptoLen = 0;
- ar->arGroupCrypto = NONE_CRYPT;
- ar->arGroupCryptoLen = 0;
- }
- break;
-#ifdef WAPI_ENABLE
- case IW_AUTH_WAPI_ENABLED:
- ar->arWapiEnable = value;
- break;
-#endif
- default:
- ret = -1;
- profChanged = false;
- break;
- }
-
- if (profChanged == true) {
- /*
- * profile has changed. Erase ssid to signal change
- */
- A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
- ar->arSsidLen = 0;
- }
-
- return ret;
-}
-
-
-/*
- * SIOCGIWAUTH
- */
-static int
-ar6000_ioctl_giwauth(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *data, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- u16 param;
- s32 ret;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- param = data->flags & IW_AUTH_INDEX;
- ret = 0;
- data->value = 0;
-
-
- switch (param) {
- case IW_AUTH_WPA_VERSION:
- if (ar->arAuthMode == NONE_AUTH) {
- data->value |= IW_AUTH_WPA_VERSION_DISABLED;
- } else if (ar->arAuthMode == WPA_AUTH) {
- data->value |= IW_AUTH_WPA_VERSION_WPA;
- } else if (ar->arAuthMode == WPA2_AUTH) {
- data->value |= IW_AUTH_WPA_VERSION_WPA2;
- } else {
- ret = -1;
- }
- break;
- case IW_AUTH_CIPHER_PAIRWISE:
- if (ar->arPairwiseCrypto == NONE_CRYPT) {
- data->value |= IW_AUTH_CIPHER_NONE;
- } else if (ar->arPairwiseCrypto == WEP_CRYPT) {
- if (ar->arPairwiseCryptoLen == 13) {
- data->value |= IW_AUTH_CIPHER_WEP104;
- } else {
- data->value |= IW_AUTH_CIPHER_WEP40;
- }
- } else if (ar->arPairwiseCrypto == TKIP_CRYPT) {
- data->value |= IW_AUTH_CIPHER_TKIP;
- } else if (ar->arPairwiseCrypto == AES_CRYPT) {
- data->value |= IW_AUTH_CIPHER_CCMP;
- } else {
- ret = -1;
- }
- break;
- case IW_AUTH_CIPHER_GROUP:
- if (ar->arGroupCrypto == NONE_CRYPT) {
- data->value |= IW_AUTH_CIPHER_NONE;
- } else if (ar->arGroupCrypto == WEP_CRYPT) {
- if (ar->arGroupCryptoLen == 13) {
- data->value |= IW_AUTH_CIPHER_WEP104;
- } else {
- data->value |= IW_AUTH_CIPHER_WEP40;
- }
- } else if (ar->arGroupCrypto == TKIP_CRYPT) {
- data->value |= IW_AUTH_CIPHER_TKIP;
- } else if (ar->arGroupCrypto == AES_CRYPT) {
- data->value |= IW_AUTH_CIPHER_CCMP;
- } else {
- ret = -1;
- }
- break;
- case IW_AUTH_KEY_MGMT:
- if ((ar->arAuthMode == WPA_PSK_AUTH) ||
- (ar->arAuthMode == WPA2_PSK_AUTH)) {
- data->value |= IW_AUTH_KEY_MGMT_PSK;
- } else if ((ar->arAuthMode == WPA_AUTH) ||
- (ar->arAuthMode == WPA2_AUTH)) {
- data->value |= IW_AUTH_KEY_MGMT_802_1X;
- }
- break;
- case IW_AUTH_TKIP_COUNTERMEASURES:
- // TODO. Save countermeassure enable/disable
- data->value = 0;
- break;
- case IW_AUTH_DROP_UNENCRYPTED:
- break;
- case IW_AUTH_80211_AUTH_ALG:
- if (ar->arDot11AuthMode == OPEN_AUTH) {
- data->value |= IW_AUTH_ALG_OPEN_SYSTEM;
- } else if (ar->arDot11AuthMode == SHARED_AUTH) {
- data->value |= IW_AUTH_ALG_SHARED_KEY;
- } else if (ar->arDot11AuthMode == LEAP_AUTH) {
- data->value |= IW_AUTH_ALG_LEAP;
- } else {
- ret = -1;
- }
- break;
- case IW_AUTH_WPA_ENABLED:
- if (ar->arAuthMode == NONE_AUTH) {
- data->value = 0;
- } else {
- data->value = 1;
- }
- break;
- case IW_AUTH_RX_UNENCRYPTED_EAPOL:
- break;
- case IW_AUTH_ROAMING_CONTROL:
- break;
- case IW_AUTH_PRIVACY_INVOKED:
- if (ar->arPairwiseCrypto == NONE_CRYPT) {
- data->value = 0;
- } else {
- data->value = 1;
- }
- break;
-#ifdef WAPI_ENABLE
- case IW_AUTH_WAPI_ENABLED:
- data->value = ar->arWapiEnable;
- break;
-#endif
- default:
- ret = -1;
- break;
- }
-
- return 0;
-}
-
-/*
- * SIOCSIWPMKSA
- */
-static int
-ar6000_ioctl_siwpmksa(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- s32 ret;
- int status;
- struct iw_pmksa *pmksa;
-
- pmksa = (struct iw_pmksa *)extra;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- ret = 0;
- status = 0;
-
- switch (pmksa->cmd) {
- case IW_PMKSA_ADD:
- status = wmi_setPmkid_cmd(ar->arWmi, (u8 *)pmksa->bssid.sa_data, pmksa->pmkid, true);
- break;
- case IW_PMKSA_REMOVE:
- status = wmi_setPmkid_cmd(ar->arWmi, (u8 *)pmksa->bssid.sa_data, pmksa->pmkid, false);
- break;
- case IW_PMKSA_FLUSH:
- if (ar->arConnected == true) {
- status = wmi_setPmkid_cmd(ar->arWmi, ar->arBssid, NULL, 0);
- }
- break;
- default:
- ret=-1;
- break;
- }
- if (status) {
- ret = -1;
- }
-
- return ret;
-}
-
-#ifdef WAPI_ENABLE
-
-#define PN_INIT 0x5c365c36
-
-static int ar6000_set_wapi_key(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
- KEY_USAGE keyUsage = 0;
- s32 keyLen;
- u8 *keyData;
- s32 index;
- u32 *PN;
- s32 i;
- int status;
- u8 wapiKeyRsc[16];
- CRYPTO_TYPE keyType = WAPI_CRYPT;
- const u8 broadcastMac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
- index = erq->flags & IW_ENCODE_INDEX;
- if (index && (((index - 1) < WMI_MIN_KEY_INDEX) ||
- ((index - 1) > WMI_MAX_KEY_INDEX))) {
- return -EIO;
- }
-
- index--;
- if (index < 0 || index > 4) {
- return -EIO;
- }
- keyData = (u8 *)(ext + 1);
- keyLen = erq->length - sizeof(struct iw_encode_ext);
- memcpy(wapiKeyRsc, ext->tx_seq, sizeof(wapiKeyRsc));
-
- if (memcmp(ext->addr.sa_data, broadcastMac, sizeof(broadcastMac)) == 0) {
- keyUsage |= GROUP_USAGE;
- PN = (u32 *)wapiKeyRsc;
- for (i = 0; i < 4; i++) {
- PN[i] = PN_INIT;
- }
- } else {
- keyUsage |= PAIRWISE_USAGE;
- }
- status = wmi_addKey_cmd(ar->arWmi,
- index,
- keyType,
- keyUsage,
- keyLen,
- wapiKeyRsc,
- keyData,
- KEY_OP_INIT_WAPIPN,
- NULL,
- SYNC_BEFORE_WMIFLAG);
- if (0 != status) {
- return -EIO;
- }
- return 0;
-}
-
-#endif
-
-/*
- * SIOCSIWENCODEEXT
- */
-static int
-ar6000_ioctl_siwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- s32 index;
- struct iw_encode_ext *ext;
- KEY_USAGE keyUsage;
- s32 keyLen;
- u8 *keyData;
- u8 keyRsc[8];
- int status;
- CRYPTO_TYPE keyType;
-#ifdef USER_KEYS
- struct ieee80211req_key ik;
-#endif /* USER_KEYS */
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
-#ifdef USER_KEYS
- ar->user_saved_keys.keyOk = false;
-#endif /* USER_KEYS */
-
- index = erq->flags & IW_ENCODE_INDEX;
-
- if (index && (((index - 1) < WMI_MIN_KEY_INDEX) ||
- ((index - 1) > WMI_MAX_KEY_INDEX)))
- {
- return -EIO;
- }
-
- ext = (struct iw_encode_ext *)extra;
- if (erq->flags & IW_ENCODE_DISABLED) {
- /*
- * Encryption disabled
- */
- if (index) {
- /*
- * If key index was specified then clear the specified key
- */
- index--;
- A_MEMZERO(ar->arWepKeyList[index].arKey,
- sizeof(ar->arWepKeyList[index].arKey));
- ar->arWepKeyList[index].arKeyLen = 0;
- }
- } else {
- /*
- * Enabling WEP encryption
- */
- if (index) {
- index--; /* keyindex is off base 1 in iwconfig */
- }
-
- keyUsage = 0;
- keyLen = erq->length - sizeof(struct iw_encode_ext);
-
- if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
- keyUsage = TX_USAGE;
- ar->arDefTxKeyIndex = index;
- // Just setting the key index
- if (keyLen == 0) {
- return 0;
- }
- }
-
- if (keyLen <= 0) {
- return -EIO;
- }
-
- /* key follows iw_encode_ext */
- keyData = (u8 *)(ext + 1);
-
- switch (ext->alg) {
- case IW_ENCODE_ALG_WEP:
- keyType = WEP_CRYPT;
-#ifdef USER_KEYS
- ik.ik_type = IEEE80211_CIPHER_WEP;
-#endif /* USER_KEYS */
- if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(keyLen)) {
- return -EIO;
- }
-
- /* Check whether it is static wep. */
- if (!ar->arConnected) {
- A_MEMZERO(ar->arWepKeyList[index].arKey,
- sizeof(ar->arWepKeyList[index].arKey));
- memcpy(ar->arWepKeyList[index].arKey, keyData, keyLen);
- ar->arWepKeyList[index].arKeyLen = keyLen;
-
- return 0;
- }
- break;
- case IW_ENCODE_ALG_TKIP:
- keyType = TKIP_CRYPT;
-#ifdef USER_KEYS
- ik.ik_type = IEEE80211_CIPHER_TKIP;
-#endif /* USER_KEYS */
- break;
- case IW_ENCODE_ALG_CCMP:
- keyType = AES_CRYPT;
-#ifdef USER_KEYS
- ik.ik_type = IEEE80211_CIPHER_AES_CCM;
-#endif /* USER_KEYS */
- break;
-#ifdef WAPI_ENABLE
- case IW_ENCODE_ALG_SM4:
- if (ar->arWapiEnable) {
- return ar6000_set_wapi_key(dev, info, erq, extra);
- } else {
- return -EIO;
- }
-#endif
- case IW_ENCODE_ALG_PMK:
- ar->arConnectCtrlFlags |= CONNECT_DO_WPA_OFFLOAD;
- return wmi_set_pmk_cmd(ar->arWmi, keyData);
- default:
- return -EIO;
- }
-
-
- if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
- keyUsage |= GROUP_USAGE;
- } else {
- keyUsage |= PAIRWISE_USAGE;
- }
-
- if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
- memcpy(keyRsc, ext->rx_seq, sizeof(keyRsc));
- } else {
- A_MEMZERO(keyRsc, sizeof(keyRsc));
- }
-
- if (((WPA_PSK_AUTH == ar->arAuthMode) || (WPA2_PSK_AUTH == ar->arAuthMode)) &&
- (GROUP_USAGE & keyUsage))
- {
- A_UNTIMEOUT(&ar->disconnect_timer);
- }
-
- status = wmi_addKey_cmd(ar->arWmi, index, keyType, keyUsage,
- keyLen, keyRsc,
- keyData, KEY_OP_INIT_VAL,
- (u8 *)ext->addr.sa_data,
- SYNC_BOTH_WMIFLAG);
- if (status) {
- return -EIO;
- }
-
-#ifdef USER_KEYS
- ik.ik_keyix = index;
- ik.ik_keylen = keyLen;
- memcpy(ik.ik_keydata, keyData, keyLen);
- memcpy(&ik.ik_keyrsc, keyRsc, sizeof(keyRsc));
- memcpy(ik.ik_macaddr, ext->addr.sa_data, ETH_ALEN);
- if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
- memcpy(&ar->user_saved_keys.bcast_ik, &ik,
- sizeof(struct ieee80211req_key));
- } else {
- memcpy(&ar->user_saved_keys.ucast_ik, &ik,
- sizeof(struct ieee80211req_key));
- }
- ar->user_saved_keys.keyOk = true;
-#endif /* USER_KEYS */
- }
-
-
- return 0;
-}
-
-/*
- * SIOCGIWENCODEEXT
- */
-static int
-ar6000_ioctl_giwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (ar->arPairwiseCrypto == NONE_CRYPT) {
- erq->length = 0;
- erq->flags = IW_ENCODE_DISABLED;
- } else {
- erq->length = 0;
- }
-
- return 0;
-}
-#endif // WIRELESS_EXT >= 18
-
-#if WIRELESS_EXT > 20
-static int ar6000_ioctl_siwpower(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
-#ifndef ATH6K_CONFIG_OTA_MODE
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_POWER_MODE power_mode;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (wrqu->power.disabled)
- power_mode = MAX_PERF_POWER;
- else
- power_mode = REC_POWER;
-
- if (wmi_powermode_cmd(ar->arWmi, power_mode) < 0)
- return -EIO;
-#endif
- return 0;
-}
-
-static int ar6000_ioctl_giwpower(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- WMI_POWER_MODE power_mode;
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- power_mode = wmi_get_power_mode_cmd(ar->arWmi);
-
- if (power_mode == MAX_PERF_POWER)
- wrqu->power.disabled = 1;
- else
- wrqu->power.disabled = 0;
-
- return 0;
-}
-#endif // WIRELESS_EXT > 20
-
-/*
- * SIOCGIWNAME
- */
-int
-ar6000_ioctl_giwname(struct net_device *dev,
- struct iw_request_info *info,
- char *name, char *extra)
-{
- u8 capability;
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- capability = ar->arPhyCapability;
- if(ar->arNetworkType == INFRA_NETWORK && ar->arConnected) {
- bss_t *bss = wmi_find_node(ar->arWmi, ar->arBssid);
- if (bss) {
- capability = get_bss_phy_capability(bss);
- wmi_node_return(ar->arWmi, bss);
- }
- }
- switch (capability) {
- case (WMI_11A_CAPABILITY):
- strncpy(name, "AR6000 802.11a", IFNAMSIZ);
- break;
- case (WMI_11G_CAPABILITY):
- strncpy(name, "AR6000 802.11g", IFNAMSIZ);
- break;
- case (WMI_11AG_CAPABILITY):
- strncpy(name, "AR6000 802.11ag", IFNAMSIZ);
- break;
- case (WMI_11NA_CAPABILITY):
- strncpy(name, "AR6000 802.11na", IFNAMSIZ);
- break;
- case (WMI_11NG_CAPABILITY):
- strncpy(name, "AR6000 802.11ng", IFNAMSIZ);
- break;
- case (WMI_11NAG_CAPABILITY):
- strncpy(name, "AR6000 802.11nag", IFNAMSIZ);
- break;
- default:
- strncpy(name, "AR6000 802.11b", IFNAMSIZ);
- break;
- }
-
- return 0;
-}
-
-/*
- * SIOCSIWFREQ
- */
-int
-ar6000_ioctl_siwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *freq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- /*
- * We support limiting the channels via wmiconfig.
- *
- * We use this command to configure the channel hint for the connect cmd
- * so it is possible the target will end up connecting to a different
- * channel.
- */
- if (freq->e > 1) {
- return -EINVAL;
- } else if (freq->e == 1) {
- ar->arChannelHint = freq->m / 100000;
- } else {
- if(freq->m) {
- ar->arChannelHint = wlan_ieee2freq(freq->m);
- } else {
- /* Auto Channel Selection */
- ar->arChannelHint = 0;
- }
- }
-
- ar->ap_profile_flag = 1; /* There is a change in profile */
-
- A_PRINTF("channel hint set to %d\n", ar->arChannelHint);
- return 0;
-}
-
-/*
- * SIOCGIWFREQ
- */
-int
-ar6000_ioctl_giwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *freq, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (ar->arNetworkType == AP_NETWORK) {
- if(ar->arChannelHint) {
- freq->m = ar->arChannelHint * 100000;
- } else if(ar->arACS) {
- freq->m = ar->arACS * 100000;
- } else {
- return -EINVAL;
- }
- } else {
- if (ar->arConnected != true) {
- return -EINVAL;
- } else {
- freq->m = ar->arBssChannel * 100000;
- }
- }
-
- freq->e = 1;
-
- return 0;
-}
-
-/*
- * SIOCSIWMODE
- */
-int
-ar6000_ioctl_siwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *mode, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- /*
- * clear SSID during mode switch in connected state
- */
- if(!(ar->arNetworkType == (((*mode) == IW_MODE_INFRA) ? INFRA_NETWORK : ADHOC_NETWORK)) && (ar->arConnected == true) ){
- A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
- ar->arSsidLen = 0;
- }
-
- switch (*mode) {
- case IW_MODE_INFRA:
- ar->arNextMode = INFRA_NETWORK;
- break;
- case IW_MODE_ADHOC:
- ar->arNextMode = ADHOC_NETWORK;
- break;
- case IW_MODE_MASTER:
- ar->arNextMode = AP_NETWORK;
- break;
- default:
- return -EINVAL;
- }
-
- /* clear all shared parameters between AP and STA|IBSS modes when we
- * switch between them. Switch between STA & IBSS modes does'nt clear
- * the shared profile. This is as per the original design for switching
- * between STA & IBSS.
- */
- if (ar->arNetworkType == AP_NETWORK || ar->arNextMode == AP_NETWORK) {
- ar->arDot11AuthMode = OPEN_AUTH;
- ar->arAuthMode = NONE_AUTH;
- ar->arPairwiseCrypto = NONE_CRYPT;
- ar->arPairwiseCryptoLen = 0;
- ar->arGroupCrypto = NONE_CRYPT;
- ar->arGroupCryptoLen = 0;
- ar->arChannelHint = 0;
- ar->arBssChannel = 0;
- A_MEMZERO(ar->arBssid, sizeof(ar->arBssid));
- A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
- ar->arSsidLen = 0;
- }
-
- /* SSID has to be cleared to trigger a profile change while switching
- * between STA & IBSS modes having the same SSID
- */
- if (ar->arNetworkType != ar->arNextMode) {
- A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
- ar->arSsidLen = 0;
- }
-
- return 0;
-}
-
-/*
- * SIOCGIWMODE
- */
-int
-ar6000_ioctl_giwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *mode, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- switch (ar->arNetworkType) {
- case INFRA_NETWORK:
- *mode = IW_MODE_INFRA;
- break;
- case ADHOC_NETWORK:
- *mode = IW_MODE_ADHOC;
- break;
- case AP_NETWORK:
- *mode = IW_MODE_MASTER;
- break;
- default:
- return -EIO;
- }
- return 0;
-}
-
-/*
- * SIOCSIWSENS
- */
-int
-ar6000_ioctl_siwsens(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *sens, char *extra)
-{
- return 0;
-}
-
-/*
- * SIOCGIWSENS
- */
-int
-ar6000_ioctl_giwsens(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *sens, char *extra)
-{
- sens->value = 0;
- sens->fixed = 1;
-
- return 0;
-}
-
-/*
- * SIOCGIWRANGE
- */
-int
-ar6000_ioctl_giwrange(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- struct iw_range *range = (struct iw_range *) extra;
- int i, ret = 0;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- if (ar->bIsDestroyProgress) {
- up(&ar->arSem);
- return -EBUSY;
- }
-
- ar->arNumChannels = -1;
- A_MEMZERO(ar->arChannelList, sizeof (ar->arChannelList));
-
- if (wmi_get_channelList_cmd(ar->arWmi) != 0) {
- up(&ar->arSem);
- return -EIO;
- }
-
- wait_event_interruptible_timeout(arEvent, ar->arNumChannels != -1, wmitimeout * HZ);
-
- if (signal_pending(current)) {
- up(&ar->arSem);
- return -EINTR;
- }
-
- data->length = sizeof(struct iw_range);
- A_MEMZERO(range, sizeof(struct iw_range));
-
- range->txpower_capa = 0;
-
- range->min_pmp = 1 * 1024;
- range->max_pmp = 65535 * 1024;
- range->min_pmt = 1 * 1024;
- range->max_pmt = 1000 * 1024;
- range->pmp_flags = IW_POWER_PERIOD;
- range->pmt_flags = IW_POWER_TIMEOUT;
- range->pm_capa = 0;
-
- range->we_version_compiled = WIRELESS_EXT;
- range->we_version_source = 13;
-
- range->retry_capa = IW_RETRY_LIMIT;
- range->retry_flags = IW_RETRY_LIMIT;
- range->min_retry = 0;
- range->max_retry = 255;
-
- range->num_frequency = range->num_channels = ar->arNumChannels;
- for (i = 0; i < ar->arNumChannels; i++) {
- range->freq[i].i = wlan_freq2ieee(ar->arChannelList[i]);
- range->freq[i].m = ar->arChannelList[i] * 100000;
- range->freq[i].e = 1;
- /*
- * Linux supports max of 32 channels, bail out once you
- * reach the max.
- */
- if (i == IW_MAX_FREQUENCIES) {
- break;
- }
- }
-
- /* Max quality is max field value minus noise floor */
- range->max_qual.qual = 0xff - 161;
-
- /*
- * In order to use dBm measurements, 'level' must be lower
- * than any possible measurement (see iw_print_stats() in
- * wireless tools). It's unclear how this is meant to be
- * done, but setting zero in these values forces dBm and
- * the actual numbers are not used.
- */
- range->max_qual.level = 0;
- range->max_qual.noise = 0;
-
- range->sensitivity = 3;
-
- range->max_encoding_tokens = 4;
- /* XXX query driver to find out supported key sizes */
- range->num_encoding_sizes = 3;
- range->encoding_size[0] = 5; /* 40-bit */
- range->encoding_size[1] = 13; /* 104-bit */
- range->encoding_size[2] = 16; /* 128-bit */
-
- range->num_bitrates = 0;
-
- /* estimated maximum TCP throughput values (bps) */
- range->throughput = 22000000;
-
- range->min_rts = 0;
- range->max_rts = 2347;
- range->min_frag = 256;
- range->max_frag = 2346;
-
- up(&ar->arSem);
-
- return ret;
-}
-
-
-/*
- * SIOCSIWAP
- * This ioctl is used to set the desired bssid for the connect command.
- */
-int
-ar6000_ioctl_siwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *ap_addr, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (ap_addr->sa_family != ARPHRD_ETHER) {
- return -EIO;
- }
-
- if (memcmp(&ap_addr->sa_data, bcast_mac, AR6000_ETH_ADDR_LEN) == 0) {
- A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid));
- } else {
- memcpy(ar->arReqBssid, &ap_addr->sa_data, sizeof(ar->arReqBssid));
- }
-
- return 0;
-}
-
-/*
- * SIOCGIWAP
- */
-int
-ar6000_ioctl_giwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *ap_addr, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (ar->arNetworkType == AP_NETWORK) {
- memcpy(&ap_addr->sa_data, dev->dev_addr, ATH_MAC_LEN);
- ap_addr->sa_family = ARPHRD_ETHER;
- return 0;
- }
-
- if (ar->arConnected != true) {
- return -EINVAL;
- }
-
- memcpy(&ap_addr->sa_data, ar->arBssid, sizeof(ar->arBssid));
- ap_addr->sa_family = ARPHRD_ETHER;
-
- return 0;
-}
-
-#if (WIRELESS_EXT >= 18)
-/*
- * SIOCSIWMLME
- */
-int
-ar6000_ioctl_siwmlme(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->bIsDestroyProgress) {
- return -EBUSY;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (down_interruptible(&ar->arSem)) {
- return -ERESTARTSYS;
- }
-
- if (data->pointer && data->length == sizeof(struct iw_mlme)) {
-
- u8 arNetworkType;
- struct iw_mlme mlme;
-
- if (copy_from_user(&mlme, data->pointer, sizeof(struct iw_mlme)))
- return -EIO;
-
- switch (mlme.cmd) {
-
- case IW_MLME_DEAUTH:
- /* fall through */
- case IW_MLME_DISASSOC:
- if ((ar->arConnected != true) ||
- (memcmp(ar->arBssid, mlme.addr.sa_data, 6) != 0)) {
-
- up(&ar->arSem);
- return -EINVAL;
- }
- wmi_setPmkid_cmd(ar->arWmi, ar->arBssid, NULL, 0);
- arNetworkType = ar->arNetworkType;
- ar6000_init_profile_info(ar);
- ar->arNetworkType = arNetworkType;
- reconnect_flag = 0;
- ar6000_disconnect(ar);
- A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
- ar->arSsidLen = 0;
- if (ar->arSkipScan == false) {
- A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid));
- }
- break;
-
- case IW_MLME_AUTH:
- /* fall through */
- case IW_MLME_ASSOC:
- /* fall through */
- default:
- up(&ar->arSem);
- return -EOPNOTSUPP;
- }
- }
-
- up(&ar->arSem);
- return 0;
-}
-#endif /* WIRELESS_EXT >= 18 */
-
-/*
- * SIOCGIWAPLIST
- */
-int
-ar6000_ioctl_iwaplist(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *extra)
-{
- return -EIO; /* for now */
-}
-
-/*
- * SIOCSIWSCAN
- */
-int
-ar6000_ioctl_siwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *extra)
-{
-#define ACT_DWELLTIME_DEFAULT 105
-#define HOME_TXDRAIN_TIME 100
-#define SCAN_INT HOME_TXDRAIN_TIME + ACT_DWELLTIME_DEFAULT
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
- int ret = 0;
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- /* If scan is issued in the middle of ongoing scan or connect,
- dont issue another one */
- if ( ar->scan_triggered > 0 ) {
- ++ar->scan_triggered;
- if (ar->scan_triggered < 5) {
- return 0;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_SCAN,("Scan request is triggered over 5 times. Not scan complete event\n"));
- }
- }
-
- if (!ar->arUserBssFilter) {
- if (wmi_bssfilter_cmd(ar->arWmi, ALL_BSS_FILTER, 0) != 0) {
- return -EIO;
- }
- }
-
- if (ar->arConnected) {
- if (wmi_get_stats_cmd(ar->arWmi) != 0) {
- return -EIO;
- }
- }
-
- if (wmi_startscan_cmd(ar->arWmi, WMI_LONG_SCAN, false, false, \
- 0, 0, 0, NULL) != 0) {
- ret = -EIO;
- }
-
- if (ret == 0) {
- ar->scan_triggered = 1;
- }
-
- return ret;
-#undef ACT_DWELLTIME_DEFAULT
-#undef HOME_TXDRAIN_TIME
-#undef SCAN_INT
-}
-
-
-/*
- * Units are in db above the noise floor. That means the
- * rssi values reported in the tx/rx descriptors in the
- * driver are the SNR expressed in db.
- *
- * If you assume that the noise floor is -95, which is an
- * excellent assumption 99.5 % of the time, then you can
- * derive the absolute signal level (i.e. -95 + rssi).
- * There are some other slight factors to take into account
- * depending on whether the rssi measurement is from 11b,
- * 11g, or 11a. These differences are at most 2db and
- * can be documented.
- *
- * NB: various calculations are based on the orinoco/wavelan
- * drivers for compatibility
- */
-static void
-ar6000_set_quality(struct iw_quality *iq, s8 rssi)
-{
- if (rssi < 0) {
- iq->qual = 0;
- } else {
- iq->qual = rssi;
- }
-
- /* NB: max is 94 because noise is hardcoded to 161 */
- if (iq->qual > 94)
- iq->qual = 94;
-
- iq->noise = 161; /* -95dBm */
- iq->level = iq->noise + iq->qual;
- iq->updated = 7;
-}
-
-
-int
-ar6000_ioctl_siwcommit(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *data, char *extra)
-{
- struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
-
- if (is_iwioctl_allowed(ar->arNextMode, info->cmd) != 0) {
- A_PRINTF("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd);
- return -EOPNOTSUPP;
- }
-
- if (ar->arWmiReady == false) {
- return -EIO;
- }
-
- if (ar->arWlanState == WLAN_DISABLED) {
- return -EIO;
- }
-
- AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("AP: SSID %s freq %d authmode %d dot11 auth %d"\
- " PW crypto %d GRP crypto %d\n",
- ar->arSsid, ar->arChannelHint,
- ar->arAuthMode, ar->arDot11AuthMode,
- ar->arPairwiseCrypto, ar->arGroupCrypto));
-
- ar6000_ap_mode_profile_commit(ar);
-
- /* if there is a profile switch from STA|IBSS mode to AP mode,
- * update the host driver association state for the STA|IBSS mode.
- */
- if (ar->arNetworkType != AP_NETWORK && ar->arNextMode == AP_NETWORK) {
- /* Stop getting pkts from upper stack */
- netif_stop_queue(ar->arNetDev);
- A_MEMZERO(ar->arBssid, sizeof(ar->arBssid));
- ar->arBssChannel = 0;
- ar->arBeaconInterval = 0;
-
- /* Flush the Tx queues */
- ar6000_TxDataCleanup(ar);
-
- /* Start getting pkts from upper stack */
- netif_wake_queue(ar->arNetDev);
- }
-
- return 0;
-}
-
-#define W_PROTO(_x) wait_ ## _x
-#define WAIT_HANDLER_IMPL(_x, type) \
-int wait_ ## _x (struct net_device *dev, struct iw_request_info *info, type wrqu, char *extra) {\
- int ret; \
- dev_hold(dev); \
- rtnl_unlock(); \
- ret = _x(dev, info, wrqu, extra); \
- rtnl_lock(); \
- dev_put(dev); \
- return ret;\
-}
-
-WAIT_HANDLER_IMPL(ar6000_ioctl_siwessid, struct iw_point *)
-WAIT_HANDLER_IMPL(ar6000_ioctl_giwrate, struct iw_param *)
-WAIT_HANDLER_IMPL(ar6000_ioctl_giwtxpow, struct iw_param *)
-WAIT_HANDLER_IMPL(ar6000_ioctl_giwrange, struct iw_point*)
-
-/* Structures to export the Wireless Handlers */
-static const iw_handler ath_handlers[] = {
- (iw_handler) ar6000_ioctl_siwcommit, /* SIOCSIWCOMMIT */
- (iw_handler) ar6000_ioctl_giwname, /* SIOCGIWNAME */
- (iw_handler) NULL, /* SIOCSIWNWID */
- (iw_handler) NULL, /* SIOCGIWNWID */
- (iw_handler) ar6000_ioctl_siwfreq, /* SIOCSIWFREQ */
- (iw_handler) ar6000_ioctl_giwfreq, /* SIOCGIWFREQ */
- (iw_handler) ar6000_ioctl_siwmode, /* SIOCSIWMODE */
- (iw_handler) ar6000_ioctl_giwmode, /* SIOCGIWMODE */
- (iw_handler) ar6000_ioctl_siwsens, /* SIOCSIWSENS */
- (iw_handler) ar6000_ioctl_giwsens, /* SIOCGIWSENS */
- (iw_handler) NULL /* not _used */, /* SIOCSIWRANGE */
- (iw_handler) W_PROTO(ar6000_ioctl_giwrange),/* SIOCGIWRANGE */
- (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
- (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
- (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
- (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
- (iw_handler) NULL, /* SIOCSIWSPY */
- (iw_handler) NULL, /* SIOCGIWSPY */
- (iw_handler) NULL, /* SIOCSIWTHRSPY */
- (iw_handler) NULL, /* SIOCGIWTHRSPY */
- (iw_handler) ar6000_ioctl_siwap, /* SIOCSIWAP */
- (iw_handler) ar6000_ioctl_giwap, /* SIOCGIWAP */
-#if (WIRELESS_EXT >= 18)
- (iw_handler) ar6000_ioctl_siwmlme, /* SIOCSIWMLME */
-#else
- (iw_handler) NULL, /* -- hole -- */
-#endif /* WIRELESS_EXT >= 18 */
- (iw_handler) ar6000_ioctl_iwaplist, /* SIOCGIWAPLIST */
- (iw_handler) ar6000_ioctl_siwscan, /* SIOCSIWSCAN */
- (iw_handler) ar6000_ioctl_giwscan, /* SIOCGIWSCAN */
- (iw_handler) W_PROTO(ar6000_ioctl_siwessid),/* SIOCSIWESSID */
- (iw_handler) ar6000_ioctl_giwessid, /* SIOCGIWESSID */
- (iw_handler) NULL, /* SIOCSIWNICKN */
- (iw_handler) NULL, /* SIOCGIWNICKN */
- (iw_handler) NULL, /* -- hole -- */
- (iw_handler) NULL, /* -- hole -- */
- (iw_handler) ar6000_ioctl_siwrate, /* SIOCSIWRATE */
- (iw_handler) W_PROTO(ar6000_ioctl_giwrate), /* SIOCGIWRATE */
- (iw_handler) NULL, /* SIOCSIWRTS */
- (iw_handler) NULL, /* SIOCGIWRTS */
- (iw_handler) NULL, /* SIOCSIWFRAG */
- (iw_handler) NULL, /* SIOCGIWFRAG */
- (iw_handler) ar6000_ioctl_siwtxpow, /* SIOCSIWTXPOW */
- (iw_handler) W_PROTO(ar6000_ioctl_giwtxpow),/* SIOCGIWTXPOW */
- (iw_handler) ar6000_ioctl_siwretry, /* SIOCSIWRETRY */
- (iw_handler) ar6000_ioctl_giwretry, /* SIOCGIWRETRY */
- (iw_handler) ar6000_ioctl_siwencode, /* SIOCSIWENCODE */
- (iw_handler) ar6000_ioctl_giwencode, /* SIOCGIWENCODE */
-#if WIRELESS_EXT > 20
- (iw_handler) ar6000_ioctl_siwpower, /* SIOCSIWPOWER */
- (iw_handler) ar6000_ioctl_giwpower, /* SIOCGIWPOWER */
-#endif // WIRELESS_EXT > 20
-#if WIRELESS_EXT >= 18
- (iw_handler) NULL, /* -- hole -- */
- (iw_handler) NULL, /* -- hole -- */
- (iw_handler) ar6000_ioctl_siwgenie, /* SIOCSIWGENIE */
- (iw_handler) ar6000_ioctl_giwgenie, /* SIOCGIWGENIE */
- (iw_handler) ar6000_ioctl_siwauth, /* SIOCSIWAUTH */
- (iw_handler) ar6000_ioctl_giwauth, /* SIOCGIWAUTH */
- (iw_handler) ar6000_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */
- (iw_handler) ar6000_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */
- (iw_handler) ar6000_ioctl_siwpmksa, /* SIOCSIWPMKSA */
-#endif // WIRELESS_EXT >= 18
-};
-
-struct iw_handler_def ath_iw_handler_def = {
- .standard = (iw_handler *)ath_handlers,
- .num_standard = ARRAY_SIZE(ath_handlers),
- .private = NULL,
- .num_private = 0,
-};
diff --git a/drivers/staging/ath6kl/wmi/wmi.c b/drivers/staging/ath6kl/wmi/wmi.c
index eccccee..8b9ad76 100644
--- a/drivers/staging/ath6kl/wmi/wmi.c
+++ b/drivers/staging/ath6kl/wmi/wmi.c
@@ -132,12 +132,6 @@ wmi_set_params_event_rx(struct wmi_t *wmip, u8 *datap, u32 len);
static int
wmi_acm_reject_event_rx(struct wmi_t *wmip, u8 *datap, u32 len);

-#ifdef CONFIG_HOST_GPIO_SUPPORT
-static int wmi_gpio_intr_rx(struct wmi_t *wmip, u8 *datap, int len);
-static int wmi_gpio_data_rx(struct wmi_t *wmip, u8 *datap, int len);
-static int wmi_gpio_ack_rx(struct wmi_t *wmip, u8 *datap, int len);
-#endif /* CONFIG_HOST_GPIO_SUPPORT */
-
#ifdef CONFIG_HOST_TCMD_SUPPORT
static int
wmi_tcmd_test_report_rx(struct wmi_t *wmip, u8 *datap, int len);
@@ -865,17 +859,6 @@ wmi_control_rx_xtnd(struct wmi_t *wmip, void *osbuf)
status = wmi_dset_data_req_rx(wmip, datap, len);
break;
#endif /* CONFIG_HOST_DSET_SUPPORT */
-#ifdef CONFIG_HOST_GPIO_SUPPORT
- case (WMIX_GPIO_INTR_EVENTID):
- wmi_gpio_intr_rx(wmip, datap, len);
- break;
- case (WMIX_GPIO_DATA_EVENTID):
- wmi_gpio_data_rx(wmip, datap, len);
- break;
- case (WMIX_GPIO_ACK_EVENTID):
- wmi_gpio_ack_rx(wmip, datap, len);
- break;
-#endif /* CONFIG_HOST_GPIO_SUPPORT */
case (WMIX_HB_CHALLENGE_RESP_EVENTID):
wmi_hbChallengeResp_rx(wmip, datap, len);
break;
@@ -1208,7 +1191,7 @@ wmi_simple_cmd(struct wmi_t *wmip, WMI_COMMAND_ID cmdid)
/* Send a "simple" extended wmi command -- one with no arguments.
Enabling this command only if GPIO or profiling support is enabled.
This is to suppress warnings on some platforms */
-#if defined(CONFIG_HOST_GPIO_SUPPORT) || defined(CONFIG_TARGET_PROFILE_SUPPORT)
+#if defined(CONFIG_TARGET_PROFILE_SUPPORT)
static int
wmi_simple_cmd_xtnd(struct wmi_t *wmip, WMIX_COMMAND_ID cmdid)
{
@@ -2298,46 +2281,6 @@ wmi_dbglog_event_rx(struct wmi_t *wmip, u8 *datap, int len)
return 0;
}

-#ifdef CONFIG_HOST_GPIO_SUPPORT
-static int
-wmi_gpio_intr_rx(struct wmi_t *wmip, u8 *datap, int len)
-{
- WMIX_GPIO_INTR_EVENT *gpio_intr = (WMIX_GPIO_INTR_EVENT *)datap;
-
- A_DPRINTF(DBG_WMI,
- (DBGFMT "Enter - intrmask=0x%x input=0x%x.\n", DBGARG,
- gpio_intr->intr_mask, gpio_intr->input_values));
-
- A_WMI_GPIO_INTR_RX(gpio_intr->intr_mask, gpio_intr->input_values);
-
- return 0;
-}
-
-static int
-wmi_gpio_data_rx(struct wmi_t *wmip, u8 *datap, int len)
-{
- WMIX_GPIO_DATA_EVENT *gpio_data = (WMIX_GPIO_DATA_EVENT *)datap;
-
- A_DPRINTF(DBG_WMI,
- (DBGFMT "Enter - reg=%d value=0x%x\n", DBGARG,
- gpio_data->reg_id, gpio_data->value));
-
- A_WMI_GPIO_DATA_RX(gpio_data->reg_id, gpio_data->value);
-
- return 0;
-}
-
-static int
-wmi_gpio_ack_rx(struct wmi_t *wmip, u8 *datap, int len)
-{
- A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG));
-
- A_WMI_GPIO_ACK_RX();
-
- return 0;
-}
-#endif /* CONFIG_HOST_GPIO_SUPPORT */
-
/*
* Called to send a wmi command. Command specific data is already built
* on osbuf and current osbuf->data points to it.
@@ -4282,132 +4225,6 @@ wmi_set_powersave_timers_cmd(struct wmi_t *wmip,
NO_SYNC_WMIFLAG));
}

-#ifdef CONFIG_HOST_GPIO_SUPPORT
-/* Send a command to Target to change GPIO output pins. */
-int
-wmi_gpio_output_set(struct wmi_t *wmip,
- u32 set_mask,
- u32 clear_mask,
- u32 enable_mask,
- u32 disable_mask)
-{
- void *osbuf;
- WMIX_GPIO_OUTPUT_SET_CMD *output_set;
- int size;
-
- size = sizeof(*output_set);
-
- A_DPRINTF(DBG_WMI,
- (DBGFMT "Enter - set=0x%x clear=0x%x enb=0x%x dis=0x%x\n", DBGARG,
- set_mask, clear_mask, enable_mask, disable_mask));
-
- osbuf = A_NETBUF_ALLOC(size);
- if (osbuf == NULL) {
- return A_NO_MEMORY;
- }
- A_NETBUF_PUT(osbuf, size);
- output_set = (WMIX_GPIO_OUTPUT_SET_CMD *)(A_NETBUF_DATA(osbuf));
-
- output_set->set_mask = set_mask;
- output_set->clear_mask = clear_mask;
- output_set->enable_mask = enable_mask;
- output_set->disable_mask = disable_mask;
-
- return (wmi_cmd_send_xtnd(wmip, osbuf, WMIX_GPIO_OUTPUT_SET_CMDID,
- NO_SYNC_WMIFLAG));
-}
-
-/* Send a command to the Target requesting state of the GPIO input pins */
-int
-wmi_gpio_input_get(struct wmi_t *wmip)
-{
- A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG));
-
- return wmi_simple_cmd_xtnd(wmip, WMIX_GPIO_INPUT_GET_CMDID);
-}
-
-/* Send a command to the Target that changes the value of a GPIO register. */
-int
-wmi_gpio_register_set(struct wmi_t *wmip,
- u32 gpioreg_id,
- u32 value)
-{
- void *osbuf;
- WMIX_GPIO_REGISTER_SET_CMD *register_set;
- int size;
-
- size = sizeof(*register_set);
-
- A_DPRINTF(DBG_WMI,
- (DBGFMT "Enter - reg=%d value=0x%x\n", DBGARG, gpioreg_id, value));
-
- osbuf = A_NETBUF_ALLOC(size);
- if (osbuf == NULL) {
- return A_NO_MEMORY;
- }
- A_NETBUF_PUT(osbuf, size);
- register_set = (WMIX_GPIO_REGISTER_SET_CMD *)(A_NETBUF_DATA(osbuf));
-
- register_set->gpioreg_id = gpioreg_id;
- register_set->value = value;
-
- return (wmi_cmd_send_xtnd(wmip, osbuf, WMIX_GPIO_REGISTER_SET_CMDID,
- NO_SYNC_WMIFLAG));
-}
-
-/* Send a command to the Target to fetch the value of a GPIO register. */
-int
-wmi_gpio_register_get(struct wmi_t *wmip,
- u32 gpioreg_id)
-{
- void *osbuf;
- WMIX_GPIO_REGISTER_GET_CMD *register_get;
- int size;
-
- size = sizeof(*register_get);
-
- A_DPRINTF(DBG_WMI, (DBGFMT "Enter - reg=%d\n", DBGARG, gpioreg_id));
-
- osbuf = A_NETBUF_ALLOC(size);
- if (osbuf == NULL) {
- return A_NO_MEMORY;
- }
- A_NETBUF_PUT(osbuf, size);
- register_get = (WMIX_GPIO_REGISTER_GET_CMD *)(A_NETBUF_DATA(osbuf));
-
- register_get->gpioreg_id = gpioreg_id;
-
- return (wmi_cmd_send_xtnd(wmip, osbuf, WMIX_GPIO_REGISTER_GET_CMDID,
- NO_SYNC_WMIFLAG));
-}
-
-/* Send a command to the Target acknowledging some GPIO interrupts. */
-int
-wmi_gpio_intr_ack(struct wmi_t *wmip,
- u32 ack_mask)
-{
- void *osbuf;
- WMIX_GPIO_INTR_ACK_CMD *intr_ack;
- int size;
-
- size = sizeof(*intr_ack);
-
- A_DPRINTF(DBG_WMI, (DBGFMT "Enter ack_mask=0x%x\n", DBGARG, ack_mask));
-
- osbuf = A_NETBUF_ALLOC(size);
- if (osbuf == NULL) {
- return A_NO_MEMORY;
- }
- A_NETBUF_PUT(osbuf, size);
- intr_ack = (WMIX_GPIO_INTR_ACK_CMD *)(A_NETBUF_DATA(osbuf));
-
- intr_ack->ack_mask = ack_mask;
-
- return (wmi_cmd_send_xtnd(wmip, osbuf, WMIX_GPIO_INTR_ACK_CMDID,
- NO_SYNC_WMIFLAG));
-}
-#endif /* CONFIG_HOST_GPIO_SUPPORT */
-
int
wmi_set_access_params_cmd(struct wmi_t *wmip, u8 ac, u16 txop, u8 eCWmin,
u8 eCWmax, u8 aifsn)
@@ -4683,8 +4500,6 @@ wmi_tcmd_test_report_rx(struct wmi_t *wmip, u8 *datap, int len)

A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG));

- A_WMI_TCMD_RX_REPORT_EVENT(wmip->wmi_devt, datap, len);
-
return 0;
}

--
1.7.0.4


2011-03-30 00:56:48

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 06/34] ath6kl: move setting netdev for non-cf80211 case

The check for SET_NETDEV_DEV is not required given that
this is upstream. The setting of the SET_NETDEV_DEV with
the osDevInfo.pOSDevice is redundant for the cfg80211 case
as this was already being done, so just set the netdev device
for the non-cfg80211 which was missing.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index bb4dbb5..94b9132 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -1685,6 +1685,7 @@ ar6000_avail_ev(void *context, void *hif_handle)
}
ether_setup(dev);
ar_netif = ar6k_priv(dev);
+ SET_NETDEV_DEV(dev, osDevInfo.pOSDevice);
#endif /* ATH6K_CONFIG_CFG80211 */

if (ar_netif == NULL) {
@@ -1715,11 +1716,6 @@ ar6000_avail_ev(void *context, void *hif_handle)

init_netdev(dev, ifname);

-#ifdef SET_NETDEV_DEV
- if (ar_netif) {
- SET_NETDEV_DEV(dev, osDevInfo.pOSDevice);
- }
-#endif

ar->arNetDev = dev;
ar->arHifDevice = hif_handle;
--
1.7.0.4


2011-03-30 00:57:04

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 11/34] ath6kl: remove dependency on LINUX and KERNEL_2_6 macros

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 1 -
drivers/staging/ath6kl/htc2/AR6000/ar6k.h | 3 -
drivers/staging/ath6kl/include/a_config.h | 22 --------
drivers/staging/ath6kl/include/a_debug.h | 28 ----------
drivers/staging/ath6kl/include/a_drv.h | 22 --------
drivers/staging/ath6kl/include/a_osapi.h | 29 ----------
drivers/staging/ath6kl/include/a_types.h | 26 ---------
drivers/staging/ath6kl/include/ar6000_api.h | 22 --------
drivers/staging/ath6kl/include/athendpack.h | 52 ------------------
drivers/staging/ath6kl/include/athstartpack.h | 55 --------------------
drivers/staging/ath6kl/include/common/bmi_msg.h | 8 ---
drivers/staging/ath6kl/include/common/dbglog.h | 8 ---
.../staging/ath6kl/include/common/dset_internal.h | 8 ---
drivers/staging/ath6kl/include/common/dsetid.h | 8 ---
.../staging/ath6kl/include/common/epping_test.h | 9 ---
drivers/staging/ath6kl/include/common/gmboxif.h | 8 ---
drivers/staging/ath6kl/include/common/htc.h | 9 ---
drivers/staging/ath6kl/include/common/regdump.h | 8 ---
drivers/staging/ath6kl/include/common/targaddrs.h | 8 ---
drivers/staging/ath6kl/include/common/wmi.h | 8 ---
drivers/staging/ath6kl/include/common/wmix.h | 7 ---
drivers/staging/ath6kl/wlan/include/ieee80211.h | 4 --
drivers/staging/ath6kl/wmi/wmi.c | 4 --
23 files changed, 0 insertions(+), 357 deletions(-)
delete mode 100644 drivers/staging/ath6kl/include/athendpack.h
delete mode 100644 drivers/staging/ath6kl/include/athstartpack.h

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index 96e4ed9..9903034 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -110,7 +110,6 @@ ifeq ($(CONFIG_ATH6KL_SKIP_ABI_VERSION_CHECK),y)
ccflags-y += -DATH6KL_SKIP_ABI_VERSION_CHECK
endif

-ccflags-y += -DLINUX -DKERNEL_2_6
ccflags-y += -DTCMD
ccflags-y += -DSEND_EVENT_TO_APP
ccflags-y += -DUSER_KEYS
diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k.h b/drivers/staging/ath6kl/htc2/AR6000/ar6k.h
index 1ff2218..e551dbe 100644
--- a/drivers/staging/ath6kl/htc2/AR6000/ar6k.h
+++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k.h
@@ -42,7 +42,6 @@

//#define MBOXHW_UNIT_TEST 1

-#include "athstartpack.h"
PREPACK struct ar6k_irq_proc_registers {
u8 host_int_status;
u8 cpu_int_status;
@@ -69,8 +68,6 @@ PREPACK struct ar6k_gmbox_ctrl_registers {
u8 int_status_enable;
} POSTPACK;

-#include "athendpack.h"
-
#define AR6K_IRQ_ENABLE_REGS_SIZE sizeof(struct ar6k_irq_enable_registers)

#define AR6K_REG_IO_BUFFER_SIZE 32
diff --git a/drivers/staging/ath6kl/include/a_config.h b/drivers/staging/ath6kl/include/a_config.h
index 4a0083c..f7c0931 100644
--- a/drivers/staging/ath6kl/include/a_config.h
+++ b/drivers/staging/ath6kl/include/a_config.h
@@ -26,28 +26,6 @@
#ifndef _A_CONFIG_H_
#define _A_CONFIG_H_

-#ifdef UNDER_NWIFI
-#include "../os/windows/include/config.h"
-#endif
-
-#ifdef ATHR_CE_LEGACY
-#include "../os/windows/include/config.h"
-#endif
-
-#if defined(__linux__) && !defined(LINUX_EMULATION)
#include "../os/linux/include/config_linux.h"
-#endif
-
-#ifdef REXOS
-#include "../os/rexos/include/common/config_rexos.h"
-#endif
-
-#ifdef WIN_NWF
-#include "../os/windows/include/win/config_win.h"
-#endif
-
-#ifdef THREADX
-#include "../os/threadx/include/common/config_threadx.h"
-#endif

#endif
diff --git a/drivers/staging/ath6kl/include/a_debug.h b/drivers/staging/ath6kl/include/a_debug.h
index d433942..51cb633 100644
--- a/drivers/staging/ath6kl/include/a_debug.h
+++ b/drivers/staging/ath6kl/include/a_debug.h
@@ -187,35 +187,7 @@ void a_dump_module_debug_info_by_name(char *module_name);
void a_module_debug_support_init(void);
void a_module_debug_support_cleanup(void);

-#ifdef UNDER_NWIFI
-#include "../os/windows/include/debug.h"
-#endif
-
-#ifdef ATHR_CE_LEGACY
-#include "../os/windows/include/debug.h"
-#endif
-
-#if defined(__linux__) && !defined(LINUX_EMULATION)
#include "../os/linux/include/debug_linux.h"
-#endif
-
-#ifdef REXOS
-#include "../os/rexos/include/common/debug_rexos.h"
-#endif
-
-#if defined ART_WIN
-#include "../os/win_art/include/debug_win.h"
-#endif
-
-#ifdef WIN_NWF
-#include <debug_win.h>
-#endif
-
-#ifdef THREADX
-#define ATH_DEBUG_MAKE_MODULE_MASK(index) (1 << (ATH_DEBUG_MODULE_MASK_SHIFT + (index)))
-#include "../os/threadx/include/common/debug_threadx.h"
-#endif
-

#ifdef __cplusplus
}
diff --git a/drivers/staging/ath6kl/include/a_drv.h b/drivers/staging/ath6kl/include/a_drv.h
index 6db10f0..1548604 100644
--- a/drivers/staging/ath6kl/include/a_drv.h
+++ b/drivers/staging/ath6kl/include/a_drv.h
@@ -27,28 +27,6 @@
#ifndef _A_DRV_H_
#define _A_DRV_H_

-#if defined(__linux__) && !defined(LINUX_EMULATION)
#include "../os/linux/include/athdrv_linux.h"
-#endif
-
-#ifdef UNDER_NWIFI
-#include "../os/windows/include/athdrv.h"
-#endif
-
-#ifdef ATHR_CE_LEGACY
-#include "../os/windows/include/athdrv.h"
-#endif
-
-#ifdef REXOS
-#include "../os/rexos/include/common/athdrv_rexos.h"
-#endif
-
-#ifdef WIN_NWF
-#include "../os/windows/include/athdrv.h"
-#endif
-
-#ifdef THREADX
-#include "../os/threadx/include/common/athdrv_threadx.h"
-#endif

#endif /* _ADRV_H_ */
diff --git a/drivers/staging/ath6kl/include/a_osapi.h b/drivers/staging/ath6kl/include/a_osapi.h
index 7bdeeea..fd7ae0d 100644
--- a/drivers/staging/ath6kl/include/a_osapi.h
+++ b/drivers/staging/ath6kl/include/a_osapi.h
@@ -27,35 +27,6 @@
#ifndef _A_OSAPI_H_
#define _A_OSAPI_H_

-#if defined(__linux__) && !defined(LINUX_EMULATION)
#include "../os/linux/include/osapi_linux.h"
-#endif
-
-#ifdef UNDER_NWIFI
-#include "../os/windows/include/osapi.h"
-#include "../os/windows/include/netbuf.h"
-#endif
-
-#ifdef ATHR_CE_LEGACY
-#include "../os/windows/include/osapi.h"
-#include "../os/windows/include/netbuf.h"
-#endif
-
-#ifdef REXOS
-#include "../os/rexos/include/common/osapi_rexos.h"
-#endif
-
-#if defined ART_WIN
-#include "../os/win_art/include/osapi_win.h"
-#include "../os/win_art/include/netbuf.h"
-#endif
-
-#ifdef WIN_NWF
-#include <osapi_win.h>
-#endif
-
-#if defined(THREADX)
-#include "../os/threadx/include/common/osapi_threadx.h"
-#endif

#endif /* _OSAPI_H_ */
diff --git a/drivers/staging/ath6kl/include/a_types.h b/drivers/staging/ath6kl/include/a_types.h
index 18f4cfe..4b6783f 100644
--- a/drivers/staging/ath6kl/include/a_types.h
+++ b/drivers/staging/ath6kl/include/a_types.h
@@ -27,32 +27,6 @@
#ifndef _A_TYPES_H_
#define _A_TYPES_H_

-#if defined(__linux__) && !defined(LINUX_EMULATION)
#include "../os/linux/include/athtypes_linux.h"
-#endif
-
-#ifdef UNDER_NWIFI
-#include "../os/windows/include/athtypes.h"
-#endif
-
-#ifdef ATHR_CE_LEGACY
-#include "../os/windows/include/athtypes.h"
-#endif
-
-#ifdef REXOS
-#include "../os/rexos/include/common/athtypes_rexos.h"
-#endif
-
-#if defined ART_WIN
-#include "../os/win_art/include/athtypes_win.h"
-#endif
-
-#ifdef WIN_NWF
-#include <athtypes_win.h>
-#endif
-
-#ifdef THREADX
-#include "../os/threadx/include/common/athtypes_threadx.h"
-#endif

#endif /* _ATHTYPES_H_ */
diff --git a/drivers/staging/ath6kl/include/ar6000_api.h b/drivers/staging/ath6kl/include/ar6000_api.h
index 1e1d92a..e946080 100644
--- a/drivers/staging/ath6kl/include/ar6000_api.h
+++ b/drivers/staging/ath6kl/include/ar6000_api.h
@@ -26,29 +26,7 @@
#ifndef _AR6000_API_H_
#define _AR6000_API_H_

-#if defined(__linux__) && !defined(LINUX_EMULATION)
#include "../os/linux/include/ar6xapi_linux.h"
-#endif
-
-#ifdef UNDER_NWIFI
-#include "../os/windows/include/ar6xapi.h"
-#endif
-
-#ifdef ATHR_CE_LEGACY
-#include "../os/windows/include/ar6xapi.h"
-#endif
-
-#ifdef REXOS
-#include "../os/rexos/include/common/ar6xapi_rexos.h"
-#endif
-
-#if defined ART_WIN
-#include "../os/win_art/include/ar6xapi_win.h"
-#endif
-
-#ifdef WIN_NWF
-#include "../os/windows/include/ar6xapi.h"
-#endif

#endif /* _AR6000_API_H */

diff --git a/drivers/staging/ath6kl/include/athendpack.h b/drivers/staging/ath6kl/include/athendpack.h
deleted file mode 100644
index 1b94050..0000000
--- a/drivers/staging/ath6kl/include/athendpack.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="athendpack.h" company="Atheros">
-// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
-//
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// end compiler-specific structure packing
-//
-// Author(s): ="Atheros"
-//==============================================================================
-#ifdef VXWORKS
-#endif /* VXWORKS */
-
-#if defined(LINUX) || defined(__linux__)
-#endif /* LINUX */
-
-#ifdef QNX
-#endif /* QNX */
-
-#ifdef INTEGRITY
-#include "integrity/athendpack_integrity.h"
-#endif /* INTEGRITY */
-
-#ifdef NUCLEUS
-#endif /* NUCLEUS */
-
-
-#ifdef UNDER_NWIFI
-#include "../os/windows/include/athendpack.h"
-#endif
-
-#ifdef ATHR_CE_LEGACY
-#include "../os/windows/include/athendpack.h"
-#endif /* WINCE */
-
-#ifdef WIN_NWF
-#include <athendpack_win.h>
-#endif
diff --git a/drivers/staging/ath6kl/include/athstartpack.h b/drivers/staging/ath6kl/include/athstartpack.h
deleted file mode 100644
index 1c45f66..0000000
--- a/drivers/staging/ath6kl/include/athstartpack.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//------------------------------------------------------------------------------
-// <copyright file="athstartpack.h" company="Atheros">
-// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
-//
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//------------------------------------------------------------------------------
-//==============================================================================
-// start compiler-specific structure packing
-//
-// Author(s): ="Atheros"
-//==============================================================================
-#ifdef VXWORKS
-#endif /* VXWORKS */
-
-#if defined(LINUX) || defined(__linux__)
-#endif /* LINUX */
-
-#ifdef QNX
-#endif /* QNX */
-
-#ifdef INTEGRITY
-#include "integrity/athstartpack_integrity.h"
-#endif /* INTEGRITY */
-
-#ifdef NUCLEUS
-#endif /* NUCLEUS */
-
-#ifdef UNDER_NWIFI
-#include "../os/windows/include/athstartpack.h"
-#endif
-
-#ifdef ATHR_CE_LEGACY
-#include "../os/windows/include/athstartpack.h"
-#endif /* WINCE */
-
-#ifdef WIN_NWF
-#include <athstartpack_win.h>
-#endif
-
-#ifdef THREADX
-#include "../os/threadx/include/common/osapi_threadx.h"
-#endif
diff --git a/drivers/staging/ath6kl/include/common/bmi_msg.h b/drivers/staging/ath6kl/include/common/bmi_msg.h
index e76624c..84e8db5 100644
--- a/drivers/staging/ath6kl/include/common/bmi_msg.h
+++ b/drivers/staging/ath6kl/include/common/bmi_msg.h
@@ -22,10 +22,6 @@
#ifndef __BMI_MSG_H__
#define __BMI_MSG_H__

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
/*
* Bootloader Messaging Interface (BMI)
*
@@ -234,8 +230,4 @@ PREPACK struct bmi_target_info {
* Note: Not supported on all versions of ROM firmware.
*/

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
#endif /* __BMI_MSG_H__ */
diff --git a/drivers/staging/ath6kl/include/common/dbglog.h b/drivers/staging/ath6kl/include/common/dbglog.h
index 3a3d00d..e5ef939 100644
--- a/drivers/staging/ath6kl/include/common/dbglog.h
+++ b/drivers/staging/ath6kl/include/common/dbglog.h
@@ -24,10 +24,6 @@
#ifndef _DBGLOG_H_
#define _DBGLOG_H_

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -127,8 +123,4 @@ PREPACK struct dbglog_config_s {
}
#endif

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
#endif /* _DBGLOG_H_ */
diff --git a/drivers/staging/ath6kl/include/common/dset_internal.h b/drivers/staging/ath6kl/include/common/dset_internal.h
index 6947533..e3ecd8e 100644
--- a/drivers/staging/ath6kl/include/common/dset_internal.h
+++ b/drivers/staging/ath6kl/include/common/dset_internal.h
@@ -25,10 +25,6 @@
#ifndef __DSET_INTERNAL_H__
#define __DSET_INTERNAL_H__

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
/*
* Internal dset definitions, common for DataSet layer.
*/
@@ -56,8 +52,4 @@ typedef PREPACK struct dset_descriptor_s {
Dataset descriptor for BPatch. */
} POSTPACK dset_descriptor_t;

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
#endif /* __DSET_INTERNAL_H__ */
diff --git a/drivers/staging/ath6kl/include/common/dsetid.h b/drivers/staging/ath6kl/include/common/dsetid.h
index 090e309..cc797ba 100644
--- a/drivers/staging/ath6kl/include/common/dsetid.h
+++ b/drivers/staging/ath6kl/include/common/dsetid.h
@@ -25,10 +25,6 @@
#ifndef __DSETID_H__
#define __DSETID_H__

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
/* Well-known DataSet IDs */
#define DSETID_UNUSED 0x00000000
#define DSETID_BOARD_DATA 0x00000001 /* Cal and board data */
@@ -127,8 +123,4 @@ PREPACK struct patch_s {
*/
#define DSETID_BPATCH_FLAG 0x80000000

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
#endif /* __DSETID_H__ */
diff --git a/drivers/staging/ath6kl/include/common/epping_test.h b/drivers/staging/ath6kl/include/common/epping_test.h
index 5c40d8a..c9520ed 100644
--- a/drivers/staging/ath6kl/include/common/epping_test.h
+++ b/drivers/staging/ath6kl/include/common/epping_test.h
@@ -25,10 +25,6 @@
#ifndef EPPING_TEST_H_
#define EPPING_TEST_H_

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
/* alignment to 4-bytes */
#define EPPING_ALIGNMENT_PAD (((sizeof(struct htc_frame_hdr) + 3) & (~0x3)) - sizeof(struct htc_frame_hdr))

@@ -112,9 +108,4 @@ typedef PREPACK struct {
#define HCI_TRANSPORT_STREAM_NUM 16 /* this number is higher than the define WMM AC classes so we
can use this to distinguish packets */

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
-
#endif /*EPPING_TEST_H_*/
diff --git a/drivers/staging/ath6kl/include/common/gmboxif.h b/drivers/staging/ath6kl/include/common/gmboxif.h
index dd9afbd..ea11c14 100644
--- a/drivers/staging/ath6kl/include/common/gmboxif.h
+++ b/drivers/staging/ath6kl/include/common/gmboxif.h
@@ -23,10 +23,6 @@
#ifndef __GMBOXIF_H__
#define __GMBOXIF_H__

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
/* GMBOX interface definitions */

#define AR6K_GMBOX_CREDIT_COUNTER 1 /* we use credit counter 1 to track credits */
@@ -70,9 +66,5 @@ typedef PREPACK struct {
#define MBOX_SIG_HCI_BRIDGE_PWR_SAV_OFF 4


-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
#endif /* __GMBOXIF_H__ */

diff --git a/drivers/staging/ath6kl/include/common/htc.h b/drivers/staging/ath6kl/include/common/htc.h
index b9d4495..85cbfa8 100644
--- a/drivers/staging/ath6kl/include/common/htc.h
+++ b/drivers/staging/ath6kl/include/common/htc.h
@@ -24,10 +24,6 @@
#ifndef __HTC_H__
#define __HTC_H__

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
#define A_OFFSETOF(type,field) (unsigned long)(&(((type *)NULL)->field))

#define ASSEMBLE_UNALIGNED_UINT16(p,highbyte,lowbyte) \
@@ -227,10 +223,5 @@ typedef PREPACK struct {
u8 LookAhead[4]; /* 4 byte lookahead */
} POSTPACK HTC_BUNDLED_LOOKAHEAD_REPORT;

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
-
#endif /* __HTC_H__ */

diff --git a/drivers/staging/ath6kl/include/common/regdump.h b/drivers/staging/ath6kl/include/common/regdump.h
index aa64821..614dfa1 100644
--- a/drivers/staging/ath6kl/include/common/regdump.h
+++ b/drivers/staging/ath6kl/include/common/regdump.h
@@ -24,10 +24,6 @@
#ifndef __REGDUMP_H__
#define __REGDUMP_H__

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
#if defined(AR6001)
#include "AR6001/AR6001_regdump.h"
#endif
@@ -52,8 +48,4 @@ PREPACK struct register_dump_s {
} POSTPACK;
#endif /* __ASSEMBLER__ */

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
#endif /* __REGDUMP_H__ */
diff --git a/drivers/staging/ath6kl/include/common/targaddrs.h b/drivers/staging/ath6kl/include/common/targaddrs.h
index 794ae21..e921b30 100644
--- a/drivers/staging/ath6kl/include/common/targaddrs.h
+++ b/drivers/staging/ath6kl/include/common/targaddrs.h
@@ -22,10 +22,6 @@
#ifndef __TARGADDRS_H__
#define __TARGADDRS_H__

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
#if defined(AR6002)
#include "AR6002/addrs.h"
#endif
@@ -238,8 +234,4 @@ PREPACK struct host_interest_s {

#endif /* !__ASSEMBLER__ */

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
#endif /* __TARGADDRS_H__ */
diff --git a/drivers/staging/ath6kl/include/common/wmi.h b/drivers/staging/ath6kl/include/common/wmi.h
index d3de3cc..363e935 100644
--- a/drivers/staging/ath6kl/include/common/wmi.h
+++ b/drivers/staging/ath6kl/include/common/wmi.h
@@ -34,10 +34,6 @@
#ifndef _WMI_H_
#define _WMI_H_

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
#include "wmix.h"
#include "wlan_defs.h"

@@ -3122,10 +3118,6 @@ typedef PREPACK struct {
* End of AP mode definitions
*/

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/drivers/staging/ath6kl/include/common/wmix.h b/drivers/staging/ath6kl/include/common/wmix.h
index 5ebb828..38c2970 100644
--- a/drivers/staging/ath6kl/include/common/wmix.h
+++ b/drivers/staging/ath6kl/include/common/wmix.h
@@ -40,10 +40,6 @@
extern "C" {
#endif

-#ifndef ATH_TARGET
-#include "athstartpack.h"
-#endif
-
#include "dbglog.h"

/*
@@ -268,9 +264,6 @@ typedef PREPACK struct {
u32 count;
} POSTPACK WMIX_PROF_COUNT_EVENT;

-#ifndef ATH_TARGET
-#include "athendpack.h"
-#endif

#ifdef __cplusplus
}
diff --git a/drivers/staging/ath6kl/wlan/include/ieee80211.h b/drivers/staging/ath6kl/wlan/include/ieee80211.h
index 532ab0e..cf47d06 100644
--- a/drivers/staging/ath6kl/wlan/include/ieee80211.h
+++ b/drivers/staging/ath6kl/wlan/include/ieee80211.h
@@ -23,8 +23,6 @@
#ifndef _NET80211_IEEE80211_H_
#define _NET80211_IEEE80211_H_

-#include "athstartpack.h"
-
/*
* 802.11 protocol definitions.
*/
@@ -396,6 +394,4 @@ enum ieee80211_authmode {

#define IEEE80211_PS_MAX_QUEUE 50 /*Maximum no of buffers that can be queues for PS*/

-#include "athendpack.h"
-
#endif /* _NET80211_IEEE80211_H_ */
diff --git a/drivers/staging/ath6kl/wmi/wmi.c b/drivers/staging/ath6kl/wmi/wmi.c
index 153ca1f..aad0c97 100644
--- a/drivers/staging/ath6kl/wmi/wmi.c
+++ b/drivers/staging/ath6kl/wmi/wmi.c
@@ -265,8 +265,6 @@ const u8 up_to_ac[]= {
WMM_AC_VO,
};

-#include "athstartpack.h"
-
/* This stuff is used when we want a simple layer-3 visibility */
typedef PREPACK struct _iphdr {
u8 ip_ver_hdrlen; /* version and hdr length */
@@ -284,8 +282,6 @@ typedef PREPACK struct _iphdr {
u8 ip_dst[4];
} POSTPACK iphdr;

-#include "athendpack.h"
-
static s16 rssi_event_value = 0;
static s16 snr_event_value = 0;

--
1.7.0.4


2011-03-30 00:57:31

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 22/34] ath6kl: use CONFIG_ATH6KL_ENABLE_COEXISTENCE

When CONFIG_ATH6KL_ENABLE_COEXISTENCE gets enabled we define
another flag called ENABLE_COEXISTENCE, just use
CONFIG_ATH6KL_ENABLE_COEXISTENCE since that is already defined
by the generated autoconf header file from the kernel.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 4 ----
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 8 ++++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index b0f711e..1d3f239 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -29,10 +29,6 @@ ccflags-y += -I$(obj)/os
ccflags-y += -I$(obj)/bmi/include
ccflags-y += -I$(obj)/include/common/AR6002/hw4.0

-ifeq ($(CONFIG_ATH6KL_ENABLE_COEXISTENCE),y)
-ccflags-y += -DENABLE_COEXISTENCE
-endif
-
ifeq ($(CONFIG_AR600x_DUAL_ANTENNA),y)
ccflags-y += -DAR600x_DUAL_ANTENNA
endif
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 8f9e4b2..1798889 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -2334,10 +2334,10 @@ u8 ar6000_endpoint_id2_ac(void * devt, HTC_ENDPOINT_ID ep )
int ar6000_target_config_wlan_params(struct ar6_softc *ar)
{
int status = 0;
-#if defined(ENABLE_COEXISTENCE)
+#if defined(CONFIG_ATH6KL_ENABLE_COEXISTENCE)
WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD sbcb_cmd;
WMI_SET_BTCOEX_FE_ANT_CMD sbfa_cmd;
-#endif /* ENABLE_COEXISTENCE */
+#endif /* CONFIG_ATH6KL_ENABLE_COEXISTENCE */

#ifdef CONFIG_HOST_TCMD_SUPPORT
if (ar->arTargetMode != AR6000_WLAN_MODE) {
@@ -2355,7 +2355,7 @@ int ar6000_target_config_wlan_params(struct ar6_softc *ar)
status = A_ERROR;
}

-#if defined(ENABLE_COEXISTENCE)
+#if defined(CONFIG_ATH6KL_ENABLE_COEXISTENCE)
/* Configure the type of BT collocated with WLAN */
memset(&sbcb_cmd, 0, sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD));
#ifdef CONFIG_AR600x_BT_QCOM
@@ -2387,7 +2387,7 @@ int ar6000_target_config_wlan_params(struct ar6_softc *ar)
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set fornt end antenna configuration\n"));
status = A_ERROR;
}
-#endif /* ENABLE_COEXISTENCE */
+#endif /* CONFIG_ATH6KL_ENABLE_COEXISTENCE */

#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN
if ((wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN)) != 0) {
--
1.7.0.4


2011-03-30 00:57:08

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 13/34] ath6kl: remove USER_KEYS define

This is always defined so just keep the code.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 1 -
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 11 -----------
.../staging/ath6kl/os/linux/include/ar6000_drv.h | 5 -----
.../staging/ath6kl/os/linux/include/athdrv_linux.h | 2 --
4 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index a86dd5a..d7441e7 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -110,7 +110,6 @@ ifeq ($(CONFIG_ATH6KL_SKIP_ABI_VERSION_CHECK),y)
ccflags-y += -DATH6KL_SKIP_ABI_VERSION_CHECK
endif

-ccflags-y += -DUSER_KEYS
ccflags-y += -DNO_SYNC_FLUSH
ccflags-y += -DHTC_EP_STAT_PROFILING
ccflags-y += -DWAPI_ENABLE
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 2a5abe0..abde256 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -349,9 +349,7 @@ static void ar6000_cookie_cleanup(struct ar6_softc *ar);
static void ar6000_free_cookie(struct ar6_softc *ar, struct ar_cookie * cookie);
static struct ar_cookie *ar6000_alloc_cookie(struct ar6_softc *ar);

-#ifdef USER_KEYS
static int ar6000_reinstall_keys(struct ar6_softc *ar,u8 key_op_ctrl);
-#endif

#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
struct net_device *arApNetDev;
@@ -1926,10 +1924,8 @@ ar6000_stop_endpoint(struct net_device *dev, bool keepprofile, bool getdbglogs)
ar6000_disconnect_event(ar, DISCONNECT_CMD, ar->arBssid, 0, NULL, 0);
}
}
-#ifdef USER_KEYS
ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT;
ar->user_key_ctrl = 0;
-#endif
}

AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI stopped\n", __func__));
@@ -4347,7 +4343,6 @@ skip_key:
wireless_send_event(ar->arNetDev, IWEVCUSTOM, &wrqu, buf);
}

-#ifdef USER_KEYS
if (ar->user_savedkeys_stat == USER_SAVEDKEYS_STAT_RUN &&
ar->user_saved_keys.keyOk == true)
{
@@ -4360,7 +4355,6 @@ skip_key:
}
ar6000_reinstall_keys(ar, key_op_ctrl);
}
-#endif /* USER_KEYS */

netif_wake_queue(ar->arNetDev);

@@ -4581,13 +4575,11 @@ ar6000_disconnect_event(struct ar6_softc *ar, u8 reason, u8 *bssid,
reconnect_flag = 0;
}

-#ifdef USER_KEYS
if (reason != CSERV_DISCONNECT)
{
ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT;
ar->user_key_ctrl = 0;
}
-#endif /* USER_KEYS */

netif_stop_queue(ar->arNetDev);
A_MEMZERO(ar->arBssid, sizeof(ar->arBssid));
@@ -5713,9 +5705,7 @@ void ap_wapi_rekey_event(struct ar6_softc *ar, u8 type, u8 *mac)
}
#endif

-#ifdef USER_KEYS
static int
-
ar6000_reinstall_keys(struct ar6_softc *ar, u8 key_op_ctrl)
{
int status = 0;
@@ -5760,7 +5750,6 @@ _reinstall_keys_out:

return status;
}
-#endif /* USER_KEYS */


void
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
index 5b053ab..23427cf 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
@@ -92,8 +92,6 @@
#endif


-#ifdef USER_KEYS
-
#define USER_SAVEDKEYS_STAT_INIT 0
#define USER_SAVEDKEYS_STAT_RUN 1

@@ -104,7 +102,6 @@ struct USER_SAVEDKEYS {
CRYPTO_TYPE keyType;
bool keyOk;
};
-#endif

#define DBG_INFO 0x00000001
#define DBG_ERROR 0x00000002
@@ -540,11 +537,9 @@ struct ar6_softc {
u32 log_cnt;
u32 dbglog_init_done;
u32 arConnectCtrlFlags;
-#ifdef USER_KEYS
s32 user_savedkeys_stat;
u32 user_key_ctrl;
struct USER_SAVEDKEYS user_saved_keys;
-#endif
USER_RSSI_THOLD rssi_map[12];
u8 arUserBssFilter;
u16 ap_profile_flag; /* AP mode */
diff --git a/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h b/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
index 065b09b..3d5f01d 100644
--- a/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
+++ b/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
@@ -620,7 +620,6 @@ typedef enum {
*/
#define AR6000_XIOCTL_WMI_SET_TXOP 57

-#ifdef USER_KEYS
/*
* arguments:
* UINT32 cmd (AR6000_XIOCTL_USER_SETKEYS)
@@ -628,7 +627,6 @@ typedef enum {
* uses struct ar6000_user_setkeys_info
*/
#define AR6000_XIOCTL_USER_SETKEYS 58
-#endif /* USER_KEYS */

#define AR6000_XIOCTL_WMI_SET_KEEPALIVE 59
/*
--
1.7.0.4


2011-03-30 00:57:45

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 28/34] ath6kl: style cleanup on struct sdio_driver components

No functional changes except renames of the routines and
id data structure.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
.../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 172 ++++++++++----------
1 files changed, 85 insertions(+), 87 deletions(-)

diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
index c862a19..9420c40 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
@@ -56,12 +56,14 @@
static int hifDeviceSuspend(struct device *dev);
static int hifDeviceResume(struct device *dev);
#endif /* CONFIG_PM */
-static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id);
-static void hifDeviceRemoved(struct sdio_func *func);
static void delHifDevice(struct hif_device * device);
static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte);
static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsigned char *byte);

+static int hifEnableFunc(struct hif_device *device, struct sdio_func *func);
+static int hifDisableFunc(struct hif_device *device, struct sdio_func *func);
+OSDRV_CALLBACKS osdrvCallbacks;
+
int reset_sdio_on_unload = 0;
module_param(reset_sdio_on_unload, int, 0644);

@@ -88,21 +90,86 @@ static struct hif_device *ath6kl_get_hifdev(struct sdio_func *func)
return (struct hif_device *) sdio_get_drvdata(func);
}

-/* ------ Static Variables ------ */
-static const struct sdio_device_id ar6k_id_table[] = {
- { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6002_BASE | 0x0)) },
- { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6002_BASE | 0x1)) },
- { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x0)) },
- { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x1)) },
- { /* null */ },
+static const struct sdio_device_id ath6kl_hifdev_ids[] = {
+ { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6002_BASE | 0x0)) },
+ { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6002_BASE | 0x1)) },
+ { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x0)) },
+ { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x1)) },
+ { /* null */ },
};
-MODULE_DEVICE_TABLE(sdio, ar6k_id_table);

-static struct sdio_driver ar6k_driver = {
- .name = "ar6k_wlan",
- .id_table = ar6k_id_table,
- .probe = hifDeviceInserted,
- .remove = hifDeviceRemoved,
+MODULE_DEVICE_TABLE(sdio, ath6kl_hifdev_ids);
+
+static int ath6kl_hifdev_probe(struct sdio_func *func,
+ const struct sdio_device_id *id)
+{
+ int ret;
+ struct hif_device *device;
+ int count;
+
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
+ ("ath6kl: Function: 0x%X, Vendor ID: 0x%X, "
+ "Device ID: 0x%X, block size: 0x%X/0x%X\n",
+ func->num, func->vendor, func->device,
+ func->max_blksize, func->cur_blksize));
+
+ ath6kl_alloc_hifdev(func);
+ device = ath6kl_get_hifdev(func);
+
+ device->id = id;
+ device->is_disabled = true;
+
+ spin_lock_init(&device->lock);
+ spin_lock_init(&device->asynclock);
+
+ DL_LIST_INIT(&device->ScatterReqHead);
+
+ /* Try to allow scatter unless globally overridden */
+ if (!nohifscattersupport)
+ device->scatter_enabled = true;
+
+ A_MEMZERO(device->busRequest, sizeof(device->busRequest));
+
+ for (count = 0; count < BUS_REQUEST_MAX_NUM; count++) {
+ sema_init(&device->busRequest[count].sem_req, 0);
+ hifFreeBusRequest(device, &device->busRequest[count]);
+ }
+
+ sema_init(&device->sem_async, 0);
+
+ ret = hifEnableFunc(device, func);
+
+ return ret;
+}
+
+static void ath6kl_hifdev_remove(struct sdio_func *func)
+{
+ int status = 0;
+ struct hif_device *device;
+ AR_DEBUG_ASSERT(func != NULL);
+
+ device = ath6kl_get_hifdev(func);
+ if (device->claimedContext != NULL)
+ status = osdrvCallbacks.
+ deviceRemovedHandler(device->claimedContext, device);
+
+ if (device->is_disabled)
+ device->is_disabled = false;
+ else
+ status = hifDisableFunc(device, func);
+
+ CleanupHIFScatterResources(device);
+
+ delHifDevice(device);
+ AR_DEBUG_ASSERT(status == 0);
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
+}
+
+static struct sdio_driver ath6kl_hifdev_driver = {
+ .name = "ath6kl_hifdev",
+ .id_table = ath6kl_hifdev_ids,
+ .probe = ath6kl_hifdev_probe,
+ .remove = ath6kl_hifdev_remove,
};

#if defined(CONFIG_PM)
@@ -119,14 +186,11 @@ static struct dev_pm_ops ar6k_device_pm_ops = {
/* make sure we only unregister when registered. */
static int registered = 0;

-OSDRV_CALLBACKS osdrvCallbacks;
extern u32 onebitmode;
extern u32 busspeedlow;
extern u32 debughif;

static void ResetAllCards(void);
-static int hifDisableFunc(struct hif_device *device, struct sdio_func *func);
-static int hifEnableFunc(struct hif_device *device, struct sdio_func *func);

#ifdef DEBUG

@@ -156,10 +220,10 @@ int HIFInit(OSDRV_CALLBACKS *callbacks)

#if defined(CONFIG_PM)
if (callbacks->deviceSuspendHandler && callbacks->deviceResumeHandler)
- ar6k_driver.drv.pm = &ar6k_device_pm_ops;
+ ath6kl_hifdev_driver.drv.pm = &ar6k_device_pm_ops;
#endif /* CONFIG_PM */

- r = sdio_register_driver(&ar6k_driver);
+ r = sdio_register_driver(&ath6kl_hifdev_driver);
if (r < 0)
return r;

@@ -777,7 +841,7 @@ HIFShutDownDevice(struct hif_device *device)
registered = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("AR6000: Unregistering with the bus driver\n"));
- sdio_unregister_driver(&ar6k_driver);
+ sdio_unregister_driver(&ath6kl_hifdev_driver);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("AR6000: Unregistered\n"));
}
@@ -837,48 +901,6 @@ static int enable_task(void *param)
}
#endif

-static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id)
-{
- int ret;
- struct hif_device * device;
- int count;
-
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("AR6000: hifDeviceInserted, Function: 0x%X, Vendor ID: 0x%X, Device ID: 0x%X, block size: 0x%X/0x%X\n",
- func->num, func->vendor, func->device, func->max_blksize, func->cur_blksize));
-
- ath6kl_alloc_hifdev(func);
- device = ath6kl_get_hifdev(func);
-
- device->id = id;
- device->is_disabled = true;
-
- spin_lock_init(&device->lock);
-
- spin_lock_init(&device->asynclock);
-
- DL_LIST_INIT(&device->ScatterReqHead);
-
- if (!nohifscattersupport) {
- /* try to allow scatter operation on all instances,
- * unless globally overridden */
- device->scatter_enabled = true;
- }
-
- /* Initialize the bus requests to be used later */
- A_MEMZERO(device->busRequest, sizeof(device->busRequest));
- for (count = 0; count < BUS_REQUEST_MAX_NUM; count ++) {
- sema_init(&device->busRequest[count].sem_req, 0);
- hifFreeBusRequest(device, &device->busRequest[count]);
- }
- sema_init(&device->sem_async, 0);
-
- ret = hifEnableFunc(device, func);
-
- return ret;
-}
-
-
void
HIFAckInterrupt(struct hif_device *device)
{
@@ -1139,30 +1161,6 @@ static int hifDeviceResume(struct device *dev)
}
#endif /* CONFIG_PM */

-static void hifDeviceRemoved(struct sdio_func *func)
-{
- int status = 0;
- struct hif_device *device;
- AR_DEBUG_ASSERT(func != NULL);
-
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n"));
- device = ath6kl_get_hifdev(func);
- if (device->claimedContext != NULL) {
- status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device);
- }
-
- if (device->is_disabled) {
- device->is_disabled = false;
- } else {
- status = hifDisableFunc(device, func);
- }
- CleanupHIFScatterResources(device);
-
- delHifDevice(device);
- AR_DEBUG_ASSERT(status == 0);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
-}
-
/*
* This should be moved to AR6K HTC layer.
*/
--
1.7.0.4


2011-03-30 00:57:58

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 34/34] ath6kl: remove the HTC raw interface

This uses ioctl, if this is required it should be replaced
with the nl80211 test command interface.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Kconfig | 6 -
drivers/staging/ath6kl/Makefile | 5 -
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 36 --
drivers/staging/ath6kl/os/linux/ar6000_raw_if.c | 455 --------------------
.../staging/ath6kl/os/linux/include/ar6000_drv.h | 20 -
.../staging/ath6kl/os/linux/include/athdrv_linux.h | 37 --
6 files changed, 0 insertions(+), 559 deletions(-)
delete mode 100644 drivers/staging/ath6kl/os/linux/ar6000_raw_if.c

diff --git a/drivers/staging/ath6kl/Kconfig b/drivers/staging/ath6kl/Kconfig
index 1f15e1f..3db09ab 100644
--- a/drivers/staging/ath6kl/Kconfig
+++ b/drivers/staging/ath6kl/Kconfig
@@ -100,12 +100,6 @@ config AR600x_BT_RESET_PIN
help
WLAN GPIO to be used for resetting BT

-config ATH6KL_HTC_RAW_INTERFACE
- bool "RAW HTC support"
- depends on ATH6K_LEGACY
- help
- Enables raw HTC interface. Allows application to directly talk to the HTC interface via the ioctl interface
-
config ATH6KL_VIRTUAL_SCATTER_GATHER
bool "Virtual Scatter-Gather support"
depends on ATH6K_LEGACY
diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index 1d3f239..dfba8f4 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -65,10 +65,6 @@ ifeq ($(CONFIG_ATH6KL_CONFIG_GPIO_BT_RESET),y)
ccflags-y += -DATH6KL_CONFIG_GPIO_BT_RESET
endif

-ifeq ($(CONFIG_ATH6KL_HTC_RAW_INTERFACE),y)
-ccflags-y += -DHTC_RAW_INTERFACE
-endif
-
ifeq ($(CONFIG_ATH6KL_ENABLE_HOST_DEBUG),y)
ccflags-y += -DDEBUG
ccflags-y += -DATH_DEBUG_MODULE
@@ -103,7 +99,6 @@ ath6kl-y += htc2/htc.o
ath6kl-y += bmi/src/bmi.o
ath6kl-y += os/linux/cfg80211.o
ath6kl-y += os/linux/ar6000_drv.o
-ath6kl-y += os/linux/ar6000_raw_if.o
ath6kl-y += os/linux/ar6000_pm.o
ath6kl-y += os/linux/netbuf.o
ath6kl-y += os/linux/hci_bridge.o
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 666d5e6..31be5ca 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -1000,19 +1000,6 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address,
compressed = false;
}
#endif
-#ifdef HTC_RAW_INTERFACE
- if (!eppingtest && bypasswmi) {
- if (ar->arVersion.target_ver == AR6003_REV1_VERSION) {
- filename = AR6003_REV1_ART_FIRMWARE_FILE;
- } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) {
- filename = AR6003_REV2_ART_FIRMWARE_FILE;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver));
- return A_ERROR;
- }
- compressed = false;
- }
-#endif
break;

case AR6K_PATCH_FILE:
@@ -1333,13 +1320,6 @@ ar6000_sysfs_bmi_get_config(struct ar6_softc *ar, u32 mode)
#endif /* CONFIG_ATH6KL_BT_UART_FC_POLARITY */
}

-#ifdef HTC_RAW_INTERFACE
- if (!eppingtest && bypasswmi) {
- /* Don't run BMIDone for ART mode and force resetok=0 */
- resetok = 0;
- msleep(1000);
- }
-#endif /* HTC_RAW_INTERFACE */
}

return 0;
@@ -1545,20 +1525,10 @@ static int __ath6kl_init_netdev(struct net_device *dev)
return 0;
}

-#ifdef HTC_RAW_INTERFACE
static int ath6kl_init_netdev_wmi(struct net_device *dev)
{
- if (!eppingtest && bypasswmi)
- return 0;
-
return __ath6kl_init_netdev(dev);
}
-#else
-static int ath6kl_init_netdev_wmi(struct net_device *dev)
-{
- return __ath6kl_init_netdev(dev);
-}
-#endif

static int ath6kl_init_netdev(struct ar6_softc *ar)
{
@@ -2034,12 +2004,6 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister)
memset(tx_post, 0, sizeof(tx_post));
memset(tx_complete, 0, sizeof(tx_complete));

-#ifdef HTC_RAW_INTERFACE
- if (ar->arRawHtc) {
- kfree(ar->arRawHtc);
- ar->arRawHtc = NULL;
- }
-#endif
/* Free up the device data structure */
if (unregister && is_netdev_registered) {
unregister_netdev(dev);
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c b/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
deleted file mode 100644
index ae7c1dd..0000000
--- a/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
+++ /dev/null
@@ -1,455 +0,0 @@
-//------------------------------------------------------------------------------
-// Copyright (c) 2004-2010 Atheros Communications Inc.
-// All rights reserved.
-//
-//
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//
-// Author(s): ="Atheros"
-//------------------------------------------------------------------------------
-
-#include "ar6000_drv.h"
-
-#ifdef HTC_RAW_INTERFACE
-
-static void
-ar6000_htc_raw_read_cb(void *Context, struct htc_packet *pPacket)
-{
- struct ar6_softc *ar = (struct ar6_softc *)Context;
- raw_htc_buffer *busy;
- HTC_RAW_STREAM_ID streamID;
- AR_RAW_HTC_T *arRaw = ar->arRawHtc;
-
- busy = (raw_htc_buffer *)pPacket->pPktContext;
- A_ASSERT(busy != NULL);
-
- if (pPacket->Status == A_ECANCELED) {
- /*
- * HTC provides A_ECANCELED status when it doesn't want to be refilled
- * (probably due to a shutdown)
- */
- return;
- }
-
- streamID = arEndpoint2RawStreamID(ar,pPacket->Endpoint);
- A_ASSERT(streamID != HTC_RAW_STREAM_NOT_MAPPED);
-
-#ifdef CF
- if (down_trylock(&arRaw->raw_htc_read_sem[streamID])) {
-#else
- if (down_interruptible(&arRaw->raw_htc_read_sem[streamID])) {
-#endif /* CF */
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to down the semaphore\n"));
- }
-
- A_ASSERT((pPacket->Status != 0) ||
- (pPacket->pBuffer == (busy->data + HTC_HEADER_LEN)));
-
- busy->length = pPacket->ActualLength + HTC_HEADER_LEN;
- busy->currPtr = HTC_HEADER_LEN;
- arRaw->read_buffer_available[streamID] = true;
- //AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("raw read cb: 0x%X 0x%X \n", busy->currPtr,busy->length);
- up(&arRaw->raw_htc_read_sem[streamID]);
-
- /* Signal the waiting process */
- AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("Waking up the StreamID(%d) read process\n", streamID));
- wake_up_interruptible(&arRaw->raw_htc_read_queue[streamID]);
-}
-
-static void
-ar6000_htc_raw_write_cb(void *Context, struct htc_packet *pPacket)
-{
- struct ar6_softc *ar = (struct ar6_softc *)Context;
- raw_htc_buffer *free;
- HTC_RAW_STREAM_ID streamID;
- AR_RAW_HTC_T *arRaw = ar->arRawHtc;
-
- free = (raw_htc_buffer *)pPacket->pPktContext;
- A_ASSERT(free != NULL);
-
- if (pPacket->Status == A_ECANCELED) {
- /*
- * HTC provides A_ECANCELED status when it doesn't want to be refilled
- * (probably due to a shutdown)
- */
- return;
- }
-
- streamID = arEndpoint2RawStreamID(ar,pPacket->Endpoint);
- A_ASSERT(streamID != HTC_RAW_STREAM_NOT_MAPPED);
-
-#ifdef CF
- if (down_trylock(&arRaw->raw_htc_write_sem[streamID])) {
-#else
- if (down_interruptible(&arRaw->raw_htc_write_sem[streamID])) {
-#endif
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to down the semaphore\n"));
- }
-
- A_ASSERT(pPacket->pBuffer == (free->data + HTC_HEADER_LEN));
-
- free->length = 0;
- arRaw->write_buffer_available[streamID] = true;
- up(&arRaw->raw_htc_write_sem[streamID]);
-
- /* Signal the waiting process */
- AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("Waking up the StreamID(%d) write process\n", streamID));
- wake_up_interruptible(&arRaw->raw_htc_write_queue[streamID]);
-}
-
-/* connect to a service */
-static int ar6000_connect_raw_service(struct ar6_softc *ar,
- HTC_RAW_STREAM_ID StreamID)
-{
- int status;
- struct htc_service_connect_resp response;
- u8 streamNo;
- struct htc_service_connect_req connect;
-
- do {
-
- A_MEMZERO(&connect,sizeof(connect));
- /* pass the stream ID as meta data to the RAW streams service */
- streamNo = (u8)StreamID;
- connect.pMetaData = &streamNo;
- connect.MetaDataLength = sizeof(u8);
- /* these fields are the same for all endpoints */
- connect.EpCallbacks.pContext = ar;
- connect.EpCallbacks.EpTxComplete = ar6000_htc_raw_write_cb;
- connect.EpCallbacks.EpRecv = ar6000_htc_raw_read_cb;
- /* simple interface, we don't need these optional callbacks */
- connect.EpCallbacks.EpRecvRefill = NULL;
- connect.EpCallbacks.EpSendFull = NULL;
- connect.MaxSendQueueDepth = RAW_HTC_WRITE_BUFFERS_NUM;
-
- /* connect to the raw streams service, we may be able to get 1 or more
- * connections, depending on WHAT is running on the target */
- connect.ServiceID = HTC_RAW_STREAMS_SVC;
-
- A_MEMZERO(&response,sizeof(response));
-
- /* try to connect to the raw stream, it is okay if this fails with
- * status HTC_SERVICE_NO_MORE_EP */
- status = HTCConnectService(ar->arHtcTarget,
- &connect,
- &response);
-
- if (status) {
- if (response.ConnectRespCode == HTC_SERVICE_NO_MORE_EP) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HTC RAW , No more streams allowed \n"));
- status = 0;
- }
- break;
- }
-
- /* set endpoint mapping for the RAW HTC streams */
- arSetRawStream2EndpointIDMap(ar,StreamID,response.Endpoint);
-
- AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("HTC RAW : stream ID: %d, endpoint: %d\n",
- StreamID, arRawStream2EndpointID(ar,StreamID)));
-
- } while (false);
-
- return status;
-}
-
-int ar6000_htc_raw_open(struct ar6_softc *ar)
-{
- int status;
- int streamID, endPt, count2;
- raw_htc_buffer *buffer;
- HTC_SERVICE_ID servicepriority;
- AR_RAW_HTC_T *arRaw = ar->arRawHtc;
- if (!arRaw) {
- arRaw = ar->arRawHtc = A_MALLOC(sizeof(AR_RAW_HTC_T));
- if (arRaw) {
- A_MEMZERO(arRaw, sizeof(AR_RAW_HTC_T));
- }
- }
- A_ASSERT(ar->arHtcTarget != NULL);
- if (!arRaw) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Faile to allocate memory for HTC RAW interface\n"));
- return -ENOMEM;
- }
- /* wait for target */
- status = HTCWaitTarget(ar->arHtcTarget);
-
- if (status) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HTCWaitTarget failed (%d)\n", status));
- return -ENODEV;
- }
-
- for (endPt = 0; endPt < ENDPOINT_MAX; endPt++) {
- arRaw->arEp2RawMapping[endPt] = HTC_RAW_STREAM_NOT_MAPPED;
- }
-
- for (streamID = HTC_RAW_STREAM_0; streamID < HTC_RAW_STREAM_NUM_MAX; streamID++) {
- /* Initialize the data structures */
- sema_init(&arRaw->raw_htc_read_sem[streamID], 1);
- sema_init(&arRaw->raw_htc_write_sem[streamID], 1);
- init_waitqueue_head(&arRaw->raw_htc_read_queue[streamID]);
- init_waitqueue_head(&arRaw->raw_htc_write_queue[streamID]);
-
- /* try to connect to the raw service */
- status = ar6000_connect_raw_service(ar,streamID);
-
- if (status) {
- break;
- }
-
- if (arRawStream2EndpointID(ar,streamID) == 0) {
- break;
- }
-
- for (count2 = 0; count2 < RAW_HTC_READ_BUFFERS_NUM; count2 ++) {
- /* Initialize the receive buffers */
- buffer = &arRaw->raw_htc_write_buffer[streamID][count2];
- memset(buffer, 0, sizeof(raw_htc_buffer));
- buffer = &arRaw->raw_htc_read_buffer[streamID][count2];
- memset(buffer, 0, sizeof(raw_htc_buffer));
-
- SET_HTC_PACKET_INFO_RX_REFILL(&buffer->HTCPacket,
- buffer,
- buffer->data,
- HTC_RAW_BUFFER_SIZE,
- arRawStream2EndpointID(ar,streamID));
-
- /* Queue buffers to HTC for receive */
- if ((status = HTCAddReceivePkt(ar->arHtcTarget, &buffer->HTCPacket)) != 0)
- {
- BMIInit();
- return -EIO;
- }
- }
-
- for (count2 = 0; count2 < RAW_HTC_WRITE_BUFFERS_NUM; count2 ++) {
- /* Initialize the receive buffers */
- buffer = &arRaw->raw_htc_write_buffer[streamID][count2];
- memset(buffer, 0, sizeof(raw_htc_buffer));
- }
-
- arRaw->read_buffer_available[streamID] = false;
- arRaw->write_buffer_available[streamID] = true;
- }
-
- if (status) {
- return -EIO;
- }
-
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("HTC RAW, number of streams the target supports: %d \n", streamID));
-
- servicepriority = HTC_RAW_STREAMS_SVC; /* only 1 */
-
- /* set callbacks and priority list */
- HTCSetCreditDistribution(ar->arHtcTarget,
- ar,
- NULL, /* use default */
- NULL, /* use default */
- &servicepriority,
- 1);
-
- /* Start the HTC component */
- if ((status = HTCStart(ar->arHtcTarget)) != 0) {
- BMIInit();
- return -EIO;
- }
-
- (ar)->arRawIfInit = true;
-
- return 0;
-}
-
-int ar6000_htc_raw_close(struct ar6_softc *ar)
-{
- A_PRINTF("ar6000_htc_raw_close called \n");
- HTCStop(ar->arHtcTarget);
-
- /* reset the device */
- ar6000_reset_device(ar->arHifDevice, ar->arTargetType, true, false);
- /* Initialize the BMI component */
- BMIInit();
-
- return 0;
-}
-
-raw_htc_buffer *
-get_filled_buffer(struct ar6_softc *ar, HTC_RAW_STREAM_ID StreamID)
-{
- int count;
- raw_htc_buffer *busy;
- AR_RAW_HTC_T *arRaw = ar->arRawHtc;
-
- /* Check for data */
- for (count = 0; count < RAW_HTC_READ_BUFFERS_NUM; count ++) {
- busy = &arRaw->raw_htc_read_buffer[StreamID][count];
- if (busy->length) {
- break;
- }
- }
- if (busy->length) {
- arRaw->read_buffer_available[StreamID] = true;
- } else {
- arRaw->read_buffer_available[StreamID] = false;
- }
-
- return busy;
-}
-
-ssize_t ar6000_htc_raw_read(struct ar6_softc *ar, HTC_RAW_STREAM_ID StreamID,
- char __user *buffer, size_t length)
-{
- int readPtr;
- raw_htc_buffer *busy;
- AR_RAW_HTC_T *arRaw = ar->arRawHtc;
-
- if (arRawStream2EndpointID(ar,StreamID) == 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("StreamID(%d) not connected! \n", StreamID));
- return -EFAULT;
- }
-
- if (down_interruptible(&arRaw->raw_htc_read_sem[StreamID])) {
- return -ERESTARTSYS;
- }
-
- busy = get_filled_buffer(ar,StreamID);
- while (!arRaw->read_buffer_available[StreamID]) {
- up(&arRaw->raw_htc_read_sem[StreamID]);
-
- /* Wait for the data */
- AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("Sleeping StreamID(%d) read process\n", StreamID));
- if (wait_event_interruptible(arRaw->raw_htc_read_queue[StreamID],
- arRaw->read_buffer_available[StreamID]))
- {
- return -EINTR;
- }
- if (down_interruptible(&arRaw->raw_htc_read_sem[StreamID])) {
- return -ERESTARTSYS;
- }
- busy = get_filled_buffer(ar,StreamID);
- }
-
- /* Read the data */
- readPtr = busy->currPtr;
- if (length > busy->length - HTC_HEADER_LEN) {
- length = busy->length - HTC_HEADER_LEN;
- }
- if (copy_to_user(buffer, &busy->data[readPtr], length)) {
- up(&arRaw->raw_htc_read_sem[StreamID]);
- return -EFAULT;
- }
-
- busy->currPtr += length;
-
- if (busy->currPtr == busy->length)
- {
- busy->currPtr = 0;
- busy->length = 0;
- HTC_PACKET_RESET_RX(&busy->HTCPacket);
- //AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("raw read ioctl: ep for packet:%d \n", busy->HTCPacket.Endpoint));
- HTCAddReceivePkt(ar->arHtcTarget, &busy->HTCPacket);
- }
- arRaw->read_buffer_available[StreamID] = false;
- up(&arRaw->raw_htc_read_sem[StreamID]);
-
- return length;
-}
-
-static raw_htc_buffer *
-get_free_buffer(struct ar6_softc *ar, HTC_ENDPOINT_ID StreamID)
-{
- int count;
- raw_htc_buffer *free;
- AR_RAW_HTC_T *arRaw = ar->arRawHtc;
-
- free = NULL;
- for (count = 0; count < RAW_HTC_WRITE_BUFFERS_NUM; count ++) {
- free = &arRaw->raw_htc_write_buffer[StreamID][count];
- if (free->length == 0) {
- break;
- }
- }
- if (!free->length) {
- arRaw->write_buffer_available[StreamID] = true;
- } else {
- arRaw->write_buffer_available[StreamID] = false;
- }
-
- return free;
-}
-
-ssize_t ar6000_htc_raw_write(struct ar6_softc *ar, HTC_RAW_STREAM_ID StreamID,
- char __user *buffer, size_t length)
-{
- int writePtr;
- raw_htc_buffer *free;
- AR_RAW_HTC_T *arRaw = ar->arRawHtc;
- if (arRawStream2EndpointID(ar,StreamID) == 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("StreamID(%d) not connected! \n", StreamID));
- return -EFAULT;
- }
-
- if (down_interruptible(&arRaw->raw_htc_write_sem[StreamID])) {
- return -ERESTARTSYS;
- }
-
- /* Search for a free buffer */
- free = get_free_buffer(ar,StreamID);
-
- /* Check if there is space to write else wait */
- while (!arRaw->write_buffer_available[StreamID]) {
- up(&arRaw->raw_htc_write_sem[StreamID]);
-
- /* Wait for buffer to become free */
- AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("Sleeping StreamID(%d) write process\n", StreamID));
- if (wait_event_interruptible(arRaw->raw_htc_write_queue[StreamID],
- arRaw->write_buffer_available[StreamID]))
- {
- return -EINTR;
- }
- if (down_interruptible(&arRaw->raw_htc_write_sem[StreamID])) {
- return -ERESTARTSYS;
- }
- free = get_free_buffer(ar,StreamID);
- }
-
- /* Send the data */
- writePtr = HTC_HEADER_LEN;
- if (length > (HTC_RAW_BUFFER_SIZE - HTC_HEADER_LEN)) {
- length = HTC_RAW_BUFFER_SIZE - HTC_HEADER_LEN;
- }
-
- if (copy_from_user(&free->data[writePtr], buffer, length)) {
- up(&arRaw->raw_htc_read_sem[StreamID]);
- return -EFAULT;
- }
-
- free->length = length;
-
- SET_HTC_PACKET_INFO_TX(&free->HTCPacket,
- free,
- &free->data[writePtr],
- length,
- arRawStream2EndpointID(ar,StreamID),
- AR6K_DATA_PKT_TAG);
-
- HTCSendPkt(ar->arHtcTarget,&free->HTCPacket);
-
- arRaw->write_buffer_available[StreamID] = false;
- up(&arRaw->raw_htc_write_sem[StreamID]);
-
- return length;
-}
-#endif /* HTC_RAW_INTERFACE */
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
index e47b078..ae57573 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
@@ -539,9 +539,6 @@ struct ar6_softc {
u8 arHiAcStreamActivePri;
u8 arEp2AcMapping[ENDPOINT_MAX];
HTC_ENDPOINT_ID arControlEp;
-#ifdef HTC_RAW_INTERFACE
- AR_RAW_HTC_T *arRawHtc;
-#endif
bool arNetQueueStopped;
bool arRawIfInit;
int arDeviceIndex;
@@ -680,23 +677,6 @@ int ar6000_acl_data_tx(struct sk_buff *skb, struct net_device *dev);
void ar6000_restart_endpoint(struct net_device *dev);
void ar6000_stop_endpoint(struct net_device *dev, bool keepprofile, bool getdbglogs);

-#ifdef HTC_RAW_INTERFACE
-
-#ifndef __user
-#define __user
-#endif
-
-int ar6000_htc_raw_open(struct ar6_softc *ar);
-int ar6000_htc_raw_close(struct ar6_softc *ar);
-ssize_t ar6000_htc_raw_read(struct ar6_softc *ar,
- HTC_RAW_STREAM_ID StreamID,
- char __user *buffer, size_t count);
-ssize_t ar6000_htc_raw_write(struct ar6_softc *ar,
- HTC_RAW_STREAM_ID StreamID,
- char __user *buffer, size_t count);
-
-#endif /* HTC_RAW_INTERFACE */
-
/* AP mode */
/*TODO: These routines should be moved to a file that is common across OS */
sta_t *
diff --git a/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h b/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
index 3d5f01d..f911799 100644
--- a/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
+++ b/drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
@@ -309,43 +309,6 @@ extern "C" {
*/


-#ifdef HTC_RAW_INTERFACE
-/* HTC Raw Interface Ioctls */
-#define AR6000_XIOCTL_HTC_RAW_OPEN 13
-/*
- * arguments:
- * UINT32 cmd (AR6000_XIOCTL_HTC_RAW_OPEN)
- */
-
-#define AR6000_XIOCTL_HTC_RAW_CLOSE 14
-/*
- * arguments:
- * UINT32 cmd (AR6000_XIOCTL_HTC_RAW_CLOSE)
- */
-
-#define AR6000_XIOCTL_HTC_RAW_READ 15
-/*
- * arguments:
- * union {
- * struct {
- * UINT32 cmd (AR6000_XIOCTL_HTC_RAW_READ)
- * UINT32 mailboxID
- * UINT32 length
- * }
- * results[length]
- * }
- */
-
-#define AR6000_XIOCTL_HTC_RAW_WRITE 16
-/*
- * arguments:
- * UINT32 cmd (AR6000_XIOCTL_HTC_RAW_WRITE)
- * UINT32 mailboxID
- * UINT32 length
- * char buffer[length]
- */
-#endif /* HTC_RAW_INTERFACE */
-
#define AR6000_XIOCTL_CHECK_TARGET_READY 17
/*
* arguments:
--
1.7.0.4


2011-03-30 00:57:46

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 29/34] ath6kl: remove completely pointles platform driver

Perhaps there was some good intention on having some platform
driver on ath6kl, but right now its pointless. Kill!

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 6 --
drivers/staging/ath6kl/os/linux/ar6000_pm.c | 55 --------------------
.../ath6kl/os/linux/include/ar6xapi_linux.h | 3 -
3 files changed, 0 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 056acae..e3c1f58 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -636,10 +636,6 @@ ar6000_init_module(void)
osdrvCallbacks.devicePowerChangeHandler = ar6000_power_change_ev;
#endif

- r = ar6000_pm_init();
- if (r)
- return r;
-
#ifdef DEBUG
/* Set the debug flags if specified at load time */
if(debugflags != 0)
@@ -689,8 +685,6 @@ ar6000_cleanup_module(void)

a_module_debug_support_cleanup();

- ar6000_pm_exit();
-
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_cleanup: success\n"));
}

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_pm.c b/drivers/staging/ath6kl/os/linux/ar6000_pm.c
index eeb3807..1e0ace8 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_pm.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_pm.c
@@ -302,35 +302,6 @@ int ar6000_power_change_ev(void *context, u32 config)
return status;
}

-static int ar6000_pm_probe(struct platform_device *pdev)
-{
- return 0;
-}
-
-static int ar6000_pm_remove(struct platform_device *pdev)
-{
- return 0;
-}
-
-static int ar6000_pm_suspend(struct platform_device *pdev, pm_message_t state)
-{
- return 0;
-}
-
-static int ar6000_pm_resume(struct platform_device *pdev)
-{
- return 0;
-}
-
-static struct platform_driver ar6000_pm_device = {
- .probe = ar6000_pm_probe,
- .remove = ar6000_pm_remove,
- .suspend = ar6000_pm_suspend,
- .resume = ar6000_pm_resume,
- .driver = {
- .name = "wlan_ar6000_pm",
- },
-};
#endif /* CONFIG_PM */

int
@@ -653,29 +624,3 @@ ar6000_set_wlan_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
status = ar6000_update_wlan_pwr_state(ar, state, false);
return status;
}
-
-int ar6000_pm_init()
-{
- int r;
- A_REGISTER_MODULE_DEBUG_INFO(pm);
-
-#ifdef CONFIG_PM
- /*
- * Register ar6000_pm_device into system.
- * We should also add platform_device into the first item of array
- * of devices[] in file arch/xxx/mach-xxx/board-xxxx.c
- */
- r = platform_driver_register(&ar6000_pm_device);
- if (r < 0)
- return -ENODEV;
-#endif /* CONFIG_PM */
-
- return 0;
-}
-
-void ar6000_pm_exit()
-{
-#ifdef CONFIG_PM
- platform_driver_unregister(&ar6000_pm_device);
-#endif /* CONFIG_PM */
-}
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h b/drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h
index a8e8e36..184dbdb 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h
@@ -178,9 +178,6 @@ int ar6000_power_change_ev(void *context, u32 config);
void ar6000_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isEvent);
#endif

-int ar6000_pm_init(void);
-void ar6000_pm_exit(void);
-
#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
int ar6000_add_ap_interface(struct ar6_softc *ar, char *ifname);
int ar6000_remove_ap_interface(struct ar6_softc *ar);
--
1.7.0.4


2011-03-30 00:56:55

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 08/34] ath6kl: kill Android specific code

To get upstream we can't use out of tree defines, kill
all the androidisms. ath6kl won't be usable on Android
unless external patches are supported later or Android
gets their shit together and gets all their crap upstream.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/os/linux/ar6000_android.c | 386 --------------------
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 16 -
drivers/staging/ath6kl/os/linux/ar6000_pm.c | 18 -
drivers/staging/ath6kl/os/linux/eeprom.c | 213 -----------
.../staging/ath6kl/os/linux/include/osapi_linux.h | 43 +---
.../staging/ath6kl/os/linux/include/wlan_config.h | 4 -
drivers/staging/ath6kl/os/linux/wireless_ext.c | 33 --
7 files changed, 1 insertions(+), 712 deletions(-)
delete mode 100644 drivers/staging/ath6kl/os/linux/ar6000_android.c

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_android.c b/drivers/staging/ath6kl/os/linux/ar6000_android.c
deleted file mode 100644
index 03352b0..0000000
--- a/drivers/staging/ath6kl/os/linux/ar6000_android.c
+++ /dev/null
@@ -1,386 +0,0 @@
-//------------------------------------------------------------------------------
-// Copyright (c) 2004-2010 Atheros Communications Inc.
-// All rights reserved.
-//
-//
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-//
-//
-//
-// Author(s): ="Atheros"
-//------------------------------------------------------------------------------
-#include "ar6000_drv.h"
-#include "htc.h"
-#include <linux/vmalloc.h>
-#include <linux/fs.h>
-
-#ifdef CONFIG_HAS_EARLYSUSPEND
-#include <linux/earlysuspend.h>
-#endif
-
-bool enable_mmc_host_detect_change = false;
-static void ar6000_enable_mmchost_detect_change(int enable);
-
-
-char fwpath[256] = "/system/wifi";
-int wowledon;
-unsigned int enablelogcat;
-
-extern struct net_device *ar6000_devices[];
-extern char ifname[];
-
-const char def_ifname[] = "wlan0";
-module_param_string(fwpath, fwpath, sizeof(fwpath), 0644);
-module_param(enablelogcat, uint, 0644);
-module_param(wowledon, int, 0644);
-
-#ifdef CONFIG_HAS_EARLYSUSPEND
-static int screen_is_off;
-static struct early_suspend ar6k_early_suspend;
-#endif
-
-static int (*ar6000_avail_ev_p)(void *, void *);
-
-#if defined(CONFIG_ANDROID_LOGGER) && (!defined(CONFIG_MMC_MSM))
-int logger_write(const enum logidx index,
- const unsigned char prio,
- const char __kernel * const tag,
- const char __kernel * const fmt,
- ...)
-{
- int ret = 0;
- va_list vargs;
- struct file *filp = (struct file *)-ENOENT;
- mm_segment_t oldfs;
- struct iovec vec[3];
- int tag_bytes = strlen(tag) + 1, msg_bytes;
- char *msg;
- va_start(vargs, fmt);
- msg = kvasprintf(GFP_ATOMIC, fmt, vargs);
- va_end(vargs);
- if (!msg)
- return -ENOMEM;
- if (in_interrupt()) {
- /* we have no choice since aio_write may be blocked */
- printk(KERN_ALERT "%s", msg);
- goto out_free_message;
- }
- msg_bytes = strlen(msg) + 1;
- if (msg_bytes <= 1) /* empty message? */
- goto out_free_message; /* don't bother, then */
- if ((msg_bytes + tag_bytes + 1) > 2048) {
- ret = -E2BIG;
- goto out_free_message;
- }
-
- vec[0].iov_base = (unsigned char *) &prio;
- vec[0].iov_len = 1;
- vec[1].iov_base = (void *) tag;
- vec[1].iov_len = strlen(tag) + 1;
- vec[2].iov_base = (void *) msg;
- vec[2].iov_len = strlen(msg) + 1;
-
- oldfs = get_fs();
- set_fs(KERNEL_DS);
- do {
- filp = filp_open("/dev/log/main", O_WRONLY, S_IRUSR);
- if (IS_ERR(filp) || !filp->f_op) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: filp_open /dev/log/main error\n", __FUNCTION__));
- ret = -ENOENT;
- break;
- }
-
- if (filp->f_op->aio_write) {
- int nr_segs = sizeof(vec) / sizeof(vec[0]);
- int len = vec[0].iov_len + vec[1].iov_len + vec[2].iov_len;
- struct kiocb kiocb;
- init_sync_kiocb(&kiocb, filp);
- kiocb.ki_pos = 0;
- kiocb.ki_left = len;
- kiocb.ki_nbytes = len;
- ret = filp->f_op->aio_write(&kiocb, vec, nr_segs, kiocb.ki_pos);
- }
-
- } while (0);
-
- if (!IS_ERR(filp)) {
- filp_close(filp, NULL);
- }
- set_fs(oldfs);
-out_free_message:
- kfree(msg);
- return ret;
-}
-#endif
-
-int android_logger_lv(void *module, int mask)
-{
- switch (mask) {
- case ATH_DEBUG_ERR:
- return 6;
- case ATH_DEBUG_INFO:
- return 4;
- case ATH_DEBUG_WARN:
- return 5;
- case ATH_DEBUG_TRC:
- return 3;
- default:
-#ifdef DEBUG
- if (!module) {
- return 3;
- } else if (module == &GET_ATH_MODULE_DEBUG_VAR_NAME(driver)) {
- return (mask <=ATH_DEBUG_MAKE_MODULE_MASK(3)) ? 3 : 2;
- } else if (module == &GET_ATH_MODULE_DEBUG_VAR_NAME(htc)) {
- return 2;
- } else {
- return 3;
- }
-#else
- return 3; /* DEBUG */
-#endif
- }
-}
-
-static int android_readwrite_file(const char *filename, char *rbuf, const char *wbuf, size_t length)
-{
- int ret = 0;
- struct file *filp = (struct file *)-ENOENT;
- mm_segment_t oldfs;
- oldfs = get_fs();
- set_fs(KERNEL_DS);
- do {
- int mode = (wbuf) ? O_RDWR : O_RDONLY;
- filp = filp_open(filename, mode, S_IRUSR);
- if (IS_ERR(filp) || !filp->f_op) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: file %s filp_open error\n", __FUNCTION__, filename));
- ret = -ENOENT;
- break;
- }
-
- if (length==0) {
- /* Read the length of the file only */
- struct inode *inode;
-
- inode = GET_INODE_FROM_FILEP(filp);
- if (!inode) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Get inode from %s failed\n", __FUNCTION__, filename));
- ret = -ENOENT;
- break;
- }
- ret = i_size_read(inode->i_mapping->host);
- break;
- }
-
- if (wbuf) {
- if ( (ret=filp->f_op->write(filp, wbuf, length, &filp->f_pos)) < 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Write %u bytes to file %s error %d\n", __FUNCTION__,
- length, filename, ret));
- break;
- }
- } else {
- if ( (ret=filp->f_op->read(filp, rbuf, length, &filp->f_pos)) < 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Read %u bytes from file %s error %d\n", __FUNCTION__,
- length, filename, ret));
- break;
- }
- }
- } while (0);
-
- if (!IS_ERR(filp)) {
- filp_close(filp, NULL);
- }
- set_fs(oldfs);
-
- return ret;
-}
-
-int android_request_firmware(const struct firmware **firmware_p, const char *name,
- struct device *device)
-{
- int ret = 0;
- struct firmware *firmware;
- char filename[256];
- const char *raw_filename = name;
- *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
- if (!firmware)
- return -ENOMEM;
- sprintf(filename, "%s/%s", fwpath, raw_filename);
- do {
- size_t length, bufsize, bmisize;
-
- if ( (ret=android_readwrite_file(filename, NULL, NULL, 0)) < 0) {
- break;
- } else {
- length = ret;
- }
-
- bufsize = ALIGN(length, PAGE_SIZE);
- bmisize = A_ROUND_UP(length, 4);
- bufsize = max(bmisize, bufsize);
- firmware->data = vmalloc(bufsize);
- firmware->size = length;
- if (!firmware->data) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: Cannot allocate buffer for firmware\n", __FUNCTION__));
- ret = -ENOMEM;
- break;
- }
-
- if ( (ret=android_readwrite_file(filename, (char*)firmware->data, NULL, length)) != length) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: file read error, ret %d request %d\n", __FUNCTION__, ret, length));
- ret = -1;
- break;
- }
-
- } while (0);
-
- if (ret<0) {
- if (firmware) {
- if (firmware->data)
- vfree(firmware->data);
- kfree(firmware);
- }
- *firmware_p = NULL;
- } else {
- ret = 0;
- }
- return ret;
-}
-
-void android_release_firmware(const struct firmware *firmware)
-{
- if (firmware) {
- if (firmware->data)
- vfree(firmware->data);
- kfree(firmware);
- }
-}
-
-static int ar6000_android_avail_ev(void *context, void *hif_handle)
-{
- int ret;
- ar6000_enable_mmchost_detect_change(0);
- ret = ar6000_avail_ev_p(context, hif_handle);
- return ret;
-}
-
-/* Useful for qualcom platform to detect our wlan card for mmc stack */
-static void ar6000_enable_mmchost_detect_change(int enable)
-{
-#ifdef CONFIG_MMC_MSM
-#define MMC_MSM_DEV "msm_sdcc.1"
- char buf[3];
- int length;
-
- if (!enable_mmc_host_detect_change) {
- return;
- }
- length = snprintf(buf, sizeof(buf), "%d\n", enable ? 1 : 0);
- if (android_readwrite_file("/sys/devices/platform/" MMC_MSM_DEV "/detect_change",
- NULL, buf, length) < 0) {
- /* fall back to polling */
- android_readwrite_file("/sys/devices/platform/" MMC_MSM_DEV "/polling", NULL, buf, length);
- }
-#endif
-}
-
-#ifdef CONFIG_HAS_EARLYSUSPEND
-static void android_early_suspend(struct early_suspend *h)
-{
- screen_is_off = 1;
-}
-
-static void android_late_resume(struct early_suspend *h)
-{
- screen_is_off = 0;
-}
-#endif
-
-void android_module_init(OSDRV_CALLBACKS *osdrvCallbacks)
-{
- if (ifname[0] == '\0')
- strcpy(ifname, def_ifname);
-#ifdef CONFIG_HAS_EARLYSUSPEND
- ar6k_early_suspend.suspend = android_early_suspend;
- ar6k_early_suspend.resume = android_late_resume;
- ar6k_early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN;
- register_early_suspend(&ar6k_early_suspend);
-#endif
-
- ar6000_avail_ev_p = osdrvCallbacks->deviceInsertedHandler;
- osdrvCallbacks->deviceInsertedHandler = ar6000_android_avail_ev;
-
- ar6000_enable_mmchost_detect_change(1);
-}
-
-void android_module_exit(void)
-{
-#ifdef CONFIG_HAS_EARLYSUSPEND
- unregister_early_suspend(&ar6k_early_suspend);
-#endif
- ar6000_enable_mmchost_detect_change(1);
-}
-
-#ifdef CONFIG_PM
-void android_ar6k_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isEvent)
-{
- if (
-#ifdef CONFIG_HAS_EARLYSUSPEND
- screen_is_off &&
-#endif
- skb && ar->arConnected) {
- bool needWake = false;
- if (isEvent) {
- if (A_NETBUF_LEN(skb) >= sizeof(u16)) {
- u16 cmd = *(const u16 *)A_NETBUF_DATA(skb);
- switch (cmd) {
- case WMI_CONNECT_EVENTID:
- case WMI_DISCONNECT_EVENTID:
- needWake = true;
- break;
- default:
- /* dont wake lock the system for other event */
- break;
- }
- }
- } else if (A_NETBUF_LEN(skb) >= sizeof(ATH_MAC_HDR)) {
- ATH_MAC_HDR *datap = (ATH_MAC_HDR *)A_NETBUF_DATA(skb);
- if (!IEEE80211_IS_MULTICAST(datap->dstMac)) {
- switch (A_BE2CPU16(datap->typeOrLen)) {
- case 0x0800: /* IP */
- case 0x888e: /* EAPOL */
- case 0x88c7: /* RSN_PREAUTH */
- case 0x88b4: /* WAPI */
- needWake = true;
- break;
- case 0x0806: /* ARP is not important to hold wake lock */
- default:
- break;
- }
- }
- }
- if (needWake) {
- /* keep host wake up if there is any event and packate comming in*/
- if (wowledon) {
- char buf[32];
- int len = sprintf(buf, "on");
- android_readwrite_file("/sys/power/state", NULL, buf, len);
-
- len = sprintf(buf, "%d", 127);
- android_readwrite_file("/sys/class/leds/lcd-backlight/brightness",
- NULL, buf,len);
- }
- }
- }
-}
-#endif /* CONFIG_PM */
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 3dfbb0d..c938537 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -290,14 +290,6 @@ static void disconnect_timer_handler(unsigned long ptr);

void read_rssi_compensation_param(struct ar6_softc *ar);

- /* for android builds we call external APIs that handle firmware download and configuration */
-#ifdef ANDROID_ENV
-/* !!!! Interim android support to make it easier to patch the default driver for
- * android use. You must define an external source file ar6000_android.c that handles the following
- * APIs */
-extern void android_module_init(OSDRV_CALLBACKS *osdrvCallbacks);
-extern void android_module_exit(void);
-#endif
/*
* HTC service connection handlers
*/
@@ -660,10 +652,6 @@ ar6000_init_module(void)

ar6000_pm_init();

-#ifdef ANDROID_ENV
- android_module_init(&osdrvCallbacks);
-#endif
-
#ifdef DEBUG
/* Set the debug flags if specified at load time */
if(debugflags != 0)
@@ -719,10 +707,6 @@ ar6000_cleanup_module(void)

ar6000_pm_exit();

-#ifdef ANDROID_ENV
- android_module_exit();
-#endif
-
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_cleanup: success\n"));
}

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_pm.c b/drivers/staging/ath6kl/os/linux/ar6000_pm.c
index 1a90424..b245909 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_pm.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_pm.c
@@ -36,9 +36,6 @@
extern unsigned int wmitimeout;
extern wait_queue_head_t arEvent;

-#ifdef ANDROID_ENV
-extern void android_ar6k_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isEvent);
-#endif
#undef ATH_MODULE_NAME
#define ATH_MODULE_NAME pm
#define ATH_DEBUG_PM ATH_DEBUG_MAKE_MODULE_MASK(0)
@@ -283,10 +280,6 @@ void ar6000_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isE
/* Wow resume from irq interrupt */
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: WoW resume from irq thread status %d\n", __func__, ar->arWlanPowerState));
ar6000_wow_resume(ar);
- } else {
-#ifdef ANDROID_ENV
- android_ar6k_check_wow_status(ar, skb, isEvent);
-#endif
}
}

@@ -373,17 +366,6 @@ ar6000_setup_cut_power_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
sizeof(HIF_DEVICE_POWER_CHANGE_TYPE));

if (status == A_PENDING) {
-#ifdef ANDROID_ENV
- /* Wait for WMI ready event */
- u32 timeleft = wait_event_interruptible_timeout(arEvent,
- (ar->arWmiReady == true), wmitimeout * HZ);
- if (!timeleft || signal_pending(current)) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000 : Failed to get wmi ready \n"));
- status = A_ERROR;
- break;
- }
-#endif
- status = 0;
} else if (status == 0) {
ar6000_restart_endpoint(ar->arNetDev);
status = 0;
diff --git a/drivers/staging/ath6kl/os/linux/eeprom.c b/drivers/staging/ath6kl/os/linux/eeprom.c
index 4cff9da..96f1724 100644
--- a/drivers/staging/ath6kl/os/linux/eeprom.c
+++ b/drivers/staging/ath6kl/os/linux/eeprom.c
@@ -359,216 +359,3 @@ commit_4bytes(int offset, u32 data)
request_4byte_write(offset, data);
wait_for_eeprom_completion();
}
-/* ATHENV */
-#ifdef ANDROID_ENV
-void eeprom_ar6000_transfer(struct hif_device *device, char *fake_file, char *p_mac)
-{
- u32 first_word;
- u32 board_data_addr;
- int i;
-
- printk("%s: Enter\n", __FUNCTION__);
-
- enable_SI(device);
- eeprom_type_detect();
-
- if (fake_file) {
- /*
- * Transfer from file to Target RAM.
- * Fetch source data from file.
- */
- mm_segment_t oldfs;
- struct file *filp;
- struct inode *inode = NULL;
- int length;
-
- /* open file */
- oldfs = get_fs();
- set_fs(KERNEL_DS);
- filp = filp_open(fake_file, O_RDONLY, S_IRUSR);
-
- if (IS_ERR(filp)) {
- printk("%s: file %s filp_open error\n", __FUNCTION__, fake_file);
- set_fs(oldfs);
- return;
- }
-
- if (!filp->f_op) {
- printk("%s: File Operation Method Error\n", __FUNCTION__);
- filp_close(filp, NULL);
- set_fs(oldfs);
- return;
- }
-
- inode = GET_INODE_FROM_FILEP(filep);
- if (!inode) {
- printk("%s: Get inode from filp failed\n", __FUNCTION__);
- filp_close(filp, NULL);
- set_fs(oldfs);
- return;
- }
-
- printk("%s file offset opsition: %xh\n", __FUNCTION__, (unsigned)filp->f_pos);
-
- /* file's size */
- length = i_size_read(inode->i_mapping->host);
- printk("%s: length=%d\n", __FUNCTION__, length);
- if (length != EEPROM_SZ) {
- printk("%s: The file's size is not as expected\n", __FUNCTION__);
- filp_close(filp, NULL);
- set_fs(oldfs);
- return;
- }
-
- /* read data */
- if (filp->f_op->read(filp, eeprom_data, length, &filp->f_pos) != length) {
- printk("%s: file read error\n", __FUNCTION__);
- filp_close(filp, NULL);
- set_fs(oldfs);
- return;
- }
-
- /* read data out successfully */
- filp_close(filp, NULL);
- set_fs(oldfs);
- } else {
- /*
- * Read from EEPROM to file OR transfer from EEPROM to Target RAM.
- * Fetch EEPROM_SZ Bytes of Board Data, 8 bytes at a time.
- */
-
- fetch_8bytes(0, (u32 *)(&eeprom_data[0]));
-
- /* Check the first word of EEPROM for validity */
- first_word = *((u32 *)eeprom_data);
-
- if ((first_word == 0) || (first_word == 0xffffffff)) {
- printk("Did not find EEPROM with valid Board Data.\n");
- }
-
- for (i=8; i<EEPROM_SZ; i+=8) {
- fetch_8bytes(i, (u32 *)(&eeprom_data[i]));
- }
- }
-
- /* soft mac */
- if (p_mac) {
-
- mm_segment_t oldfs;
- struct file *filp;
- struct inode *inode = NULL;
- int length;
-
- /* open file */
- oldfs = get_fs();
- set_fs(KERNEL_DS);
- filp = filp_open(p_mac, O_RDONLY, S_IRUSR);
-
- printk("%s try to open file %s\n", __FUNCTION__, p_mac);
-
- if (IS_ERR(filp)) {
- printk("%s: file %s filp_open error\n", __FUNCTION__, p_mac);
- set_fs(oldfs);
- return;
- }
-
- if (!filp->f_op) {
- printk("%s: File Operation Method Error\n", __FUNCTION__);
- filp_close(filp, NULL);
- set_fs(oldfs);
- return;
- }
-
- inode = GET_INODE_FROM_FILEP(filep);
- if (!inode) {
- printk("%s: Get inode from filp failed\n", __FUNCTION__);
- filp_close(filp, NULL);
- set_fs(oldfs);
- return;
- }
-
- printk("%s file offset opsition: %xh\n", __FUNCTION__, (unsigned)filp->f_pos);
-
- /* file's size */
- length = i_size_read(inode->i_mapping->host);
- printk("%s: length=%d\n", __FUNCTION__, length);
- if (length > ATH_SOFT_MAC_TMP_BUF_LEN) {
- printk("%s: MAC file's size is not as expected\n", __FUNCTION__);
- filp_close(filp, NULL);
- set_fs(oldfs);
- return;
- }
-
- /* read data */
- if (filp->f_op->read(filp, soft_mac_tmp_buf, length, &filp->f_pos) != length) {
- printk("%s: file read error\n", __FUNCTION__);
- filp_close(filp, NULL);
- set_fs(oldfs);
- return;
- }
-
-#if 0
- /* the data we just read */
- printk("%s: mac address from the file:\n", __FUNCTION__);
- for (i = 0; i < length; i++)
- printk("[%c(0x%x)],", soft_mac_tmp_buf[i], soft_mac_tmp_buf[i]);
- printk("\n");
-#endif
-
- /* read data out successfully */
- filp_close(filp, NULL);
- set_fs(oldfs);
-
- /* convert mac address */
- if (!wmic_ether_aton(soft_mac_tmp_buf, mac_addr)) {
- printk("%s: convert mac value fail\n", __FUNCTION__);
- return;
- }
-
-#if 0
- /* the converted mac address */
- printk("%s: the converted mac value\n", __FUNCTION__);
- for (i = 0; i < ATH_MAC_LEN; i++)
- printk("[0x%x],", mac_addr[i]);
- printk("\n");
-#endif
- }
- /* soft mac */
-
- /* Determine where in Target RAM to write Board Data */
- BMI_read_mem( HOST_INTEREST_ITEM_ADDRESS(hi_board_data), &board_data_addr);
- if (board_data_addr == 0) {
- printk("hi_board_data is zero\n");
- }
-
- /* soft mac */
-#if 1
- /* Update MAC address in RAM */
- if (p_mac) {
- update_mac(eeprom_data, EEPROM_SZ, mac_addr);
- }
-#endif
-#if 0
- /* mac address in eeprom array */
- printk("%s: mac values in eeprom array\n", __FUNCTION__);
- for (i = 10; i < 10 + 6; i++)
- printk("[0x%x],", eeprom_data[i]);
- printk("\n");
-#endif
- /* soft mac */
-
- /* Write EEPROM data to Target RAM */
- BMI_write_mem(board_data_addr, ((u8 *)eeprom_data), EEPROM_SZ);
-
- /* Record the fact that Board Data IS initialized */
- {
- u32 one = 1;
- BMI_write_mem(HOST_INTEREST_ITEM_ADDRESS(hi_board_data_initialized),
- (u8 *)&one, sizeof(u32));
- }
-
- disable_SI();
-}
-#endif
-/* ATHENV */
-
diff --git a/drivers/staging/ath6kl/os/linux/include/osapi_linux.h b/drivers/staging/ath6kl/os/linux/include/osapi_linux.h
index ff9d06e..07078b4 100644
--- a/drivers/staging/ath6kl/os/linux/include/osapi_linux.h
+++ b/drivers/staging/ath6kl/os/linux/include/osapi_linux.h
@@ -80,31 +80,9 @@
#define A_MALLOC(size) kmalloc((size), GFP_KERNEL)
#define A_MALLOC_NOWAIT(size) kmalloc((size), GFP_ATOMIC)

-#if defined(ANDROID_ENV) && defined(CONFIG_ANDROID_LOGGER)
-extern unsigned int enablelogcat;
-extern int android_logger_lv(void* module, int mask);
-enum logidx { LOG_MAIN_IDX = 0 };
-extern int logger_write(const enum logidx idx,
- const unsigned char prio,
- const char __kernel * const tag,
- const char __kernel * const fmt,
- ...);
-#define A_ANDROID_PRINTF(mask, module, tags, args...) do { \
- if (enablelogcat) \
- logger_write(LOG_MAIN_IDX, android_logger_lv(module, mask), tags, args); \
- else \
- printk(KERN_ALERT args); \
-} while (0)
-#ifdef DEBUG
-#define A_LOGGER_MODULE_NAME(x) #x
-#define A_LOGGER(mask, mod, args...) \
- A_ANDROID_PRINTF(mask, &GET_ATH_MODULE_DEBUG_VAR_NAME(mod), "ar6k_" A_LOGGER_MODULE_NAME(mod), args);
-#endif
-#define A_PRINTF(args...) A_ANDROID_PRINTF(ATH_DEBUG_INFO, NULL, "ar6k_driver", args)
-#else
#define A_LOGGER(mask, mod, args...) printk(KERN_ALERT args)
#define A_PRINTF(args...) printk(KERN_ALERT args)
-#endif /* ANDROID */
+
#define A_PRINTF_LOG(args...) printk(args)
#define A_SPRINTF(buf, args...) sprintf (buf, args)

@@ -210,17 +188,8 @@ extern unsigned int panic_on_assert;
#define A_ASSERT(expr)
#endif /* DEBUG */

-#ifdef ANDROID_ENV
-struct firmware;
-int android_request_firmware(const struct firmware **firmware_p, const char *filename,
- struct device *device);
-void android_release_firmware(const struct firmware *firmware);
-#define A_REQUEST_FIRMWARE(_ppf, _pfile, _dev) android_request_firmware(_ppf, _pfile, _dev)
-#define A_RELEASE_FIRMWARE(_pf) android_release_firmware(_pf)
-#else
#define A_REQUEST_FIRMWARE(_ppf, _pfile, _dev) request_firmware(_ppf, _pfile, _dev)
#define A_RELEASE_FIRMWARE(_pf) release_firmware(_pf)
-#endif

/*
* Initialization of the network buffer subsystem
@@ -364,17 +333,7 @@ static inline void *A_ALIGN_TO_CACHE_LINE(void *ptr) {
#define A_MEMZERO(addr, len) memset((addr), 0, (len))
#define A_MALLOC(size) malloc(size)

-#ifdef ANDROID
-#ifndef err
-#include <errno.h>
-#define err(_s, args...) do { \
- fprintf(stderr, "%s: line %d ", __FILE__, __LINE__); \
- fprintf(stderr, args); fprintf(stderr, ": %d\n", errno); \
- exit(_s); } while (0)
-#endif
-#else
#include <err.h>
-#endif

#endif /* __KERNEL__ */

diff --git a/drivers/staging/ath6kl/os/linux/include/wlan_config.h b/drivers/staging/ath6kl/os/linux/include/wlan_config.h
index 2de5cef..98951bb 100644
--- a/drivers/staging/ath6kl/os/linux/include/wlan_config.h
+++ b/drivers/staging/ath6kl/os/linux/include/wlan_config.h
@@ -56,11 +56,7 @@
* If the firmware successly roams within the disconnect timeout
* it sends a new connect event
*/
-#ifdef ANDROID_ENV
-#define WLAN_CONFIG_DISCONNECT_TIMEOUT 3
-#else
#define WLAN_CONFIG_DISCONNECT_TIMEOUT 10
-#endif /* ANDROID_ENV */

/*
* This configuration item disables 11n support.
diff --git a/drivers/staging/ath6kl/os/linux/wireless_ext.c b/drivers/staging/ath6kl/os/linux/wireless_ext.c
index 4b77943..5af09f1 100644
--- a/drivers/staging/ath6kl/os/linux/wireless_ext.c
+++ b/drivers/staging/ath6kl/os/linux/wireless_ext.c
@@ -2499,39 +2499,6 @@ ar6000_ioctl_siwscan(struct net_device *dev,
}
}

-#ifdef ANDROID_ENV
-#if WIRELESS_EXT >= 18
- if (data->pointer && (data->length == sizeof(struct iw_scan_req)))
- {
- if ((data->flags & IW_SCAN_THIS_ESSID) == IW_SCAN_THIS_ESSID)
- {
- struct iw_scan_req req;
- if (copy_from_user(&req, data->pointer, sizeof(struct iw_scan_req)))
- return -EIO;
- if (wmi_probedSsid_cmd(ar->arWmi, 1, SPECIFIC_SSID_FLAG, req.essid_len, req.essid) != 0)
- return -EIO;
- ar->scanSpecificSsid = true;
- }
- else
- {
- if (ar->scanSpecificSsid) {
- if (wmi_probedSsid_cmd(ar->arWmi, 1, DISABLE_SSID_FLAG, 0, NULL) != 0)
- return -EIO;
- ar->scanSpecificSsid = false;
- }
- }
- }
- else
- {
- if (ar->scanSpecificSsid) {
- if (wmi_probedSsid_cmd(ar->arWmi, 1, DISABLE_SSID_FLAG, 0, NULL) != 0)
- return -EIO;
- ar->scanSpecificSsid = false;
- }
- }
-#endif
-#endif /* ANDROID_ENV */
-
if (wmi_startscan_cmd(ar->arWmi, WMI_LONG_SCAN, false, false, \
0, 0, 0, NULL) != 0) {
ret = -EIO;
--
1.7.0.4


2011-03-30 00:57:53

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 32/34] ath6kl: remove chatty debug messages on ath6kl driver ops

These do not help in any way.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
.../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
index 314c552..c8f1a6e 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
@@ -144,7 +144,6 @@ static void ath6kl_hifdev_remove(struct sdio_func *func)
{
int status = 0;
struct hif_device *device;
- AR_DEBUG_ASSERT(func != NULL);

device = ath6kl_get_hifdev(func);
if (device->claimedContext != NULL)
@@ -159,8 +158,6 @@ static void ath6kl_hifdev_remove(struct sdio_func *func)
CleanupHIFScatterResources(device);

delHifDevice(device);
- AR_DEBUG_ASSERT(status == 0);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
}

#if defined(CONFIG_PM)
@@ -171,7 +168,6 @@ static int ath6kl_hifdev_suspend(struct device *dev)
struct hif_device *device;

device = ath6kl_get_hifdev(func);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +ath6kl_hifdev_suspend\n"));

if (device && device->claimedContext &&
osdrvCallbacks.deviceSuspendHandler) {
@@ -184,7 +180,6 @@ static int ath6kl_hifdev_suspend(struct device *dev)
}

CleanupHIFScatterResources(device);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -ath6kl_hifdev_suspend\n"));

switch (status) {
case 0:
@@ -204,7 +199,6 @@ static int ath6kl_hifdev_resume(struct device *dev)
struct hif_device *device;

device = ath6kl_get_hifdev(func);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +ath6kl_hifdev_resume\n"));
if (device && device->claimedContext &&
osdrvCallbacks.deviceSuspendHandler) {
status = osdrvCallbacks.
@@ -212,7 +206,6 @@ static int ath6kl_hifdev_resume(struct device *dev)
if (status == 0)
device->is_suspend = false;
}
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -ath6kl_hifdev_resume\n"));

return status;
}
--
1.7.0.4


2011-03-31 16:50:44

by Vipin Mehta

[permalink] [raw]
Subject: RE: [PATCH 34/34] ath6kl: remove the HTC raw interface

-----Original Message-----
From: Luis Rodriguez
Sent: Tuesday, March 29, 2011 5:57 PM
To: [email protected]
Cc: [email protected]; [email protected]; Vipin Mehta; Naveen Singh; Luis Rodriguez
Subject: [PATCH 34/34] ath6kl: remove the HTC raw interface

This uses ioctl, if this is required it should be replaced
with the nl80211 test command interface.




The raw HTC support is required for the tools used on the manufacturing floor
For module calibration. Without this code, the driver and the hardware
cannot be shipped. I suggest we keep this code until we add the support for
nl80211 test command interface and migrate the tools to use the new interface.

2011-03-30 00:57:51

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 31/34] ath6kl: rename the pm ops to something more sensible

This has no functional changes.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
.../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
index 359261b..314c552 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
@@ -164,14 +164,14 @@ static void ath6kl_hifdev_remove(struct sdio_func *func)
}

#if defined(CONFIG_PM)
-static int hifDeviceSuspend(struct device *dev)
+static int ath6kl_hifdev_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
int status = 0;
struct hif_device *device;

device = ath6kl_get_hifdev(func);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceSuspend\n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +ath6kl_hifdev_suspend\n"));

if (device && device->claimedContext &&
osdrvCallbacks.deviceSuspendHandler) {
@@ -184,7 +184,7 @@ static int hifDeviceSuspend(struct device *dev)
}

CleanupHIFScatterResources(device);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceSuspend\n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -ath6kl_hifdev_suspend\n"));

switch (status) {
case 0:
@@ -197,14 +197,14 @@ static int hifDeviceSuspend(struct device *dev)
}
}

-static int hifDeviceResume(struct device *dev)
+static int ath6kl_hifdev_resume(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
int status = 0;
struct hif_device *device;

device = ath6kl_get_hifdev(func);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceResume\n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +ath6kl_hifdev_resume\n"));
if (device && device->claimedContext &&
osdrvCallbacks.deviceSuspendHandler) {
status = osdrvCallbacks.
@@ -212,14 +212,14 @@ static int hifDeviceResume(struct device *dev)
if (status == 0)
device->is_suspend = false;
}
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceResume\n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -ath6kl_hifdev_resume\n"));

return status;
}

-static const struct dev_pm_ops ar6k_device_pm_ops = {
- .suspend = hifDeviceSuspend,
- .resume = hifDeviceResume,
+static const struct dev_pm_ops ath6kl_hifdev_pmops = {
+ .suspend = ath6kl_hifdev_suspend,
+ .resume = ath6kl_hifdev_resume,
};
#endif /* CONFIG_PM */

@@ -230,7 +230,7 @@ static struct sdio_driver ath6kl_hifdev_driver = {
.remove = ath6kl_hifdev_remove,
#if defined(CONFIG_PM)
.drv = {
- .pm = &ar6k_device_pm_ops,
+ .pm = &ath6kl_hifdev_pmops,
},
#endif
};
--
1.7.0.4


2011-03-30 00:56:44

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 04/34] ath6kl: replace do while loop with function helpers on ar6000_avail_ev()

This unwraps the do while loops in favor for function helpers.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 68 ++++++++++++++++++--------
1 files changed, 48 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 846eea7..cbf2cb6 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -1586,6 +1586,52 @@ init_netdev(struct net_device *dev, char *name)
return;
}

+static int __ath6kl_init_netdev(struct net_device *dev)
+{
+ int r;
+
+ rtnl_lock();
+ r = ar6000_init(dev);
+ rtnl_unlock();
+
+ if (r) {
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n"));
+ return r;
+ }
+
+ return 0;
+}
+
+#ifdef HTC_RAW_INTERFACE
+static int ath6kl_init_netdev_wmi(struct net_device *dev)
+{
+ if (!eppingtest && bypasswmi)
+ return 0;
+
+ return __ath6kl_init_netdev(dev);
+}
+#else
+static int ath6kl_init_netdev_wmi(struct net_device *dev)
+{
+ return __ath6kl_init_netdev(dev);
+}
+#endif
+
+static int ath6kl_init_netdev(struct ar6_softc *ar)
+{
+ int r;
+
+ r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode);
+ if (r) {
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
+ ("ar6000_avail: "
+ "ar6000_sysfs_bmi_get_config failed\n"));
+ return r;
+ }
+
+ return ath6kl_init_netdev_wmi(ar->arNetDev);
+}
+
/*
* HTC Event handlers
*/
@@ -1788,26 +1834,8 @@ ar6000_avail_ev(void *context, void *hif_handle)
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode));
if ((wlaninitmode == WLAN_INIT_MODE_UDEV) ||
(wlaninitmode == WLAN_INIT_MODE_DRV)) {
- do {
- r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode);
- if (r) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n"));
- break;
- }
-#ifdef HTC_RAW_INTERFACE
- if (!eppingtest && bypasswmi) {
- break; /* Don't call ar6000_init for ART */
- }
-#endif
- rtnl_lock();
- r = ar6000_init(dev);
- rtnl_unlock();
- if (r) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n"));
- }
- } while (false);
-
- if (r)
+ r = ath6kl_init_netdev(ar);
+ if (r)
goto avail_ev_failed;
}

--
1.7.0.4


2011-03-30 00:57:17

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 17/34] ath6kl: remove INIT_MODE_DRV_ENABLED define

Since this is defined statically we just leave the code.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 1 -
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 14 ++++----------
.../staging/ath6kl/os/linux/include/ar6000_drv.h | 4 ----
3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index cd04fba..8a46e93 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -112,7 +112,6 @@ endif

ccflags-y += -DWAPI_ENABLE
ccflags-y += -DCHECKSUM_OFFLOAD
-ccflags-y += -DINIT_MODE_DRV_ENABLED

obj-$(CONFIG_ATH6K_LEGACY) := ath6kl.o
ath6kl-y += htc2/AR6000/ar6k.o
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index b9d0471..8f9e4b2 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -852,8 +852,6 @@ ar6000_sysfs_bmi_deinit(struct ar6_softc *ar)
} \
} while(0)

-#ifdef INIT_MODE_DRV_ENABLED
-
#ifdef SOFTMAC_FILE_USED
#define AR6002_MAC_ADDRESS_OFFSET 0x0A
#define AR6003_MAC_ADDRESS_OFFSET 0x16
@@ -1111,7 +1109,6 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address,
A_RELEASE_FIRMWARE(fw_entry);
return 0;
}
-#endif /* INIT_MODE_DRV_ENABLED */

int
ar6000_update_bdaddr(struct ar6_softc *ar)
@@ -1158,7 +1155,6 @@ ar6000_sysfs_bmi_get_config(struct ar6_softc *ar, u32 mode)
}

A_RELEASE_FIRMWARE(fw_entry);
-#ifdef INIT_MODE_DRV_ENABLED
} else {
/* The config is contained within the driver itself */
int status;
@@ -1348,8 +1344,6 @@ ar6000_sysfs_bmi_get_config(struct ar6_softc *ar, u32 mode)
msleep(1000);
}
#endif /* HTC_RAW_INTERFACE */
-
-#endif /* INIT_MODE_DRV_ENABLED */
}

return 0;
@@ -2340,10 +2334,10 @@ u8 ar6000_endpoint_id2_ac(void * devt, HTC_ENDPOINT_ID ep )
int ar6000_target_config_wlan_params(struct ar6_softc *ar)
{
int status = 0;
-#if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE)
+#if defined(ENABLE_COEXISTENCE)
WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD sbcb_cmd;
WMI_SET_BTCOEX_FE_ANT_CMD sbfa_cmd;
-#endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */
+#endif /* ENABLE_COEXISTENCE */

#ifdef CONFIG_HOST_TCMD_SUPPORT
if (ar->arTargetMode != AR6000_WLAN_MODE) {
@@ -2361,7 +2355,7 @@ int ar6000_target_config_wlan_params(struct ar6_softc *ar)
status = A_ERROR;
}

-#if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE)
+#if defined(ENABLE_COEXISTENCE)
/* Configure the type of BT collocated with WLAN */
memset(&sbcb_cmd, 0, sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD));
#ifdef CONFIG_AR600x_BT_QCOM
@@ -2393,7 +2387,7 @@ int ar6000_target_config_wlan_params(struct ar6_softc *ar)
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set fornt end antenna configuration\n"));
status = A_ERROR;
}
-#endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */
+#endif /* ENABLE_COEXISTENCE */

#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN
if ((wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN)) != 0) {
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
index 23427cf..205a7bf 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
@@ -238,11 +238,7 @@ typedef enum _AR6K_BIN_FILE {
#define HCIUARTSTEP_DEFAULT 0
#endif /* AR600x_BT_AR3001 */

-#ifdef INIT_MODE_DRV_ENABLED
#define WLAN_INIT_MODE_DEFAULT WLAN_INIT_MODE_DRV
-#else
-#define WLAN_INIT_MODE_DEFAULT WLAN_INIT_MODE_USR
-#endif /* INIT_MODE_DRV_ENABLED */

#define AR6K_PATCH_DOWNLOAD_ADDRESS(_param, _ver) do { \
if ((_ver) == AR6003_REV1_VERSION) { \
--
1.7.0.4


2011-03-30 00:57:33

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 23/34] ath6kl: simplify btcoex parameter programming

Make the code more legible by parsing the config options on
the header file. While a it ensure to propagate errors and
bail out if we fail to set btcoex params.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 80 +++++++++++---------
.../staging/ath6kl/os/linux/include/ar6000_drv.h | 19 +++++
2 files changed, 62 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 1798889..f08f165 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -2328,16 +2328,52 @@ u8 ar6000_endpoint_id2_ac(void * devt, HTC_ENDPOINT_ID ep )
return(arEndpoint2Ac(ar, ep ));
}

+#if defined(CONFIG_ATH6KL_ENABLE_COEXISTENCE)
+static int ath6kl_config_btcoex_params(struct ar6_softc *ar)
+{
+ int r;
+ WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD sbcb_cmd;
+ WMI_SET_BTCOEX_FE_ANT_CMD sbfa_cmd;
+
+ /* Configure the type of BT collocated with WLAN */
+ memset(&sbcb_cmd, 0, sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD));
+ sbcb_cmd.btcoexCoLocatedBTdev = ATH6KL_BT_DEV;
+
+ r = wmi_set_btcoex_colocated_bt_dev_cmd(ar->arWmi, &sbcb_cmd);
+
+ if (r) {
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
+ ("Unable to set collocated BT type\n"));
+ return r;
+ }
+
+ /* Configure the type of BT collocated with WLAN */
+ memset(&sbfa_cmd, 0, sizeof(WMI_SET_BTCOEX_FE_ANT_CMD));
+
+ sbfa_cmd.btcoexFeAntType = ATH6KL_BT_ANTENNA;
+
+ r = wmi_set_btcoex_fe_ant_cmd(ar->arWmi, &sbfa_cmd);
+ if (r) {
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
+ ("Unable to set fornt end antenna configuration\n"));
+ return r;
+ }
+
+ return 0;
+}
+#else
+static int ath6kl_config_btcoex_params(struct ar6_softc *ar)
+{
+ return 0;
+}
+#endif /* CONFIG_ATH6KL_ENABLE_COEXISTENCE */
+
/*
* This function applies WLAN specific configuration defined in wlan_config.h
*/
int ar6000_target_config_wlan_params(struct ar6_softc *ar)
{
int status = 0;
-#if defined(CONFIG_ATH6KL_ENABLE_COEXISTENCE)
- WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD sbcb_cmd;
- WMI_SET_BTCOEX_FE_ANT_CMD sbfa_cmd;
-#endif /* CONFIG_ATH6KL_ENABLE_COEXISTENCE */

#ifdef CONFIG_HOST_TCMD_SUPPORT
if (ar->arTargetMode != AR6000_WLAN_MODE) {
@@ -2355,39 +2391,9 @@ int ar6000_target_config_wlan_params(struct ar6_softc *ar)
status = A_ERROR;
}

-#if defined(CONFIG_ATH6KL_ENABLE_COEXISTENCE)
- /* Configure the type of BT collocated with WLAN */
- memset(&sbcb_cmd, 0, sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD));
-#ifdef CONFIG_AR600x_BT_QCOM
- sbcb_cmd.btcoexCoLocatedBTdev = 1;
-#elif defined(CONFIG_AR600x_BT_CSR)
- sbcb_cmd.btcoexCoLocatedBTdev = 2;
-#elif defined(CONFIG_AR600x_BT_AR3001)
- sbcb_cmd.btcoexCoLocatedBTdev = 3;
-#else
-#error Unsupported Bluetooth Type
-#endif /* Collocated Bluetooth Type */
-
- if ((wmi_set_btcoex_colocated_bt_dev_cmd(ar->arWmi, &sbcb_cmd)) != 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set collocated BT type\n"));
- status = A_ERROR;
- }
-
- /* Configure the type of BT collocated with WLAN */
- memset(&sbfa_cmd, 0, sizeof(WMI_SET_BTCOEX_FE_ANT_CMD));
-#ifdef CONFIG_AR600x_DUAL_ANTENNA
- sbfa_cmd.btcoexFeAntType = 2;
-#elif defined(CONFIG_AR600x_SINGLE_ANTENNA)
- sbfa_cmd.btcoexFeAntType = 1;
-#else
-#error Unsupported Front-End Antenna Configuration
-#endif /* AR600x Front-End Antenna Configuration */
-
- if ((wmi_set_btcoex_fe_ant_cmd(ar->arWmi, &sbfa_cmd)) != 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set fornt end antenna configuration\n"));
- status = A_ERROR;
- }
-#endif /* CONFIG_ATH6KL_ENABLE_COEXISTENCE */
+ status = ath6kl_config_btcoex_params(ar);
+ if (status)
+ return status;

#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN
if ((wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN)) != 0) {
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
index 764f8f1..e47b078 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
@@ -228,6 +228,25 @@ typedef enum _AR6K_BIN_FILE {
#define NOHIFSCATTERSUPPORT_DEFAULT 0
#endif /* ATH6K_CONFIG_HIF_VIRTUAL_SCATTER */

+
+#if defined(CONFIG_ATH6KL_ENABLE_COEXISTENCE)
+
+#ifdef CONFIG_AR600x_BT_QCOM
+#define ATH6KL_BT_DEV 1
+#elif defined(CONFIG_AR600x_BT_CSR)
+#define ATH6KL_BT_DEV 2
+#else
+#define ATH6KL_BT_DEV 3
+#endif
+
+#ifdef CONFIG_AR600x_DUAL_ANTENNA
+#define ATH6KL_BT_ANTENNA 2
+#else
+#define ATH6KL_BT_ANTENNA 1
+#endif
+
+#endif /* CONFIG_ATH6KL_ENABLE_COEXISTENCE */
+
#ifdef AR600x_BT_AR3001
#define AR3KHCIBAUD_DEFAULT 3000000
#define HCIUARTSCALE_DEFAULT 1
--
1.7.0.4


2011-03-30 00:57:50

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 30/34] ath6kl: cleanup and move the ath6kl pm ops to be assigned statically

There should be no need to assign the pm ops dynamically, so
assign them statically and make them const. While we are
doing this just do some simple code style cleanup on the
routines and move them above prior to their assignment
into the driver ops.

This has no functional change other than assigning the
pm ops statically.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
.../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 130 ++++++++++----------
1 files changed, 64 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
index 9420c40..359261b 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
@@ -53,8 +53,6 @@
#if defined(CONFIG_PM)
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv)
-static int hifDeviceSuspend(struct device *dev);
-static int hifDeviceResume(struct device *dev);
#endif /* CONFIG_PM */
static void delHifDevice(struct hif_device * device);
static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte);
@@ -165,23 +163,77 @@ static void ath6kl_hifdev_remove(struct sdio_func *func)
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
}

+#if defined(CONFIG_PM)
+static int hifDeviceSuspend(struct device *dev)
+{
+ struct sdio_func *func = dev_to_sdio_func(dev);
+ int status = 0;
+ struct hif_device *device;
+
+ device = ath6kl_get_hifdev(func);
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceSuspend\n"));
+
+ if (device && device->claimedContext &&
+ osdrvCallbacks.deviceSuspendHandler) {
+ /* set true first for PowerStateChangeNotify(..) */
+ device->is_suspend = true;
+ status = osdrvCallbacks.
+ deviceSuspendHandler(device->claimedContext);
+ if (status)
+ device->is_suspend = false;
+ }
+
+ CleanupHIFScatterResources(device);
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceSuspend\n"));
+
+ switch (status) {
+ case 0:
+ return 0;
+ case A_EBUSY:
+ /* Hack for kernel in order to support deep sleep and wow */
+ return -EBUSY;
+ default:
+ return -1;
+ }
+}
+
+static int hifDeviceResume(struct device *dev)
+{
+ struct sdio_func *func = dev_to_sdio_func(dev);
+ int status = 0;
+ struct hif_device *device;
+
+ device = ath6kl_get_hifdev(func);
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceResume\n"));
+ if (device && device->claimedContext &&
+ osdrvCallbacks.deviceSuspendHandler) {
+ status = osdrvCallbacks.
+ deviceResumeHandler(device->claimedContext);
+ if (status == 0)
+ device->is_suspend = false;
+ }
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceResume\n"));
+
+ return status;
+}
+
+static const struct dev_pm_ops ar6k_device_pm_ops = {
+ .suspend = hifDeviceSuspend,
+ .resume = hifDeviceResume,
+};
+#endif /* CONFIG_PM */
+
static struct sdio_driver ath6kl_hifdev_driver = {
.name = "ath6kl_hifdev",
.id_table = ath6kl_hifdev_ids,
.probe = ath6kl_hifdev_probe,
.remove = ath6kl_hifdev_remove,
-};
-
#if defined(CONFIG_PM)
-/* New suspend/resume based on linux-2.6.32
- * Need to patch linux-2.6.32 with mmc2.6.32_suspend.patch
- * Need to patch with msmsdcc2.6.29_suspend.patch for msm_sdcc host
- */
-static struct dev_pm_ops ar6k_device_pm_ops = {
- .suspend = hifDeviceSuspend,
- .resume = hifDeviceResume,
+ .drv = {
+ .pm = &ar6k_device_pm_ops,
+ },
+#endif
};
-#endif /* CONFIG_PM */

/* make sure we only unregister when registered. */
static int registered = 0;
@@ -218,11 +270,6 @@ int HIFInit(OSDRV_CALLBACKS *callbacks)
/* Register with bus driver core */
registered = 1;

-#if defined(CONFIG_PM)
- if (callbacks->deviceSuspendHandler && callbacks->deviceResumeHandler)
- ath6kl_hifdev_driver.drv.pm = &ar6k_device_pm_ops;
-#endif /* CONFIG_PM */
-
r = sdio_register_driver(&ath6kl_hifdev_driver);
if (r < 0)
return r;
@@ -1112,55 +1159,6 @@ static int hifEnableFunc(struct hif_device *device, struct sdio_func *func)
return ret;
}

-#if defined(CONFIG_PM)
-static int hifDeviceSuspend(struct device *dev)
-{
- struct sdio_func *func=dev_to_sdio_func(dev);
- int status = 0;
- struct hif_device *device;
-
- device = ath6kl_get_hifdev(func);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceSuspend\n"));
- if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
- device->is_suspend = true; /* set true first for PowerStateChangeNotify(..) */
- status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext);
- if (status) {
- device->is_suspend = false;
- }
- }
- CleanupHIFScatterResources(device);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceSuspend\n"));
-
- switch (status) {
- case 0:
- return 0;
- case A_EBUSY:
- return -EBUSY; /* Hack for kernel in order to support deep sleep and wow */
- default:
- return -1;
- }
-}
-
-static int hifDeviceResume(struct device *dev)
-{
- struct sdio_func *func=dev_to_sdio_func(dev);
- int status = 0;
- struct hif_device *device;
-
- device = ath6kl_get_hifdev(func);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceResume\n"));
- if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
- status = osdrvCallbacks.deviceResumeHandler(device->claimedContext);
- if (status == 0) {
- device->is_suspend = false;
- }
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceResume\n"));
-
- return status;
-}
-#endif /* CONFIG_PM */
-
/*
* This should be moved to AR6K HTC layer.
*/
--
1.7.0.4


2011-03-30 00:56:41

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 03/34] ath6kl: propagate error values on ar6000_avail_ev()

When something fails we set up some generic error values,
instead keep the values from the callers and make sure to
pass them on.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 51 ++++++++++++--------------
1 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 6248c6d..846eea7 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -1601,7 +1601,7 @@ ar6000_avail_ev(void *context, void *hif_handle)
#ifdef ATH6K_CONFIG_CFG80211
struct wireless_dev *wdev;
#endif /* ATH6K_CONFIG_CFG80211 */
- int init_status = 0;
+ int r = 0;
struct hif_device_os_device_info osDevInfo;

memset(&osDevInfo, 0, sizeof(osDevInfo));
@@ -1722,28 +1722,25 @@ ar6000_avail_ev(void *context, void *hif_handle)
{
struct bmi_target_info targ_info;

- if (BMIGetTargetInfo(ar->arHifDevice, &targ_info) != 0) {
- init_status = A_ERROR;
+ r = BMIGetTargetInfo(ar->arHifDevice, &targ_info);
+ if (r)
goto avail_ev_failed;
- }

ar->arVersion.target_ver = targ_info.target_ver;
ar->arTargetType = targ_info.target_type;

- /* do any target-specific preparation that can be done through BMI */
- if (ar6000_prepare_target(ar->arHifDevice,
+ /* do any target-specific preparation that can be done through BMI */
+ r = ar6000_prepare_target(ar->arHifDevice,
targ_info.target_type,
- targ_info.target_ver) != 0) {
- init_status = A_ERROR;
+ targ_info.target_ver);
+ if (r)
goto avail_ev_failed;
- }

}

- if (ar6000_configure_target(ar) != 0) {
- init_status = A_ERROR;
+ r = ar6000_configure_target(ar);
+ if (r)
goto avail_ev_failed;
- }

A_MEMZERO(&htcInfo,sizeof(htcInfo));
htcInfo.pContext = ar;
@@ -1751,8 +1748,8 @@ ar6000_avail_ev(void *context, void *hif_handle)

ar->arHtcTarget = HTCCreate(ar->arHifDevice,&htcInfo);

- if (ar->arHtcTarget == NULL) {
- init_status = A_ERROR;
+ if (!ar->arHtcTarget) {
+ r = -ENOMEM;
goto avail_ev_failed;
}

@@ -1771,9 +1768,10 @@ ar6000_avail_ev(void *context, void *hif_handle)
#endif

#ifdef ATH_AR6K_11N_SUPPORT
- if((ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs)) == NULL) {
+ ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs);
+ if (!ar->aggr_cntxt) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize aggr.\n", __func__));
- init_status = A_ERROR;
+ r = -ENOMEM;
goto avail_ev_failed;
}

@@ -1790,9 +1788,9 @@ ar6000_avail_ev(void *context, void *hif_handle)
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode));
if ((wlaninitmode == WLAN_INIT_MODE_UDEV) ||
(wlaninitmode == WLAN_INIT_MODE_DRV)) {
- int status = 0;
do {
- if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0) {
+ r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode);
+ if (r) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n"));
break;
}
@@ -1802,24 +1800,23 @@ ar6000_avail_ev(void *context, void *hif_handle)
}
#endif
rtnl_lock();
- status = (ar6000_init(dev)==0) ? 0 : A_ERROR;
+ r = ar6000_init(dev);
rtnl_unlock();
- if (status) {
+ if (r) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n"));
}
} while (false);

- if (status) {
- init_status = status;
+ if (r)
goto avail_ev_failed;
- }
}

/* This runs the init function if registered */
- if (register_netdev(dev)) {
+ r = register_netdev(dev);
+ if (r) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: register_netdev failed\n"));
ar6000_destroy(dev, 0);
- return A_ERROR;
+ return r;
}

is_netdev_registered = 1;
@@ -1832,10 +1829,10 @@ ar6000_avail_ev(void *context, void *hif_handle)
(unsigned long)ar));

avail_ev_failed :
- if (init_status)
+ if (r)
ar6000_sysfs_bmi_deinit(ar);

- return init_status;
+ return r;
}

static void ar6000_target_failure(void *Instance, int Status)
--
1.7.0.4


2011-03-30 00:57:15

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 16/34] ath6kl: remove unused define WLAN_HEADERS

All the code is used so just keep it and remove the static define.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/Makefile | 1 -
.../common/AR6002/hw4.0/hw/analog_intf_reg.h | 13 -------------
.../include/common/AR6002/hw4.0/hw/apb_map.h | 8 --------
.../include/common/AR6002/hw4.0/hw/gpio_reg.h | 8 --------
.../include/common/AR6002/hw4.0/hw/mbox_host_reg.h | 13 -------------
.../include/common/AR6002/hw4.0/hw/mbox_reg.h | 8 --------
.../include/common/AR6002/hw4.0/hw/rtc_reg.h | 8 --------
.../include/common/AR6002/hw4.0/hw/umbox_reg.h | 14 --------------
.../include/common/AR6002/hw4.0/hw/vmc_reg.h | 8 --------
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 14 --------------
drivers/staging/ath6kl/wmi/wmi.c | 2 --
11 files changed, 0 insertions(+), 97 deletions(-)

diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile
index d79f862..cd04fba 100644
--- a/drivers/staging/ath6kl/Makefile
+++ b/drivers/staging/ath6kl/Makefile
@@ -112,7 +112,6 @@ endif

ccflags-y += -DWAPI_ENABLE
ccflags-y += -DCHECKSUM_OFFLOAD
-ccflags-y += -DWLAN_HEADERS
ccflags-y += -DINIT_MODE_DRV_ENABLED

obj-$(CONFIG_ATH6K_LEGACY) := ath6kl.o
diff --git a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/analog_intf_reg.h b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/analog_intf_reg.h
index 01b9eb5..b8de1c9 100644
--- a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/analog_intf_reg.h
+++ b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/analog_intf_reg.h
@@ -21,17 +21,4 @@
//===================================================================


-#ifdef WLAN_HEADERS
-
#include "analog_intf_athr_wlan_reg.h"
-
-
-#ifndef BT_HEADERS
-
-
-
-#endif
-#endif
-
-
-
diff --git a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/apb_map.h b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/apb_map.h
index e4d2d62..0068ca3 100644
--- a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/apb_map.h
+++ b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/apb_map.h
@@ -21,11 +21,8 @@
//===================================================================


-#ifdef WLAN_HEADERS
-
#include "apb_athr_wlan_map.h"

-
#ifndef BT_HEADERS

#define RTC_BASE_ADDRESS WLAN_RTC_BASE_ADDRESS
@@ -40,9 +37,4 @@
#define MAC_BASE_ADDRESS WLAN_MAC_BASE_ADDRESS
#define RDMA_BASE_ADDRESS WLAN_RDMA_BASE_ADDRESS

-
-#endif
#endif
-
-
-
diff --git a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/gpio_reg.h b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/gpio_reg.h
index b3e7126..afef47e 100644
--- a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/gpio_reg.h
+++ b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/gpio_reg.h
@@ -21,11 +21,8 @@
//===================================================================


-#ifdef WLAN_HEADERS
-
#include "gpio_athr_wlan_reg.h"

-
#ifndef BT_HEADERS

#define GPIO_OUT_ADDRESS WLAN_GPIO_OUT_ADDRESS
@@ -1086,9 +1083,4 @@
#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x)
#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x)

-
-#endif
#endif
-
-
-
diff --git a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_host_reg.h b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_host_reg.h
index 3af5621..109f24e 100644
--- a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_host_reg.h
+++ b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_host_reg.h
@@ -21,17 +21,4 @@
//===================================================================


-#ifdef WLAN_HEADERS
-
#include "mbox_wlan_host_reg.h"
-
-
-#ifndef BT_HEADERS
-
-
-
-#endif
-#endif
-
-
-
diff --git a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_reg.h b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_reg.h
index cc67585..72fa483 100644
--- a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_reg.h
+++ b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_reg.h
@@ -21,11 +21,8 @@
//===================================================================


-#ifdef WLAN_HEADERS
-
#include "mbox_wlan_reg.h"

-
#ifndef BT_HEADERS

#define MBOX_FIFO_ADDRESS WLAN_MBOX_FIFO_ADDRESS
@@ -552,9 +549,4 @@
#define HOST_IF_WINDOW_DATA_GET(x) WLAN_HOST_IF_WINDOW_DATA_GET(x)
#define HOST_IF_WINDOW_DATA_SET(x) WLAN_HOST_IF_WINDOW_DATA_SET(x)

-
-#endif
#endif
-
-
-
diff --git a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/rtc_reg.h b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/rtc_reg.h
index 0855de5..82bd708 100644
--- a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/rtc_reg.h
+++ b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/rtc_reg.h
@@ -21,11 +21,8 @@
//===================================================================


-#ifdef WLAN_HEADERS
-
#include "rtc_wlan_reg.h"

-
#ifndef BT_HEADERS

#define RESET_CONTROL_ADDRESS WLAN_RESET_CONTROL_ADDRESS
@@ -967,9 +964,4 @@
#define GPIO_WAKEUP_CONTROL_ENABLE_GET(x) WLAN_GPIO_WAKEUP_CONTROL_ENABLE_GET(x)
#define GPIO_WAKEUP_CONTROL_ENABLE_SET(x) WLAN_GPIO_WAKEUP_CONTROL_ENABLE_SET(x)

-
-#endif
#endif
-
-
-
diff --git a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/umbox_reg.h b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/umbox_reg.h
index b233cbc..b18ff48 100644
--- a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/umbox_reg.h
+++ b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/umbox_reg.h
@@ -20,18 +20,4 @@
// Author(s): ="Atheros"
//===================================================================

-
-#ifdef WLAN_HEADERS
-
#include "umbox_wlan_reg.h"
-
-
-#ifndef BT_HEADERS
-
-
-
-#endif
-#endif
-
-
-
diff --git a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/vmc_reg.h b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/vmc_reg.h
index c3d8088..990f2be 100644
--- a/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/vmc_reg.h
+++ b/drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/vmc_reg.h
@@ -21,11 +21,8 @@
//===================================================================


-#ifdef WLAN_HEADERS
-
#include "vmc_wlan_reg.h"

-
#ifndef BT_HEADERS

#define MC_BCAM_VALID_ADDRESS WLAN_MC_BCAM_VALID_ADDRESS
@@ -159,9 +156,4 @@
#define CPU_RAM4_CONFLICT_CNT_GET(x) WLAN_CPU_RAM4_CONFLICT_CNT_GET(x)
#define CPU_RAM4_CONFLICT_CNT_SET(x) WLAN_CPU_RAM4_CONFLICT_CNT_SET(x)

-
-#endif
#endif
-
-
-
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index abde256..b9d0471 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -152,10 +152,8 @@ unsigned int ar3khcibaud = AR3KHCIBAUD_DEFAULT;
unsigned int hciuartscale = HCIUARTSCALE_DEFAULT;
unsigned int hciuartstep = HCIUARTSTEP_DEFAULT;
#endif
-#ifdef CONFIG_CHECKSUM_OFFLOAD
unsigned int csumOffload=0;
unsigned int csumOffloadTest=0;
-#endif
unsigned int eppingtest=0;

module_param_string(ifname, ifname, sizeof(ifname), 0644);
@@ -177,9 +175,7 @@ module_param(reduce_credit_dribble, int, 0644);
module_param(allow_trace_signal, int, 0644);
module_param(enablerssicompensation, uint, 0644);
module_param(processDot11Hdr, uint, 0644);
-#ifdef CONFIG_CHECKSUM_OFFLOAD
module_param(csumOffload, uint, 0644);
-#endif
#ifdef CONFIG_HOST_TCMD_SUPPORT
module_param(testmode, uint, 0644);
#endif
@@ -1744,12 +1740,10 @@ ar6000_avail_ev(void *context, void *hif_handle)
#endif


-#ifdef CONFIG_CHECKSUM_OFFLOAD
if(csumOffload){
/*if external frame work is also needed, change and use an extended rxMetaVerion*/
ar->rxMetaVersion=WMI_META_VERSION_2;
}
-#endif

ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs);
if (!ar->aggr_cntxt) {
@@ -3006,7 +3000,6 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev)
}

if (ar->arWmiEnabled) {
-#ifdef CONFIG_CHECKSUM_OFFLOAD
u8 csumStart=0;
u8 csumDest=0;
u8 csum=skb->ip_summed;
@@ -3015,7 +3008,6 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev)
sizeof(ATH_LLC_SNAP_HDR));
csumDest=skb->csum_offset+csumStart;
}
-#endif
if (A_NETBUF_HEADROOM(skb) < dev->hard_header_len - LINUX_HACK_FUDGE_FACTOR) {
struct sk_buff *newbuf;

@@ -3046,7 +3038,6 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev)
break;
}
}
-#ifdef CONFIG_CHECKSUM_OFFLOAD
if(csumOffload && (csum ==CHECKSUM_PARTIAL)){
WMI_TX_META_V2 metaV2;
metaV2.csumStart =csumStart;
@@ -3060,7 +3051,6 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev)

}
else
-#endif
{
if (wmi_data_hdr_add(ar->arWmi, skb, DATA_MSGTYPE, bMoreData, dot11Hdr,0,NULL) != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx - wmi_data_hdr_add failed\n"));
@@ -3693,11 +3683,9 @@ ar6000_rx(void *Context, struct htc_packet *pPacket)
case WMI_META_VERSION_1:
offset += sizeof(WMI_RX_META_V1);
break;
-#ifdef CONFIG_CHECKSUM_OFFLOAD
case WMI_META_VERSION_2:
offset += sizeof(WMI_RX_META_V2);
break;
-#endif
default:
break;
}
@@ -3767,7 +3755,6 @@ ar6000_rx(void *Context, struct htc_packet *pPacket)
A_NETBUF_PULL((void*)skb, sizeof(WMI_RX_META_V1));
break;
}
-#ifdef CONFIG_CHECKSUM_OFFLOAD
case WMI_META_VERSION_2:
{
WMI_RX_META_V2 *pMeta = (WMI_RX_META_V2 *)A_NETBUF_DATA(skb);
@@ -3778,7 +3765,6 @@ ar6000_rx(void *Context, struct htc_packet *pPacket)
A_NETBUF_PULL((void*)skb, sizeof(WMI_RX_META_V2));
break;
}
-#endif
default:
break;
}
diff --git a/drivers/staging/ath6kl/wmi/wmi.c b/drivers/staging/ath6kl/wmi/wmi.c
index e1f6acd..3f5bbe3 100644
--- a/drivers/staging/ath6kl/wmi/wmi.c
+++ b/drivers/staging/ath6kl/wmi/wmi.c
@@ -463,7 +463,6 @@ int wmi_meta_add(struct wmi_t *wmip, void *osbuf, u8 *pVersion,void *pTxMetaS)
*pVersion = WMI_META_VERSION_1;
return (0);
}
-#ifdef CONFIG_CHECKSUM_OFFLOAD
case WMI_META_VERSION_2:
{
WMI_TX_META_V2 *pV2 ;
@@ -475,7 +474,6 @@ int wmi_meta_add(struct wmi_t *wmip, void *osbuf, u8 *pVersion,void *pTxMetaS)
memcpy(pV2,(WMI_TX_META_V2 *)pTxMetaS,sizeof(WMI_TX_META_V2));
return (0);
}
-#endif
default:
return (0);
}
--
1.7.0.4


2011-03-30 00:56:46

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 05/34] ath6kl: remove SET_MODULE_OWNER usage

This is not required.

Cc: Naveen Singh <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index cbf2cb6..bb4dbb5 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -1573,10 +1573,6 @@ init_netdev(struct net_device *dev, char *name)
strcpy(dev->name, name);
}

-#ifdef SET_MODULE_OWNER
- SET_MODULE_OWNER(dev);
-#endif
-
#ifdef CONFIG_CHECKSUM_OFFLOAD
if(csumOffload){
dev->features |= NETIF_F_IP_CSUM; /*advertise kernel capability to do TCP/UDP CSUM offload for IPV4*/
--
1.7.0.4


2011-04-04 22:55:07

by Vipin Mehta

[permalink] [raw]
Subject: Re: [PATCH 34/34] ath6kl: remove the HTC raw interface

On Thu, Mar 31, 2011 at 11:03:50AM -0700, Luis R. Rodriguez wrote:
> On Thu, Mar 31, 2011 at 9:50 AM, Vipin Mehta <[email protected]> wrote:
> > The raw HTC support is required for the tools used on the manufacturing floor
> > For module calibration. Without this code, the driver and the hardware
> > cannot be shipped. I suggest we keep this code until we add the support for
> > nl80211 test command interface and migrate the tools to use the new interface.
>
> Vipin, so you NACK the patch -- that's fine. Greg please drop this
> one. Vipin, when do you plan on adding the nl80211 test command
> support? The API already exists. I'll remind you that this is a
> blocker for getting this out of staging.
>
> Luis
Greg,
Can you apply the rest of the changes from patch 0 through 33 in
this series if you are satisfied with them. We have more patches coming
but are currently waiting for you to apply the existing ones.

Thanks,
Vipin

2011-04-05 14:58:28

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 34/34] ath6kl: remove the HTC raw interface

On Mon, Apr 04, 2011 at 03:56:43PM -0700, Vipin Mehta wrote:
> On Thu, Mar 31, 2011 at 11:03:50AM -0700, Luis R. Rodriguez wrote:
> > On Thu, Mar 31, 2011 at 9:50 AM, Vipin Mehta <[email protected]> wrote:
> > > The raw HTC support is required for the tools used on the manufacturing floor
> > > For module calibration. Without this code, the driver and the hardware
> > > cannot be shipped. I suggest we keep this code until we add the support for
> > > nl80211 test command interface and migrate the tools to use the new interface.
> >
> > Vipin, so you NACK the patch -- that's fine. Greg please drop this
> > one. Vipin, when do you plan on adding the nl80211 test command
> > support? The API already exists. I'll remind you that this is a
> > blocker for getting this out of staging.
> >
> > Luis
> Greg,
> Can you apply the rest of the changes from patch 0 through 33 in
> this series if you are satisfied with them. We have more patches coming
> but are currently waiting for you to apply the existing ones.

Already applied.

thanks,

greg k-h

2011-04-05 07:38:32

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 34/34] ath6kl: remove the HTC raw interface

On Thu, Mar 31, 2011 at 11:03:50AM -0700, Luis R. Rodriguez wrote:
> On Thu, Mar 31, 2011 at 9:50 AM, Vipin Mehta <[email protected]> wrote:
> > The raw HTC support is required for the tools used on the manufacturing floor
> > For module calibration. Without this code, the driver and the hardware
> > cannot be shipped. I suggest we keep this code until we add the support for
> > nl80211 test command interface and migrate the tools to use the new interface.
>
> Vipin, so you NACK the patch -- that's fine. Greg please drop this
> one.

Dropped.