Skip to content

Commit

Permalink
staging: brcm80211: replaced some ieee80211 preprocessor constants pa…
Browse files Browse the repository at this point in the history
…rt 1

Code cleanup.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Roland Vossen authored and Greg Kroah-Hartman committed Jan 20, 2011
1 parent 392308d commit 3726ed4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
10 changes: 3 additions & 7 deletions drivers/staging/brcm80211/include/proto/802.11.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@
#define DOT11_A3_HDR_LEN 24
#define DOT11_A4_HDR_LEN 30
#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN
#define DOT11_FCS_LEN 4
#define DOT11_ICV_AES_LEN 8
#define DOT11_QOS_LEN 2

#define DOT11_IV_MAX_LEN 8

#define DOT11_MAX_SSID_LEN 32

#define DOT11_DEFAULT_RTS_LEN 2347

#define DOT11_MIN_FRAG_LEN 256
Expand Down Expand Up @@ -131,7 +128,6 @@ typedef struct wme_param_ie wme_param_ie_t;
#define FC_TYPE_SHIFT 2
#define FC_SUBTYPE_MASK 0xF0
#define FC_SUBTYPE_SHIFT 4
#define FC_MOREFRAG 0x400

#define SEQNUM_SHIFT 4
#define SEQNUM_MAX 0x1000
Expand All @@ -150,12 +146,12 @@ typedef struct wme_param_ie wme_param_ie_t;

#define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0)

#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK)
#define FC_KIND_MASK (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)

#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))

#define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT)
#define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT)
#define FC_SUBTYPE(fc) (((fc) & IEEE80211_FCTL_STYPE) >> FC_SUBTYPE_SHIFT)
#define FC_TYPE(fc) (((fc) & IEEE80211_FCTL_FTYPE) >> FC_TYPE_SHIFT)

#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/brcm80211/sys/wlc_ampdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
#define TX_SEQ_TO_INDEX(seq) ((seq) % AMPDU_TX_BA_MAX_WSIZE)

/* max possible overhead per mpdu in the ampdu; 3 is for roundup if needed */
#define AMPDU_MAX_MPDU_OVERHEAD (DOT11_FCS_LEN + DOT11_ICV_AES_LEN + AMPDU_DELIMITER_LEN + 3 \
#define AMPDU_MAX_MPDU_OVERHEAD (FCS_LEN + DOT11_ICV_AES_LEN +\
AMPDU_DELIMITER_LEN + 3\
+ DOT11_A4_HDR_LEN + DOT11_QOS_LEN + DOT11_IV_MAX_LEN)

#ifdef BCMDBG
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/sys/wlc_bsscfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct wlc_bsscfg {
bool sup_auth_pending; /* flag for auth timeout */
#endif
u8 SSID_len; /* the length of SSID */
u8 SSID[DOT11_MAX_SSID_LEN]; /* SSID string */
u8 SSID[IEEE80211_MAX_SSID_LEN]; /* SSID string */
struct scb *bcmc_scb[MAXBANDS]; /* one bcmc_scb per band */
s8 _idx; /* the index of this bsscfg,
* assigned at wlc_bsscfg_alloc()
Expand Down
30 changes: 15 additions & 15 deletions drivers/staging/brcm80211/sys/wlc_mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
* buffer length needed for wlc_format_ssid
* 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
*/
#define SSID_FMT_BUF_LEN ((4 * DOT11_MAX_SSID_LEN) + 1)
#define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1)

#define TIMER_INTERVAL_WATCHDOG 1000 /* watchdog timer, in unit of ms */
#define TIMER_INTERVAL_RADIOCHK 800 /* radio monitor timer, in unit of ms */
Expand Down Expand Up @@ -4963,8 +4963,8 @@ int wlc_format_ssid(char *buf, const unsigned char ssid[], uint ssid_len)
char *p = buf;
char *endp = buf + SSID_FMT_BUF_LEN;

if (ssid_len > DOT11_MAX_SSID_LEN)
ssid_len = DOT11_MAX_SSID_LEN;
if (ssid_len > IEEE80211_MAX_SSID_LEN)
ssid_len = IEEE80211_MAX_SSID_LEN;

for (i = 0; i < ssid_len; i++) {
c = (uint) ssid[i];
Expand Down Expand Up @@ -5708,7 +5708,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,

/* compute length of frame in bytes for use in PLCP computations */
len = pkttotlen(osh, p);
phylen = len + DOT11_FCS_LEN;
phylen = len + FCS_LEN;

/* If WEP enabled, add room in phylen for the additional bytes of
* ICV which MAC generates. We do NOT add the additional bytes to
Expand Down Expand Up @@ -6104,9 +6104,9 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
ASSERT(IS_ALIGNED((unsigned long)txh->RTSPhyHeader, sizeof(u16)));
rts_plcp = txh->RTSPhyHeader;
if (use_cts)
rts_phylen = DOT11_CTS_LEN + DOT11_FCS_LEN;
rts_phylen = DOT11_CTS_LEN + FCS_LEN;
else
rts_phylen = DOT11_RTS_LEN + DOT11_FCS_LEN;
rts_phylen = DOT11_RTS_LEN + FCS_LEN;

wlc_compute_plcp(wlc, rts_rspec[0], rts_phylen, rts_plcp);

Expand Down Expand Up @@ -6627,7 +6627,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
tx_rts_count =
(txs->status & TX_STATUS_RTS_RTX_MASK) >> TX_STATUS_RTS_RTX_SHIFT;

lastframe = (fc & FC_MOREFRAG) == 0;
lastframe = (fc & IEEE80211_FCTL_MOREFRAGS) == 0;

if (!lastframe) {
WL_ERROR("Not last frame!\n");
Expand Down Expand Up @@ -6945,7 +6945,7 @@ wlc_recvctl(struct wlc_info *wlc, struct osl_info *osh, d11rxhdr_t *rxh,
prep_mac80211_status(wlc, rxh, p, &rx_status);

/* mac header+body length, exclude CRC and plcp header */
len_mpdu = p->len - D11_PHY_HDR_LEN - DOT11_FCS_LEN;
len_mpdu = p->len - D11_PHY_HDR_LEN - FCS_LEN;
skb_pull(p, D11_PHY_HDR_LEN);
__skb_trim(p, len_mpdu);

Expand Down Expand Up @@ -7259,7 +7259,7 @@ wlc_calc_ba_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type)
/* BA len == 32 == 16(ctl hdr) + 4(ba len) + 8(bitmap) + 4(fcs) */
return wlc_calc_frame_time(wlc, rspec, preamble_type,
(DOT11_BA_LEN + DOT11_BA_BITMAP_LEN +
DOT11_FCS_LEN));
FCS_LEN));
}

