aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/ndis/subr_ndis.c
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>2004-01-18 22:57:11 +0000
committerBill Paul <wpaul@FreeBSD.org>2004-01-18 22:57:11 +0000
commited880bb60f6d78546773349d70cb513c7207a634 (patch)
tree8f94ac297b35591f95c060a1820c94637d8fd4b8 /sys/compat/ndis/subr_ndis.c
parent8d71fed0f2f10c08a9a2cd558f3660405c1bc203 (diff)
downloadsrc-ed880bb60f6d78546773349d70cb513c7207a634.tar.gz
src-ed880bb60f6d78546773349d70cb513c7207a634.zip
Convert from using taskqueue_swi to using private kernel threads. The
problem with using taskqueue_swi is that some of the things we defer into threads might block for up to several seconds. This is an unfriendly thing to do to taskqueue_swi, since it is assumed the taskqueue threads will execute fairly quickly once a task is submitted. Reorganized the locking in if_ndis.c in the process. Cleaned up ndis_write_cfg() and ndis_decode_parm() a little.
Notes
Notes: svn path=/head/; revision=124697
Diffstat (limited to 'sys/compat/ndis/subr_ndis.c')
-rw-r--r--sys/compat/ndis/subr_ndis.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c
index 9b210a05eb2d..da5cf89016f8 100644
--- a/sys/compat/ndis/subr_ndis.c
+++ b/sys/compat/ndis/subr_ndis.c
@@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
#include <sys/timespec.h>
#include <sys/smp.h>
#include <sys/queue.h>
-#include <sys/taskqueue.h>
#include <sys/proc.h>
#include <sys/namei.h>
#include <sys/fcntl.h>
@@ -261,7 +260,7 @@ __stdcall static u_int8_t ndis_cpu_cnt(void);
__stdcall static void ndis_ind_statusdone(ndis_handle);
__stdcall static void ndis_ind_status(ndis_handle, ndis_status,
void *, uint32_t);
-static void ndis_workfunc(void *, int);
+static void ndis_workfunc(void *);
__stdcall static ndis_status ndis_sched_workitem(ndis_work_item *);
__stdcall static void ndis_pkt_to_pkt(ndis_packet *, uint32_t, uint32_t,
ndis_packet *, uint32_t, uint32_t *);
@@ -601,18 +600,18 @@ ndis_decode_parm(block, parm, val)
ndis_config_parm *parm;
char *val;
{
- uint16_t *unicode;
ndis_unicode_string *ustr;
-
- unicode = (uint16_t *)&block->nmb_dummybuf;
+ char *astr = NULL;
switch(parm->ncp_type) {
case ndis_parm_string:
ustr = &parm->ncp_parmdata.ncp_stringdata;
- ndis_unicode_to_ascii(ustr->nus_buf, ustr->nus_len, &val);
+ ndis_unicode_to_ascii(ustr->nus_buf, ustr->nus_len, &astr);
+ bcopy(astr, val, 254);
+ free(astr, M_DEVBUF);
break;
case ndis_parm_int:
- sprintf(val, "%ul", parm->ncp_parmdata.ncp_intdata);
+ sprintf(val, "%d", parm->ncp_parmdata.ncp_intdata);
break;
case ndis_parm_hexint:
sprintf(val, "%xu", parm->ncp_parmdata.ncp_intdata);
@@ -644,6 +643,7 @@ ndis_write_cfg(status, cfg, key, parm)
ndis_unicode_to_ascii(key->nus_buf, key->nus_len, &keystr);
/* Decode the parameter into a string. */
+ bzero(val, sizeof(val));
*status = ndis_decode_parm(block, parm, val);
if (*status != NDIS_STATUS_SUCCESS) {
free(keystr, M_DEVBUF);
@@ -2484,9 +2484,8 @@ ndis_ind_status(adapter, status, sbuf, slen)
}
static void
-ndis_workfunc(ctx, pending)
+ndis_workfunc(ctx)
void *ctx;
- int pending;
{
ndis_work_item *work;
__stdcall ndis_proc workfunc;
@@ -2501,11 +2500,7 @@ __stdcall static ndis_status
ndis_sched_workitem(work)
ndis_work_item *work;
{
- struct task *t;
-
- t = (struct task *)&work->nwi_wraprsvd;
- TASK_INIT(t, 0, ndis_workfunc, work);
- taskqueue_enqueue(taskqueue_swi, t);
+ ndis_sched(ndis_workfunc, work, NDIS_TASKQUEUE);
return(NDIS_STATUS_SUCCESS);
}