From 2ecfeab07eacef2b1fa61a83ab98af39600d683c Mon Sep 17 00:00:00 2001 From: mentor Date: Thu, 1 May 2008 13:49:09 +0000 Subject: [PATCH] Move the maximum monitor headroom definition to a nice header file git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3593 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath/if_ath.c | 22 +++++++++++----------- net80211/ieee80211_monitor.c | 9 ++------- net80211/ieee80211_monitor.h | 11 ++++++++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ath/if_ath.c b/ath/if_ath.c index 7bd59c5..a6770d5 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -6339,15 +6339,11 @@ ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf) { struct ath_hal *ah = sc->sc_ah; struct ath_desc *ds = NULL; - /* NB: Always use the same size for buffer allocations so that dynamically - * adding a monitor mode VAP to a running driver doesn't cause havoc. */ - unsigned int extra = A_MAX(sizeof(struct ath_rx_radiotap_header), - A_MAX(sizeof(struct wlan_ng_prism2_header), - ATHDESC_HEADER_SIZE)); - /* NB: I'm being cautious by unmapping and releasing the SKB every time. - * XXX: I could probably keep rolling, but the DMA map/unmap logic doesn't - * seem clean enough and cycling the skb through the free function and - * slab allocator seems to scrub any un-reset values. */ + /* NB: I'm being cautious by unmapping and releasing the SKB every + * time. + * XXX: I could probably keep rolling, but the DMA map/unmap logic + * doesn't seem clean enough and cycling the skb through the free + * function and slab allocator seems to scrub any un-reset values. */ if (bf->bf_skb != NULL) { KASSERT(bf->bf_skbaddr, ("bf->bf_skbaddr is 0")); bus_unmap_single(sc->sc_bdev, bf->bf_skbaddr, @@ -6355,7 +6351,11 @@ ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf) ieee80211_dev_kfree_skb(&bf->bf_skb); } if (!bf->bf_skb) { - int size = sc->sc_rxbufsize + extra + sc->sc_cachelsz - 1; + /* NB: Always use the same size for buffer allocations so that + * dynamically adding a monitor mode VAP to a running driver + * doesn't cause havoc. */ + int size = sc->sc_rxbufsize + IEEE80211_MON_MAXHDROOM + + sc->sc_cachelsz - 1; int offset = 0; bf->bf_skb = ath_alloc_skb(size, sc->sc_cachelsz); @@ -6367,7 +6367,7 @@ ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf) /* * Reserve space for the header. */ - skb_reserve(bf->bf_skb, extra); + skb_reserve(bf->bf_skb, IEEE80211_MON_MAXHDROOM); /* * Cache-line-align. This is important (for the * 5210 at least) as not doing so causes bogus data diff --git a/net80211/ieee80211_monitor.c b/net80211/ieee80211_monitor.c index 07a1202..d6b6763 100644 --- a/net80211/ieee80211_monitor.c +++ b/net80211/ieee80211_monitor.c @@ -297,11 +297,6 @@ EXPORT_SYMBOL(ieee80211_monitor_encap); /* * Context: softIRQ (tasklet) */ -#define MON_PKT_HDRSPACE ((unsigned int) \ - A_MAX(sizeof(struct ath_tx_radiotap_header), \ - A_MAX(sizeof(struct wlan_ng_prism2_header), \ - ATHDESC_HEADER_SIZE))) - void ieee80211_input_monitor(struct ieee80211com *ic, struct sk_buff *skb, const struct ath_buf *bf, int tx, u_int64_t mactime, struct ath_softc *sc) @@ -377,8 +372,8 @@ ieee80211_input_monitor(struct ieee80211com *ic, struct sk_buff *skb, continue; } - if (skb_headroom(skb) < MON_PKT_HDRSPACE) - skb1 = skb_copy_expand(skb, MON_PKT_HDRSPACE, + if (skb_headroom(skb) < IEEE80211_MON_MAXHDROOM) + skb1 = skb_copy_expand(skb, IEEE80211_MON_MAXHDROOM, 0, GFP_ATOMIC); else skb1 = skb_copy(skb, GFP_ATOMIC); diff --git a/net80211/ieee80211_monitor.h b/net80211/ieee80211_monitor.h index 5bc0d6d..bbd9bde 100644 --- a/net80211/ieee80211_monitor.h +++ b/net80211/ieee80211_monitor.h @@ -29,6 +29,10 @@ #ifndef _NET80211_IEEE80211_MONITOR_H_ #define _NET80211_IEEE80211_MONITOR_H_ +#include +#include +#include + #ifndef ARPHRD_IEEE80211_RADIOTAP #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ #endif /* ARPHRD_IEEE80211_RADIOTAP */ @@ -39,9 +43,10 @@ #define ATHDESC_HEADER_SIZE 32 -#include -#include -#include +#define IEEE80211_MON_MAXHDROOM ((unsigned int) \ + A_MAX(sizeof(struct ath_tx_radiotap_header), \ + A_MAX(sizeof(struct wlan_ng_prism2_header), \ + ATHDESC_HEADER_SIZE))) struct ieee80211_phy_params { u_int8_t rate0; -- 2.35.1