static uint BCMFASTPATH
Expand All @@ -7278,7 +7278,7 @@ wlc_calc_ack_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type)
/* ACK frame len == 14 == 2(fc) + 2(dur) + 6(ra) + 4(fcs) */
dur =
wlc_calc_frame_time(wlc, rspec, preamble_type,
(DOT11_ACK_LEN + DOT11_FCS_LEN));
(DOT11_ACK_LEN + FCS_LEN));
return dur;
}

Expand Down Expand Up @@ -7647,7 +7647,7 @@ wlc_bcn_prb_template(struct wlc_info *wlc, uint type, ratespec_t bcn_rspec,
if (type == FC_BEACON && !MBSS_BCN_ENAB(cfg)) {
/* fill in PLCP */
wlc_compute_plcp(wlc, bcn_rspec,
(DOT11_MAC_HDR_LEN + body_len + DOT11_FCS_LEN),
(DOT11_MAC_HDR_LEN + body_len + FCS_LEN),
(u8 *) plcp);

}
Expand Down Expand Up @@ -7757,13 +7757,13 @@ void wlc_shm_ssid_upd(struct wlc_info *wlc, wlc_bsscfg_t *cfg)
{
u8 *ssidptr = cfg->SSID;
u16 base = M_SSID;
u8 ssidbuf[DOT11_MAX_SSID_LEN];
u8 ssidbuf[IEEE80211_MAX_SSID_LEN];

/* padding the ssid with zero and copy it into shm */
memset(ssidbuf, 0, DOT11_MAX_SSID_LEN);
memset(ssidbuf, 0, IEEE80211_MAX_SSID_LEN);
bcopy(ssidptr, ssidbuf, cfg->SSID_len);

wlc_copyto_shm(wlc, base, ssidbuf, DOT11_MAX_SSID_LEN);
wlc_copyto_shm(wlc, base, ssidbuf, IEEE80211_MAX_SSID_LEN);

if (!MBSS_BCN_ENAB(cfg))
wlc_write_shm(wlc, M_SSIDLEN, (u16) cfg->SSID_len);
Expand Down Expand Up @@ -7812,7 +7812,7 @@ wlc_bss_update_probe_resp(struct wlc_info *wlc, wlc_bsscfg_t *cfg, bool suspend)
* Use the actual frame length covered by the PLCP header for the call to
* wlc_mod_prb_rsp_rate_table() by subtracting the PLCP len and adding the FCS.
*/
len += (-D11_PHY_HDR_LEN + DOT11_FCS_LEN);
len += (-D11_PHY_HDR_LEN + FCS_LEN);
wlc_mod_prb_rsp_rate_table(wlc, (u16) len);

if (suspend)
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/sys/wlc_pub.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct rsn_parms {
* buffer length needed for wlc_format_ssid
* 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
*/
#define SSID_FMT_BUF_LEN ((4 * DOT11_MAX_SSID_LEN) + 1)
#define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1)

#define RSN_FLAGS_SUPPORTED 0x1 /* Flag for rsn_params */
#define RSN_FLAGS_PREAUTH 0x2 /* Flag for WPA2 rsn_params */
Expand Down

0 comments on commit 3726ed4

Please sign in to comment.