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

Collapse All | Expand All

(-)sys/dev/wpi/if_wpi.c (-9 / +13 lines)
Lines 617-624 Link Here
617
	vap = &wvp->wv_vap;
617
	vap = &wvp->wv_vap;
618
	ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac);
618
	ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac);
619
619
620
	if (opmode == IEEE80211_M_IBSS)
620
	if (opmode == IEEE80211_M_IBSS) {
621
		WPI_VAP_LOCK_INIT(wvp);
621
		wpi_init_beacon(wvp);
622
		wpi_init_beacon(wvp);
623
	}
622
624
623
	/* Override with driver methods. */
625
	/* Override with driver methods. */
624
	vap->iv_key_alloc = wpi_key_alloc;
626
	vap->iv_key_alloc = wpi_key_alloc;
Lines 649-654 Link Here
649
	if (opmode == IEEE80211_M_IBSS) {
651
	if (opmode == IEEE80211_M_IBSS) {
650
		if (bcn->m != NULL)
652
		if (bcn->m != NULL)
651
			m_freem(bcn->m);
653
			m_freem(bcn->m);
654
655
		WPI_VAP_LOCK_DESTROY(wvp);
652
	}
656
	}
653
657
654
	free(wvp, M_80211_VAP);
658
	free(wvp, M_80211_VAP);
Lines 2340-2347 Link Here
2340
	bus_dma_segment_t *seg, segs[WPI_MAX_SCATTER];
2344
	bus_dma_segment_t *seg, segs[WPI_MAX_SCATTER];
2341
	int error, i, hdrlen, nsegs, totlen, pad;
2345
	int error, i, hdrlen, nsegs, totlen, pad;
2342
2346
2343
	WPI_LOCK_ASSERT(sc);
2344
2345
	WPI_TXQ_LOCK(sc);
2347
	WPI_TXQ_LOCK(sc);
2346
2348
2347
	KASSERT(buf->size <= sizeof(buf->data), ("buffer overflow"));
2349
	KASSERT(buf->size <= sizeof(buf->data), ("buffer overflow"));
Lines 3967-3973 Link Here
3967
3969
3968
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__);
3970
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__);
3969
3971
3970
	WPI_LOCK_ASSERT(sc);
3972
	WPI_VAP_LOCK_ASSERT(wvp);
3971
3973
3972
	cmd->len = htole16(bcn->m->m_pkthdr.len);
3974
	cmd->len = htole16(bcn->m->m_pkthdr.len);
3973
	cmd->plcp = (ic->ic_curmode == IEEE80211_MODE_11A) ?
3975
	cmd->plcp = (ic->ic_curmode == IEEE80211_MODE_11A) ?
Lines 4025-4030 Link Here
4025
		return ENOMEM;
4027
		return ENOMEM;
4026
	}
4028
	}
4027
4029
4030
	WPI_VAP_LOCK(wvp);
4028
	if (bcn->m != NULL)
4031
	if (bcn->m != NULL)
4029
		m_freem(bcn->m);
4032
		m_freem(bcn->m);
4030
4033
Lines 4031-4036 Link Here
4031
	bcn->m = m;
4034
	bcn->m = m;
4032
4035
4033
	error = wpi_config_beacon(wvp);
4036
	error = wpi_config_beacon(wvp);
4037
	WPI_VAP_UNLOCK(wvp);
4034
4038
4035
	return error;
4039
	return error;
4036
}
4040
}
Lines 4047-4067 Link Here
4047
4051
4048
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
4052
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
4049
4053
4050
	WPI_LOCK(sc);
4054
	WPI_VAP_LOCK(wvp);
