From 380c55d9c97217008fec4be9bd62fac533c25ede Mon Sep 17 00:00:00 2001 From: mentor Date: Sun, 4 May 2008 17:48:59 +0000 Subject: [PATCH] Rename and move, into the right headers, the SKB and BF macros git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3596 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath/if_ath.c | 16 +++++++-------- ath/if_athvar.h | 6 ++++++ net80211/ieee80211_linux.h | 40 -------------------------------------- net80211/ieee80211_skb.h | 31 +++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 48 deletions(-) diff --git a/ath/if_ath.c b/ath/if_ath.c index 7c8cb6e..8631f6c 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -3186,15 +3186,15 @@ ath_ffstageq_flush(struct ath_softc *sc, struct ath_txq *txq, return; } - KASSERT(BF_AN(bf_ff)->an_tx_ffbuf[bf_ff->bf_skb->priority], + KASSERT(ATH_BUF_AN(bf_ff)->an_tx_ffbuf[bf_ff->bf_skb->priority], ("no bf_ff on staging queue %p", bf_ff)); - BF_AN(bf_ff)->an_tx_ffbuf[bf_ff->bf_skb->priority] = NULL; + ATH_BUF_AN(bf_ff)->an_tx_ffbuf[bf_ff->bf_skb->priority] = NULL; TAILQ_REMOVE(&txq->axq_stageq, bf_ff, bf_stagelist); ATH_TXQ_UNLOCK_IRQ(txq); /* encap and xmit */ - bf_ff->bf_skb = ieee80211_encap(BF_NI(bf_ff), bf_ff->bf_skb, + bf_ff->bf_skb = ieee80211_encap(ATH_BUF_NI(bf_ff), bf_ff->bf_skb, &framecnt); if (bf_ff->bf_skb == NULL) { DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_FF, @@ -3203,7 +3203,7 @@ ath_ffstageq_flush(struct ath_softc *sc, struct ath_txq *txq, goto bad; } pktlen = bf_ff->bf_skb->len; /* NB: don't reference skb below */ - if (ath_tx_start(sc->sc_dev, BF_NI(bf_ff), bf_ff, + if (ath_tx_start(sc->sc_dev, ATH_BUF_NI(bf_ff), bf_ff, bf_ff->bf_skb, 0) == 0) continue; bad: @@ -6004,7 +6004,7 @@ ath_node_move_data(const struct ieee80211_node *ni) else bf_tmp = prev; while (bf) { - if (ni == BF_NI(bf)) { + if (ni == ATH_BUF_NI(bf)) { if (prev == bf) { ATH_TXQ_REMOVE_HEAD(txq, bf_list); @@ -6160,7 +6160,7 @@ ath_node_move_data(const struct ieee80211_node *ni) * collect all the data in to four temp SW queues. */ while (bf) { - if (ni == BF_NI(bf)) { + if (ni == ATH_BUF_NI(bf)) { if (prev == bf) { STAILQ_REMOVE_HEAD(&txq->axq_q, bf_list); bf_tmp=bf; @@ -8389,7 +8389,7 @@ ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) ATH_TXQ_REMOVE_HEAD(txq, bf_list); ATH_TXQ_UNLOCK_IRQ(txq); - ni = BF_NI(bf); + ni = ATH_BUF_NI(bf); if (ni != NULL) { an = ATH_NODE(ni); if (ts->ts_status == 0) { @@ -10501,7 +10501,7 @@ ath_printtxbuf(const struct ath_buf *bf, int done) { const struct ath_tx_status *ts = &bf->bf_dsstatus.ds_txstat; const struct ath_desc *ds = bf->bf_desc; - struct ath_softc *sc = BF_NI(bf)->ni_ic->ic_dev->priv; + struct ath_softc *sc = ATH_BUF_NI(bf)->ni_ic->ic_dev->priv; u_int8_t status = done ? ts->ts_status : 0; DPRINTF(sc, ATH_DEBUG_ANY, diff --git a/ath/if_athvar.h b/ath/if_athvar.h index 667f606..4507cb5 100644 --- a/ath/if_athvar.h +++ b/ath/if_athvar.h @@ -368,6 +368,7 @@ struct ath_node { /* variable-length rate control state follows */ }; #define ATH_NODE(_n) ((struct ath_node *)(_n)) +#define SKB_AN(_skb) (ATH_NODE(SKB_NI(_skb))) #define ATH_NODE_CONST(ni) ((const struct ath_node *)(ni)) #define ATH_NODE_UAPSD_LOCK_INIT(_an) spin_lock_init(&(_an)->an_uapsd_lock) #define ATH_NODE_UAPSD_LOCK_IRQ(_an) do { \ @@ -451,6 +452,11 @@ struct ath_buf { const char* bf_taken_at_func; }; +/* BF_XX(...) macros will blow up if _bf is NULL, but not if _bf->bf_skb is + * null*/ +#define ATH_BUF_CB(_bf) (((_bf)->bf_skb) ? SKB_CB((_bf)->bf_skb) : NULL) +#define ATH_BUF_NI(_bf) (((_bf)->bf_skb) ? SKB_NI((_bf)->bf_skb) : NULL) +#define ATH_BUF_AN(_bf) (((_bf)->bf_skb) ? SKB_AN((_bf)->bf_skb) : NULL) /* XXX: only managed for rx at the moment */ #define ATH_BUFSTATUS_RXDESC_DONE 0x00000001 /* rx descriptor processing complete, desc processed by hal */ #define ATH_BUFSTATUS_RADAR_DONE 0x00000002 /* marker to indicate a PHYERR for radar pulse diff --git a/net80211/ieee80211_linux.h b/net80211/ieee80211_linux.h index aa1870a..f6e3498 100644 --- a/net80211/ieee80211_linux.h +++ b/net80211/ieee80211_linux.h @@ -409,46 +409,6 @@ typedef spinlock_t acl_lock_t; struct sk_buff *next; /* fast frame sk_buf chain */ }; - -/* SKB_XX(...) macros will blow up if _skb is NULL (detect problems early) */ -#define SKB_CB(_skb) ((struct ieee80211_cb *)(_skb)->cb) -#define SKB_NI(_skb) (SKB_CB(_skb)->ni) -#define SKB_AN(_skb) (ATH_NODE(SKB_NI(_skb))) -/* BF_XX(...) macros will blow up if _bf is NULL, but not if _bf->bf_skb is - * null*/ -#define BF_CB(_bf) (((_bf)->bf_skb) ? SKB_CB((_bf)->bf_skb) : NULL) -#define BF_NI(_bf) (((_bf)->bf_skb) ? SKB_NI((_bf)->bf_skb) : NULL) -#define BF_AN(_bf) (((_bf)->bf_skb) ? SKB_AN((_bf)->bf_skb) : NULL) - -#define M_FLAG_SET(_skb, _flag) \ - (SKB_CB(_skb)->flags |= (_flag)) -#define M_FLAG_CLR(_skb, _flag) \ - (SKB_CB(_skb)->flags &= ~(_flag)) -#define M_FLAG_GET(_skb, _flag) \ - (SKB_CB(_skb)->flags & (_flag)) -#define M_FLAG_KEEP_ONLY(_skb, _flag) \ - (SKB_CB(_skb)->flags &= (_flag)) - -#define M_PWR_SAV_SET(skb) M_FLAG_SET((skb), M_PWR_SAV) -#define M_PWR_SAV_CLR(skb) M_FLAG_CLR((skb), M_PWR_SAV) -#define M_PWR_SAV_GET(skb) M_FLAG_GET((skb), M_PWR_SAV) - -/* - * Skbufs on the power save queue are tagged with an age and - * timed out. We reuse the hardware checksum field in the - * mbuf packet header to store this data. - * XXX use private cb area - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -#define skb_age csum_offset -#else -#define skb_age csum -#endif - -#define M_AGE_SET(skb,v) ((skb)->skb_age = (v)) -#define M_AGE_GET(skb) ((skb)->skb_age) -#define M_AGE_SUB(skb,adj) ((skb)->skb_age -= (adj)) - struct ieee80211com; struct ieee80211vap; diff --git a/net80211/ieee80211_skb.h b/net80211/ieee80211_skb.h index 6c5f9eb..e304b3d 100644 --- a/net80211/ieee80211_skb.h +++ b/net80211/ieee80211_skb.h @@ -46,6 +46,37 @@ extern atomic_t skb_refs_counter; * Public API ******************************************************************************/ +/* SKB_XX(...) macros will blow up if _skb is NULL (detect problems early) */ +#define SKB_CB(_skb) ((struct ieee80211_cb *)(_skb)->cb) +#define SKB_NI(_skb) (SKB_CB(_skb)->ni) + +#define M_FLAG_SET(_skb, _flag) \ + (SKB_CB(_skb)->flags |= (_flag)) +#define M_FLAG_CLR(_skb, _flag) \ + (SKB_CB(_skb)->flags &= ~(_flag)) +#define M_FLAG_GET(_skb, _flag) \ + (SKB_CB(_skb)->flags & (_flag)) +#define M_FLAG_KEEP_ONLY(_skb, _flag) \ + (SKB_CB(_skb)->flags &= (_flag)) + +#define M_PWR_SAV_SET(skb) M_FLAG_SET((skb), M_PWR_SAV) +#define M_PWR_SAV_CLR(skb) M_FLAG_CLR((skb), M_PWR_SAV) +#define M_PWR_SAV_GET(skb) M_FLAG_GET((skb), M_PWR_SAV) + +/* SKBs on the power save queue are tagged with an age and + * timed out. We reuse the hardware checksum field in the + * mbuf packet header to store this data. + * XXX: use private cb area. */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) +#define skb_age csum_offset +#else +#define skb_age csum +#endif + +#define M_AGE_SET(_skb,_v) ((_skb)->skb_age = (_v)) +#define M_AGE_GET(_skb) ((_skb)->skb_age) +#define M_AGE_SUB(_skb,_adj) ((_skb)->skb_age -= (_adj)) + /* ieee80211_dev_kfree_skb will release one reference from SKB. * If SKB refcount is going to zero: * - Free the node reference and set it to null. -- 2.35.1