Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e9796f9 authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman
Browse files

staging: brcm80211: replaced struct dot11_header by struct ieee80211_hdr



Code cleanup. Replaced Broadcom specific structure by its Linux equivalent.

Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f3dc3ea4
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line Diff line number Diff line
@@ -44,16 +44,6 @@


#define DOT11_OUI_LEN			3
#define DOT11_OUI_LEN			3


struct dot11_header {
	u16 fc;
	u16 durid;
	u8 a1[ETH_ALEN];
	u8 a2[ETH_ALEN];
	u8 a3[ETH_ALEN];
	u16 seq;
	u8 a4[ETH_ALEN];
} __attribute__((packed));

#define	DOT11_RTS_LEN		16
#define	DOT11_RTS_LEN		16
#define	DOT11_CTS_LEN		10
#define	DOT11_CTS_LEN		10
#define	DOT11_ACK_LEN		10
#define	DOT11_ACK_LEN		10
+9 −9
Original line number Original line Diff line number Diff line
@@ -154,10 +154,10 @@ static void wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu,
static inline u16 pkt_txh_seqnum(struct wlc_info *wlc, struct sk_buff *p)
static inline u16 pkt_txh_seqnum(struct wlc_info *wlc, struct sk_buff *p)
{
{
	d11txh_t *txh;
	d11txh_t *txh;
	struct dot11_header *h;
	struct ieee80211_hdr *h;
	txh = (d11txh_t *) p->data;
	txh = (d11txh_t *) p->data;
	h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
	h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
	return ltoh16(h->seq) >> SEQNUM_SHIFT;
	return ltoh16(h->seq_ctrl) >> SEQNUM_SHIFT;
}
}


struct ampdu_info *wlc_ampdu_attach(struct wlc_info *wlc)
struct ampdu_info *wlc_ampdu_attach(struct wlc_info *wlc)
@@ -510,7 +510,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
	u32 ampdu_len, maxlen = 0;
	u32 ampdu_len, maxlen = 0;
	d11txh_t *txh = NULL;
	d11txh_t *txh = NULL;
	u8 *plcp;
	u8 *plcp;
	struct dot11_header *h;
	struct ieee80211_hdr *h;
	struct scb *scb;
	struct scb *scb;
	scb_ampdu_t *scb_ampdu;
	scb_ampdu_t *scb_ampdu;
	scb_ampdu_tid_ini_t *ini;
	scb_ampdu_tid_ini_t *ini;
@@ -596,8 +596,8 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
		ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
		ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
		txh = (d11txh_t *) p->data;
		txh = (d11txh_t *) p->data;
		plcp = (u8 *) (txh + 1);
		plcp = (u8 *) (txh + 1);
		h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN);
		h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN);
		seq = ltoh16(h->seq) >> SEQNUM_SHIFT;
		seq = ltoh16(h->seq_ctrl) >> SEQNUM_SHIFT;
		index = TX_SEQ_TO_INDEX(seq);
		index = TX_SEQ_TO_INDEX(seq);


		/* check mcl fields and test whether it can be agg'd */
		/* check mcl fields and test whether it can be agg'd */
@@ -968,7 +968,7 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
	u8 bitmap[8], queue, tid;
	u8 bitmap[8], queue, tid;
	d11txh_t *txh;
	d11txh_t *txh;
	u8 *plcp;
	u8 *plcp;
	struct dot11_header *h;
	struct ieee80211_hdr *h;
	u16 seq, start_seq = 0, bindex, index, mcl;
	u16 seq, start_seq = 0, bindex, index, mcl;
	u8 mcs = 0;
	u8 mcs = 0;
	bool ba_recd = false, ack_recd = false;
	bool ba_recd = false, ack_recd = false;
