Commit 3568a0a0 authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

staging: brcm80211: removed global var global_scb from softmac

Global variables are undesirable unless they are read only. Removed by
instead using an already defined Station Control Block variable in a
per-device structure.
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f9be7492
...@@ -314,7 +314,7 @@ static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu, ...@@ -314,7 +314,7 @@ static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,
static void brcms_c_scb_ampdu_update_config_all(struct ampdu_info *ampdu) static void brcms_c_scb_ampdu_update_config_all(struct ampdu_info *ampdu)
{ {
brcms_c_scb_ampdu_update_config(ampdu, ampdu->wlc->pub->global_scb); brcms_c_scb_ampdu_update_config(ampdu, &ampdu->wlc->pri_scb);
} }
static void brcms_c_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f) static void brcms_c_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f)
...@@ -482,7 +482,7 @@ brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, ...@@ -482,7 +482,7 @@ brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
struct scb_ampdu *scb_ampdu; struct scb_ampdu *scb_ampdu;
struct scb_ampdu_tid_ini *ini; struct scb_ampdu_tid_ini *ini;
struct ampdu_info *ampdu = wlc->ampdu; struct ampdu_info *ampdu = wlc->ampdu;
struct scb *scb = wlc->pub->global_scb; struct scb *scb = &wlc->pri_scb;
scb_ampdu = &scb->scb_ampdu; scb_ampdu = &scb->scb_ampdu;
if (!ampdu->ini_enable[tid]) { if (!ampdu->ini_enable[tid]) {
...@@ -542,7 +542,7 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi, ...@@ -542,7 +542,7 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
f = ampdu->fifo_tb + prio2fifo[tid]; f = ampdu->fifo_tb + prio2fifo[tid];
scb = wlc->pub->global_scb; scb = &wlc->pri_scb;
scb_ampdu = &scb->scb_ampdu; scb_ampdu = &scb->scb_ampdu;
ini = &scb_ampdu->ini[tid]; ini = &scb_ampdu->ini[tid];
......
...@@ -616,25 +616,14 @@ static int ...@@ -616,25 +616,14 @@ static int
brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta) struct ieee80211_sta *sta)
{ {
struct scb *scb;
int i;
struct brcms_info *wl = hw->priv; struct brcms_info *wl = hw->priv;
struct scb *scb = &wl->wlc->pri_scb;
/* Init the scb */ brcms_c_init_scb(scb);
scb = (struct scb *)sta->drv_priv;
memset(scb, 0, sizeof(struct scb));
for (i = 0; i < NUMPRIO; i++)
scb->seqctl[i] = 0xFFFF;
scb->seqctl_nonqos = 0xFFFF;
scb->magic = SCB_MAGIC;
wl->pub->global_scb = scb;
wl->pub->global_ampdu = &(scb->scb_ampdu); wl->pub->global_ampdu = &(scb->scb_ampdu);
wl->pub->global_ampdu->scb = scb; wl->pub->global_ampdu->scb = scb;
wl->pub->global_ampdu->max_pdu = 16; wl->pub->global_ampdu->max_pdu = 16;
brcmu_pktq_init(&scb->scb_ampdu.txq, AMPDU_MAX_SCB_TID,
AMPDU_MAX_SCB_TID * PKTQ_LEN_DEFAULT);
sta->ht_cap.ht_supported = true; sta->ht_cap.ht_supported = true;
sta->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; sta->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
...@@ -657,8 +646,8 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, ...@@ -657,8 +646,8 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw,
struct ieee80211_sta *sta, u16 tid, u16 *ssn, struct ieee80211_sta *sta, u16 tid, u16 *ssn,
u8 buf_size) u8 buf_size)
{ {
struct scb *scb = (struct scb *)sta->drv_priv;
struct brcms_info *wl = hw->priv; struct brcms_info *wl = hw->priv;
struct scb *scb = &wl->wlc->pri_scb;
int status; int status;
if (WARN_ON(scb->magic != SCB_MAGIC)) if (WARN_ON(scb->magic != SCB_MAGIC))
...@@ -1038,7 +1027,7 @@ static int ieee_hw_init(struct ieee80211_hw *hw) ...@@ -1038,7 +1027,7 @@ static int ieee_hw_init(struct ieee80211_hw *hw)
hw->rate_control_algorithm = "minstrel_ht"; hw->rate_control_algorithm = "minstrel_ht";
hw->sta_data_size = sizeof(struct scb); hw->sta_data_size = 0;
return ieee_hw_rate_init(hw); return ieee_hw_rate_init(hw);
} }
......
...@@ -882,7 +882,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) ...@@ -882,7 +882,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
if (tx_info->control.sta) if (tx_info->control.sta)
scb = (struct scb *)tx_info->control.sta->drv_priv; scb = &wlc->pri_scb;
if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs); brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs);
...@@ -3331,14 +3331,21 @@ static u16 brcms_c_init_chanspec(struct brcms_c_info *wlc) ...@@ -3331,14 +3331,21 @@ static u16 brcms_c_init_chanspec(struct brcms_c_info *wlc)
return chanspec; return chanspec;
} }
static struct scb global_scb; void brcms_c_init_scb(struct scb *scb)
static void brcms_c_init_scb(struct brcms_c_info *wlc, struct scb *scb)
{ {
int i; int i;
memset(scb, 0, sizeof(struct scb));
scb->flags = SCB_WMECAP | SCB_HTCAP; scb->flags = SCB_WMECAP | SCB_HTCAP;
for (i = 0; i < NUMPRIO; i++) for (i = 0; i < NUMPRIO; i++) {
scb->seqnum[i] = 0; scb->seqnum[i] = 0;
scb->seqctl[i] = 0xFFFF;
}
scb->seqctl_nonqos = 0xFFFF;
scb->magic = SCB_MAGIC;
brcmu_pktq_init(&scb->scb_ampdu.txq, AMPDU_MAX_SCB_TID,
AMPDU_MAX_SCB_TID * PKTQ_LEN_DEFAULT);
} }
/* d11 core init /* d11 core init
...@@ -3799,8 +3806,6 @@ void brcms_c_init(struct brcms_c_info *wlc) ...@@ -3799,8 +3806,6 @@ void brcms_c_init(struct brcms_c_info *wlc)
brcms_c_bandinit_ordered(wlc, chanspec); brcms_c_bandinit_ordered(wlc, chanspec);
brcms_c_init_scb(wlc, &global_scb);
/* init probe response timeout */ /* init probe response timeout */
brcms_c_write_shm(wlc, M_PRS_MAXTIME, wlc->prb_resp_timeout); brcms_c_write_shm(wlc, M_PRS_MAXTIME, wlc->prb_resp_timeout);
...@@ -7684,7 +7689,7 @@ void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, ...@@ -7684,7 +7689,7 @@ void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
{ {
u8 prio; u8 prio;
uint fifo; uint fifo;
struct scb *scb = &global_scb; struct scb *scb = &wlc->pri_scb;
struct ieee80211_hdr *d11_header = (struct ieee80211_hdr *)(sdu->data); struct ieee80211_hdr *d11_header = (struct ieee80211_hdr *)(sdu->data);
/* /*
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <brcmu_utils.h> #include <brcmu_utils.h>
#include "types.h" #include "types.h"
#include "d11.h" #include "d11.h"
#include "scb.h"
#define INVCHANNEL 255 /* invalid channel */ #define INVCHANNEL 255 /* invalid channel */
...@@ -483,6 +484,7 @@ struct brcms_txq_info { ...@@ -483,6 +484,7 @@ struct brcms_txq_info {
* tx_duty_cycle_cck: maximum allowed duty cycle for CCK. * tx_duty_cycle_cck: maximum allowed duty cycle for CCK.
* pkt_queue: txq for transmit packets. * pkt_queue: txq for transmit packets.
* wiphy: * wiphy:
* pri_scb: primary Station Control Block
*/ */
struct brcms_c_info { struct brcms_c_info {
struct brcms_pub *pub; struct brcms_pub *pub;
...@@ -610,6 +612,7 @@ struct brcms_c_info { ...@@ -610,6 +612,7 @@ struct brcms_c_info {
struct brcms_txq_info *pkt_queue; struct brcms_txq_info *pkt_queue;
struct wiphy *wiphy; struct wiphy *wiphy;
struct scb pri_scb;
}; };
/* antsel module specific state */ /* antsel module specific state */
...@@ -864,5 +867,6 @@ extern void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on); ...@@ -864,5 +867,6 @@ extern void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on);
extern void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant); extern void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant);
extern void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, extern void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw,
u8 stf_mode); u8 stf_mode);
extern void brcms_c_init_scb(struct scb *scb);
#endif /* _BRCM_MAIN_H_ */ #endif /* _BRCM_MAIN_H_ */
...@@ -144,7 +144,6 @@ struct brcms_bss_info { ...@@ -144,7 +144,6 @@ struct brcms_bss_info {
struct brcms_pub { struct brcms_pub {
struct brcms_c_info *wlc; struct brcms_c_info *wlc;
struct ieee80211_hw *ieee_hw; struct ieee80211_hw *ieee_hw;
struct scb *global_scb;
struct scb_ampdu *global_ampdu; struct scb_ampdu *global_ampdu;
uint mac80211_state; uint mac80211_state;
uint unit; /* device instance number */ uint unit; /* device instance number */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment