Undo some issues from the previous big patch - there's no padding on RX,

so remove DATAPAD and re-do the padding in the TX path manually.

PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
This commit is contained in:
Adrian Chadd 2015-03-08 01:47:10 +00:00
parent 3de934a7a4
commit 8a28176add

View File

@ -447,8 +447,6 @@ wpi_attach(device_t dev)
ic->ic_cryptocaps =
IEEE80211_CRYPTO_AES_CCM;
ic->ic_flags |= IEEE80211_F_DATAPAD;
/*
* Read in the eeprom and also setup the channels for
* net80211. We don't set the rates as net80211 does this for us
@ -2224,8 +2222,6 @@ wpi_intr(void *arg)
static int
wpi_cmd2(struct wpi_softc *sc, struct wpi_buf *buf)
{
struct ifnet *ifp = sc->sc_ifp;
struct ieee80211com *ic = ifp->if_l2com;
struct ieee80211_frame *wh;
struct wpi_tx_cmd *cmd;
struct wpi_tx_data *data;
@ -2233,16 +2229,22 @@ wpi_cmd2(struct wpi_softc *sc, struct wpi_buf *buf)
struct wpi_tx_ring *ring;
struct mbuf *m1;
bus_dma_segment_t *seg, segs[WPI_MAX_SCATTER];
int error, i, hdrspace, nsegs, totlen;
int error, i, hdrlen, nsegs, totlen, pad;
WPI_LOCK_ASSERT(sc);
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
wh = mtod(buf->m, struct ieee80211_frame *);
hdrspace = ieee80211_anyhdrspace(ic, wh);
hdrlen = ieee80211_anyhdrsize(wh);
totlen = buf->m->m_pkthdr.len;
if (hdrlen & 3) {
/* First segment length must be a multiple of 4. */
pad = 4 - (hdrlen & 3);
} else
pad = 0;
ring = &sc->txq[buf->ac];
desc = &ring->desc[ring->cur];
data = &ring->data[ring->cur];
@ -2257,8 +2259,8 @@ wpi_cmd2(struct wpi_softc *sc, struct wpi_buf *buf)
memcpy(cmd->data, buf->data, buf->size);
/* Save and trim IEEE802.11 header. */
memcpy((uint8_t *)(cmd->data + buf->size), wh, hdrspace);
m_adj(buf->m, hdrspace);
memcpy((uint8_t *)(cmd->data + buf->size), wh, hdrlen);
m_adj(buf->m, hdrlen);
error = bus_dmamap_load_mbuf_sg(ring->data_dmat, data->map, buf->m,
segs, &nsegs, BUS_DMA_NOWAIT);
@ -2296,10 +2298,10 @@ wpi_cmd2(struct wpi_softc *sc, struct wpi_buf *buf)
__func__, ring->qid, ring->cur, totlen, nsegs);
/* Fill TX descriptor. */
desc->nsegs = WPI_PAD32(totlen) << 4 | (1 + nsegs);
desc->nsegs = WPI_PAD32(totlen + pad) << 4 | (1 + nsegs);
/* First DMA segment is used by the TX command. */
desc->segs[0].addr = htole32(data->cmd_paddr);
desc->segs[0].len = htole32(4 + buf->size + hdrspace);
desc->segs[0].len = htole32(4 + buf->size + hdrlen + pad);
/* Other DMA segments are for data payload. */
seg = &segs[0];
for (i = 1; i <= nsegs; i++) {
@ -2345,10 +2347,9 @@ wpi_tx_data(struct wpi_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
uint32_t flags;
uint16_t qos;
uint8_t tid, type;
int ac, error, rate, ismcast, hdrlen, totlen;
int ac, error, rate, ismcast, totlen;
wh = mtod(m, struct ieee80211_frame *);
hdrlen = ieee80211_anyhdrsize(wh);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
@ -2392,12 +2393,12 @@ wpi_tx_data(struct wpi_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
/* 802.11 header may have moved. */
wh = mtod(m, struct ieee80211_frame *);
}
totlen = m->m_pkthdr.len - (hdrlen & 3);
totlen = m->m_pkthdr.len;
if (ieee80211_radiotap_active_vap(vap)) {
struct wpi_tx_radiotap_header *tap = &sc->sc_txtap;
tap->wt_flags = IEEE80211_RADIOTAP_F_DATAPAD;
tap->wt_flags = 0;
tap->wt_rate = rate;
if (k != NULL)
tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP;
@ -2514,12 +2515,11 @@ wpi_tx_data_raw(struct wpi_softc *sc, struct mbuf *m, struct ieee80211_node *ni,
struct wpi_buf tx_data;
uint32_t flags;
uint8_t type;
int ac, rate, hdrlen, totlen;
int ac, rate, totlen;
wh = mtod(m, struct ieee80211_frame *);
hdrlen = ieee80211_anyhdrsize(wh);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
totlen = m->m_pkthdr.len - (hdrlen & 3);
totlen = m->m_pkthdr.len;
ac = params->ibp_pri & 3;
@ -2541,8 +2541,6 @@ wpi_tx_data_raw(struct wpi_softc *sc, struct mbuf *m, struct ieee80211_node *ni,
tap->wt_flags = 0;
tap->wt_rate = rate;
if (params->ibp_flags & IEEE80211_BPF_DATAPAD)
tap->wt_flags |= IEEE80211_RADIOTAP_F_DATAPAD;
ieee80211_radiotap_tx(vap, m);
}