mirror of
https://github.com/proski/madwifi
synced 2024-11-22 06:21:47 +03:00
Move the monitor physical parameter struct inside ieee80211_cb. Have same struct actually be an array. Add an evil struct definition that breaks if ieee80211_cb is bigger than 48 bytes; it serves no other purpose.
git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3615 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
parent
094374b5ee
commit
f577062ef7
15
ath/if_ath.c
15
ath/if_ath.c
@ -3048,8 +3048,7 @@ ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
|
||||
{
|
||||
struct ath_softc *sc = dev->priv;
|
||||
struct ath_hal *ah = sc->sc_ah;
|
||||
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)
|
||||
(SKB_CB(skb) + 1); /* NB: SKB_CB casts to CB struct*. */
|
||||
struct ieee80211_phy_params *ph = &(SKB_CB(skb)->phy);
|
||||
const HAL_RATE_TABLE *rt;
|
||||
unsigned int pktlen, hdrlen, try0, power;
|
||||
HAL_PKT_TYPE atype;
|
||||
@ -3060,9 +3059,9 @@ ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
|
||||
struct ieee80211_frame *wh;
|
||||
|
||||
wh = (struct ieee80211_frame *)skb->data;
|
||||
try0 = ph->try0;
|
||||
try0 = ph->try[0];
|
||||
rt = sc->sc_currates;
|
||||
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
|
||||
txrate = dot11_to_ratecode(sc, rt, ph->rate[0]);
|
||||
power = ph->power > 60 ? 60 : ph->power;
|
||||
hdrlen = ieee80211_anyhdrsize(wh);
|
||||
pktlen = skb->len + IEEE80211_CRC_LEN;
|
||||
@ -3113,11 +3112,11 @@ ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
|
||||
ATH_COMP_PROC_NO_COMP_NO_CCS /* comp scheme */
|
||||
);
|
||||
|
||||
if (ph->try1) {
|
||||
if (ph->try[1]) {
|
||||
ath_hal_setupxtxdesc(sc->sc_ah, ds,
|
||||
dot11_to_ratecode(sc, rt, ph->rate1), ph->try1,
|
||||
dot11_to_ratecode(sc, rt, ph->rate2), ph->try2,
|
||||
dot11_to_ratecode(sc, rt, ph->rate3), ph->try3
|
||||
dot11_to_ratecode(sc, rt, ph->rate[1]), ph->try[1],
|
||||
dot11_to_ratecode(sc, rt, ph->rate[2]), ph->try[2],
|
||||
dot11_to_ratecode(sc, rt, ph->rate[3]), ph->try[3]
|
||||
);
|
||||
}
|
||||
bf->bf_flags = flags; /* record for post-processing */
|
||||
|
@ -388,8 +388,18 @@ typedef spinlock_t acl_lock_t;
|
||||
* NB: sizeof(cb) == 48 and the vlan code grabs the first
|
||||
* 8 bytes so we reserve/avoid it.
|
||||
*/
|
||||
struct ieee80211_cb {
|
||||
u_int8_t vlan[8]; /* reserve for vlan tag info */
|
||||
|
||||
struct ieee80211_phy_params {
|
||||
u_int8_t rate[4];
|
||||
u_int8_t try[4];
|
||||
|
||||
u_int8_t power;
|
||||
u_int32_t flags;
|
||||
};
|
||||
|
||||
struct ieee80211_cb {
|
||||
u_int8_t __reserved_vlan[8]; /* reserve for vlan tag info */
|
||||
struct ieee80211_phy_params phy;
|
||||
struct ieee80211_node *ni;
|
||||
u_int32_t flags;
|
||||
#define M_LINK0 0x01 /* frame needs WEP encryption */
|
||||
@ -404,6 +414,10 @@ typedef spinlock_t acl_lock_t;
|
||||
struct sk_buff *next; /* fast frame sk_buf chain */
|
||||
};
|
||||
|
||||
struct __assert {
|
||||
int __ieee80211_cb_size[sizeof(struct ieee80211_cb) <= 48 ? 0 : -1];
|
||||
};
|
||||
|
||||
struct ieee80211com;
|
||||
struct ieee80211vap;
|
||||
|
||||
|
@ -61,7 +61,6 @@
|
||||
#include <ath/if_athvar.h>
|
||||
|
||||
|
||||
|
||||
static int
|
||||
ratecode_to_dot11(int ratecode)
|
||||
{
|
||||
@ -128,24 +127,22 @@ struct ar5212_openbsd_desc {
|
||||
void
|
||||
ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)
|
||||
(SKB_CB(skb) + 1); /* NB: SKB_CB casts to CB struct*. */
|
||||
struct ieee80211_phy_params *ph = &(SKB_CB(skb)->phy);
|
||||
SKB_CB(skb)->flags = M_RAW;
|
||||
SKB_NI(skb) = NULL;
|
||||
SKB_CB(skb)->next = NULL;
|
||||
memset(ph, 0, sizeof(struct ieee80211_phy_params));
|
||||
|
||||
/* send at a static rate if it is configured */
|
||||
ph->rate0 = vap->iv_fixed_rate > 0 ? vap->iv_fixed_rate : 2;
|
||||
ph->rate[0] = vap->iv_fixed_rate > 0 ? vap->iv_fixed_rate : 2;
|
||||
/* don't retry control packets */
|
||||
ph->try0 = 11;
|
||||
ph->try[0] = 11;
|
||||
ph->power = 60;
|
||||
|
||||
switch (skb->dev->type) {
|
||||
case ARPHRD_IEEE80211: {
|
||||
struct ieee80211_frame *wh = (struct ieee80211_frame *) skb->data;
|
||||
if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
|
||||
ph->try0 = 1;
|
||||
ph->try[0] = 1;
|
||||
break;
|
||||
}
|
||||
case ARPHRD_IEEE80211_PRISM: {
|
||||
@ -156,12 +153,12 @@ ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff *skb)
|
||||
if (skb->len > sizeof(struct wlan_ng_prism2_header) &&
|
||||
p2h->msgcode == DIDmsg_lnxind_wlansniffrm &&
|
||||
p2h->rate.did == DIDmsg_lnxind_wlansniffrm_rate) {
|
||||
ph->rate0 = p2h->rate.data;
|
||||
ph->rate[0] = p2h->rate.data;
|
||||
skb_pull(skb, sizeof(struct wlan_ng_prism2_header));
|
||||
}
|
||||
wh = (struct ieee80211_frame *) skb->data;
|
||||
if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
|
||||
ph->try0 = 1;
|
||||
ph->try[0] = 1;
|
||||
break;
|
||||
}
|
||||
case ARPHRD_IEEE80211_RADIOTAP: {
|
||||
@ -201,7 +198,7 @@ ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff *skb)
|
||||
continue;
|
||||
switch (bit) {
|
||||
case IEEE80211_RADIOTAP_RATE:
|
||||
ph->rate0 = *p;
|
||||
ph->rate[0] = *p;
|
||||
p++;
|
||||
break;
|
||||
|
||||
@ -247,7 +244,7 @@ ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff *skb)
|
||||
break;
|
||||
|
||||
case IEEE80211_RADIOTAP_DATA_RETRIES:
|
||||
ph->try0 = *p + 1;
|
||||
ph->try[0] = *p + 1;
|
||||
p++;
|
||||
break;
|
||||
|
||||
@ -261,9 +258,9 @@ ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff *skb)
|
||||
/* Remove FCS from the end of frames to transmit */
|
||||
skb_trim(skb, skb->len - IEEE80211_CRC_LEN);
|
||||
wh = (struct ieee80211_frame *)skb->data;
|
||||
if (!ph->try0 &&
|
||||
if (!ph->try[0] &&
|
||||
(wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
|
||||
ph->try0 = 1;
|
||||
ph->try[0] = 1;
|
||||
break;
|
||||
}
|
||||
case ARPHRD_IEEE80211_ATHDESC: {
|
||||
@ -271,14 +268,14 @@ ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff *skb)
|
||||
struct ar5212_openbsd_desc *desc =
|
||||
(struct ar5212_openbsd_desc *) (skb->data + 8);
|
||||
ph->power = desc->xmit_power;
|
||||
ph->rate0 = ratecode_to_dot11(desc->xmit_rate0);
|
||||
ph->rate1 = ratecode_to_dot11(desc->xmit_rate1);
|
||||
ph->rate2 = ratecode_to_dot11(desc->xmit_rate2);
|
||||
ph->rate3 = ratecode_to_dot11(desc->xmit_rate3);
|
||||
ph->try0 = desc->xmit_tries0;
|
||||
ph->try1 = desc->xmit_tries1;
|
||||
ph->try2 = desc->xmit_tries2;
|
||||
ph->try3 = desc->xmit_tries3;
|
||||
ph->rate[0] = ratecode_to_dot11(desc->xmit_rate0);
|
||||
ph->rate[1] = ratecode_to_dot11(desc->xmit_rate1);
|
||||
ph->rate[2] = ratecode_to_dot11(desc->xmit_rate2);
|
||||
ph->rate[3] = ratecode_to_dot11(desc->xmit_rate3);
|
||||
ph->try[0] = desc->xmit_tries0;
|
||||
ph->try[1] = desc->xmit_tries1;
|
||||
ph->try[2] = desc->xmit_tries2;
|
||||
ph->try[3] = desc->xmit_tries3;
|
||||
skb_pull(skb, ATHDESC_HEADER_SIZE);
|
||||
}
|
||||
break;
|
||||
@ -287,9 +284,9 @@ ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff *skb)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ph->rate0) {
|
||||
ph->rate0 = 0;
|
||||
ph->try0 = 11;
|
||||
if (!ph->rate[0]) {
|
||||
ph->rate[0] = 0;
|
||||
ph->try[0] = 11;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(ieee80211_monitor_encap);
|
||||
|
@ -47,22 +47,6 @@
|
||||
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;
|
||||
u_int8_t rate1;
|
||||
u_int8_t rate2;
|
||||
u_int8_t rate3;
|
||||
|
||||
u_int8_t try0;
|
||||
u_int8_t try1;
|
||||
u_int8_t try2;
|
||||
u_int8_t try3;
|
||||
|
||||
u_int8_t power;
|
||||
u_int32_t flags;
|
||||
};
|
||||
|
||||
enum {
|
||||
DIDmsg_lnxind_wlansniffrm = 0x00000044,
|
||||
DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044,
|
||||
|
Loading…
Reference in New Issue
Block a user