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

Collapse All | Expand All

(-)sys/dev/wpi/if_wpi.c (-67 / +44 lines)
Lines 586-592 Link Here
586
    const uint8_t mac[IEEE80211_ADDR_LEN])
586
    const uint8_t mac[IEEE80211_ADDR_LEN])
587
{
587
{
588
	struct wpi_vap *wvp;
588
	struct wpi_vap *wvp;
589
	struct wpi_buf *bcn;
590
	struct ieee80211vap *vap;
589
	struct ieee80211vap *vap;
591
590
592
	if (!TAILQ_EMPTY(&ic->ic_vaps))		/* only one at a time */
591
	if (!TAILQ_EMPTY(&ic->ic_vaps))		/* only one at a time */
Lines 599-607 Link Here
599
	vap = &wvp->vap;
598
	vap = &wvp->vap;
600
	ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac);
599
	ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac);
601
600
602
	bcn = &wvp->wv_bcbuf;
603
	bcn->data = NULL;
604
605
	/* Override with driver methods. */
601
	/* Override with driver methods. */
606
	wvp->newstate = vap->iv_newstate;
602
	wvp->newstate = vap->iv_newstate;
607
	vap->iv_key_alloc = wpi_key_alloc;
603
	vap->iv_key_alloc = wpi_key_alloc;
Lines 622-634 Link Here
622
wpi_vap_delete(struct ieee80211vap *vap)
618
wpi_vap_delete(struct ieee80211vap *vap)
623
{
619
{
624
	struct wpi_vap *wvp = WPI_VAP(vap);
620
	struct wpi_vap *wvp = WPI_VAP(vap);
625
	struct wpi_buf *bcn = &wvp->wv_bcbuf;
626
621
627
	ieee80211_ratectl_deinit(vap);
622
	ieee80211_ratectl_deinit(vap);
628
	ieee80211_vap_detach(vap);
623
	ieee80211_vap_detach(vap);
629
624
630
	if (bcn->data != NULL)
631
		free(bcn->data, M_DEVBUF);
632
	free(wvp, M_80211_VAP);
625
	free(wvp, M_80211_VAP);
633
}
626
}
634
627
Lines 2322-2327 Link Here
2322
2315
2323
	WPI_TXQ_LOCK(sc);
2316
	WPI_TXQ_LOCK(sc);
2324
2317
2318
	KASSERT(buf->size <= sizeof(buf->data), ("buffer overflow"));
2319
2325
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
2320
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
2326
2321
2327
	if (sc->txq_active == 0) {
2322
	if (sc->txq_active == 0) {
Lines 2454-2461 Link Here
2454
	struct ieee80211_channel *chan;
2449
	struct ieee80211_channel *chan;
2455
	struct ieee80211_frame *wh;
2450
	struct ieee80211_frame *wh;
2456
	struct ieee80211_key *k = NULL;
2451
	struct ieee80211_key *k = NULL;
2457
	struct wpi_cmd_data tx;
2458
	struct wpi_buf tx_data;
2452
	struct wpi_buf tx_data;
2453
	struct wpi_cmd_data *tx = (struct wpi_cmd_data *)&tx_data.data;
2459
	uint32_t flags;
2454
	uint32_t flags;
2460
	uint16_t qos;
2455
	uint16_t qos;
2461
	uint8_t tid, type;
2456
	uint8_t tid, type;
Lines 2548-2554 Link Here
2548
			flags |= WPI_TX_FULL_TXOP;
2543
			flags |= WPI_TX_FULL_TXOP;
2549
	}
2544
	}
2550
2545
2551
	memset(&tx, 0, sizeof (struct wpi_cmd_data));
2546
	memset(tx, 0, sizeof (struct wpi_cmd_data));
