Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bwi/if_bwi.c
| Show First 20 Lines • Show All 1,358 Lines • ▼ Show 20 Lines | bwi_start_locked(struct bwi_softc *sc) | ||||
| trans = 0; | trans = 0; | ||||
| idx = tbd->tbd_idx; | idx = tbd->tbd_idx; | ||||
| while (tbd->tbd_buf[idx].tb_mbuf == NULL && | while (tbd->tbd_buf[idx].tb_mbuf == NULL && | ||||
| tbd->tbd_used + BWI_TX_NSPRDESC < BWI_TX_NDESC && | tbd->tbd_used + BWI_TX_NSPRDESC < BWI_TX_NDESC && | ||||
| (m = mbufq_dequeue(&sc->sc_snd)) != NULL) { | (m = mbufq_dequeue(&sc->sc_snd)) != NULL) { | ||||
| ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; | ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; | ||||
| wh = mtod(m, struct ieee80211_frame *); | wh = mtod(m, struct ieee80211_frame *); | ||||
| ieee80211_output_seqno_assign(ni, -1, m); | |||||
| if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) != 0 && | if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) != 0 && | ||||
| ieee80211_crypto_encap(ni, m) == NULL) { | ieee80211_crypto_encap(ni, m) == NULL) { | ||||
| if_inc_counter(ni->ni_vap->iv_ifp, | if_inc_counter(ni->ni_vap->iv_ifp, | ||||
| IFCOUNTER_OERRORS, 1); | IFCOUNTER_OERRORS, 1); | ||||
| ieee80211_free_node(ni); | ieee80211_free_node(ni); | ||||
| m_freem(m); | m_freem(m); | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,522 Lines • ▼ Show 20 Lines | bwi_plcp_header(const struct ieee80211_rate_table *rt, | ||||
| if (modtype == IEEE80211_T_OFDM) | if (modtype == IEEE80211_T_OFDM) | ||||
| bwi_ofdm_plcp_header(plcp, pkt_len, rate); | bwi_ofdm_plcp_header(plcp, pkt_len, rate); | ||||
| else if (modtype == IEEE80211_T_DS) | else if (modtype == IEEE80211_T_DS) | ||||
| bwi_ds_plcp_header(plcp, pkt_len, rate); | bwi_ds_plcp_header(plcp, pkt_len, rate); | ||||
| else | else | ||||
| panic("unsupported modulation type %u\n", modtype); | panic("unsupported modulation type %u\n", modtype); | ||||
| } | } | ||||
| /* | |||||
| * @brief Encapsulate a frame for transmit. | |||||
| * | |||||
| * Note that this must be called inside the same lock / path | |||||
| * as the crypto encap call in the transmit path. | |||||
| */ | |||||
| static int | static int | ||||
| bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m, | bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m, | ||||
| struct ieee80211_node *ni) | struct ieee80211_node *ni) | ||||
| { | { | ||||
| struct ieee80211vap *vap = ni->ni_vap; | struct ieee80211vap *vap = ni->ni_vap; | ||||
| struct ieee80211com *ic = &sc->sc_ic; | struct ieee80211com *ic = &sc->sc_ic; | ||||
| struct bwi_ring_data *rd = &sc->sc_tx_rdata[BWI_TX_DATA_RING]; | struct bwi_ring_data *rd = &sc->sc_tx_rdata[BWI_TX_DATA_RING]; | ||||
| struct bwi_txbuf_data *tbd = &sc->sc_tx_bdata[BWI_TX_DATA_RING]; | struct bwi_txbuf_data *tbd = &sc->sc_tx_bdata[BWI_TX_DATA_RING]; | ||||
| Show All 19 Lines | #endif | ||||
| wh = mtod(m, struct ieee80211_frame *); | wh = mtod(m, struct ieee80211_frame *); | ||||
| type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; | type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; | ||||
| ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); | ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); | ||||
| /* Get 802.11 frame len before prepending TX header */ | /* Get 802.11 frame len before prepending TX header */ | ||||
| pkt_len = m->m_pkthdr.len + IEEE80211_CRC_LEN; | pkt_len = m->m_pkthdr.len + IEEE80211_CRC_LEN; | ||||
| /* | /* | ||||
| * Assign sequence number - must be done in lock-step with | |||||
| * cipher encap. | |||||
| */ | |||||
| ieee80211_output_seqno_assign(ni, -1, m); | |||||
| /* | |||||
| * Find TX rate | * Find TX rate | ||||
| */ | */ | ||||
| if (type != IEEE80211_FC0_TYPE_DATA || (m->m_flags & M_EAPOL)) { | if (type != IEEE80211_FC0_TYPE_DATA || (m->m_flags & M_EAPOL)) { | ||||
| rate = rate_fb = tp->mgmtrate; | rate = rate_fb = tp->mgmtrate; | ||||
| } else if (ismcast) { | } else if (ismcast) { | ||||
| rate = rate_fb = tp->mcastrate; | rate = rate_fb = tp->mcastrate; | ||||
| } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { | } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { | ||||
| rate = rate_fb = tp->ucastrate; | rate = rate_fb = tp->ucastrate; | ||||
| ▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | KASSERT(sc->sc_cur_regwin->rw_type == BWI_REGWIN_T_MAC, | ||||
| ("current regwin type %d", sc->sc_cur_regwin->rw_type)); | ("current regwin type %d", sc->sc_cur_regwin->rw_type)); | ||||
| mac = (struct bwi_mac *)sc->sc_cur_regwin; | mac = (struct bwi_mac *)sc->sc_cur_regwin; | ||||
| wh = mtod(m, struct ieee80211_frame *); | wh = mtod(m, struct ieee80211_frame *); | ||||
| ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); | ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); | ||||
| /* Get 802.11 frame len before prepending TX header */ | /* Get 802.11 frame len before prepending TX header */ | ||||
| pkt_len = m->m_pkthdr.len + IEEE80211_CRC_LEN; | pkt_len = m->m_pkthdr.len + IEEE80211_CRC_LEN; | ||||
| /* Assign sequence number. */ | |||||
| ieee80211_output_seqno_assign(ni, -1, m); | |||||
| /* | /* | ||||
| * Find TX rate | * Find TX rate | ||||
| */ | */ | ||||
| rate = params->ibp_rate0; | rate = params->ibp_rate0; | ||||
| if (!ieee80211_isratevalid(ic->ic_rt, rate)) { | if (!ieee80211_isratevalid(ic->ic_rt, rate)) { | ||||
| /* XXX fall back to mcast/mgmt rate? */ | /* XXX fall back to mcast/mgmt rate? */ | ||||
| m_freem(m); | m_freem(m); | ||||
| ▲ Show 20 Lines • Show All 872 Lines • Show Last 20 Lines | |||||