@@ -1089,8 +1089,8 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
		txh = (d11txh_t *) p->data;
		txh = (d11txh_t *) p->data;
		mcl = ltoh16(txh->MacTxControlLow);
		mcl = ltoh16(txh->MacTxControlLow);
		plcp = (u8 *) (txh + 1);
		plcp = (u8 *) (txh + 1);
		h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN);
		h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN);
		seq = ltoh16(h->seq) >> SEQNUM_SHIFT;
		seq = ltoh16(h->seq_ctrl) >> SEQNUM_SHIFT;


		if (tot_mpdu == 0) {
		if (tot_mpdu == 0) {
			mcs = plcp[0] & MIMO_PLCP_MCS_MASK;
			mcs = plcp[0] & MIMO_PLCP_MCS_MASK;
+33 −33
Original line number Original line Diff line number Diff line
@@ -1742,7 +1742,7 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode,
	ASSERT(sizeof(cck_phy_hdr_t) == D11_PHY_HDR_LEN);
	ASSERT(sizeof(cck_phy_hdr_t) == D11_PHY_HDR_LEN);
	ASSERT(sizeof(d11txh_t) == D11_TXH_LEN);
	ASSERT(sizeof(d11txh_t) == D11_TXH_LEN);
	ASSERT(sizeof(d11rxhdr_t) == RXHDR_LEN);
	ASSERT(sizeof(d11rxhdr_t) == RXHDR_LEN);
	ASSERT(sizeof(struct dot11_header) == DOT11_A4_HDR_LEN);
	ASSERT(sizeof(struct ieee80211_hdr) == DOT11_A4_HDR_LEN);
	ASSERT(sizeof(struct ieee80211_rts) == DOT11_RTS_LEN);
	ASSERT(sizeof(struct ieee80211_rts) == DOT11_RTS_LEN);
	ASSERT(sizeof(struct dot11_management_header) == DOT11_MGMT_HDR_LEN);
	ASSERT(sizeof(struct dot11_management_header) == DOT11_MGMT_HDR_LEN);
	ASSERT(sizeof(struct dot11_bcn_prb) == DOT11_BCN_PRB_LEN);
	ASSERT(sizeof(struct dot11_bcn_prb) == DOT11_BCN_PRB_LEN);
@@ -5120,12 +5120,12 @@ wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu,
	uint fifo;
	uint fifo;
	void *pkt;
	void *pkt;
	struct scb *scb = &global_scb;
	struct scb *scb = &global_scb;
	struct dot11_header *d11_header = (struct dot11_header *)(sdu->data);
	struct ieee80211_hdr *d11_header = (struct ieee80211_hdr *)(sdu->data);
	u16 type, fc;
	u16 type, fc;


	ASSERT(sdu);
	ASSERT(sdu);


	fc = ltoh16(d11_header->fc);
	fc = ltoh16(d11_header->frame_control);
	type = FC_TYPE(fc);
	type = FC_TYPE(fc);


	/* 802.11 standard requires management traffic to go at highest priority */
	/* 802.11 standard requires management traffic to go at highest priority */
@@ -5658,7 +5658,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
		     uint nfrags, uint queue, uint next_frag_len,
		     uint nfrags, uint queue, uint next_frag_len,
		     wsec_key_t *key, ratespec_t rspec_override)
		     wsec_key_t *key, ratespec_t rspec_override)
{
{
	struct dot11_header *h;
	struct ieee80211_hdr *h;
	d11txh_t *txh;
	d11txh_t *txh;
	u8 *plcp, plcp_fallback[D11_PHY_HDR_LEN];
	u8 *plcp, plcp_fallback[D11_PHY_HDR_LEN];
	struct osl_info *osh;
	struct osl_info *osh;
@@ -5701,8 +5701,8 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
	osh = wlc->osh;
	osh = wlc->osh;


	/* locate 802.11 MAC header */
	/* locate 802.11 MAC header */
	h = (struct dot11_header *)(p->data);
	h = (struct ieee80211_hdr *)(p->data);
	fc = ltoh16(h->fc);
	fc = ltoh16(h->frame_control);
	type = FC_TYPE(fc);
	type = FC_TYPE(fc);


	qos = (type == FC_TYPE_DATA && FC_SUBTYPE_ANY_QOS(FC_SUBTYPE(fc)));
	qos = (type == FC_TYPE_DATA && FC_SUBTYPE_ANY_QOS(FC_SUBTYPE(fc)));
@@ -5748,7 +5748,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
			/* extract fragment number from frame first */
			/* extract fragment number from frame first */
			seq = ltoh16(seq) & FRAGNUM_MASK;
			seq = ltoh16(seq) & FRAGNUM_MASK;
			seq |= (SCB_SEQNUM(scb, p->priority) << SEQNUM_SHIFT);
			seq |= (SCB_SEQNUM(scb, p->priority) << SEQNUM_SHIFT);
			h->seq = htol16(seq);
			h->seq_ctrl = htol16(seq);


			frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
			frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
			    (queue & TXFID_QUEUE_MASK);
			    (queue & TXFID_QUEUE_MASK);
@@ -5818,7 +5818,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
			rspec[k] = WLC_RATE_1M;
			rspec[k] = WLC_RATE_1M;
		} else {
		} else {
			if (WLANTSEL_ENAB(wlc) &&
			if (WLANTSEL_ENAB(wlc) &&
			    !is_multicast_ether_addr(h->a1)) {
			    !is_multicast_ether_addr(h->addr1)) {
				/* set tx antenna config */
				/* set tx antenna config */
				wlc_antsel_antcfg_get(wlc->asi, false, false, 0,
				wlc_antsel_antcfg_get(wlc->asi, false, false, 0,
						      0, &antcfg, &fbantcfg);
						      0, &antcfg, &fbantcfg);
@@ -5981,11 +5981,11 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,


	/* DUR field for main rate */
	/* DUR field for main rate */
	if ((fc != FC_PS_POLL) &&
	if ((fc != FC_PS_POLL) &&
	    !is_multicast_ether_addr(h->a1) && !use_rifs) {
	    !is_multicast_ether_addr(h->addr1) && !use_rifs) {
		durid =
		durid =
		    wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0],
		    wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0],
					  next_frag_len);
					  next_frag_len);
		h->durid = htol16(durid);
		h->duration_id = htol16(durid);
	} else if (use_rifs) {
	} else if (use_rifs) {
		/* NAV protect to end of next max packet size */
		/* NAV protect to end of next max packet size */
		durid =
		durid =
@@ -5993,13 +5993,13 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
						 preamble_type[0],
						 preamble_type[0],
						 DOT11_MAX_FRAG_LEN);
						 DOT11_MAX_FRAG_LEN);
		durid += RIFS_11N_TIME;
		durid += RIFS_11N_TIME;
		h->durid = htol16(durid);
		h->duration_id = htol16(durid);
	}
	}


	/* DUR field for fallback rate */
	/* DUR field for fallback rate */
	if (fc == FC_PS_POLL)
	if (fc == FC_PS_POLL)
		txh->FragDurFallback = h->durid;
		txh->FragDurFallback = h->duration_id;
	else if (is_multicast_ether_addr(h->a1) || use_rifs)
	else if (is_multicast_ether_addr(h->addr1) || use_rifs)
		txh->FragDurFallback = 0;
		txh->FragDurFallback = 0;
	else {
	else {
		durid = wlc_compute_frame_dur(wlc, rspec[1],
		durid = wlc_compute_frame_dur(wlc, rspec[1],
@@ -6011,7 +6011,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
	if (frag == 0)
	if (frag == 0)
		mcl |= TXC_STARTMSDU;
		mcl |= TXC_STARTMSDU;


	if (!is_multicast_ether_addr(h->a1))
	if (!is_multicast_ether_addr(h->addr1))
		mcl |= TXC_IMMEDACK;
		mcl |= TXC_IMMEDACK;


	if (BAND_5G(wlc->band->bandtype))
	if (BAND_5G(wlc->band->bandtype))
@@ -6039,14 +6039,14 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
	}
	}


	/* MacFrameControl */
	/* MacFrameControl */
	bcopy((char *)&h->fc, (char *)&txh->MacFrameControl, sizeof(u16));
	bcopy((char *)&h->frame_control, (char *)&txh->MacFrameControl,

	    sizeof(u16));
	txh->TxFesTimeNormal = htol16(0);
	txh->TxFesTimeNormal = htol16(0);


	txh->TxFesTimeFallback = htol16(0);
	txh->TxFesTimeFallback = htol16(0);


	/* TxFrameRA */
	/* TxFrameRA */
	bcopy((char *)&h->a1, (char *)&txh->TxFrameRA, ETH_ALEN);
	bcopy((char *)&h->addr1, (char *)&txh->TxFrameRA, ETH_ALEN);


	/* TxFrameID */
	/* TxFrameID */
	txh->TxFrameID = htol16(frameid);
	txh->TxFrameID = htol16(frameid);
@@ -6133,10 +6133,10 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,


		if (use_cts) {
		if (use_cts) {
			rts->frame_control = htol16(FC_CTS);
			rts->frame_control = htol16(FC_CTS);
			bcopy((char *)&h->a2, (char *)&rts->ra, ETH_ALEN);
			bcopy((char *)&h->addr2, (char *)&rts->ra, ETH_ALEN);
		} else {
		} else {
			rts->frame_control = htol16((u16) FC_RTS);
			rts->frame_control = htol16((u16) FC_RTS);
			bcopy((char *)&h->a1, (char *)&rts->ra,
			bcopy((char *)&h->addr1, (char *)&rts->ra,
			      2 * ETH_ALEN);
			      2 * ETH_ALEN);
		}
		}


@@ -6240,7 +6240,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
	if (SCB_WME(scb) && qos && wlc->edcf_txop[ac]) {
	if (SCB_WME(scb) && qos && wlc->edcf_txop[ac]) {
		uint frag_dur, dur, dur_fallback;
		uint frag_dur, dur, dur_fallback;


		ASSERT(!is_multicast_ether_addr(h->a1));
		ASSERT(!is_multicast_ether_addr(h->addr1));


		/* WME: Update TXOP threshold */
		/* WME: Update TXOP threshold */
		if ((!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) && (frag == 0)) {
		if ((!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) && (frag == 0)) {
@@ -6542,7 +6542,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
	int tx_rts, tx_frame_count, tx_rts_count;
	int tx_rts, tx_frame_count, tx_rts_count;
	uint totlen, supr_status;
	uint totlen, supr_status;
	bool lastframe;
	bool lastframe;
	struct dot11_header *h;
	struct ieee80211_hdr *h;
	u16 fc;
	u16 fc;
	u16 mcl;
	u16 mcl;
	struct ieee80211_tx_info *tx_info;
	struct ieee80211_tx_info *tx_info;
@@ -6598,8 +6598,8 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
		goto fatal;
		goto fatal;


	tx_info = IEEE80211_SKB_CB(p);
	tx_info = IEEE80211_SKB_CB(p);
	h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
	h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
	fc = ltoh16(h->fc);
	fc = ltoh16(h->frame_control);


	scb = (struct scb *)tx_info->control.sta->drv_priv;
	scb = (struct scb *)tx_info->control.sta->drv_priv;


@@ -6995,7 +6995,7 @@ void wlc_bss_list_free(struct wlc_info *wlc, wlc_bss_list_t *bss_list)
void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
{
{
	d11rxhdr_t *rxh;
	d11rxhdr_t *rxh;
	struct dot11_header *h;
	struct ieee80211_hdr *h;
	struct osl_info *osh;
	struct osl_info *osh;
	u16 fc;
	u16 fc;
	uint len;
	uint len;
@@ -7025,7 +7025,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
		skb_pull(p, 2);
		skb_pull(p, 2);
	}
	}


	h = (struct dot11_header *)(p->data + D11_PHY_HDR_LEN);
	h = (struct ieee80211_hdr *)(p->data + D11_PHY_HDR_LEN);
	len = p->len;
	len = p->len;


	if (rxh->RxStatus1 & RXS_FCSERR) {
	if (rxh->RxStatus1 & RXS_FCSERR) {
@@ -7039,8 +7039,8 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
	}
	}


	/* check received pkt has at least frame control field */
	/* check received pkt has at least frame control field */
	if (len >= D11_PHY_HDR_LEN + sizeof(h->fc)) {
	if (len >= D11_PHY_HDR_LEN + sizeof(h->frame_control)) {
		fc = ltoh16(h->fc);
		fc = ltoh16(h->frame_control);
	} else {
	} else {
		WLCNTINCR(wlc->pub->_cnt->rxrunt);
		WLCNTINCR(wlc->pub->_cnt->rxrunt);
		goto toss;
		goto toss;
@@ -7052,10 +7052,10 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
	if (!is_amsdu) {
	if (!is_amsdu) {
		/* CTS and ACK CTL frames are w/o a2 */
		/* CTS and ACK CTL frames are w/o a2 */
		if (FC_TYPE(fc) == FC_TYPE_DATA || FC_TYPE(fc) == FC_TYPE_MNG) {
		if (FC_TYPE(fc) == FC_TYPE_DATA || FC_TYPE(fc) == FC_TYPE_MNG) {
			if ((is_zero_ether_addr(h->a2) ||
			if ((is_zero_ether_addr(h->addr2) ||
			     is_multicast_ether_addr(h->a2))) {
			     is_multicast_ether_addr(h->addr2))) {
				WL_ERROR("wl%d: %s: dropping a frame with invalid src mac address, a2: %pM\n",
				WL_ERROR("wl%d: %s: dropping a frame with invalid src mac address, a2: %pM\n",
					 wlc->pub->unit, __func__, &h->a2);
					 wlc->pub->unit, __func__, &h->addr2);
				WLCNTINCR(wlc->pub->_cnt->rxbadsrcmac);
				WLCNTINCR(wlc->pub->_cnt->rxbadsrcmac);
				goto toss;
				goto toss;
			}
			}
@@ -7829,7 +7829,7 @@ int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifop)
	struct osl_info *osh;
	struct osl_info *osh;
	uint fifo;
	uint fifo;
	d11txh_t *txh;
	d11txh_t *txh;
	struct dot11_header *h;
	struct ieee80211_hdr *h;
	struct scb *scb;
	struct scb *scb;
	u16 fc;
	u16 fc;


@@ -7838,9 +7838,9 @@ int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifop)
	ASSERT(pdu);
	ASSERT(pdu);
	txh = (d11txh_t *) (pdu->data);
	txh = (d11txh_t *) (pdu->data);
	ASSERT(txh);
	ASSERT(txh);
	h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
	h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
	ASSERT(h);
	ASSERT(h);
	fc = ltoh16(h->fc);
	fc = ltoh16(h->frame_control);


	/* get the pkt queue info. This was put at wlc_sendctl or wlc_send for PDU */
	/* get the pkt queue info. This was put at wlc_sendctl or wlc_send for PDU */
	fifo = ltoh16(txh->TxFrameID) & TXFID_QUEUE_MASK;
	fifo = ltoh16(txh->TxFrameID) & TXFID_QUEUE_MASK;