2552
	if (type == IEEE80211_FC0_TYPE_MGT) {
2547
	if (type == IEEE80211_FC0_TYPE_MGT) {
2553
		uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
2548
		uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
2554
2549
Lines 2557-2569 Link Here
2557
			flags |= WPI_TX_INSERT_TSTAMP;
2552
			flags |= WPI_TX_INSERT_TSTAMP;
2558
		if (subtype == IEEE80211_FC0_SUBTYPE_ASSOC_REQ ||
2553
		if (subtype == IEEE80211_FC0_SUBTYPE_ASSOC_REQ ||
2559
		    subtype == IEEE80211_FC0_SUBTYPE_REASSOC_REQ)
2554
		    subtype == IEEE80211_FC0_SUBTYPE_REASSOC_REQ)
2560
			tx.timeout = htole16(3);
2555
			tx->timeout = htole16(3);
2561
		else
2556
		else
2562
			tx.timeout = htole16(2);
2557
			tx->timeout = htole16(2);
2563
	}
2558
	}
2564
2559
2565
	if (ismcast || type != IEEE80211_FC0_TYPE_DATA)
2560
	if (ismcast || type != IEEE80211_FC0_TYPE_DATA)
2566
		tx.id = WPI_ID_BROADCAST;
2561
		tx->id = WPI_ID_BROADCAST;
