View | Details | Raw Unified | Return to bug 197143 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/wpi/if_wpi.c (-19 / +17 lines)
Lines 447-454 Link Here
447
	ic->ic_cryptocaps =
447
	ic->ic_cryptocaps =
448
		  IEEE80211_CRYPTO_AES_CCM;
448
		  IEEE80211_CRYPTO_AES_CCM;
449
449
450
	ic->ic_flags |= IEEE80211_F_DATAPAD;
451
452
	/*
450
	/*
453
	 * Read in the eeprom and also setup the channels for
451
	 * Read in the eeprom and also setup the channels for
454
	 * net80211. We don't set the rates as net80211 does this for us
452
	 * net80211. We don't set the rates as net80211 does this for us
Lines 2224-2231 Link Here
2224
static int
2222
static int
2225
wpi_cmd2(struct wpi_softc *sc, struct wpi_buf *buf)
2223
wpi_cmd2(struct wpi_softc *sc, struct wpi_buf *buf)
2226
{
2224
{
2227
	struct ifnet *ifp = sc->sc_ifp;
2228
	struct ieee80211com *ic = ifp->if_l2com;
2229
	struct ieee80211_frame *wh;
2225
	struct ieee80211_frame *wh;
2230
	struct wpi_tx_cmd *cmd;
2226
	struct wpi_tx_cmd *cmd;
2231
	struct wpi_tx_data *data;
2227
	struct wpi_tx_data *data;
Lines 2233-2239 Link Here
2233
	struct wpi_tx_ring *ring;
2229
	struct wpi_tx_ring *ring;
2234
	struct mbuf *m1;
2230
	struct mbuf *m1;
2235
	bus_dma_segment_t *seg, segs[WPI_MAX_SCATTER];
2231
	bus_dma_segment_t *seg, segs[WPI_MAX_SCATTER];
2236
	int error, i, hdrspace, nsegs, totlen;
2232
	int error, i, hdrlen, nsegs, totlen, pad;
2237
2233
2238
	WPI_LOCK_ASSERT(sc);
2234
	WPI_LOCK_ASSERT(sc);
2239
2235
Lines 2240-2248 Link Here
2240
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
2236
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
2241
2237
2242
	wh = mtod(buf->m, struct ieee80211_frame *);
2238
	wh = mtod(buf->m, struct ieee80211_frame *);
2243
	hdrspace = ieee80211_anyhdrspace(ic, wh);
2239
	hdrlen = ieee80211_anyhdrsize(wh);
2244
	totlen = buf->m->m_pkthdr.len;
2240
	totlen = buf->m->m_pkthdr.len;
2245
2241
2242
	if (hdrlen & 3) {
2243
		/* First segment length must be a multiple of 4. */
2244
		pad = 4 - (hdrlen & 3);
2245
	} else
2246
		pad = 0;
2247
2246
	ring = &sc->txq[buf->ac];
2248
	ring = &sc->txq[buf->ac];
2247
	desc = &ring->desc[ring->cur];
2249
	desc = &ring->desc[ring->cur];
2248
	data = &ring->data[ring->cur];
2250
	data = &ring->data[ring->cur];
Lines 2257-2264 Link Here
2257
	memcpy(cmd->data, buf->data, buf->size);
2259
	memcpy(cmd->data, buf->data, buf->size);
2258
2260
2259
	/* Save and trim IEEE802.11 header. */
2261
	/* Save and trim IEEE802.11 header. */
2260
	memcpy((uint8_t *)(cmd->data + buf->size), wh, hdrspace);
2262
	memcpy((uint8_t *)(cmd->data + buf->size), wh, hdrlen);
2261
	m_adj(buf->m, hdrspace);
2263
	m_adj(buf->m, hdrlen);
2262
2264
2263
	error = bus_dmamap_load_mbuf_sg(ring->data_dmat, data->map, buf->m,
2265
	error = bus_dmamap_load_mbuf_sg(ring->data_dmat, data->map, buf->m,
2264
	    segs, &nsegs, BUS_DMA_NOWAIT);
2266
	    segs, &nsegs, BUS_DMA_NOWAIT);
Lines 2296-2305 Link Here
2296
	    __func__, ring->qid, ring->cur, totlen, nsegs);
2298
	    __func__, ring->qid, ring->cur, totlen, nsegs);
