From c7d48a5971934708242f062fd99da3537f9a4c47 Mon Sep 17 00:00:00 2001 From: Marcus Glocker Date: Wed, 13 Dec 2006 11:03:55 +0000 Subject: First part of fixing broken beacon frames in acx(4) AP mode based on a diff from Sepherosa Ziehau (DragonFly); The firmware TIM element template was initialized wrong. Though, our ieee80211_alloc_beacon() routine calculates it's own TIM element, which now results in having two TIMs in an acx(4) beacon. Would it be an idea to introduce a ieee80211_alloc_beacon() flag to turn the TIM element off? Because fiddling out the TIM element in the driver for cases in which the firmware calculates its own TIM is a bit ugly ... ok claudio@ --- sys/dev/ic/acx.c | 19 ++++++++++++++++--- sys/dev/ic/acx100.c | 13 +------------ sys/dev/ic/acxreg.h | 4 ++-- 3 files changed, 19 insertions(+), 17 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c index fcded71f528..b76919c9904 100644 --- a/sys/dev/ic/acx.c +++ b/sys/dev/ic/acx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx.c,v 1.56 2006/12/08 09:17:34 claudio Exp $ */ +/* $OpenBSD: acx.c,v 1.57 2006/12/13 11:03:54 mglocker Exp $ */ /* * Copyright (c) 2006 Jonathan Gray @@ -1792,6 +1792,8 @@ back: int acx_init_tmplt_ordered(struct acx_softc *sc) { + struct acx_tmplt_tim tim; + /* * NOTE: * Order of templates initialization: @@ -1817,6 +1819,16 @@ acx_init_tmplt_ordered(struct acx_softc *sc) if (acx_init_probe_resp_tmplt(sc) != 0) return (1); + /* Setup TIM template */ + bzero(&tim, sizeof(tim)); + tim.tim_eid = IEEE80211_ELEMID_TIM; + tim.tim_len = ACX_TIM_LEN(ACX_TIM_BITMAP_LEN); + if (acx_set_tmplt(sc, ACXCMD_TMPLT_TIM, &tim, + ACX_TMPLT_TIM_SIZ(ACX_TIM_BITMAP_LEN)) != 0) { + printf("%s: can't set tim tmplt\n", sc->sc_dev.dv_xname); + return (1); + } + #undef CALL_SET_TMPLT return (0); } @@ -2334,9 +2346,10 @@ acx_set_beacon_tmplt(struct acx_softc *sc, struct ieee80211_node *ni) struct mbuf *m; int len; - bzero(&beacon, sizeof(beacon)); - m = ieee80211_beacon_alloc(ic, ni); + if (m == NULL) + return (1); + bzero(&beacon, sizeof(beacon)); m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)&beacon.data); len = m->m_pkthdr.len + sizeof(beacon.size); m_freem(m); diff --git a/sys/dev/ic/acx100.c b/sys/dev/ic/acx100.c index 8078cb13919..b65e720a0aa 100644 --- a/sys/dev/ic/acx100.c +++ b/sys/dev/ic/acx100.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx100.c,v 1.15 2006/12/08 09:17:34 claudio Exp $ */ +/* $OpenBSD: acx100.c,v 1.16 2006/12/13 11:03:54 mglocker Exp $ */ /* * Copyright (c) 2006 Jonathan Gray @@ -383,7 +383,6 @@ int acx100_init_tmplt(struct acx_softc *sc) { struct acx_conf_mmap mem_map; - struct acx_tmplt_tim tim; struct ifnet *ifp = &sc->sc_ic.ic_if; /* Set templates start address */ @@ -404,16 +403,6 @@ acx100_init_tmplt(struct acx_softc *sc) return (1); } - /* Setup TIM template */ - bzero(&tim, sizeof(tim)); - tim.tim_eid = IEEE80211_ELEMID_TIM; - tim.tim_len = ACX_TIM_LEN(ACX_TIM_BITMAP_LEN); - if (acx_set_tmplt(sc, ACXCMD_TMPLT_TIM, &tim, - ACX_TMPLT_TIM_SIZ(ACX_TIM_BITMAP_LEN)) != 0) { - printf("%s: can't set tim tmplt\n", ifp->if_xname); - return (1); - } - return (0); } diff --git a/sys/dev/ic/acxreg.h b/sys/dev/ic/acxreg.h index e1523a47933..af3b5764946 100644 --- a/sys/dev/ic/acxreg.h +++ b/sys/dev/ic/acxreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acxreg.h,v 1.7 2006/12/08 09:17:34 claudio Exp $ */ +/* $OpenBSD: acxreg.h,v 1.8 2006/12/13 11:03:54 mglocker Exp $ */ /* * Copyright (c) 2006 Jonathan Gray @@ -404,7 +404,7 @@ struct tim_head { /* For tim_head.len (tim_head - eid - len + bitmap) */ #define ACX_TIM_LEN(bitmap_len) \ (sizeof(struct tim_head) - (2 * sizeof(uint8_t)) + (bitmap_len)) -#define ACX_TIM_BITMAP_LEN 5 +#define ACX_TIM_BITMAP_LEN 1 struct acx_tmplt_tim { uint16_t size; -- cgit v1.2.3