Deleted Added
full compact
ieee80211.c (302408) ieee80211.c (337950)
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: stable/11/sys/net80211/ieee80211.c 300232 2016-05-19 21:08:33Z avos $");
28__FBSDID("$FreeBSD: stable/11/sys/net80211/ieee80211.c 337950 2018-08-17 03:03:27Z kevans $");
29
30/*
31 * IEEE 802.11 generic handler
32 */
33#include "opt_wlan.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>

--- 205 unchanged lines hidden (view full) ---

242null_update_chw(struct ieee80211com *ic)
243{
244
245 ic_printf(ic, "%s: need callback\n", __func__);
246}
247
248int
249ic_printf(struct ieee80211com *ic, const char * fmt, ...)
29
30/*
31 * IEEE 802.11 generic handler
32 */
33#include "opt_wlan.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>

--- 205 unchanged lines hidden (view full) ---

242null_update_chw(struct ieee80211com *ic)
243{
244
245 ic_printf(ic, "%s: need callback\n", __func__);
246}
247
248int
249ic_printf(struct ieee80211com *ic, const char * fmt, ...)
250{
250{
251 va_list ap;
252 int retval;
253
254 retval = printf("%s: ", ic->ic_name);
255 va_start(ap, fmt);
256 retval += vprintf(fmt, ap);
251 va_list ap;
252 int retval;
253
254 retval = printf("%s: ", ic->ic_name);
255 va_start(ap, fmt);
256 retval += vprintf(fmt, ap);
257 va_end(ap);
257 va_end(ap);
258 return (retval);
259}
260
261static LIST_HEAD(, ieee80211com) ic_head = LIST_HEAD_INITIALIZER(ic_head);
262static struct mtx ic_list_mtx;
263MTX_SYSINIT(ic_list, &ic_list_mtx, "ieee80211com list", MTX_DEF);
264
265static int

--- 85 unchanged lines hidden (view full) ---

351 * device state going away. Note we may call back into
352 * driver; it must be prepared for this.
353 */
354void
355ieee80211_ifdetach(struct ieee80211com *ic)
356{
357 struct ieee80211vap *vap;
358
258 return (retval);
259}
260
261static LIST_HEAD(, ieee80211com) ic_head = LIST_HEAD_INITIALIZER(ic_head);
262static struct mtx ic_list_mtx;
263MTX_SYSINIT(ic_list, &ic_list_mtx, "ieee80211com list", MTX_DEF);
264
265static int

--- 85 unchanged lines hidden (view full) ---

351 * device state going away. Note we may call back into
352 * driver; it must be prepared for this.
353 */
354void
355ieee80211_ifdetach(struct ieee80211com *ic)
356{
357 struct ieee80211vap *vap;
358
359 /*
360 * We use this as an indicator that ifattach never had a chance to be
361 * called, e.g. early driver attach failed and ifdetach was called
362 * during subsequent detach. Never fear, for we have nothing to do
363 * here.
364 */
365 if (ic->ic_tq == NULL)
366 return;
367
359 mtx_lock(&ic_list_mtx);
360 LIST_REMOVE(ic, ic_next);
361 mtx_unlock(&ic_list_mtx);
362
363 taskqueue_drain(taskqueue_thread, &ic->ic_restart_task);
364
365 /*
366 * The VAP is responsible for setting and clearing

--- 263 unchanged lines hidden (view full) ---

630 ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
631 ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
632 ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
633 IEEE80211_UNLOCK(ic);
634
635 return 1;
636}
637
368 mtx_lock(&ic_list_mtx);
369 LIST_REMOVE(ic, ic_next);
370 mtx_unlock(&ic_list_mtx);
371
372 taskqueue_drain(taskqueue_thread, &ic->ic_restart_task);
373
374 /*
375 * The VAP is responsible for setting and clearing

--- 263 unchanged lines hidden (view full) ---

639 ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
640 ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
641 ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
642 IEEE80211_UNLOCK(ic);
643
644 return 1;
645}
646
638/*
647/*
639 * Tear down vap state and reclaim the ifnet.
640 * The driver is assumed to have prepared for
641 * this; e.g. by turning off interrupts for the
642 * underlying device.
643 */
644void
645ieee80211_vap_detach(struct ieee80211vap *vap)
646{

--- 704 unchanged lines hidden (view full) ---

1351}
1352
1353static void
1354addmedia(struct ifmedia *media, int caps, int addsta, int mode, int mword)
1355{
1356#define ADD(_ic, _s, _o) \
1357 ifmedia_add(media, \
1358 IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL)
648 * Tear down vap state and reclaim the ifnet.
649 * The driver is assumed to have prepared for
650 * this; e.g. by turning off interrupts for the
651 * underlying device.
652 */
653void
654ieee80211_vap_detach(struct ieee80211vap *vap)
655{

--- 704 unchanged lines hidden (view full) ---

1360}
1361
1362static void
1363addmedia(struct ifmedia *media, int caps, int addsta, int mode, int mword)
1364{
1365#define ADD(_ic, _s, _o) \
1366 ifmedia_add(media, \
1367 IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL)
1359 static const u_int mopts[IEEE80211_MODE_MAX] = {
1368 static const u_int mopts[IEEE80211_MODE_MAX] = {
1360 [IEEE80211_MODE_AUTO] = IFM_AUTO,
1361 [IEEE80211_MODE_11A] = IFM_IEEE80211_11A,
1362 [IEEE80211_MODE_11B] = IFM_IEEE80211_11B,
1363 [IEEE80211_MODE_11G] = IFM_IEEE80211_11G,
1364 [IEEE80211_MODE_FH] = IFM_IEEE80211_FH,
1365 [IEEE80211_MODE_TURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO,
1366 [IEEE80211_MODE_TURBO_G] = IFM_IEEE80211_11G|IFM_IEEE80211_TURBO,
1367 [IEEE80211_MODE_STURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO,

--- 581 unchanged lines hidden (view full) ---

1949 rate &= IEEE80211_RATE_VAL;
1950 switch (mode) {
1951 case IEEE80211_MODE_11A:
1952 case IEEE80211_MODE_HALF: /* XXX good 'nuf */
1953 case IEEE80211_MODE_QUARTER:
1954 case IEEE80211_MODE_11NA:
1955 case IEEE80211_MODE_TURBO_A:
1956 case IEEE80211_MODE_STURBO_A:
1369 [IEEE80211_MODE_AUTO] = IFM_AUTO,
1370 [IEEE80211_MODE_11A] = IFM_IEEE80211_11A,
1371 [IEEE80211_MODE_11B] = IFM_IEEE80211_11B,
1372 [IEEE80211_MODE_11G] = IFM_IEEE80211_11G,
1373 [IEEE80211_MODE_FH] = IFM_IEEE80211_FH,
1374 [IEEE80211_MODE_TURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO,
1375 [IEEE80211_MODE_TURBO_G] = IFM_IEEE80211_11G|IFM_IEEE80211_TURBO,
1376 [IEEE80211_MODE_STURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO,

--- 581 unchanged lines hidden (view full) ---

1958 rate &= IEEE80211_RATE_VAL;
1959 switch (mode) {
1960 case IEEE80211_MODE_11A:
1961 case IEEE80211_MODE_HALF: /* XXX good 'nuf */
1962 case IEEE80211_MODE_QUARTER:
1963 case IEEE80211_MODE_11NA:
1964 case IEEE80211_MODE_TURBO_A:
1965 case IEEE80211_MODE_STURBO_A:
1957 return findmedia(rates, nitems(rates),
1966 return findmedia(rates, nitems(rates),
1958 rate | IFM_IEEE80211_11A);
1959 case IEEE80211_MODE_11B:
1967 rate | IFM_IEEE80211_11A);
1968 case IEEE80211_MODE_11B:
1960 return findmedia(rates, nitems(rates),
1969 return findmedia(rates, nitems(rates),
1961 rate | IFM_IEEE80211_11B);
1962 case IEEE80211_MODE_FH:
1970 rate | IFM_IEEE80211_11B);
1971 case IEEE80211_MODE_FH:
1963 return findmedia(rates, nitems(rates),
1972 return findmedia(rates, nitems(rates),
1964 rate | IFM_IEEE80211_FH);
1965 case IEEE80211_MODE_AUTO:
1966 /* NB: ic may be NULL for some drivers */
1967 if (ic != NULL && ic->ic_phytype == IEEE80211_T_FH)
1968 return findmedia(rates, nitems(rates),
1969 rate | IFM_IEEE80211_FH);
1970 /* NB: hack, 11g matches both 11b+11a rates */
1971 /* fall thru... */

--- 97 unchanged lines hidden ---
1973 rate | IFM_IEEE80211_FH);
1974 case IEEE80211_MODE_AUTO:
1975 /* NB: ic may be NULL for some drivers */
1976 if (ic != NULL && ic->ic_phytype == IEEE80211_T_FH)
1977 return findmedia(rates, nitems(rates),
1978 rate | IFM_IEEE80211_FH);
1979 /* NB: hack, 11g matches both 11b+11a rates */
1980 /* fall thru... */

--- 97 unchanged lines hidden ---