Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/net80211 Adapt to NetBSD (make it compile).



details:   https://anonhg.NetBSD.org/src-all/rev/e4dce518360c
branches:  trunk
changeset: 366982:e4dce518360c
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Sun Jul 05 19:00:33 2020 +0200

description:
Adapt to NetBSD (make it compile).

Cleanup KASSERT/MPASS handling - fully convert to NetBSD KASSERTMSG
and KASSERT resp.

diffstat:

 sys/net80211/CHANGES                 |    6 +
 sys/net80211/ieee80211.c             |   39 +++-----
 sys/net80211/ieee80211_acl.c         |    7 +-
 sys/net80211/ieee80211_adhoc.c       |    7 +-
 sys/net80211/ieee80211_ageq.c        |   19 +--
 sys/net80211/ieee80211_amrr.c        |   11 +-
 sys/net80211/ieee80211_crypto.c      |    9 +-
 sys/net80211/ieee80211_crypto_ccmp.c |    7 +-
 sys/net80211/ieee80211_crypto_tkip.c |   27 ++---
 sys/net80211/ieee80211_crypto_wep.c  |    7 +-
 sys/net80211/ieee80211_ddb.c         |    3 +
 sys/net80211/ieee80211_hostap.c      |   15 +--
 sys/net80211/ieee80211_ht.c          |   57 +++++------
 sys/net80211/ieee80211_hwmp.c        |   41 +++-----
 sys/net80211/ieee80211_input.c       |   13 +-
 sys/net80211/ieee80211_ioctl.c       |   31 ++---
 sys/net80211/ieee80211_mesh.c        |   81 ++++++++---------
 sys/net80211/ieee80211_netbsd.c      |   55 ++++++++++-
 sys/net80211/ieee80211_netbsd.h      |  161 +++++++++++++++++++++++++++++++---
 sys/net80211/ieee80211_node.c        |   53 +++++------
 sys/net80211/ieee80211_output.c      |   71 +++++++--------
 sys/net80211/ieee80211_phy.c         |   19 +--
 sys/net80211/ieee80211_phy.h         |   89 ++----------------
 sys/net80211/ieee80211_power.c       |   39 +++----
 sys/net80211/ieee80211_proto.c       |   27 ++---
 sys/net80211/ieee80211_proto.h       |   13 +--
 sys/net80211/ieee80211_radiotap.c    |    6 +-
 sys/net80211/ieee80211_regdomain.c   |    7 +-
 sys/net80211/ieee80211_rssadapt.c    |   11 +-
 sys/net80211/ieee80211_scan.c        |    2 +-
 sys/net80211/ieee80211_scan_sta.c    |   60 +++++-------
 sys/net80211/ieee80211_scan_sw.c     |    9 +-
 sys/net80211/ieee80211_sta.c         |   21 +--
 sys/net80211/ieee80211_superg.c      |    5 -
 sys/net80211/ieee80211_tdma.c        |    5 -
 sys/net80211/ieee80211_var.h         |    2 +-
 sys/net80211/ieee80211_wds.c         |   19 +--
 37 files changed, 511 insertions(+), 543 deletions(-)

diffs (truncated from 2848 to 300 lines):

diff -r bb1561b2287c -r e4dce518360c sys/net80211/CHANGES
--- a/sys/net80211/CHANGES      Thu Jun 25 17:11:30 2020 +0200
+++ b/sys/net80211/CHANGES      Sun Jul 05 19:00:33 2020 +0200
@@ -1,5 +1,11 @@
 *** Changes in 2020 for WiFi refresh.
 
+2020-07-04 12:00 Martin
+
+Remove FBSDKASSERT, convert all calls to native (NetBSD) usage:
+ - MPASS -> KASSERT
+ - KASSERT(cond, (printf-args)) -> KASSERTMSG(cond, printf-args)
+
 2020-06-25 12:00 Martin
 
 Update to FreeBSD HEAD on 2020-06-21: highest rev 362210
diff -r bb1561b2287c -r e4dce518360c sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c  Thu Jun 25 17:11:30 2020 +0200
+++ b/sys/net80211/ieee80211.c  Sun Jul 05 19:00:33 2020 +0200
@@ -84,11 +84,6 @@
 
 #include <net/bpf.h>
 
