From: damien Date: Mon, 21 Jul 2008 18:43:18 +0000 (+0000) Subject: instead of passing rx tstamp and rssi to the ieee80211_input function, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=30d05aace5dfc9e238681bc4d88f40b3eb18547b;p=openbsd instead of passing rx tstamp and rssi to the ieee80211_input function, pass a pointer to an ieee80211_rxinfo structure containing those two fields plus an extra flags field that indicates whether the frame was decrypted by hardware or not. required for a future fix. --- diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c index 9cc1e50f265..ff8a1360273 100644 --- a/sys/dev/ic/acx.c +++ b/sys/dev/ic/acx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx.c,v 1.84 2008/06/22 21:40:36 brad Exp $ */ +/* $OpenBSD: acx.c,v 1.85 2008/07/21 18:43:19 damien Exp $ */ /* * Copyright (c) 2006 Jonathan Gray @@ -1315,6 +1315,7 @@ acx_rxeof(struct acx_softc *sc) struct acx_rxbuf_hdr *head; struct acx_rxbuf *buf; struct mbuf *m; + struct ieee80211_rxinfo rxi; uint32_t desc_status; uint16_t desc_ctrl; int len, error; @@ -1350,6 +1351,7 @@ acx_rxeof(struct acx_softc *sc) sc->chip_rxbuf_exhdr); wh = mtod(m, struct ieee80211_frame *); + rxi.rxi_flags = 0; if ((wh->i_fc[1] & IEEE80211_FC1_WEP) && sc->chip_hw_crypt) { /* Short circuit software WEP */ @@ -1360,6 +1362,7 @@ acx_rxeof(struct acx_softc *sc) sc->chip_proc_wep_rxbuf(sc, m, &len); wh = mtod(m, struct ieee80211_frame *); } + rxi.rxi_flags |= IEEE80211_RXI_HWDEC; } m->m_len = m->m_pkthdr.len = len; @@ -1390,8 +1393,9 @@ acx_rxeof(struct acx_softc *sc) ni = ieee80211_find_rxnode(ic, wh); - ieee80211_input(ifp, m, ni, head->rbh_level, - letoh32(head->rbh_time)); + rxi.rxi_rssi = head->rbh_level; + rxi.rxi_tstamp = letoh32(head->rbh_time); + ieee80211_input(ifp, m, ni, &rxi); ieee80211_release_node(ic, ni); } else { diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index a2f2f5787df..0f238c326c5 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.54 2007/09/30 11:33:14 kettenis Exp $ */ +/* $OpenBSD: an.c,v 1.55 2008/07/21 18:43:19 damien Exp $ */ /* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -357,6 +357,7 @@ an_rxeof(struct an_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct an_rxframe frmhdr; struct mbuf *m; @@ -474,17 +475,21 @@ an_rxeof(struct an_softc *sc) #endif /* NBPFILTER > 0 */ wh = mtod(m, struct ieee80211_frame *); + rxi.rxi_flags = 0; if (wh->i_fc[1] & IEEE80211_FC1_WEP) { /* * WEP is decrypted by hardware. Clear WEP bit * header for ieee80211_input(). */ wh->i_fc[1] &= ~IEEE80211_FC1_WEP; + + rxi.rxi_flags |= IEEE80211_RXI_HWDEC; } ni = ieee80211_find_rxnode(ic, wh); - ieee80211_input(ifp, m, ni, frmhdr.an_rx_signal_strength, - an_switch32(frmhdr.an_rx_time)); + rxi.rxi_rssi = frmhdr.an_rx_signal_strength; + rxi.rxi_tstamp = an_switch32(frmhdr.an_rx_time); + ieee80211_input(ifp, m, ni, &rxi); ieee80211_release_node(ic, ni); } diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index d8dbc2d6d96..8d9e9abf71d 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.69 2007/10/13 16:12:29 fgsch Exp $ */ +/* $OpenBSD: ath.c,v 1.70 2008/07/21 18:43:19 damien Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -134,7 +134,7 @@ void ath_setcurmode(struct ath_softc *, enum ieee80211_phymode); void ath_rssadapt_updatenode(void *, struct ieee80211_node *); void ath_rssadapt_updatestats(void *); void ath_recv_mgmt(struct ieee80211com *, struct mbuf *, - struct ieee80211_node *, int, int, u_int32_t); + struct ieee80211_node *, struct ieee80211_rxinfo *, int); void ath_disable(struct ath_softc *); void ath_power(int, void *); @@ -1886,6 +1886,7 @@ ath_rx_proc(void *arg, int npending) struct ath_desc *ds; struct mbuf *m; struct ieee80211_frame *wh, whbuf; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct ath_node *an; struct ath_recv_hist *rh; @@ -2018,9 +2019,9 @@ ath_rx_proc(void *arg, int npending) bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif - m_adj(m, -IEEE80211_CRC_LEN); wh = mtod(m, struct ieee80211_frame *); + rxi.rxi_flags = 0; if (wh->i_fc[1] & IEEE80211_FC1_WEP) { /* * WEP is decrypted by hardware. Clear WEP bit @@ -2039,6 +2040,8 @@ ath_rx_proc(void *arg, int npending) * The header has probably moved. */ wh = mtod(m, struct ieee80211_frame *); + + rxi.rxi_flags |= IEEE80211_RXI_HWDEC; } /* @@ -2062,8 +2065,9 @@ ath_rx_proc(void *arg, int npending) /* * Send frame up for processing. */ - ieee80211_input(ifp, m, ni, - ds->ds_rxstat.rs_rssi, ds->ds_rxstat.rs_tstamp); + rxi.rxi_rssi = ds->ds_rxstat.rs_rssi; + rxi.rxi_tstamp = ds->ds_rxstat.rs_tstamp; + ieee80211_input(ifp, m, ni, &rxi); /* Handle the rate adaption */ ieee80211_rssadapt_input(ic, ni, &an->an_rssadapt, @@ -2982,12 +2986,12 @@ bad: void ath_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, - struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, int subtype) { struct ath_softc *sc = (struct ath_softc*)ic->ic_softc; struct ath_hal *ah = sc->sc_ah; - (*sc->sc_recv_mgmt)(ic, m, ni, subtype, rssi, rstamp); + (*sc->sc_recv_mgmt)(ic, m, ni, rxi, subtype); switch (subtype) { case IEEE80211_FC0_SUBTYPE_PROBE_RESP: diff --git a/sys/dev/ic/athvar.h b/sys/dev/ic/athvar.h index f59a5a8167d..8ca19b847ec 100644 --- a/sys/dev/ic/athvar.h +++ b/sys/dev/ic/athvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athvar.h,v 1.22 2008/06/14 02:28:14 jsing Exp $ */ +/* $OpenBSD: athvar.h,v 1.23 2008/07/21 18:43:19 damien Exp $ */ /* $NetBSD: athvar.h,v 1.10 2004/08/10 01:03:53 dyoung Exp $ */ /*- @@ -214,7 +214,7 @@ struct ath_softc { const struct ieee80211_node *); void (*sc_recv_mgmt)(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, - int, int, u_int32_t); + struct ieee80211_rxinfo *, int); #ifdef __FreeBSD__ device_t sc_dev; #endif diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 0bbf5464d5d..d2b549bc5a8 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atw.c,v 1.59 2008/06/26 05:42:15 ray Exp $ */ +/* $OpenBSD: atw.c,v 1.60 2008/07/21 18:43:19 damien Exp $ */ /* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */ /*- @@ -201,7 +201,7 @@ void atw_linkintr(struct atw_softc *, u_int32_t); int atw_newstate(struct ieee80211com *, enum ieee80211_state, int); int atw_tune(struct atw_softc *); void atw_recv_mgmt(struct ieee80211com *, struct mbuf *, - struct ieee80211_node *, int, int, u_int32_t); + struct ieee80211_node *, struct ieee80211_rxinfo *, int); void atw_next_scan(void *); /* Device initialization */ @@ -2262,7 +2262,7 @@ atw_change_ibss(struct atw_softc *sc) void atw_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, - struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, int subtype) { struct atw_softc *sc = (struct atw_softc*)ic->ic_softc; @@ -2271,7 +2271,7 @@ atw_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, sc->sc_rev < ATW_REVISION_BA) return; - (*sc->sc_recv_mgmt)(ic, m, ni, subtype, rssi, rstamp); + (*sc->sc_recv_mgmt)(ic, m, ni, rxi, subtype); switch (subtype) { case IEEE80211_FC0_SUBTYPE_PROBE_RESP: @@ -3066,6 +3066,7 @@ atw_rxintr(struct atw_softc *sc) { static int rate_tbl[] = {2, 4, 11, 22, 44}; struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct ieee80211_frame *wh; struct ifnet *ifp = &ic->ic_if; @@ -3213,11 +3214,16 @@ atw_rxintr(struct atw_softc *sc) wh = mtod(m, struct ieee80211_frame *); ni = ieee80211_find_rxnode(ic, wh); + rxi.rxi_flags = 0; #if 0 - if (atw_hw_decrypted(sc, wh)) + if (atw_hw_decrypted(sc, wh)) { wh->i_fc[1] &= ~IEEE80211_FC1_WEP; + rxi.rxi_flags |= IEEE80211_RXI_HWDEC; + } #endif - ieee80211_input(ifp, m, ni, (int)rssi, 0); + rxi.rxi_rssi = (int)rssi; + rxi.rxi_tstamp = 0; + ieee80211_input(ifp, m, ni, &rxi); /* * The frame may have caused the node to be marked for * reclamation (e.g. in response to a DEAUTH message) diff --git a/sys/dev/ic/atwvar.h b/sys/dev/ic/atwvar.h index c83523b47b1..b784dab5403 100644 --- a/sys/dev/ic/atwvar.h +++ b/sys/dev/ic/atwvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atwvar.h,v 1.14 2008/06/27 06:03:08 ray Exp $ */ +/* $OpenBSD: atwvar.h,v 1.15 2008/07/21 18:43:19 damien Exp $ */ /* $NetBSD: atwvar.h,v 1.13 2004/07/23 07:07:55 dyoung Exp $ */ /* @@ -197,7 +197,7 @@ struct atw_softc { enum ieee80211_state, int); void (*sc_recv_mgmt)(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, - int, int, u_int32_t); + struct ieee80211_rxinfo *, int); struct ieee80211_node *(*sc_node_alloc)(struct ieee80211com *); void (*sc_node_free)(struct ieee80211com *, struct ieee80211_node *); diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index fd77d56d030..bae421f45cc 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.76 2008/06/11 00:17:17 jsg Exp $ */ +/* $OpenBSD: bwi.c,v 1.77 2008/07/21 18:43:19 damien Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -8214,6 +8214,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_idx) struct bwi_rxbuf *rb = &rbd->rbd_buf[idx]; struct bwi_rxbuf_hdr *hdr; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *m; void *plcp; @@ -8290,8 +8291,9 @@ bwi_rxeof(struct bwi_softc *sc, int end_idx) ni = ieee80211_find_rxnode(ic, wh); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; - ieee80211_input(ifp, m, ni, hdr->rxh_rssi, - letoh16(hdr->rxh_tsf)); + rxi.rxi_rssi = hdr->rxh_rssi; + rxi.rxi_tstamp = letoh16(hdr->rxh_tsf); + ieee80211_input(ifp, m, ni, &rxi); ieee80211_release_node(ic, ni); diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index e17cd6585cb..eacfefd661e 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malo.c,v 1.82 2008/04/16 18:32:15 damien Exp $ */ +/* $OpenBSD: malo.c,v 1.83 2008/07/21 18:43:19 damien Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -1626,6 +1626,7 @@ malo_rx_intr(struct malo_softc *sc) struct malo_rx_desc *desc; struct malo_rx_data *data; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *mnew, *m; uint32_t rxRdPtr, rxWrPtr; @@ -1736,7 +1737,10 @@ malo_rx_intr(struct malo_softc *sc) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ifp, m, ni, desc->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = desc->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index d141e768054..9d40b54e299 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgt.c,v 1.49 2008/07/01 11:44:12 claudio Exp $ */ +/* $OpenBSD: pgt.c,v 1.50 2008/07/21 18:43:19 damien Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -916,6 +916,7 @@ pgt_input_frames(struct pgt_softc *sc, struct mbuf *m) struct ether_header eh; struct ifnet *ifp; struct ieee80211_channel *chan; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct ieee80211com *ic; struct pgt_rx_annex *pra; @@ -1034,9 +1035,10 @@ input: bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif - ni->ni_rssi = rssi; - ni->ni_rstamp = rstamp; - ieee80211_input(ifp, m, ni, rssi, rstamp); + rxi.rxi_flags = 0; + ni->ni_rssi = rxi.rxi_rssi = rssi; + ni->ni_rstamp = rxi.rxi_tstamp = rstamp; + ieee80211_input(ifp, m, ni, &rxi); /* * The frame may have caused the node to be marked for * reclamation (e.g. in response to a DEAUTH message) diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 81bbb9f93f0..ab8d87fbb7c 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.36 2008/04/16 18:32:15 damien Exp $ */ +/* $OpenBSD: rt2560.c,v 1.37 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1071,6 +1071,7 @@ rt2560_decryption_intr(struct rt2560_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *mnew, *m; int hw, error; @@ -1193,7 +1194,10 @@ rt2560_decryption_intr(struct rt2560_softc *sc) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ifp, m, ni, desc->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = desc->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index 04a98615465..a55f5a6efc0 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.41 2008/04/16 18:32:15 damien Exp $ */ +/* $OpenBSD: rt2661.c,v 1.42 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2006 @@ -995,6 +995,7 @@ rt2661_rx_intr(struct rt2661_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *mnew, *m; int error, rssi; @@ -1115,7 +1116,10 @@ rt2661_rx_intr(struct rt2661_softc *sc) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ifp, m, ni, desc->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = desc->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /*- * Keep track of the average RSSI using an Exponential Moving diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c index dec6a71b21f..71be64a3891 100644 --- a/sys/dev/ic/rt2860.c +++ b/sys/dev/ic/rt2860.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2860.c,v 1.15 2008/06/08 19:34:14 jsg Exp $ */ +/* $OpenBSD: rt2860.c,v 1.16 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2007,2008 @@ -1014,6 +1014,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *m, *mnew; uint8_t ant, rssi; @@ -1101,8 +1102,12 @@ rt2860_rx_intr(struct rt2860_softc *sc) m->m_pkthdr.len = m->m_len = letoh16(rxwi->len) & 0xfff; wh = mtod(m, struct ieee80211_frame *); - /* frame is decrypted by hardware */ - wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + rxi.rxi_flags = 0; + if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + /* frame is decrypted by hardware */ + wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + rxi.rxi_flags |= IEEE80211_RXI_HWDEC; + } /* HW may insert 2 padding bytes after 802.11 header */ if (rxd->flags & htole32(RT2860_RX_L2PAD)) { @@ -1164,7 +1169,9 @@ skipbpf: ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ifp, m, ni, rssi, 0); + rxi.rxi_rssi = rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index f0071a2be4e..0dca15b1685 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.66 2008/04/16 18:32:15 damien Exp $ */ +/* $OpenBSD: rtw.c,v 1.67 2008/07/21 18:43:19 damien Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- @@ -106,7 +106,7 @@ void rtw_start(struct ifnet *); void rtw_watchdog(struct ifnet *); void rtw_next_scan(void *); void rtw_recv_mgmt(struct ieee80211com *, struct mbuf *, - struct ieee80211_node *, int, int, u_int32_t); + struct ieee80211_node *, struct ieee80211_rxinfo *, int); struct ieee80211_node *rtw_node_alloc(struct ieee80211com *); void rtw_node_free(struct ieee80211com *, struct ieee80211_node *); void rtw_media_status(struct ifnet *, struct ifmediareq *); @@ -1090,7 +1090,7 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr) struct rtw_rxsoft *rs; struct rtw_rxdesc_blk *rdb; struct mbuf *m; - + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct ieee80211_frame *wh; @@ -1289,7 +1289,10 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr) } #endif /* NBPFILTER > 0 */ - ieee80211_input(&sc->sc_if, m, ni, rssi, htsftl); + rxi.rxi_flags = 0; + rxi.rxi_rssi = rssi; + rxi.rxi_tstamp = htsftl; + ieee80211_input(&sc->sc_if, m, ni, &rxi); ieee80211_release_node(&sc->sc_ic, ni); next: rtw_rxdesc_init(rdb, rs, next, 0); @@ -3511,11 +3514,11 @@ rtw_ibss_merge(struct rtw_softc *sc, struct ieee80211_node *ni, void rtw_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, - struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, int subtype) { struct rtw_softc *sc = (struct rtw_softc*)ic->ic_softc; - (*sc->sc_mtbl.mt_recv_mgmt)(ic, m, ni, subtype, rssi, rstamp); + (*sc->sc_mtbl.mt_recv_mgmt)(ic, m, ni, rxi, subtype); switch (subtype) { case IEEE80211_FC0_SUBTYPE_PROBE_RESP: @@ -3523,7 +3526,7 @@ rtw_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, if (ic->ic_opmode != IEEE80211_M_IBSS || ic->ic_state != IEEE80211_S_RUN) return; - rtw_ibss_merge(sc, ni, rstamp); + rtw_ibss_merge(sc, ni, rxi->rxi_tstamp); break; default: break; diff --git a/sys/dev/ic/rtwvar.h b/sys/dev/ic/rtwvar.h index fbadf60822f..8337581fcea 100644 --- a/sys/dev/ic/rtwvar.h +++ b/sys/dev/ic/rtwvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rtwvar.h,v 1.23 2007/06/07 20:20:15 damien Exp $ */ +/* $OpenBSD: rtwvar.h,v 1.24 2008/07/21 18:43:19 damien Exp $ */ /* $NetBSD: rtwvar.h,v 1.10 2004/12/26 22:37:57 mycroft Exp $ */ /*- @@ -300,7 +300,7 @@ struct rtw_mtbl { enum ieee80211_state, int); void (*mt_recv_mgmt)(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, - int, int, u_int32_t); + struct ieee80211_rxinfo *, int); struct ieee80211_node *(*mt_node_alloc)(struct ieee80211com *); void (*mt_node_free)(struct ieee80211com *, struct ieee80211_node *); diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index b6ff2171dcd..6542c14c8c7 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.72 2008/04/16 18:32:15 damien Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.73 2008/07/21 18:43:18 damien Exp $ */ /*- * Copyright (c) 2004-2008 @@ -815,6 +815,7 @@ ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status, struct ifnet *ifp = &ic->ic_if; struct mbuf *mnew, *m; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; int error; @@ -892,7 +893,10 @@ ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status, ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the upper layer */ - ieee80211_input(ifp, m, ni, status->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = status->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); ieee80211_release_node(ic, ni); } diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 56923690bdc..57858f61ee4 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.86 2007/11/17 19:09:16 damien Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.87 2008/07/21 18:43:18 damien Exp $ */ /*- * Copyright (c) 2004-2006 @@ -868,6 +868,7 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, struct ifnet *ifp = &ic->ic_if; struct mbuf *mnew, *m; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; int error; @@ -932,6 +933,7 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, wh = mtod(m, struct ieee80211_frame *); + rxi.rxi_flags = 0; if ((wh->i_fc[1] & IEEE80211_FC1_WEP) && ic->ic_opmode != IEEE80211_M_MONITOR) { /* @@ -945,6 +947,8 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, m_adj(m, IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN); m_adj(m, -IEEE80211_WEP_CRCLEN); wh = mtod(m, struct ieee80211_frame *); + + rxi.rxi_flags |= IEEE80211_RXI_HWDEC; } #if NBPFILTER > 0 @@ -976,7 +980,9 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the upper layer */ - ieee80211_input(ifp, m, ni, frame->rssi_dbm, 0); + rxi.rxi_rssi = frame->rssi_dbm; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index dae2d7a4bb8..b529990d5ee 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.20 2008/06/16 18:43:06 damien Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.21 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2007,2008 @@ -1196,6 +1196,7 @@ iwn_rx_intr(struct iwn_softc *sc, struct iwn_rx_desc *desc, struct iwn_rx_ring *ring = &sc->rxq; struct iwn_rbuf *rbuf; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *m, *mnew; struct iwn_rx_stat *stat; @@ -1330,7 +1331,10 @@ iwn_rx_intr(struct iwn_softc *sc, struct iwn_rx_desc *desc, ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ifp, m, ni, rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index 04107d3d865..f7e7742ffa6 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.61 2008/06/16 18:43:06 damien Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.62 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2006, 2007 @@ -1204,6 +1204,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc, struct wpi_rx_tail *tail; struct wpi_rbuf *rbuf; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *m, *mnew; @@ -1317,7 +1318,10 @@ wpi_rx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc, ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ifp, m, ni, stat->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = stat->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index 30033557984..af17f927e7c 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.91 2007/11/27 16:22:13 martynas Exp $ */ +/* $OpenBSD: if_atu.c,v 1.92 2008/07/21 18:43:19 damien Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken . All rights reserved. @@ -1654,6 +1654,7 @@ atu_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) struct ifnet *ifp = &ic->ic_if; struct atu_rx_hdr *h; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *m; u_int32_t len; @@ -1753,15 +1754,19 @@ atu_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) } #endif /* NBPFILTER > 0 */ + rxi.rxi_flags = 0; if (wh->i_fc[1] & IEEE80211_FC1_WEP) { /* * WEP is decrypted by hardware. Clear WEP bit * header for ieee80211_input(). */ wh->i_fc[1] &= ~IEEE80211_FC1_WEP; + rxi.rxi_flags |= IEEE80211_RXI_HWDEC; } - ieee80211_input(ifp, m, ni, h->rssi, UGETDW(h->rx_time)); + rxi.rxi_rssi = h->rssi; + rxi.rxi_tstamp = UGETDW(h->rx_time); + ieee80211_input(ifp, m, ni, &rxi); ieee80211_release_node(ic, ni); done1: diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index f125f66eb12..c1bc8f10aa9 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.103 2008/04/16 18:32:15 damien Exp $ */ +/* $OpenBSD: if_ral.c,v 1.104 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -708,6 +708,7 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) struct ifnet *ifp = &ic->ic_if; const struct ural_rx_desc *desc; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *mnew, *m; int s, len; @@ -795,7 +796,10 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ifp, m, ni, desc->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = desc->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index a3dea32b01a..a450be7baee 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.73 2008/06/29 00:43:11 deraadt Exp $ */ +/* $OpenBSD: if_rum.c,v 1.74 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini @@ -774,6 +774,7 @@ rum_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) struct ifnet *ifp = &ic->ic_if; const struct rum_rx_desc *desc; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *mnew, *m; int s, len; @@ -860,7 +861,10 @@ rum_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ifp, m, ni, desc->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = desc->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index 4affeabc416..13f4ff26797 100644 --- a/sys/dev/usb/if_uath.c +++ b/sys/dev/usb/if_uath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uath.c,v 1.34 2008/06/08 20:43:31 yuo Exp $ */ +/* $OpenBSD: if_uath.c,v 1.35 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2006 @@ -1182,6 +1182,7 @@ uath_data_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct uath_rx_desc *desc; struct mbuf *mnew, *m; @@ -1248,6 +1249,7 @@ uath_data_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, data->buf = mtod(data->m, uint8_t *); wh = mtod(m, struct ieee80211_frame *); + rxi.rxi_flags = 0; if ((wh->i_fc[1] & IEEE80211_FC1_WEP) && ic->ic_opmode != IEEE80211_M_MONITOR) { /* @@ -1261,6 +1263,8 @@ uath_data_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, m_adj(m, IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN); m_adj(m, -IEEE80211_WEP_CRCLEN); wh = mtod(m, struct ieee80211_frame *); + + rxi.rxi_flags |= IEEE80211_RXI_HWDEC; } #if NBPFILTER > 0 @@ -1286,7 +1290,9 @@ uath_data_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, s = splnet(); ni = ieee80211_find_rxnode(ic, wh); - ieee80211_input(ifp, m, ni, (int)betoh32(desc->rssi), 0); + rxi.rxi_rssi = (int)betoh32(desc->rssi); + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c index e2f368a9ba2..7efb28a69c0 100644 --- a/sys/dev/usb/if_upgt.c +++ b/sys/dev/usb/if_upgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upgt.c,v 1.35 2008/04/16 18:32:15 damien Exp $ */ +/* $OpenBSD: if_upgt.c,v 1.36 2008/07/21 18:43:19 damien Exp $ */ /* * Copyright (c) 2007 Marcus Glocker @@ -1771,6 +1771,7 @@ upgt_rx(struct upgt_softc *sc, uint8_t *data, int pkglen) struct ifnet *ifp = &ic->ic_if; struct upgt_lmac_rx_desc *rxdesc; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; struct ieee80211_node *ni; struct mbuf *m; int s; @@ -1817,7 +1818,10 @@ upgt_rx(struct upgt_softc *sc, uint8_t *data, int pkglen) ni = ieee80211_find_rxnode(ic, wh); /* push the frame up to the 802.11 stack */ - ieee80211_input(ifp, m, ni, rxdesc->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = rxdesc->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 9d86d976627..b509739439f 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.68 2008/05/27 00:11:11 jsg Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.69 2008/07/21 18:43:19 damien Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini @@ -1899,6 +1899,7 @@ zyd_rx_data(struct zyd_softc *sc, const uint8_t *buf, uint16_t len) struct ifnet *ifp = &ic->ic_if; struct ieee80211_node *ni; struct ieee80211_frame *wh; + struct ieee80211_rxinfo rxi; const struct zyd_plcphdr *plcp; const struct zyd_rx_stat *stat; struct mbuf *m; @@ -1977,7 +1978,10 @@ zyd_rx_data(struct zyd_softc *sc, const uint8_t *buf, uint16_t len) s = splnet(); wh = mtod(m, struct ieee80211_frame *); ni = ieee80211_find_rxnode(ic, wh); - ieee80211_input(ifp, m, ni, stat->rssi, 0); + rxi.rxi_flags = 0; + rxi.rxi_rssi = stat->rssi; + rxi.rxi_tstamp = 0; /* unused */ + ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ ieee80211_release_node(ic, ni); diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 07775a0ad9a..de5744fc04d 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,5 +1,5 @@ /* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */ -/* $OpenBSD: ieee80211_input.c,v 1.80 2008/06/09 07:07:16 djm Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.81 2008/07/21 18:43:18 damien Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe @@ -79,13 +79,13 @@ int ieee80211_parse_wpa(struct ieee80211com *, const u_int8_t *, int ieee80211_save_ie(const u_int8_t *, u_int8_t **); void ieee80211_recv_pspoll(struct ieee80211com *, struct mbuf *); void ieee80211_recv_probe_resp(struct ieee80211com *, struct mbuf *, - struct ieee80211_node *, int, u_int32_t, int); + struct ieee80211_node *, struct ieee80211_rxinfo *, int); void ieee80211_recv_probe_req(struct ieee80211com *, struct mbuf *, - struct ieee80211_node *, int, u_int32_t); + struct ieee80211_node *, struct ieee80211_rxinfo *); void ieee80211_recv_auth(struct ieee80211com *, struct mbuf *, - struct ieee80211_node *, int, u_int32_t); + struct ieee80211_node *, struct ieee80211_rxinfo *); void ieee80211_recv_assoc_req(struct ieee80211com *, struct mbuf *, - struct ieee80211_node *, int, u_int32_t, int); + struct ieee80211_node *, struct ieee80211_rxinfo *, int); void ieee80211_recv_assoc_resp(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, int); void ieee80211_recv_deauth(struct ieee80211com *, struct mbuf *, @@ -151,7 +151,7 @@ ieee80211_get_hdrlen(const void *data) */ void ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, - int rssi, u_int32_t rstamp) + struct ieee80211_rxinfo *rxi) { struct ieee80211com *ic = (void *)ifp; struct ieee80211_frame *wh; @@ -203,8 +203,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, goto out; } if (ic->ic_state != IEEE80211_S_SCAN) { - ni->ni_rssi = rssi; - ni->ni_rstamp = rstamp; + ni->ni_rssi = rxi->rxi_rssi; + ni->ni_rstamp = rxi->rxi_tstamp; if (type == IEEE80211_FC0_TYPE_DATA && (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_QOS)) { struct ieee80211_qosframe *qwh = @@ -374,11 +374,9 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, ic->ic_stats.is_rx_nowep++; goto out; } + } else if (!(rxi->rxi_flags & IEEE80211_RXI_HWDEC)) { + /* XXX */ } - /* - * XXX else: drivers should pass a flag to indicate if the - * frame was successfully decrypted or not. - */ #if NBPFILTER > 0 /* copy to listener after decrypt */ if (ic->ic_rawbpf) @@ -502,7 +500,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, ifp->if_xname, ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT], - ether_sprintf(wh->i_addr2), rssi, + ether_sprintf(wh->i_addr2), rxi->rxi_rssi, ieee80211_phymode_name[ieee80211_chan2mode(ic, ic->ic_bss->ni_chan)]); } @@ -519,7 +517,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, return; } #endif - (*ic->ic_recv_mgmt)(ic, m, ni, subtype, rssi, rstamp); + (*ic->ic_recv_mgmt)(ic, m, ni, rxi, subtype); m_freem(m); return; @@ -874,7 +872,7 @@ ieee80211_parse_rsn(struct ieee80211com *ic, const u_int8_t *frm, { /* check IE length */ if (frm[1] < 2) { - IEEE80211_DPRINTF(("%s: invalid RSN/WPA2 IE;" + IEEE80211_DPRINTF(("%s: invalid RSN IE;" " length %u, expecting at least 2\n", __func__, frm[1])); ic->ic_stats.is_rx_elem_toosmall++; return IEEE80211_STATUS_IE_INVALID; @@ -930,7 +928,7 @@ ieee80211_save_ie(const u_int8_t *frm, u_int8_t **ie) */ void ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, - struct ieee80211_node *ni, int rssi, u_int32_t rstamp, int isprobe) + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, int isprobe) { const struct ieee80211_frame *wh; const u_int8_t *frm, *efrm; @@ -1104,7 +1102,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, * potential better one. */ if ((ni = ieee80211_find_node_for_beacon(ic, wh->i_addr2, - &ic->ic_channels[chan], ssid, rssi)) != NULL) + &ic->ic_channels[chan], ssid, rxi->rxi_rssi)) != NULL) return; #ifdef IEEE80211_DEBUG @@ -1217,8 +1215,8 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, memcpy(ni->ni_essid, &ssid[2], ssid[1]); } IEEE80211_ADDR_COPY(ni->ni_bssid, wh->i_addr3); - ni->ni_rssi = rssi; - ni->ni_rstamp = rstamp; + ni->ni_rssi = rxi->rxi_rssi; + ni->ni_rstamp = rxi->rxi_tstamp; memcpy(ni->ni_tstamp, tstamp, sizeof(ni->ni_tstamp)); ni->ni_intval = bintval; ni->ni_capinfo = capinfo; @@ -1256,7 +1254,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, */ void ieee80211_recv_probe_req(struct ieee80211com *ic, struct mbuf *m0, - struct ieee80211_node *ni, int rssi, u_int32_t rstamp) + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi) { const struct ieee80211_frame *wh; const u_int8_t *frm, *efrm; @@ -1322,8 +1320,8 @@ ieee80211_recv_probe_req(struct ieee80211com *ic, struct mbuf *m0, IEEE80211_DPRINTF(("%s: new probe req from %s\n", __func__, ether_sprintf((u_int8_t *)wh->i_addr2))); } - ni->ni_rssi = rssi; - ni->ni_rstamp = rstamp; + ni->ni_rssi = rxi->rxi_rssi; + ni->ni_rstamp = rxi->rxi_tstamp; rate = ieee80211_setup_rates(ic, ni, rates, xrates, IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE | IEEE80211_F_DONEGO | IEEE80211_F_DODEL); @@ -1343,7 +1341,7 @@ ieee80211_recv_probe_req(struct ieee80211com *ic, struct mbuf *m0, */ void ieee80211_recv_auth(struct ieee80211com *ic, struct mbuf *m0, - struct ieee80211_node *ni, int rssi, u_int32_t rstamp) + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi) { const struct ieee80211_frame *wh; const u_int8_t *frm, *efrm; @@ -1378,7 +1376,7 @@ ieee80211_recv_auth(struct ieee80211com *ic, struct mbuf *m0, } return; } - ieee80211_auth_open(ic, wh, ni, rssi, rstamp, seq, status); + ieee80211_auth_open(ic, wh, ni, rxi, seq, status); } /*- @@ -1394,7 +1392,7 @@ ieee80211_recv_auth(struct ieee80211com *ic, struct mbuf *m0, */ void ieee80211_recv_assoc_req(struct ieee80211com *ic, struct mbuf *m0, - struct ieee80211_node *ni, int rssi, u_int32_t rstamp, int reassoc) + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, int reassoc) { const struct ieee80211_frame *wh; const u_int8_t *frm, *efrm; @@ -1588,8 +1586,8 @@ ieee80211_recv_assoc_req(struct ieee80211com *ic, struct mbuf *m0, } else ni->ni_rsnprotos = IEEE80211_PROTO_NONE; - ni->ni_rssi = rssi; - ni->ni_rstamp = rstamp; + ni->ni_rssi = rxi->rxi_rssi; + ni->ni_rstamp = rxi->rxi_tstamp; ni->ni_intval = bintval; ni->ni_capinfo = capinfo; ni->ni_chan = ic->ic_bss->ni_chan; @@ -1847,26 +1845,26 @@ ieee80211_recv_action(struct ieee80211com *ic, struct mbuf *m0, void ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, - struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, int subtype) { switch (subtype) { case IEEE80211_FC0_SUBTYPE_BEACON: - ieee80211_recv_probe_resp(ic, m0, ni, rssi, rstamp, 0); + ieee80211_recv_probe_resp(ic, m0, ni, rxi, 0); break; case IEEE80211_FC0_SUBTYPE_PROBE_RESP: - ieee80211_recv_probe_resp(ic, m0, ni, rssi, rstamp, 1); + ieee80211_recv_probe_resp(ic, m0, ni, rxi, 1); break; case IEEE80211_FC0_SUBTYPE_PROBE_REQ: - ieee80211_recv_probe_req(ic, m0, ni, rssi, rstamp); + ieee80211_recv_probe_req(ic, m0, ni, rxi); break; case IEEE80211_FC0_SUBTYPE_AUTH: - ieee80211_recv_auth(ic, m0, ni, rssi, rstamp); + ieee80211_recv_auth(ic, m0, ni, rxi); break; case IEEE80211_FC0_SUBTYPE_ASSOC_REQ: - ieee80211_recv_assoc_req(ic, m0, ni, rssi, rstamp, 0); + ieee80211_recv_assoc_req(ic, m0, ni, rxi, 0); break; case IEEE80211_FC0_SUBTYPE_REASSOC_REQ: - ieee80211_recv_assoc_req(ic, m0, ni, rssi, rstamp, 1); + ieee80211_recv_assoc_req(ic, m0, ni, rxi, 1); break; case IEEE80211_FC0_SUBTYPE_ASSOC_RESP: ieee80211_recv_assoc_resp(ic, m0, ni, 0); diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index eb349fa7b73..02e4c9ff6f7 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_proto.c,v 1.24 2008/06/09 07:07:16 djm Exp $ */ +/* $OpenBSD: ieee80211_proto.c,v 1.25 2008/07/21 18:43:18 damien Exp $ */ /* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */ /*- @@ -432,7 +432,7 @@ ieee80211_gtk_rekey_timeout(void *arg) void ieee80211_auth_open(struct ieee80211com *ic, const struct ieee80211_frame *wh, - struct ieee80211_node *ni, int rssi, u_int32_t rstamp, u_int16_t seq, + struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, u_int16_t seq, u_int16_t status) { struct ifnet *ifp = &ic->ic_if; @@ -472,8 +472,8 @@ ieee80211_auth_open(struct ieee80211com *ic, const struct ieee80211_frame *wh, return; } IEEE80211_ADDR_COPY(ni->ni_bssid, ic->ic_bss->ni_bssid); - ni->ni_rssi = rssi; - ni->ni_rstamp = rstamp; + ni->ni_rssi = rxi->rxi_rssi; + ni->ni_rstamp = rxi->rxi_tstamp; ni->ni_chan = ic->ic_bss->ni_chan; } IEEE80211_SEND_MGMT(ic, ni, diff --git a/sys/net80211/ieee80211_proto.h b/sys/net80211/ieee80211_proto.h index 20f5da1ed1a..27c0b95bc8f 100644 --- a/sys/net80211/ieee80211_proto.h +++ b/sys/net80211/ieee80211_proto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_proto.h,v 1.29 2008/04/21 19:37:18 damien Exp $ */ +/* $OpenBSD: ieee80211_proto.h,v 1.30 2008/07/21 18:43:18 damien Exp $ */ /* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */ /*- @@ -57,13 +57,14 @@ extern void ieee80211_proto_attach(struct ifnet *); extern void ieee80211_proto_detach(struct ifnet *); struct ieee80211_node; +struct ieee80211_rxinfo; extern u_int ieee80211_get_hdrlen(const void *); extern void ieee80211_input(struct ifnet *, struct mbuf *, - struct ieee80211_node *, int, u_int32_t); + struct ieee80211_node *, struct ieee80211_rxinfo *); extern int ieee80211_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); extern void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *, - struct ieee80211_node *, int, int, u_int32_t); + struct ieee80211_node *, struct ieee80211_rxinfo *, int); extern int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *, int, int); extern void ieee80211_recv_eapol(struct ieee80211com *, struct mbuf *, @@ -127,8 +128,8 @@ extern int ieee80211_ibss_merge(struct ieee80211com *, extern void ieee80211_reset_erp(struct ieee80211com *); extern void ieee80211_set_shortslottime(struct ieee80211com *, int); extern void ieee80211_auth_open(struct ieee80211com *, - const struct ieee80211_frame *, struct ieee80211_node *, int, - u_int32_t, u_int16_t, u_int16_t); + const struct ieee80211_frame *, struct ieee80211_node *, + struct ieee80211_rxinfo *rs, u_int16_t, u_int16_t); extern void ieee80211_gtk_rekey_timeout(void *); extern void ieee80211_setkeys(struct ieee80211com *); extern void ieee80211_setkeysdone(struct ieee80211com *); diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 973afb5005f..e12ec242c4f 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.38 2008/04/16 18:32:15 damien Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.39 2008/07/21 18:43:18 damien Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -158,6 +158,13 @@ struct ieee80211_rsnparams { u_int16_t rsn_caps; }; +struct ieee80211_rxinfo { + u_int32_t rxi_flags; + u_int32_t rxi_tstamp; + int rxi_rssi; +}; +#define IEEE80211_RXI_HWDEC 0x00000001 + #define IEEE80211_PS_SLEEP 0x1 /* STA is in power saving mode */ #define IEEE80211_PS_MAX_QUEUE 50 /* maximum saved packets */ @@ -172,7 +179,7 @@ struct ieee80211com { LIST_ENTRY(ieee80211com) ic_list; /* chain of all ieee80211com */ void (*ic_recv_mgmt)(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, - int, int, u_int32_t); + struct ieee80211_rxinfo *, int); int (*ic_send_mgmt)(struct ieee80211com *, struct ieee80211_node *, int, int); void (*ic_recv_eapol)(struct ieee80211com *,