commit 7f972e2fc41b51603ff2a17184be6f633af636d4 Author: Jiri Slaby Date: Sun Jul 22 08:26:07 2007 +0200 remove raw and net80211 stuff diff --git a/ath/if_ath.c b/ath/if_ath.c index d0a4b9e..661f571 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -1193,390 +1193,6 @@ ath_beacon_config(struct ath_softc *sc) } /* - * Add additional headers to a transmitted frame and netif_rx it on - * a monitor or raw device - */ -static void -ath_tx_capture(struct net_device *dev, struct ath_desc *ds, struct sk_buff *skb) -{ - struct ath_softc *sc = dev->priv; - u_int32_t tsf; - - /* - * release the owner of this skb since we're basically - * recycling it - */ - if (atomic_read(&skb->users) != 1) { - struct sk_buff *skb2 = skb; - skb = skb_clone(skb, GFP_ATOMIC); - if (skb == NULL) { - dev_kfree_skb(skb2); - return; - } - kfree_skb(skb2); - } else { - skb_orphan(skb); - } - - switch (dev->type) { - case ARPHRD_IEEE80211: - break; - case ARPHRD_IEEE80211_PRISM: { - wlan_ng_prism2_header *ph; - if (skb_headroom(skb) < sizeof(wlan_ng_prism2_header) && - pskb_expand_head(skb, - sizeof(wlan_ng_prism2_header), - 0, GFP_ATOMIC)) { - DPRINTF(sc, ATH_DEBUG_RECV, - "%s: couldn't pskb_expand_head\n", __func__); - goto bad; - } - - ph = (wlan_ng_prism2_header *) - skb_push(skb, sizeof(wlan_ng_prism2_header)); - memset(ph, 0, sizeof(wlan_ng_prism2_header)); - - ph->msgcode = DIDmsg_lnxind_wlansniffrm; - ph->msglen = sizeof(wlan_ng_prism2_header); - strcpy(ph->devname, sc->sc_dev.name); - - ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; - ph->hosttime.status = 0; - ph->hosttime.len = 4; - ph->hosttime.data = jiffies; - - /* Pass up tsf clock in mactime */ - ph->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime; - ph->mactime.status = 0; - ph->mactime.len = 4; - /* - * Rx descriptor has the low 15 bits of the tsf at - * the time the frame was received. Use the current - * tsf to extend this to 32 bits. - */ - tsf = ath5k_hw_get_tsf32(sc->sc_ah); - if ((tsf & 0x7fff) < ds->ds_rxstat.rs_tstamp) - tsf -= 0x8000; - ph->mactime.data = ds->ds_rxstat.rs_tstamp | (tsf &~ 0x7fff); - - ph->istx.did = DIDmsg_lnxind_wlansniffrm_istx; - ph->istx.status = 0; - ph->istx.len = 4; - ph->istx.data = P80211ENUM_truth_true; - - ph->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen; - ph->frmlen.status = 0; - ph->frmlen.len = 4; - ph->frmlen.data = ds->ds_rxstat.rs_datalen; - - ph->channel.did = DIDmsg_lnxind_wlansniffrm_channel; - ph->channel.status = 0; - ph->channel.len = 4; - ph->channel.data = ieee80211_mhz2ieee(ic->ic_ibss_chan->ic_freq,0); - - ph->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi; - ph->rssi.status = 0; - ph->rssi.len = 4; - ph->rssi.data = ds->ds_rxstat.rs_rssi; - - ph->noise.did = DIDmsg_lnxind_wlansniffrm_noise; - ph->noise.status = 0; - ph->noise.len = 4; - ph->noise.data = -95; - - ph->signal.did = DIDmsg_lnxind_wlansniffrm_signal; - ph->signal.status = 0; - ph->signal.len = 4; - ph->signal.data = -95 + ds->ds_rxstat.rs_rssi; - - ph->rate.did = DIDmsg_lnxind_wlansniffrm_rate; - ph->rate.status = 0; - ph->rate.len = 4; - ph->rate.data = sc->sc_hwmap[ds->ds_txstat.ts_rate &~ AR5K_TXSTAT_ALTRATE].ieeerate; - break; - } - case ARPHRD_IEEE80211_RADIOTAP: { - struct ath_tx_radiotap_header *th; - - if (skb_headroom(skb) < sizeof(struct ath_tx_radiotap_header) && - pskb_expand_head(skb, - sizeof(struct ath_tx_radiotap_header), - 0, GFP_ATOMIC)) { - DPRINTF(sc, ATH_DEBUG_RECV, - "%s: couldn't pskb_expand_head\n", __func__); - goto bad; - } - - th = (struct ath_tx_radiotap_header *) skb_push(skb, sizeof(struct ath_tx_radiotap_header)); - memset(th, 0, sizeof(struct ath_tx_radiotap_header)); - th->wt_ihdr.it_version = 0; - th->wt_ihdr.it_len = cpu_to_le16(sizeof(struct ath_tx_radiotap_header)); - th->wt_ihdr.it_present = cpu_to_le32(ATH_TX_RADIOTAP_PRESENT); - th->wt_flags = 0; - th->wt_rate = sc->sc_hwmap[ds->ds_txstat.ts_rate &~ AR5K_TXSTAT_ALTRATE].ieeerate; - th->wt_txpower = 0; - th->wt_antenna = ds->ds_txstat.ts_antenna; - th->wt_tx_flags = 0; - if (ds->ds_txstat.ts_status) - th->wt_tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); - th->wt_rts_retries = ds->ds_txstat.ts_shortretry; - th->wt_data_retries = ds->ds_txstat.ts_longretry; - - break; - } - default: - break; - } - - skb->dev = dev; - skb_reset_mac_header(skb); - skb->ip_summed = CHECKSUM_NONE; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */ - netif_rx(skb); - return; - - bad: - dev_kfree_skb(skb); -} - -/* - * Add additional headers to a received frame and netif_rx it on - * a monitor or raw device - */ -static void -ath_rx_capture(struct net_device *dev, struct ath_desc *ds, struct sk_buff *skb) -{ -#define IS_QOS_DATA(wh) \ - ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK|IEEE80211_FC0_SUBTYPE_MASK))==\ - (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) - struct ath_softc *sc = dev->priv; - struct ieee80211com *ic = &sc->sc_ic; - int len = ds->ds_rxstat.rs_datalen; - struct ieee80211_frame *wh; - u_int32_t tsf; - - KASSERT(ic->ic_flags & IEEE80211_F_DATAPAD, - ("data padding not enabled?")); - /* Remove pad bytes */ - wh = (struct ieee80211_frame *) skb->data; - if (IS_QOS_DATA(wh)) { - int headersize = ieee80211_hdrsize(wh); - int padbytes = roundup(headersize,4) - headersize; - - /* - * Copy up 802.11 header and strip h/w padding. - */ - if (padbytes > 0) { - memmove(skb->data + padbytes, skb->data, headersize); - skb_pull(skb, padbytes); - len -= padbytes; - } - } - - switch (dev->type) { - case ARPHRD_IEEE80211: - break; - case ARPHRD_IEEE80211_PRISM: { - wlan_ng_prism2_header *ph; - if (skb_headroom(skb) < sizeof(wlan_ng_prism2_header)) { - DPRINTF(sc, ATH_DEBUG_RECV, - "%s: prism not enough headroom %d/%d\n", - __func__, skb_headroom(skb), - (int)sizeof(wlan_ng_prism2_header)); - goto bad; - } - ph = (wlan_ng_prism2_header *) - skb_push(skb, sizeof(wlan_ng_prism2_header)); - memset(ph, 0, sizeof(wlan_ng_prism2_header)); - - ph->msgcode = DIDmsg_lnxind_wlansniffrm; - ph->msglen = sizeof(wlan_ng_prism2_header); - strcpy(ph->devname, sc->sc_dev.name); - - ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; - ph->hosttime.status = 0; - ph->hosttime.len = 4; - ph->hosttime.data = jiffies; - - /* Pass up tsf clock in mactime */ - ph->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime; - ph->mactime.status = 0; - ph->mactime.len = 4; - /* - * Rx descriptor has the low 15 bits of the tsf at - * the time the frame was received. Use the current - * tsf to extend this to 32 bits. - */ - tsf = ath5k_hw_get_tsf32(sc->sc_ah); - if ((tsf & 0x7fff) < ds->ds_rxstat.rs_tstamp) - tsf -= 0x8000; - ph->mactime.data = ds->ds_rxstat.rs_tstamp | (tsf &~ 0x7fff); - - ph->istx.did = DIDmsg_lnxind_wlansniffrm_istx; - ph->istx.status = 0; - ph->istx.len = 4; - ph->istx.data = P80211ENUM_truth_false; - - ph->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen; - ph->frmlen.status = 0; - ph->frmlen.len = 4; - ph->frmlen.data = len; - - ph->channel.did = DIDmsg_lnxind_wlansniffrm_channel; - ph->channel.status = 0; - ph->channel.len = 4; - ph->channel.data = ieee80211_mhz2ieee(ic->ic_ibss_chan->ic_freq,0); - - ph->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi; - ph->rssi.status = 0; - ph->rssi.len = 4; - ph->rssi.data = ds->ds_rxstat.rs_rssi; - - ph->noise.did = DIDmsg_lnxind_wlansniffrm_noise; - ph->noise.status = 0; - ph->noise.len = 4; - ph->noise.data = -95; - - ph->signal.did = DIDmsg_lnxind_wlansniffrm_signal; - ph->signal.status = 0; - ph->signal.len = 4; - ph->signal.data = -95 + ds->ds_rxstat.rs_rssi; - - ph->rate.did = DIDmsg_lnxind_wlansniffrm_rate; - ph->rate.status = 0; - ph->rate.len = 4; - ph->rate.data = sc->sc_hwmap[ds->ds_rxstat.rs_rate].ieeerate; - break; - } - case ARPHRD_IEEE80211_RADIOTAP: { - struct ath_rx_radiotap_header *th; - if (skb_headroom(skb) < sizeof(struct ath_rx_radiotap_header)) { - DPRINTF(sc, ATH_DEBUG_RECV, - "%s: radiotap not enough headroom %d/%d\n", - __func__, skb_headroom(skb), - (int)sizeof(struct ath_rx_radiotap_header)); - goto bad; - } - th = (struct ath_rx_radiotap_header *) skb_push(skb, sizeof(struct ath_rx_radiotap_header)); - memset(th, 0, sizeof(struct ath_rx_radiotap_header)); - - th->wr_ihdr.it_version = 0; - th->wr_ihdr.it_len = cpu_to_le16(sizeof(struct ath_rx_radiotap_header)); - th->wr_ihdr.it_present = cpu_to_le32(ATH_RX_RADIOTAP_PRESENT); - th->wr_flags = IEEE80211_RADIOTAP_F_FCS; - th->wr_rate = sc->sc_hwmap[ds->ds_rxstat.rs_rate].ieeerate; - th->wr_chan_freq = cpu_to_le16(ic->ic_ibss_chan->ic_freq); - th->wr_chan_flags = cpu_to_le16(ic->ic_ibss_chan->ic_flags); - th->wr_antenna = ds->ds_rxstat.rs_antenna; - th->wr_antsignal = ds->ds_rxstat.rs_rssi; - if (ds->ds_rxstat.rs_status & AR5K_RXERR_CRC) - th->wr_flags |= IEEE80211_RADIOTAP_F_BADFCS; - - break; - } - default: - break; - } - - skb->dev = dev; - skb_reset_mac_header(skb); - skb->ip_summed = CHECKSUM_NONE; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */ - - netif_rx(skb); - return; - - bad: - dev_kfree_skb(skb); - return; -#undef IS_QOS_DATA -} - -/* - * Extend 15-bit time stamp from rx descriptor to - * a full 64-bit TSF using the current h/w TSF. - */ -static inline uint64_t -ath_tsf_extend(struct ath_hal *ah, uint32_t rstamp) -{ - uint64_t tsf; - - tsf = ath5k_hw_get_tsf64(ah); - - /* Compensate for rollover. */ - if ((tsf & 0x7fff) < rstamp) - tsf -= 0x8000; - - return ((tsf & ~(uint64_t)0x7fff) | rstamp); -} - -/* - * Intercept management frames to collect beacon rssi data - * and to do ibss merges. - */ -static void -ath_recv_mgmt(struct ieee80211com *ic, struct sk_buff *skb, - struct ieee80211_node *ni, - int subtype, int rssi, u_int32_t rstamp) -{ - struct ath_softc *sc = ic->ic_dev->priv; - - /* - * Call up first so subsequent work can use information - * potentially stored in the node (e.g. for ibss merge). - */ - sc->sc_recv_mgmt(ic, skb, ni, subtype, rssi, rstamp); - - switch (subtype) { - case IEEE80211_FC0_SUBTYPE_BEACON: - /* update rssi statistics for use by the hal */ - ATH_RSSI_LPF((ATH_NODE(ni))->an_halstats.ns_avgbrssi, rssi); - /* fall thru... */ - case IEEE80211_FC0_SUBTYPE_PROBE_RESP: - if (ic->ic_opmode == IEEE80211_M_IBSS && - ic->ic_state == IEEE80211_S_RUN) { - /* Extend rstamp with the current tsf to 64 bit */ - u_int64_t tsf = ath_tsf_extend(sc->sc_ah, rstamp); - /* - * Handle ibss merge as needed; check the tsf on the - * frame before attempting the merge. The 802.11 spec - * says the station should change it's bssid to match - * the oldest station with the same ssid, where oldest - * is determined by the tsf. Note that hardware - * reconfiguration happens through callback to - * ath_newstate as the state machine will go from - * RUN -> RUN when this happens. - */ - if (le64toh(ni->ni_tstamp.tsf) >= tsf) { - DPRINTF(sc, ATH_DEBUG_STATE, - "ibss merge, rstamp %u tsf %llx " - "tstamp %llx\n", rstamp, tsf, - ni->ni_tstamp.tsf); - ieee80211_ibss_merge(ni); - } - } - if (ic->ic_opmode == IEEE80211_M_STA && - ic->ic_state == IEEE80211_S_RUN && - sc->sc_bmisscount > 0) { - struct ieee80211_frame *wh; - wh = (struct ieee80211_frame *) skb->data; - if (IEEE80211_ADDR_EQ(wh->i_addr2, ic->ic_bss->ni_bssid)) { - DPRINTF(sc, ATH_DEBUG_BEACON, - "[%s] received %s after beacon miss - clear\n", - ether_sprintf(wh->i_addr2), - (subtype == IEEE80211_FC0_SUBTYPE_BEACON) ? - "beacon" : "probe response"); - sc->sc_bmisscount = 0; - ic->ic_mgt_timer = 0; - } - } - break; - } -} - -/* * Set the default antenna. */ static void