-#ifdef __NetBSD__
-#undef  KASSERT
-#define KASSERT(__cond, __complaint) FBSDKASSERT(__cond, __complaint)
-#endif
-
 const char *ieee80211_phymode_name[IEEE80211_MODE_MAX] = {
        [IEEE80211_MODE_AUTO]     = "auto",
        [IEEE80211_MODE_11A]      = "11a",
@@ -169,14 +164,14 @@
        struct ieee80211_channel *c;
        int i;
 
-       KASSERT(0 < ic->ic_nchans && ic->ic_nchans <= IEEE80211_CHAN_MAX,
-               ("invalid number of channels specified: %u", ic->ic_nchans));
+       KASSERTMSG(0 < ic->ic_nchans && ic->ic_nchans <= IEEE80211_CHAN_MAX,
+               "invalid number of channels specified: %u", ic->ic_nchans);
        memset(ic->ic_chan_avail, 0, sizeof(ic->ic_chan_avail));
        memset(ic->ic_modecaps, 0, sizeof(ic->ic_modecaps));
        setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO);
        for (i = 0; i < ic->ic_nchans; i++) {
                c = &ic->ic_channels[i];
-               KASSERT(c->ic_flags != 0, ("channel with no flags"));
+               KASSERTMSG(c->ic_flags != 0, "channel with no flags");
                /*
                 * Help drivers that work only with frequencies by filling
                 * in IEEE channel #'s if not already calculated.  Note this
@@ -304,17 +299,15 @@
        ic_printf(ic, "%s: need callback\n", __func__);
 }
 
-int
+void
 ic_printf(struct ieee80211com *ic, const char * fmt, ...)
 {
        va_list ap;
-       int retval;
 
-       retval = printf("%s: ", ic->ic_name);
+       printf("%s: ", ic->ic_name);
        va_start(ap, fmt);
-       retval += vprintf(fmt, ap);
+       vprintf(fmt, ap);
        va_end(ap);
-       return (retval);
 }
 
 static LIST_HEAD(, ieee80211com) ic_head = LIST_HEAD_INITIALIZER(ic_head);
@@ -837,7 +830,7 @@
 #endif
 
        IEEE80211_LOCK(ic);
-       KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running"));
+       KASSERTMSG(vap->iv_state == IEEE80211_S_INIT , "vap still running");
        TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
        ieee80211_syncflag_locked(ic, IEEE80211_F_WME);
 #ifdef IEEE80211_SUPPORT_SUPERG
@@ -899,8 +892,8 @@
                if (++ic->ic_promisc == 1)
                        ieee80211_runtask(ic, &ic->ic_promisc_task);
        } else {
-               KASSERT(ic->ic_promisc > 0, ("%s: ic %p not promisc",
-                   __func__, ic));
+               KASSERTMSG(ic->ic_promisc > 0, "%s: ic %p not promisc",
+                   __func__, ic);
                if (--ic->ic_promisc == 0)
                        ieee80211_runtask(ic, &ic->ic_promisc_task);
        }
@@ -921,8 +914,8 @@
                if (++ic->ic_allmulti == 1)
                        ieee80211_runtask(ic, &ic->ic_mcast_task);
        } else {
-               KASSERT(ic->ic_allmulti > 0, ("%s: ic %p not allmulti",
-                   __func__, ic));
+               KASSERTMSG(ic->ic_allmulti > 0, "%s: ic %p not allmulti",
+                   __func__, ic);
                if (--ic->ic_allmulti == 0)
                        ieee80211_runtask(ic, &ic->ic_mcast_task);
        }
@@ -1357,7 +1350,7 @@
 {
        struct ieee80211_channel *c;
 
-       KASSERT(*nchans > 0, ("channel list is empty\n"));
+       KASSERTMSG(*nchans > 0, "channel list is empty\n");
 
        if (*nchans >= maxchans)
                return (ENOBUFS);
@@ -1489,7 +1482,7 @@
        int i, error;
 
        getflags(bands, flags, 0, 0);
-       KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
+       KASSERTMSG(flags[0] != 0, "%s: no correct mode provided\n", __func__);
 
        error = addchan(chans, maxchans, nchans, ieee, freq, maxregpower,
            flags[0] | chan_flags);
@@ -1718,7 +1711,7 @@
 
        /* XXX no VHT for now */
        getflags_2ghz(bands, flags, ht40);
-       KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
+       KASSERTMSG(flags[0] != 0, "%s: no correct mode provided\n", __func__);
 
        return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags));
 }
