summaryrefslogtreecommitdiffstats
path: root/sys/dev/if_ndis/if_ndis.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2003-12-23 04:08:22 +0000
committerwpaul <wpaul@FreeBSD.org>2003-12-23 04:08:22 +0000
commita0d9582fee2a30515c17d0859ce268d10a063328 (patch)
treebf9f1f3a9199c4028ebe0d1efac3fa602c1a337f /sys/dev/if_ndis/if_ndis.c
parent38f4513fb878dd012fe1ff5438e23e3b846785e4 (diff)
downloadFreeBSD-src-a0d9582fee2a30515c17d0859ce268d10a063328.zip
FreeBSD-src-a0d9582fee2a30515c17d0859ce268d10a063328.tar.gz
Re-do the handling of ndis_buffers. The NDIS_BUFFER structure is
supposed to be opaque to the driver, however it is exposed through several macros which expect certain behavior. In my original implementation, I used the mappedsystemva member of the structure to hold a pointer to the buffer and bytecount to hold the length. It turns out you must use the startva pointer to point to the page containing the start of the buffer and set byteoffset to the offset within the page where the buffer starts. So, for a buffer with address 'baseva,' startva is baseva & ~(PAGE_SIZE -1) and byteoffset is baseva & (PAGE_SIZE -1). We have to maintain this convention everywhere that ndis_buffers are used. Fortunately, Microsoft defines some macros for initializing and manipulating NDIS_BUFFER structures in ntddk.h. I adapted some of them for use here and used them where appropriate. This fixes the discrepancy I observed between how RX'ed packet sizes were being reported in the Broadcom wireless driver and the sample ethernet drivers that I've tested. This should also help the Intel Centrino wireless driver work. Also try to properly initialize the 802.11 BSS and IBSS channels. (Sadly, the channel value is meaningless since there's no way in the existing NDIS API to get/set the channel, but this should take care of any 'invalid channel (NULL)' messages printed on the console.
Diffstat (limited to 'sys/dev/if_ndis/if_ndis.c')
-rw-r--r--sys/dev/if_ndis/if_ndis.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index 9752572..c6bd206 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -512,11 +512,17 @@ ndis_attach(dev)
}
#undef SETRATE
#undef INCRATE
+ /*
+ * The Microsoft API has no support for getting/setting
+ * channels, so we lie like a rug here. If you wan to
+ * select a channel, use the sysctl/registry interface.
+ */
for (i = 1; i < 11; i++) {
ic->ic_channels[i].ic_freq =
ieee80211_ieee2mhz(i, IEEE80211_CHAN_B);
ic->ic_channels[i].ic_flags = IEEE80211_CHAN_B;
}
+
i = sizeof(arg);
r = ndis_get_info(sc, OID_802_11_WEP_STATUS, &arg, &i);
if (arg != NDIS_80211_WEPSTAT_NOTSUPPORTED)
@@ -524,7 +530,8 @@ ndis_attach(dev)
ieee80211_node_attach(ifp);
ieee80211_media_init(ifp, ieee80211_media_change,
ieee80211_media_status);
- /*ic->ic_bss->ni_rates = ic->ic_sup_rates[IEEE80211_MODE_11G];*/
+ ic->ic_ibss_chan = &ic->ic_channels[1];
+ ic->ic_bss->ni_chan = &ic->ic_channels[1];
} else {
ifmedia_init(&sc->ifmedia, IFM_IMASK, ndis_ifmedia_upd,
ndis_ifmedia_sts);
@@ -568,7 +575,7 @@ static int
ndis_detach(dev)
device_t dev;
{
- struct ndis_softc *sc;
+ struct ndis_softc *sc;
struct ifnet *ifp;
sc = device_get_softc(dev);
@@ -747,7 +754,7 @@ static void
ndis_intr(arg)
void *arg;
{
- struct ndis_softc *sc;
+ struct ndis_softc *sc;
struct ifnet *ifp;
int is_our_intr = 0;
int call_isr = 0;
@@ -779,7 +786,7 @@ static void
ndis_tick(xsc)
void *xsc;
{
- struct ndis_softc *sc;
+ struct ndis_softc *sc;
__stdcall ndis_checkforhang_handler hangfunc;
uint8_t rval;
ndis_media_state linkstate;
OpenPOWER on IntegriCloud