From owner-p4-projects@FreeBSD.ORG Thu Nov 20 19:19:20 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B801F16A4D0; Thu, 20 Nov 2003 19:19:19 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9261016A4CE for ; Thu, 20 Nov 2003 19:19:19 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84F0E43FEC for ; Thu, 20 Nov 2003 19:19:18 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hAL3JIXJ033358 for ; Thu, 20 Nov 2003 19:19:18 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hAL3JHFr033355 for perforce@freebsd.org; Thu, 20 Nov 2003 19:19:17 -0800 (PST) (envelope-from sam@freebsd.org) Date: Thu, 20 Nov 2003 19:19:17 -0800 (PST) Message-Id: <200311210319.hAL3JHFr033355@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 42868 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2003 03:19:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=42868 Change 42868 by sam@sam_ebb on 2003/11/20 19:18:33 o import netbsd pspoll support o add missing htole's from netbsd Affected files ... .. //depot/projects/netperf/sys/dev/wi/if_wavelan_ieee.h#2 edit .. //depot/projects/netperf/sys/dev/wi/if_wi.c#15 edit Differences ... ==== //depot/projects/netperf/sys/dev/wi/if_wavelan_ieee.h#2 (text+ko) ==== @@ -239,6 +239,7 @@ #define WI_RID_ROAMING_MODE 0xFC2D #define WI_RID_OWN_BEACON_INT 0xFC33 /* beacon xmit time for BSS creation */ #define WI_RID_CNF_DBM_ADJUST 0xFC46 +#define WI_RID_SET_TIM 0xFC40 #define WI_RID_DBM_ADJUST 0xFC46 /* RSSI - WI_RID_DBM_ADJUST ~ dBm */ #define WI_RID_BASIC_RATE 0xFCB3 #define WI_RID_SUPPORT_RATE 0xFCB4 ==== //depot/projects/netperf/sys/dev/wi/if_wi.c#15 (text+ko) ==== @@ -148,6 +148,7 @@ static int wi_write_rid(struct wi_softc *, int, void *, int); static int wi_newstate(struct ieee80211com *, enum ieee80211_state, int); +static int wi_set_tim(struct ieee80211com *, int, int); static int wi_scan_ap(struct wi_softc *, u_int16_t, u_int16_t); static void wi_scan_result(struct wi_softc *, int, int); @@ -469,6 +470,7 @@ /* override state transition method */ sc->sc_newstate = ic->ic_newstate; ic->ic_newstate = wi_newstate; + ic->ic_set_tim = wi_set_tim; ieee80211_media_init(ifp, wi_media_change, wi_media_status); #if NBPFILTER > 0 @@ -866,8 +868,7 @@ memset(&frmhdr, 0, sizeof(frmhdr)); cur = sc->sc_txnext; for (;;) { - IF_POLL(&ic->ic_mgtq, m0); - if (m0 != NULL) { + if (IF_POLL(&ic->ic_mgtq, m0)) { if (sc->sc_txd[cur].d_len != 0) { ifp->if_flags |= IFF_OACTIVE; break; @@ -889,6 +890,29 @@ (caddr_t)&frmhdr.wi_ehdr); frmhdr.wi_ehdr.ether_type = 0; wh = mtod(m0, struct ieee80211_frame *); + } else if (IF_POLL(&ic->ic_pwrsaveq, m0)) { + /* + * Should these packets be processed after the + * regular packets or before? Since they are being + * probed for, they are probably less time critical + * than other packets, but, on the other hand, + * we want the power saving nodes to go back to + * sleep as quickly as possible to save power... + */ + if (ic->ic_state != IEEE80211_S_RUN) + break; + if (sc->sc_txd[cur].d_len != 0) { + ifp->if_flags |= IFF_OACTIVE; + break; + } + IF_DEQUEUE(&ic->ic_pwrsaveq, m0); + ni = (struct ieee80211_node *)m0->m_pkthdr.rcvif; + m0->m_pkthdr.rcvif = NULL; + + wh = mtod(m0, struct ieee80211_frame *); + m_copydata(m0, 4, ETHER_ADDR_LEN * 2, + (caddr_t)&frmhdr.wi_ehdr); + frmhdr.wi_ehdr.ether_type = 0; /* XXX?? */ } else { if (ic->ic_state != IEEE80211_S_RUN) break; @@ -915,6 +939,27 @@ wh = mtod(m0, struct ieee80211_frame *); if (ic->ic_flags & IEEE80211_F_WEPON) wh->i_fc[1] |= IEEE80211_FC1_WEP; + if (ic->ic_opmode == IEEE80211_M_HOSTAP && + !IEEE80211_IS_MULTICAST(wh->i_addr1) && + (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == + IEEE80211_FC0_TYPE_DATA) { + if (ni->ni_associd == 0) { + m_freem(m0); + if (ni != ic->ic_bss) + ieee80211_free_node(ic, ni); + ifp->if_oerrors++; + continue; + } + if (ni->ni_pwrsave & IEEE80211_PS_SLEEP) { + /* + * Node is in power-save sleep state, + * stash the packet on the save q for + * transmission later. + */ + ieee80211_pwrsave(ic, ni, m0); + continue; /* don't free node. */ + } + } } #if NBPFILTER > 0 @@ -932,10 +977,6 @@ } frmhdr.wi_tx_ctl |= htole16(WI_TXCNTL_NOCRYPT); } - m_copydata(m0, 0, sizeof(struct ieee80211_frame), - (caddr_t)&frmhdr.wi_whdr); - m_adj(m0, sizeof(struct ieee80211_frame)); - frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len); #if NBPFILTER > 0 if (sc->sc_drvbpf) { struct mbuf *mb; @@ -951,8 +992,12 @@ } } #endif + m_copydata(m0, 0, sizeof(struct ieee80211_frame), + (caddr_t)&frmhdr.wi_whdr); + m_adj(m0, sizeof(struct ieee80211_frame)); + frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len); if (IFF_DUMPPKTS(ifp)) - wi_dump_pkt(&frmhdr, NULL, -1); + wi_dump_pkt(&frmhdr, ni, -1); fid = sc->sc_txd[cur].d_fid; off = sizeof(frmhdr); error = wi_write_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr)) != 0 @@ -2704,6 +2749,18 @@ } static int +wi_set_tim(struct ieee80211com *ic, int aid, int which) +{ + struct wi_softc *sc = ic->ic_softc; + + aid &= ~0xc000; + if (which) + aid |= 0x8000; + + return wi_write_val(sc, WI_RID_SET_TIM, aid); +} + +static int wi_scan_ap(struct wi_softc *sc, u_int16_t chanmask, u_int16_t txrate) { int error = 0; @@ -2716,8 +2773,8 @@ (void)wi_cmd(sc, WI_CMD_INQUIRE, WI_INFO_SCAN_RESULTS, 0, 0); break; case WI_INTERSIL: - val[0] = chanmask; /* channel */ - val[1] = txrate; /* tx rate */ + val[0] = htole16(chanmask); /* channel */ + val[1] = htole16(txrate); /* tx rate */ error = wi_write_rid(sc, WI_RID_SCAN_REQ, val, sizeof(val)); break; case WI_SYMBOL: