summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/ath/ath_osdep.c
diff options
context:
space:
mode:
authorxc151355 <none@none>2006-11-20 22:51:46 -0800
committerxc151355 <none@none>2006-11-20 22:51:46 -0800
commit0ba2cbe97e0678a691742f98d2532caed0a2c4aa (patch)
tree999e927888ff26967f593246afc931402e17b50e /usr/src/uts/common/io/ath/ath_osdep.c
parent0c64a9b435314788e185507d40ef9fae71507f5a (diff)
downloadillumos-joyent-0ba2cbe97e0678a691742f98d2532caed0a2c4aa.tar.gz
PSARC/2006/406 WiFi for GLDv3
PSARC/2006/517 WiFi for GLDv3 Addendum PSARC/2006/623 WiFi for GLDv3 Addendum #2 6253476 dladm exec_attr entry doesn't allow show-link to work 6362391 ath driver needs to be updated to use the latest HAL 6364198 system crashes if multiple ath driver instances are modunload'ed 6367259 ath driver needs to support GLDv3 6407181 ath driver panics in ath_rate_update function 6421983 ath driver needs shared_key authmode support 6472427 ath driver causes watchdog timeout error 6484943 integrate WiFi/GLDv3 --HG-- rename : usr/src/uts/common/io/ath/ath_ieee80211.c => deleted_files/usr/src/uts/common/io/ath/ath_ieee80211.c rename : usr/src/uts/common/io/ath/ath_ieee80211.h => deleted_files/usr/src/uts/common/io/ath/ath_ieee80211.h rename : usr/src/uts/common/io/ath/ath_wificonfig.c => deleted_files/usr/src/uts/common/io/ath/ath_wificonfig.c
Diffstat (limited to 'usr/src/uts/common/io/ath/ath_osdep.c')
-rw-r--r--usr/src/uts/common/io/ath/ath_osdep.c48
1 files changed, 16 insertions, 32 deletions
diff --git a/usr/src/uts/common/io/ath/ath_osdep.c b/usr/src/uts/common/io/ath/ath_osdep.c
index 6b6def64a2..8551b9e3d3 100644
--- a/usr/src/uts/common/io/ath/ath_osdep.c
+++ b/usr/src/uts/common/io/ath/ath_osdep.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -43,17 +43,15 @@
#include <sys/sunddi.h>
#include <sys/varargs.h>
#include "ath_hal.h"
-#include "ath_ieee80211.h"
#include "ath_impl.h"
struct ath_halfix {
void *p;
size_t size;
- int malloced;
- int freed;
};
-static struct ath_halfix ath_halfix[32];
+#define ATH_MAX_HALMEM 1024
+static struct ath_halfix ath_halfix[ATH_MAX_HALMEM];
/* HAL layer needs these definitions */
int ath_hal_dma_beacon_response_time = 2; /* in TU's */
@@ -96,20 +94,17 @@ ath_hal_malloc(size_t size)
void *p;
int i;
- /* support 16 devices(max leakage of one device is 8) */
- for (i = 0; i < 32; i++) {
- if (ath_halfix[i].malloced == 0)
+ for (i = 0; i < ATH_MAX_HALMEM; i++) {
+ if (ath_halfix[i].p == NULL)
break;
}
- if (i >= 32) {
+ if (i >= ATH_MAX_HALMEM) {
ath_problem("ath: ath_hal_malloc(): too many malloc\n");
return (NULL);
}
p = kmem_zalloc(size, KM_SLEEP);
ath_halfix[i].p = p;
ath_halfix[i].size = size;
- ath_halfix[i].malloced = 1;
- ath_halfix[i].freed = 0;
ATH_DEBUG((ATH_DBG_OSDEP, "ath: ath_hal_malloc(): "
"%d: p=%p, size=%d\n", i, p, size));
return (p);
@@ -119,17 +114,16 @@ void
ath_hal_free(void* p)
{
int i;
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < ATH_MAX_HALMEM; i++) {
if (ath_halfix[i].p == p)
break;
}
- if (i >= 32) {
+ if (i >= ATH_MAX_HALMEM) {
ath_problem("ath: ath_hal_free(): no record for %p\n", p);
return;
}
kmem_free(p, ath_halfix[i].size);
- ath_halfix[i].malloced = 0;
- ath_halfix[i].freed = 1;
+ ath_halfix[i].p = NULL;
ATH_DEBUG((ATH_DBG_OSDEP, "ath: ath_hal_free(): %d: p=%p, size=%d\n",
i, p, ath_halfix[i].size));
}
@@ -147,24 +141,13 @@ ath_hal_memzero(void *dst, size_t n)
bzero(dst, n);
}
-/*
- * So far as I know and test, hal.o has a bug that when attaching,
- * it calls ath_hal_malloc() four times while detaching it calls
- * ath_hal_free() only 3 times, so everytime when a pair of driver
- * load/unload is done, a memory leak occurs. The function
- * free_hal_leaked_mem() just help free the memory that alloced by
- * hal.o but not freed by it. In fact, when attaching, hal.o only
- * call ath_hal_alloc() four times, here assuming a maximum times of
- * 8 just considers some special cases, we have no source after all!
- */
void
ath_halfix_init(void)
{
int i;
- for (i = 0; i < 32; i++) {
- ath_halfix[i].malloced = 0;
- }
+ for (i = 0; i < ATH_MAX_HALMEM; i++)
+ ath_halfix[i].p = NULL;
}
void
@@ -172,10 +155,11 @@ ath_halfix_finit(void)
{
int i;
- for (i = 0; i < 32; i++) {
- if ((ath_halfix[i].malloced == 1) &&
- (ath_halfix[i].freed == 0)) {
+ for (i = 0; i < ATH_MAX_HALMEM; i++)
+ if (ath_halfix[i].p != NULL) {
kmem_free(ath_halfix[i].p, ath_halfix[i].size);
+ ATH_DEBUG((ATH_DBG_OSDEP, "ath_halfix: "
+ "Free %d: p=%x size=%d\n",
+ i, ath_halfix[i].p, ath_halfix[i].size));
}
- }
}