4051
	if (bcn->m == NULL) {
4055
	if (bcn->m == NULL) {
4052
		bcn->m = ieee80211_beacon_alloc(ni, bo);
4056
		bcn->m = ieee80211_beacon_alloc(ni, bo);
4053
		if (bcn->m == NULL) {
4057
		if (bcn->m == NULL) {
4054
			device_printf(sc->sc_dev,
4058
			device_printf(sc->sc_dev,
4055
			    "%s: could not allocate beacon frame\n", __func__);
4059
			    "%s: could not allocate beacon frame\n", __func__);
4056
			WPI_UNLOCK(sc);
4057
4060
4058
			DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR,
4061
			DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR,
4059
			    __func__);
4062
			    __func__);
4060
4063
4064
			WPI_VAP_UNLOCK(wvp);
4061
			return;
4065
			return;
4062
		}
4066
		}
4063
	}
4067
	}
4064
	WPI_UNLOCK(sc);
4068
	WPI_VAP_UNLOCK(wvp);
4065
4069
4066
	if (item == IEEE80211_BEACON_TIM)
4070
	if (item == IEEE80211_BEACON_TIM)
4067
		mcast = 1;	/* TODO */
4071
		mcast = 1;	/* TODO */
Lines 4069-4077 Link Here
4069
	setbit(bo->bo_flags, item);
4073
	setbit(bo->bo_flags, item);
4070
	ieee80211_beacon_update(ni, bo, bcn->m, mcast);
4074
	ieee80211_beacon_update(ni, bo, bcn->m, mcast);
4071
4075
4072
	WPI_LOCK(sc);
4076
	WPI_VAP_LOCK(wvp);
4073
	wpi_config_beacon(wvp);
4077
	wpi_config_beacon(wvp);
4074
	WPI_UNLOCK(sc);
4078
	WPI_VAP_UNLOCK(wvp);
4075
4079
4076
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
4080
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
4077
}
4081
}
(-)sys/dev/wpi/if_wpivar.h (-1 / +10 lines)
Lines 125-130 Link Here
125
125
126
	struct wpi_buf			wv_bcbuf;
126
	struct wpi_buf			wv_bcbuf;
127
	struct ieee80211_beacon_offsets	wv_boff;
127
	struct ieee80211_beacon_offsets	wv_boff;
128
	struct mtx			wv_mtx;
128
129
129
	int				(*wv_newstate)(struct ieee80211vap *,
130
	int				(*wv_newstate)(struct ieee80211vap *,
130
					    enum ieee80211_state, int);
131
					    enum ieee80211_state, int);
Lines 131-136 Link Here
131
};
132
};
132
#define	WPI_VAP(vap)	((struct wpi_vap *)(vap))
133
#define	WPI_VAP(vap)	((struct wpi_vap *)(vap))
133
134
135
#define WPI_VAP_LOCK_INIT(_wvp)	\
136
	mtx_init(&(_wvp)->wv_mtx, "lock for wv_bcbuf/wv_boff structures", \
137
	    NULL, MTX_DEF)
138
#define WPI_VAP_LOCK(_wvp)		mtx_lock(&(_wvp)->wv_mtx)
139
#define WPI_VAP_UNLOCK(_wvp)		mtx_unlock(&(_wvp)->wv_mtx)
140
#define WPI_VAP_LOCK_ASSERT(_wvp)	mtx_assert(&(_wvp)->wv_mtx, MA_OWNED)
141
#define WPI_VAP_LOCK_DESTROY(_wvp)	mtx_destroy(&(_wvp)->wv_mtx)
142
134
struct wpi_fw_part {
143
struct wpi_fw_part {
135
	const uint8_t	*text;
144
	const uint8_t	*text;
136
	uint32_t	textsz;
145
	uint32_t	textsz;
Lines 224-230 Link Here
224
	char			domain[4];	/* Regulatory domain. */
233
	char			domain[4];	/* Regulatory domain. */
225
};
234
};
226
235
227
/* WPI_LOCK > WPI_NT_LOCK > WPI_TXQ_LOCK */
236
/* WPI_LOCK > WPI_NT_LOCK / WPI_VAP_LOCK > WPI_TXQ_LOCK */
228
237
229
#define WPI_LOCK_INIT(_sc) \
238
#define WPI_LOCK_INIT(_sc) \
230
	mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
239
	mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \

Return to bug 197143