git: bd29f81763aa - main - net80211: consistently use the IEEE80211_M_ memory related options
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Aug 2022 20:35:04 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bd29f81763aa9cac74c75b663c2cf46723f05528 commit bd29f81763aa9cac74c75b663c2cf46723f05528 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-08-17 18:33:08 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2022-08-18 20:32:24 +0000 net80211: consistently use the IEEE80211_M_ memory related options Replace a malloc() by IEEE80211_MALLOC(). For malloc flags even in the local ieee80211_freebsd.c there was a mix of both versions M_ and IEEE80211_M_. Consistently use the IEEE80211_M_ malloc options everywhere. If the field is changed for malloc, it'll also be changed for the other accessor functions taking a "how" field to avoid any confusion. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D36249 --- sys/net80211/ieee80211.c | 7 ++++--- sys/net80211/ieee80211_crypto_ccmp.c | 2 +- sys/net80211/ieee80211_crypto_tkip.c | 2 +- sys/net80211/ieee80211_crypto_wep.c | 2 +- sys/net80211/ieee80211_freebsd.c | 16 ++++++++-------- sys/net80211/ieee80211_hostap.c | 4 ++-- sys/net80211/ieee80211_ht.c | 2 +- sys/net80211/ieee80211_hwmp.c | 2 +- sys/net80211/ieee80211_input.c | 2 +- sys/net80211/ieee80211_ioctl.c | 4 ++-- sys/net80211/ieee80211_mesh.c | 6 +++--- sys/net80211/ieee80211_output.c | 27 ++++++++++++++------------- sys/net80211/ieee80211_superg.c | 6 +++--- sys/net80211/ieee80211_wds.c | 2 +- 14 files changed, 43 insertions(+), 41 deletions(-) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 4af9450213ce..4878af65a4fe 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -333,12 +333,13 @@ ieee80211_ifattach(struct ieee80211com *ic) TAILQ_INIT(&ic->ic_vaps); /* Create a taskqueue for all state changes */ - ic->ic_tq = taskqueue_create("ic_taskq", M_WAITOK | M_ZERO, + ic->ic_tq = taskqueue_create("ic_taskq", + IEEE80211_M_WAITOK | IEEE80211_M_ZERO, taskqueue_thread_enqueue, &ic->ic_tq); taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s net80211 taskq", ic->ic_name); - ic->ic_ierrors = counter_u64_alloc(M_WAITOK); - ic->ic_oerrors = counter_u64_alloc(M_WAITOK); + ic->ic_ierrors = counter_u64_alloc(IEEE80211_M_WAITOK); + ic->ic_oerrors = counter_u64_alloc(IEEE80211_M_WAITOK); /* * Fill in 802.11 available channel set, mark all * available channels as active, and pick a default diff --git a/sys/net80211/ieee80211_crypto_ccmp.c b/sys/net80211/ieee80211_crypto_ccmp.c index c4423e8a4ca9..a8ef3dab7635 100644 --- a/sys/net80211/ieee80211_crypto_ccmp.c +++ b/sys/net80211/ieee80211_crypto_ccmp.c @@ -189,7 +189,7 @@ ccmp_encap(struct ieee80211_key *k, struct mbuf *m) /* * Copy down 802.11 header and add the IV, KeyID, and ExtIV. */ - M_PREPEND(m, ccmp.ic_header, M_NOWAIT); + M_PREPEND(m, ccmp.ic_header, IEEE80211_M_NOWAIT); if (m == NULL) return 0; ivp = mtod(m, uint8_t *); diff --git a/sys/net80211/ieee80211_crypto_tkip.c b/sys/net80211/ieee80211_crypto_tkip.c index 59230d3538a7..cfd1392e2075 100644 --- a/sys/net80211/ieee80211_crypto_tkip.c +++ b/sys/net80211/ieee80211_crypto_tkip.c @@ -214,7 +214,7 @@ tkip_encap(struct ieee80211_key *k, struct mbuf *m) /* * Copy down 802.11 header and add the IV, KeyID, and ExtIV. */ - M_PREPEND(m, tkip.ic_header, M_NOWAIT); + M_PREPEND(m, tkip.ic_header, IEEE80211_M_NOWAIT); if (m == NULL) return 0; ivp = mtod(m, uint8_t *); diff --git a/sys/net80211/ieee80211_crypto_wep.c b/sys/net80211/ieee80211_crypto_wep.c index 164157559cb2..113bb726a54b 100644 --- a/sys/net80211/ieee80211_crypto_wep.c +++ b/sys/net80211/ieee80211_crypto_wep.c @@ -202,7 +202,7 @@ wep_encap(struct ieee80211_key *k, struct mbuf *m) /* * Copy down 802.11 header and add the IV + KeyID. */ - M_PREPEND(m, wep.ic_header, M_NOWAIT); + M_PREPEND(m, wep.ic_header, IEEE80211_M_NOWAIT); if (m == NULL) return 0; ivp = mtod(m, uint8_t *); diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c index 011ae7060a6c..5511791ae2aa 100644 --- a/sys/net80211/ieee80211_freebsd.c +++ b/sys/net80211/ieee80211_freebsd.c @@ -487,7 +487,7 @@ ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen) len = roundup2(headroom + pktlen, 4); KASSERT(len <= MCLBYTES, ("802.11 mgt frame too large: %u", len)); if (len < MINCLSIZE) { - m = m_gethdr(M_NOWAIT, MT_DATA); + m = m_gethdr(IEEE80211_M_NOWAIT, MT_DATA); /* * Align the data in case additional headers are added. * This should only happen when a WEP header is added @@ -497,7 +497,7 @@ ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen) if (m != NULL) M_ALIGN(m, len); } else { - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(IEEE80211_M_NOWAIT, MT_DATA, M_PKTHDR); if (m != NULL) MC_ALIGN(m, len); } @@ -522,9 +522,9 @@ ieee80211_realign(struct ieee80211vap *vap, struct mbuf *m, size_t align) pktlen = m->m_pkthdr.len; space = pktlen + align; if (space < MINCLSIZE) - n = m_gethdr(M_NOWAIT, MT_DATA); + n = m_gethdr(IEEE80211_M_NOWAIT, MT_DATA); else { - n = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, + n = m_getjcl(IEEE80211_M_NOWAIT, MT_DATA, M_PKTHDR, space <= MCLBYTES ? MCLBYTES : #if MJUMPAGESIZE != MCLBYTES space <= MJUMPAGESIZE ? MJUMPAGESIZE : @@ -555,7 +555,7 @@ ieee80211_add_callback(struct mbuf *m, struct ieee80211_cb *cb; mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_CALLBACK, - sizeof(struct ieee80211_cb), M_NOWAIT); + sizeof(struct ieee80211_cb), IEEE80211_M_NOWAIT); if (mtag == NULL) return 0; @@ -575,7 +575,7 @@ ieee80211_add_xmit_params(struct mbuf *m, struct ieee80211_tx_params *tx; mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_XMIT_PARAMS, - sizeof(struct ieee80211_tx_params), M_NOWAIT); + sizeof(struct ieee80211_tx_params), IEEE80211_M_NOWAIT); if (mtag == NULL) return (0); @@ -626,7 +626,7 @@ ieee80211_add_rx_params(struct mbuf *m, const struct ieee80211_rx_stats *rxs) struct ieee80211_rx_params *rx; mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_RECV_PARAMS, - sizeof(struct ieee80211_rx_stats), M_NOWAIT); + sizeof(struct ieee80211_rx_stats), IEEE80211_M_NOWAIT); if (mtag == NULL) return (0); @@ -675,7 +675,7 @@ ieee80211_add_toa_params(struct mbuf *m, const struct ieee80211_toa_params *p) struct ieee80211_toa_params *rp; mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_TOA_PARAMS, - sizeof(struct ieee80211_toa_params), M_NOWAIT); + sizeof(struct ieee80211_toa_params), IEEE80211_M_NOWAIT); if (mtag == NULL) return (0); diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 17c1de6c2894..2be8f241b59d 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -386,7 +386,7 @@ hostap_deliver_data(struct ieee80211vap *vap, struct mbuf *mcopy = NULL; if (m->m_flags & M_MCAST) { - mcopy = m_dup(m, M_NOWAIT); + mcopy = m_dup(m, IEEE80211_M_NOWAIT); if (mcopy == NULL) if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); else @@ -1654,7 +1654,7 @@ ieee80211_deliver_l2uf(struct ieee80211_node *ni) struct l2_update_frame *l2uf; struct ether_header *eh; - m = m_gethdr(M_NOWAIT, MT_DATA); + m = m_gethdr(IEEE80211_M_NOWAIT, MT_DATA); if (m == NULL) { IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC, ni, "%s", "no mbuf for l2uf frame"); diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c index e680db5faa52..2fbb5a10febf 100644 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -495,7 +495,7 @@ ieee80211_decap_amsdu(struct ieee80211_node *ni, struct mbuf *m) } if (m->m_pkthdr.len == framelen) break; - n = m_split(m, framelen, M_NOWAIT); + n = m_split(m, framelen, IEEE80211_M_NOWAIT); if (n == NULL) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, ni->ni_macaddr, "a-msdu", diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index de07d501513b..77ba218ccd50 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -646,7 +646,7 @@ hwmp_send_action(struct ieee80211vap *vap, } m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); - M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), IEEE80211_M_NOWAIT); if (m == NULL) { ieee80211_free_node(ni); vap->iv_stats.is_tx_nobuf++; diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 683c8d5a06f1..b7d9c6f9457e 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -146,7 +146,7 @@ ieee80211_input_mimo_all(struct ieee80211com *ic, struct mbuf *m) * so do a deep copy of the packet. * NB: tags are copied too. */ - mcopy = m_dup(m, M_NOWAIT); + mcopy = m_dup(m, IEEE80211_M_NOWAIT); if (mcopy == NULL) { /* XXX stat+msg */ continue; diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 419518eb1224..839f965f542f 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -332,7 +332,7 @@ ieee80211_ioctl_getscanresults(struct ieee80211vap *vap, void *p; space = req.space; - /* XXX M_WAITOK after driver lock released */ + /* XXX IEEE80211_M_WAITOK after driver lock released */ p = IEEE80211_MALLOC(space, M_TEMP, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (p == NULL) @@ -478,7 +478,7 @@ getstainfo_common(struct ieee80211vap *vap, struct ieee80211req *ireq, req.space = ireq->i_len; if (req.space > 0) { space = req.space; - /* XXX M_WAITOK after driver lock released */ + /* XXX IEEE80211_M_WAITOK after driver lock released */ p = IEEE80211_MALLOC(space, M_TEMP, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (p == NULL) { diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index 6d1f5a99fda5..79ec5c9b7de8 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -1119,7 +1119,7 @@ ieee80211_mesh_forward_to_gates(struct ieee80211vap *vap, ieee80211_mesh_rt_update(rt_dest, ms->ms_ppath->mpp_inact); MESH_RT_UNLOCK(ms); /* XXX: lock?? */ - mcopy = m_dup(m, M_NOWAIT); + mcopy = m_dup(m, IEEE80211_M_NOWAIT); for (; mcopy != NULL; mcopy = next) { next = mcopy->m_nextpkt; mcopy->m_nextpkt = NULL; @@ -1175,7 +1175,7 @@ mesh_forward(struct ieee80211vap *vap, struct mbuf *m, vap->iv_stats.is_mesh_fwd_disabled++; return; } - mcopy = m_dup(m, M_NOWAIT); + mcopy = m_dup(m, IEEE80211_M_NOWAIT); if (mcopy == NULL) { IEEE80211_NOTE_FRAME(vap, IEEE80211_MSG_MESH, wh, "%s", "frame not fwd'd, cannot dup"); @@ -2668,7 +2668,7 @@ mesh_send_action(struct ieee80211_node *ni, return EIO; /* XXX */ } - M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), IEEE80211_M_NOWAIT); if (m == NULL) { ieee80211_free_node(ni); return ENOMEM; diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 17904672a72b..1be27380b01e 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1031,7 +1031,7 @@ ieee80211_mgmt_output(struct ieee80211_node *ni, struct mbuf *m, int type, return EIO; /* XXX */ } - M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), IEEE80211_M_NOWAIT); if (m == NULL) { ieee80211_free_node(ni); return ENOMEM; @@ -1129,7 +1129,7 @@ ieee80211_send_nulldata(struct ieee80211_node *ni) } KASSERT(M_LEADINGSPACE(m) >= hdrlen, ("leading space %zd", M_LEADINGSPACE(m))); - M_PREPEND(m, hdrlen, M_NOWAIT); + M_PREPEND(m, hdrlen, IEEE80211_M_NOWAIT); if (m == NULL) { /* NB: cannot happen */ ieee80211_free_node(ni); @@ -1358,7 +1358,7 @@ ieee80211_mbuf_adjust(struct ieee80211vap *vap, int hdrsize, * XXX handle SWMIC specially */ if (key->wk_flags & (IEEE80211_KEY_SWENCRYPT|IEEE80211_KEY_SWENMIC)) { - m = m_unshare(m, M_NOWAIT); + m = m_unshare(m, IEEE80211_M_NOWAIT); if (m == NULL) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, "%s: cannot get writable mbuf\n", __func__); @@ -1377,7 +1377,7 @@ ieee80211_mbuf_adjust(struct ieee80211vap *vap, int hdrsize, */ /* XXX check trailing space and copy instead? */ if (M_LEADINGSPACE(m) < needed_space - TO_BE_RECLAIMED) { - struct mbuf *n = m_gethdr(M_NOWAIT, m->m_type); + struct mbuf *n = m_gethdr(IEEE80211_M_NOWAIT, m->m_type); if (n == NULL) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, "%s: cannot expand storage\n", __func__); @@ -1682,7 +1682,7 @@ ieee80211_encap(struct ieee80211vap *vap, struct ieee80211_node *ni, } datalen = m->m_pkthdr.len; /* NB: w/o 802.11 header */ - M_PREPEND(m, hdrspace + meshhdrsize, M_NOWAIT); + M_PREPEND(m, hdrspace + meshhdrsize, IEEE80211_M_NOWAIT); if (m == NULL) { vap->iv_stats.is_tx_nobuf++; goto bad; @@ -1991,7 +1991,7 @@ ieee80211_fragment(struct ieee80211vap *vap, struct mbuf *m0, prev = m0; do { fragsize = MIN(totalhdrsize + remainder, mtu); - m = m_get2(fragsize, M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_get2(fragsize, IEEE80211_M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) goto bad; /* leave room to prepend any cipher header */ @@ -2480,7 +2480,8 @@ ieee80211_probereq_ie(struct ieee80211vap *vap, struct ieee80211com *ic, len -= (2 + IEEE80211_NWID_LEN); if (alloc) { - frm = malloc(len, M_80211_VAP, M_WAITOK | M_ZERO); + frm = IEEE80211_MALLOC(len, M_80211_VAP, + IEEE80211_M_WAITOK | IEEE80211_M_ZERO); *frmp = frm; *frmlen = len; } else @@ -2597,7 +2598,7 @@ ieee80211_send_probereq(struct ieee80211_node *ni, m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); KASSERT(M_LEADINGSPACE(m) >= sizeof(struct ieee80211_frame), ("leading space %zd", M_LEADINGSPACE(m))); - M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), IEEE80211_M_NOWAIT); if (m == NULL) { /* NB: cannot happen */ ieee80211_free_node(ni); @@ -3259,7 +3260,7 @@ ieee80211_send_proberesp(struct ieee80211vap *vap, return ENOMEM; } - M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), IEEE80211_M_NOWAIT); KASSERT(m != NULL, ("no room for header")); IEEE80211_TX_LOCK(ic); @@ -3295,7 +3296,7 @@ ieee80211_alloc_rts(struct ieee80211com *ic, struct mbuf *m; /* XXX honor ic_headroom */ - m = m_gethdr(M_NOWAIT, MT_DATA); + m = m_gethdr(IEEE80211_M_NOWAIT, MT_DATA); if (m != NULL) { rts = mtod(m, struct ieee80211_frame_rts *); rts->i_fc[0] = IEEE80211_FC0_VERSION_0 | @@ -3321,7 +3322,7 @@ ieee80211_alloc_cts(struct ieee80211com *ic, struct mbuf *m; /* XXX honor ic_headroom */ - m = m_gethdr(M_NOWAIT, MT_DATA); + m = m_gethdr(IEEE80211_M_NOWAIT, MT_DATA); if (m != NULL) { cts = mtod(m, struct ieee80211_frame_cts *); cts->i_fc[0] = IEEE80211_FC0_VERSION_0 | @@ -3748,7 +3749,7 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) } ieee80211_beacon_construct(m, frm, ni); - M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), IEEE80211_M_NOWAIT); KASSERT(m != NULL, ("no space for 802.11 header?")); wh = mtod(m, struct ieee80211_frame *); wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT | @@ -4132,7 +4133,7 @@ ieee80211_ff_encap1(struct ieee80211vap *vap, struct mbuf *m, llc->llc_snap.ether_type = eh->ether_type; payload = m->m_pkthdr.len; /* NB: w/o Ethernet header */ - M_PREPEND(m, sizeof(struct ether_header), M_NOWAIT); + M_PREPEND(m, sizeof(struct ether_header), IEEE80211_M_NOWAIT); if (m == NULL) { /* XXX cannot happen */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, "%s: no space for ether_header\n", __func__); diff --git a/sys/net80211/ieee80211_superg.c b/sys/net80211/ieee80211_superg.c index 4ac7813d2811..5da97577165b 100644 --- a/sys/net80211/ieee80211_superg.c +++ b/sys/net80211/ieee80211_superg.c @@ -326,7 +326,7 @@ ieee80211_ff_decap(struct ieee80211_node *ni, struct mbuf *m) vap->iv_stats.is_ff_tooshort++; return NULL; } - n = m_split(m, framelen, M_NOWAIT); + n = m_split(m, framelen, IEEE80211_M_NOWAIT); if (n == NULL) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, ni->ni_macaddr, "fast-frame", @@ -445,7 +445,7 @@ ieee80211_ff_encap(struct ieee80211vap *vap, struct mbuf *m1, int hdrspace, */ m->m_next = m2; /* NB: last mbuf from above */ m1->m_pkthdr.len += m2->m_pkthdr.len; - M_PREPEND(m1, sizeof(uint32_t)+2, M_NOWAIT); + M_PREPEND(m1, sizeof(uint32_t)+2, IEEE80211_M_NOWAIT); if (m1 == NULL) { /* XXX cannot happen */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, "%s: no space for tunnel header\n", __func__); @@ -454,7 +454,7 @@ ieee80211_ff_encap(struct ieee80211vap *vap, struct mbuf *m1, int hdrspace, } memset(mtod(m1, void *), 0, sizeof(uint32_t)+2); - M_PREPEND(m1, sizeof(struct llc), M_NOWAIT); + M_PREPEND(m1, sizeof(struct llc), IEEE80211_M_NOWAIT); if (m1 == NULL) { /* XXX cannot happen */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, "%s: no space for llc header\n", __func__); diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c index debe89436d3d..bb85b430b5b3 100644 --- a/sys/net80211/ieee80211_wds.c +++ b/sys/net80211/ieee80211_wds.c @@ -257,7 +257,7 @@ ieee80211_dwds_mcast(struct ieee80211vap *vap0, struct mbuf *m) /* * Duplicate the frame and send it. */ - mcopy = m_copypacket(m, M_NOWAIT); + mcopy = m_copypacket(m, IEEE80211_M_NOWAIT); if (mcopy == NULL) { if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* XXX stat + msg */