aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>2003-12-25 06:04:40 +0000
committerBill Paul <wpaul@FreeBSD.org>2003-12-25 06:04:40 +0000
commit72b926ae1a0cdad4e7cc2298e49d27a6f1d5e475 (patch)
treebb19c8c3f36fb73d2988fb6a4f982f2dd595413d /sys/compat
parent67206e04f9259feed999453984fe0d38e8c1e0b5 (diff)
downloadsrc-72b926ae1a0cdad4e7cc2298e49d27a6f1d5e475.tar.gz
src-72b926ae1a0cdad4e7cc2298e49d27a6f1d5e475.zip
Avoid using any of the ndis_packet/ndis_packet_private fields for
mbuf<->packet housekeeping. Instead, add a couple of extra fields to the end of ndis_packet. These should be invisible to the Windows driver module. This also lets me get rid of a little bit of evil from ndis_ptom() (frobbing of the ext_buf field instead of relying on the MEXTADD() macro).
Notes
Notes: svn path=/head/; revision=123826
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/ndis/kern_ndis.c25
-rw-r--r--sys/compat/ndis/ndis_var.h8
2 files changed, 19 insertions, 14 deletions
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c
index 6606b452bddd..3186d8b7d234 100644
--- a/sys/compat/ndis/kern_ndis.c
+++ b/sys/compat/ndis/kern_ndis.c
@@ -328,8 +328,8 @@ ndis_flush_sysctls(arg)
}
void
-ndis_return_packet(packet, arg)
- void *packet;
+ndis_return_packet(buf, arg)
+ void *buf; /* not used */
void *arg;
{
struct ndis_softc *sc;
@@ -337,25 +337,25 @@ ndis_return_packet(packet, arg)
ndis_packet *p;
__stdcall ndis_return_handler returnfunc;
- if (arg == NULL || packet == NULL)
+ if (arg == NULL)
return;
- p = packet;
+ p = arg;
/* Decrement refcount. */
- p->np_private.npp_count--;
+ p->np_refcnt--;
/* Release packet when refcount hits zero, otherwise return. */
- if (p->np_private.npp_count)
+ if (p->np_refcnt)
return;
- sc = arg;
+ sc = p->np_softc;
returnfunc = sc->ndis_chars.nmc_return_packet_func;
adapter = sc->ndis_block.nmb_miniportadapterctx;
if (returnfunc == NULL)
- ndis_free_packet((ndis_packet *)packet);
+ ndis_free_packet(p);
else
- returnfunc(adapter, (ndis_packet *)packet);
+ returnfunc(adapter, p);
return;
}
@@ -474,7 +474,7 @@ ndis_ptom(m0, p)
priv = &p->np_private;
buf = priv->npp_head;
- priv->npp_count = 0;
+ p->np_refcnt = 0;
for (buf = priv->npp_head; buf != NULL; buf = buf->nb_next) {
if (buf == priv->npp_head)
@@ -489,9 +489,8 @@ ndis_ptom(m0, p)
m->m_len = buf->nb_bytecount;
m->m_data = MDL_VA(buf);
MEXTADD(m, m->m_data, m->m_len, ndis_return_packet,
- p->np_rsvd[0], 0, EXT_NDIS);
- m->m_ext.ext_buf = (void *)p; /* XXX */
- priv->npp_count++;
+ p, 0, EXT_NDIS);
+ p->np_refcnt++;
totlen += m->m_len;
if (m->m_flags & MT_HEADER)
*m0 = m;
diff --git a/sys/compat/ndis/ndis_var.h b/sys/compat/ndis/ndis_var.h
index 729606500a27..353069a89a47 100644
--- a/sys/compat/ndis/ndis_var.h
+++ b/sys/compat/ndis/ndis_var.h
@@ -829,7 +829,6 @@ struct ndis_packet {
} np_macrsvd;
} u;
uint32_t *np_rsvd[2];
- uint8_t np_proto_rsvd[1];
/*
* This next part is probably wrong, but we need some place
@@ -838,6 +837,13 @@ struct ndis_packet {
ndis_packet_oob np_oob;
ndis_packet_extension np_ext;
ndis_sc_list np_sclist;
+
+ /* BSD-specific stuff which should be invisible to drivers. */
+
+ uint32_t np_refcnt;
+ void *np_softc;
+ void *np_m0;
+ int np_txidx;
};
typedef struct ndis_packet ndis_packet;