2297
2299
2298
	/* Fill TX descriptor. */
2300
	/* Fill TX descriptor. */
2299
	desc->nsegs = WPI_PAD32(totlen) << 4 | (1 + nsegs);
2301
	desc->nsegs = WPI_PAD32(totlen + pad) << 4 | (1 + nsegs);
2300
	/* First DMA segment is used by the TX command. */
2302
	/* First DMA segment is used by the TX command. */
2301
	desc->segs[0].addr = htole32(data->cmd_paddr);
2303
	desc->segs[0].addr = htole32(data->cmd_paddr);
2302
	desc->segs[0].len  = htole32(4 + buf->size + hdrspace);
2304
	desc->segs[0].len  = htole32(4 + buf->size + hdrlen + pad);
2303
	/* Other DMA segments are for data payload. */
2305
	/* Other DMA segments are for data payload. */
2304
	seg = &segs[0];
2306
	seg = &segs[0];
2305
	for (i = 1; i <= nsegs; i++) {
2307
	for (i = 1; i <= nsegs; i++) {
Lines 2345-2354 Link Here
2345
	uint32_t flags;
2347
	uint32_t flags;
2346
	uint16_t qos;
2348
	uint16_t qos;
2347
	uint8_t tid, type;
2349
	uint8_t tid, type;
2348
	int ac, error, rate, ismcast, hdrlen, totlen;
2350
	int ac, error, rate, ismcast, totlen;
2349
2351
2350
	wh = mtod(m, struct ieee80211_frame *);
2352
	wh = mtod(m, struct ieee80211_frame *);
2351
	hdrlen = ieee80211_anyhdrsize(wh);
2352
	type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
2353
	type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
2353
	ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
2354
	ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
2354
2355
Lines 2392-2403 Link Here
2392
		/* 802.11 header may have moved. */
2393
		/* 802.11 header may have moved. */
2393
		wh = mtod(m, struct ieee80211_frame *);
2394
		wh = mtod(m, struct ieee80211_frame *);
2394
	}
2395
	}
2395
	totlen = m->m_pkthdr.len - (hdrlen & 3);
2396
	totlen = m->m_pkthdr.len;
2396
2397
2397
	if (ieee80211_radiotap_active_vap(vap)) {
2398
	if (ieee80211_radiotap_active_vap(vap)) {
2398
		struct wpi_tx_radiotap_header *tap = &sc->sc_txtap;
2399
		struct wpi_tx_radiotap_header *tap = &sc->sc_txtap;
2399
2400
2400
		tap->wt_flags = IEEE80211_RADIOTAP_F_DATAPAD;
2401
		tap->wt_flags = 0;
2401
		tap->wt_rate = rate;
2402
		tap->wt_rate = rate;
2402
		if (k != NULL)
2403
		if (k != NULL)
2403
			tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP;
2404
			tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP;
Lines 2514-2525 Link Here
2514
	struct wpi_buf tx_data;
2515
	struct wpi_buf tx_data;
2515
	uint32_t flags;
2516
	uint32_t flags;
2516
	uint8_t type;
2517
	uint8_t type;
2517
	int ac, rate, hdrlen, totlen;
2518
	int ac, rate, totlen;
2518
2519
2519
	wh = mtod(m, struct ieee80211_frame *);
2520
	wh = mtod(m, struct ieee80211_frame *);
2520
	hdrlen = ieee80211_anyhdrsize(wh);
2521
	type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
2521
	type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
2522
	totlen = m->m_pkthdr.len - (hdrlen & 3);
2522
	totlen = m->m_pkthdr.len;
2523
2523
2524
	ac = params->ibp_pri & 3;
2524
	ac = params->ibp_pri & 3;
2525
2525
Lines 2541-2548 Link Here
2541
2541
2542
		tap->wt_flags = 0;
2542
		tap->wt_flags = 0;
2543
		tap->wt_rate = rate;
2543
		tap->wt_rate = rate;
2544
		if (params->ibp_flags & IEEE80211_BPF_DATAPAD)
2545
			tap->wt_flags |= IEEE80211_RADIOTAP_F_DATAPAD;
2546
2544
2547
		ieee80211_radiotap_tx(vap, m);
2545
		ieee80211_radiotap_tx(vap, m);
2548
	}
2546
	}

Return to bug 197143