2567
	else {
2562
	else {
2568
		if (wn->id == WPI_ID_UNDEFINED) {
2563
		if (wn->id == WPI_ID_UNDEFINED) {
2569
			device_printf(sc->sc_dev,
2564
			device_printf(sc->sc_dev,
Lines 2572-2587 Link Here
2572
			goto fail;
2567
			goto fail;
2573
		}
2568
		}
2574
2569
2575
		tx.id = wn->id;
2570
		tx->id = wn->id;
2576
	}
2571
	}
2577
2572
2578
	if (type != IEEE80211_FC0_TYPE_MGT)
2573
	if (type != IEEE80211_FC0_TYPE_MGT)
2579
		tx.data_ntries = tp->maxretry;
2574
		tx->data_ntries = tp->maxretry;
2580
2575
2581
	if (k != NULL && !swcrypt) {
2576
	if (k != NULL && !swcrypt) {
2582
		switch (k->wk_cipher->ic_cipher) {
2577
		switch (k->wk_cipher->ic_cipher) {
2583
		case IEEE80211_CIPHER_AES_CCM:
2578
		case IEEE80211_CIPHER_AES_CCM:
2584
			tx.security = WPI_CIPHER_CCMP;
2579
			tx->security = WPI_CIPHER_CCMP;
2585
			break;
2580
			break;
2586
2581
2587
		default:
2582
		default:
Lines 2588-2609 Link Here
2588
			break;
2583
			break;
2589
		}
2584
		}
2590
2585
2591
		memcpy(tx.key, k->wk_key, k->wk_keylen);
2586
		memcpy(tx->key, k->wk_key, k->wk_keylen);
2592
	}
2587
	}
2593
2588
2594
	tx.len = htole16(totlen);
2589
	tx->len = htole16(totlen);
2595
	tx.flags = htole32(flags);
2590
	tx->flags = htole32(flags);
2596
	tx.plcp = rate2plcp(rate);
2591
	tx->plcp = rate2plcp(rate);
2597
	tx.tid = tid;
2592
	tx->tid = tid;
2598
	tx.lifetime = htole32(WPI_LIFETIME_INFINITE);
2593
	tx->lifetime = htole32(WPI_LIFETIME_INFINITE);
2599
	tx.ofdm_mask = 0xff;
2594
	tx->ofdm_mask = 0xff;
2600
	tx.cck_mask = 0x0f;
2595
	tx->cck_mask = 0x0f;
2601
	tx.rts_ntries = 7;
2596
	tx->rts_ntries = 7;
2602
2597
2603
	tx_data.data = &tx;
2604
	tx_data.ni = ni;
2598
	tx_data.ni = ni;
2605
	tx_data.m = m;
2599
	tx_data.m = m;
2606
	tx_data.size = sizeof(tx);
2600
	tx_data.size = sizeof(struct wpi_cmd_data);
2607
	tx_data.code = WPI_CMD_TX_DATA;
2601
	tx_data.code = WPI_CMD_TX_DATA;
2608
	tx_data.ac = ac;
2602
	tx_data.ac = ac;
2609
2603
Lines 2619-2626 Link Here
2619
{
2613
{
2620
	struct ieee80211vap *vap = ni->ni_vap;
2614
	struct ieee80211vap *vap = ni->ni_vap;
2621
	struct ieee80211_frame *wh;
2615
	struct ieee80211_frame *wh;
2622
	struct wpi_cmd_data tx;
2623
	struct wpi_buf tx_data;
2616
	struct wpi_buf tx_data;
2617
	struct wpi_cmd_data *tx = (struct wpi_cmd_data *)&tx_data.data;
2624
	uint32_t flags;
2618
	uint32_t flags;
2625
	uint8_t type;
2619
	uint8_t type;
2626
	int ac, rate, totlen;
2620
	int ac, rate, totlen;
Lines 2653-2659 Link Here
2653
		ieee80211_radiotap_tx(vap, m);
2647
		ieee80211_radiotap_tx(vap, m);
2654
	}
2648
	}
2655
2649
2656
	memset(&tx, 0, sizeof (struct wpi_cmd_data));
2650
	memset(tx, 0, sizeof (struct wpi_cmd_data));
2657
	if (type == IEEE80211_FC0_TYPE_MGT) {
2651
	if (type == IEEE80211_FC0_TYPE_MGT) {
2658
		uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
2652
		uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
2659
2653
Lines 2662-2684 Link Here
2662
			flags |= WPI_TX_INSERT_TSTAMP;
2656
			flags |= WPI_TX_INSERT_TSTAMP;
2663
		if (subtype == IEEE80211_FC0_SUBTYPE_ASSOC_REQ ||
2657
		if (subtype == IEEE80211_FC0_SUBTYPE_ASSOC_REQ ||
2664
		    subtype == IEEE80211_FC0_SUBTYPE_REASSOC_REQ)
2658
		    subtype == IEEE80211_FC0_SUBTYPE_REASSOC_REQ)
2665
			tx.timeout = htole16(3);
2659
			tx->timeout = htole16(3);
2666
		else
2660
		else
2667
			tx.timeout = htole16(2);
2661
			tx->timeout = htole16(2);
2668
	}
2662
	}
2669
2663
2670
	tx.len = htole16(totlen);
2664
	tx->len = htole16(totlen);
2671
	tx.flags = htole32(flags);
2665
	tx->flags = htole32(flags);
2672
	tx.plcp = rate2plcp(rate);
2666
	tx->plcp = rate2plcp(rate);
2673
	tx.id = WPI_ID_BROADCAST;
2667
	tx->id = WPI_ID_BROADCAST;
2674
	tx.lifetime = htole32(WPI_LIFETIME_INFINITE);
2668
	tx->lifetime = htole32(WPI_LIFETIME_INFINITE);
2675
	tx.rts_ntries = params->ibp_try1;
2669
	tx->rts_ntries = params->ibp_try1;
2676
	tx.data_ntries = params->ibp_try0;
2670
	tx->data_ntries = params->ibp_try0;
2677
2671
2678
	tx_data.data = &tx;
2679
	tx_data.ni = ni;
2672
	tx_data.ni = ni;
2680
	tx_data.m = m;
2673
	tx_data.m = m;
2681
	tx_data.size = sizeof(tx);
2674
	tx_data.size = sizeof(struct wpi_cmd_data);
2682
	tx_data.code = WPI_CMD_TX_DATA;
2675
	tx_data.code = WPI_CMD_TX_DATA;
2683
	tx_data.ac = ac;
2676
	tx_data.ac = ac;
2684
2677
Lines 3933-3945 Link Here
3933
static int
3926
static int
3934
wpi_setup_beacon(struct wpi_softc *sc, struct ieee80211_node *ni)
3927
wpi_setup_beacon(struct wpi_softc *sc, struct ieee80211_node *ni)
3935
{
3928
{
3936
	struct ifnet *ifp = sc->sc_ifp;
3929
	struct ieee80211com *ic = sc->sc_ifp->if_l2com;
3937
	struct ieee80211com *ic = ifp->if_l2com;
3930
	struct wpi_vap *wvp = WPI_VAP(ni->ni_vap);
3938
	struct ieee80211vap *vap = ni->ni_vap;
3939
	struct wpi_vap *wvp = WPI_VAP(vap);
3940
	struct wpi_buf *bcn = &wvp->wv_bcbuf;
3931
	struct wpi_buf *bcn = &wvp->wv_bcbuf;
3941
	struct ieee80211_beacon_offsets bo;
3932
	struct ieee80211_beacon_offsets bo;
3942
	struct wpi_cmd_beacon *cmd;
3933
	struct wpi_cmd_beacon *cmd = (struct wpi_cmd_beacon *)&bcn->data;
3943
	struct mbuf *m;
3934
	struct mbuf *m;
3944
	int totlen;
3935
	int totlen;
3945
3936
Lines 3956-3986 Link Here
3956
	}
3947
	}
3957
	totlen = m->m_pkthdr.len;
3948
	totlen = m->m_pkthdr.len;
3958
3949
3959
	if (bcn->data == NULL) {
3950
	cmd->id = WPI_ID_BROADCAST;
3960
		cmd = malloc(sizeof(struct wpi_cmd_beacon), M_DEVBUF,
3951
	cmd->ofdm_mask = 0xff;
3961
		    M_NOWAIT | M_ZERO);
3952
	cmd->cck_mask = 0x0f;
3953
	cmd->lifetime = htole32(WPI_LIFETIME_INFINITE);
3954
	cmd->flags = htole32(WPI_TX_AUTO_SEQ | WPI_TX_INSERT_TSTAMP);
3962
3955
3963
		if (cmd == NULL) {
3956
	bcn->ni = NULL;
3964
			device_printf(sc->sc_dev,
3957
	bcn->code = WPI_CMD_SET_BEACON;
3965
			    "could not allocate buffer for beacon command\n");
3958
	bcn->ac = 4;
3966
			m_freem(m);
3959
	bcn->size = sizeof(struct wpi_cmd_beacon);
3967
			return ENOMEM;
3968
		}
3969
3960
3970
		cmd->id = WPI_ID_BROADCAST;
3971
		cmd->ofdm_mask = 0xff;
3972
		cmd->cck_mask = 0x0f;
3973
		cmd->lifetime = htole32(WPI_LIFETIME_INFINITE);
3974
		cmd->flags = htole32(WPI_TX_AUTO_SEQ | WPI_TX_INSERT_TSTAMP);
3975
3976
		bcn->data = cmd;
3977
		bcn->ni = NULL;
3978
		bcn->code = WPI_CMD_SET_BEACON;
3979
		bcn->ac = 4;
3980
		bcn->size = sizeof(struct wpi_cmd_beacon);
3981
	} else
3982
		cmd = bcn->data;
3983
3984
	cmd->len = htole16(totlen);
3961
	cmd->len = htole16(totlen);
3985
	cmd->plcp = (ic->ic_curmode == IEEE80211_MODE_11A) ?
3962
	cmd->plcp = (ic->ic_curmode == IEEE80211_MODE_11A) ?
3986
	    wpi_ridx_to_plcp[WPI_RIDX_OFDM6] : wpi_ridx_to_plcp[WPI_RIDX_CCK1];
3963
	    wpi_ridx_to_plcp[WPI_RIDX_OFDM6] : wpi_ridx_to_plcp[WPI_RIDX_CCK1];
(-)sys/dev/wpi/if_wpivar.h (-1 / +1 lines)
Lines 112-118 Link Here
112
};
112
};
113
113
114
struct wpi_buf {
114
struct wpi_buf {
115
	void			*data;
115
	uint8_t			data[56];  /* sizeof(struct wpi_cmd_beacon) */
116
	struct ieee80211_node	*ni;
116
	struct ieee80211_node	*ni;
117
	struct mbuf		*m;
117
	struct mbuf		*m;
118
	size_t			size;
118
	size_t			size;

Return to bug 197143