@@ -1749,7 +1742,7 @@
                vht80 = 1;
 
        getflags_5ghz(bands, flags, ht40, vht80);
-       KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
+       KASSERTMSG(flags[0] != 0, "%s: no correct mode provided\n", __func__);
 
        return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags));
 }
@@ -2041,7 +2034,7 @@
        struct ieee80211vap *vap;
 
        vap = TAILQ_FIRST(&ic->ic_vaps);
-       KASSERT(vap != NULL, ("media vap is null"));
+       KASSERTMSG(vap != NULL, "media vap is null");
 
        ifmedia_init_with_lock(&vap->iv_media, 0, media_change,
            media_stat, NULL);
diff -r bb1561b2287c -r e4dce518360c sys/net80211/ieee80211_acl.c
--- a/sys/net80211/ieee80211_acl.c      Thu Jun 25 17:11:30 2020 +0200
+++ b/sys/net80211/ieee80211_acl.c      Sun Jul 05 19:00:33 2020 +0200
@@ -71,11 +71,6 @@
 
 #include <net80211/ieee80211_var.h>
 
-#ifdef __NetBSD__
-#undef KASSERT
-#define KASSERT(__cond, __complaint) FBSDKASSERT(__cond, __complaint)
-#endif
-
 enum {
        ACL_POLICY_OPEN         = 0,    /* open, don't check ACL's */
        ACL_POLICY_ALLOW        = 1,    /* allow traffic from MAC */
@@ -140,7 +135,7 @@
 {
        struct aclstate *as = vap->iv_as;
 
-       KASSERT(nrefs > 0, ("imbalanced attach/detach"));
+       KASSERTMSG(nrefs > 0, "imbalanced attach/detach");
        nrefs--;                        /* NB: we assume caller locking */
 
        acl_free_all(vap);
diff -r bb1561b2287c -r e4dce518360c sys/net80211/ieee80211_adhoc.c
--- a/sys/net80211/ieee80211_adhoc.c    Thu Jun 25 17:11:30 2020 +0200
+++ b/sys/net80211/ieee80211_adhoc.c    Sun Jul 05 19:00:33 2020 +0200
@@ -84,11 +84,6 @@
 
 #define        IEEE80211_RATE2MBS(r)   (((r) & IEEE80211_RATE_VAL) / 2)
 
-#ifdef __NetBSD__
-#undef  KASSERT
-#define KASSERT(__cond, __complaint) FBSDKASSERT(__cond, __complaint)
-#endif
-
 static void adhoc_vattach(struct ieee80211vap *);
 static int adhoc_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static int adhoc_input(struct ieee80211_node *, struct mbuf *,
@@ -369,7 +364,7 @@
                goto resubmit_ampdu;
        }
 
-       KASSERT(ni != NULL, ("null node"));
+       KASSERTMSG(ni != NULL, "null node");
        ni->ni_inact = ni->ni_inact_reload;
 
        type = -1;                      /* undefined */
diff -r bb1561b2287c -r e4dce518360c sys/net80211/ieee80211_ageq.c
--- a/sys/net80211/ieee80211_ageq.c     Thu Jun 25 17:11:30 2020 +0200
+++ b/sys/net80211/ieee80211_ageq.c     Sun Jul 05 19:00:33 2020 +0200
@@ -66,11 +66,6 @@
 
 #include <net80211/ieee80211_var.h>
 
-#ifdef __NetBSD__
-#undef  KASSERT
-#define KASSERT(__cond, __complaint) FBSDKASSERT(__cond, __complaint)
-#endif
-
 /*
  * Initialize an ageq.
  */
@@ -89,7 +84,7 @@
 void
 ieee80211_ageq_cleanup(struct ieee80211_ageq *aq)
 {
-       KASSERT(aq->aq_len == 0, ("%d frames on ageq", aq->aq_len));
+       KASSERTMSG(aq->aq_len == 0, "%d frames on ageq", aq->aq_len);
        IEEE80211_AGEQ_DESTROY(aq);             /* OS-dependent cleanup */
 }
 
@@ -144,7 +139,7 @@
                        aq->aq_tail->m_nextpkt = m;
                        age -= M_AGE_GET(aq->aq_head);
                }
-               KASSERT(age >= 0, ("age %d", age));
+               KASSERTMSG(age >= 0, "age %d", age);
                M_AGE_SET(m, age);
                m->m_nextpkt = NULL;
                aq->aq_tail = m;
@@ -201,7 +196,7 @@
                while ((m = aq->aq_head) != NULL && M_AGE_GET(m) < quanta) {
                        if ((aq->aq_head = m->m_nextpkt) == NULL)
                                aq->aq_tail = NULL;
-                       KASSERT(aq->aq_len > 0, ("aq len %d", aq->aq_len));
+                       KASSERTMSG(aq->aq_len > 0, "aq len %d", aq->aq_len);
                        aq->aq_len--;
                        /* add to private list for return */
                        *phead = m;
@@ -251,16 +246,16 @@
                /*
                 * Adjust q length.
                 */
-               KASSERT(aq->aq_len > 0, ("aq len %d", aq->aq_len));
+               KASSERTMSG(aq->aq_len > 0, "aq len %d", aq->aq_len);
                aq->aq_len--;
                /*
                 * Remove from forward list; tail pointer is harder.
                 */
                if (aq->aq_tail == m) {
-                       KASSERT(m->m_nextpkt == NULL, ("not last"));
+                       KASSERTMSG(m->m_nextpkt == NULL, "not last");
                        if (aq->aq_head == m) {         /* list empty */
-                               KASSERT(aq->aq_len == 0,
-                                   ("not empty, len %d", aq->aq_len));
+                               KASSERTMSG(aq->aq_len == 0,
+                                   "not empty, len %d", aq->aq_len);
                                aq->aq_tail = NULL;
                        } else {                        /* must be one before */
                                aq->aq_tail = (struct mbuf *)((uintptr_t)prev -
diff -r bb1561b2287c -r e4dce518360c sys/net80211/ieee80211_amrr.c
--- a/sys/net80211/ieee80211_amrr.c     Thu Jun 25 17:11:30 2020 +0200
+++ b/sys/net80211/ieee80211_amrr.c     Sun Jul 05 19:00:33 2020 +0200
@@ -74,11 +74,6 @@
 #include <net80211/ieee80211_amrr.h>
 #include <net80211/ieee80211_ratectl.h>
 
-#ifdef __NetBSD__
-#undef  KASSERT
-#define KASSERT(__cond, __complaint) FBSDKASSERT(__cond, __complaint)
-#endif
-
 #define is_success(amn)        \
        ((amn)->amn_retrycnt < (amn)->amn_txcnt / 10)
 #define is_failure(amn)        \
@@ -149,7 +144,7 @@
 {
        struct ieee80211_amrr *amrr;
 
-       KASSERT(vap->iv_rs == NULL, ("%s called multiple times", __func__));
+       KASSERTMSG(vap->iv_rs == NULL, "%s called multiple times", __func__);
 
        nrefs++;                /* XXX locking */
        amrr = vap->iv_rs = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr),
@@ -170,7 +165,7 @@
 amrr_deinit(struct ieee80211vap *vap)
 {
        IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL);
-       KASSERT(nrefs > 0, ("imbalanced attach/detach"));
+       KASSERTMSG(nrefs > 0, "imbalanced attach/detach");
        nrefs--;                /* XXX locking */
 }
 
@@ -287,7 +282,7 @@
        int rix = amn->amn_rix;
        const struct ieee80211_rateset *rs = NULL;
 
-       KASSERT(is_enough(amn), ("txcnt %d", amn->amn_txcnt));
+       KASSERTMSG(is_enough(amn), "txcnt %d", amn->amn_txcnt);
 
        /* 11n or not? Pick the right rateset */
        if (amrr_node_is_11n(ni)) {
diff -r bb1561b2287c -r e4dce518360c sys/net80211/ieee80211_crypto.c
--- a/sys/net80211/ieee80211_crypto.c   Thu Jun 25 17:11:30 2020 +0200



Home | Main Index | Thread Index | Old Index