diff options
Diffstat (limited to 'drivers/staging/brcm80211/sys')
30 files changed, 1889 insertions, 3334 deletions
diff --git a/drivers/staging/brcm80211/sys/wl_dbg.h b/drivers/staging/brcm80211/sys/wl_dbg.h index e63b27e..54af257 100644 --- a/drivers/staging/brcm80211/sys/wl_dbg.h +++ b/drivers/staging/brcm80211/sys/wl_dbg.h @@ -20,15 +20,20 @@ /* wl_msg_level is a bit vector with defs in wlioctl.h */ extern u32 wl_msg_level; -#define WL_PRINT(args) printf args -#define WL_NONE(args) +#define WL_NONE(fmt, args...) no_printk(fmt, ##args) + +#define WL_PRINT(level, fmt, args...) \ +do { \ + if (wl_msg_level & level) \ + printk(fmt, ##args); \ +} while (0) #ifdef BCMDBG -#define WL_ERROR(args) do {if ((wl_msg_level & WL_ERROR_VAL)) WL_PRINT(args); } while (0) -#define WL_TRACE(args) do {if (wl_msg_level & WL_TRACE_VAL) WL_PRINT(args); } while (0) -#define WL_AMPDU(args) do {if (wl_msg_level & WL_AMPDU_VAL) WL_PRINT(args); } while (0) -#define WL_FFPLD(args) do {if (wl_msg_level & WL_FFPLD_VAL) WL_PRINT(args); } while (0) +#define WL_ERROR(fmt, args...) WL_PRINT(WL_ERROR_VAL, fmt, ##args) +#define WL_TRACE(fmt, args...) WL_PRINT(WL_TRACE_VAL, fmt, ##args) +#define WL_AMPDU(fmt, args...) WL_PRINT(WL_AMPDU_VAL, fmt, ##args) +#define WL_FFPLD(fmt, args...) WL_PRINT(WL_FFPLD_VAL, fmt, ##args) #define WL_ERROR_ON() (wl_msg_level & WL_ERROR_VAL) @@ -44,35 +49,50 @@ extern u32 wl_msg_level; extern u32 wl_ampdu_dbg; -#define WL_AMPDU_UPDN(args) do {if (wl_ampdu_dbg & WL_AMPDU_UPDN_VAL) {WL_AMPDU(args); } } while (0) -#define WL_AMPDU_RX(args) do {if (wl_ampdu_dbg & WL_AMPDU_RX_VAL) {WL_AMPDU(args); } } while (0) -#define WL_AMPDU_ERR(args) do {if (wl_ampdu_dbg & WL_AMPDU_ERR_VAL) {WL_AMPDU(args); } } while (0) -#define WL_AMPDU_TX(args) do {if (wl_ampdu_dbg & WL_AMPDU_TX_VAL) {WL_AMPDU(args); } } while (0) -#define WL_AMPDU_CTL(args) do {if (wl_ampdu_dbg & WL_AMPDU_CTL_VAL) {WL_AMPDU(args); } } while (0) -#define WL_AMPDU_HW(args) do {if (wl_ampdu_dbg & WL_AMPDU_HW_VAL) {WL_AMPDU(args); } } while (0) -#define WL_AMPDU_HWTXS(args) do {if (wl_ampdu_dbg & WL_AMPDU_HWTXS_VAL) {WL_AMPDU(args); } } while (0) -#define WL_AMPDU_HWDBG(args) do {if (wl_ampdu_dbg & WL_AMPDU_HWDBG_VAL) {WL_AMPDU(args); } } while (0) +#define WL_AMPDU_PRINT(level, fmt, args...) \ +do { \ + if (wl_ampdu_dbg & level) { \ + WL_AMPDU(fmt, ##args); \ + } \ +} while (0) + +#define WL_AMPDU_UPDN(fmt, args...) \ + WL_AMPDU_PRINT(WL_AMPDU_UPDN_VAL, fmt, ##args) +#define WL_AMPDU_RX(fmt, args...) \ + WL_AMPDU_PRINT(WL_AMPDU_RX_VAL, fmt, ##args) +#define WL_AMPDU_ERR(fmt, args...) \ + WL_AMPDU_PRINT(WL_AMPDU_ERR_VAL, fmt, ##args) +#define WL_AMPDU_TX(fmt, args...) \ + WL_AMPDU_PRINT(WL_AMPDU_TX_VAL, fmt, ##args) +#define WL_AMPDU_CTL(fmt, args...) \ + WL_AMPDU_PRINT(WL_AMPDU_CTL_VAL, fmt, ##args) +#define WL_AMPDU_HW(fmt, args...) \ + WL_AMPDU_PRINT(WL_AMPDU_HW_VAL, fmt, ##args) +#define WL_AMPDU_HWTXS(fmt, args...) \ + WL_AMPDU_PRINT(WL_AMPDU_HWTXS_VAL, fmt, ##args) +#define WL_AMPDU_HWDBG(fmt, args...) \ + WL_AMPDU_PRINT(WL_AMPDU_HWDBG_VAL, fmt, ##args) #define WL_AMPDU_ERR_ON() (wl_ampdu_dbg & WL_AMPDU_ERR_VAL) #define WL_AMPDU_HW_ON() (wl_ampdu_dbg & WL_AMPDU_HW_VAL) #define WL_AMPDU_HWTXS_ON() (wl_ampdu_dbg & WL_AMPDU_HWTXS_VAL) #else /* BCMDBG */ -#define WL_ERROR(args) -#define WL_TRACE(args) -#define WL_AMPDU(args) -#define WL_FFPLD(args) +#define WL_ERROR(fmt, args...) no_printk(fmt, ##args) +#define WL_TRACE(fmt, args...) no_printk(fmt, ##args) +#define WL_AMPDU(fmt, args...) no_printk(fmt, ##args) +#define WL_FFPLD(fmt, args...) no_printk(fmt, ##args) #define WL_ERROR_ON() 0 -#define WL_AMPDU_UPDN(args) -#define WL_AMPDU_RX(args) -#define WL_AMPDU_ERR(args) -#define WL_AMPDU_TX(args) -#define WL_AMPDU_CTL(args) -#define WL_AMPDU_HW(args) -#define WL_AMPDU_HWTXS(args) -#define WL_AMPDU_HWDBG(args) +#define WL_AMPDU_UPDN(fmt, args...) no_printk(fmt, ##args) +#define WL_AMPDU_RX(fmt, args...) no_printk(fmt, ##args) +#define WL_AMPDU_ERR(fmt, args...) no_printk(fmt, ##args) +#define WL_AMPDU_TX(fmt, args...) no_printk(fmt, ##args) +#define WL_AMPDU_CTL(fmt, args...) no_printk(fmt, ##args) +#define WL_AMPDU_HW(fmt, args...) no_printk(fmt, ##args) +#define WL_AMPDU_HWTXS(fmt, args...) no_printk(fmt, ##args) +#define WL_AMPDU_HWDBG(fmt, args...) no_printk(fmt, ##args) #define WL_AMPDU_ERR_ON() 0 #define WL_AMPDU_HW_ON() 0 #define WL_AMPDU_HWTXS_ON() 0 diff --git a/drivers/staging/brcm80211/sys/wl_export.h b/drivers/staging/brcm80211/sys/wl_export.h index 08442f8..aa8b5a3 100644 --- a/drivers/staging/brcm80211/sys/wl_export.h +++ b/drivers/staging/brcm80211/sys/wl_export.h @@ -45,10 +45,10 @@ extern void wl_add_timer(struct wl_info *wl, struct wl_timer *timer, uint ms, int periodic); extern bool wl_del_timer(struct wl_info *wl, struct wl_timer *timer); -extern uint wl_buf_to_pktcopy(osl_t *osh, void *p, unsigned char *buf, int len, - uint offset); -extern void *wl_get_pktbuffer(osl_t *osh, int len); -extern int wl_set_pktlen(osl_t *osh, void *p, int len); +extern uint wl_buf_to_pktcopy(struct osl_info *osh, void *p, unsigned char *buf, + int len, uint offset); +extern void *wl_get_pktbuffer(struct osl_info *osh, int len); +extern int wl_set_pktlen(struct osl_info *osh, void *p, int len); #define wl_sort_bsslist(a, b) false diff --git a/drivers/staging/brcm80211/sys/wl_mac80211.c b/drivers/staging/brcm80211/sys/wl_mac80211.c index d060377..bdd629d 100644 --- a/drivers/staging/brcm80211/sys/wl_mac80211.c +++ b/drivers/staging/brcm80211/sys/wl_mac80211.c @@ -21,72 +21,36 @@ #include <linux/string.h> #include <linux/pci_ids.h> #include <bcmdefs.h> -#include <linuxver.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/sched.h> #include <osl.h> #define WLC_MAXBSSCFG 1 /* single BSS configs */ #include <wlc_cfg.h> #include <net/mac80211.h> -#include <epivers.h> -#ifndef WLC_HIGH_ONLY #include <phy_version.h> -#endif #include <bcmutils.h> #include <pcicfg.h> #include <wlioctl.h> #include <wlc_key.h> +#include <sbhndpio.h> +#include <sbhnddma.h> #include <wlc_channel.h> #include <wlc_pub.h> #include <wlc_scb.h> #include <wl_dbg.h> -#ifdef BCMSDIO -#include <bcmsdh.h> -#endif #include <wl_export.h> -#ifdef WLC_HIGH_ONLY -#include "dbus.h" -#include "bcm_rpc_tp.h" -#include "bcm_rpc.h" -#include "bcm_xdr.h" -#include "wlc_rpc.h" -#endif #include <wl_mac80211.h> #include <linux/firmware.h> -#ifndef WLC_HIGH_ONLY #include <wl_ucode.h> #include <d11ucode_ext.h> -#endif -#ifdef BCMSDIO -extern struct device *sdiommc_dev; -#endif - -extern void wlc_wme_setparams(wlc_info_t *wlc, u16 aci, void *arg, - bool suspend); -bool wlc_sendpkt_mac80211(wlc_info_t *wlc, void *sdu, struct ieee80211_hw *hw); -void wlc_mac_bcn_promisc_change(wlc_info_t *wlc, bool promisc); -void wlc_set_addrmatch(wlc_info_t *wlc, int match_reg_offset, - const struct ether_addr *addr); static void wl_timer(unsigned long data); static void _wl_timer(wl_timer_t *t); -#ifdef WLC_HIGH_ONLY -#define RPCQ_LOCK(_wl, _flags) spin_lock_irqsave(&(_wl)->rpcq_lock, (_flags)) -#define RPCQ_UNLOCK(_wl, _flags) spin_unlock_irqrestore(&(_wl)->rpcq_lock, (_flags)) -#define TXQ_LOCK(_wl, _flags) spin_lock_irqsave(&(_wl)->txq_lock, (_flags)) -#define TXQ_UNLOCK(_wl, _flags) spin_unlock_irqrestore(&(_wl)->txq_lock, (_flags)) -static void wl_rpc_down(void *wlh); -static void wl_rpcq_free(wl_info_t *wl); -static void wl_rpcq_dispatch(struct wl_task *task); -static void wl_rpc_dispatch_schedule(void *ctx, struct rpc_buf *buf); -static void wl_start_txqwork(struct wl_task *task); -static void wl_txq_free(wl_info_t *wl); -static void wl_timer_task(wl_task_t *task); -static int wl_schedule_task(wl_info_t *wl, void (*fn) (struct wl_task *), - void *context); -#endif /* WLC_HIGH_ONLY */ static int ieee_hw_init(struct ieee80211_hw *hw); static int ieee_hw_rate_init(struct ieee80211_hw *hw); @@ -134,16 +98,14 @@ struct ieee80211_tkip_data { u8 rx_hdr[16], tx_hdr[16]; }; -#ifndef WLC_HIGH_ONLY -#define WL_DEV_IF(dev) ((wl_if_t *)netdev_priv(dev)) -#define WL_INFO(dev) ((wl_info_t *)(WL_DEV_IF(dev)->wl)) /* points to wl */ -static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev); -static void wl_release_fw(wl_info_t *wl); -#endif +#define WL_DEV_IF(dev) ((struct wl_if *)netdev_priv(dev)) +#define WL_INFO(dev) ((struct wl_info *)(WL_DEV_IF(dev)->wl)) +static int wl_request_fw(struct wl_info *wl, struct pci_dev *pdev); +static void wl_release_fw(struct wl_info *wl); /* local prototypes */ -static int wl_start(struct sk_buff *skb, wl_info_t *wl); -static int wl_start_int(wl_info_t *wl, struct ieee80211_hw *hw, +static int wl_start(struct sk_buff *skb, struct wl_info *wl); +static int wl_start_int(struct wl_info *wl, struct ieee80211_hw *hw, struct sk_buff *skb); static void wl_dpc(unsigned long data); @@ -152,7 +114,6 @@ MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver."); MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN cards"); MODULE_LICENSE("Dual BSD/GPL"); -#ifndef BCMSDIO /* recognized PCI IDs */ static struct pci_device_id wl_id_table[] = { {PCI_VENDOR_ID_BROADCOM, 0x4357, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* 43225 2G */ @@ -163,55 +124,18 @@ static struct pci_device_id wl_id_table[] = { MODULE_DEVICE_TABLE(pci, wl_id_table); static void wl_remove(struct pci_dev *pdev); -#endif /* !BCMSDIO */ -#ifdef BCMSDIO -static uint sd_drivestrength = 6; -module_param(sd_drivestrength, uint, 0); -#endif #ifdef BCMDBG static int msglevel = 0xdeadbeef; module_param(msglevel, int, 0); -#ifndef WLC_HIGH_ONLY static int phymsglevel = 0xdeadbeef; module_param(phymsglevel, int, 0); -#endif /* WLC_HIGH_ONLY */ #endif /* BCMDBG */ -static int oneonly; -module_param(oneonly, int, 0); - -static int piomode; -module_param(piomode, int, 0); - -static int instance_base; /* Starting instance number */ -module_param(instance_base, int, 0); - -#if defined(BCMDBG) -static char *macaddr; -module_param(macaddr, charp, S_IRUGO); -#endif - -static int nompc = 1; -module_param(nompc, int, 0); - -static char name[IFNAMSIZ] = "eth%d"; -module_param_string(name, name, IFNAMSIZ, 0); - -#ifndef SRCBASE -#define SRCBASE "." -#endif - -#define WL_MAGIC 0xdeadbeef - #define HW_TO_WL(hw) (hw->priv) #define WL_TO_HW(wl) (wl->pub->ieee_hw) -#ifdef WLC_HIGH_ONLY -static int wl_ops_tx_nl(struct ieee80211_hw *hw, struct sk_buff *skb); -#else static int wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb); -#endif static int wl_ops_start(struct ieee80211_hw *hw); static void wl_ops_stop(struct ieee80211_hw *hw); static int wl_ops_add_interface(struct ieee80211_hw *hw, @@ -249,28 +173,13 @@ static int wl_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum ieee80211_ampdu_mlme_action action, struct ieee80211_sta *sta, u16 tid, u16 *ssn); -#ifdef WLC_HIGH_ONLY -static int wl_ops_tx_nl(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - int status; - wl_info_t *wl = hw->priv; - if (!wl->pub->up) { - WL_ERROR(("ops->tx called while down\n")); - status = -ENETDOWN; - goto done; - } - status = wl_start(skb, wl); - done: - return status; -} -#else static int wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { int status; - wl_info_t *wl = hw->priv; + struct wl_info *wl = hw->priv; WL_LOCK(wl); if (!wl->pub->up) { - WL_ERROR(("ops->tx called while down\n")); + WL_ERROR("ops->tx called while down\n"); status = -ENETDOWN; goto done; } @@ -279,13 +188,14 @@ static int wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb) WL_UNLOCK(wl); return status; } -#endif /* WLC_HIGH_ONLY */ static int wl_ops_start(struct ieee80211_hw *hw) { - wl_info_t *wl = hw->priv; - /* struct ieee80211_channel *curchan = hw->conf.channel; */ - WL_NONE(("%s : Initial channel: %d\n", __func__, curchan->hw_value)); + struct wl_info *wl = hw->priv; + /* + struct ieee80211_channel *curchan = hw->conf.channel; + WL_NONE("%s : Initial channel: %d\n", __func__, curchan->hw_value); + */ WL_LOCK(wl); ieee80211_wake_queues(hw); @@ -296,7 +206,7 @@ static int wl_ops_start(struct ieee80211_hw *hw) static void wl_ops_stop(struct ieee80211_hw *hw) { - wl_info_t *wl = hw->priv; + struct wl_info *wl = hw->priv; ASSERT(wl); WL_LOCK(wl); wl_down(wl); @@ -309,7 +219,7 @@ static void wl_ops_stop(struct ieee80211_hw *hw) static int wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - wl_info_t *wl; + struct wl_info *wl; int err; /* Just STA for now */ @@ -318,8 +228,8 @@ wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) vif->type != NL80211_IFTYPE_STATION && vif->type != NL80211_IFTYPE_WDS && vif->type != NL80211_IFTYPE_ADHOC) { - WL_ERROR(("%s: Attempt to add type %d, only STA for now\n", - __func__, vif->type)); + WL_ERROR("%s: Attempt to add type %d, only STA for now\n", + __func__, vif->type); return -EOPNOTSUPP; } @@ -329,7 +239,7 @@ wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) WL_UNLOCK(wl); if (err != 0) - WL_ERROR(("%s: wl_up() returned %d\n", __func__, err)); + WL_ERROR("%s: wl_up() returned %d\n", __func__, err); return err; } @@ -343,7 +253,7 @@ static int ieee_set_channel(struct ieee80211_hw *hw, struct ieee80211_channel *chan, enum nl80211_channel_type type) { - wl_info_t *wl = HW_TO_WL(hw); + struct wl_info *wl = HW_TO_WL(hw); int err = 0; switch (type) { @@ -355,8 +265,7 @@ ieee_set_channel(struct ieee80211_hw *hw, struct ieee80211_channel *chan, break; case NL80211_CHAN_HT40MINUS: case NL80211_CHAN_HT40PLUS: - WL_ERROR(("%s: Need to implement 40 Mhz Channels!\n", - __func__)); + WL_ERROR("%s: Need to implement 40 Mhz Channels!\n", __func__); break; } @@ -368,17 +277,17 @@ ieee_set_channel(struct ieee80211_hw *hw, struct ieee80211_channel *chan, static int wl_ops_config(struct ieee80211_hw *hw, u32 changed) { struct ieee80211_conf *conf = &hw->conf; - wl_info_t *wl = HW_TO_WL(hw); + struct wl_info *wl = HW_TO_WL(hw); int err = 0; int new_int; if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { - WL_NONE(("%s: Setting listen interval to %d\n", - __func__, conf->listen_interval)); + WL_NONE("%s: Setting listen interval to %d\n", + __func__, conf->listen_interval); if (wlc_iovar_setint (wl->wlc, "bcn_li_bcn", conf->listen_interval)) { - WL_ERROR(("%s: Error setting listen_interval\n", - __func__)); + WL_ERROR("%s: Error setting listen_interval\n", + __func__); err = -EIO; goto config_out; } @@ -386,41 +295,42 @@ static int wl_ops_config(struct ieee80211_hw *hw, u32 changed) ASSERT(new_int == conf->listen_interval); } if (changed & IEEE80211_CONF_CHANGE_MONITOR) - WL_NONE(("Need to set monitor mode\n")); + WL_NONE("Need to set monitor mode\n"); if (changed & IEEE80211_CONF_CHANGE_PS) - WL_NONE(("Need to set Power-save mode\n")); + WL_NONE("Need to set Power-save mode\n"); if (changed & IEEE80211_CONF_CHANGE_POWER) { - WL_NONE(("%s: Setting tx power to %d dbm\n", __func__, - conf->power_level)); + WL_NONE("%s: Setting tx power to %d dbm\n", + __func__, conf->power_level); if (wlc_iovar_setint (wl->wlc, "qtxpower", conf->power_level * 4)) { - WL_ERROR(("%s: Error setting power_level\n", __func__)); + WL_ERROR("%s: Error setting power_level\n", __func__); err = -EIO; goto config_out; } wlc_iovar_getint(wl->wlc, "qtxpower", &new_int); if (new_int != (conf->power_level * 4)) - WL_ERROR(("%s: Power level req != actual, %d %d\n", - __func__, conf->power_level * 4, new_int)); + WL_ERROR("%s: Power level req != actual, %d %d\n", + __func__, conf->power_level * 4, new_int); } if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { err = ieee_set_channel(hw, conf->channel, conf->channel_type); } if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) { - WL_NONE(("%s: srl %d, lrl %d\n", __func__, - conf->short_frame_max_tx_count, - conf->long_frame_max_tx_count)); + WL_NONE("%s: srl %d, lrl %d\n", + __func__, + conf->short_frame_max_tx_count, + conf->long_frame_max_tx_count); if (wlc_set (wl->wlc, WLC_SET_SRL, conf->short_frame_max_tx_count) < 0) { - WL_ERROR(("%s: Error setting srl\n", __func__)); + WL_ERROR("%s: Error setting srl\n", __func__); err = -EIO; goto config_out; } if (wlc_set(wl->wlc, WLC_SET_LRL, conf->long_frame_max_tx_count) < 0) { - WL_ERROR(("%s: Error setting lrl\n", __func__)); + WL_ERROR("%s: Error setting lrl\n", __func__); err = -EIO; goto config_out; } @@ -435,32 +345,29 @@ wl_ops_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, u32 changed) { - wl_info_t *wl = HW_TO_WL(hw); + struct wl_info *wl = HW_TO_WL(hw); int val; -#ifdef WLC_HIGH_ONLY - WL_LOCK(wl); -#endif if (changed & BSS_CHANGED_ASSOC) { - WL_ERROR(("Associated:\t%s\n", info->assoc ? "True" : "False")); + WL_ERROR("Associated:\t%s\n", info->assoc ? "True" : "False"); /* association status changed (associated/disassociated) * also implies a change in the AID. */ } if (changed & BSS_CHANGED_ERP_CTS_PROT) { - WL_NONE(("Use_cts_prot:\t%s Implement me\n", - info->use_cts_prot ? "True" : "False")); + WL_NONE("Use_cts_prot:\t%s Implement me\n", + info->use_cts_prot ? "True" : "False"); /* CTS protection changed */ } if (changed & BSS_CHANGED_ERP_PREAMBLE) { - WL_NONE(("Short preamble:\t%s Implement me\n", - info->use_short_preamble ? "True" : "False")); + WL_NONE("Short preamble:\t%s Implement me\n", + info->use_short_preamble ? "True" : "False"); /* preamble changed */ } if (changed & BSS_CHANGED_ERP_SLOT) { - WL_NONE(("Changing short slot:\t%s\n", - info->use_short_slot ? "True" : "False")); + WL_NONE("Changing short slot:\t%s\n", + info->use_short_slot ? "True" : "False"); if (info->use_short_slot) val = 1; else @@ -470,39 +377,36 @@ wl_ops_bss_info_changed(struct ieee80211_hw *hw, } if (changed & BSS_CHANGED_HT) { - WL_NONE(("%s: HT mode - Implement me\n", __func__)); + WL_NONE("%s: HT mode - Implement me\n", __func__); /* 802.11n parameters changed */ } if (changed & BSS_CHANGED_BASIC_RATES) { - WL_NONE(("Need to change Basic Rates:\t0x%x! Implement me\n", - (u32) info->basic_rates)); + WL_NONE("Need to change Basic Rates:\t0x%x! Implement me\n", + (u32) info->basic_rates); /* Basic rateset changed */ } if (changed & BSS_CHANGED_BEACON_INT) { - WL_NONE(("Beacon Interval:\t%d Implement me\n", - info->beacon_int)); + WL_NONE("Beacon Interval:\t%d Implement me\n", + info->beacon_int); /* Beacon interval changed */ } if (changed & BSS_CHANGED_BSSID) { - WL_NONE(("new BSSID:\taid %d bss:%pM\n", info->aid, - info->bssid)); + WL_NONE("new BSSID:\taid %d bss:%pM\n", + info->aid, info->bssid); /* BSSID changed, for whatever reason (IBSS and managed mode) */ /* FIXME: need to store bssid in bsscfg */ wlc_set_addrmatch(wl->wlc, RCM_BSSID_OFFSET, (struct ether_addr *)info->bssid); } if (changed & BSS_CHANGED_BEACON) { - WL_ERROR(("BSS_CHANGED_BEACON\n")); + WL_ERROR("BSS_CHANGED_BEACON\n"); /* Beacon data changed, retrieve new beacon (beaconing modes) */ } if (changed & BSS_CHANGED_BEACON_ENABLED) { - WL_ERROR(("Beacon enabled:\t%s\n", - info->enable_beacon ? "True" : "False")); + WL_ERROR("Beacon enabled:\t%s\n", + info->enable_beacon ? "True" : "False"); /* Beaconing should be enabled/disabled (beaconing modes) */ } -#ifdef WLC_HIGH_ONLY - WL_UNLOCK(wl); -#endif return; } @@ -511,27 +415,24 @@ wl_ops_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, u64 multicast) { -#ifndef WLC_HIGH_ONLY - wl_info_t *wl = hw->priv; -#endif + struct wl_info *wl = hw->priv; changed_flags &= MAC_FILTERS; *total_flags &= MAC_FILTERS; if (changed_flags & FIF_PROMISC_IN_BSS) - WL_ERROR(("FIF_PROMISC_IN_BSS\n")); + WL_ERROR("FIF_PROMISC_IN_BSS\n"); if (changed_flags & FIF_ALLMULTI) - WL_ERROR(("FIF_ALLMULTI\n")); + WL_ERROR("FIF_ALLMULTI\n"); if (changed_flags & FIF_FCSFAIL) - WL_ERROR(("FIF_FCSFAIL\n")); + WL_ERROR("FIF_FCSFAIL\n"); if (changed_flags & FIF_PLCPFAIL) - WL_ERROR(("FIF_PLCPFAIL\n")); + WL_ERROR("FIF_PLCPFAIL\n"); if (changed_flags & FIF_CONTROL) - WL_ERROR(("FIF_CONTROL\n")); + WL_ERROR("FIF_CONTROL\n"); if (changed_flags & FIF_OTHER_BSS) - WL_ERROR(("FIF_OTHER_BSS\n")); + WL_ERROR("FIF_OTHER_BSS\n"); if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { - WL_NONE(("FIF_BCN_PRBRESP_PROMISC\n")); -#ifndef WLC_HIGH_ONLY + WL_NONE("FIF_BCN_PRBRESP_PROMISC\n"); WL_LOCK(wl); if (*total_flags & FIF_BCN_PRBRESP_PROMISC) { wl->pub->mac80211_state |= MAC80211_PROMISC_BCNS; @@ -541,7 +442,6 @@ wl_ops_configure_filter(struct ieee80211_hw *hw, wl->pub->mac80211_state &= ~MAC80211_PROMISC_BCNS; } WL_UNLOCK(wl); -#endif } return; } @@ -549,25 +449,25 @@ wl_ops_configure_filter(struct ieee80211_hw *hw, static int wl_ops_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set) { - WL_ERROR(("%s: Enter\n", __func__)); + WL_ERROR("%s: Enter\n", __func__); return 0; } static void wl_ops_sw_scan_start(struct ieee80211_hw *hw) { - WL_NONE(("Scan Start\n")); + WL_NONE("Scan Start\n"); return; } static void wl_ops_sw_scan_complete(struct ieee80211_hw *hw) { - WL_NONE(("Scan Complete\n")); + WL_NONE("Scan Complete\n"); return; } static void wl_ops_set_tsf(struct ieee80211_hw *hw, u64 tsf) { - WL_ERROR(("%s: Enter\n", __func__)); + WL_ERROR("%s: Enter\n", __func__); return; } @@ -575,13 +475,13 @@ static int wl_ops_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) { - WL_ERROR(("%s: Enter\n", __func__)); + WL_ERROR("%s: Enter\n", __func__); return 0; } static int wl_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value) { - WL_ERROR(("%s: Enter\n", __func__)); + WL_ERROR("%s: Enter\n", __func__); return 0; } @@ -589,10 +489,10 @@ static void wl_ops_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum sta_notify_cmd cmd, struct ieee80211_sta *sta) { - WL_NONE(("%s: Enter\n", __func__)); + WL_NONE("%s: Enter\n", __func__); switch (cmd) { default: - WL_ERROR(("%s: Uknown cmd = %d\n", __func__, cmd)); + WL_ERROR("%s: Unknown cmd = %d\n", __func__, cmd); break; } return; @@ -602,11 +502,11 @@ static int wl_ops_conf_tx(struct ieee80211_hw *hw, u16 queue, const struct ieee80211_tx_queue_params *params) { - wl_info_t *wl = hw->priv; + struct wl_info *wl = hw->priv; - WL_NONE(("%s: Enter (WME config)\n", __func__)); - WL_NONE(("queue %d, txop %d, cwmin %d, cwmax %d, aifs %d\n", queue, - params->txop, params->cw_min, params->cw_max, params->aifs)); + WL_NONE("%s: Enter (WME config)\n", __func__); + WL_NONE("queue %d, txop %d, cwmin %d, cwmax %d, aifs %d\n", queue, + params->txop, params->cw_min, params->cw_max, params->aifs); WL_LOCK(wl); wlc_wme_setparams(wl->wlc, queue, (void *)params, true); @@ -617,7 +517,7 @@ wl_ops_conf_tx(struct ieee80211_hw *hw, u16 queue, static u64 wl_ops_get_tsf(struct ieee80211_hw *hw) { - WL_ERROR(("%s: Enter\n", __func__)); + WL_ERROR("%s: Enter\n", __func__); return 0; } @@ -628,11 +528,11 @@ wl_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct scb *scb; int i; - wl_info_t *wl = hw->priv; + struct wl_info *wl = hw->priv; /* Init the scb */ scb = (struct scb *)sta->drv_priv; - bzero(scb, sizeof(struct scb)); + memset(scb, 0, sizeof(struct scb)); for (i = 0; i < NUMPRIO; i++) scb->seqctl[i] = 0xFFFF; scb->seqctl_nonqos = 0xFFFF; @@ -641,20 +541,12 @@ wl_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wl->pub->global_scb = scb; wl->pub->global_ampdu = &(scb->scb_ampdu); wl->pub->global_ampdu->scb = scb; -#ifdef WLC_HIGH_ONLY - wl->pub->global_ampdu->max_pdu = AMPDU_NUM_MPDU; -#else wl->pub->global_ampdu->max_pdu = 16; -#endif pktq_init(&scb->scb_ampdu.txq, AMPDU_MAX_SCB_TID, AMPDU_MAX_SCB_TID * PKTQ_LEN_DEFAULT); sta->ht_cap.ht_supported = true; -#ifdef WLC_HIGH_ONLY - sta->ht_cap.ampdu_factor = AMPDU_RX_FACTOR_16K; -#else sta->ht_cap.ampdu_factor = AMPDU_RX_FACTOR_64K; -#endif sta->ht_cap.ampdu_density = AMPDU_DEF_MPDU_DENSITY; sta->ht_cap.cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | @@ -668,7 +560,7 @@ static int wl_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - WL_NONE(("%s: Enter\n", __func__)); + WL_NONE("%s: Enter\n", __func__); return 0; } @@ -681,19 +573,19 @@ wl_ampdu_action(struct ieee80211_hw *hw, #if defined(BCMDBG) struct scb *scb = (struct scb *)sta->drv_priv; #endif - wl_info_t *wl = hw->priv; + struct wl_info *wl = hw->priv; ASSERT(scb->magic == SCB_MAGIC); switch (action) { case IEEE80211_AMPDU_RX_START: - WL_NONE(("%s: action = IEEE80211_AMPDU_RX_START\n", __func__)); + WL_NONE("%s: action = IEEE80211_AMPDU_RX_START\n", __func__); break; case IEEE80211_AMPDU_RX_STOP: - WL_NONE(("%s: action = IEEE80211_AMPDU_RX_STOP\n", __func__)); + WL_NONE("%s: action = IEEE80211_AMPDU_RX_STOP\n", __func__); break; case IEEE80211_AMPDU_TX_START: if (!wlc_aggregatable(wl->wlc, tid)) { - /* WL_ERROR(("START: tid %d is not agg' able, return FAILURE to stack\n", tid)); */ + /* WL_ERROR("START: tid %d is not agg' able, return FAILURE to stack\n", tid); */ return -1; } /* XXX: Use the starting sequence number provided ... */ @@ -707,22 +599,18 @@ wl_ampdu_action(struct ieee80211_hw *hw, case IEEE80211_AMPDU_TX_OPERATIONAL: /* Not sure what to do here */ /* Power save wakeup */ - WL_NONE(("%s: action = IEEE80211_AMPDU_TX_OPERATIONAL\n", - __func__)); + WL_NONE("%s: action = IEEE80211_AMPDU_TX_OPERATIONAL\n", + __func__); break; default: - WL_ERROR(("%s: Invalid command, ignoring\n", __func__)); + WL_ERROR("%s: Invalid command, ignoring\n", __func__); } return 0; } static const struct ieee80211_ops wl_ops = { -#ifdef WLC_HIGH_ONLY - .tx = wl_ops_tx_nl, -#else .tx = wl_ops_tx, -#endif .start = wl_ops_start, .stop = wl_ops_stop, .add_interface = wl_ops_add_interface, @@ -744,10 +632,10 @@ static const struct ieee80211_ops wl_ops = { .ampdu_action = wl_ampdu_action, }; -static int wl_set_hint(wl_info_t *wl, char *abbrev) +static int wl_set_hint(struct wl_info *wl, char *abbrev) { - WL_ERROR(("%s: Sending country code %c%c to MAC80211\n", __func__, - abbrev[0], abbrev[1])); + WL_ERROR("%s: Sending country code %c%c to MAC80211\n", + __func__, abbrev[0], abbrev[1]); return regulatory_hint(wl->pub->ieee_hw->wiphy, abbrev); } @@ -762,117 +650,61 @@ static int wl_set_hint(wl_info_t *wl, char *abbrev) * a warning that this function is defined but not used if we declare * it as static. */ -static wl_info_t *wl_attach(u16 vendor, u16 device, unsigned long regs, +static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs, uint bustype, void *btparam, uint irq) { - wl_info_t *wl; - osl_t *osh; + struct wl_info *wl; + struct osl_info *osh; int unit, err; unsigned long base_addr; struct ieee80211_hw *hw; u8 perm[ETH_ALEN]; - unit = wl_found + instance_base; + unit = wl_found; err = 0; if (unit < 0) { - WL_ERROR(("wl%d: unit number overflow, exiting\n", unit)); + WL_ERROR("wl%d: unit number overflow, exiting\n", unit); return NULL; } - if (oneonly && (unit != instance_base)) { - WL_ERROR(("wl%d: wl_attach: oneonly is set, exiting\n", unit)); - return NULL; - } - - /* Requires pkttag feature */ - osh = osl_attach(btparam, bustype, true); + osh = osl_attach(btparam, bustype); ASSERT(osh); -#ifdef WLC_HIGH_ONLY - hw = ieee80211_alloc_hw(sizeof(wl_info_t), &wl_ops); - if (!hw) { - WL_ERROR(("%s: ieee80211_alloc_hw failed\n", __func__)); - ASSERT(0); - } - - bzero(hw->priv, sizeof(*wl)); - wl = hw->priv; -#else /* allocate private info */ hw = pci_get_drvdata(btparam); /* btparam == pdev */ wl = hw->priv; -#endif ASSERT(wl); - wl->magic = WL_MAGIC; wl->osh = osh; atomic_set(&wl->callbacks, 0); /* setup the bottom half handler */ tasklet_init(&wl->tasklet, wl_dpc, (unsigned long) wl); -#ifdef WLC_HIGH_ONLY - wl->rpc_th = bcm_rpc_tp_attach(osh, NULL); - if (wl->rpc_th == NULL) { - WL_ERROR(("wl%d: %s: bcm_rpc_tp_attach failed!\n", unit, - __func__)); - goto fail; - } - - wl->rpc = bcm_rpc_attach(NULL, osh, wl->rpc_th); - if (wl->rpc == NULL) { - WL_ERROR(("wl%d: %s: bcm_rpc_attach failed!\n", unit, - __func__)); - goto fail; - } - - /* init tx work queue for wl_start/send pkt; no need to destroy workitem */ - INIT_WORK(&wl->txq_task.work, (work_func_t) wl_start_txqwork); - wl->txq_task.context = wl; -#endif /* WLC_HIGH_ONLY */ -#ifdef BCMSDIO - SET_IEEE80211_DEV(hw, sdiommc_dev); -#endif base_addr = regs; if (bustype == PCI_BUS) { - /* piomode can be overwritten by command argument */ - wl->piomode = piomode; - WL_TRACE(("PCI/%s\n", wl->piomode ? "PIO" : "DMA")); + wl->piomode = false; } else if (bustype == RPC_BUS) { /* Do nothing */ } else { bustype = PCI_BUS; - WL_TRACE(("force to PCI\n")); + WL_TRACE("force to PCI\n"); } wl->bcm_bustype = bustype; -#ifdef WLC_HIGH_ONLY - if (wl->bcm_bustype == RPC_BUS) { - wl->regsva = (void *)0; - btparam = wl->rpc; - } else -#endif wl->regsva = ioremap_nocache(base_addr, PCI_BAR0_WINSZ); if (wl->regsva == NULL) { - WL_ERROR(("wl%d: ioremap() failed\n", unit)); + WL_ERROR("wl%d: ioremap() failed\n", unit); goto fail; } -#ifdef WLC_HIGH_ONLY - spin_lock_init(&wl->rpcq_lock); - spin_lock_init(&wl->txq_lock); - - sema_init(&wl->sem, 1); -#else spin_lock_init(&wl->lock); spin_lock_init(&wl->isr_lock); -#endif -#ifndef WLC_HIGH_ONLY /* prepare ucode */ if (wl_request_fw(wl, (struct pci_dev *)btparam)) { printf("%s: Failed to find firmware usually in %s\n", @@ -881,17 +713,14 @@ static wl_info_t *wl_attach(u16 vendor, u16 device, unsigned long regs, wl_remove((struct pci_dev *)btparam); goto fail1; } -#endif /* common load-time initialization */ wl->wlc = wlc_attach((void *)wl, vendor, device, unit, wl->piomode, osh, wl->regsva, wl->bcm_bustype, btparam, &err); -#ifndef WLC_HIGH_ONLY wl_release_fw(wl); -#endif if (!wl->wlc) { - printf("%s: %s wlc_attach() failed with code %d\n", - KBUILD_MODNAME, EPI_VERSION_STR, err); + printf("%s: wlc_attach() failed with code %d\n", + KBUILD_MODNAME, err); goto fail; } wl->pub = wlc_pub(wl->wlc); @@ -900,52 +729,35 @@ static wl_info_t *wl_attach(u16 vendor, u16 device, unsigned long regs, ASSERT(wl->pub->ieee_hw); ASSERT(wl->pub->ieee_hw->priv == wl); -#ifdef WLC_HIGH_ONLY - REGOPSSET(osh, (osl_rreg_fn_t) wlc_reg_read, - (osl_wreg_fn_t) wlc_reg_write, wl->wlc); - wl->rpc_dispatch_ctx.rpc = wl->rpc; - wl->rpc_dispatch_ctx.wlc = wl->wlc; - bcm_rpc_rxcb_init(wl->rpc, wl, wl_rpc_dispatch_schedule, wl, - wl_rpc_down, NULL, NULL); -#endif /* WLC_HIGH_ONLY */ - - if (nompc) { - if (wlc_iovar_setint(wl->wlc, "mpc", 0)) { - WL_ERROR(("wl%d: Error setting MPC variable to 0\n", - unit)); - } + + if (wlc_iovar_setint(wl->wlc, "mpc", 0)) { + WL_ERROR("wl%d: Error setting MPC variable to 0\n", unit); } -#ifdef BCMSDIO - /* Set SDIO drive strength */ - wlc_iovar_setint(wl->wlc, "sd_drivestrength", sd_drivestrength); -#endif -#ifdef WLC_LOW /* register our interrupt handler */ if (request_irq(irq, wl_isr, IRQF_SHARED, KBUILD_MODNAME, wl)) { - WL_ERROR(("wl%d: request_irq() failed\n", unit)); + WL_ERROR("wl%d: request_irq() failed\n", unit); goto fail; } wl->irq = irq; -#endif /* WLC_LOW */ /* register module */ wlc_module_register(wl->pub, NULL, "linux", wl, NULL, wl_linux_watchdog, NULL); if (ieee_hw_init(hw)) { - WL_ERROR(("wl%d: %s: ieee_hw_init failed!\n", unit, __func__)); + WL_ERROR("wl%d: %s: ieee_hw_init failed!\n", unit, __func__); goto fail; } - bcopy(&wl->pub->cur_etheraddr, perm, ETHER_ADDR_LEN); + bcopy(&wl->pub->cur_etheraddr, perm, ETH_ALEN); ASSERT(is_valid_ether_addr(perm)); SET_IEEE80211_PERM_ADDR(hw, perm); err = ieee80211_register_hw(hw); if (err) { - WL_ERROR(("%s: ieee80211_register_hw failed, status %d\n", - __func__, err)); + WL_ERROR("%s: ieee80211_register_hw failed, status %d\n", + __func__, err); } if (wl->pub->srom_ccode[0]) @@ -953,19 +765,14 @@ static wl_info_t *wl_attach(u16 vendor, u16 device, unsigned long regs, else err = wl_set_hint(wl, "US"); if (err) { - WL_ERROR(("%s: regulatory_hint failed, status %d\n", __func__, - err)); - } -#ifndef WLC_HIGH_ONLY - WL_ERROR(("wl%d: Broadcom BCM43xx 802.11 MAC80211 Driver " - EPI_VERSION_STR " (" PHY_VERSION_STR ")", unit)); -#else - WL_ERROR(("wl%d: Broadcom BCM43xx 802.11 MAC80211 Driver " - EPI_VERSION_STR, unit)); -#endif + WL_ERROR("%s: regulatory_hint failed, status %d\n", + __func__, err); + } + WL_ERROR("wl%d: Broadcom BCM43xx 802.11 MAC80211 Driver (" PHY_VERSION_STR ")", + unit); #ifdef BCMDBG - printf(" (Compiled in " SRCBASE " at " __TIME__ " on " __DATE__ ")"); + printf(" (Compiled at " __TIME__ " on " __DATE__ ")"); #endif /* BCMDBG */ printf("\n"); @@ -978,54 +785,6 @@ fail1: return NULL; } -#ifdef WLC_HIGH_ONLY -static void *wl_dbus_probe_cb(void *arg, const char *desc, u32 bustype, - u32 hdrlen) -{ - wl_info_t *wl; - WL_ERROR(("%s:\n", __func__)); - - wl = wl_attach(BCM_DNGL_VID, BCM_DNGL_BDC_PID, (unsigned long) NULL, RPC_BUS, - NULL, 0); - if (!wl) { - WL_ERROR(("%s: wl_attach failed\n", __func__)); - } - - /* This is later passed to wl_dbus_disconnect_cb */ - return wl; -} - -static void wl_dbus_disconnect_cb(void *arg) -{ - wl_info_t *wl = arg; - - WL_ERROR(("%s:\n", __func__)); - - if (wl) { -#ifdef WLC_HIGH_ONLY - if (wl->pub->ieee_hw) { - ieee80211_unregister_hw(wl->pub->ieee_hw); - WL_ERROR(("%s: Back from down\n", __func__)); - } - wlc_device_removed(wl->wlc); - wlc_bmac_dngl_reboot(wl->rpc); - bcm_rpc_down(wl->rpc); -#endif - WL_LOCK(wl); - wl_down(wl); - WL_UNLOCK(wl); -#ifdef WLC_HIGH_ONLY - if (wl->pub->ieee_hw) { - ieee80211_free_hw(wl->pub->ieee_hw); - WL_ERROR(("%s: Back from ieee80211_free_hw\n", - __func__)); - wl->pub->ieee_hw = NULL; - } -#endif - wl_free(wl); - } -} -#endif /* WLC_HIGH_ONLY */ #define CHAN2GHZ(channel, freqency, chflags) { \ @@ -1163,29 +922,13 @@ static struct ieee80211_supported_band wl_band_2GHz_nphy = { .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_40MHZ_INTOLERANT, -#ifdef WLC_HIGH_ONLY - .ht_supported = true, - .ampdu_factor = AMPDU_RX_FACTOR_16K, -#else .ht_supported = true, .ampdu_factor = AMPDU_RX_FACTOR_64K, -#endif .ampdu_density = AMPDU_DEF_MPDU_DENSITY, .mcs = { /* placeholders for now */ -#ifdef WLC_HIGH_ONLY - /* - * rx_mask[0] = 0xff by default - * rx_mask[1] = 0xff if number of rx chain >=2 - * rx_mask[2] = 0xff if number of rx chain >=3 - * rx_mask[4] = 1 if 40Mhz is supported - */ - .rx_mask = {0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .rx_highest = 72, /* max rate of single stream */ -#else .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0}, .rx_highest = 500, -#endif .tx_params = IEEE80211_HT_MCS_TX_DEFINED} } }; @@ -1212,7 +955,7 @@ static struct ieee80211_supported_band wl_band_5GHz_nphy = { static int ieee_hw_rate_init(struct ieee80211_hw *hw) { - wl_info_t *wl = HW_TO_WL(hw); + struct wl_info *wl = HW_TO_WL(hw); int has_5g; char phy_list[4]; @@ -1222,20 +965,16 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw) hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; if (wlc_get(wl->wlc, WLC_GET_PHYLIST, (int *)&phy_list) < 0) { - WL_ERROR(("Phy list failed\n")); + WL_ERROR("Phy list failed\n"); } - WL_NONE(("%s: phylist = %c\n", __func__, phy_list[0])); + WL_NONE("%s: phylist = %c\n", __func__, phy_list[0]); -#ifndef WLC_HIGH_ONLY if (phy_list[0] == 'n' || phy_list[0] == 'c') { if (phy_list[0] == 'c') { /* Single stream */ wl_band_2GHz_nphy.ht_cap.mcs.rx_mask[1] = 0; wl_band_2GHz_nphy.ht_cap.mcs.rx_highest = 72; } -#else - if (phy_list[0] == 's') { -#endif hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl_band_2GHz_nphy; } else { BUG(); @@ -1245,11 +984,7 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw) /* Assume all bands use the same phy. True for 11n devices. */ if (NBANDS_PUB(wl->pub) > 1) { has_5g++; -#ifndef WLC_HIGH_ONLY if (phy_list[0] == 'n' || phy_list[0] == 'c') { -#else - if (phy_list[0] == 's') { -#endif hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wl_band_5GHz_nphy; } else { @@ -1257,7 +992,7 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw) } } - WL_NONE(("%s: 2ghz = %d, 5ghz = %d\n", __func__, 1, has_5g)); + WL_NONE("%s: 2ghz = %d, 5ghz = %d\n", __func__, 1, has_5g); return 0; } @@ -1288,7 +1023,6 @@ static int ieee_hw_init(struct ieee80211_hw *hw) return ieee_hw_rate_init(hw); } -#ifndef BCMSDIO /** * determines if a device is a WL device, and if so, attaches it. * @@ -1300,15 +1034,15 @@ int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int rc; - wl_info_t *wl; + struct wl_info *wl; struct ieee80211_hw *hw; u32 val; ASSERT(pdev); - WL_TRACE(("%s: bus %d slot %d func %d irq %d\n", __func__, - pdev->bus->number, PCI_SLOT(pdev->devfn), - PCI_FUNC(pdev->devfn), pdev->irq)); + WL_TRACE("%s: bus %d slot %d func %d irq %d\n", + __func__, pdev->bus->number, PCI_SLOT(pdev->devfn), + PCI_FUNC(pdev->devfn), pdev->irq); if ((pdev->vendor != PCI_VENDOR_ID_BROADCOM) || (((pdev->device & 0xff00) != 0x4300) && @@ -1318,9 +1052,9 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) rc = pci_enable_device(pdev); if (rc) { - WL_ERROR(("%s: Cannot enable device %d-%d_%d\n", __func__, - pdev->bus->number, PCI_SLOT(pdev->devfn), - PCI_FUNC(pdev->devfn))); + WL_ERROR("%s: Cannot enable device %d-%d_%d\n", + __func__, pdev->bus->number, PCI_SLOT(pdev->devfn), + PCI_FUNC(pdev->devfn)); return -ENODEV; } pci_set_master(pdev); @@ -1329,9 +1063,9 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if ((val & 0x0000ff00) != 0) pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); - hw = ieee80211_alloc_hw(sizeof(wl_info_t), &wl_ops); + hw = ieee80211_alloc_hw(sizeof(struct wl_info), &wl_ops); if (!hw) { - WL_ERROR(("%s: ieee80211_alloc_hw failed\n", __func__)); + WL_ERROR("%s: ieee80211_alloc_hw failed\n", __func__); rc = -ENOMEM; goto err_1; } @@ -1340,34 +1074,34 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, hw); - bzero(hw->priv, sizeof(*wl)); + memset(hw->priv, 0, sizeof(*wl)); wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev, pdev->irq); if (!wl) { - WL_ERROR(("%s: %s: wl_attach failed!\n", - KBUILD_MODNAME, __func__)); + WL_ERROR("%s: %s: wl_attach failed!\n", + KBUILD_MODNAME, __func__); return -ENODEV; } return 0; err_1: - WL_ERROR(("%s: err_1: Major hoarkage\n", __func__)); + WL_ERROR("%s: err_1: Major hoarkage\n", __func__); return 0; } #ifdef LINUXSTA_PS static int wl_suspend(struct pci_dev *pdev, pm_message_t state) { - wl_info_t *wl; + struct wl_info *wl; struct ieee80211_hw *hw; - WL_TRACE(("wl: wl_suspend\n")); + WL_TRACE("wl: wl_suspend\n"); hw = pci_get_drvdata(pdev); wl = HW_TO_WL(hw); if (!wl) { - WL_ERROR(("wl: wl_suspend: pci_get_drvdata failed\n")); + WL_ERROR("wl: wl_suspend: pci_get_drvdata failed\n"); return -ENODEV; } @@ -1382,16 +1116,16 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state) static int wl_resume(struct pci_dev *pdev) { - wl_info_t *wl; + struct wl_info *wl; struct ieee80211_hw *hw; int err = 0; u32 val; - WL_TRACE(("wl: wl_resume\n")); + WL_TRACE("wl: wl_resume\n"); hw = pci_get_drvdata(pdev); wl = HW_TO_WL(hw); if (!wl) { - WL_ERROR(("wl: wl_resume: pci_get_drvdata failed\n")); + WL_ERROR("wl: wl_resume: pci_get_drvdata failed\n"); return -ENODEV; } @@ -1421,17 +1155,17 @@ static int wl_resume(struct pci_dev *pdev) static void wl_remove(struct pci_dev *pdev) { - wl_info_t *wl; + struct wl_info *wl; struct ieee80211_hw *hw; hw = pci_get_drvdata(pdev); wl = HW_TO_WL(hw); if (!wl) { - WL_ERROR(("wl: wl_remove: pci_get_drvdata failed\n")); + WL_ERROR("wl: wl_remove: pci_get_drvdata failed\n"); return; } if (!wlc_chipmatch(pdev->vendor, pdev->device)) { - WL_ERROR(("wl: wl_remove: wlc_chipmatch failed\n")); + WL_ERROR("wl: wl_remove: wlc_chipmatch failed\n"); return; } if (wl->wlc) { @@ -1439,7 +1173,7 @@ static void wl_remove(struct pci_dev *pdev) WL_LOCK(wl); wl_down(wl); WL_UNLOCK(wl); - WL_NONE(("%s: Down\n", __func__)); + WL_NONE("%s: Down\n", __func__); } pci_disable_device(pdev); @@ -1459,7 +1193,6 @@ static struct pci_driver wl_pci_driver = { .remove = __devexit_p(wl_remove), .id_table = wl_id_table, }; -#endif /* !BCMSDIO */ /** * This is the main entry point for the WL driver. @@ -1480,7 +1213,6 @@ static int __init wl_module_init(void) if (var) wl_msg_level = simple_strtoul(var, NULL, 0); } -#ifndef WLC_HIGH_ONLY { extern u32 phyhal_msg_level; @@ -1492,25 +1224,13 @@ static int __init wl_module_init(void) phyhal_msg_level = simple_strtoul(var, NULL, 0); } } -#endif /* WLC_HIGH_ONLY */ #endif /* BCMDBG */ -#ifndef BCMSDIO error = pci_register_driver(&wl_pci_driver); if (!error) return 0; -#endif /* !BCMSDIO */ -#ifdef WLC_HIGH_ONLY - /* BMAC_NOTE: define hardcode number, why NODEVICE is ok ? */ - error = - dbus_register(BCM_DNGL_VID, 0, wl_dbus_probe_cb, - wl_dbus_disconnect_cb, NULL, NULL, NULL); - if (error == DBUS_ERR_NODEVICE) { - error = DBUS_OK; - } -#endif /* WLC_HIGH_ONLY */ return error; } @@ -1524,13 +1244,8 @@ static int __init wl_module_init(void) */ static void __exit wl_module_exit(void) { -#ifndef BCMSDIO pci_unregister_driver(&wl_pci_driver); -#endif /* !BCMSDIO */ -#ifdef WLC_HIGH_ONLY - dbus_deregister(); -#endif /* WLC_HIGH_ONLY */ } module_init(wl_module_init); @@ -1543,19 +1258,17 @@ module_exit(wl_module_exit); * by the wl parameter. * */ -void wl_free(wl_info_t *wl) +void wl_free(struct wl_info *wl) { wl_timer_t *t, *next; - osl_t *osh; + struct osl_info *osh; ASSERT(wl); -#ifndef WLC_HIGH_ONLY /* free ucode data */ if (wl->fw.fw_cnt) wl_ucode_data_free(); if (wl->irq) free_irq(wl->irq, wl); -#endif /* kill dpc */ tasklet_kill(&wl->tasklet); @@ -1593,103 +1306,50 @@ void wl_free(wl_info_t *wl) * unregister_netdev() calls get_stats() which may read chip registers * so we cannot unmap the chip registers until after calling unregister_netdev() . */ - if (wl->regsva && BUSTYPE(wl->bcm_bustype) != SDIO_BUS && - BUSTYPE(wl->bcm_bustype) != JTAG_BUS) { + if (wl->regsva && wl->bcm_bustype != SDIO_BUS && + wl->bcm_bustype != JTAG_BUS) { iounmap((void *)wl->regsva); } wl->regsva = NULL; -#ifdef WLC_HIGH_ONLY - wl_rpcq_free(wl); - - wl_txq_free(wl); - - if (wl->rpc) { - bcm_rpc_detach(wl->rpc); - wl->rpc = NULL; - } - - if (wl->rpc_th) { - bcm_rpc_tp_detach(wl->rpc_th); - wl->rpc_th = NULL; - } -#endif /* WLC_HIGH_ONLY */ osl_detach(osh); } -#ifdef WLC_LOW /* transmit a packet */ -static int BCMFASTPATH wl_start(struct sk_buff *skb, wl_info_t *wl) +static int BCMFASTPATH wl_start(struct sk_buff *skb, struct wl_info *wl) { if (!wl) return -ENETDOWN; return wl_start_int(wl, WL_TO_HW(wl), skb); } -#endif /* WLC_LOW */ static int BCMFASTPATH -wl_start_int(wl_info_t *wl, struct ieee80211_hw *hw, struct sk_buff *skb) +wl_start_int(struct wl_info *wl, struct ieee80211_hw *hw, struct sk_buff *skb) { -#ifdef WLC_HIGH_ONLY - WL_LOCK(wl); -#endif wlc_sendpkt_mac80211(wl->wlc, skb, hw); -#ifdef WLC_HIGH_ONLY - WL_UNLOCK(wl); -#endif return NETDEV_TX_OK; } -void wl_txflowcontrol(wl_info_t *wl, struct wl_if *wlif, bool state, int prio) +void wl_txflowcontrol(struct wl_info *wl, struct wl_if *wlif, bool state, + int prio) { - WL_ERROR(("Shouldn't be here %s\n", __func__)); + WL_ERROR("Shouldn't be here %s\n", __func__); } -#if defined(WLC_HIGH_ONLY) -/* Schedule a completion handler to run at safe time */ -static int -wl_schedule_task(wl_info_t *wl, void (*fn) (struct wl_task *task), - void *context) +void wl_init(struct wl_info *wl) { - wl_task_t *task; - - WL_TRACE(("wl%d: wl_schedule_task\n", wl->pub->unit)); - - task = kmalloc(sizeof(wl_task_t), GFP_ATOMIC); - if (!task) { - WL_ERROR(("wl%d: wl_schedule_task: out of memory\n", wl->pub->unit)); - return -ENOMEM; - } - - INIT_WORK(&task->work, (work_func_t) fn); - task->context = context; - - if (!schedule_work(&task->work)) { - WL_ERROR(("wl%d: schedule_work() failed\n", wl->pub->unit)); - kfree(task); - return -ENOMEM; - } - - atomic_inc(&wl->callbacks); - - return 0; -} -#endif /* defined(WLC_HIGH_ONLY) */ - -void wl_init(wl_info_t *wl) -{ - WL_TRACE(("wl%d: wl_init\n", wl->pub->unit)); + WL_TRACE("wl%d: wl_init\n", wl->pub->unit); wl_reset(wl); wlc_init(wl->wlc); } -uint wl_reset(wl_info_t *wl) +uint wl_reset(struct wl_info *wl) { - WL_TRACE(("wl%d: wl_reset\n", wl->pub->unit)); + WL_TRACE("wl%d: wl_reset\n", wl->pub->unit); wlc_reset(wl->wlc); @@ -1703,25 +1363,22 @@ uint wl_reset(wl_info_t *wl) * These are interrupt on/off entry points. Disable interrupts * during interrupt state transition. */ -void BCMFASTPATH wl_intrson(wl_info_t *wl) +void BCMFASTPATH wl_intrson(struct wl_info *wl) { -#if defined(WLC_LOW) unsigned long flags; INT_LOCK(wl, flags); wlc_intrson(wl->wlc); INT_UNLOCK(wl, flags); -#endif /* WLC_LOW */ } -bool wl_alloc_dma_resources(wl_info_t *wl, uint addrwidth) +bool wl_alloc_dma_resources(struct wl_info *wl, uint addrwidth) { return true; } -u32 BCMFASTPATH wl_intrsoff(wl_info_t *wl) +u32 BCMFASTPATH wl_intrsoff(struct wl_info *wl) { -#if defined(WLC_LOW) unsigned long flags; u32 status; @@ -1729,23 +1386,18 @@ u32 BCMFASTPATH wl_intrsoff(wl_info_t *wl) status = wlc_intrsoff(wl->wlc); INT_UNLOCK(wl, flags); return status; -#else - return 0; -#endif /* WLC_LOW */ } -void wl_intrsrestore(wl_info_t *wl, u32 macintmask) +void wl_intrsrestore(struct wl_info *wl, u32 macintmask) { -#if defined(WLC_LOW) unsigned long flags; INT_LOCK(wl, flags); wlc_intrsrestore(wl->wlc, macintmask); INT_UNLOCK(wl, flags); -#endif /* WLC_LOW */ } -int wl_up(wl_info_t *wl) +int wl_up(struct wl_info *wl) { int error = 0; @@ -1757,7 +1409,7 @@ int wl_up(wl_info_t *wl) return error; } -void wl_down(wl_info_t *wl) +void wl_down(struct wl_info *wl) { uint callbacks, ret_val = 0; @@ -1768,24 +1420,21 @@ void wl_down(wl_info_t *wl) /* wait for down callbacks to complete */ WL_UNLOCK(wl); -#ifndef WLC_HIGH_ONLY /* For HIGH_only driver, it's important to actually schedule other work, * not just spin wait since everything runs at schedule level */ SPINWAIT((atomic_read(&wl->callbacks) > callbacks), 100 * 1000); -#endif /* WLC_HIGH_ONLY */ WL_LOCK(wl); } irqreturn_t BCMFASTPATH wl_isr(int irq, void *dev_id) { -#if defined(WLC_LOW) - wl_info_t *wl; + struct wl_info *wl; bool ours, wantdpc; unsigned long flags; - wl = (wl_info_t *) dev_id; + wl = (struct wl_info *) dev_id; WL_ISRLOCK(wl, flags); @@ -1805,17 +1454,13 @@ irqreturn_t BCMFASTPATH wl_isr(int irq, void *dev_id) WL_ISRUNLOCK(wl, flags); return IRQ_RETVAL(ours); -#else - return IRQ_RETVAL(0); -#endif /* WLC_LOW */ } static void BCMFASTPATH wl_dpc(unsigned long data) { -#ifdef WLC_LOW - wl_info_t *wl; + struct wl_info *wl; - wl = (wl_info_t *) data; + wl = (struct wl_info *) data; WL_LOCK(wl); @@ -1846,20 +1491,19 @@ static void BCMFASTPATH wl_dpc(unsigned long data) done: WL_UNLOCK(wl); -#endif /* WLC_LOW */ } -static void wl_link_up(wl_info_t *wl, char *ifname) +static void wl_link_up(struct wl_info *wl, char *ifname) { - WL_ERROR(("wl%d: link up (%s)\n", wl->pub->unit, ifname)); + WL_ERROR("wl%d: link up (%s)\n", wl->pub->unit, ifname); } -static void wl_link_down(wl_info_t *wl, char *ifname) +static void wl_link_down(struct wl_info *wl, char *ifname) { - WL_ERROR(("wl%d: link down (%s)\n", wl->pub->unit, ifname)); + WL_ERROR("wl%d: link down (%s)\n", wl->pub->unit, ifname); } -void wl_event(wl_info_t *wl, char *ifname, wlc_event_t *e) +void wl_event(struct wl_info *wl, char *ifname, wlc_event_t *e) { switch (e->event.event_type) { @@ -1877,12 +1521,7 @@ void wl_event(wl_info_t *wl, char *ifname, wlc_event_t *e) static void wl_timer(unsigned long data) { -#ifndef WLC_HIGH_ONLY _wl_timer((wl_timer_t *) data); -#else - wl_timer_t *t = (wl_timer_t *) data; - wl_schedule_task(t->wl, wl_timer_task, t); -#endif /* WLC_HIGH_ONLY */ } static void _wl_timer(wl_timer_t *t) @@ -1906,18 +1545,18 @@ static void _wl_timer(wl_timer_t *t) WL_UNLOCK(t->wl); } -wl_timer_t *wl_init_timer(wl_info_t *wl, void (*fn) (void *arg), void *arg, +wl_timer_t *wl_init_timer(struct wl_info *wl, void (*fn) (void *arg), void *arg, const char *name) { wl_timer_t *t; t = kmalloc(sizeof(wl_timer_t), GFP_ATOMIC); if (!t) { - WL_ERROR(("wl%d: wl_init_timer: out of memory\n", wl->pub->unit)); + WL_ERROR("wl%d: wl_init_timer: out of memory\n", wl->pub->unit); return 0; } - bzero(t, sizeof(wl_timer_t)); + memset(t, 0, sizeof(wl_timer_t)); init_timer(&t->timer); t->timer.data = (unsigned long) t; @@ -1940,12 +1579,12 @@ wl_timer_t *wl_init_timer(wl_info_t *wl, void (*fn) (void *arg), void *arg, /* BMAC_NOTE: Add timer adds only the kernel timer since it's going to be more accurate * as well as it's easier to make it periodic */ -void wl_add_timer(wl_info_t *wl, wl_timer_t *t, uint ms, int periodic) +void wl_add_timer(struct wl_info *wl, wl_timer_t *t, uint ms, int periodic) { #ifdef BCMDBG if (t->set) { - WL_ERROR(("%s: Already set. Name: %s, per %d\n", - __func__, t->name, periodic)); + WL_ERROR("%s: Already set. Name: %s, per %d\n", + __func__, t->name, periodic); } #endif ASSERT(!t->set); @@ -1960,7 +1599,7 @@ void wl_add_timer(wl_info_t *wl, wl_timer_t *t, uint ms, int periodic) } /* return true if timer successfully deleted, false if still pending */ -bool wl_del_timer(wl_info_t *wl, wl_timer_t *t) +bool wl_del_timer(struct wl_info *wl, wl_timer_t *t) { if (t->set) { t->set = false; @@ -1973,7 +1612,7 @@ bool wl_del_timer(wl_info_t *wl, wl_timer_t *t) return true; } -void wl_free_timer(wl_info_t *wl, wl_timer_t *t) +void wl_free_timer(struct wl_info *wl, wl_timer_t *t) { wl_timer_t *tmp; @@ -2009,7 +1648,7 @@ void wl_free_timer(wl_info_t *wl, wl_timer_t *t) static int wl_linux_watchdog(void *ctx) { - wl_info_t *wl = (wl_info_t *) ctx; + struct wl_info *wl = (struct wl_info *) ctx; struct net_device_stats *stats = NULL; uint id; /* refresh stats */ @@ -2049,233 +1688,12 @@ struct wl_fw_hdr { u32 idx; }; -#ifdef WLC_HIGH_ONLY -static void wl_rpc_down(void *wlh) -{ - wl_info_t *wl = (wl_info_t *) (wlh); - - wlc_device_removed(wl->wlc); - - wl_rpcq_free(wl); -} - -static int BCMFASTPATH wl_start(struct sk_buff *skb, wl_info_t *wl) -{ - - unsigned long flags; - - skb->prev = NULL; - - /* Lock the queue as tasklet could be running at this time */ - TXQ_LOCK(wl, flags); - if (wl->txq_head == NULL) - wl->txq_head = skb; - else { - wl->txq_tail->prev = skb; - } - wl->txq_tail = skb; - - if (wl->txq_dispatched == false) { - wl->txq_dispatched = true; - - if (schedule_work(&wl->txq_task.work)) { - atomic_inc(&wl->callbacks); - } else { - WL_ERROR(("wl%d: wl_start/schedule_work failed\n", - wl->pub->unit)); - } - } - - TXQ_UNLOCK(wl, flags); - - return 0; - -} - -static void wl_start_txqwork(struct wl_task *task) -{ - wl_info_t *wl = (wl_info_t *) task->context; - struct sk_buff *skb; - unsigned long flags; - uint count = 0; - - WL_TRACE(("wl%d: wl_start_txqwork\n", wl->pub->unit)); - - /* First remove an entry then go for execution */ - TXQ_LOCK(wl, flags); - while (wl->txq_head) { - skb = wl->txq_head; - wl->txq_head = skb->prev; - skb->prev = NULL; - if (wl->txq_head == NULL) - wl->txq_tail = NULL; - TXQ_UNLOCK(wl, flags); - - /* it has WL_LOCK/WL_UNLOCK inside */ - wl_start_int(wl, WL_TO_HW(wl), skb); - - /* bounded our execution, reshedule ourself next */ - if (++count >= 10) - break; - - TXQ_LOCK(wl, flags); - } - - if (count >= 10) { - if (!schedule_work(&wl->txq_task.work)) { - WL_ERROR(("wl%d: wl_start/schedule_work failed\n", - wl->pub->unit)); - atomic_dec(&wl->callbacks); - } - } else { - wl->txq_dispatched = false; - TXQ_UNLOCK(wl, flags); - atomic_dec(&wl->callbacks); - } - - return; -} - -static void wl_txq_free(wl_info_t *wl) -{ - struct sk_buff *skb; - - if (wl->txq_head == NULL) { - ASSERT(wl->txq_tail == NULL); - return; - } - - while (wl->txq_head) { - skb = wl->txq_head; - wl->txq_head = skb->prev; - PKTFREE(wl->osh, skb, true); - } - - wl->txq_tail = NULL; -} - -static void wl_rpcq_free(wl_info_t *wl) -{ - rpc_buf_t *buf; - - if (wl->rpcq_head == NULL) { - ASSERT(wl->rpcq_tail == NULL); - return; - } - - while (wl->rpcq_head) { - buf = wl->rpcq_head; - wl->rpcq_head = bcm_rpc_buf_next_get(wl->rpc_th, buf); - bcm_rpc_buf_free(wl->rpc_dispatch_ctx.rpc, buf); - } - - wl->rpcq_tail = NULL; -} - -static void wl_rpcq_dispatch(struct wl_task *task) -{ - wl_info_t *wl = (wl_info_t *) task->context; - rpc_buf_t *buf; - unsigned long flags; - - /* First remove an entry then go for execution */ - RPCQ_LOCK(wl, flags); - while (wl->rpcq_head) { - buf = wl->rpcq_head; - wl->rpcq_head = bcm_rpc_buf_next_get(wl->rpc_th, buf); - - if (wl->rpcq_head == NULL) - wl->rpcq_tail = NULL; - RPCQ_UNLOCK(wl, flags); - - WL_LOCK(wl); - wlc_rpc_high_dispatch(&wl->rpc_dispatch_ctx, buf); - WL_UNLOCK(wl); - - RPCQ_LOCK(wl, flags); - } - - wl->rpcq_dispatched = false; - - RPCQ_UNLOCK(wl, flags); - - kfree(task); - atomic_dec(&wl->callbacks); -} - -static void wl_rpcq_add(wl_info_t *wl, rpc_buf_t *buf) -{ - unsigned long flags; - - bcm_rpc_buf_next_set(wl->rpc_th, buf, NULL); - - /* Lock the queue as tasklet could be running at this time */ - RPCQ_LOCK(wl, flags); - if (wl->rpcq_head == NULL) - wl->rpcq_head = buf; - else - bcm_rpc_buf_next_set(wl->rpc_th, wl->rpcq_tail, buf); - - wl->rpcq_tail = buf; - - if (wl->rpcq_dispatched == false) { - wl->rpcq_dispatched = true; - wl_schedule_task(wl, wl_rpcq_dispatch, wl); - } - - RPCQ_UNLOCK(wl, flags); -} - -#if defined(BCMDBG) -static const struct name_entry rpc_name_tbl[] = RPC_ID_TABLE; -#endif /* BCMDBG */ - -/* dongle-side rpc dispatch routine */ -static void wl_rpc_dispatch_schedule(void *ctx, struct rpc_buf *buf) -{ - bcm_xdr_buf_t b; - wl_info_t *wl = (wl_info_t *) ctx; - wlc_rpc_id_t rpc_id; - int err; - - bcm_xdr_buf_init(&b, bcm_rpc_buf_data(wl->rpc_th, buf), - bcm_rpc_buf_len_get(wl->rpc_th, buf)); - - err = bcm_xdr_unpack_u32(&b, &rpc_id); - ASSERT(!err); - WL_TRACE(("%s: Dispatch id %s\n", __func__, - WLC_RPC_ID_LOOKUP(rpc_name_tbl, rpc_id))); - - /* Handle few emergency ones */ - switch (rpc_id) { - default: - wl_rpcq_add(wl, buf); - break; - } -} - -static void wl_timer_task(wl_task_t *task) -{ - wl_timer_t *t = (wl_timer_t *) task->context; - - _wl_timer(t); - kfree(task); - - /* This dec is for the task_schedule. The timer related - * callback is decremented in _wl_timer - */ - atomic_dec(&t->wl->callbacks); -} -#endif /* WLC_HIGH_ONLY */ - -#ifndef WLC_HIGH_ONLY char *wl_firmwares[WL_MAX_FW] = { "brcm/bcm43xx", NULL }; -#ifdef WLC_LOW -int wl_ucode_init_buf(wl_info_t *wl, void **pbuf, u32 idx) +int wl_ucode_init_buf(struct wl_info *wl, void **pbuf, u32 idx) { int i, entry; const u8 *pdata; @@ -2301,7 +1719,7 @@ int wl_ucode_init_buf(wl_info_t *wl, void **pbuf, u32 idx) return -1; } -int wl_ucode_init_uint(wl_info_t *wl, u32 *data, u32 idx) +int wl_ucode_init_uint(struct wl_info *wl, u32 *data, u32 idx) { int i, entry; const u8 *pdata; @@ -2321,22 +1739,21 @@ int wl_ucode_init_uint(wl_info_t *wl, u32 *data, u32 idx) printf("ERROR: ucode tag:%d can not be found!\n", idx); return -1; } -#endif /* WLC_LOW */ -static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev) +static int wl_request_fw(struct wl_info *wl, struct pci_dev *pdev) { int status; struct device *device = &pdev->dev; char fw_name[100]; int i; - bzero((void *)&wl->fw, sizeof(struct wl_firmware)); + memset((void *)&wl->fw, 0, sizeof(struct wl_firmware)); for (i = 0; i < WL_MAX_FW; i++) { if (wl_firmwares[i] == NULL) break; sprintf(fw_name, "%s-%d.fw", wl_firmwares[i], UCODE_LOADER_API_VER); - WL_NONE(("request fw %s\n", fw_name)); + WL_NONE("request fw %s\n", fw_name); status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); if (status) { printf("%s: fail to load firmware %s\n", @@ -2344,7 +1761,7 @@ static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev) wl_release_fw(wl); return status; } - WL_NONE(("request fw %s\n", fw_name)); + WL_NONE("request fw %s\n", fw_name); sprintf(fw_name, "%s_hdr-%d.fw", wl_firmwares[i], UCODE_LOADER_API_VER); status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); @@ -2356,22 +1773,19 @@ static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev) } wl->fw.hdr_num_entries[i] = wl->fw.fw_hdr[i]->size / (sizeof(struct wl_fw_hdr)); - WL_NONE(("request fw %s find: %d entries\n", fw_name, - wl->fw.hdr_num_entries[i])); + WL_NONE("request fw %s find: %d entries\n", + fw_name, wl->fw.hdr_num_entries[i]); } wl->fw.fw_cnt = i; - wl_ucode_data_init(wl); - return 0; + return wl_ucode_data_init(wl); } -#ifdef WLC_LOW void wl_ucode_free_buf(void *p) { kfree(p); } -#endif /* WLC_LOW */ -static void wl_release_fw(wl_info_t *wl) +static void wl_release_fw(struct wl_info *wl) { int i; for (i = 0; i < WL_MAX_FW; i++) { @@ -2379,4 +1793,54 @@ static void wl_release_fw(wl_info_t *wl) release_firmware(wl->fw.fw_hdr[i]); } } -#endif /* WLC_HIGH_ONLY */ + + +/* + * checks validity of all firmware images loaded from user space + */ +int wl_check_firmwares(struct wl_info *wl) +{ + int i; + int entry; + int rc = 0; + const struct firmware *fw; + const struct firmware *fw_hdr; + struct wl_fw_hdr *ucode_hdr; + for (i = 0; i < WL_MAX_FW && rc == 0; i++) { + fw = wl->fw.fw_bin[i]; + fw_hdr = wl->fw.fw_hdr[i]; + if (fw == NULL && fw_hdr == NULL) { + break; + } else if (fw == NULL || fw_hdr == NULL) { + WL_ERROR("%s: invalid bin/hdr fw\n", __func__); + rc = -EBADF; + } else if (fw_hdr->size % sizeof(struct wl_fw_hdr)) { + WL_ERROR("%s: non integral fw hdr file size %d/%zu\n", + __func__, fw_hdr->size, + sizeof(struct wl_fw_hdr)); + rc = -EBADF; + } else if (fw->size < MIN_FW_SIZE || fw->size > MAX_FW_SIZE) { + WL_ERROR("%s: out of bounds fw file size %d\n", + __func__, fw->size); + rc = -EBADF; + } else { + /* check if ucode section overruns firmware image */ + ucode_hdr = (struct wl_fw_hdr *)fw_hdr->data; + for (entry = 0; entry < wl->fw.hdr_num_entries[i] && rc; + entry++, ucode_hdr++) { + if (ucode_hdr->offset + ucode_hdr->len > + fw->size) { + WL_ERROR("%s: conflicting bin/hdr\n", + __func__); + rc = -EBADF; + } + } + } + } + if (rc == 0 && wl->fw.fw_cnt != i) { + WL_ERROR("%s: invalid fw_cnt=%d\n", __func__, wl->fw.fw_cnt); + rc = -EBADF; + } + return rc; +} + diff --git a/drivers/staging/brcm80211/sys/wl_mac80211.h b/drivers/staging/brcm80211/sys/wl_mac80211.h index 78cee44..bb39b77 100644 --- a/drivers/staging/brcm80211/sys/wl_mac80211.h +++ b/drivers/staging/brcm80211/sys/wl_mac80211.h @@ -60,58 +60,32 @@ struct wl_firmware { }; struct wl_info { - wlc_pub_t *pub; /* pointer to public wlc state */ + struct wlc_pub *pub; /* pointer to public wlc state */ void *wlc; /* pointer to private common os-independent data */ - osl_t *osh; /* pointer to os handler */ + struct osl_info *osh; /* pointer to os handler */ u32 magic; int irq; -#ifdef WLC_HIGH_ONLY - struct semaphore sem; /* use semaphore to allow sleep */ -#else spinlock_t lock; /* per-device perimeter lock */ spinlock_t isr_lock; /* per-device ISR synchronization lock */ -#endif uint bcm_bustype; /* bus type */ bool piomode; /* set from insmod argument */ void *regsva; /* opaque chip registers virtual address */ atomic_t callbacks; /* # outstanding callback functions */ struct wl_timer *timers; /* timer cleanup queue */ struct tasklet_struct tasklet; /* dpc tasklet */ -#ifdef BCMSDIO - bcmsdh_info_t *sdh; /* pointer to sdio bus handler */ - unsigned long flags; /* current irq flags */ -#endif /* BCMSDIO */ bool resched; /* dpc needs to be and is rescheduled */ #ifdef LINUXSTA_PS u32 pci_psstate[16]; /* pci ps-state save/restore */ #endif /* RPC, handle, lock, txq, workitem */ -#ifdef WLC_HIGH_ONLY - rpc_info_t *rpc; /* RPC handle */ - rpc_tp_info_t *rpc_th; /* RPC transport handle */ - wlc_rpc_ctx_t rpc_dispatch_ctx; - - bool rpcq_dispatched; /* Avoid scheduling multiple tasks */ - spinlock_t rpcq_lock; /* Lock for the queue */ - rpc_buf_t *rpcq_head; /* RPC Q */ - rpc_buf_t *rpcq_tail; /* Points to the last buf */ - - bool txq_dispatched; /* Avoid scheduling multiple tasks */ - spinlock_t txq_lock; /* Lock for the queue */ - struct sk_buff *txq_head; /* TX Q */ - struct sk_buff *txq_tail; /* Points to the last buf */ - - wl_task_t txq_task; /* work queue for wl_start() */ -#endif /* WLC_HIGH_ONLY */ uint stats_id; /* the current set of stats */ /* ping-pong stats counters updated by Linux watchdog */ struct net_device_stats stats_watchdog[2]; struct wl_firmware fw; }; -#ifndef WLC_HIGH_ONLY #define WL_LOCK(wl) spin_lock_bh(&(wl)->lock) #define WL_UNLOCK(wl) spin_unlock_bh(&(wl)->lock) @@ -122,17 +96,6 @@ struct wl_info { /* locking under WL_LOCK() to synchronize with wl_isr */ #define INT_LOCK(wl, flags) spin_lock_irqsave(&(wl)->isr_lock, flags) #define INT_UNLOCK(wl, flags) spin_unlock_irqrestore(&(wl)->isr_lock, flags) -#else /* BCMSDIO */ - -#define WL_LOCK(wl) down(&(wl)->sem) -#define WL_UNLOCK(wl) up(&(wl)->sem) - -#define WL_ISRLOCK(wl) -#define WL_ISRUNLOCK(wl) -#endif /* WLC_HIGH_ONLY */ - -/* handle forward declaration */ -typedef struct wl_info wl_info_t; #ifndef PCI_D0 #define PCI_D0 0 @@ -148,14 +111,7 @@ extern irqreturn_t wl_isr(int irq, void *dev_id); extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent); -extern void wl_free(wl_info_t *wl); +extern void wl_free(struct wl_info *wl); extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); -extern int wl_ucode_data_init(wl_info_t *wl); -extern void wl_ucode_data_free(void); -#ifdef WLC_LOW -extern void wl_ucode_free_buf(void *); -extern int wl_ucode_init_buf(wl_info_t *wl, void **pbuf, u32 idx); -extern int wl_ucode_init_uint(wl_info_t *wl, u32 *data, u32 idx); -#endif /* WLC_LOW */ #endif /* _wl_mac80211_h_ */ diff --git a/drivers/staging/brcm80211/sys/wl_ucode.h b/drivers/staging/brcm80211/sys/wl_ucode.h index a1ba372..2a0f402 100644 --- a/drivers/staging/brcm80211/sys/wl_ucode.h +++ b/drivers/staging/brcm80211/sys/wl_ucode.h @@ -14,6 +14,9 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#define MIN_FW_SIZE 40000 /* minimum firmware file size in bytes */ +#define MAX_FW_SIZE 150000 + typedef struct d11init { u16 addr; u16 size; @@ -35,3 +38,12 @@ extern u32 *bcm43xx_24_lcn; extern u32 bcm43xx_24_lcnsz; extern u32 *bcm43xx_bommajor; extern u32 *bcm43xx_bomminor; + +extern int wl_ucode_data_init(struct wl_info *wl); +extern void wl_ucode_data_free(void); + +extern int wl_ucode_init_buf(struct wl_info *wl, void **pbuf, unsigned int idx); +extern int wl_ucode_init_uint(struct wl_info *wl, unsigned *data, + unsigned int idx); +extern void wl_ucode_free_buf(void *); +extern int wl_check_firmwares(struct wl_info *wl); diff --git a/drivers/staging/brcm80211/sys/wl_ucode_loader.c b/drivers/staging/brcm80211/sys/wl_ucode_loader.c index 0b41a9c..23e10f3 100644 --- a/drivers/staging/brcm80211/sys/wl_ucode_loader.c +++ b/drivers/staging/brcm80211/sys/wl_ucode_loader.c @@ -14,17 +14,12 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -typedef struct wl_info wl_info_t; #include <linux/types.h> #include <bcmdefs.h> #include <d11ucode_ext.h> #include <wl_ucode.h> -extern int wl_ucode_init_buf(wl_info_t *wl, void **pbuf, unsigned int idx); -extern int wl_ucode_init_uint(wl_info_t *wl, unsigned *data, unsigned int idx); -extern int wl_ucode_data_init(wl_info_t *wl); -extern void wl_ucode_data_free(void); -extern void wl_ucode_free_buf(void *); + d11init_t *d11lcn0bsinitvals24; d11init_t *d11lcn0initvals24; @@ -42,8 +37,12 @@ u32 bcm43xx_24_lcnsz; u32 *bcm43xx_bommajor; u32 *bcm43xx_bomminor; -int wl_ucode_data_init(wl_info_t *wl) +int wl_ucode_data_init(struct wl_info *wl) { + int rc; + rc = wl_check_firmwares(wl); + if (rc < 0) + return rc; wl_ucode_init_buf(wl, (void **)&d11lcn0bsinitvals24, D11LCN0BSINITVALS24); wl_ucode_init_buf(wl, (void **)&d11lcn0initvals24, D11LCN0INITVALS24); diff --git a/drivers/staging/brcm80211/sys/wlc_alloc.c b/drivers/staging/brcm80211/sys/wlc_alloc.c index 2dc89f9..746439e 100644 --- a/drivers/staging/brcm80211/sys/wlc_alloc.c +++ b/drivers/staging/brcm80211/sys/wlc_alloc.c @@ -17,28 +17,33 @@ #include <linux/string.h> #include <bcmdefs.h> #include <wlc_cfg.h> -#include <linuxver.h> +#include <linux/module.h> +#include <linux/pci.h> #include <osl.h> #include <bcmutils.h> #include <siutils.h> #include <wlioctl.h> #include <wlc_pub.h> #include <wlc_key.h> +#include <sbhndpio.h> +#include <sbhnddma.h> +#include <wlc_event.h> #include <wlc_mac80211.h> #include <wlc_alloc.h> +#include <wl_dbg.h> -static wlc_pub_t *wlc_pub_malloc(osl_t *osh, uint unit, uint *err, - uint devid); -static void wlc_pub_mfree(osl_t *osh, wlc_pub_t *pub); +static struct wlc_pub *wlc_pub_malloc(struct osl_info *osh, uint unit, + uint *err, uint devid); +static void wlc_pub_mfree(struct osl_info *osh, struct wlc_pub *pub); static void wlc_tunables_init(wlc_tunables_t *tunables, uint devid); -void *wlc_calloc(osl_t *osh, uint unit, uint size) +void *wlc_calloc(struct osl_info *osh, uint unit, uint size) { void *item; item = kzalloc(size, GFP_ATOMIC); if (item == NULL) - WL_ERROR(("wl%d: %s: out of memory\n", unit, __func__)); + WL_ERROR("wl%d: %s: out of memory\n", unit, __func__); return item; } @@ -58,18 +63,14 @@ void wlc_tunables_init(wlc_tunables_t *tunables, uint devid) tunables->ampdudatahiwat = WLC_AMPDUDATAHIWAT; tunables->rxbnd = RXBND; tunables->txsbnd = TXSBND; -#if defined(WLC_HIGH_ONLY) && defined(NTXD_USB_4319) - if (devid == BCM4319_CHIP_ID) { - tunables->ntxd = NTXD_USB_4319; - } -#endif /* WLC_HIGH_ONLY */ } -static wlc_pub_t *wlc_pub_malloc(osl_t *osh, uint unit, uint *err, uint devid) +static struct wlc_pub *wlc_pub_malloc(struct osl_info *osh, uint unit, + uint *err, uint devid) { - wlc_pub_t *pub; + struct wlc_pub *pub; - pub = (wlc_pub_t *) wlc_calloc(osh, unit, sizeof(wlc_pub_t)); + pub = (struct wlc_pub *) wlc_calloc(osh, unit, sizeof(struct wlc_pub)); if (pub == NULL) { *err = 1001; goto fail; @@ -99,7 +100,7 @@ static wlc_pub_t *wlc_pub_malloc(osl_t *osh, uint unit, uint *err, uint devid) return NULL; } -static void wlc_pub_mfree(osl_t *osh, wlc_pub_t *pub) +static void wlc_pub_mfree(struct osl_info *osh, struct wlc_pub *pub) { if (pub == NULL) return; @@ -114,7 +115,7 @@ static void wlc_pub_mfree(osl_t *osh, wlc_pub_t *pub) kfree(pub); } -wlc_bsscfg_t *wlc_bsscfg_malloc(osl_t *osh, uint unit) +wlc_bsscfg_t *wlc_bsscfg_malloc(struct osl_info *osh, uint unit) { wlc_bsscfg_t *cfg; @@ -134,7 +135,7 @@ wlc_bsscfg_t *wlc_bsscfg_malloc(osl_t *osh, uint unit) return NULL; } -void wlc_bsscfg_mfree(osl_t *osh, wlc_bsscfg_t *cfg) +void wlc_bsscfg_mfree(struct osl_info *osh, wlc_bsscfg_t *cfg) { if (cfg == NULL) return; @@ -155,7 +156,7 @@ void wlc_bsscfg_mfree(osl_t *osh, wlc_bsscfg_t *cfg) kfree(cfg); } -void wlc_bsscfg_ID_assign(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg) +void wlc_bsscfg_ID_assign(struct wlc_info *wlc, wlc_bsscfg_t *bsscfg) { bsscfg->ID = wlc->next_bsscfg_ID; wlc->next_bsscfg_ID++; @@ -164,11 +165,13 @@ void wlc_bsscfg_ID_assign(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg) /* * The common driver entry routine. Error codes should be unique */ -wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid) +struct wlc_info *wlc_attach_malloc(struct osl_info *osh, uint unit, uint *err, + uint devid) { - wlc_info_t *wlc; + struct wlc_info *wlc; - wlc = (wlc_info_t *) wlc_calloc(osh, unit, sizeof(wlc_info_t)); + wlc = (struct wlc_info *) wlc_calloc(osh, unit, + sizeof(struct wlc_info)); if (wlc == NULL) { *err = 1002; goto fail; @@ -176,7 +179,7 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid) wlc->hwrxoff = WL_HWRXOFF; - /* allocate wlc_pub_t state structure */ + /* allocate struct wlc_pub state structure */ wlc->pub = wlc_pub_malloc(osh, unit, err, devid); if (wlc->pub == NULL) { *err = 1003; @@ -184,17 +187,16 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid) } wlc->pub->wlc = wlc; - /* allocate wlc_hw_info_t state structure */ + /* allocate struct wlc_hw_info state structure */ - wlc->hw = (wlc_hw_info_t *)wlc_calloc(osh, unit, - sizeof(wlc_hw_info_t)); + wlc->hw = (struct wlc_hw_info *)wlc_calloc(osh, unit, + sizeof(struct wlc_hw_info)); if (wlc->hw == NULL) { *err = 1005; goto fail; } wlc->hw->wlc = wlc; -#ifdef WLC_LOW wlc->hw->bandstate[0] = (wlc_hwband_t *)wlc_calloc(osh, unit, (sizeof(wlc_hwband_t) * MAXBANDS)); if (wlc->hw->bandstate[0] == NULL) { @@ -209,7 +211,6 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid) (sizeof(wlc_hwband_t) * i)); } } -#endif /* WLC_LOW */ wlc->modulecb = (modulecb_t *)wlc_calloc(osh, unit, sizeof(modulecb_t) * WLC_MAXMODULES); @@ -266,8 +267,8 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid) goto fail; } - wlc->bandstate[0] = (wlcband_t *)wlc_calloc(osh, unit, - (sizeof(wlcband_t) * MAXBANDS)); + wlc->bandstate[0] = (struct wlcband *)wlc_calloc(osh, unit, + (sizeof(struct wlcband)*MAXBANDS)); if (wlc->bandstate[0] == NULL) { *err = 1025; goto fail; @@ -276,12 +277,13 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid) for (i = 1; i < MAXBANDS; i++) { wlc->bandstate[i] = - (wlcband_t *) ((unsigned long)wlc->bandstate[0] + - (sizeof(wlcband_t) * i)); + (struct wlcband *) ((unsigned long)wlc->bandstate[0] + + (sizeof(struct wlcband)*i)); } } - wlc->corestate = (wlccore_t *)wlc_calloc(osh, unit, sizeof(wlccore_t)); + wlc->corestate = (struct wlccore *)wlc_calloc(osh, unit, + sizeof(struct wlccore)); if (wlc->corestate == NULL) { *err = 1026; goto fail; @@ -301,7 +303,7 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid) return NULL; } -void wlc_detach_mfree(wlc_info_t *wlc, osl_t *osh) +void wlc_detach_mfree(struct wlc_info *wlc, struct osl_info *osh) { if (wlc == NULL) return; @@ -355,12 +357,10 @@ void wlc_detach_mfree(wlc_info_t *wlc, osl_t *osh) } if (wlc->hw) { -#ifdef WLC_LOW if (wlc->hw->bandstate[0]) { kfree(wlc->hw->bandstate[0]); wlc->hw->bandstate[0] = NULL; } -#endif /* free hw struct */ kfree(wlc->hw); diff --git a/drivers/staging/brcm80211/sys/wlc_alloc.h b/drivers/staging/brcm80211/sys/wlc_alloc.h index 678a2b9..ac34f78 100644 --- a/drivers/staging/brcm80211/sys/wlc_alloc.h +++ b/drivers/staging/brcm80211/sys/wlc_alloc.h @@ -14,12 +14,12 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -extern void *wlc_calloc(osl_t *osh, uint unit, uint size); +extern void *wlc_calloc(struct osl_info *osh, uint unit, uint size); -extern wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, - uint devid); -extern void wlc_detach_mfree(wlc_info_t *wlc, osl_t *osh); +extern struct wlc_info *wlc_attach_malloc(struct osl_info *osh, uint unit, + uint *err, uint devid); +extern void wlc_detach_mfree(struct wlc_info *wlc, struct osl_info *osh); struct wlc_bsscfg; -extern struct wlc_bsscfg *wlc_bsscfg_malloc(osl_t *osh, uint unit); -extern void wlc_bsscfg_mfree(osl_t *osh, struct wlc_bsscfg *cfg); +extern struct wlc_bsscfg *wlc_bsscfg_malloc(struct osl_info *osh, uint unit); +extern void wlc_bsscfg_mfree(struct osl_info *osh, struct wlc_bsscfg *cfg); diff --git a/drivers/staging/brcm80211/sys/wlc_ampdu.c b/drivers/staging/brcm80211/sys/wlc_ampdu.c index a4e49f3..d749917 100644 --- a/drivers/staging/brcm80211/sys/wlc_ampdu.c +++ b/drivers/staging/brcm80211/sys/wlc_ampdu.c @@ -16,19 +16,19 @@ #include <linux/kernel.h> #include <wlc_cfg.h> #include <bcmdefs.h> -#include <linuxver.h> -#include <bcmdefs.h> #include <osl.h> #include <bcmutils.h> #include <siutils.h> #include <bcmendian.h> #include <wlioctl.h> +#include <sbhndpio.h> #include <sbhnddma.h> #include <hnddma.h> #include <d11.h> #include <wlc_rate.h> #include <wlc_pub.h> #include <wlc_key.h> +#include <wlc_event.h> #include <wlc_mac80211.h> #include <wlc_phy_hal.h> #include <wlc_antsel.h> @@ -36,11 +36,8 @@ #include <net/mac80211.h> #include <wlc_ampdu.h> #include <wl_export.h> +#include <wl_dbg.h> -#ifdef WLC_HIGH_ONLY -#include <bcm_rpc_tp.h> -#include <wlc_rpctx.h> -#endif #define AMPDU_MAX_MPDU 32 /* max number of mpdus in an ampdu */ #define AMPDU_NUM_MPDU_LEGACY 16 /* max number of mpdus in an ampdu to a legacy */ @@ -101,7 +98,7 @@ typedef struct wlc_fifo_info { /* AMPDU module specific state */ struct ampdu_info { - wlc_info_t *wlc; /* pointer to main wlc structure */ + struct wlc_info *wlc; /* pointer to main wlc structure */ int scb_handle; /* scb cubby handle to retrieve data from scb */ u8 ini_enable[AMPDU_MAX_SCB_TID]; /* per-tid initiator enable/disable of ampdu */ u8 ba_tx_wsize; /* Tx ba window size (in pdu) */ @@ -125,11 +122,6 @@ struct ampdu_info { */ wlc_fifo_info_t fifo_tb[NUM_FFPLD_FIFO]; /* table of fifo infos */ -#ifdef WLC_HIGH_ONLY - void *p; - tx_status_t txs; - bool waiting_status; /* To help sanity checks */ -#endif }; #define AMPDU_CLEANUPFLAG_RX (0x1) @@ -138,38 +130,39 @@ struct ampdu_info { #define SCB_AMPDU_CUBBY(ampdu, scb) (&(scb->scb_ampdu)) #define SCB_AMPDU_INI(scb_ampdu, tid) (&(scb_ampdu->ini[tid])) -static void wlc_ffpld_init(ampdu_info_t *ampdu); -static int wlc_ffpld_check_txfunfl(wlc_info_t *wlc, int f); -static void wlc_ffpld_calc_mcs2ampdu_table(ampdu_info_t *ampdu, int f); +static void wlc_ffpld_init(struct ampdu_info *ampdu); +static int wlc_ffpld_check_txfunfl(struct wlc_info *wlc, int f); +static void wlc_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f); -static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(ampdu_info_t *ampdu, +static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(struct ampdu_info *ampdu, scb_ampdu_t *scb_ampdu, u8 tid, bool override); -static void ampdu_cleanup_tid_ini(ampdu_info_t *ampdu, scb_ampdu_t *scb_ampdu, +static void ampdu_cleanup_tid_ini(struct ampdu_info *ampdu, + scb_ampdu_t *scb_ampdu, u8 tid, bool force); -static void ampdu_update_max_txlen(ampdu_info_t *ampdu, u8 dur); -static void scb_ampdu_update_config(ampdu_info_t *ampdu, struct scb *scb); -static void scb_ampdu_update_config_all(ampdu_info_t *ampdu); +static void ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur); +static void scb_ampdu_update_config(struct ampdu_info *ampdu, struct scb *scb); +static void scb_ampdu_update_config_all(struct ampdu_info *ampdu); #define wlc_ampdu_txflowcontrol(a, b, c) do {} while (0) -static void wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, - void *p, tx_status_t *txs, - u32 frmtxstatus, - u32 frmtxstatus2); +static void wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, + struct scb *scb, + struct sk_buff *p, tx_status_t *txs, + u32 frmtxstatus, u32 frmtxstatus2); -static inline u16 pkt_txh_seqnum(wlc_info_t *wlc, void *p) +static inline u16 pkt_txh_seqnum(struct wlc_info *wlc, struct sk_buff *p) { d11txh_t *txh; struct dot11_header *h; - txh = (d11txh_t *) PKTDATA(p); + txh = (d11txh_t *) p->data; h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); return ltoh16(h->seq) >> SEQNUM_SHIFT; } -ampdu_info_t *wlc_ampdu_attach(wlc_info_t *wlc) +struct ampdu_info *wlc_ampdu_attach(struct wlc_info *wlc) { - ampdu_info_t *ampdu; + struct ampdu_info *ampdu; int i; /* some code depends on packed structures */ @@ -179,9 +172,10 @@ ampdu_info_t *wlc_ampdu_attach(wlc_info_t *wlc) ASSERT(wlc->pub->tunables->ampdunummpdu <= AMPDU_MAX_MPDU); ASSERT(wlc->pub->tunables->ampdunummpdu > 0); - ampdu = kzalloc(sizeof(ampdu_info_t), GFP_ATOMIC); + ampdu = kzalloc(sizeof(struct ampdu_info), GFP_ATOMIC); if (!ampdu) { - WL_ERROR(("wl%d: wlc_ampdu_attach: out of mem\n", wlc->pub->unit)); + WL_ERROR("wl%d: wlc_ampdu_attach: out of mem\n", + wlc->pub->unit); return NULL; } ampdu->wlc = wlc; @@ -209,10 +203,6 @@ ampdu_info_t *wlc_ampdu_attach(wlc_info_t *wlc) ampdu->rx_factor = AMPDU_RX_FACTOR_32K; else ampdu->rx_factor = AMPDU_RX_FACTOR_64K; -#ifdef WLC_HIGH_ONLY - /* Restrict to smaller rcv size for BMAC dongle */ - ampdu->rx_factor = AMPDU_RX_FACTOR_32K; -#endif ampdu->retry_limit = AMPDU_DEF_RETRY_LIMIT; ampdu->rr_retry_limit = AMPDU_DEF_RR_RETRY_LIMIT; @@ -232,7 +222,7 @@ ampdu_info_t *wlc_ampdu_attach(wlc_info_t *wlc) return ampdu; } -void wlc_ampdu_detach(ampdu_info_t *ampdu) +void wlc_ampdu_detach(struct ampdu_info *ampdu) { int i; @@ -250,12 +240,12 @@ void wlc_ampdu_detach(ampdu_info_t *ampdu) kfree(ampdu); } -void scb_ampdu_cleanup(ampdu_info_t *ampdu, struct scb *scb) +void scb_ampdu_cleanup(struct ampdu_info *ampdu, struct scb *scb) { scb_ampdu_t *scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); u8 tid; - WL_AMPDU_UPDN(("scb_ampdu_cleanup: enter\n")); + WL_AMPDU_UPDN("scb_ampdu_cleanup: enter\n"); ASSERT(scb_ampdu); for (tid = 0; tid < AMPDU_MAX_SCB_TID; tid++) { @@ -266,12 +256,12 @@ void scb_ampdu_cleanup(ampdu_info_t *ampdu, struct scb *scb) /* reset the ampdu state machine so that it can gracefully handle packets that were * freed from the dma and tx queues during reinit */ -void wlc_ampdu_reset(ampdu_info_t *ampdu) +void wlc_ampdu_reset(struct ampdu_info *ampdu) { - WL_NONE(("%s: Entering\n", __func__)); + WL_NONE("%s: Entering\n", __func__); } -static void scb_ampdu_update_config(ampdu_info_t *ampdu, struct scb *scb) +static void scb_ampdu_update_config(struct ampdu_info *ampdu, struct scb *scb) { scb_ampdu_t *scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); int i; @@ -301,12 +291,12 @@ static void scb_ampdu_update_config(ampdu_info_t *ampdu, struct scb *scb) ASSERT(scb_ampdu->release); } -void scb_ampdu_update_config_all(ampdu_info_t *ampdu) +void scb_ampdu_update_config_all(struct ampdu_info *ampdu) { scb_ampdu_update_config(ampdu, ampdu->wlc->pub->global_scb); } -static void wlc_ffpld_init(ampdu_info_t *ampdu) +static void wlc_ffpld_init(struct ampdu_info *ampdu) { int i, j; wlc_fifo_info_t *fifo; @@ -330,9 +320,9 @@ static void wlc_ffpld_init(ampdu_info_t *ampdu) * Return 1 if pre-loading not active, -1 if not an underflow event, * 0 if pre-loading module took care of the event. */ -static int wlc_ffpld_check_txfunfl(wlc_info_t *wlc, int fid) +static int wlc_ffpld_check_txfunfl(struct wlc_info *wlc, int fid) { - ampdu_info_t *ampdu = wlc->ampdu; + struct ampdu_info *ampdu = wlc->ampdu; u32 phy_rate = MCS_RATE(FFPLD_MAX_MCS, true, false); u32 txunfl_ratio; u8 max_mpdu; @@ -349,7 +339,7 @@ static int wlc_ffpld_check_txfunfl(wlc_info_t *wlc, int fid) M_UCODE_MACSTAT + offsetof(macstat_t, txfunfl[fid])); new_txunfl = (u16) (cur_txunfl - fifo->prev_txfunfl); if (new_txunfl == 0) { - WL_FFPLD(("check_txunfl : TX status FRAG set but no tx underflows\n")); + WL_FFPLD("check_txunfl : TX status FRAG set but no tx underflows\n"); return -1; } fifo->prev_txfunfl = cur_txunfl; @@ -359,7 +349,7 @@ static int wlc_ffpld_check_txfunfl(wlc_info_t *wlc, int fid) /* check if fifo is big enough */ if (wlc_xmtfifo_sz_get(wlc, fid, &xmtfifo_sz)) { - WL_FFPLD(("check_txunfl : get xmtfifo_sz failed.\n")); + WL_FFPLD("check_txunfl : get xmtfifo_sz failed\n"); return -1; } @@ -373,8 +363,8 @@ static int wlc_ffpld_check_txfunfl(wlc_info_t *wlc, int fid) if (fifo->accum_txfunfl < 10) return 0; - WL_FFPLD(("ampdu_count %d tx_underflows %d\n", - current_ampdu_cnt, fifo->accum_txfunfl)); + WL_FFPLD("ampdu_count %d tx_underflows %d\n", + current_ampdu_cnt, fifo->accum_txfunfl); /* compute the current ratio of tx unfl per ampdu. @@ -427,8 +417,8 @@ static int wlc_ffpld_check_txfunfl(wlc_info_t *wlc, int fid) (max_mpdu * FFPLD_MPDU_SIZE - fifo->ampdu_pld_size)) / (max_mpdu * FFPLD_MPDU_SIZE)) * 100; - WL_FFPLD(("DMA estimated transfer rate %d; pre-load size %d\n", - fifo->dmaxferrate, fifo->ampdu_pld_size)); + WL_FFPLD("DMA estimated transfer rate %d; pre-load size %d\n", + fifo->dmaxferrate, fifo->ampdu_pld_size); } else { /* decrease ampdu size */ @@ -450,7 +440,7 @@ static int wlc_ffpld_check_txfunfl(wlc_info_t *wlc, int fid) return 0; } -static void wlc_ffpld_calc_mcs2ampdu_table(ampdu_info_t *ampdu, int f) +static void wlc_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f) { int i; u32 phy_rate, dma_rate, tmp; @@ -483,11 +473,12 @@ static void wlc_ffpld_calc_mcs2ampdu_table(ampdu_info_t *ampdu, int f) } static void BCMFASTPATH -wlc_ampdu_agg(ampdu_info_t *ampdu, struct scb *scb, void *p, uint prec) +wlc_ampdu_agg(struct ampdu_info *ampdu, struct scb *scb, struct sk_buff *p, + uint prec) { scb_ampdu_t *scb_ampdu; scb_ampdu_tid_ini_t *ini; - u8 tid = (u8) PKTPRIO(p); + u8 tid = (u8) (p->priority); scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); @@ -500,11 +491,12 @@ wlc_ampdu_agg(ampdu_info_t *ampdu, struct scb *scb, void *p, uint prec) } int BCMFASTPATH -wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) +wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi, + struct sk_buff **pdu, int prec) { - wlc_info_t *wlc; - osl_t *osh; - void *p, *pkt[AMPDU_MAX_MPDU]; + struct wlc_info *wlc; + struct osl_info *osh; + struct sk_buff *p, *pkt[AMPDU_MAX_MPDU]; u8 tid, ndelim; int err = 0; u8 preamble_type = WLC_GF_PREAMBLE; @@ -540,7 +532,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) ASSERT(p); - tid = (u8) PKTPRIO(p); + tid = (u8) (p->priority); ASSERT(tid < AMPDU_MAX_SCB_TID); f = ampdu->fifo_tb + prio2fifo[tid]; @@ -561,7 +553,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) wlc_ampdu_agg(ampdu, scb, p, tid); if (wlc->block_datafifo) { - WL_ERROR(("%s: Fifo blocked\n", __func__)); + WL_ERROR("%s: Fifo blocked\n", __func__); return BCME_BUSY; } rr_retry_limit = ampdu->rr_retry_limit_tid[tid]; @@ -576,7 +568,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { err = wlc_prep_pdu(wlc, p, &fifo); } else { - WL_ERROR(("%s: AMPDU flag is off!\n", __func__)); + WL_ERROR("%s: AMPDU flag is off!\n", __func__); *pdu = NULL; err = 0; break; @@ -584,14 +576,16 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) if (err) { if (err == BCME_BUSY) { - WL_ERROR(("wl%d: wlc_sendampdu: prep_xdu retry; seq 0x%x\n", wlc->pub->unit, seq)); + WL_ERROR("wl%d: wlc_sendampdu: prep_xdu retry; seq 0x%x\n", + wlc->pub->unit, seq); WLCNTINCR(ampdu->cnt->sduretry); *pdu = p; break; } /* error in the packet; reject it */ - WL_AMPDU_ERR(("wl%d: wlc_sendampdu: prep_xdu rejected; seq 0x%x\n", wlc->pub->unit, seq)); + WL_AMPDU_ERR("wl%d: wlc_sendampdu: prep_xdu rejected; seq 0x%x\n", + wlc->pub->unit, seq); WLCNTINCR(ampdu->cnt->sdurejected); *pdu = NULL; @@ -600,7 +594,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) /* pkt is good to be aggregated */ ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU); - txh = (d11txh_t *) PKTDATA(p); + txh = (d11txh_t *) p->data; plcp = (u8 *) (txh + 1); h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN); seq = ltoh16(h->seq) >> SEQNUM_SHIFT; @@ -633,8 +627,8 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; seg_cnt += 1; - WL_AMPDU_TX(("wl%d: wlc_sendampdu: mpdu %d plcp_len %d\n", - wlc->pub->unit, count, len)); + WL_AMPDU_TX("wl%d: wlc_sendampdu: mpdu %d plcp_len %d\n", + wlc->pub->unit, count, len); /* * aggregateable mpdu. For ucode/hw agg, @@ -665,7 +659,8 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) dma_len += (u16) pkttotlen(osh, p); - WL_AMPDU_TX(("wl%d: wlc_sendampdu: ampdu_len %d seg_cnt %d null delim %d\n", wlc->pub->unit, ampdu_len, seg_cnt, ndelim)); + WL_AMPDU_TX("wl%d: wlc_sendampdu: ampdu_len %d seg_cnt %d null delim %d\n", + wlc->pub->unit, ampdu_len, seg_cnt, ndelim); txh->MacTxControlLow = htol16(mcl); @@ -695,8 +690,8 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) min(scb_ampdu->max_rxlen, ampdu->max_txlen[mcs][is40][sgi]); - WL_NONE(("sendampdu: sgi %d, is40 %d, mcs %d\n", sgi, - is40, mcs)); + WL_NONE("sendampdu: sgi %d, is40 %d, mcs %d\n", + sgi, is40, mcs); maxlen = 64 * 1024; /* XXX Fix me to honor real max_rxlen */ @@ -739,13 +734,14 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) /* test whether to add more */ if ((MCS_RATE(mcs, true, false) >= f->dmaxferrate) && (count == f->mcs2ampdu_table[mcs])) { - WL_AMPDU_ERR(("wl%d: PR 37644: stopping ampdu at %d for mcs %d", wlc->pub->unit, count, mcs)); + WL_AMPDU_ERR("wl%d: PR 37644: stopping ampdu at %d for mcs %d\n", + wlc->pub->unit, count, mcs); break; } if (count == scb_ampdu->max_pdu) { - WL_NONE(("Stop taking from q, reached %d deep\n", - scb_ampdu->max_pdu)); + WL_NONE("Stop taking from q, reached %d deep\n", + scb_ampdu->max_pdu); break; } @@ -755,7 +751,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) if (p) { if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && - ((u8) PKTPRIO(p) == tid)) { + ((u8) (p->priority) == tid)) { plen = pkttotlen(osh, p) + AMPDU_MAX_MPDU_OVERHEAD; @@ -763,15 +759,16 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) if ((plen + ampdu_len) > maxlen) { p = NULL; - WL_ERROR(("%s: Bogus plen #1\n", - __func__)); + WL_ERROR("%s: Bogus plen #1\n", + __func__); ASSERT(3 == 4); continue; } /* check if there are enough descriptors available */ if (TXAVAIL(wlc, fifo) <= (seg_cnt + 1)) { - WL_ERROR(("%s: No fifo space !!!!!!\n", __func__)); + WL_ERROR("%s: No fifo space !!!!!!\n", + __func__); p = NULL; continue; } @@ -789,7 +786,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) WLCNTADD(ampdu->cnt->txmpdu, count); /* patch up the last txh */ - txh = (d11txh_t *) PKTDATA(pkt[count - 1]); + txh = (d11txh_t *) pkt[count - 1]->data; mcl = ltoh16(txh->MacTxControlLow); mcl &= ~TXC_AMPDU_MASK; mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT); @@ -807,7 +804,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) ampdu_len -= roundup(len, 4) - len; /* patch up the first txh & plcp */ - txh = (d11txh_t *) PKTDATA(pkt[0]); + txh = (d11txh_t *) pkt[0]->data; plcp = (u8 *) (txh + 1); WLC_SET_MIMO_PLCP_LEN(plcp, ampdu_len); @@ -878,27 +875,18 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) WLC_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback); } - WL_AMPDU_TX(("wl%d: wlc_sendampdu: count %d ampdu_len %d\n", - wlc->pub->unit, count, ampdu_len)); + WL_AMPDU_TX("wl%d: wlc_sendampdu: count %d ampdu_len %d\n", + wlc->pub->unit, count, ampdu_len); /* inform rate_sel if it this is a rate probe pkt */ frameid = ltoh16(txh->TxFrameID); if (frameid & TXFID_RATE_PROBE_MASK) { - WL_ERROR(("%s: XXX what to do with TXFID_RATE_PROBE_MASK!?\n", __func__)); + WL_ERROR("%s: XXX what to do with TXFID_RATE_PROBE_MASK!?\n", + __func__); } -#ifdef WLC_HIGH_ONLY - if (wlc->rpc_agg & BCM_RPC_TP_HOST_AGG_AMPDU) - bcm_rpc_tp_agg_set(bcm_rpc_tp_get(wlc->rpc), - BCM_RPC_TP_HOST_AGG_AMPDU, true); -#endif for (i = 0; i < count; i++) wlc_txfifo(wlc, fifo, pkt[i], i == (count - 1), ampdu->txpkt_weight); -#ifdef WLC_HIGH_ONLY - if (wlc->rpc_agg & BCM_RPC_TP_HOST_AGG_AMPDU) - bcm_rpc_tp_agg_set(bcm_rpc_tp_get(wlc->rpc), - BCM_RPC_TP_HOST_AGG_AMPDU, false); -#endif } /* endif (count) */ @@ -906,11 +894,11 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) } void BCMFASTPATH -wlc_ampdu_dotxstatus(ampdu_info_t *ampdu, struct scb *scb, void *p, - tx_status_t *txs) +wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, + struct sk_buff *p, tx_status_t *txs) { scb_ampdu_t *scb_ampdu; - wlc_info_t *wlc = ampdu->wlc; + struct wlc_info *wlc = ampdu->wlc; scb_ampdu_tid_ini_t *ini; u32 s1 = 0, s2 = 0; struct ieee80211_tx_info *tx_info; @@ -922,7 +910,7 @@ wlc_ampdu_dotxstatus(ampdu_info_t *ampdu, struct scb *scb, void *p, ASSERT(txs->status & TX_STATUS_AMPDU); scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); ASSERT(scb_ampdu); - ini = SCB_AMPDU_INI(scb_ampdu, PKTPRIO(p)); + ini = SCB_AMPDU_INI(scb_ampdu, p->priority); ASSERT(ini->scb == scb); /* BMAC_NOTE: For the split driver, second level txstatus comes later @@ -930,7 +918,6 @@ wlc_ampdu_dotxstatus(ampdu_info_t *ampdu, struct scb *scb, void *p, * call the first one */ if (txs->status & TX_STATUS_ACK_RCV) { -#ifdef WLC_LOW u8 status_delay = 0; /* wait till the next 8 bytes of txstatus is available */ @@ -948,54 +935,14 @@ wlc_ampdu_dotxstatus(ampdu_info_t *ampdu, struct scb *scb, void *p, ASSERT(!(s1 & TX_STATUS_INTERMEDIATE)); ASSERT(s1 & TX_STATUS_AMPDU); s2 = R_REG(wlc->osh, &wlc->regs->frmtxstatus2); -#else /* WLC_LOW */ - - /* Store the relevant information in ampdu structure */ - WL_AMPDU_TX(("wl%d: wlc_ampdu_dotxstatus: High Recvd\n", - wlc->pub->unit)); - - ASSERT(!ampdu->p); - ampdu->p = p; - bcopy(txs, &du->txs, sizeof(tx_status_t)); - ampdu->waiting_status = true; - return; -#endif /* WLC_LOW */ } wlc_ampdu_dotxstatus_complete(ampdu, scb, p, txs, s1, s2); wlc_ampdu_txflowcontrol(wlc, scb_ampdu, ini); } -#ifdef WLC_HIGH_ONLY -void wlc_ampdu_txstatus_complete(ampdu_info_t *ampdu, u32 s1, u32 s2) -{ - WL_AMPDU_TX(("wl%d: wlc_ampdu_txstatus_complete: High Recvd 0x%x 0x%x p:%p\n", ampdu->wlc->pub->unit, s1, s2, ampdu->p)); - - ASSERT(ampdu->waiting_status); - - /* The packet may have been freed if the SCB went away, if so, then still free the - * DMA chain - */ - if (ampdu->p) { - struct ieee80211_tx_info *tx_info; - struct scb *scb; - - tx_info = IEEE80211_SKB_CB(ampdu->p); - scb = (struct scb *)tx_info->control.sta->drv_priv; - - wlc_ampdu_dotxstatus_complete(ampdu, scb, ampdu->p, &du->txs, - s1, s2); - ampdu->p = NULL; - } - - ampdu->waiting_status = false; -} -#endif /* WLC_HIGH_ONLY */ -void rate_status(wlc_info_t *wlc, struct ieee80211_tx_info *tx_info, - tx_status_t *txs, u8 mcs); - void -rate_status(wlc_info_t *wlc, struct ieee80211_tx_info *tx_info, +rate_status(struct wlc_info *wlc, struct ieee80211_tx_info *tx_info, tx_status_t *txs, u8 mcs) { struct ieee80211_tx_rate *txrate = tx_info->status.rates; @@ -1008,17 +955,15 @@ rate_status(wlc_info_t *wlc, struct ieee80211_tx_info *tx_info, } } -extern void wlc_txq_enq(wlc_info_t *wlc, struct scb *scb, void *sdu, - uint prec); - #define SHORTNAME "AMPDU status" static void BCMFASTPATH -wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, - tx_status_t *txs, u32 s1, u32 s2) +wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, + struct sk_buff *p, tx_status_t *txs, + u32 s1, u32 s2) { scb_ampdu_t *scb_ampdu; - wlc_info_t *wlc = ampdu->wlc; + struct wlc_info *wlc = ampdu->wlc; scb_ampdu_tid_ini_t *ini; u8 bitmap[8], queue, tid; d11txh_t *txh; @@ -1037,7 +982,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, #ifdef BCMDBG u8 hole[AMPDU_MAX_MPDU]; - bzero(hole, sizeof(hole)); + memset(hole, 0, sizeof(hole)); #endif ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU); @@ -1046,7 +991,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, scb_ampdu = SCB_AMPDU_CUBBY(ampdu, scb); ASSERT(scb_ampdu); - tid = (u8) PKTPRIO(p); + tid = (u8) (p->priority); ini = SCB_AMPDU_INI(scb_ampdu, tid); retry_limit = ampdu->retry_limit_tid[tid]; @@ -1054,7 +999,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, ASSERT(ini->scb == scb); - bzero(bitmap, sizeof(bitmap)); + memset(bitmap, 0, sizeof(bitmap)); queue = txs->frameid & TXFID_QUEUE_MASK; ASSERT(queue < AC_COUNT); @@ -1091,13 +1036,16 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, if (supr_status) { update_rate = false; if (supr_status == TX_STATUS_SUPR_BADCH) { - WL_ERROR(("%s: Pkt tx suppressed, illegal channel possibly %d\n", __func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec))); + WL_ERROR("%s: Pkt tx suppressed, illegal channel possibly %d\n", + __func__, + CHSPEC_CHANNEL(wlc->default_bss->chanspec)); } else { if (supr_status == TX_STATUS_SUPR_FRAG) - WL_NONE(("%s: AMPDU frag err\n", - __func__)); + WL_NONE("%s: AMPDU frag err\n", + __func__); else - WL_ERROR(("%s: wlc_ampdu_dotxstatus: supr_status 0x%x\n", __func__, supr_status)); + WL_ERROR("%s: wlc_ampdu_dotxstatus: supr_status 0x%x\n", + __func__, supr_status); } /* no need to retry for badch; will fail again */ if (supr_status == TX_STATUS_SUPR_BADCH || @@ -1116,22 +1064,18 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, if (wlc_ffpld_check_txfunfl(wlc, prio2fifo[tid]) > 0) { tx_error = true; -#ifdef WLC_HIGH_ONLY - /* With BMAC, TX Underflows should not happen */ - WL_ERROR(("wl%d: BMAC TX Underflow?", - wlc->pub->unit)); -#endif } } } else if (txs->phyerr) { update_rate = false; WLCNTINCR(wlc->pub->_cnt->txphyerr); - WL_ERROR(("wl%d: wlc_ampdu_dotxstatus: tx phy error (0x%x)\n", wlc->pub->unit, txs->phyerr)); + WL_ERROR("wl%d: wlc_ampdu_dotxstatus: tx phy error (0x%x)\n", + wlc->pub->unit, txs->phyerr); #ifdef BCMDBG if (WL_ERROR_ON()) { prpkt("txpkt (AMPDU)", wlc->osh, p); - wlc_print_txdesc((d11txh_t *) PKTDATA(p)); + wlc_print_txdesc((d11txh_t *) p->data); wlc_print_txstatus(txs); } #endif /* BCMDBG */ @@ -1142,7 +1086,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, while (p) { tx_info = IEEE80211_SKB_CB(p); ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU); - txh = (d11txh_t *) PKTDATA(p); + txh = (d11txh_t *) p->data; mcl = ltoh16(txh->MacTxControlLow); plcp = (u8 *) (txh + 1); h = (struct dot11_header *)(plcp + D11_PHY_HDR_LEN); @@ -1158,10 +1102,9 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, if (ba_recd) { bindex = MODSUB_POW2(seq, start_seq, SEQNUM_MAX); - WL_AMPDU_TX(("%s: tid %d seq is %d, start_seq is %d, " - "bindex is %d set %d, index %d\n", - __func__, tid, seq, start_seq, bindex, - isset(bitmap, bindex), index)); + WL_AMPDU_TX("%s: tid %d seq is %d, start_seq is %d, bindex is %d set %d, index %d\n", + __func__, tid, seq, start_seq, bindex, + isset(bitmap, bindex), index); /* if acked then clear bit and free packet */ if ((bindex < AMPDU_TX_BA_MAX_WSIZE) @@ -1186,8 +1129,8 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT; - PKTPULL(p, D11_PHY_HDR_LEN); - PKTPULL(p, D11_TXH_LEN); + skb_pull(p, D11_PHY_HDR_LEN); + skb_pull(p, D11_TXH_LEN); ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p); @@ -1212,9 +1155,10 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, ieee80211_tx_info_clear_status(tx_info); tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; - PKTPULL(p, D11_PHY_HDR_LEN); - PKTPULL(p, D11_TXH_LEN); - WL_ERROR(("%s: BA Timeout, seq %d, in_transit %d\n", SHORTNAME, seq, ini->tx_in_transit)); + skb_pull(p, D11_PHY_HDR_LEN); + skb_pull(p, D11_TXH_LEN); + WL_ERROR("%s: BA Timeout, seq %d, in_transit %d\n", + SHORTNAME, seq, ini->tx_in_transit); ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p); } @@ -1242,7 +1186,7 @@ wlc_ampdu_dotxstatus_complete(ampdu_info_t *ampdu, struct scb *scb, void *p, } static void -ampdu_cleanup_tid_ini(ampdu_info_t *ampdu, scb_ampdu_t *scb_ampdu, u8 tid, +ampdu_cleanup_tid_ini(struct ampdu_info *ampdu, scb_ampdu_t *scb_ampdu, u8 tid, bool force) { scb_ampdu_tid_ini_t *ini; @@ -1250,8 +1194,8 @@ ampdu_cleanup_tid_ini(ampdu_info_t *ampdu, scb_ampdu_t *scb_ampdu, u8 tid, if (!ini) return; - WL_AMPDU_CTL(("wl%d: ampdu_cleanup_tid_ini: tid %d\n", - ampdu->wlc->pub->unit, tid)); + WL_AMPDU_CTL("wl%d: ampdu_cleanup_tid_ini: tid %d\n", + ampdu->wlc->pub->unit, tid); if (ini->tx_in_transit && !force) return; @@ -1264,7 +1208,7 @@ ampdu_cleanup_tid_ini(ampdu_info_t *ampdu, scb_ampdu_t *scb_ampdu, u8 tid, } /* initialize the initiator code for tid */ -static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(ampdu_info_t *ampdu, +static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(struct ampdu_info *ampdu, scb_ampdu_t *scb_ampdu, u8 tid, bool override) { @@ -1277,7 +1221,7 @@ static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(ampdu_info_t *ampdu, /* check for per-tid control of ampdu */ if (!ampdu->ini_enable[tid]) { - WL_ERROR(("%s: Rejecting tid %d\n", __func__, tid)); + WL_ERROR("%s: Rejecting tid %d\n", __func__, tid); return NULL; } @@ -1290,21 +1234,21 @@ static scb_ampdu_tid_ini_t *wlc_ampdu_init_tid_ini(ampdu_info_t *ampdu, return ini; } -int wlc_ampdu_set(ampdu_info_t *ampdu, bool on) +int wlc_ampdu_set(struct ampdu_info *ampdu, bool on) { - wlc_info_t *wlc = ampdu->wlc; + struct wlc_info *wlc = ampdu->wlc; wlc->pub->_ampdu = false; if (on) { if (!N_ENAB(wlc->pub)) { - WL_AMPDU_ERR(("wl%d: driver not nmode enabled\n", - wlc->pub->unit)); + WL_AMPDU_ERR("wl%d: driver not nmode enabled\n", + wlc->pub->unit); return BCME_UNSUPPORTED; } if (!wlc_ampdu_cap(ampdu)) { - WL_AMPDU_ERR(("wl%d: device not ampdu capable\n", - wlc->pub->unit)); + WL_AMPDU_ERR("wl%d: device not ampdu capable\n", + wlc->pub->unit); return BCME_UNSUPPORTED; } wlc->pub->_ampdu = on; @@ -1313,7 +1257,7 @@ int wlc_ampdu_set(ampdu_info_t *ampdu, bool on) return 0; } -bool wlc_ampdu_cap(ampdu_info_t *ampdu) +bool wlc_ampdu_cap(struct ampdu_info *ampdu) { if (WLC_PHY_11N_CAP(ampdu->wlc->band)) return true; @@ -1321,7 +1265,7 @@ bool wlc_ampdu_cap(ampdu_info_t *ampdu) return false; } -static void ampdu_update_max_txlen(ampdu_info_t *ampdu, u8 dur) +static void ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur) { u32 rate, mcs; @@ -1343,7 +1287,7 @@ static void ampdu_update_max_txlen(ampdu_info_t *ampdu, u8 dur) } u8 BCMFASTPATH -wlc_ampdu_null_delim_cnt(ampdu_info_t *ampdu, struct scb *scb, +wlc_ampdu_null_delim_cnt(struct ampdu_info *ampdu, struct scb *scb, ratespec_t rspec, int phylen) { scb_ampdu_t *scb_ampdu; @@ -1379,25 +1323,25 @@ wlc_ampdu_null_delim_cnt(ampdu_info_t *ampdu, struct scb *scb, return 0; } -void wlc_ampdu_macaddr_upd(wlc_info_t *wlc) +void wlc_ampdu_macaddr_upd(struct wlc_info *wlc) { char template[T_RAM_ACCESS_SZ * 2]; /* driver needs to write the ta in the template; ta is at offset 16 */ - bzero(template, sizeof(template)); - bcopy((char *)wlc->pub->cur_etheraddr.octet, template, ETHER_ADDR_LEN); + memset(template, 0, sizeof(template)); + bcopy((char *)wlc->pub->cur_etheraddr.octet, template, ETH_ALEN); wlc_write_template_ram(wlc, (T_BA_TPL_BASE + 16), (T_RAM_ACCESS_SZ * 2), template); } -bool wlc_aggregatable(wlc_info_t *wlc, u8 tid) +bool wlc_aggregatable(struct wlc_info *wlc, u8 tid) { return wlc->ampdu->ini_enable[tid]; } -void wlc_ampdu_shm_upd(ampdu_info_t *ampdu) +void wlc_ampdu_shm_upd(struct ampdu_info *ampdu) { - wlc_info_t *wlc = ampdu->wlc; + struct wlc_info *wlc = ampdu->wlc; /* Extend ucode internal watchdog timer to match larger received frames */ if ((ampdu->rx_factor & HT_PARAMS_RX_FACTOR_MASK) == diff --git a/drivers/staging/brcm80211/sys/wlc_ampdu.h b/drivers/staging/brcm80211/sys/wlc_ampdu.h index c721b16..03457f6 100644 --- a/drivers/staging/brcm80211/sys/wlc_ampdu.h +++ b/drivers/staging/brcm80211/sys/wlc_ampdu.h @@ -17,24 +17,20 @@ #ifndef _wlc_ampdu_h_ #define _wlc_ampdu_h_ -extern ampdu_info_t *wlc_ampdu_attach(wlc_info_t *wlc); -extern void wlc_ampdu_detach(ampdu_info_t *ampdu); -extern bool wlc_ampdu_cap(ampdu_info_t *ampdu); -extern int wlc_ampdu_set(ampdu_info_t *ampdu, bool on); -extern int wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **aggp, - int prec); -extern void wlc_ampdu_dotxstatus(ampdu_info_t *ampdu, struct scb *scb, void *p, - tx_status_t *txs); -extern void wlc_ampdu_reset(ampdu_info_t *ampdu); -extern void wlc_ampdu_macaddr_upd(wlc_info_t *wlc); -extern void wlc_ampdu_shm_upd(ampdu_info_t *ampdu); +extern struct ampdu_info *wlc_ampdu_attach(struct wlc_info *wlc); +extern void wlc_ampdu_detach(struct ampdu_info *ampdu); +extern bool wlc_ampdu_cap(struct ampdu_info *ampdu); +extern int wlc_ampdu_set(struct ampdu_info *ampdu, bool on); +extern int wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi, + struct sk_buff **aggp, int prec); +extern void wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, + struct sk_buff *p, tx_status_t *txs); +extern void wlc_ampdu_reset(struct ampdu_info *ampdu); +extern void wlc_ampdu_macaddr_upd(struct wlc_info *wlc); +extern void wlc_ampdu_shm_upd(struct ampdu_info *ampdu); -extern u8 wlc_ampdu_null_delim_cnt(ampdu_info_t *ampdu, struct scb *scb, +extern u8 wlc_ampdu_null_delim_cnt(struct ampdu_info *ampdu, struct scb *scb, ratespec_t rspec, int phylen); -extern void scb_ampdu_cleanup(ampdu_info_t *ampdu, struct scb *scb); -#ifdef WLC_HIGH_ONLY -extern void wlc_ampdu_txstatus_complete(ampdu_info_t *ampdu, u32 s1, - u32 s2); -#endif +extern void scb_ampdu_cleanup(struct ampdu_info *ampdu, struct scb *scb); #endif /* _wlc_ampdu_h_ */ diff --git a/drivers/staging/brcm80211/sys/wlc_antsel.c b/drivers/staging/brcm80211/sys/wlc_antsel.c index 5ff8831..402ddf8 100644 --- a/drivers/staging/brcm80211/sys/wlc_antsel.c +++ b/drivers/staging/brcm80211/sys/wlc_antsel.c @@ -19,18 +19,23 @@ #ifdef WLANTSEL #include <linux/kernel.h> -#include <linuxver.h> +#include <linux/module.h> +#include <linux/pci.h> #include <bcmdefs.h> #include <osl.h> #include <bcmutils.h> #include <siutils.h> #include <wlioctl.h> +#include <bcmdevs.h> +#include <sbhndpio.h> +#include <sbhnddma.h> #include <d11.h> #include <wlc_rate.h> #include <wlc_key.h> #include <wlc_pub.h> #include <wl_dbg.h> +#include <wlc_event.h> #include <wlc_mac80211.h> #include <wlc_bmac.h> #include <wlc_phy_hal.h> @@ -58,10 +63,11 @@ #define ANT_SELCFG_DEF_2x4 0x02 /* default antenna configuration */ /* static functions */ -static int wlc_antsel_cfgupd(antsel_info_t *asi, wlc_antselcfg_t *antsel); -static u8 wlc_antsel_id2antcfg(antsel_info_t *asi, u8 id); -static u16 wlc_antsel_antcfg2antsel(antsel_info_t *asi, u8 ant_cfg); -static void wlc_antsel_init_cfg(antsel_info_t *asi, wlc_antselcfg_t *antsel, +static int wlc_antsel_cfgupd(struct antsel_info *asi, wlc_antselcfg_t *antsel); +static u8 wlc_antsel_id2antcfg(struct antsel_info *asi, u8 id); +static u16 wlc_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg); +static void wlc_antsel_init_cfg(struct antsel_info *asi, + wlc_antselcfg_t *antsel, bool auto_sel); const u16 mimo_2x4_div_antselpat_tbl[] = { @@ -88,14 +94,15 @@ const u8 mimo_2x3_div_antselid_tbl[16] = { 0, 0, 0, 0, 0, 0, 0, 0 /* pat to antselid */ }; -antsel_info_t *wlc_antsel_attach(wlc_info_t *wlc, osl_t *osh, - wlc_pub_t *pub, - wlc_hw_info_t *wlc_hw) { - antsel_info_t *asi; +struct antsel_info *wlc_antsel_attach(struct wlc_info *wlc, + struct osl_info *osh, + struct wlc_pub *pub, + struct wlc_hw_info *wlc_hw) { + struct antsel_info *asi; - asi = kzalloc(sizeof(antsel_info_t), GFP_ATOMIC); + asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC); if (!asi) { - WL_ERROR(("wl%d: wlc_antsel_attach: out of mem\n", pub->unit)); + WL_ERROR("wl%d: wlc_antsel_attach: out of mem\n", pub->unit); return NULL; } @@ -124,7 +131,7 @@ antsel_info_t *wlc_antsel_attach(wlc_info_t *wlc, osl_t *osh, asi->antsel_avail = false; } else { asi->antsel_avail = false; - WL_ERROR(("wlc_antsel_attach: 2o3 board cfg invalid\n")); + WL_ERROR("wlc_antsel_attach: 2o3 board cfg invalid\n"); ASSERT(0); } break; @@ -152,7 +159,7 @@ antsel_info_t *wlc_antsel_attach(wlc_info_t *wlc, osl_t *osh, return asi; } -void wlc_antsel_detach(antsel_info_t *asi) +void wlc_antsel_detach(struct antsel_info *asi) { if (!asi) return; @@ -160,7 +167,7 @@ void wlc_antsel_detach(antsel_info_t *asi) kfree(asi); } -void wlc_antsel_init(antsel_info_t *asi) +void wlc_antsel_init(struct antsel_info *asi) { if ((asi->antsel_type == ANTSEL_2x3) || (asi->antsel_type == ANTSEL_2x4)) @@ -169,7 +176,7 @@ void wlc_antsel_init(antsel_info_t *asi) /* boardlevel antenna selection: init antenna selection structure */ static void -wlc_antsel_init_cfg(antsel_info_t *asi, wlc_antselcfg_t *antsel, +wlc_antsel_init_cfg(struct antsel_info *asi, wlc_antselcfg_t *antsel, bool auto_sel) { if (asi->antsel_type == ANTSEL_2x3) { @@ -200,7 +207,7 @@ wlc_antsel_init_cfg(antsel_info_t *asi, wlc_antselcfg_t *antsel, } void BCMFASTPATH -wlc_antsel_antcfg_get(antsel_info_t *asi, bool usedef, bool sel, +wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel, u8 antselid, u8 fbantselid, u8 *antcfg, u8 *fbantcfg) { @@ -232,7 +239,7 @@ wlc_antsel_antcfg_get(antsel_info_t *asi, bool usedef, bool sel, } /* boardlevel antenna selection: convert mimo_antsel (ucode interface) to id */ -u8 wlc_antsel_antsel2id(antsel_info_t *asi, u16 antsel) +u8 wlc_antsel_antsel2id(struct antsel_info *asi, u16 antsel) { u8 antselid = 0; @@ -251,7 +258,7 @@ u8 wlc_antsel_antsel2id(antsel_info_t *asi, u16 antsel) } /* boardlevel antenna selection: convert id to ant_cfg */ -static u8 wlc_antsel_id2antcfg(antsel_info_t *asi, u8 id) +static u8 wlc_antsel_id2antcfg(struct antsel_info *asi, u8 id) { u8 antcfg = ANT_SELCFG_DEF_2x2; @@ -270,7 +277,7 @@ static u8 wlc_antsel_id2antcfg(antsel_info_t *asi, u8 id) } /* boardlevel antenna selection: convert ant_cfg to mimo_antsel (ucode interface) */ -static u16 wlc_antsel_antcfg2antsel(antsel_info_t *asi, u8 ant_cfg) +static u16 wlc_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg) { u8 idx = WLC_ANTIDX_11N(WLC_ANTSEL_11N(ant_cfg)); u16 mimo_antsel = 0; @@ -290,9 +297,9 @@ static u16 wlc_antsel_antcfg2antsel(antsel_info_t *asi, u8 ant_cfg) } /* boardlevel antenna selection: ucode interface control */ -static int wlc_antsel_cfgupd(antsel_info_t *asi, wlc_antselcfg_t *antsel) +static int wlc_antsel_cfgupd(struct antsel_info *asi, wlc_antselcfg_t *antsel) { - wlc_info_t *wlc = asi->wlc; + struct wlc_info *wlc = asi->wlc; u8 ant_cfg; u16 mimo_antsel; diff --git a/drivers/staging/brcm80211/sys/wlc_antsel.h b/drivers/staging/brcm80211/sys/wlc_antsel.h index 1d048bb..8875b58 100644 --- a/drivers/staging/brcm80211/sys/wlc_antsel.h +++ b/drivers/staging/brcm80211/sys/wlc_antsel.h @@ -16,13 +16,15 @@ #ifndef _wlc_antsel_h_ #define _wlc_antsel_h_ -extern antsel_info_t *wlc_antsel_attach(wlc_info_t *wlc, osl_t *osh, - wlc_pub_t *pub, - wlc_hw_info_t *wlc_hw); -extern void wlc_antsel_detach(antsel_info_t *asi); -extern void wlc_antsel_init(antsel_info_t *asi); -extern void wlc_antsel_antcfg_get(antsel_info_t *asi, bool usedef, bool sel, +extern struct antsel_info *wlc_antsel_attach(struct wlc_info *wlc, + struct osl_info *osh, + struct wlc_pub *pub, + struct wlc_hw_info *wlc_hw); +extern void wlc_antsel_detach(struct antsel_info *asi); +extern void wlc_antsel_init(struct antsel_info *asi); +extern void wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, + bool sel, u8 id, u8 fbid, u8 *antcfg, u8 *fbantcfg); -extern u8 wlc_antsel_antsel2id(antsel_info_t *asi, u16 antsel); +extern u8 wlc_antsel_antsel2id(struct antsel_info *asi, u16 antsel); #endif /* _wlc_antsel_h_ */ diff --git a/drivers/staging/brcm80211/sys/wlc_bmac.c b/drivers/staging/brcm80211/sys/wlc_bmac.c index b70f9d0..69f600a 100644 --- a/drivers/staging/brcm80211/sys/wlc_bmac.c +++ b/drivers/staging/brcm80211/sys/wlc_bmac.c @@ -14,13 +14,13 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef WLC_LOW -#error "This file needs WLC_LOW" -#endif #include <linux/kernel.h> #include <wlc_cfg.h> -#include <linuxver.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/netdevice.h> +#include <linux/etherdevice.h> #include <bcmdefs.h> #include <osl.h> #include <proto/802.11.h> @@ -42,12 +42,14 @@ #include <wlc_channel.h> #include <bcmsrom.h> #include <wlc_key.h> +#include <bcmdevs.h> /* BMAC_NOTE: a WLC_HIGH compile include of wlc.h adds in more structures and type * dependencies. Need to include these to files to allow a clean include of wlc.h * with WLC_HIGH defined. * At some point we may be able to skip the include of wlc.h and instead just * define a stub wlc_info and band struct to allow rpc calls to get the rpc handle. */ +#include <wlc_event.h> #include <wlc_mac80211.h> #include <wlc_bmac.h> #include <wlc_phy_shim.h> @@ -55,9 +57,6 @@ #include <wl_export.h> #include "wl_ucode.h" #include "d11ucode_ext.h" -#ifdef BCMSDIO -#include <bcmsdh.h> -#endif #include <bcmotp.h> /* BMAC_NOTE: With WLC_HIGH defined, some fns in this file make calls to high level @@ -69,6 +68,7 @@ #include <pcie_core.h> #include <wlc_alloc.h> +#include <wl_dbg.h> #define TIMER_INTERVAL_WATCHDOG_BMAC 1000 /* watchdog timer, in unit of ms */ @@ -113,64 +113,65 @@ static u16 xmtfifo_sz[][NFIFO] = { {9, 58, 22, 14, 14, 5}, /* corerev 24: 2304, 14848, 5632, 3584, 3584, 1280 */ }; -static void wlc_clkctl_clk(wlc_hw_info_t *wlc, uint mode); -static void wlc_coreinit(wlc_info_t *wlc); +static void wlc_clkctl_clk(struct wlc_hw_info *wlc, uint mode); +static void wlc_coreinit(struct wlc_info *wlc); /* used by wlc_wakeucode_init() */ -static void wlc_write_inits(wlc_hw_info_t *wlc_hw, const d11init_t *inits); -static void wlc_ucode_write(wlc_hw_info_t *wlc_hw, const u32 ucode[], +static void wlc_write_inits(struct wlc_hw_info *wlc_hw, const d11init_t *inits); +static void wlc_ucode_write(struct wlc_hw_info *wlc_hw, const u32 ucode[], const uint nbytes); -static void wlc_ucode_download(wlc_hw_info_t *wlc); -static void wlc_ucode_txant_set(wlc_hw_info_t *wlc_hw); +static void wlc_ucode_download(struct wlc_hw_info *wlc); +static void wlc_ucode_txant_set(struct wlc_hw_info *wlc_hw); /* used by wlc_dpc() */ -static bool wlc_bmac_dotxstatus(wlc_hw_info_t *wlc, tx_status_t *txs, +static bool wlc_bmac_dotxstatus(struct wlc_hw_info *wlc, tx_status_t *txs, u32 s2); -static bool wlc_bmac_txstatus_corerev4(wlc_hw_info_t *wlc); -static bool wlc_bmac_txstatus(wlc_hw_info_t *wlc, bool bound, bool *fatal); -static bool wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound); +static bool wlc_bmac_txstatus_corerev4(struct wlc_hw_info *wlc); +static bool wlc_bmac_txstatus(struct wlc_hw_info *wlc, bool bound, bool *fatal); +static bool wlc_bmac_recv(struct wlc_hw_info *wlc_hw, uint fifo, bool bound); /* used by wlc_down() */ -static void wlc_flushqueues(wlc_info_t *wlc); +static void wlc_flushqueues(struct wlc_info *wlc); -static void wlc_write_mhf(wlc_hw_info_t *wlc_hw, u16 *mhfs); -static void wlc_mctrl_reset(wlc_hw_info_t *wlc_hw); -static void wlc_corerev_fifofixup(wlc_hw_info_t *wlc_hw); +static void wlc_write_mhf(struct wlc_hw_info *wlc_hw, u16 *mhfs); +static void wlc_mctrl_reset(struct wlc_hw_info *wlc_hw); +static void wlc_corerev_fifofixup(struct wlc_hw_info *wlc_hw); /* Low Level Prototypes */ -static u16 wlc_bmac_read_objmem(wlc_hw_info_t *wlc_hw, uint offset, +static u16 wlc_bmac_read_objmem(struct wlc_hw_info *wlc_hw, uint offset, u32 sel); -static void wlc_bmac_write_objmem(wlc_hw_info_t *wlc_hw, uint offset, u16 v, - u32 sel); -static bool wlc_bmac_attach_dmapio(wlc_info_t *wlc, uint j, bool wme); -static void wlc_bmac_detach_dmapio(wlc_hw_info_t *wlc_hw); -static void wlc_ucode_bsinit(wlc_hw_info_t *wlc_hw); -static bool wlc_validboardtype(wlc_hw_info_t *wlc); -static bool wlc_isgoodchip(wlc_hw_info_t *wlc_hw); -static char *wlc_get_macaddr(wlc_hw_info_t *wlc_hw); -static void wlc_mhfdef(wlc_info_t *wlc, u16 *mhfs, u16 mhf2_init); -static void wlc_mctrl_write(wlc_hw_info_t *wlc_hw); -static void wlc_ucode_mute_override_set(wlc_hw_info_t *wlc_hw); -static void wlc_ucode_mute_override_clear(wlc_hw_info_t *wlc_hw); -static u32 wlc_wlintrsoff(wlc_info_t *wlc); -static void wlc_wlintrsrestore(wlc_info_t *wlc, u32 macintmask); -static void wlc_gpio_init(wlc_info_t *wlc); -static void wlc_write_hw_bcntemplate0(wlc_hw_info_t *wlc_hw, void *bcn, +static void wlc_bmac_write_objmem(struct wlc_hw_info *wlc_hw, uint offset, + u16 v, u32 sel); +static bool wlc_bmac_attach_dmapio(struct wlc_info *wlc, uint j, bool wme); +static void wlc_bmac_detach_dmapio(struct wlc_hw_info *wlc_hw); +static void wlc_ucode_bsinit(struct wlc_hw_info *wlc_hw); +static bool wlc_validboardtype(struct wlc_hw_info *wlc); +static bool wlc_isgoodchip(struct wlc_hw_info *wlc_hw); +static char *wlc_get_macaddr(struct wlc_hw_info *wlc_hw); +static void wlc_mhfdef(struct wlc_info *wlc, u16 *mhfs, u16 mhf2_init); +static void wlc_mctrl_write(struct wlc_hw_info *wlc_hw); +static void wlc_ucode_mute_override_set(struct wlc_hw_info *wlc_hw); +static void wlc_ucode_mute_override_clear(struct wlc_hw_info *wlc_hw); +static u32 wlc_wlintrsoff(struct wlc_info *wlc); +static void wlc_wlintrsrestore(struct wlc_info *wlc, u32 macintmask); +static void wlc_gpio_init(struct wlc_info *wlc); +static void wlc_write_hw_bcntemplate0(struct wlc_hw_info *wlc_hw, void *bcn, int len); -static void wlc_write_hw_bcntemplate1(wlc_hw_info_t *wlc_hw, void *bcn, +static void wlc_write_hw_bcntemplate1(struct wlc_hw_info *wlc_hw, void *bcn, int len); -static void wlc_bmac_bsinit(wlc_info_t *wlc, chanspec_t chanspec); -static u32 wlc_setband_inact(wlc_info_t *wlc, uint bandunit); -static void wlc_bmac_setband(wlc_hw_info_t *wlc_hw, uint bandunit, +static void wlc_bmac_bsinit(struct wlc_info *wlc, chanspec_t chanspec); +static u32 wlc_setband_inact(struct wlc_info *wlc, uint bandunit); +static void wlc_bmac_setband(struct wlc_hw_info *wlc_hw, uint bandunit, chanspec_t chanspec); -static void wlc_bmac_update_slot_timing(wlc_hw_info_t *wlc_hw, bool shortslot); -static void wlc_upd_ofdm_pctl1_table(wlc_hw_info_t *wlc_hw); -static u16 wlc_bmac_ofdm_ratetable_offset(wlc_hw_info_t *wlc_hw, +static void wlc_bmac_update_slot_timing(struct wlc_hw_info *wlc_hw, + bool shortslot); +static void wlc_upd_ofdm_pctl1_table(struct wlc_hw_info *wlc_hw); +static u16 wlc_bmac_ofdm_ratetable_offset(struct wlc_hw_info *wlc_hw, u8 rate); /* === Low Level functions === */ -void wlc_bmac_set_shortslot(wlc_hw_info_t *wlc_hw, bool shortslot) +void wlc_bmac_set_shortslot(struct wlc_hw_info *wlc_hw, bool shortslot) { wlc_hw->shortslot = shortslot; @@ -186,9 +187,10 @@ void wlc_bmac_set_shortslot(wlc_hw_info_t *wlc_hw, bool shortslot) * or shortslot 11g (9us slots) * The PSM needs to be suspended for this call. */ -static void wlc_bmac_update_slot_timing(wlc_hw_info_t *wlc_hw, bool shortslot) +static void wlc_bmac_update_slot_timing(struct wlc_hw_info *wlc_hw, + bool shortslot) { - osl_t *osh; + struct osl_info *osh; d11regs_t *regs; osh = wlc_hw->osh; @@ -205,7 +207,7 @@ static void wlc_bmac_update_slot_timing(wlc_hw_info_t *wlc_hw, bool shortslot) } } -static void WLBANDINITFN(wlc_ucode_bsinit) (wlc_hw_info_t *wlc_hw) +static void WLBANDINITFN(wlc_ucode_bsinit) (struct wlc_hw_info *wlc_hw) { /* init microcode host flags */ wlc_write_mhf(wlc_hw, wlc_hw->band->mhfs); @@ -215,30 +217,32 @@ static void WLBANDINITFN(wlc_ucode_bsinit) (wlc_hw_info_t *wlc_hw) if (WLCISNPHY(wlc_hw->band)) { wlc_write_inits(wlc_hw, d11n0bsinitvals16); } else { - WL_ERROR(("%s: wl%d: unsupported phy in corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev)); + WL_ERROR("%s: wl%d: unsupported phy in corerev %d\n", + __func__, wlc_hw->unit, wlc_hw->corerev); } } else { if (D11REV_IS(wlc_hw->corerev, 24)) { if (WLCISLCNPHY(wlc_hw->band)) { wlc_write_inits(wlc_hw, d11lcn0bsinitvals24); } else - WL_ERROR(("%s: wl%d: unsupported phy in corerev %d\n", __func__, wlc_hw->unit, wlc_hw->corerev)); + WL_ERROR("%s: wl%d: unsupported phy in corerev %d\n", + __func__, wlc_hw->unit, + wlc_hw->corerev); } else { - WL_ERROR(("%s: wl%d: unsupported corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev)); + WL_ERROR("%s: wl%d: unsupported corerev %d\n", + __func__, wlc_hw->unit, wlc_hw->corerev); } } } /* switch to new band but leave it inactive */ -static u32 WLBANDINITFN(wlc_setband_inact) (wlc_info_t *wlc, uint bandunit) +static u32 WLBANDINITFN(wlc_setband_inact) (struct wlc_info *wlc, uint bandunit) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; u32 macintmask; u32 tmp; - WL_TRACE(("wl%d: wlc_setband_inact\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_setband_inact\n", wlc_hw->unit); ASSERT(bandunit != wlc_hw->band->bandunit); ASSERT(si_iscoreup(wlc_hw->sih)); @@ -269,24 +273,24 @@ static u32 WLBANDINITFN(wlc_setband_inact) (wlc_info_t *wlc, uint bandunit) * Param 'bound' indicates max. # frames to process before break out. */ static bool BCMFASTPATH -wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound) +wlc_bmac_recv(struct wlc_hw_info *wlc_hw, uint fifo, bool bound) { - void *p; - void *head = NULL; - void *tail = NULL; + struct sk_buff *p; + struct sk_buff *head = NULL; + struct sk_buff *tail = NULL; uint n = 0; uint bound_limit = bound ? wlc_hw->wlc->pub->tunables->rxbnd : -1; u32 tsf_h, tsf_l; wlc_d11rxhdr_t *wlc_rxhdr = NULL; - WL_TRACE(("wl%d: %s\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s\n", wlc_hw->unit, __func__); /* gather received frames */ while ((p = dma_rx(wlc_hw->di[fifo]))) { if (!tail) head = tail = p; else { - PKTSETLINK(tail, p); + tail->prev = p; tail = p; } @@ -303,11 +307,11 @@ wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound) /* process each frame */ while ((p = head) != NULL) { - head = PKTLINK(head); - PKTSETLINK(p, NULL); + head = head->prev; + p->prev = NULL; /* record the tsf_l in wlc_rxd11hdr */ - wlc_rxhdr = (wlc_d11rxhdr_t *) PKTDATA(p); + wlc_rxhdr = (wlc_d11rxhdr_t *) p->data; wlc_rxhdr->tsf_l = htol32(tsf_l); /* compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */ @@ -323,15 +327,15 @@ wlc_bmac_recv(wlc_hw_info_t *wlc_hw, uint fifo, bool bound) * Return true if another dpc needs to be re-scheduled. false otherwise. * Param 'bounded' indicates if applicable loops should be bounded. */ -bool BCMFASTPATH wlc_dpc(wlc_info_t *wlc, bool bounded) +bool BCMFASTPATH wlc_dpc(struct wlc_info *wlc, bool bounded) { u32 macintstatus; - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; d11regs_t *regs = wlc_hw->regs; bool fatal = false; if (DEVICEREMOVED(wlc)) { - WL_ERROR(("wl%d: %s: dead chip\n", wlc_hw->unit, __func__)); + WL_ERROR("wl%d: %s: dead chip\n", wlc_hw->unit, __func__); wl_down(wlc->wl); return false; } @@ -340,8 +344,8 @@ bool BCMFASTPATH wlc_dpc(wlc_info_t *wlc, bool bounded) macintstatus = wlc->macintstatus; wlc->macintstatus = 0; - WL_TRACE(("wl%d: wlc_dpc: macintstatus 0x%x\n", wlc_hw->unit, - macintstatus)); + WL_TRACE("wl%d: wlc_dpc: macintstatus 0x%x\n", + wlc_hw->unit, macintstatus); if (macintstatus & MI_PRQ) { /* Process probe request FIFO */ @@ -364,7 +368,7 @@ bool BCMFASTPATH wlc_dpc(wlc_info_t *wlc, bool bounded) if (wlc_bmac_txstatus(wlc->hw, bounded, &fatal)) wlc->macintstatus |= MI_TFS; if (fatal) { - WL_ERROR(("MI_TFS: fatal\n")); + WL_ERROR("MI_TFS: fatal\n"); goto fatal; } } @@ -374,7 +378,7 @@ bool BCMFASTPATH wlc_dpc(wlc_info_t *wlc, bool bounded) /* ATIM window end */ if (macintstatus & MI_ATIMWINEND) { - WL_TRACE(("wlc_isr: end of ATIM window\n")); + WL_TRACE("wlc_isr: end of ATIM window\n"); OR_REG(wlc_hw->osh, ®s->maccommand, wlc->qvalid); wlc->qvalid = 0; @@ -395,7 +399,7 @@ bool BCMFASTPATH wlc_dpc(wlc_info_t *wlc, bool bounded) /* TX FIFO suspend/flush completion */ if (macintstatus & MI_TXSTOP) { if (wlc_bmac_tx_fifo_suspended(wlc_hw, TX_DATA_FIFO)) { - /* WL_ERROR(("dpc: fifo_suspend_comlete\n")); */ + /* WL_ERROR("dpc: fifo_suspend_comlete\n"); */ } } @@ -405,11 +409,12 @@ bool BCMFASTPATH wlc_dpc(wlc_info_t *wlc, bool bounded) } if (macintstatus & MI_GP0) { - WL_ERROR(("wl%d: PSM microcode watchdog fired at %d (seconds). Resetting.\n", wlc_hw->unit, wlc_hw->now)); + WL_ERROR("wl%d: PSM microcode watchdog fired at %d (seconds). Resetting.\n", + wlc_hw->unit, wlc_hw->now); printk_once("%s : PSM Watchdog, chipid 0x%x, chiprev 0x%x\n", - __func__, CHIPID(wlc_hw->sih->chip), - CHIPREV(wlc_hw->sih->chiprev)); + __func__, wlc_hw->sih->chip, + wlc_hw->sih->chiprev); WLCNTINCR(wlc->pub->_cnt->psmwds); @@ -427,7 +432,8 @@ bool BCMFASTPATH wlc_dpc(wlc_info_t *wlc, bool bounded) u32 rfd = R_REG(wlc_hw->osh, ®s->phydebug) & PDBG_RFD; #endif - WL_ERROR(("wl%d: MAC Detected a change on the RF Disable Input 0x%x\n", wlc_hw->unit, rfd)); + WL_ERROR("wl%d: MAC Detected a change on the RF Disable Input 0x%x\n", + wlc_hw->unit, rfd); WLCNTINCR(wlc->pub->_cnt->rfdisable); } @@ -452,10 +458,10 @@ bool BCMFASTPATH wlc_dpc(wlc_info_t *wlc, bool bounded) /* common low-level watchdog code */ void wlc_bmac_watchdog(void *arg) { - wlc_info_t *wlc = (wlc_info_t *) arg; - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_info *wlc = (struct wlc_info *) arg; + struct wlc_hw_info *wlc_hw = wlc->hw; - WL_TRACE(("wl%d: wlc_bmac_watchdog\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_watchdog\n", wlc_hw->unit); if (!wlc_hw->up) return; @@ -476,13 +482,13 @@ void wlc_bmac_watchdog(void *arg) } void -wlc_bmac_set_chanspec(wlc_hw_info_t *wlc_hw, chanspec_t chanspec, bool mute, - struct txpwr_limits *txpwr) +wlc_bmac_set_chanspec(struct wlc_hw_info *wlc_hw, chanspec_t chanspec, + bool mute, struct txpwr_limits *txpwr) { uint bandunit; - WL_TRACE(("wl%d: wlc_bmac_set_chanspec 0x%x\n", wlc_hw->unit, - chanspec)); + WL_TRACE("wl%d: wlc_bmac_set_chanspec 0x%x\n", + wlc_hw->unit, chanspec); wlc_hw->chanspec = chanspec; @@ -520,7 +526,8 @@ wlc_bmac_set_chanspec(wlc_hw_info_t *wlc_hw, chanspec_t chanspec, bool mute, } } -int wlc_bmac_revinfo_get(wlc_hw_info_t *wlc_hw, wlc_bmac_revinfo_t *revinfo) +int wlc_bmac_revinfo_get(struct wlc_hw_info *wlc_hw, + wlc_bmac_revinfo_t *revinfo) { si_t *sih = wlc_hw->sih; uint idx; @@ -558,20 +565,20 @@ int wlc_bmac_revinfo_get(wlc_hw_info_t *wlc_hw, wlc_bmac_revinfo_t *revinfo) return 0; } -int wlc_bmac_state_get(wlc_hw_info_t *wlc_hw, wlc_bmac_state_t *state) +int wlc_bmac_state_get(struct wlc_hw_info *wlc_hw, wlc_bmac_state_t *state) { state->machwcap = wlc_hw->machwcap; return 0; } -static bool wlc_bmac_attach_dmapio(wlc_info_t *wlc, uint j, bool wme) +static bool wlc_bmac_attach_dmapio(struct wlc_info *wlc, uint j, bool wme) { uint i; char name[8]; /* ucode host flag 2 needed for pio mode, independent of band and fifo */ u16 pio_mhf2 = 0; - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; uint unit = wlc_hw->unit; wlc_tunables_t *tune = wlc->pub->tunables; @@ -581,7 +588,7 @@ static bool wlc_bmac_attach_dmapio(wlc_info_t *wlc, uint j, bool wme) if (wlc_hw->di[0] == 0) { /* Init FIFOs */ uint addrwidth; int dma_attach_err = 0; - osl_t *osh = wlc_hw->osh; + struct osl_info *osh = wlc_hw->osh; /* Find out the DMA addressing capability and let OS know * All the channels within one DMA core have 'common-minimum' same @@ -589,10 +596,10 @@ static bool wlc_bmac_attach_dmapio(wlc_info_t *wlc, uint j, bool wme) */ addrwidth = dma_addrwidth(wlc_hw->sih, DMAREG(wlc_hw, DMA_TX, 0)); - OSL_DMADDRWIDTH(osh, addrwidth); if (!wl_alloc_dma_resources(wlc_hw->wlc->wl, addrwidth)) { - WL_ERROR(("wl%d: wlc_attach: alloc_dma_resources failed\n", unit)); + WL_ERROR("wl%d: wlc_attach: alloc_dma_resources failed\n", + unit); return false; } @@ -665,8 +672,7 @@ static bool wlc_bmac_attach_dmapio(wlc_info_t *wlc, uint j, bool wme) /* Cleaner to leave this as if with AP defined */ if (dma_attach_err) { - WL_ERROR(("wl%d: wlc_attach: dma_attach failed\n", - unit)); + WL_ERROR("wl%d: wlc_attach: dma_attach failed\n", unit); return false; } @@ -684,7 +690,7 @@ static bool wlc_bmac_attach_dmapio(wlc_info_t *wlc, uint j, bool wme) return true; } -static void wlc_bmac_detach_dmapio(wlc_hw_info_t *wlc_hw) +static void wlc_bmac_detach_dmapio(struct wlc_hw_info *wlc_hw) { uint j; @@ -702,11 +708,11 @@ static void wlc_bmac_detach_dmapio(wlc_hw_info_t *wlc_hw) * initialize software state for each core and band * put the whole chip in reset(driver down state), no clock */ -int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, - bool piomode, osl_t *osh, void *regsva, uint bustype, - void *btparam) +int wlc_bmac_attach(struct wlc_info *wlc, u16 vendor, u16 device, uint unit, + bool piomode, struct osl_info *osh, void *regsva, + uint bustype, void *btparam) { - wlc_hw_info_t *wlc_hw; + struct wlc_hw_info *wlc_hw; d11regs_t *regs; char *macaddr = NULL; char *vars; @@ -715,8 +721,8 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, bool wme = false; shared_phy_params_t sha_params; - WL_TRACE(("wl%d: wlc_bmac_attach: vendor 0x%x device 0x%x\n", unit, - vendor, device)); + WL_TRACE("wl%d: wlc_bmac_attach: vendor 0x%x device 0x%x\n", + unit, vendor, device); ASSERT(sizeof(wlc_d11rxhdr_t) <= WL_HWRXOFF); @@ -729,7 +735,7 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, wlc_hw->band = wlc_hw->bandstate[0]; wlc_hw->_piomode = piomode; - /* populate wlc_hw_info_t with default values */ + /* populate struct wlc_hw_info with default values */ wlc_bmac_info_init(wlc_hw); /* @@ -740,7 +746,7 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, wlc_hw->sih = si_attach((uint) device, osh, regsva, bustype, btparam, &wlc_hw->vars, &wlc_hw->vars_size); if (wlc_hw->sih == NULL) { - WL_ERROR(("wl%d: wlc_bmac_attach: si_attach failed\n", unit)); + WL_ERROR("wl%d: wlc_bmac_attach: si_attach failed\n", unit); err = 11; goto fail; } @@ -760,21 +766,22 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, var = getvar(vars, "vendid"); if (var) { vendor = (u16) simple_strtoul(var, NULL, 0); - WL_ERROR(("Overriding vendor id = 0x%x\n", vendor)); + WL_ERROR("Overriding vendor id = 0x%x\n", vendor); } var = getvar(vars, "devid"); if (var) { u16 devid = (u16) simple_strtoul(var, NULL, 0); if (devid != 0xffff) { device = devid; - WL_ERROR(("Overriding device id = 0x%x\n", - device)); + WL_ERROR("Overriding device id = 0x%x\n", + device); } } /* verify again the device is supported */ if (!wlc_chipmatch(vendor, device)) { - WL_ERROR(("wl%d: wlc_bmac_attach: Unsupported vendor/device (0x%x/0x%x)\n", unit, vendor, device)); + WL_ERROR("wl%d: wlc_bmac_attach: Unsupported vendor/device (0x%x/0x%x)\n", + unit, vendor, device); err = 12; goto fail; } @@ -809,7 +816,8 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, wlc_bmac_corereset(wlc_hw, WLC_USE_COREFLAGS); if (!wlc_bmac_validate_chip_access(wlc_hw)) { - WL_ERROR(("wl%d: wlc_bmac_attach: validate_chip_access failed\n", unit)); + WL_ERROR("wl%d: wlc_bmac_attach: validate_chip_access failed\n", + unit); err = 14; goto fail; } @@ -821,7 +829,8 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, j = BOARDREV_PROMOTED; wlc_hw->boardrev = (u16) j; if (!wlc_validboardtype(wlc_hw)) { - WL_ERROR(("wl%d: wlc_bmac_attach: Unsupported Broadcom board type (0x%x)" " or revision level (0x%x)\n", unit, wlc_hw->sih->boardtype, wlc_hw->boardrev)); + WL_ERROR("wl%d: wlc_bmac_attach: Unsupported Broadcom board type (0x%x)" " or revision level (0x%x)\n", + unit, wlc_hw->sih->boardtype, wlc_hw->boardrev); err = 15; goto fail; } @@ -833,7 +842,7 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, || (wlc_hw->boardflags & BFL_NOPLLDOWN)) wlc_bmac_pllreq(wlc_hw, true, WLC_PLLREQ_SHARED); - if ((BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) + if ((wlc_hw->sih->bustype == PCI_BUS) && (si_pci_war16165(wlc_hw->sih))) wlc->war16165 = true; @@ -844,7 +853,7 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, } else wlc_hw->_nbands = 1; - if ((CHIPID(wlc_hw->sih->chip) == BCM43225_CHIP_ID)) + if ((wlc_hw->sih->chip == BCM43225_CHIP_ID)) wlc_hw->_nbands = 1; /* BMAC_NOTE: remove init of pub values when wlc_attach() unconditionally does the @@ -863,8 +872,8 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, wlc_hw->physhim = wlc_phy_shim_attach(wlc_hw, wlc->wl, wlc); if (wlc_hw->physhim == NULL) { - WL_ERROR(("wl%d: wlc_bmac_attach: wlc_phy_shim_attach failed\n", - unit)); + WL_ERROR("wl%d: wlc_bmac_attach: wlc_phy_shim_attach failed\n", + unit); err = 25; goto fail; } @@ -931,7 +940,8 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, wlc_hw->band->pi = wlc_phy_attach(wlc_hw->phy_sh, (void *)regs, wlc_hw->band->bandtype, vars); if (wlc_hw->band->pi == NULL) { - WL_ERROR(("wl%d: wlc_bmac_attach: wlc_phy_attach failed\n", unit)); + WL_ERROR("wl%d: wlc_bmac_attach: wlc_phy_attach failed\n", + unit); err = 17; goto fail; } @@ -961,7 +971,9 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, goto bad_phy; } else { bad_phy: - WL_ERROR(("wl%d: wlc_bmac_attach: unsupported phy type/rev (%d/%d)\n", unit, wlc_hw->band->phytype, wlc_hw->band->phyrev)); + WL_ERROR("wl%d: wlc_bmac_attach: unsupported phy type/rev (%d/%d)\n", + unit, + wlc_hw->band->phytype, wlc_hw->band->phyrev); err = 18; goto fail; } @@ -993,7 +1005,7 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, wlc_coredisable(wlc_hw); /* Match driver "down" state */ - if (BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) + if (wlc_hw->sih->bustype == PCI_BUS) si_pci_down(wlc_hw->sih); /* register sb interrupt callback functions */ @@ -1016,27 +1028,27 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, /* init etheraddr state variables */ macaddr = wlc_get_macaddr(wlc_hw); if (macaddr == NULL) { - WL_ERROR(("wl%d: wlc_bmac_attach: macaddr not found\n", unit)); + WL_ERROR("wl%d: wlc_bmac_attach: macaddr not found\n", unit); err = 21; goto fail; } bcm_ether_atoe(macaddr, &wlc_hw->etheraddr); - if (ETHER_ISBCAST((char *)&wlc_hw->etheraddr) || - ETHER_ISNULLADDR((char *)&wlc_hw->etheraddr)) { - WL_ERROR(("wl%d: wlc_bmac_attach: bad macaddr %s\n", unit, - macaddr)); + if (is_broadcast_ether_addr(wlc_hw->etheraddr.octet) || + is_zero_ether_addr(wlc_hw->etheraddr.octet)) { + WL_ERROR("wl%d: wlc_bmac_attach: bad macaddr %s\n", + unit, macaddr); err = 22; goto fail; } - WL_ERROR(("%s:: deviceid 0x%x nbands %d board 0x%x macaddr: %s\n", - __func__, wlc_hw->deviceid, wlc_hw->_nbands, - wlc_hw->sih->boardtype, macaddr)); + WL_ERROR("%s:: deviceid 0x%x nbands %d board 0x%x macaddr: %s\n", + __func__, wlc_hw->deviceid, wlc_hw->_nbands, + wlc_hw->sih->boardtype, macaddr); return err; fail: - WL_ERROR(("wl%d: wlc_bmac_attach: failed with err %d\n", unit, err)); + WL_ERROR("wl%d: wlc_bmac_attach: failed with err %d\n", unit, err); return err; } @@ -1045,9 +1057,9 @@ int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, * may get overrides later in this function * BMAC_NOTES, move low out and resolve the dangling ones */ -void wlc_bmac_info_init(wlc_hw_info_t *wlc_hw) +void wlc_bmac_info_init(struct wlc_hw_info *wlc_hw) { - wlc_info_t *wlc = wlc_hw->wlc; + struct wlc_info *wlc = wlc_hw->wlc; /* set default sw macintmask value */ wlc->defmacintmask = DEF_MACINTMASK; @@ -1067,11 +1079,11 @@ void wlc_bmac_info_init(wlc_hw_info_t *wlc_hw) /* * low level detach */ -int wlc_bmac_detach(wlc_info_t *wlc) +int wlc_bmac_detach(struct wlc_info *wlc) { uint i; wlc_hwband_t *band; - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; int callbacks; callbacks = 0; @@ -1082,7 +1094,7 @@ int wlc_bmac_detach(wlc_info_t *wlc) */ si_deregister_intr_callback(wlc_hw->sih); - if (BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) + if (wlc_hw->sih->bustype == PCI_BUS) si_pci_sleep(wlc_hw->sih); } @@ -1118,9 +1130,9 @@ int wlc_bmac_detach(wlc_info_t *wlc) } -void wlc_bmac_reset(wlc_hw_info_t *wlc_hw) +void wlc_bmac_reset(struct wlc_hw_info *wlc_hw) { - WL_TRACE(("wl%d: wlc_bmac_reset\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_reset\n", wlc_hw->unit); WLCNTINCR(wlc_hw->wlc->pub->_cnt->reset); @@ -1135,13 +1147,13 @@ void wlc_bmac_reset(wlc_hw_info_t *wlc_hw) } void -wlc_bmac_init(wlc_hw_info_t *wlc_hw, chanspec_t chanspec, +wlc_bmac_init(struct wlc_hw_info *wlc_hw, chanspec_t chanspec, bool mute) { u32 macintmask; bool fastclk; - wlc_info_t *wlc = wlc_hw->wlc; + struct wlc_info *wlc = wlc_hw->wlc; - WL_TRACE(("wl%d: wlc_bmac_init\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_init\n", wlc_hw->unit); /* request FAST clock if not on */ fastclk = wlc_hw->forcefastclk; @@ -1186,11 +1198,11 @@ wlc_bmac_init(wlc_hw_info_t *wlc_hw, chanspec_t chanspec, wlc_clkctl_clk(wlc_hw, CLK_DYNAMIC); } -int wlc_bmac_up_prep(wlc_hw_info_t *wlc_hw) +int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw) { uint coremask; - WL_TRACE(("wl%d: %s:\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s:\n", wlc_hw->unit, __func__); ASSERT(wlc_hw->wlc->pub->hw_up && wlc_hw->wlc->macintmask == 0); @@ -1208,7 +1220,7 @@ int wlc_bmac_up_prep(wlc_hw_info_t *wlc_hw) */ coremask = (1 << wlc_hw->wlc->core->coreidx); - if (BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) + if (wlc_hw->sih->bustype == PCI_BUS) si_pci_setup(wlc_hw->sih, coremask); ASSERT(si_coreid(wlc_hw->sih) == D11_CORE_ID); @@ -1219,13 +1231,13 @@ int wlc_bmac_up_prep(wlc_hw_info_t *wlc_hw) */ if (wlc_bmac_radio_read_hwdisabled(wlc_hw)) { /* put SB PCI in down state again */ - if (BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) + if (wlc_hw->sih->bustype == PCI_BUS) si_pci_down(wlc_hw->sih); wlc_bmac_xtal(wlc_hw, OFF); return BCME_RADIOOFF; } - if (BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) + if (wlc_hw->sih->bustype == PCI_BUS) si_pci_up(wlc_hw->sih); /* reset the d11 core */ @@ -1234,9 +1246,9 @@ int wlc_bmac_up_prep(wlc_hw_info_t *wlc_hw) return 0; } -int wlc_bmac_up_finish(wlc_hw_info_t *wlc_hw) +int wlc_bmac_up_finish(struct wlc_hw_info *wlc_hw) { - WL_TRACE(("wl%d: %s:\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s:\n", wlc_hw->unit, __func__); wlc_hw->up = true; wlc_phy_hw_state_upd(wlc_hw->band->pi, true); @@ -1248,12 +1260,12 @@ int wlc_bmac_up_finish(wlc_hw_info_t *wlc_hw) return 0; } -int wlc_bmac_down_prep(wlc_hw_info_t *wlc_hw) +int wlc_bmac_down_prep(struct wlc_hw_info *wlc_hw) { bool dev_gone; uint callbacks = 0; - WL_TRACE(("wl%d: %s:\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s:\n", wlc_hw->unit, __func__); if (!wlc_hw->up) return callbacks; @@ -1276,12 +1288,12 @@ int wlc_bmac_down_prep(wlc_hw_info_t *wlc_hw) return callbacks; } -int wlc_bmac_down_finish(wlc_hw_info_t *wlc_hw) +int wlc_bmac_down_finish(struct wlc_hw_info *wlc_hw) { uint callbacks = 0; bool dev_gone; - WL_TRACE(("wl%d: %s:\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s:\n", wlc_hw->unit, __func__); if (!wlc_hw->up) return callbacks; @@ -1311,7 +1323,7 @@ int wlc_bmac_down_finish(wlc_hw_info_t *wlc_hw) /* turn off primary xtal and pll */ if (!wlc_hw->noreset) { - if (BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) + if (wlc_hw->sih->bustype == PCI_BUS) si_pci_down(wlc_hw->sih); wlc_bmac_xtal(wlc_hw, OFF); } @@ -1320,7 +1332,7 @@ int wlc_bmac_down_finish(wlc_hw_info_t *wlc_hw) return callbacks; } -void wlc_bmac_wait_for_wake(wlc_hw_info_t *wlc_hw) +void wlc_bmac_wait_for_wake(struct wlc_hw_info *wlc_hw) { if (D11REV_IS(wlc_hw->corerev, 4)) /* no slowclock */ udelay(5); @@ -1336,29 +1348,30 @@ void wlc_bmac_wait_for_wake(wlc_hw_info_t *wlc_hw) ASSERT(wlc_bmac_read_shm(wlc_hw, M_UCODE_DBGST) != DBGST_ASLEEP); } -void wlc_bmac_hw_etheraddr(wlc_hw_info_t *wlc_hw, struct ether_addr *ea) +void wlc_bmac_hw_etheraddr(struct wlc_hw_info *wlc_hw, struct ether_addr *ea) { - bcopy(&wlc_hw->etheraddr, ea, ETHER_ADDR_LEN); + bcopy(&wlc_hw->etheraddr, ea, ETH_ALEN); } -void wlc_bmac_set_hw_etheraddr(wlc_hw_info_t *wlc_hw, struct ether_addr *ea) +void wlc_bmac_set_hw_etheraddr(struct wlc_hw_info *wlc_hw, + struct ether_addr *ea) { - bcopy(ea, &wlc_hw->etheraddr, ETHER_ADDR_LEN); + bcopy(ea, &wlc_hw->etheraddr, ETH_ALEN); } -int wlc_bmac_bandtype(wlc_hw_info_t *wlc_hw) +int wlc_bmac_bandtype(struct wlc_hw_info *wlc_hw) { return wlc_hw->band->bandtype; } -void *wlc_cur_phy(wlc_info_t *wlc) +void *wlc_cur_phy(struct wlc_info *wlc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; return (void *)wlc_hw->band->pi; } /* control chip clock to save power, enable dynamic clock or force fast clock */ -static void wlc_clkctl_clk(wlc_hw_info_t *wlc_hw, uint mode) +static void wlc_clkctl_clk(struct wlc_hw_info *wlc_hw, uint mode) { if (PMUCTL_ENAB(wlc_hw->sih)) { /* new chips with PMU, CCS_FORCEHT will distribute the HT clock on backplane, @@ -1455,11 +1468,11 @@ static void wlc_clkctl_clk(wlc_hw_info_t *wlc_hw, uint mode) /* set initial host flags value */ static void -wlc_mhfdef(wlc_info_t *wlc, u16 *mhfs, u16 mhf2_init) +wlc_mhfdef(struct wlc_info *wlc, u16 *mhfs, u16 mhf2_init) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; - bzero(mhfs, sizeof(u16) * MHFMAX); + memset(mhfs, 0, MHFMAX * sizeof(u16)); mhfs[MHF2] |= mhf2_init; @@ -1485,7 +1498,7 @@ wlc_mhfdef(wlc_info_t *wlc, u16 *mhfs, u16 mhf2_init) * WLC_BAND_ALL <--- All bands */ void -wlc_bmac_mhf(wlc_hw_info_t *wlc_hw, u8 idx, u16 mask, u16 val, +wlc_bmac_mhf(struct wlc_hw_info *wlc_hw, u8 idx, u16 mask, u16 val, int bands) { u16 save; @@ -1539,7 +1552,7 @@ wlc_bmac_mhf(wlc_hw_info_t *wlc_hw, u8 idx, u16 mask, u16 val, } } -u16 wlc_bmac_mhf_get(wlc_hw_info_t *wlc_hw, u8 idx, int bands) +u16 wlc_bmac_mhf_get(struct wlc_hw_info *wlc_hw, u8 idx, int bands) { wlc_hwband_t *band; ASSERT(idx < MHFMAX); @@ -1565,7 +1578,7 @@ u16 wlc_bmac_mhf_get(wlc_hw_info_t *wlc_hw, u8 idx, int bands) return band->mhfs[idx]; } -static void wlc_write_mhf(wlc_hw_info_t *wlc_hw, u16 *mhfs) +static void wlc_write_mhf(struct wlc_hw_info *wlc_hw, u16 *mhfs) { u8 idx; u16 addr[] = { @@ -1583,7 +1596,7 @@ static void wlc_write_mhf(wlc_hw_info_t *wlc_hw, u16 *mhfs) /* set the maccontrol register to desired reset state and * initialize the sw cache of the register */ -static void wlc_mctrl_reset(wlc_hw_info_t *wlc_hw) +static void wlc_mctrl_reset(struct wlc_hw_info *wlc_hw) { /* IHR accesses are always enabled, PSM disabled, HPS off and WAKE on */ wlc_hw->maccontrol = 0; @@ -1594,7 +1607,7 @@ static void wlc_mctrl_reset(wlc_hw_info_t *wlc_hw) } /* set or clear maccontrol bits */ -void wlc_bmac_mctrl(wlc_hw_info_t *wlc_hw, u32 mask, u32 val) +void wlc_bmac_mctrl(struct wlc_hw_info *wlc_hw, u32 mask, u32 val) { u32 maccontrol; u32 new_maccontrol; @@ -1616,7 +1629,7 @@ void wlc_bmac_mctrl(wlc_hw_info_t *wlc_hw, u32 mask, u32 val) } /* write the software state of maccontrol and overrides to the maccontrol register */ -static void wlc_mctrl_write(wlc_hw_info_t *wlc_hw) +static void wlc_mctrl_write(struct wlc_hw_info *wlc_hw) { u32 maccontrol = wlc_hw->maccontrol; @@ -1633,7 +1646,7 @@ static void wlc_mctrl_write(wlc_hw_info_t *wlc_hw) W_REG(wlc_hw->osh, &wlc_hw->regs->maccontrol, maccontrol); } -void wlc_ucode_wake_override_set(wlc_hw_info_t *wlc_hw, u32 override_bit) +void wlc_ucode_wake_override_set(struct wlc_hw_info *wlc_hw, u32 override_bit) { ASSERT((wlc_hw->wake_override & override_bit) == 0); @@ -1650,7 +1663,7 @@ void wlc_ucode_wake_override_set(wlc_hw_info_t *wlc_hw, u32 override_bit) return; } -void wlc_ucode_wake_override_clear(wlc_hw_info_t *wlc_hw, u32 override_bit) +void wlc_ucode_wake_override_clear(struct wlc_hw_info *wlc_hw, u32 override_bit) { ASSERT(wlc_hw->wake_override & override_bit); @@ -1671,7 +1684,7 @@ void wlc_ucode_wake_override_clear(wlc_hw_info_t *wlc_hw, u32 override_bit) * STA 0 1 <--- This will ensure no beacons * IBSS 0 0 */ -static void wlc_ucode_mute_override_set(wlc_hw_info_t *wlc_hw) +static void wlc_ucode_mute_override_set(struct wlc_hw_info *wlc_hw) { wlc_hw->mute_override = 1; @@ -1687,7 +1700,7 @@ static void wlc_ucode_mute_override_set(wlc_hw_info_t *wlc_hw) } /* Clear the override on AP and INFRA bits */ -static void wlc_ucode_mute_override_clear(wlc_hw_info_t *wlc_hw) +static void wlc_ucode_mute_override_clear(struct wlc_hw_info *wlc_hw) { if (wlc_hw->mute_override == 0) return; @@ -1707,16 +1720,16 @@ static void wlc_ucode_mute_override_clear(wlc_hw_info_t *wlc_hw) * Write a MAC address to the rcmta structure */ void -wlc_bmac_set_rcmta(wlc_hw_info_t *wlc_hw, int idx, +wlc_bmac_set_rcmta(struct wlc_hw_info *wlc_hw, int idx, const struct ether_addr *addr) { d11regs_t *regs = wlc_hw->regs; volatile u16 *objdata16 = (volatile u16 *)®s->objdata; u32 mac_hm; u16 mac_l; - osl_t *osh; + struct osl_info *osh; - WL_TRACE(("wl%d: %s\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s\n", wlc_hw->unit, __func__); ASSERT(wlc_hw->corerev > 4); @@ -1740,16 +1753,16 @@ wlc_bmac_set_rcmta(wlc_hw_info_t *wlc_hw, int idx, * Write a MAC address to the given match reg offset in the RXE match engine. */ void -wlc_bmac_set_addrmatch(wlc_hw_info_t *wlc_hw, int match_reg_offset, +wlc_bmac_set_addrmatch(struct wlc_hw_info *wlc_hw, int match_reg_offset, const struct ether_addr *addr) { d11regs_t *regs; u16 mac_l; u16 mac_m; u16 mac_h; - osl_t *osh; + struct osl_info *osh; - WL_TRACE(("wl%d: wlc_bmac_set_addrmatch\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_set_addrmatch\n", wlc_hw->unit); ASSERT((match_reg_offset < RCM_SIZE) || (wlc_hw->corerev == 4)); @@ -1769,7 +1782,7 @@ wlc_bmac_set_addrmatch(wlc_hw_info_t *wlc_hw, int match_reg_offset, } void -wlc_bmac_write_template_ram(wlc_hw_info_t *wlc_hw, int offset, int len, +wlc_bmac_write_template_ram(struct wlc_hw_info *wlc_hw, int offset, int len, void *buf) { d11regs_t *regs; @@ -1778,9 +1791,9 @@ wlc_bmac_write_template_ram(wlc_hw_info_t *wlc_hw, int offset, int len, #ifdef IL_BIGENDIAN volatile u16 *dptr = NULL; #endif /* IL_BIGENDIAN */ - osl_t *osh; + struct osl_info *osh; - WL_TRACE(("wl%d: wlc_bmac_write_template_ram\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_write_template_ram\n", wlc_hw->unit); regs = wlc_hw->regs; osh = wlc_hw->osh; @@ -1812,9 +1825,9 @@ wlc_bmac_write_template_ram(wlc_hw_info_t *wlc_hw, int offset, int len, } } -void wlc_bmac_set_cwmin(wlc_hw_info_t *wlc_hw, u16 newmin) +void wlc_bmac_set_cwmin(struct wlc_hw_info *wlc_hw, u16 newmin) { - osl_t *osh; + struct osl_info *osh; osh = wlc_hw->osh; wlc_hw->band->CWmin = newmin; @@ -1824,9 +1837,9 @@ void wlc_bmac_set_cwmin(wlc_hw_info_t *wlc_hw, u16 newmin) W_REG(osh, &wlc_hw->regs->objdata, newmin); } -void wlc_bmac_set_cwmax(wlc_hw_info_t *wlc_hw, u16 newmax) +void wlc_bmac_set_cwmax(struct wlc_hw_info *wlc_hw, u16 newmax) { - osl_t *osh; + struct osl_info *osh; osh = wlc_hw->osh; wlc_hw->band->CWmax = newmax; @@ -1836,7 +1849,7 @@ void wlc_bmac_set_cwmax(wlc_hw_info_t *wlc_hw, u16 newmax) W_REG(osh, &wlc_hw->regs->objdata, newmax); } -void wlc_bmac_bw_set(wlc_hw_info_t *wlc_hw, u16 bw) +void wlc_bmac_bw_set(struct wlc_hw_info *wlc_hw, u16 bw) { bool fastclk; u32 tmp; @@ -1861,7 +1874,7 @@ void wlc_bmac_bw_set(wlc_hw_info_t *wlc_hw, u16 bw) } static void -wlc_write_hw_bcntemplate0(wlc_hw_info_t *wlc_hw, void *bcn, int len) +wlc_write_hw_bcntemplate0(struct wlc_hw_info *wlc_hw, void *bcn, int len) { d11regs_t *regs = wlc_hw->regs; @@ -1875,7 +1888,7 @@ wlc_write_hw_bcntemplate0(wlc_hw_info_t *wlc_hw, void *bcn, int len) } static void -wlc_write_hw_bcntemplate1(wlc_hw_info_t *wlc_hw, void *bcn, int len) +wlc_write_hw_bcntemplate1(struct wlc_hw_info *wlc_hw, void *bcn, int len) { d11regs_t *regs = wlc_hw->regs; @@ -1890,7 +1903,7 @@ wlc_write_hw_bcntemplate1(wlc_hw_info_t *wlc_hw, void *bcn, int len) /* mac is assumed to be suspended at this point */ void -wlc_bmac_write_hw_bcntemplates(wlc_hw_info_t *wlc_hw, void *bcn, int len, +wlc_bmac_write_hw_bcntemplates(struct wlc_hw_info *wlc_hw, void *bcn, int len, bool both) { d11regs_t *regs = wlc_hw->regs; @@ -1911,10 +1924,10 @@ wlc_bmac_write_hw_bcntemplates(wlc_hw_info_t *wlc_hw, void *bcn, int len, } } -static void WLBANDINITFN(wlc_bmac_upd_synthpu) (wlc_hw_info_t *wlc_hw) +static void WLBANDINITFN(wlc_bmac_upd_synthpu) (struct wlc_hw_info *wlc_hw) { u16 v; - wlc_info_t *wlc = wlc_hw->wlc; + struct wlc_info *wlc = wlc_hw->wlc; /* update SYNTHPU_DLY */ if (WLCISLCNPHY(wlc->band)) { @@ -1930,12 +1943,12 @@ static void WLBANDINITFN(wlc_bmac_upd_synthpu) (wlc_hw_info_t *wlc_hw) /* band-specific init */ static void -WLBANDINITFN(wlc_bmac_bsinit) (wlc_info_t *wlc, chanspec_t chanspec) +WLBANDINITFN(wlc_bmac_bsinit) (struct wlc_info *wlc, chanspec_t chanspec) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; - WL_TRACE(("wl%d: wlc_bmac_bsinit: bandunit %d\n", wlc_hw->unit, - wlc_hw->band->bandunit)); + WL_TRACE("wl%d: wlc_bmac_bsinit: bandunit %d\n", + wlc_hw->unit, wlc_hw->band->bandunit); /* sanity check */ if (PHY_TYPE(R_REG(wlc_hw->osh, &wlc_hw->regs->phyversion)) != @@ -1969,9 +1982,9 @@ WLBANDINITFN(wlc_bmac_bsinit) (wlc_info_t *wlc, chanspec_t chanspec) wlc_bmac_upd_synthpu(wlc_hw); } -void wlc_bmac_core_phy_clk(wlc_hw_info_t *wlc_hw, bool clk) +void wlc_bmac_core_phy_clk(struct wlc_hw_info *wlc_hw, bool clk) { - WL_TRACE(("wl%d: wlc_bmac_core_phy_clk: clk %d\n", wlc_hw->unit, clk)); + WL_TRACE("wl%d: wlc_bmac_core_phy_clk: clk %d\n", wlc_hw->unit, clk); wlc_hw->phyclk = clk; @@ -1994,9 +2007,9 @@ void wlc_bmac_core_phy_clk(wlc_hw_info_t *wlc_hw, bool clk) } /* Perform a soft reset of the PHY PLL */ -void wlc_bmac_core_phypll_reset(wlc_hw_info_t *wlc_hw) +void wlc_bmac_core_phypll_reset(struct wlc_hw_info *wlc_hw) { - WL_TRACE(("wl%d: wlc_bmac_core_phypll_reset\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_core_phypll_reset\n", wlc_hw->unit); si_corereg(wlc_hw->sih, SI_CC_IDX, offsetof(chipcregs_t, chipcontrol_addr), ~0, 0); @@ -2015,7 +2028,7 @@ void wlc_bmac_core_phypll_reset(wlc_hw_info_t *wlc_hw) /* light way to turn on phy clock without reset for NPHY only * refer to wlc_bmac_core_phy_clk for full version */ -void wlc_bmac_phyclk_fgc(wlc_hw_info_t *wlc_hw, bool clk) +void wlc_bmac_phyclk_fgc(struct wlc_hw_info *wlc_hw, bool clk) { /* support(necessary for NPHY and HYPHY) only */ if (!WLCISNPHY(wlc_hw->band)) @@ -2028,7 +2041,7 @@ void wlc_bmac_phyclk_fgc(wlc_hw_info_t *wlc_hw, bool clk) } -void wlc_bmac_macphyclk_set(wlc_hw_info_t *wlc_hw, bool clk) +void wlc_bmac_macphyclk_set(struct wlc_hw_info *wlc_hw, bool clk) { if (ON == clk) si_core_cflags(wlc_hw->sih, SICF_MPCLKE, SICF_MPCLKE); @@ -2036,13 +2049,13 @@ void wlc_bmac_macphyclk_set(wlc_hw_info_t *wlc_hw, bool clk) si_core_cflags(wlc_hw->sih, SICF_MPCLKE, 0); } -void wlc_bmac_phy_reset(wlc_hw_info_t *wlc_hw) +void wlc_bmac_phy_reset(struct wlc_hw_info *wlc_hw) { wlc_phy_t *pih = wlc_hw->band->pi; u32 phy_bw_clkbits; bool phy_in_reset = false; - WL_TRACE(("wl%d: wlc_bmac_phy_reset\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_phy_reset\n", wlc_hw->unit); if (pih == NULL) return; @@ -2080,9 +2093,9 @@ void wlc_bmac_phy_reset(wlc_hw_info_t *wlc_hw) /* switch to and initialize new band */ static void -WLBANDINITFN(wlc_bmac_setband) (wlc_hw_info_t *wlc_hw, uint bandunit, +WLBANDINITFN(wlc_bmac_setband) (struct wlc_hw_info *wlc_hw, uint bandunit, chanspec_t chanspec) { - wlc_info_t *wlc = wlc_hw->wlc; + struct wlc_info *wlc = wlc_hw->wlc; u32 macintmask; ASSERT(NBANDS_HW(wlc_hw) > 1); @@ -2122,9 +2135,9 @@ WLBANDINITFN(wlc_bmac_setband) (wlc_hw_info_t *wlc_hw, uint bandunit, } /* low-level band switch utility routine */ -void WLBANDINITFN(wlc_setxband) (wlc_hw_info_t *wlc_hw, uint bandunit) +void WLBANDINITFN(wlc_setxband) (struct wlc_hw_info *wlc_hw, uint bandunit) { - WL_TRACE(("wl%d: wlc_setxband: bandunit %d\n", wlc_hw->unit, bandunit)); + WL_TRACE("wl%d: wlc_setxband: bandunit %d\n", wlc_hw->unit, bandunit); wlc_hw->band = wlc_hw->bandstate[bandunit]; @@ -2138,19 +2151,19 @@ void WLBANDINITFN(wlc_setxband) (wlc_hw_info_t *wlc_hw, uint bandunit) } } -static bool wlc_isgoodchip(wlc_hw_info_t *wlc_hw) +static bool wlc_isgoodchip(struct wlc_hw_info *wlc_hw) { /* reject unsupported corerev */ if (!VALID_COREREV(wlc_hw->corerev)) { - WL_ERROR(("unsupported core rev %d\n", wlc_hw->corerev)); + WL_ERROR("unsupported core rev %d\n", wlc_hw->corerev); return false; } return true; } -static bool wlc_validboardtype(wlc_hw_info_t *wlc_hw) +static bool wlc_validboardtype(struct wlc_hw_info *wlc_hw) { bool goodboard = true; uint boardrev = wlc_hw->boardrev; @@ -2174,7 +2187,7 @@ static bool wlc_validboardtype(wlc_hw_info_t *wlc_hw) return goodboard; } -static char *wlc_get_macaddr(wlc_hw_info_t *wlc_hw) +static char *wlc_get_macaddr(struct wlc_hw_info *wlc_hw) { const char *varname = "macaddr"; char *macaddr; @@ -2191,7 +2204,8 @@ static char *wlc_get_macaddr(wlc_hw_info_t *wlc_hw) macaddr = getvar(wlc_hw->vars, varname); if (macaddr == NULL) { - WL_ERROR(("wl%d: wlc_get_macaddr: macaddr getvar(%s) not found\n", wlc_hw->unit, varname)); + WL_ERROR("wl%d: wlc_get_macaddr: macaddr getvar(%s) not found\n", + wlc_hw->unit, varname); } return macaddr; @@ -2203,7 +2217,7 @@ static char *wlc_get_macaddr(wlc_hw_info_t *wlc_hw) * this function could be called when driver is down and w/o clock * it operates on different registers depending on corerev and boardflag. */ -bool wlc_bmac_radio_read_hwdisabled(wlc_hw_info_t *wlc_hw) +bool wlc_bmac_radio_read_hwdisabled(struct wlc_hw_info *wlc_hw) { bool v, clk, xtal; u32 resetbits = 0, flags = 0; @@ -2226,9 +2240,9 @@ bool wlc_bmac_radio_read_hwdisabled(wlc_hw_info_t *wlc_hw) flags |= SICF_PCLKE; /* AI chip doesn't restore bar0win2 on hibernation/resume, need sw fixup */ - if ((CHIPID(wlc_hw->sih->chip) == BCM43224_CHIP_ID) || - (CHIPID(wlc_hw->sih->chip) == BCM43225_CHIP_ID) || - (CHIPID(wlc_hw->sih->chip) == BCM43421_CHIP_ID)) + if ((wlc_hw->sih->chip == BCM43224_CHIP_ID) || + (wlc_hw->sih->chip == BCM43225_CHIP_ID) || + (wlc_hw->sih->chip == BCM43421_CHIP_ID)) wlc_hw->regs = (d11regs_t *) si_setcore(wlc_hw->sih, D11_CORE_ID, 0); @@ -2249,12 +2263,12 @@ bool wlc_bmac_radio_read_hwdisabled(wlc_hw_info_t *wlc_hw) } /* Initialize just the hardware when coming out of POR or S3/S5 system states */ -void wlc_bmac_hw_up(wlc_hw_info_t *wlc_hw) +void wlc_bmac_hw_up(struct wlc_hw_info *wlc_hw) { if (wlc_hw->wlc->pub->hw_up) return; - WL_TRACE(("wl%d: %s:\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s:\n", wlc_hw->unit, __func__); /* * Enable pll and xtal, initialize the power control registers, @@ -2264,13 +2278,13 @@ void wlc_bmac_hw_up(wlc_hw_info_t *wlc_hw) si_clkctl_init(wlc_hw->sih); wlc_clkctl_clk(wlc_hw, CLK_FAST); - if (BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) { + if (wlc_hw->sih->bustype == PCI_BUS) { si_pci_fixcfg(wlc_hw->sih); /* AI chip doesn't restore bar0win2 on hibernation/resume, need sw fixup */ - if ((CHIPID(wlc_hw->sih->chip) == BCM43224_CHIP_ID) || - (CHIPID(wlc_hw->sih->chip) == BCM43225_CHIP_ID) || - (CHIPID(wlc_hw->sih->chip) == BCM43421_CHIP_ID)) + if ((wlc_hw->sih->chip == BCM43224_CHIP_ID) || + (wlc_hw->sih->chip == BCM43225_CHIP_ID) || + (wlc_hw->sih->chip == BCM43421_CHIP_ID)) wlc_hw->regs = (d11regs_t *) si_setcore(wlc_hw->sih, D11_CORE_ID, 0); @@ -2283,7 +2297,7 @@ void wlc_bmac_hw_up(wlc_hw_info_t *wlc_hw) wlc_hw->wlc->pub->hw_up = true; if ((wlc_hw->boardflags & BFL_FEM) - && (CHIPID(wlc_hw->sih->chip) == BCM4313_CHIP_ID)) { + && (wlc_hw->sih->chip == BCM4313_CHIP_ID)) { if (! (wlc_hw->boardrev >= 0x1250 && (wlc_hw->boardflags & BFL_FEM_BT))) @@ -2291,10 +2305,10 @@ void wlc_bmac_hw_up(wlc_hw_info_t *wlc_hw) } } -static bool wlc_dma_rxreset(wlc_hw_info_t *wlc_hw, uint fifo) +static bool wlc_dma_rxreset(struct wlc_hw_info *wlc_hw, uint fifo) { - hnddma_t *di = wlc_hw->di[fifo]; - osl_t *osh; + struct hnddma_pub *di = wlc_hw->di[fifo]; + struct osl_info *osh; if (D11REV_LT(wlc_hw->corerev, 12)) { bool rxidle = true; @@ -2309,7 +2323,8 @@ static bool wlc_dma_rxreset(wlc_hw_info_t *wlc_hw, uint fifo) 50000); if (!rxidle && (rcv_frm_cnt != 0)) - WL_ERROR(("wl%d: %s: rxdma[%d] not idle && rcv_frm_cnt(%d) not zero\n", wlc_hw->unit, __func__, fifo, rcv_frm_cnt)); + WL_ERROR("wl%d: %s: rxdma[%d] not idle && rcv_frm_cnt(%d) not zero\n", + wlc_hw->unit, __func__, fifo, rcv_frm_cnt); mdelay(2); } @@ -2324,7 +2339,7 @@ static bool wlc_dma_rxreset(wlc_hw_info_t *wlc_hw, uint fifo) * clear software macintstatus for fresh new start * one testing hack wlc_hw->noreset will bypass the d11/phy reset */ -void wlc_bmac_corereset(wlc_hw_info_t *wlc_hw, u32 flags) +void wlc_bmac_corereset(struct wlc_hw_info *wlc_hw, u32 flags) { d11regs_t *regs; uint i; @@ -2334,7 +2349,7 @@ void wlc_bmac_corereset(wlc_hw_info_t *wlc_hw, u32 flags) if (flags == WLC_USE_COREFLAGS) flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0); - WL_TRACE(("wl%d: %s\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s\n", wlc_hw->unit, __func__); regs = wlc_hw->regs; @@ -2347,17 +2362,20 @@ void wlc_bmac_corereset(wlc_hw_info_t *wlc_hw, u32 flags) if (si_iscoreup(wlc_hw->sih)) { for (i = 0; i < NFIFO; i++) if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) { - WL_ERROR(("wl%d: %s: dma_txreset[%d]: cannot stop dma\n", wlc_hw->unit, __func__, i)); + WL_ERROR("wl%d: %s: dma_txreset[%d]: cannot stop dma\n", + wlc_hw->unit, __func__, i); } if ((wlc_hw->di[RX_FIFO]) && (!wlc_dma_rxreset(wlc_hw, RX_FIFO))) { - WL_ERROR(("wl%d: %s: dma_rxreset[%d]: cannot stop dma\n", wlc_hw->unit, __func__, RX_FIFO)); + WL_ERROR("wl%d: %s: dma_rxreset[%d]: cannot stop dma\n", + wlc_hw->unit, __func__, RX_FIFO); } if (D11REV_IS(wlc_hw->corerev, 4) && wlc_hw->di[RX_TXSTATUS_FIFO] && (!wlc_dma_rxreset(wlc_hw, RX_TXSTATUS_FIFO))) { - WL_ERROR(("wl%d: %s: dma_rxreset[%d]: cannot stop dma\n", wlc_hw->unit, __func__, RX_TXSTATUS_FIFO)); + WL_ERROR("wl%d: %s: dma_rxreset[%d]: cannot stop dma\n", + wlc_hw->unit, __func__, RX_TXSTATUS_FIFO); } } /* if noreset, just stop the psm and return */ @@ -2413,14 +2431,14 @@ void wlc_bmac_corereset(wlc_hw_info_t *wlc_hw, u32 flags) * txfifo sizes needs to be modified(increased) since the newer cores * have more memory. */ -static void wlc_corerev_fifofixup(wlc_hw_info_t *wlc_hw) +static void wlc_corerev_fifofixup(struct wlc_hw_info *wlc_hw) { d11regs_t *regs = wlc_hw->regs; u16 fifo_nu; u16 txfifo_startblk = TXFIFO_START_BLK, txfifo_endblk; u16 txfifo_def, txfifo_def1; u16 txfifo_cmd; - osl_t *osh; + struct osl_info *osh; if (D11REV_LT(wlc_hw->corerev, 9)) goto exit; @@ -2473,22 +2491,22 @@ static void wlc_corerev_fifofixup(wlc_hw_info_t *wlc_hw) * config other core registers * init dma */ -static void wlc_coreinit(wlc_info_t *wlc) +static void wlc_coreinit(struct wlc_info *wlc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; d11regs_t *regs; u32 sflags; uint bcnint_us; uint i = 0; bool fifosz_fixup = false; - osl_t *osh; + struct osl_info *osh; int err = 0; u16 buf[NFIFO]; regs = wlc_hw->regs; osh = wlc_hw->osh; - WL_TRACE(("wl%d: wlc_coreinit\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_coreinit\n", wlc_hw->unit); /* reset PSM */ wlc_bmac_mctrl(wlc_hw, ~0, (MCTL_IHR_EN | MCTL_PSM_JMP_0 | MCTL_WAKE)); @@ -2511,8 +2529,8 @@ static void wlc_coreinit(wlc_info_t *wlc) SPINWAIT(((R_REG(osh, ®s->macintstatus) & MI_MACSSPNDD) == 0), 1000 * 1000); if ((R_REG(osh, ®s->macintstatus) & MI_MACSSPNDD) == 0) - WL_ERROR(("wl%d: wlc_coreinit: ucode did not self-suspend!\n", - wlc_hw->unit)); + WL_ERROR("wl%d: wlc_coreinit: ucode did not self-suspend!\n", + wlc_hw->unit); wlc_gpio_init(wlc); @@ -2522,18 +2540,18 @@ static void wlc_coreinit(wlc_info_t *wlc) if (WLCISNPHY(wlc_hw->band)) wlc_write_inits(wlc_hw, d11n0initvals16); else - WL_ERROR(("%s: wl%d: unsupported phy in corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev)); + WL_ERROR("%s: wl%d: unsupported phy in corerev %d\n", + __func__, wlc_hw->unit, wlc_hw->corerev); } else if (D11REV_IS(wlc_hw->corerev, 24)) { if (WLCISLCNPHY(wlc_hw->band)) { wlc_write_inits(wlc_hw, d11lcn0initvals24); } else { - WL_ERROR(("%s: wl%d: unsupported phy in corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev)); + WL_ERROR("%s: wl%d: unsupported phy in corerev %d\n", + __func__, wlc_hw->unit, wlc_hw->corerev); } } else { - WL_ERROR(("%s: wl%d: unsupported corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev)); + WL_ERROR("%s: wl%d: unsupported corerev %d\n", + __func__, wlc_hw->unit, wlc_hw->corerev); } /* For old ucode, txfifo sizes needs to be modified(increased) for Corerev >= 9 */ @@ -2575,7 +2593,8 @@ static void wlc_coreinit(wlc_info_t *wlc) err = -1; } if (err != 0) { - WL_ERROR(("wlc_coreinit: txfifo mismatch: ucode size %d driver size %d index %d\n", buf[i], wlc_hw->xmtfifo_sz[i], i)); + WL_ERROR("wlc_coreinit: txfifo mismatch: ucode size %d driver size %d index %d\n", + buf[i], wlc_hw->xmtfifo_sz[i], i); /* DO NOT ASSERT corerev < 4 even there is a mismatch * shmem, since driver don't overwrite those chip and * ucode initialize data will be used. @@ -2684,15 +2703,15 @@ static void wlc_coreinit(wlc_info_t *wlc) * - 559241 = 0x88889 => tsf_clk_frac_h = 0x8, tsf_clk_frac_l = 0x8889 */ -void wlc_bmac_switch_macfreq(wlc_hw_info_t *wlc_hw, u8 spurmode) +void wlc_bmac_switch_macfreq(struct wlc_hw_info *wlc_hw, u8 spurmode) { d11regs_t *regs; - osl_t *osh; + struct osl_info *osh; regs = wlc_hw->regs; osh = wlc_hw->osh; - if ((CHIPID(wlc_hw->sih->chip) == BCM43224_CHIP_ID) || - (CHIPID(wlc_hw->sih->chip) == BCM43225_CHIP_ID)) { + if ((wlc_hw->sih->chip == BCM43224_CHIP_ID) || + (wlc_hw->sih->chip == BCM43225_CHIP_ID)) { if (spurmode == WL_SPURAVOID_ON2) { /* 126Mhz */ W_REG(osh, ®s->tsf_clk_frac_l, 0x2082); W_REG(osh, ®s->tsf_clk_frac_h, 0x8); @@ -2715,12 +2734,12 @@ void wlc_bmac_switch_macfreq(wlc_hw_info_t *wlc_hw, u8 spurmode) } /* Initialize GPIOs that are controlled by D11 core */ -static void wlc_gpio_init(wlc_info_t *wlc) +static void wlc_gpio_init(struct wlc_info *wlc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; d11regs_t *regs; u32 gc, gm; - osl_t *osh; + struct osl_info *osh; regs = wlc_hw->regs; osh = wlc_hw->osh; @@ -2780,9 +2799,9 @@ static void wlc_gpio_init(wlc_info_t *wlc) si_gpiocontrol(wlc_hw->sih, gm, gc, GPIO_DRV_PRIORITY); } -static void wlc_ucode_download(wlc_hw_info_t *wlc_hw) +static void wlc_ucode_download(struct wlc_hw_info *wlc_hw) { - wlc_info_t *wlc; + struct wlc_info *wlc; wlc = wlc_hw->wlc; if (wlc_hw->ucode_loaded) @@ -2794,30 +2813,30 @@ static void wlc_ucode_download(wlc_hw_info_t *wlc_hw) bcm43xx_16_mimosz); wlc_hw->ucode_loaded = true; } else - WL_ERROR(("%s: wl%d: unsupported phy in corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev)); + WL_ERROR("%s: wl%d: unsupported phy in corerev %d\n", + __func__, wlc_hw->unit, wlc_hw->corerev); } else if (D11REV_IS(wlc_hw->corerev, 24)) { if (WLCISLCNPHY(wlc_hw->band)) { wlc_ucode_write(wlc_hw, bcm43xx_24_lcn, bcm43xx_24_lcnsz); wlc_hw->ucode_loaded = true; } else { - WL_ERROR(("%s: wl%d: unsupported phy in corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev)); + WL_ERROR("%s: wl%d: unsupported phy in corerev %d\n", + __func__, wlc_hw->unit, wlc_hw->corerev); } } } -static void wlc_ucode_write(wlc_hw_info_t *wlc_hw, const u32 ucode[], +static void wlc_ucode_write(struct wlc_hw_info *wlc_hw, const u32 ucode[], const uint nbytes) { - osl_t *osh; + struct osl_info *osh; d11regs_t *regs = wlc_hw->regs; uint i; uint count; osh = wlc_hw->osh; - WL_TRACE(("wl%d: wlc_ucode_write\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_ucode_write\n", wlc_hw->unit); ASSERT(IS_ALIGNED(nbytes, sizeof(u32))); @@ -2829,13 +2848,13 @@ static void wlc_ucode_write(wlc_hw_info_t *wlc_hw, const u32 ucode[], W_REG(osh, ®s->objdata, ucode[i]); } -static void wlc_write_inits(wlc_hw_info_t *wlc_hw, const d11init_t *inits) +static void wlc_write_inits(struct wlc_hw_info *wlc_hw, const d11init_t *inits) { int i; - osl_t *osh; + struct osl_info *osh; volatile u8 *base; - WL_TRACE(("wl%d: wlc_write_inits\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_write_inits\n", wlc_hw->unit); osh = wlc_hw->osh; base = (volatile u8 *)wlc_hw->regs; @@ -2852,7 +2871,7 @@ static void wlc_write_inits(wlc_hw_info_t *wlc_hw, const d11init_t *inits) } } -static void wlc_ucode_txant_set(wlc_hw_info_t *wlc_hw) +static void wlc_ucode_txant_set(struct wlc_hw_info *wlc_hw) { u16 phyctl; u16 phytxant = wlc_hw->bmac_phytxant; @@ -2869,7 +2888,7 @@ static void wlc_ucode_txant_set(wlc_hw_info_t *wlc_hw) wlc_bmac_write_shm(wlc_hw, M_RSP_PCTLWD, phyctl); } -void wlc_bmac_txant_set(wlc_hw_info_t *wlc_hw, u16 phytxant) +void wlc_bmac_txant_set(struct wlc_hw_info *wlc_hw, u16 phytxant) { /* update sw state */ wlc_hw->bmac_phytxant = phytxant; @@ -2881,12 +2900,12 @@ void wlc_bmac_txant_set(wlc_hw_info_t *wlc_hw, u16 phytxant) } -u16 wlc_bmac_get_txant(wlc_hw_info_t *wlc_hw) +u16 wlc_bmac_get_txant(struct wlc_hw_info *wlc_hw) { return (u16) wlc_hw->wlc->stf->txant; } -void wlc_bmac_antsel_type_set(wlc_hw_info_t *wlc_hw, u8 antsel_type) +void wlc_bmac_antsel_type_set(struct wlc_hw_info *wlc_hw, u8 antsel_type) { wlc_hw->antsel_type = antsel_type; @@ -2894,7 +2913,7 @@ void wlc_bmac_antsel_type_set(wlc_hw_info_t *wlc_hw, u8 antsel_type) wlc_phy_antsel_type_set(wlc_hw->band->pi, antsel_type); } -void wlc_bmac_fifoerrors(wlc_hw_info_t *wlc_hw) +void wlc_bmac_fifoerrors(struct wlc_hw_info *wlc_hw) { bool fatal = false; uint unit; @@ -2911,44 +2930,45 @@ void wlc_bmac_fifoerrors(wlc_hw_info_t *wlc_hw) if (!intstatus) continue; - WL_TRACE(("wl%d: wlc_bmac_fifoerrors: intstatus%d 0x%x\n", unit, - idx, intstatus)); + WL_TRACE("wl%d: wlc_bmac_fifoerrors: intstatus%d 0x%x\n", + unit, idx, intstatus); if (intstatus & I_RO) { - WL_ERROR(("wl%d: fifo %d: receive fifo overflow\n", - unit, idx)); + WL_ERROR("wl%d: fifo %d: receive fifo overflow\n", + unit, idx); WLCNTINCR(wlc_hw->wlc->pub->_cnt->rxoflo); fatal = true; } if (intstatus & I_PC) { - WL_ERROR(("wl%d: fifo %d: descriptor error\n", unit, - idx)); + WL_ERROR("wl%d: fifo %d: descriptor error\n", + unit, idx); WLCNTINCR(wlc_hw->wlc->pub->_cnt->dmade); fatal = true; } if (intstatus & I_PD) { - WL_ERROR(("wl%d: fifo %d: data error\n", unit, idx)); + WL_ERROR("wl%d: fifo %d: data error\n", unit, idx); WLCNTINCR(wlc_hw->wlc->pub->_cnt->dmada); fatal = true; } if (intstatus & I_DE) { - WL_ERROR(("wl%d: fifo %d: descriptor protocol error\n", - unit, idx)); + WL_ERROR("wl%d: fifo %d: descriptor protocol error\n", + unit, idx); WLCNTINCR(wlc_hw->wlc->pub->_cnt->dmape); fatal = true; } if (intstatus & I_RU) { - WL_ERROR(("wl%d: fifo %d: receive descriptor underflow\n", unit, idx)); + WL_ERROR("wl%d: fifo %d: receive descriptor underflow\n", + idx, unit); WLCNTINCR(wlc_hw->wlc->pub->_cnt->rxuflo[idx]); } if (intstatus & I_XU) { - WL_ERROR(("wl%d: fifo %d: transmit fifo underflow\n", - idx, unit)); + WL_ERROR("wl%d: fifo %d: transmit fifo underflow\n", + idx, unit); WLCNTINCR(wlc_hw->wlc->pub->_cnt->txuflo); fatal = true; } @@ -2962,9 +2982,9 @@ void wlc_bmac_fifoerrors(wlc_hw_info_t *wlc_hw) } } -void wlc_intrson(wlc_info_t *wlc) +void wlc_intrson(struct wlc_info *wlc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; ASSERT(wlc->defmacintmask); wlc->macintmask = wlc->defmacintmask; W_REG(wlc_hw->osh, &wlc_hw->regs->macintmask, wlc->macintmask); @@ -2975,7 +2995,7 @@ void wlc_intrson(wlc_info_t *wlc) * but also because per-port code may require sync with valid interrupt. */ -static u32 wlc_wlintrsoff(wlc_info_t *wlc) +static u32 wlc_wlintrsoff(struct wlc_info *wlc) { if (!wlc->hw->up) return 0; @@ -2983,7 +3003,7 @@ static u32 wlc_wlintrsoff(wlc_info_t *wlc) return wl_intrsoff(wlc->wl); } -static void wlc_wlintrsrestore(wlc_info_t *wlc, u32 macintmask) +static void wlc_wlintrsrestore(struct wlc_info *wlc, u32 macintmask) { if (!wlc->hw->up) return; @@ -2991,9 +3011,9 @@ static void wlc_wlintrsrestore(wlc_info_t *wlc, u32 macintmask) wl_intrsrestore(wlc->wl, macintmask); } -u32 wlc_intrsoff(wlc_info_t *wlc) +u32 wlc_intrsoff(struct wlc_info *wlc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; u32 macintmask; if (!wlc_hw->clk) @@ -3010,9 +3030,9 @@ u32 wlc_intrsoff(wlc_info_t *wlc) return wlc->macintstatus ? 0 : macintmask; } -void wlc_intrsrestore(wlc_info_t *wlc, u32 macintmask) +void wlc_intrsrestore(struct wlc_info *wlc, u32 macintmask) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; if (!wlc_hw->clk) return; @@ -3020,7 +3040,7 @@ void wlc_intrsrestore(wlc_info_t *wlc, u32 macintmask) W_REG(wlc_hw->osh, &wlc_hw->regs->macintmask, wlc->macintmask); } -void wlc_bmac_mute(wlc_hw_info_t *wlc_hw, bool on, mbool flags) +void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool on, mbool flags) { struct ether_addr null_ether_addr = { {0, 0, 0, 0, 0, 0} }; @@ -3056,12 +3076,12 @@ void wlc_bmac_mute(wlc_hw_info_t *wlc_hw, bool on, mbool flags) wlc_ucode_mute_override_clear(wlc_hw); } -void wlc_bmac_set_deaf(wlc_hw_info_t *wlc_hw, bool user_flag) +void wlc_bmac_set_deaf(struct wlc_hw_info *wlc_hw, bool user_flag) { wlc_phy_set_deaf(wlc_hw->band->pi, user_flag); } -int wlc_bmac_xmtfifo_sz_get(wlc_hw_info_t *wlc_hw, uint fifo, uint *blocks) +int wlc_bmac_xmtfifo_sz_get(struct wlc_hw_info *wlc_hw, uint fifo, uint *blocks) { if (fifo >= NFIFO) return BCME_RANGE; @@ -3071,7 +3091,7 @@ int wlc_bmac_xmtfifo_sz_get(wlc_hw_info_t *wlc_hw, uint fifo, uint *blocks) return 0; } -int wlc_bmac_xmtfifo_sz_set(wlc_hw_info_t *wlc_hw, uint fifo, uint blocks) +int wlc_bmac_xmtfifo_sz_set(struct wlc_hw_info *wlc_hw, uint fifo, uint blocks) { if (fifo >= NFIFO || blocks > 299) return BCME_RANGE; @@ -3091,7 +3111,7 @@ int wlc_bmac_xmtfifo_sz_set(wlc_hw_info_t *wlc_hw, uint fifo, uint blocks) * be pulling data into a tx fifo, by the time the MAC acks the suspend * request. */ -bool wlc_bmac_tx_fifo_suspended(wlc_hw_info_t *wlc_hw, uint tx_fifo) +bool wlc_bmac_tx_fifo_suspended(struct wlc_hw_info *wlc_hw, uint tx_fifo) { /* check that a suspend has been requested and is no longer pending */ @@ -3110,7 +3130,7 @@ bool wlc_bmac_tx_fifo_suspended(wlc_hw_info_t *wlc_hw, uint tx_fifo) return false; } -void wlc_bmac_tx_fifo_suspend(wlc_hw_info_t *wlc_hw, uint tx_fifo) +void wlc_bmac_tx_fifo_suspend(struct wlc_hw_info *wlc_hw, uint tx_fifo) { u8 fifo = 1 << tx_fifo; @@ -3141,7 +3161,7 @@ void wlc_bmac_tx_fifo_suspend(wlc_hw_info_t *wlc_hw, uint tx_fifo) } } -void wlc_bmac_tx_fifo_resume(wlc_hw_info_t *wlc_hw, uint tx_fifo) +void wlc_bmac_tx_fifo_resume(struct wlc_hw_info *wlc_hw, uint tx_fifo) { /* BMAC_NOTE: WLC_TX_FIFO_ENAB is done in wlc_dpc() for DMA case but need to be done * here for PIO otherwise the watchdog will catch the inconsistency and fire @@ -3169,20 +3189,20 @@ void wlc_bmac_tx_fifo_resume(wlc_hw_info_t *wlc_hw, uint tx_fifo) * 0 if the interrupt is not for us, or we are in some special cases; * device interrupt status bits otherwise. */ -static inline u32 wlc_intstatus(wlc_info_t *wlc, bool in_isr) +static inline u32 wlc_intstatus(struct wlc_info *wlc, bool in_isr) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; d11regs_t *regs = wlc_hw->regs; u32 macintstatus; u32 intstatus_rxfifo, intstatus_txsfifo; - osl_t *osh; + struct osl_info *osh; osh = wlc_hw->osh; /* macintstatus includes a DMA interrupt summary bit */ macintstatus = R_REG(osh, ®s->macintstatus); - WL_TRACE(("wl%d: macintstatus: 0x%x\n", wlc_hw->unit, macintstatus)); + WL_TRACE("wl%d: macintstatus: 0x%x\n", wlc_hw->unit, macintstatus); /* detect cardbus removed, in power down(suspend) and in reset */ if (DEVICEREMOVED(wlc)) @@ -3207,9 +3227,7 @@ static inline u32 wlc_intstatus(wlc_info_t *wlc, bool in_isr) */ /* turn off the interrupts */ W_REG(osh, ®s->macintmask, 0); -#ifndef BCMSDIO (void)R_REG(osh, ®s->macintmask); /* sync readback */ -#endif wlc->macintmask = 0; /* clear device interrupts */ @@ -3224,7 +3242,9 @@ static inline u32 wlc_intstatus(wlc_info_t *wlc, bool in_isr) R_REG(osh, ®s->intctrlregs[RX_TXSTATUS_FIFO]. intstatus); - WL_TRACE(("wl%d: intstatus_rxfifo 0x%x, intstatus_txsfifo 0x%x\n", wlc_hw->unit, intstatus_rxfifo, intstatus_txsfifo)); + WL_TRACE("wl%d: intstatus_rxfifo 0x%x, intstatus_txsfifo 0x%x\n", + wlc_hw->unit, + intstatus_rxfifo, intstatus_txsfifo); /* defer unsolicited interrupt hints */ intstatus_rxfifo &= DEF_RXINTMASK; @@ -3261,7 +3281,7 @@ static inline u32 wlc_intstatus(wlc_info_t *wlc, bool in_isr) /* Update wlc->macintstatus and wlc->intstatus[]. */ /* Return true if they are updated successfully. false otherwise */ -bool wlc_intrsupd(wlc_info_t *wlc) +bool wlc_intrsupd(struct wlc_info *wlc) { u32 macintstatus; @@ -3286,9 +3306,9 @@ bool wlc_intrsupd(wlc_info_t *wlc) * *wantdpc will be set to true if further wlc_dpc() processing is required, * false otherwise. */ -bool BCMFASTPATH wlc_isr(wlc_info_t *wlc, bool *wantdpc) +bool BCMFASTPATH wlc_isr(struct wlc_info *wlc, bool *wantdpc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; u32 macintstatus; *wantdpc = false; @@ -3300,7 +3320,7 @@ bool BCMFASTPATH wlc_isr(wlc_info_t *wlc, bool *wantdpc) macintstatus = wlc_intstatus(wlc, true); if (macintstatus == 0xffffffff) - WL_ERROR(("DEVICEREMOVED detected in the ISR code path.\n")); + WL_ERROR("DEVICEREMOVED detected in the ISR code path\n"); /* it is not for us */ if (macintstatus == 0) @@ -3317,20 +3337,20 @@ bool BCMFASTPATH wlc_isr(wlc_info_t *wlc, bool *wantdpc) } /* process tx completion events for corerev < 5 */ -static bool wlc_bmac_txstatus_corerev4(wlc_hw_info_t *wlc_hw) +static bool wlc_bmac_txstatus_corerev4(struct wlc_hw_info *wlc_hw) { - void *status_p; + struct sk_buff *status_p; tx_status_t *txs; - osl_t *osh; + struct osl_info *osh; bool fatal = false; - WL_TRACE(("wl%d: wlc_txstatusrecv\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_txstatusrecv\n", wlc_hw->unit); osh = wlc_hw->osh; while (!fatal && (status_p = dma_rx(wlc_hw->di[RX_TXSTATUS_FIFO]))) { - txs = (tx_status_t *) PKTDATA(status_p); + txs = (tx_status_t *) status_p->data; /* MAC uses little endian only */ ltoh16_buf((void *)txs, sizeof(tx_status_t)); @@ -3340,7 +3360,7 @@ static bool wlc_bmac_txstatus_corerev4(wlc_hw_info_t *wlc_hw) fatal = wlc_bmac_dotxstatus(wlc_hw, txs, 0); - PKTFREE(osh, status_p, false); + pkt_buf_free_skb(osh, status_p, false); } if (fatal) @@ -3353,7 +3373,7 @@ static bool wlc_bmac_txstatus_corerev4(wlc_hw_info_t *wlc_hw) } static bool BCMFASTPATH -wlc_bmac_dotxstatus(wlc_hw_info_t *wlc_hw, tx_status_t *txs, u32 s2) +wlc_bmac_dotxstatus(struct wlc_hw_info *wlc_hw, tx_status_t *txs, u32 s2) { /* discard intermediate indications for ucode with one legitimate case: * e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, but the subsequent @@ -3372,12 +3392,12 @@ wlc_bmac_dotxstatus(wlc_hw_info_t *wlc_hw, tx_status_t *txs, u32 s2) * Return true if more tx status need to be processed. false otherwise. */ static bool BCMFASTPATH -wlc_bmac_txstatus(wlc_hw_info_t *wlc_hw, bool bound, bool *fatal) +wlc_bmac_txstatus(struct wlc_hw_info *wlc_hw, bool bound, bool *fatal) { bool morepending = false; - wlc_info_t *wlc = wlc_hw->wlc; + struct wlc_info *wlc = wlc_hw->wlc; - WL_TRACE(("wl%d: wlc_bmac_txstatus\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_txstatus\n", wlc_hw->unit); if (D11REV_IS(wlc_hw->corerev, 4)) { /* to retire soon */ @@ -3388,7 +3408,7 @@ wlc_bmac_txstatus(wlc_hw_info_t *wlc_hw, bool bound, bool *fatal) } else { /* corerev >= 5 */ d11regs_t *regs; - osl_t *osh; + struct osl_info *osh; tx_status_t txstatus, *txs; u32 s1, s2; uint n = 0; @@ -3402,8 +3422,8 @@ wlc_bmac_txstatus(wlc_hw_info_t *wlc_hw, bool bound, bool *fatal) && (s1 = R_REG(osh, ®s->frmtxstatus)) & TXS_V) { if (s1 == 0xffffffff) { - WL_ERROR(("wl%d: %s: dead chip\n", - wlc_hw->unit, __func__)); + WL_ERROR("wl%d: %s: dead chip\n", + wlc_hw->unit, __func__); ASSERT(s1 != 0xffffffff); return morepending; } @@ -3436,15 +3456,15 @@ wlc_bmac_txstatus(wlc_hw_info_t *wlc_hw, bool bound, bool *fatal) return morepending; } -void wlc_suspend_mac_and_wait(wlc_info_t *wlc) +void wlc_suspend_mac_and_wait(struct wlc_info *wlc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; d11regs_t *regs = wlc_hw->regs; u32 mc, mi; - osl_t *osh; + struct osl_info *osh; - WL_TRACE(("wl%d: wlc_suspend_mac_and_wait: bandunit %d\n", wlc_hw->unit, - wlc_hw->band->bandunit)); + WL_TRACE("wl%d: wlc_suspend_mac_and_wait: bandunit %d\n", + wlc_hw->unit, wlc_hw->band->bandunit); /* * Track overlapping suspend requests @@ -3461,7 +3481,7 @@ void wlc_suspend_mac_and_wait(wlc_info_t *wlc) mc = R_REG(osh, ®s->maccontrol); if (mc == 0xffffffff) { - WL_ERROR(("wl%d: %s: dead chip\n", wlc_hw->unit, __func__)); + WL_ERROR("wl%d: %s: dead chip\n", wlc_hw->unit, __func__); wl_down(wlc->wl); return; } @@ -3471,7 +3491,7 @@ void wlc_suspend_mac_and_wait(wlc_info_t *wlc) mi = R_REG(osh, ®s->macintstatus); if (mi == 0xffffffff) { - WL_ERROR(("wl%d: %s: dead chip\n", wlc_hw->unit, __func__)); + WL_ERROR("wl%d: %s: dead chip\n", wlc_hw->unit, __func__); wl_down(wlc->wl); return; } @@ -3483,15 +3503,18 @@ void wlc_suspend_mac_and_wait(wlc_info_t *wlc) WLC_MAX_MAC_SUSPEND); if (!(R_REG(osh, ®s->macintstatus) & MI_MACSSPNDD)) { - WL_ERROR(("wl%d: wlc_suspend_mac_and_wait: waited %d uS and " - "MI_MACSSPNDD is still not on.\n", - wlc_hw->unit, WLC_MAX_MAC_SUSPEND)); - WL_ERROR(("wl%d: psmdebug 0x%08x, phydebug 0x%08x, psm_brc 0x%04x\n", wlc_hw->unit, R_REG(osh, ®s->psmdebug), R_REG(osh, ®s->phydebug), R_REG(osh, ®s->psm_brc))); + WL_ERROR("wl%d: wlc_suspend_mac_and_wait: waited %d uS and MI_MACSSPNDD is still not on.\n", + wlc_hw->unit, WLC_MAX_MAC_SUSPEND); + WL_ERROR("wl%d: psmdebug 0x%08x, phydebug 0x%08x, psm_brc 0x%04x\n", + wlc_hw->unit, + R_REG(osh, ®s->psmdebug), + R_REG(osh, ®s->phydebug), + R_REG(osh, ®s->psm_brc)); } mc = R_REG(osh, ®s->maccontrol); if (mc == 0xffffffff) { - WL_ERROR(("wl%d: %s: dead chip\n", wlc_hw->unit, __func__)); + WL_ERROR("wl%d: %s: dead chip\n", wlc_hw->unit, __func__); wl_down(wlc->wl); return; } @@ -3500,15 +3523,15 @@ void wlc_suspend_mac_and_wait(wlc_info_t *wlc) ASSERT(!(mc & MCTL_EN_MAC)); } -void wlc_enable_mac(wlc_info_t *wlc) +void wlc_enable_mac(struct wlc_info *wlc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; d11regs_t *regs = wlc_hw->regs; u32 mc, mi; - osl_t *osh; + struct osl_info *osh; - WL_TRACE(("wl%d: wlc_enable_mac: bandunit %d\n", wlc_hw->unit, - wlc->band->bandunit)); + WL_TRACE("wl%d: wlc_enable_mac: bandunit %d\n", + wlc_hw->unit, wlc->band->bandunit); /* * Track overlapping suspend requests @@ -3539,7 +3562,7 @@ void wlc_enable_mac(wlc_info_t *wlc) wlc_ucode_wake_override_clear(wlc_hw, WLC_WAKE_OVERRIDE_MACSUSPEND); } -void wlc_bmac_ifsctl_edcrs_set(wlc_hw_info_t *wlc_hw, bool abie, bool isht) +void wlc_bmac_ifsctl_edcrs_set(struct wlc_hw_info *wlc_hw, bool abie, bool isht) { if (!(WLCISNPHY(wlc_hw->band) && (D11REV_GE(wlc_hw->corerev, 16)))) return; @@ -3575,7 +3598,7 @@ void wlc_bmac_ifsctl_edcrs_set(wlc_hw_info_t *wlc_hw, bool abie, bool isht) } } -static void wlc_upd_ofdm_pctl1_table(wlc_hw_info_t *wlc_hw) +static void wlc_upd_ofdm_pctl1_table(struct wlc_hw_info *wlc_hw) { u8 rate; u8 rates[8] = { @@ -3609,7 +3632,7 @@ static void wlc_upd_ofdm_pctl1_table(wlc_hw_info_t *wlc_hw) } } -static u16 wlc_bmac_ofdm_ratetable_offset(wlc_hw_info_t *wlc_hw, u8 rate) +static u16 wlc_bmac_ofdm_ratetable_offset(struct wlc_hw_info *wlc_hw, u8 rate) { uint i; u8 plcp_rate = 0; @@ -3642,7 +3665,7 @@ static u16 wlc_bmac_ofdm_ratetable_offset(wlc_hw_info_t *wlc_hw, u8 rate) return 2 * wlc_bmac_read_shm(wlc_hw, M_RT_DIRMAP_A + (plcp_rate * 2)); } -void wlc_bmac_band_stf_ss_set(wlc_hw_info_t *wlc_hw, u8 stf_mode) +void wlc_bmac_band_stf_ss_set(struct wlc_hw_info *wlc_hw, u8 stf_mode) { wlc_hw->hw_stf_ss_opmode = stf_mode; @@ -3651,7 +3674,7 @@ void wlc_bmac_band_stf_ss_set(wlc_hw_info_t *wlc_hw, u8 stf_mode) } void BCMFASTPATH -wlc_bmac_read_tsf(wlc_hw_info_t *wlc_hw, u32 *tsf_l_ptr, +wlc_bmac_read_tsf(struct wlc_hw_info *wlc_hw, u32 *tsf_l_ptr, u32 *tsf_h_ptr) { d11regs_t *regs = wlc_hw->regs; @@ -3663,14 +3686,14 @@ wlc_bmac_read_tsf(wlc_hw_info_t *wlc_hw, u32 *tsf_l_ptr, return; } -bool wlc_bmac_validate_chip_access(wlc_hw_info_t *wlc_hw) +bool wlc_bmac_validate_chip_access(struct wlc_hw_info *wlc_hw) { d11regs_t *regs; u32 w, val; volatile u16 *reg16; - osl_t *osh; + struct osl_info *osh; - WL_TRACE(("wl%d: validate_chip_access\n", wlc_hw->unit)); + WL_TRACE("wl%d: validate_chip_access\n", wlc_hw->unit); regs = wlc_hw->regs; osh = wlc_hw->osh; @@ -3690,7 +3713,8 @@ bool wlc_bmac_validate_chip_access(wlc_hw_info_t *wlc_hw) (void)R_REG(osh, ®s->objaddr); val = R_REG(osh, ®s->objdata); if (val != (u32) 0xaa5555aa) { - WL_ERROR(("wl%d: validate_chip_access: SHM = 0x%x, expected 0xaa5555aa\n", wlc_hw->unit, val)); + WL_ERROR("wl%d: validate_chip_access: SHM = 0x%x, expected 0xaa5555aa\n", + wlc_hw->unit, val); return false; } @@ -3702,7 +3726,8 @@ bool wlc_bmac_validate_chip_access(wlc_hw_info_t *wlc_hw) (void)R_REG(osh, ®s->objaddr); val = R_REG(osh, ®s->objdata); if (val != (u32) 0x55aaaa55) { - WL_ERROR(("wl%d: validate_chip_access: SHM = 0x%x, expected 0x55aaaa55\n", wlc_hw->unit, val)); + WL_ERROR("wl%d: validate_chip_access: SHM = 0x%x, expected 0x55aaaa55\n", + wlc_hw->unit, val); return false; } @@ -3732,12 +3757,14 @@ bool wlc_bmac_validate_chip_access(wlc_hw_info_t *wlc_hw) /* verify with the 16 bit registers that have no side effects */ val = R_REG(osh, ®s->tsf_cfpstrt_l); if (val != (uint) 0xBBBB) { - WL_ERROR(("wl%d: validate_chip_access: tsf_cfpstrt_l = 0x%x, expected" " 0x%x\n", wlc_hw->unit, val, 0xBBBB)); + WL_ERROR("wl%d: validate_chip_access: tsf_cfpstrt_l = 0x%x, expected 0x%x\n", + wlc_hw->unit, val, 0xBBBB); return false; } val = R_REG(osh, ®s->tsf_cfpstrt_h); if (val != (uint) 0xCCCC) { - WL_ERROR(("wl%d: validate_chip_access: tsf_cfpstrt_h = 0x%x, expected" " 0x%x\n", wlc_hw->unit, val, 0xCCCC)); + WL_ERROR("wl%d: validate_chip_access: tsf_cfpstrt_h = 0x%x, expected 0x%x\n", + wlc_hw->unit, val, 0xCCCC); return false; } @@ -3749,7 +3776,10 @@ bool wlc_bmac_validate_chip_access(wlc_hw_info_t *wlc_hw) w = R_REG(osh, ®s->maccontrol); if ((w != (MCTL_IHR_EN | MCTL_WAKE)) && (w != (MCTL_IHR_EN | MCTL_GMODE | MCTL_WAKE))) { - WL_ERROR(("wl%d: validate_chip_access: maccontrol = 0x%x, expected 0x%x or 0x%x\n", wlc_hw->unit, w, (MCTL_IHR_EN | MCTL_WAKE), (MCTL_IHR_EN | MCTL_GMODE | MCTL_WAKE))); + WL_ERROR("wl%d: validate_chip_access: maccontrol = 0x%x, expected 0x%x or 0x%x\n", + wlc_hw->unit, w, + (MCTL_IHR_EN | MCTL_WAKE), + (MCTL_IHR_EN | MCTL_GMODE | MCTL_WAKE)); return false; } @@ -3758,13 +3788,13 @@ bool wlc_bmac_validate_chip_access(wlc_hw_info_t *wlc_hw) #define PHYPLL_WAIT_US 100000 -void wlc_bmac_core_phypll_ctl(wlc_hw_info_t *wlc_hw, bool on) +void wlc_bmac_core_phypll_ctl(struct wlc_hw_info *wlc_hw, bool on) { d11regs_t *regs; - osl_t *osh; + struct osl_info *osh; u32 tmp; - WL_TRACE(("wl%d: wlc_bmac_core_phypll_ctl\n", wlc_hw->unit)); + WL_TRACE("wl%d: wlc_bmac_core_phypll_ctl\n", wlc_hw->unit); tmp = 0; regs = wlc_hw->regs; @@ -3785,8 +3815,8 @@ void wlc_bmac_core_phypll_ctl(wlc_hw_info_t *wlc_hw, bool on) tmp = R_REG(osh, ®s->clk_ctl_st); if ((tmp & (CCS_ERSRC_AVAIL_HT)) != (CCS_ERSRC_AVAIL_HT)) { - WL_ERROR(("%s: turn on PHY PLL failed\n", - __func__)); + WL_ERROR("%s: turn on PHY PLL failed\n", + __func__); ASSERT(0); } } else { @@ -3803,8 +3833,8 @@ void wlc_bmac_core_phypll_ctl(wlc_hw_info_t *wlc_hw, bool on) (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) != (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) { - WL_ERROR(("%s: turn on PHY PLL failed\n", - __func__)); + WL_ERROR("%s: turn on PHY PLL failed\n", + __func__); ASSERT(0); } } @@ -3817,11 +3847,11 @@ void wlc_bmac_core_phypll_ctl(wlc_hw_info_t *wlc_hw, bool on) } } -void wlc_coredisable(wlc_hw_info_t *wlc_hw) +void wlc_coredisable(struct wlc_hw_info *wlc_hw) { bool dev_gone; - WL_TRACE(("wl%d: %s\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s\n", wlc_hw->unit, __func__); ASSERT(!wlc_hw->up); @@ -3857,9 +3887,9 @@ void wlc_coredisable(wlc_hw_info_t *wlc_hw) } /* power both the pll and external oscillator on/off */ -void wlc_bmac_xtal(wlc_hw_info_t *wlc_hw, bool want) +void wlc_bmac_xtal(struct wlc_hw_info *wlc_hw, bool want) { - WL_TRACE(("wl%d: wlc_bmac_xtal: want %d\n", wlc_hw->unit, want)); + WL_TRACE("wl%d: wlc_bmac_xtal: want %d\n", wlc_hw->unit, want); /* dont power down if plldown is false or we must poll hw radio disable */ if (!want && wlc_hw->pllreq) @@ -3876,9 +3906,9 @@ void wlc_bmac_xtal(wlc_hw_info_t *wlc_hw, bool want) } } -static void wlc_flushqueues(wlc_info_t *wlc) +static void wlc_flushqueues(struct wlc_info *wlc) { - wlc_hw_info_t *wlc_hw = wlc->hw; + struct wlc_hw_info *wlc_hw = wlc->hw; uint i; wlc->txpend16165war = 0; @@ -3888,8 +3918,8 @@ static void wlc_flushqueues(wlc_info_t *wlc) if (wlc_hw->di[i]) { dma_txreclaim(wlc_hw->di[i], HNDDMA_RANGE_ALL); TXPKTPENDCLR(wlc, i); - WL_TRACE(("wlc_flushqueues: pktpend fifo %d cleared\n", - i)); + WL_TRACE("wlc_flushqueues: pktpend fifo %d cleared\n", + i); } /* free any posted rx packets */ @@ -3898,12 +3928,12 @@ static void wlc_flushqueues(wlc_info_t *wlc) dma_rxreclaim(wlc_hw->di[RX_TXSTATUS_FIFO]); } -u16 wlc_bmac_read_shm(wlc_hw_info_t *wlc_hw, uint offset) +u16 wlc_bmac_read_shm(struct wlc_hw_info *wlc_hw, uint offset) { return wlc_bmac_read_objmem(wlc_hw, offset, OBJADDR_SHM_SEL); } -void wlc_bmac_write_shm(wlc_hw_info_t *wlc_hw, uint offset, u16 v) +void wlc_bmac_write_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v) { wlc_bmac_write_objmem(wlc_hw, offset, v, OBJADDR_SHM_SEL); } @@ -3912,7 +3942,7 @@ void wlc_bmac_write_shm(wlc_hw_info_t *wlc_hw, uint offset, u16 v) * SHM 'offset' needs to be an even address and * Buffer length 'len' must be an even number of bytes */ -void wlc_bmac_set_shm(wlc_hw_info_t *wlc_hw, uint offset, u16 v, int len) +void wlc_bmac_set_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v, int len) { int i; @@ -3929,7 +3959,7 @@ void wlc_bmac_set_shm(wlc_hw_info_t *wlc_hw, uint offset, u16 v, int len) } static u16 -wlc_bmac_read_objmem(wlc_hw_info_t *wlc_hw, uint offset, u32 sel) +wlc_bmac_read_objmem(struct wlc_hw_info *wlc_hw, uint offset, u32 sel) { d11regs_t *regs = wlc_hw->regs; volatile u16 *objdata_lo = (volatile u16 *)®s->objdata; @@ -3950,7 +3980,7 @@ wlc_bmac_read_objmem(wlc_hw_info_t *wlc_hw, uint offset, u32 sel) } static void -wlc_bmac_write_objmem(wlc_hw_info_t *wlc_hw, uint offset, u16 v, u32 sel) +wlc_bmac_write_objmem(struct wlc_hw_info *wlc_hw, uint offset, u16 v, u32 sel) { d11regs_t *regs = wlc_hw->regs; volatile u16 *objdata_lo = (volatile u16 *)®s->objdata; @@ -3973,7 +4003,7 @@ wlc_bmac_write_objmem(wlc_hw_info_t *wlc_hw, uint offset, u16 v, u32 sel) * 'sel' selects the type of memory */ void -wlc_bmac_copyto_objmem(wlc_hw_info_t *wlc_hw, uint offset, const void *buf, +wlc_bmac_copyto_objmem(struct wlc_hw_info *wlc_hw, uint offset, const void *buf, int len, u32 sel) { u16 v; @@ -3999,7 +4029,7 @@ wlc_bmac_copyto_objmem(wlc_hw_info_t *wlc_hw, uint offset, const void *buf, * 'sel' selects the type of memory */ void -wlc_bmac_copyfrom_objmem(wlc_hw_info_t *wlc_hw, uint offset, void *buf, +wlc_bmac_copyfrom_objmem(struct wlc_hw_info *wlc_hw, uint offset, void *buf, int len, u32 sel) { u16 v; @@ -4020,16 +4050,16 @@ wlc_bmac_copyfrom_objmem(wlc_hw_info_t *wlc_hw, uint offset, void *buf, } } -void wlc_bmac_copyfrom_vars(wlc_hw_info_t *wlc_hw, char **buf, uint *len) +void wlc_bmac_copyfrom_vars(struct wlc_hw_info *wlc_hw, char **buf, uint *len) { - WL_TRACE(("wlc_bmac_copyfrom_vars, nvram vars totlen=%d\n", - wlc_hw->vars_size)); + WL_TRACE("wlc_bmac_copyfrom_vars, nvram vars totlen=%d\n", + wlc_hw->vars_size); *buf = wlc_hw->vars; *len = wlc_hw->vars_size; } -void wlc_bmac_retrylimit_upd(wlc_hw_info_t *wlc_hw, u16 SRL, u16 LRL) +void wlc_bmac_retrylimit_upd(struct wlc_hw_info *wlc_hw, u16 SRL, u16 LRL) { wlc_hw->SRL = SRL; wlc_hw->LRL = LRL; @@ -4047,17 +4077,17 @@ void wlc_bmac_retrylimit_upd(wlc_hw_info_t *wlc_hw, u16 SRL, u16 LRL) } } -void wlc_bmac_set_noreset(wlc_hw_info_t *wlc_hw, bool noreset_flag) +void wlc_bmac_set_noreset(struct wlc_hw_info *wlc_hw, bool noreset_flag) { wlc_hw->noreset = noreset_flag; } -void wlc_bmac_set_ucode_loaded(wlc_hw_info_t *wlc_hw, bool ucode_loaded) +void wlc_bmac_set_ucode_loaded(struct wlc_hw_info *wlc_hw, bool ucode_loaded) { wlc_hw->ucode_loaded = ucode_loaded; } -void wlc_bmac_pllreq(wlc_hw_info_t *wlc_hw, bool set, mbool req_bit) +void wlc_bmac_pllreq(struct wlc_hw_info *wlc_hw, bool set, mbool req_bit) { ASSERT(req_bit); @@ -4088,7 +4118,7 @@ void wlc_bmac_pllreq(wlc_hw_info_t *wlc_hw, bool set, mbool req_bit) return; } -void wlc_bmac_set_clk(wlc_hw_info_t *wlc_hw, bool on) +void wlc_bmac_set_clk(struct wlc_hw_info *wlc_hw, bool on) { if (on) { /* power up pll and oscillator */ @@ -4110,7 +4140,7 @@ void wlc_bmac_set_clk(wlc_hw_info_t *wlc_hw, bool on) } /* this will be true for all ai chips */ -bool wlc_bmac_taclear(wlc_hw_info_t *wlc_hw, bool ta_ok) +bool wlc_bmac_taclear(struct wlc_hw_info *wlc_hw, bool ta_ok) { return true; } @@ -4118,7 +4148,7 @@ bool wlc_bmac_taclear(wlc_hw_info_t *wlc_hw, bool ta_ok) /* Lower down relevant GPIOs like LED when going down w/o * doing PCI config cycles or touching interrupts */ -void wlc_gpio_fast_deinit(wlc_hw_info_t *wlc_hw) +void wlc_gpio_fast_deinit(struct wlc_hw_info *wlc_hw) { if ((wlc_hw == NULL) || (wlc_hw->sih == NULL)) return; @@ -4126,17 +4156,17 @@ void wlc_gpio_fast_deinit(wlc_hw_info_t *wlc_hw) /* Only chips with internal bus or PCIE cores or certain PCI cores * are able to switch cores w/o disabling interrupts */ - if (!((BUSTYPE(wlc_hw->sih->bustype) == SI_BUS) || - ((BUSTYPE(wlc_hw->sih->bustype) == PCI_BUS) && + if (!((wlc_hw->sih->bustype == SI_BUS) || + ((wlc_hw->sih->bustype == PCI_BUS) && ((wlc_hw->sih->buscoretype == PCIE_CORE_ID) || (wlc_hw->sih->buscorerev >= 13))))) return; - WL_TRACE(("wl%d: %s\n", wlc_hw->unit, __func__)); + WL_TRACE("wl%d: %s\n", wlc_hw->unit, __func__); return; } -bool wlc_bmac_radio_hw(wlc_hw_info_t *wlc_hw, bool enable) +bool wlc_bmac_radio_hw(struct wlc_hw_info *wlc_hw, bool enable) { /* Do not access Phy registers if core is not up */ if (si_iscoreup(wlc_hw->sih) == false) @@ -4171,7 +4201,7 @@ bool wlc_bmac_radio_hw(wlc_hw_info_t *wlc_hw, bool enable) return true; } -u16 wlc_bmac_rate_shm_offset(wlc_hw_info_t *wlc_hw, u8 rate) +u16 wlc_bmac_rate_shm_offset(struct wlc_hw_info *wlc_hw, u8 rate) { u16 table_ptr; u8 phy_rate, index; @@ -4195,12 +4225,12 @@ u16 wlc_bmac_rate_shm_offset(wlc_hw_info_t *wlc_hw, u8 rate) return 2 * wlc_bmac_read_shm(wlc_hw, table_ptr + (index * 2)); } -void wlc_bmac_set_txpwr_percent(wlc_hw_info_t *wlc_hw, u8 val) +void wlc_bmac_set_txpwr_percent(struct wlc_hw_info *wlc_hw, u8 val) { wlc_phy_txpwr_percent_set(wlc_hw->band->pi, val); } -void wlc_bmac_antsel_set(wlc_hw_info_t *wlc_hw, u32 antsel_avail) +void wlc_bmac_antsel_set(struct wlc_hw_info *wlc_hw, u32 antsel_avail) { wlc_hw->antsel_avail = antsel_avail; } diff --git a/drivers/staging/brcm80211/sys/wlc_bmac.h b/drivers/staging/brcm80211/sys/wlc_bmac.h index 872bc8d..98150aaf 100644 --- a/drivers/staging/brcm80211/sys/wlc_bmac.h +++ b/drivers/staging/brcm80211/sys/wlc_bmac.h @@ -57,7 +57,8 @@ typedef struct wlc_bmac_revinfo { } band[MAXBANDS]; } wlc_bmac_revinfo_t; -/* dup state between BMAC(wlc_hw_info_t) and HIGH(wlc_info_t) driver */ +/* dup state between BMAC(struct wlc_hw_info) and HIGH(struct wlc_info) + driver */ typedef struct wlc_bmac_state { u32 machwcap; /* mac hw capibility */ u32 preamble_ovr; /* preamble override */ @@ -130,148 +131,143 @@ typedef enum { WLCHW_STATE_LAST } wlc_bmac_state_id_t; -extern int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, - uint unit, bool piomode, osl_t *osh, void *regsva, - uint bustype, void *btparam); -extern int wlc_bmac_detach(wlc_info_t *wlc); +extern int wlc_bmac_attach(struct wlc_info *wlc, u16 vendor, u16 device, + uint unit, bool piomode, struct osl_info *osh, + void *regsva, uint bustype, void *btparam); +extern int wlc_bmac_detach(struct wlc_info *wlc); extern void wlc_bmac_watchdog(void *arg); -extern void wlc_bmac_info_init(wlc_hw_info_t *wlc_hw); +extern void wlc_bmac_info_init(struct wlc_hw_info *wlc_hw); /* up/down, reset, clk */ -#ifdef WLC_LOW -extern void wlc_bmac_xtal(wlc_hw_info_t *wlc_hw, bool want); -#endif +extern void wlc_bmac_xtal(struct wlc_hw_info *wlc_hw, bool want); -extern void wlc_bmac_copyto_objmem(wlc_hw_info_t *wlc_hw, +extern void wlc_bmac_copyto_objmem(struct wlc_hw_info *wlc_hw, uint offset, const void *buf, int len, u32 sel); -extern void wlc_bmac_copyfrom_objmem(wlc_hw_info_t *wlc_hw, uint offset, +extern void wlc_bmac_copyfrom_objmem(struct wlc_hw_info *wlc_hw, uint offset, void *buf, int len, u32 sel); #define wlc_bmac_copyfrom_shm(wlc_hw, offset, buf, len) \ wlc_bmac_copyfrom_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL) #define wlc_bmac_copyto_shm(wlc_hw, offset, buf, len) \ wlc_bmac_copyto_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL) -extern void wlc_bmac_core_phy_clk(wlc_hw_info_t *wlc_hw, bool clk); -extern void wlc_bmac_core_phypll_reset(wlc_hw_info_t *wlc_hw); -extern void wlc_bmac_core_phypll_ctl(wlc_hw_info_t *wlc_hw, bool on); -extern void wlc_bmac_phyclk_fgc(wlc_hw_info_t *wlc_hw, bool clk); -extern void wlc_bmac_macphyclk_set(wlc_hw_info_t *wlc_hw, bool clk); -extern void wlc_bmac_phy_reset(wlc_hw_info_t *wlc_hw); -extern void wlc_bmac_corereset(wlc_hw_info_t *wlc_hw, u32 flags); -extern void wlc_bmac_reset(wlc_hw_info_t *wlc_hw); -extern void wlc_bmac_init(wlc_hw_info_t *wlc_hw, chanspec_t chanspec, +extern void wlc_bmac_core_phy_clk(struct wlc_hw_info *wlc_hw, bool clk); +extern void wlc_bmac_core_phypll_reset(struct wlc_hw_info *wlc_hw); +extern void wlc_bmac_core_phypll_ctl(struct wlc_hw_info *wlc_hw, bool on); +extern void wlc_bmac_phyclk_fgc(struct wlc_hw_info *wlc_hw, bool clk); +extern void wlc_bmac_macphyclk_set(struct wlc_hw_info *wlc_hw, bool clk); +extern void wlc_bmac_phy_reset(struct wlc_hw_info *wlc_hw); +extern void wlc_bmac_corereset(struct wlc_hw_info *wlc_hw, u32 flags); +extern void wlc_bmac_reset(struct wlc_hw_info *wlc_hw); +extern void wlc_bmac_init(struct wlc_hw_info *wlc_hw, chanspec_t chanspec, bool mute); -extern int wlc_bmac_up_prep(wlc_hw_info_t *wlc_hw); -extern int wlc_bmac_up_finish(wlc_hw_info_t *wlc_hw); -extern int wlc_bmac_down_prep(wlc_hw_info_t *wlc_hw); -extern int wlc_bmac_down_finish(wlc_hw_info_t *wlc_hw); -extern void wlc_bmac_corereset(wlc_hw_info_t *wlc_hw, u32 flags); -extern void wlc_bmac_switch_macfreq(wlc_hw_info_t *wlc_hw, u8 spurmode); +extern int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw); +extern int wlc_bmac_up_finish(struct wlc_hw_info *wlc_hw); +extern int wlc_bmac_down_prep(struct wlc_hw_info *wlc_hw); +extern int wlc_bmac_down_finish(struct wlc_hw_info *wlc_hw); +extern void wlc_bmac_corereset(struct wlc_hw_info *wlc_hw, u32 flags); +extern void wlc_bmac_switch_macfreq(struct wlc_hw_info *wlc_hw, u8 spurmode); /* chanspec, ucode interface */ -extern int wlc_bmac_bandtype(wlc_hw_info_t *wlc_hw); -extern void wlc_bmac_set_chanspec(wlc_hw_info_t *wlc_hw, chanspec_t chanspec, +extern int wlc_bmac_bandtype(struct wlc_hw_info *wlc_hw); +extern void wlc_bmac_set_chanspec(struct wlc_hw_info *wlc_hw, + chanspec_t chanspec, bool mute, struct txpwr_limits *txpwr); -extern void wlc_bmac_txfifo(wlc_hw_info_t *wlc_hw, uint fifo, void *p, +extern void wlc_bmac_txfifo(struct wlc_hw_info *wlc_hw, uint fifo, void *p, bool commit, u16 frameid, u8 txpktpend); -extern int wlc_bmac_xmtfifo_sz_get(wlc_hw_info_t *wlc_hw, uint fifo, +extern int wlc_bmac_xmtfifo_sz_get(struct wlc_hw_info *wlc_hw, uint fifo, uint *blocks); -extern void wlc_bmac_mhf(wlc_hw_info_t *wlc_hw, u8 idx, u16 mask, +extern void wlc_bmac_mhf(struct wlc_hw_info *wlc_hw, u8 idx, u16 mask, u16 val, int bands); -extern void wlc_bmac_mctrl(wlc_hw_info_t *wlc_hw, u32 mask, u32 val); -extern u16 wlc_bmac_mhf_get(wlc_hw_info_t *wlc_hw, u8 idx, int bands); -extern int wlc_bmac_xmtfifo_sz_set(wlc_hw_info_t *wlc_hw, uint fifo, +extern void wlc_bmac_mctrl(struct wlc_hw_info *wlc_hw, u32 mask, u32 val); +extern u16 wlc_bmac_mhf_get(struct wlc_hw_info *wlc_hw, u8 idx, int bands); +extern int wlc_bmac_xmtfifo_sz_set(struct wlc_hw_info *wlc_hw, uint fifo, uint blocks); -extern void wlc_bmac_txant_set(wlc_hw_info_t *wlc_hw, u16 phytxant); -extern u16 wlc_bmac_get_txant(wlc_hw_info_t *wlc_hw); -extern void wlc_bmac_antsel_type_set(wlc_hw_info_t *wlc_hw, u8 antsel_type); -extern int wlc_bmac_revinfo_get(wlc_hw_info_t *wlc_hw, +extern void wlc_bmac_txant_set(struct wlc_hw_info *wlc_hw, u16 phytxant); +extern u16 wlc_bmac_get_txant(struct wlc_hw_info *wlc_hw); +extern void wlc_bmac_antsel_type_set(struct wlc_hw_info *wlc_hw, + u8 antsel_type); +extern int wlc_bmac_revinfo_get(struct wlc_hw_info *wlc_hw, wlc_bmac_revinfo_t *revinfo); -extern int wlc_bmac_state_get(wlc_hw_info_t *wlc_hw, wlc_bmac_state_t *state); -extern void wlc_bmac_write_shm(wlc_hw_info_t *wlc_hw, uint offset, u16 v); -extern u16 wlc_bmac_read_shm(wlc_hw_info_t *wlc_hw, uint offset); -extern void wlc_bmac_set_shm(wlc_hw_info_t *wlc_hw, uint offset, u16 v, +extern int wlc_bmac_state_get(struct wlc_hw_info *wlc_hw, + wlc_bmac_state_t *state); +extern void wlc_bmac_write_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v); +extern u16 wlc_bmac_read_shm(struct wlc_hw_info *wlc_hw, uint offset); +extern void wlc_bmac_set_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v, int len); -extern void wlc_bmac_write_template_ram(wlc_hw_info_t *wlc_hw, int offset, +extern void wlc_bmac_write_template_ram(struct wlc_hw_info *wlc_hw, int offset, int len, void *buf); -extern void wlc_bmac_copyfrom_vars(wlc_hw_info_t *wlc_hw, char **buf, +extern void wlc_bmac_copyfrom_vars(struct wlc_hw_info *wlc_hw, char **buf, uint *len); -extern void wlc_bmac_process_ps_switch(wlc_hw_info_t *wlc, +extern void wlc_bmac_process_ps_switch(struct wlc_hw_info *wlc, struct ether_addr *ea, s8 ps_on); -extern void wlc_bmac_hw_etheraddr(wlc_hw_info_t *wlc_hw, +extern void wlc_bmac_hw_etheraddr(struct wlc_hw_info *wlc_hw, struct ether_addr *ea); -extern void wlc_bmac_set_hw_etheraddr(wlc_hw_info_t *wlc_hw, +extern void wlc_bmac_set_hw_etheraddr(struct wlc_hw_info *wlc_hw, struct ether_addr *ea); -extern bool wlc_bmac_validate_chip_access(wlc_hw_info_t *wlc_hw); +extern bool wlc_bmac_validate_chip_access(struct wlc_hw_info *wlc_hw); -extern bool wlc_bmac_radio_read_hwdisabled(wlc_hw_info_t *wlc_hw); -extern void wlc_bmac_set_shortslot(wlc_hw_info_t *wlc_hw, bool shortslot); -extern void wlc_bmac_mute(wlc_hw_info_t *wlc_hw, bool want, mbool flags); -extern void wlc_bmac_set_deaf(wlc_hw_info_t *wlc_hw, bool user_flag); -extern void wlc_bmac_band_stf_ss_set(wlc_hw_info_t *wlc_hw, u8 stf_mode); +extern bool wlc_bmac_radio_read_hwdisabled(struct wlc_hw_info *wlc_hw); +extern void wlc_bmac_set_shortslot(struct wlc_hw_info *wlc_hw, bool shortslot); +extern void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool want, mbool flags); +extern void wlc_bmac_set_deaf(struct wlc_hw_info *wlc_hw, bool user_flag); +extern void wlc_bmac_band_stf_ss_set(struct wlc_hw_info *wlc_hw, u8 stf_mode); -extern void wlc_bmac_wait_for_wake(wlc_hw_info_t *wlc_hw); -extern bool wlc_bmac_tx_fifo_suspended(wlc_hw_info_t *wlc_hw, uint tx_fifo); -extern void wlc_bmac_tx_fifo_suspend(wlc_hw_info_t *wlc_hw, uint tx_fifo); -extern void wlc_bmac_tx_fifo_resume(wlc_hw_info_t *wlc_hw, uint tx_fifo); +extern void wlc_bmac_wait_for_wake(struct wlc_hw_info *wlc_hw); +extern bool wlc_bmac_tx_fifo_suspended(struct wlc_hw_info *wlc_hw, + uint tx_fifo); +extern void wlc_bmac_tx_fifo_suspend(struct wlc_hw_info *wlc_hw, uint tx_fifo); +extern void wlc_bmac_tx_fifo_resume(struct wlc_hw_info *wlc_hw, uint tx_fifo); -extern void wlc_ucode_wake_override_set(wlc_hw_info_t *wlc_hw, +extern void wlc_ucode_wake_override_set(struct wlc_hw_info *wlc_hw, u32 override_bit); -extern void wlc_ucode_wake_override_clear(wlc_hw_info_t *wlc_hw, +extern void wlc_ucode_wake_override_clear(struct wlc_hw_info *wlc_hw, u32 override_bit); -extern void wlc_bmac_set_rcmta(wlc_hw_info_t *wlc_hw, int idx, +extern void wlc_bmac_set_rcmta(struct wlc_hw_info *wlc_hw, int idx, const struct ether_addr *addr); -extern void wlc_bmac_set_addrmatch(wlc_hw_info_t *wlc_hw, int match_reg_offset, +extern void wlc_bmac_set_addrmatch(struct wlc_hw_info *wlc_hw, + int match_reg_offset, const struct ether_addr *addr); -extern void wlc_bmac_write_hw_bcntemplates(wlc_hw_info_t *wlc_hw, void *bcn, - int len, bool both); +extern void wlc_bmac_write_hw_bcntemplates(struct wlc_hw_info *wlc_hw, + void *bcn, int len, bool both); -extern void wlc_bmac_read_tsf(wlc_hw_info_t *wlc_hw, u32 *tsf_l_ptr, +extern void wlc_bmac_read_tsf(struct wlc_hw_info *wlc_hw, u32 *tsf_l_ptr, u32 *tsf_h_ptr); -extern void wlc_bmac_set_cwmin(wlc_hw_info_t *wlc_hw, u16 newmin); -extern void wlc_bmac_set_cwmax(wlc_hw_info_t *wlc_hw, u16 newmax); -extern void wlc_bmac_set_noreset(wlc_hw_info_t *wlc, bool noreset_flag); -extern void wlc_bmac_set_ucode_loaded(wlc_hw_info_t *wlc, bool ucode_loaded); +extern void wlc_bmac_set_cwmin(struct wlc_hw_info *wlc_hw, u16 newmin); +extern void wlc_bmac_set_cwmax(struct wlc_hw_info *wlc_hw, u16 newmax); +extern void wlc_bmac_set_noreset(struct wlc_hw_info *wlc, bool noreset_flag); +extern void wlc_bmac_set_ucode_loaded(struct wlc_hw_info *wlc, + bool ucode_loaded); -extern void wlc_bmac_retrylimit_upd(wlc_hw_info_t *wlc_hw, u16 SRL, +extern void wlc_bmac_retrylimit_upd(struct wlc_hw_info *wlc_hw, u16 SRL, u16 LRL); -extern void wlc_bmac_fifoerrors(wlc_hw_info_t *wlc_hw); +extern void wlc_bmac_fifoerrors(struct wlc_hw_info *wlc_hw); -#ifdef WLC_HIGH_ONLY -extern void wlc_bmac_dngl_reboot(rpc_info_t *); -extern void wlc_bmac_dngl_rpc_agg(rpc_info_t *, u16 agg); -extern void wlc_bmac_dngl_rpc_msglevel(rpc_info_t *, u16 level); -extern void wlc_bmac_dngl_rpc_txq_wm_set(rpc_info_t *rpc, u32 wm); -extern void wlc_bmac_dngl_rpc_txq_wm_get(rpc_info_t *rpc, u32 *wm); -extern void wlc_bmac_dngl_rpc_agg_limit_set(rpc_info_t *rpc, u32 val); -extern void wlc_bmac_dngl_rpc_agg_limit_get(rpc_info_t *rpc, u32 *pval); -extern int wlc_bmac_debug_template(wlc_hw_info_t *wlc_hw); -#endif /* API for BMAC driver (e.g. wlc_phy.c etc) */ -extern void wlc_bmac_bw_set(wlc_hw_info_t *wlc_hw, u16 bw); -extern void wlc_bmac_pllreq(wlc_hw_info_t *wlc_hw, bool set, mbool req_bit); -extern void wlc_bmac_set_clk(wlc_hw_info_t *wlc_hw, bool on); -extern bool wlc_bmac_taclear(wlc_hw_info_t *wlc_hw, bool ta_ok); +extern void wlc_bmac_bw_set(struct wlc_hw_info *wlc_hw, u16 bw); +extern void wlc_bmac_pllreq(struct wlc_hw_info *wlc_hw, bool set, + mbool req_bit); +extern void wlc_bmac_set_clk(struct wlc_hw_info *wlc_hw, bool on); +extern bool wlc_bmac_taclear(struct wlc_hw_info *wlc_hw, bool ta_ok); extern void wlc_bmac_hw_up(struct wlc_hw_info *wlc_hw); -extern void wlc_bmac_dump(wlc_hw_info_t *wlc_hw, struct bcmstrbuf *b, +extern void wlc_bmac_dump(struct wlc_hw_info *wlc_hw, struct bcmstrbuf *b, wlc_bmac_dump_id_t dump_id); -extern void wlc_gpio_fast_deinit(wlc_hw_info_t *wlc_hw); +extern void wlc_gpio_fast_deinit(struct wlc_hw_info *wlc_hw); -extern bool wlc_bmac_radio_hw(wlc_hw_info_t *wlc_hw, bool enable); -extern u16 wlc_bmac_rate_shm_offset(wlc_hw_info_t *wlc_hw, u8 rate); +extern bool wlc_bmac_radio_hw(struct wlc_hw_info *wlc_hw, bool enable); +extern u16 wlc_bmac_rate_shm_offset(struct wlc_hw_info *wlc_hw, u8 rate); -extern void wlc_bmac_assert_type_set(wlc_hw_info_t *wlc_hw, u32 type); -extern void wlc_bmac_set_txpwr_percent(wlc_hw_info_t *wlc_hw, u8 val); -extern void wlc_bmac_blink_sync(wlc_hw_info_t *wlc_hw, u32 led_pins); -extern void wlc_bmac_ifsctl_edcrs_set(wlc_hw_info_t *wlc_hw, bool abie, +extern void wlc_bmac_assert_type_set(struct wlc_hw_info *wlc_hw, u32 type); +extern void wlc_bmac_set_txpwr_percent(struct wlc_hw_info *wlc_hw, u8 val); +extern void wlc_bmac_blink_sync(struct wlc_hw_info *wlc_hw, u32 led_pins); +extern void wlc_bmac_ifsctl_edcrs_set(struct wlc_hw_info *wlc_hw, bool abie, bool isht); -extern void wlc_bmac_antsel_set(wlc_hw_info_t *wlc_hw, u32 antsel_avail); +extern void wlc_bmac_antsel_set(struct wlc_hw_info *wlc_hw, u32 antsel_avail); diff --git a/drivers/staging/brcm80211/sys/wlc_bsscfg.h b/drivers/staging/brcm80211/sys/wlc_bsscfg.h index ae5542a..d6a1971 100644 --- a/drivers/staging/brcm80211/sys/wlc_bsscfg.h +++ b/drivers/staging/brcm80211/sys/wlc_bsscfg.h @@ -34,7 +34,8 @@ typedef struct wlc_bsscfg wlc_bsscfg_t; #define MAXMACLIST 64 /* max # source MAC matches */ #define BCN_TEMPLATE_COUNT 2 -/* Iterator for "associated" STA bss configs: (wlc_info_t *wlc, int idx, wlc_bsscfg_t *cfg) */ +/* Iterator for "associated" STA bss configs: + (struct wlc_info *wlc, int idx, wlc_bsscfg_t *cfg) */ #define FOREACH_AS_STA(wlc, idx, cfg) \ for (idx = 0; (int) idx < WLC_MAXBSSCFG; idx++) \ if ((cfg = (wlc)->bsscfg[idx]) && BSSCFG_STA(cfg) && cfg->associated) diff --git a/drivers/staging/brcm80211/sys/wlc_cfg.h b/drivers/staging/brcm80211/sys/wlc_cfg.h index a415e1f..3decb7d 100644 --- a/drivers/staging/brcm80211/sys/wlc_cfg.h +++ b/drivers/staging/brcm80211/sys/wlc_cfg.h @@ -23,14 +23,6 @@ #define IS_SINGLEBAND_5G(device) 0 -/* Keep WLC_HIGH_ONLY, WLC_SPLIT for USB extension later on */ -#if !defined(WLC_LOW) -#define WLC_HIGH_ONLY -#endif -#if !defined(WLC_LOW) -#define WLC_SPLIT -#endif - /* **** Core type/rev defaults **** */ #define D11_DEFAULT 0x0fffffb0 /* Supported D11 revs: 4, 5, 7-27 * also need to update wlc.h MAXCOREREV @@ -61,22 +53,6 @@ * 3 5356a0 */ -#ifdef BCMSDIO -#define D11CONF 0x100000 -#define SSLPNCONF 2 -#define GCCONF 0 -#define ACCONF 0 -#define NCONF 0 -#define LPCONF 0 -#define LCNCONF 0 -#define NTXD 32 -#define NRXD 16 -#define NRXBUFPOST 8 -#define WLC_DATAHIWAT 32 -#define RXBND 8 -#define MAXPKTCB 64 -#define AMPDU_NUM_MPDU 8 -#endif /* For undefined values, use defaults */ #ifndef D11CONF diff --git a/drivers/staging/brcm80211/sys/wlc_channel.c b/drivers/staging/brcm80211/sys/wlc_channel.c index 5092803..a35c152 100644 --- a/drivers/staging/brcm80211/sys/wlc_channel.c +++ b/drivers/staging/brcm80211/sys/wlc_channel.c @@ -19,16 +19,21 @@ #include <bcmdefs.h> #include <wlc_cfg.h> #include <osl.h> -#include <linuxver.h> +#include <linux/module.h> +#include <linux/pci.h> #include <bcmutils.h> #include <siutils.h> +#include <sbhndpio.h> +#include <sbhnddma.h> #include <wlioctl.h> #include <wlc_pub.h> #include <wlc_key.h> +#include <wlc_event.h> #include <wlc_mac80211.h> #include <wlc_bmac.h> #include <wlc_stf.h> #include <wlc_channel.h> +#include <wl_dbg.h> typedef struct wlc_cm_band { u8 locale_flags; /* locale_info_t flags */ @@ -39,8 +44,8 @@ typedef struct wlc_cm_band { } wlc_cm_band_t; struct wlc_cm_info { - wlc_pub_t *pub; - wlc_info_t *wlc; + struct wlc_pub *pub; + struct wlc_info *wlc; char srom_ccode[WLC_CNTRY_BUF_SZ]; /* Country Code in SROM */ uint srom_regrev; /* Regulatory Rev for the SROM ccode */ const country_info_t *country; /* current country def */ @@ -377,7 +382,7 @@ void wlc_locale_get_channels(const locale_info_t *locale, chanvec_t *channels) { u8 i; - bzero(channels, sizeof(chanvec_t)); + memset(channels, 0, sizeof(chanvec_t)); for (i = 0; i < ARRAY_SIZE(g_table_locale_base); i++) { if (locale->valid_channels & (1 << i)) { @@ -562,8 +567,8 @@ struct chan20_info chan20_info[] = { const locale_info_t *wlc_get_locale_2g(u8 locale_idx) { if (locale_idx >= ARRAY_SIZE(g_locale_2g_table)) { - WL_ERROR(("%s: locale 2g index size out of range %d\n", - __func__, locale_idx)); + WL_ERROR("%s: locale 2g index size out of range %d\n", + __func__, locale_idx); ASSERT(locale_idx < ARRAY_SIZE(g_locale_2g_table)); return NULL; } @@ -573,8 +578,8 @@ const locale_info_t *wlc_get_locale_2g(u8 locale_idx) const locale_info_t *wlc_get_locale_5g(u8 locale_idx) { if (locale_idx >= ARRAY_SIZE(g_locale_5g_table)) { - WL_ERROR(("%s: locale 5g index size out of range %d\n", - __func__, locale_idx)); + WL_ERROR("%s: locale 5g index size out of range %d\n", + __func__, locale_idx); ASSERT(locale_idx < ARRAY_SIZE(g_locale_5g_table)); return NULL; } @@ -584,8 +589,8 @@ const locale_info_t *wlc_get_locale_5g(u8 locale_idx) const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx) { if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) { - WL_ERROR(("%s: mimo 2g index size out of range %d\n", __func__, - locale_idx)); + WL_ERROR("%s: mimo 2g index size out of range %d\n", + __func__, locale_idx); return NULL; } return g_mimo_2g_table[locale_idx]; @@ -594,26 +599,26 @@ const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx) const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx) { if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table)) { - WL_ERROR(("%s: mimo 5g index size out of range %d\n", __func__, - locale_idx)); + WL_ERROR("%s: mimo 5g index size out of range %d\n", + __func__, locale_idx); return NULL; } return g_mimo_5g_table[locale_idx]; } -wlc_cm_info_t *wlc_channel_mgr_attach(wlc_info_t *wlc) +wlc_cm_info_t *wlc_channel_mgr_attach(struct wlc_info *wlc) { wlc_cm_info_t *wlc_cm; char country_abbrev[WLC_CNTRY_BUF_SZ]; const country_info_t *country; - wlc_pub_t *pub = wlc->pub; + struct wlc_pub *pub = wlc->pub; char *ccode; - WL_TRACE(("wl%d: wlc_channel_mgr_attach\n", wlc->pub->unit)); + WL_TRACE("wl%d: wlc_channel_mgr_attach\n", wlc->pub->unit); wlc_cm = kzalloc(sizeof(wlc_cm_info_t), GFP_ATOMIC); if (wlc_cm == NULL) { - WL_ERROR(("wl%d: %s: out of memory", pub->unit, __func__)); + WL_ERROR("wl%d: %s: out of memory", pub->unit, __func__); return NULL; } wlc_cm->pub = pub; @@ -624,12 +629,13 @@ wlc_cm_info_t *wlc_channel_mgr_attach(wlc_info_t *wlc) ccode = getvar(wlc->pub->vars, "ccode"); if (ccode) { strncpy(wlc->pub->srom_ccode, ccode, WLC_CNTRY_BUF_SZ - 1); - WL_NONE(("%s: SROM country code is %c%c\n", __func__, - wlc->pub->srom_ccode[0], wlc->pub->srom_ccode[1])); + WL_NONE("%s: SROM country code is %c%c\n", + __func__, + wlc->pub->srom_ccode[0], wlc->pub->srom_ccode[1]); } /* internal country information which must match regulatory constraints in firmware */ - bzero(country_abbrev, WLC_CNTRY_BUF_SZ); + memset(country_abbrev, 0, WLC_CNTRY_BUF_SZ); strncpy(country_abbrev, "X2", sizeof(country_abbrev) - 1); country = wlc_country_lookup(wlc, country_abbrev); @@ -659,7 +665,7 @@ const char *wlc_channel_country_abbrev(wlc_cm_info_t *wlc_cm) u8 wlc_channel_locale_flags(wlc_cm_info_t *wlc_cm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; return wlc_cm->bandstate[wlc->band->bandunit].locale_flags; } @@ -711,7 +717,9 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm, char mapped_ccode[WLC_CNTRY_BUF_SZ]; uint mapped_regrev; - WL_NONE(("%s: (country_abbrev \"%s\", ccode \"%s\", regrev %d) SPROM \"%s\"/%u\n", __func__, country_abbrev, ccode, regrev, wlc_cm->srom_ccode, wlc_cm->srom_regrev)); + WL_NONE("%s: (country_abbrev \"%s\", ccode \"%s\", regrev %d) SPROM \"%s\"/%u\n", + __func__, country_abbrev, ccode, regrev, + wlc_cm->srom_ccode, wlc_cm->srom_regrev); /* if regrev is -1, lookup the mapped country code, * otherwise use the ccode and regrev directly @@ -750,7 +758,7 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm, { const locale_mimo_info_t *li_mimo; const locale_info_t *locale; - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; char prev_country_abbrev[WLC_CNTRY_BUF_SZ]; ASSERT(country != NULL); @@ -758,7 +766,7 @@ wlc_set_country_common(wlc_cm_info_t *wlc_cm, /* save current country state */ wlc_cm->country = country; - bzero(&prev_country_abbrev, WLC_CNTRY_BUF_SZ); + memset(&prev_country_abbrev, 0, WLC_CNTRY_BUF_SZ); strncpy(prev_country_abbrev, wlc_cm->country_abbrev, WLC_CNTRY_BUF_SZ - 1); @@ -814,7 +822,7 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, char *mapped_ccode, uint *mapped_regrev) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; const country_info_t *country; uint srom_regrev = wlc_cm->srom_regrev; const char *srom_ccode = wlc_cm->srom_ccode; @@ -822,8 +830,8 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, /* check for currently supported ccode size */ if (strlen(ccode) > (WLC_CNTRY_BUF_SZ - 1)) { - WL_ERROR(("wl%d: %s: ccode \"%s\" too long for match\n", - wlc->pub->unit, __func__, ccode)); + WL_ERROR("wl%d: %s: ccode \"%s\" too long for match\n", + wlc->pub->unit, __func__, ccode); return NULL; } @@ -838,7 +846,7 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm, if (!strcmp(srom_ccode, ccode)) { *mapped_regrev = srom_regrev; mapped = 0; - WL_ERROR(("srom_code == ccode %s\n", __func__)); + WL_ERROR("srom_code == ccode %s\n", __func__); ASSERT(0); } else { mapped = @@ -890,7 +898,7 @@ static const country_info_t *wlc_country_lookup_direct(const char *ccode, } } - WL_ERROR(("%s: Returning NULL\n", __func__)); + WL_ERROR("%s: Returning NULL\n", __func__); ASSERT(0); return NULL; } @@ -898,9 +906,9 @@ static const country_info_t *wlc_country_lookup_direct(const char *ccode, static int wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; uint i, j; - wlcband_t *band; + struct wlcband *band; const locale_info_t *li; chanvec_t sup_chan; const locale_mimo_info_t *li_mimo; @@ -952,7 +960,7 @@ wlc_channels_init(wlc_cm_info_t *wlc_cm, const country_info_t *country) */ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; uint chan; struct txpwr_limits txpwr; @@ -969,7 +977,9 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) if (chan == INVCHANNEL) { /* country/locale with no valid channels, set the radio disable bit */ mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); - WL_ERROR(("wl%d: %s: no valid channel for \"%s\" nbands %d bandlocked %d\n", wlc->pub->unit, __func__, wlc_cm->country_abbrev, NBANDS(wlc), wlc->bandlocked)); + WL_ERROR("wl%d: %s: no valid channel for \"%s\" nbands %d bandlocked %d\n", + wlc->pub->unit, __func__, + wlc_cm->country_abbrev, NBANDS(wlc), wlc->bandlocked); } else if (mboolisset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE)) { @@ -998,12 +1008,12 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) /* reset the quiet channels vector to the union of the restricted and radar channel sets */ void wlc_quiet_channels_reset(wlc_cm_info_t *wlc_cm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; uint i, j; - wlcband_t *band; + struct wlcband *band; const chanvec_t *chanvec; - bzero(&wlc_cm->quiet_channels, sizeof(chanvec_t)); + memset(&wlc_cm->quiet_channels, 0, sizeof(chanvec_t)); band = wlc->band; for (i = 0; i < NBANDS(wlc); @@ -1036,7 +1046,7 @@ bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec) */ bool wlc_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; return VALID_CHANNEL20(wlc, val) || (!wlc->bandlocked @@ -1054,7 +1064,7 @@ wlc_valid_channel20_in_band(wlc_cm_info_t *wlc_cm, uint bandunit, uint val) /* Is the channel valid for the current locale and current band? */ bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; return ((val < MAXCHANNEL) && isset(wlc_cm->bandstate[wlc->band->bandunit].valid_channels.vec, @@ -1064,7 +1074,7 @@ bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val) /* Is the 40 MHz allowed for the current locale and specified band? */ bool wlc_valid_40chanspec_in_band(wlc_cm_info_t *wlc_cm, uint bandunit) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; return (((wlc_cm->bandstate[bandunit]. locale_flags & (WLC_NO_MIMO | WLC_NO_40MHZ)) == 0) @@ -1162,7 +1172,7 @@ void wlc_channel_set_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, u8 local_constraint_qdbm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; struct txpwr_limits txpwr; wlc_channel_reg_limits(wlc_cm, chanspec, &txpwr); @@ -1179,7 +1189,7 @@ int wlc_channel_set_txpower_limit(wlc_cm_info_t *wlc_cm, u8 local_constraint_qdbm) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; struct txpwr_limits txpwr; wlc_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr); @@ -1299,13 +1309,13 @@ void wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, txpwr_limits_t *txpwr) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; uint i; uint chan; int maxpwr; int delta; const country_info_t *country; - wlcband_t *band; + struct wlcband *band; const locale_info_t *li; int conducted_max; int conducted_ofdm_max; @@ -1314,7 +1324,7 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, int maxpwr_idx; uint j; - bzero(txpwr, sizeof(txpwr_limits_t)); + memset(txpwr, 0, sizeof(txpwr_limits_t)); if (!wlc_valid_chanspec_db(wlc_cm, chanspec)) { country = wlc_country_lookup(wlc, wlc->autocountry_default); @@ -1528,13 +1538,13 @@ static bool wlc_japan_ccode(const char *ccode) static bool wlc_valid_chanspec_ext(wlc_cm_info_t *wlc_cm, chanspec_t chspec, bool dualband) { - wlc_info_t *wlc = wlc_cm->wlc; + struct wlc_info *wlc = wlc_cm->wlc; u8 channel = CHSPEC_CHANNEL(chspec); /* check the chanspec */ if (wf_chspec_malformed(chspec)) { - WL_ERROR(("wl%d: malformed chanspec 0x%x\n", wlc->pub->unit, - chspec)); + WL_ERROR("wl%d: malformed chanspec 0x%x\n", + wlc->pub->unit, chspec); ASSERT(0); return false; } diff --git a/drivers/staging/brcm80211/sys/wlc_event.c b/drivers/staging/brcm80211/sys/wlc_event.c index 7e1bf0e..dabd709 100644 --- a/drivers/staging/brcm80211/sys/wlc_event.c +++ b/drivers/staging/brcm80211/sys/wlc_event.c @@ -16,9 +16,13 @@ #include <linux/kernel.h> #include <bcmdefs.h> -#include <linuxver.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <osl.h> #include <bcmutils.h> #include <siutils.h> +#include <sbhndpio.h> +#include <sbhnddma.h> #include <wlioctl.h> #include <wlc_cfg.h> #include <wlc_pub.h> @@ -32,6 +36,7 @@ #ifdef MSGTRACE #include <msgtrace.h> #endif +#include <wl_dbg.h> /* Local prototypes */ static void wlc_timer_cb(void *arg); @@ -42,7 +47,7 @@ struct wlc_eventq { wlc_event_t *tail; struct wlc_info *wlc; void *wl; - wlc_pub_t *pub; + struct wlc_pub *pub; bool tpending; bool workpending; struct wl_timer *timer; @@ -53,7 +58,8 @@ struct wlc_eventq { /* * Export functions */ -wlc_eventq_t *wlc_eventq_attach(wlc_pub_t *pub, struct wlc_info *wlc, void *wl, +wlc_eventq_t *wlc_eventq_attach(struct wlc_pub *pub, struct wlc_info *wlc, + void *wl, wlc_eventq_cb_t cb) { wlc_eventq_t *eq; @@ -69,8 +75,8 @@ wlc_eventq_t *wlc_eventq_attach(wlc_pub_t *pub, struct wlc_info *wlc, void *wl, eq->timer = wl_init_timer(eq->wl, wlc_timer_cb, eq, "eventq"); if (!eq->timer) { - WL_ERROR(("wl%d: wlc_eventq_attach: timer failed\n", - pub->unit)); + WL_ERROR("wl%d: wlc_eventq_attach: timer failed\n", + pub->unit); kfree(eq); return NULL; } diff --git a/drivers/staging/brcm80211/sys/wlc_event.h b/drivers/staging/brcm80211/sys/wlc_event.h index e443dae..e75582d 100644 --- a/drivers/staging/brcm80211/sys/wlc_event.h +++ b/drivers/staging/brcm80211/sys/wlc_event.h @@ -21,7 +21,8 @@ typedef struct wlc_eventq wlc_eventq_t; typedef void (*wlc_eventq_cb_t) (void *arg); -extern wlc_eventq_t *wlc_eventq_attach(wlc_pub_t *pub, struct wlc_info *wlc, +extern wlc_eventq_t *wlc_eventq_attach(struct wlc_pub *pub, + struct wlc_info *wlc, void *wl, wlc_eventq_cb_t cb); extern int wlc_eventq_detach(wlc_eventq_t *eq); extern int wlc_eventq_down(wlc_eventq_t *eq); @@ -38,7 +39,7 @@ extern int wlc_eventq_query_ind(wlc_eventq_t *eq, void *bitvect); extern int wlc_eventq_test_ind(wlc_eventq_t *eq, int et); extern int wlc_eventq_set_ind(wlc_eventq_t *eq, uint et, bool on); extern void wlc_eventq_flush(wlc_eventq_t *eq); -extern void wlc_assign_event_msg(wlc_info_t *wlc, wl_event_msg_t *msg, +extern void wlc_assign_event_msg(struct wlc_info *wlc, wl_event_msg_t *msg, const wlc_event_t *e, u8 *data, u32 len); diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c index feaffcc..1d5d01a 100644 --- a/drivers/staging/brcm80211/sys/wlc_mac80211.c +++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c @@ -15,9 +15,10 @@ */ #include <linux/kernel.h> #include <linux/ctype.h> +#include <linux/etherdevice.h> #include <bcmdefs.h> +#include <bcmdevs.h> #include <wlc_cfg.h> -#include <linuxver.h> #include <osl.h> #include <bcmutils.h> #include <bcmwifi.h> @@ -27,7 +28,7 @@ #include <pcicfg.h> #include <bcmsrom.h> #include <wlioctl.h> -#include <epivers.h> +#include <sbhndpio.h> #include <sbhnddma.h> #include <hnddma.h> #include <hndpmu.h> @@ -37,6 +38,7 @@ #include <wlc_key.h> #include <wlc_bsscfg.h> #include <wlc_channel.h> +#include <wlc_event.h> #include <wlc_mac80211.h> #include <wlc_bmac.h> #include <wlc_scb.h> @@ -47,27 +49,11 @@ #include <wlc_ampdu.h> #include <wlc_event.h> #include <wl_export.h> -#ifdef BCMSDIO -#include <bcmsdh.h> -#else #include "d11ucode_ext.h" -#endif -#ifdef WLC_HIGH_ONLY -#include <bcm_rpc_tp.h> -#include <bcm_rpc.h> -#include <bcm_xdr.h> -#include <wlc_rpc.h> -#include <wlc_rpctx.h> -#endif /* WLC_HIGH_ONLY */ #include <wlc_alloc.h> #include <net/mac80211.h> +#include <wl_dbg.h> -#ifdef WLC_HIGH_ONLY -#undef R_REG -#undef W_REG -#define R_REG(osh, r) RPC_READ_REG(osh, r) -#define W_REG(osh, r, v) RPC_WRITE_REG(osh, r, v) -#endif /* * buffer length needed for wlc_format_ssid @@ -107,12 +93,8 @@ /* To inform the ucode of the last mcast frame posted so that it can clear moredata bit */ #define BCMCFID(wlc, fid) wlc_bmac_write_shm((wlc)->hw, M_BCMC_FID, (fid)) -#ifndef WLC_HIGH_ONLY -#define WLC_WAR16165(wlc) (BUSTYPE(wlc->pub->sih->bustype) == PCI_BUS && \ +#define WLC_WAR16165(wlc) (wlc->pub->sih->bustype == PCI_BUS && \ (!AP_ENAB(wlc->pub)) && (wlc->war16165)) -#else -#define WLC_WAR16165(wlc) (false) -#endif /* WLC_HIGH_ONLY */ /* debug/trace */ uint wl_msg_level = @@ -135,9 +117,11 @@ uint wl_msg_level = #define SCAN_IN_PROGRESS(x) 0 +#define EPI_VERSION_NUM 0x054b0b00 + #ifdef BCMDBG /* pointer to most recently allocated wl/wlc */ -static wlc_info_t *wlc_info_dbg = (wlc_info_t *) (NULL); +static struct wlc_info *wlc_info_dbg = (struct wlc_info *) (NULL); #endif /* IOVar table */ @@ -238,91 +222,91 @@ static const u8 acbitmap2maxprio[] = { #define WLC_REPLAY_CNTRS_VALUE WPA_CAP_16_REPLAY_CNTRS /* local prototypes */ -extern void wlc_txq_enq(void *ctx, struct scb *scb, void *sdu, uint prec); -static u16 BCMFASTPATH wlc_d11hdrs_mac80211(wlc_info_t *wlc, - struct ieee80211_hw *hw, void *p, +static u16 BCMFASTPATH wlc_d11hdrs_mac80211(struct wlc_info *wlc, + struct ieee80211_hw *hw, + struct sk_buff *p, struct scb *scb, uint frag, uint nfrags, uint queue, uint next_frag_len, wsec_key_t *key, ratespec_t rspec_override); -bool wlc_sendpkt_mac80211(wlc_info_t *wlc, void *sdu, struct ieee80211_hw *hw); -void wlc_wme_setparams(wlc_info_t *wlc, u16 aci, void *arg, bool suspend); -static void wlc_bss_default_init(wlc_info_t *wlc); -static void wlc_ucode_mac_upd(wlc_info_t *wlc); -static ratespec_t mac80211_wlc_set_nrate(wlc_info_t *wlc, wlcband_t *cur_band, - u32 int_val); -static void wlc_tx_prec_map_init(wlc_info_t *wlc); + +static void wlc_bss_default_init(struct wlc_info *wlc); +static void wlc_ucode_mac_upd(struct wlc_info *wlc); +static ratespec_t mac80211_wlc_set_nrate(struct wlc_info *wlc, + struct wlcband *cur_band, u32 int_val); +static void wlc_tx_prec_map_init(struct wlc_info *wlc); static void wlc_watchdog(void *arg); static void wlc_watchdog_by_timer(void *arg); -static int wlc_set_rateset(wlc_info_t *wlc, wlc_rateset_t *rs_arg); -static int wlc_iovar_rangecheck(wlc_info_t *wlc, u32 val, +static int wlc_set_rateset(struct wlc_info *wlc, wlc_rateset_t *rs_arg); +static int wlc_iovar_rangecheck(struct wlc_info *wlc, u32 val, const bcm_iovar_t *vi); -static u8 wlc_local_constraint_qdbm(wlc_info_t *wlc); +static u8 wlc_local_constraint_qdbm(struct wlc_info *wlc); /* send and receive */ -static wlc_txq_info_t *wlc_txq_alloc(wlc_info_t *wlc, osl_t *osh); -static void wlc_txq_free(wlc_info_t *wlc, osl_t *osh, wlc_txq_info_t *qi); -static void wlc_txflowcontrol_signal(wlc_info_t *wlc, wlc_txq_info_t *qi, +static wlc_txq_info_t *wlc_txq_alloc(struct wlc_info *wlc, + struct osl_info *osh); +static void wlc_txq_free(struct wlc_info *wlc, struct osl_info *osh, + wlc_txq_info_t *qi); +static void wlc_txflowcontrol_signal(struct wlc_info *wlc, wlc_txq_info_t *qi, bool on, int prio); -static void wlc_txflowcontrol_reset(wlc_info_t *wlc); -static u16 wlc_compute_airtime(wlc_info_t *wlc, ratespec_t rspec, +static void wlc_txflowcontrol_reset(struct wlc_info *wlc); +static u16 wlc_compute_airtime(struct wlc_info *wlc, ratespec_t rspec, uint length); static void wlc_compute_cck_plcp(ratespec_t rate, uint length, u8 *plcp); static void wlc_compute_ofdm_plcp(ratespec_t rate, uint length, u8 *plcp); static void wlc_compute_mimo_plcp(ratespec_t rate, uint length, u8 *plcp); -static u16 wlc_compute_frame_dur(wlc_info_t *wlc, ratespec_t rate, +static u16 wlc_compute_frame_dur(struct wlc_info *wlc, ratespec_t rate, u8 preamble_type, uint next_frag_len); -static void wlc_recvctl(wlc_info_t *wlc, osl_t *osh, d11rxhdr_t *rxh, - void *p); -static uint wlc_calc_frame_len(wlc_info_t *wlc, ratespec_t rate, +static void wlc_recvctl(struct wlc_info *wlc, struct osl_info *osh, + d11rxhdr_t *rxh, struct sk_buff *p); +static uint wlc_calc_frame_len(struct wlc_info *wlc, ratespec_t rate, u8 preamble_type, uint dur); -static uint wlc_calc_ack_time(wlc_info_t *wlc, ratespec_t rate, +static uint wlc_calc_ack_time(struct wlc_info *wlc, ratespec_t rate, u8 preamble_type); -static uint wlc_calc_cts_time(wlc_info_t *wlc, ratespec_t rate, +static uint wlc_calc_cts_time(struct wlc_info *wlc, ratespec_t rate, u8 preamble_type); /* interrupt, up/down, band */ -static void wlc_setband(wlc_info_t *wlc, uint bandunit); -static chanspec_t wlc_init_chanspec(wlc_info_t *wlc); -static void wlc_bandinit_ordered(wlc_info_t *wlc, chanspec_t chanspec); -static void wlc_bsinit(wlc_info_t *wlc); -static int wlc_duty_cycle_set(wlc_info_t *wlc, int duty_cycle, bool isOFDM, +static void wlc_setband(struct wlc_info *wlc, uint bandunit); +static chanspec_t wlc_init_chanspec(struct wlc_info *wlc); +static void wlc_bandinit_ordered(struct wlc_info *wlc, chanspec_t chanspec); +static void wlc_bsinit(struct wlc_info *wlc); +static int wlc_duty_cycle_set(struct wlc_info *wlc, int duty_cycle, bool isOFDM, bool writeToShm); -static void wlc_radio_hwdisable_upd(wlc_info_t *wlc); -static bool wlc_radio_monitor_start(wlc_info_t *wlc); +static void wlc_radio_hwdisable_upd(struct wlc_info *wlc); +static bool wlc_radio_monitor_start(struct wlc_info *wlc); static void wlc_radio_timer(void *arg); -static void wlc_radio_enable(wlc_info_t *wlc); -static void wlc_radio_upd(wlc_info_t *wlc); +static void wlc_radio_enable(struct wlc_info *wlc); +static void wlc_radio_upd(struct wlc_info *wlc); /* scan, association, BSS */ -static uint wlc_calc_ba_time(wlc_info_t *wlc, ratespec_t rate, +static uint wlc_calc_ba_time(struct wlc_info *wlc, ratespec_t rate, u8 preamble_type); -static void wlc_update_mimo_band_bwcap(wlc_info_t *wlc, u8 bwcap); -static void wlc_ht_update_sgi_rx(wlc_info_t *wlc, int val); -void wlc_ht_mimops_cap_update(wlc_info_t *wlc, u8 mimops_mode); -static void wlc_ht_update_ldpc(wlc_info_t *wlc, s8 val); -static void wlc_war16165(wlc_info_t *wlc, bool tx); +static void wlc_update_mimo_band_bwcap(struct wlc_info *wlc, u8 bwcap); +static void wlc_ht_update_sgi_rx(struct wlc_info *wlc, int val); +static void wlc_ht_update_ldpc(struct wlc_info *wlc, s8 val); +static void wlc_war16165(struct wlc_info *wlc, bool tx); static void wlc_process_eventq(void *arg); -static void wlc_wme_retries_write(wlc_info_t *wlc); -static bool wlc_attach_stf_ant_init(wlc_info_t *wlc); -static uint wlc_attach_module(wlc_info_t *wlc); -static void wlc_detach_module(wlc_info_t *wlc); -static void wlc_timers_deinit(wlc_info_t *wlc); -static void wlc_down_led_upd(wlc_info_t *wlc); -static uint wlc_down_del_timer(wlc_info_t *wlc); -static void wlc_ofdm_rateset_war(wlc_info_t *wlc); -static int _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, +static void wlc_wme_retries_write(struct wlc_info *wlc); +static bool wlc_attach_stf_ant_init(struct wlc_info *wlc); +static uint wlc_attach_module(struct wlc_info *wlc); +static void wlc_detach_module(struct wlc_info *wlc); +static void wlc_timers_deinit(struct wlc_info *wlc); +static void wlc_down_led_upd(struct wlc_info *wlc); +static uint wlc_down_del_timer(struct wlc_info *wlc); +static void wlc_ofdm_rateset_war(struct wlc_info *wlc); +static int _wlc_ioctl(struct wlc_info *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif); #if defined(BCMDBG) -void wlc_get_rcmta(wlc_info_t *wlc, int idx, struct ether_addr *addr) +void wlc_get_rcmta(struct wlc_info *wlc, int idx, struct ether_addr *addr) { d11regs_t *regs = wlc->regs; u32 v32; - osl_t *osh; + struct osl_info *osh; - WL_TRACE(("wl%d: %s\n", WLCWLUNIT(wlc), __func__)); + WL_TRACE("wl%d: %s\n", WLCWLUNIT(wlc), __func__); ASSERT(wlc->pub->corerev > 4); @@ -344,14 +328,14 @@ void wlc_get_rcmta(wlc_info_t *wlc, int idx, struct ether_addr *addr) #endif /* defined(BCMDBG) */ /* keep the chip awake if needed */ -bool wlc_stay_awake(wlc_info_t *wlc) +bool wlc_stay_awake(struct wlc_info *wlc) { return true; } /* conditions under which the PM bit should be set in outgoing frames and STAY_AWAKE is meaningful */ -bool wlc_ps_allowed(wlc_info_t *wlc) +bool wlc_ps_allowed(struct wlc_info *wlc) { int idx; wlc_bsscfg_t *cfg; @@ -378,9 +362,9 @@ bool wlc_ps_allowed(wlc_info_t *wlc) return true; } -void wlc_reset(wlc_info_t *wlc) +void wlc_reset(struct wlc_info *wlc) { - WL_TRACE(("wl%d: wlc_reset\n", wlc->pub->unit)); + WL_TRACE("wl%d: wlc_reset\n", wlc->pub->unit); wlc->check_for_unaligned_tbtt = false; @@ -389,34 +373,19 @@ void wlc_reset(wlc_info_t *wlc) wlc_statsupd(wlc); /* reset our snapshot of macstat counters */ - bzero((char *)wlc->core->macstat_snapshot, sizeof(macstat_t)); + memset((char *)wlc->core->macstat_snapshot, 0, + sizeof(macstat_t)); } wlc_bmac_reset(wlc->hw); wlc_ampdu_reset(wlc->ampdu); wlc->txretried = 0; -#ifdef WLC_HIGH_ONLY - /* Need to set a flag(to be cleared asynchronously by BMAC driver with high call) - * in order to prevent wlc_rpctx_txreclaim() from screwing wlc_rpctx_getnexttxp(), - * which could be invoked by already QUEUED high call(s) from BMAC driver before - * wlc_bmac_reset() finishes. - * It's not needed before in monolithic driver model because d11core interrupts would - * have been cleared instantly in wlc_bmac_reset() and no txstatus interrupt - * will come to driver to fetch those flushed dma pkt pointers. - */ - wlc->reset_bmac_pending = true; - - wlc_rpctx_txreclaim(wlc->rpctx); - - wlc_stf_phy_txant_upd(wlc); - wlc_phy_ant_rxdiv_set(wlc->band->pi, wlc->stf->ant_rx_ovr); -#endif } -void wlc_fatal_error(wlc_info_t *wlc) +void wlc_fatal_error(struct wlc_info *wlc) { - WL_ERROR(("wl%d: fatal error, reinitializing\n", wlc->pub->unit)); + WL_ERROR("wl%d: fatal error, reinitializing\n", wlc->pub->unit); wl_init(wlc->wl); } @@ -425,7 +394,7 @@ void wlc_fatal_error(wlc_info_t *wlc) * if other configurations are in conflict (bandlocked, 11n mode disabled, * invalid channel for current country, etc.) */ -static chanspec_t wlc_init_chanspec(wlc_info_t *wlc) +static chanspec_t wlc_init_chanspec(struct wlc_info *wlc) { chanspec_t chanspec = 1 | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE | @@ -441,7 +410,7 @@ static chanspec_t wlc_init_chanspec(wlc_info_t *wlc) struct scb global_scb; -static void wlc_init_scb(wlc_info_t *wlc, struct scb *scb) +static void wlc_init_scb(struct wlc_info *wlc, struct scb *scb) { int i; scb->flags = SCB_WMECAP | SCB_HTCAP; @@ -449,7 +418,7 @@ static void wlc_init_scb(wlc_info_t *wlc, struct scb *scb) scb->seqnum[i] = 0; } -void wlc_init(wlc_info_t *wlc) +void wlc_init(struct wlc_info *wlc) { d11regs_t *regs; chanspec_t chanspec; @@ -457,7 +426,7 @@ void wlc_init(wlc_info_t *wlc) wlc_bsscfg_t *bsscfg; bool mute = false; - WL_TRACE(("wl%d: wlc_init\n", wlc->pub->unit)); + WL_TRACE("wl%d: wlc_init\n", wlc->pub->unit); regs = wlc->regs; @@ -583,13 +552,13 @@ void wlc_init(wlc_info_t *wlc) } } -void wlc_mac_bcn_promisc_change(wlc_info_t *wlc, bool promisc) +void wlc_mac_bcn_promisc_change(struct wlc_info *wlc, bool promisc) { wlc->bcnmisc_monitor = promisc; wlc_mac_bcn_promisc(wlc); } -void wlc_mac_bcn_promisc(wlc_info_t *wlc) +void wlc_mac_bcn_promisc(struct wlc_info *wlc) { if ((AP_ENAB(wlc->pub) && (N_ENAB(wlc->pub) || wlc->band->gmode)) || wlc->bcnmisc_ibss || wlc->bcnmisc_scan || wlc->bcnmisc_monitor) @@ -599,7 +568,7 @@ void wlc_mac_bcn_promisc(wlc_info_t *wlc) } /* set or clear maccontrol bits MCTL_PROMISC and MCTL_KEEPCONTROL */ -void wlc_mac_promisc(wlc_info_t *wlc) +void wlc_mac_promisc(struct wlc_info *wlc) { u32 promisc_bits = 0; @@ -621,7 +590,7 @@ void wlc_mac_promisc(wlc_info_t *wlc) } /* check if hps and wake states of sw and hw are in sync */ -bool wlc_ps_check(wlc_info_t *wlc) +bool wlc_ps_check(struct wlc_info *wlc) { bool res = true; bool hps, wake; @@ -636,8 +605,8 @@ bool wlc_ps_check(wlc_info_t *wlc) * to avoid assert */ if (tmp == 0xffffffff) { - WL_ERROR(("wl%d: %s: dead chip\n", wlc->pub->unit, - __func__)); + WL_ERROR("wl%d: %s: dead chip\n", + wlc->pub->unit, __func__); return DEVICEREMOVED(wlc); } @@ -646,7 +615,8 @@ bool wlc_ps_check(wlc_info_t *wlc) if (hps != ((tmp & MCTL_HPS) != 0)) { int idx; wlc_bsscfg_t *cfg; - WL_ERROR(("wl%d: hps not sync, sw %d, maccontrol 0x%x\n", wlc->pub->unit, hps, tmp)); + WL_ERROR("wl%d: hps not sync, sw %d, maccontrol 0x%x\n", + wlc->pub->unit, hps, tmp); FOREACH_BSS(wlc, idx, cfg) { if (!BSSCFG_STA(cfg)) continue; @@ -654,23 +624,14 @@ bool wlc_ps_check(wlc_info_t *wlc) res = false; } -#ifdef WLC_LOW /* For a monolithic build the wake check can be exact since it looks at wake * override bits. The MCTL_WAKE bit should match the 'wake' value. */ wake = STAY_AWAKE(wlc) || wlc->hw->wake_override; wake_ok = (wake == ((tmp & MCTL_WAKE) != 0)); -#else - /* For a split build we will not have access to any wake overrides from the low - * level. The check can only make sure the MCTL_WAKE bit is on if the high - * level 'wake' value is true. If the high level 'wake' is false, the MCTL_WAKE - * may be either true or false due to the low level override. - */ - wake = STAY_AWAKE(wlc); - wake_ok = (wake && ((tmp & MCTL_WAKE) != 0)) || !wake; -#endif if (hps && !wake_ok) { - WL_ERROR(("wl%d: wake not sync, sw %d maccontrol 0x%x\n", wlc->pub->unit, wake, tmp)); + WL_ERROR("wl%d: wake not sync, sw %d maccontrol 0x%x\n", + wlc->pub->unit, wake, tmp); res = false; } } @@ -679,7 +640,7 @@ bool wlc_ps_check(wlc_info_t *wlc) } /* push sw hps and wake state through hardware */ -void wlc_set_ps_ctrl(wlc_info_t *wlc) +void wlc_set_ps_ctrl(struct wlc_info *wlc) { u32 v1, v2; bool hps, wake; @@ -688,8 +649,8 @@ void wlc_set_ps_ctrl(wlc_info_t *wlc) hps = PS_ALLOWED(wlc); wake = hps ? (STAY_AWAKE(wlc)) : true; - WL_TRACE(("wl%d: wlc_set_ps_ctrl: hps %d wake %d\n", wlc->pub->unit, - hps, wake)); + WL_TRACE("wl%d: wlc_set_ps_ctrl: hps %d wake %d\n", + wlc->pub->unit, hps, wake); v1 = R_REG(wlc->osh, &wlc->regs->maccontrol); v2 = 0; @@ -714,7 +675,7 @@ void wlc_set_ps_ctrl(wlc_info_t *wlc) int wlc_set_mac(wlc_bsscfg_t *cfg) { int err = 0; - wlc_info_t *wlc = cfg->wlc; + struct wlc_info *wlc = cfg->wlc; if (cfg == wlc->cfg) { /* enter the MAC addr into the RXE match registers */ @@ -731,7 +692,7 @@ int wlc_set_mac(wlc_bsscfg_t *cfg) */ void wlc_set_bssid(wlc_bsscfg_t *cfg) { - wlc_info_t *wlc = cfg->wlc; + struct wlc_info *wlc = cfg->wlc; /* if primary config, we need to update BSSID in RXE match registers */ if (cfg == wlc->cfg) { @@ -748,7 +709,7 @@ void wlc_set_bssid(wlc_bsscfg_t *cfg) * Suspend the the MAC and update the slot timing * for standard 11b/g (20us slots) or shortslot 11g (9us slots). */ -void wlc_switch_shortslot(wlc_info_t *wlc, bool shortslot) +void wlc_switch_shortslot(struct wlc_info *wlc, bool shortslot) { int idx; wlc_bsscfg_t *cfg; @@ -776,7 +737,7 @@ void wlc_switch_shortslot(wlc_info_t *wlc, bool shortslot) wlc_bmac_set_shortslot(wlc->hw, shortslot); } -static u8 wlc_local_constraint_qdbm(wlc_info_t *wlc) +static u8 wlc_local_constraint_qdbm(struct wlc_info *wlc) { u8 local; s16 local_max; @@ -803,7 +764,7 @@ static u8 wlc_local_constraint_qdbm(wlc_info_t *wlc) } /* propagate home chanspec to all bsscfgs in case bsscfg->current_bss->chanspec is referenced */ -void wlc_set_home_chanspec(wlc_info_t *wlc, chanspec_t chanspec) +void wlc_set_home_chanspec(struct wlc_info *wlc, chanspec_t chanspec) { if (wlc->home_chanspec != chanspec) { int idx; @@ -821,7 +782,7 @@ void wlc_set_home_chanspec(wlc_info_t *wlc, chanspec_t chanspec) } } -static void wlc_set_phy_chanspec(wlc_info_t *wlc, chanspec_t chanspec) +static void wlc_set_phy_chanspec(struct wlc_info *wlc, chanspec_t chanspec) { /* Save our copy of the chanspec */ wlc->chanspec = chanspec; @@ -840,15 +801,15 @@ static void wlc_set_phy_chanspec(wlc_info_t *wlc, chanspec_t chanspec) } -void wlc_set_chanspec(wlc_info_t *wlc, chanspec_t chanspec) +void wlc_set_chanspec(struct wlc_info *wlc, chanspec_t chanspec) { uint bandunit; bool switchband = false; chanspec_t old_chanspec = wlc->chanspec; if (!wlc_valid_chanspec_db(wlc->cmi, chanspec)) { - WL_ERROR(("wl%d: %s: Bad channel %d\n", - wlc->pub->unit, __func__, CHSPEC_CHANNEL(chanspec))); + WL_ERROR("wl%d: %s: Bad channel %d\n", + wlc->pub->unit, __func__, CHSPEC_CHANNEL(chanspec)); ASSERT(wlc_valid_chanspec_db(wlc->cmi, chanspec)); return; } @@ -859,7 +820,9 @@ void wlc_set_chanspec(wlc_info_t *wlc, chanspec_t chanspec) if (wlc->band->bandunit != bandunit || wlc->bandinit_pending) { switchband = true; if (wlc->bandlocked) { - WL_ERROR(("wl%d: %s: chspec %d band is locked!\n", wlc->pub->unit, __func__, CHSPEC_CHANNEL(chanspec))); + WL_ERROR("wl%d: %s: chspec %d band is locked!\n", + wlc->pub->unit, __func__, + CHSPEC_CHANNEL(chanspec)); return; } /* BMAC_NOTE: should the setband call come after the wlc_bmac_chanspec() ? @@ -895,7 +858,7 @@ void wlc_set_chanspec(wlc_info_t *wlc, chanspec_t chanspec) } #if defined(BCMDBG) -static int wlc_get_current_txpwr(wlc_info_t *wlc, void *pwr, uint len) +static int wlc_get_current_txpwr(struct wlc_info *wlc, void *pwr, uint len) { txpwr_limits_t txpwr; tx_power_t power; @@ -909,7 +872,7 @@ static int wlc_get_current_txpwr(wlc_info_t *wlc, void *pwr, uint len) else if (len < sizeof(tx_power_t)) return BCME_BUFTOOSHORT; - bzero(&power, sizeof(tx_power_t)); + memset(&power, 0, sizeof(tx_power_t)); power.chanspec = WLC_BAND_PI_RADIO_CHANSPEC; if (wlc->pub->associated) @@ -1031,7 +994,7 @@ static int wlc_get_current_txpwr(wlc_info_t *wlc, void *pwr, uint len) } else { int band_idx = CHSPEC_IS2G(power.chanspec) ? 0 : 1; - bzero(old_power, sizeof(tx_power_legacy_t)); + memset(old_power, 0, sizeof(tx_power_legacy_t)); old_power->txpwr_local_max = power.local_max; old_power->txpwr_local_constraint = power.local_constraint; @@ -1064,7 +1027,7 @@ static int wlc_get_current_txpwr(wlc_info_t *wlc, void *pwr, uint len) } #endif /* defined(BCMDBG) */ -static u32 wlc_watchdog_backup_bi(wlc_info_t *wlc) +static u32 wlc_watchdog_backup_bi(struct wlc_info *wlc) { u32 bi; bi = 2 * wlc->cfg->current_bss->dtim_period * @@ -1083,7 +1046,7 @@ static u32 wlc_watchdog_backup_bi(wlc_info_t *wlc) /* Change to run the watchdog either from a periodic timer or from tbtt handler. * Call watchdog from tbtt handler if tbtt is true, watchdog timer otherwise. */ -void wlc_watchdog_upd(wlc_info_t *wlc, bool tbtt) +void wlc_watchdog_upd(struct wlc_info *wlc, bool tbtt) { /* make sure changing watchdog driver is allowed */ if (!wlc->pub->up || !wlc->pub->align_wd_tbtt) @@ -1112,7 +1075,7 @@ void wlc_watchdog_upd(wlc_info_t *wlc, bool tbtt) } } -ratespec_t wlc_lowest_basic_rspec(wlc_info_t *wlc, wlc_rateset_t *rs) +ratespec_t wlc_lowest_basic_rspec(struct wlc_info *wlc, wlc_rateset_t *rs) { ratespec_t lowest_basic_rspec; uint i; @@ -1140,7 +1103,7 @@ ratespec_t wlc_lowest_basic_rspec(wlc_info_t *wlc, wlc_rateset_t *rs) * ratespec CCK ant = wlc->stf->txant * OFDM ant = 3 */ -void wlc_beacon_phytxctl_txant_upd(wlc_info_t *wlc, ratespec_t bcn_rspec) +void wlc_beacon_phytxctl_txant_upd(struct wlc_info *wlc, ratespec_t bcn_rspec) { u16 phyctl; u16 phytxant = wlc->stf->phytxant; @@ -1159,9 +1122,9 @@ void wlc_beacon_phytxctl_txant_upd(wlc_info_t *wlc, ratespec_t bcn_rspec) /* centralized protection config change function to simplify debugging, no consistency checking * this should be called only on changes to avoid overhead in periodic function */ -void wlc_protection_upd(wlc_info_t *wlc, uint idx, int val) +void wlc_protection_upd(struct wlc_info *wlc, uint idx, int val) { - WL_TRACE(("wlc_protection_upd: idx %d, val %d\n", idx, val)); + WL_TRACE("wlc_protection_upd: idx %d, val %d\n", idx, val); switch (idx) { case WLC_PROT_G_SPEC: @@ -1205,7 +1168,7 @@ void wlc_protection_upd(wlc_info_t *wlc, uint idx, int val) } -static void wlc_ht_update_sgi_rx(wlc_info_t *wlc, int val) +static void wlc_ht_update_sgi_rx(struct wlc_info *wlc, int val) { wlc->ht_cap.cap &= ~(HT_CAP_SHORT_GI_20 | HT_CAP_SHORT_GI_40); wlc->ht_cap.cap |= (val & WLC_N_SGI_20) ? HT_CAP_SHORT_GI_20 : 0; @@ -1217,7 +1180,7 @@ static void wlc_ht_update_sgi_rx(wlc_info_t *wlc, int val) } } -static void wlc_ht_update_ldpc(wlc_info_t *wlc, s8 val) +static void wlc_ht_update_ldpc(struct wlc_info *wlc, s8 val) { wlc->stf->ldpc = val; @@ -1236,7 +1199,7 @@ static void wlc_ht_update_ldpc(wlc_info_t *wlc, s8 val) * ucode, hwmac update * Channel dependent updates for ucode and hw */ -static void wlc_ucode_mac_upd(wlc_info_t *wlc) +static void wlc_ucode_mac_upd(struct wlc_info *wlc) { /* enable or disable any active IBSSs depending on whether or not * we are on the home channel @@ -1263,13 +1226,13 @@ static void wlc_ucode_mac_upd(wlc_info_t *wlc) wlc_mac_promisc(wlc); } -static void wlc_bandinit_ordered(wlc_info_t *wlc, chanspec_t chanspec) +static void wlc_bandinit_ordered(struct wlc_info *wlc, chanspec_t chanspec) { wlc_rateset_t default_rateset; uint parkband; uint i, band_order[2]; - WL_TRACE(("wl%d: wlc_bandinit_ordered\n", wlc->pub->unit)); + WL_TRACE("wl%d: wlc_bandinit_ordered\n", wlc->pub->unit); /* * We might have been bandlocked during down and the chip power-cycled (hibernate). * figure out the right band to park on @@ -1310,10 +1273,10 @@ static void wlc_bandinit_ordered(wlc_info_t *wlc, chanspec_t chanspec) } /* band-specific init */ -static void WLBANDINITFN(wlc_bsinit) (wlc_info_t *wlc) +static void WLBANDINITFN(wlc_bsinit) (struct wlc_info *wlc) { - WL_TRACE(("wl%d: wlc_bsinit: bandunit %d\n", wlc->pub->unit, - wlc->band->bandunit)); + WL_TRACE("wl%d: wlc_bsinit: bandunit %d\n", + wlc->pub->unit, wlc->band->bandunit); /* write ucode ACK/CTS rate table */ wlc_set_ratetable(wlc); @@ -1328,7 +1291,7 @@ static void WLBANDINITFN(wlc_bsinit) (wlc_info_t *wlc) } /* switch to and initialize new band */ -static void WLBANDINITFN(wlc_setband) (wlc_info_t *wlc, uint bandunit) +static void WLBANDINITFN(wlc_setband) (struct wlc_info *wlc, uint bandunit) { int idx; wlc_bsscfg_t *cfg; @@ -1353,7 +1316,7 @@ static void WLBANDINITFN(wlc_setband) (wlc_info_t *wlc, uint bandunit) } /* Initialize a WME Parameter Info Element with default STA parameters from WMM Spec, Table 12 */ -void wlc_wme_initparams_sta(wlc_info_t *wlc, wme_param_ie_t *pe) +void wlc_wme_initparams_sta(struct wlc_info *wlc, wme_param_ie_t *pe) { static const wme_param_ie_t stadef = { WME_OUI, @@ -1378,7 +1341,7 @@ void wlc_wme_initparams_sta(wlc_info_t *wlc, wme_param_ie_t *pe) memcpy(pe, &stadef, sizeof(*pe)); } -void wlc_wme_setparams(wlc_info_t *wlc, u16 aci, void *arg, bool suspend) +void wlc_wme_setparams(struct wlc_info *wlc, u16 aci, void *arg, bool suspend) { int i; shm_acparams_t acp_shm; @@ -1389,7 +1352,7 @@ void wlc_wme_setparams(wlc_info_t *wlc, u16 aci, void *arg, bool suspend) /* Only apply params if the core is out of reset and has clocks */ if (!wlc->clk) { - WL_ERROR(("wl%d: %s : no-clock\n", wlc->pub->unit, __func__)); + WL_ERROR("wl%d: %s : no-clock\n", wlc->pub->unit, __func__); return; } @@ -1402,7 +1365,7 @@ void wlc_wme_setparams(wlc_info_t *wlc, u16 aci, void *arg, bool suspend) wlc->wme_admctl = 0; do { - bzero((char *)&acp_shm, sizeof(shm_acparams_t)); + memset((char *)&acp_shm, 0, sizeof(shm_acparams_t)); /* find out which ac this set of params applies to */ ASSERT(aci < AC_COUNT); /* set the admission control policy for this AC */ @@ -1421,8 +1384,8 @@ void wlc_wme_setparams(wlc_info_t *wlc, u16 aci, void *arg, bool suspend) if (acp_shm.aifs < EDCF_AIFSN_MIN || acp_shm.aifs > EDCF_AIFSN_MAX) { - WL_ERROR(("wl%d: wlc_edcf_setparams: bad aifs %d\n", - wlc->pub->unit, acp_shm.aifs)); + WL_ERROR("wl%d: wlc_edcf_setparams: bad aifs %d\n", + wlc->pub->unit, acp_shm.aifs); continue; } @@ -1459,7 +1422,7 @@ void wlc_wme_setparams(wlc_info_t *wlc, u16 aci, void *arg, bool suspend) void wlc_edcf_setparams(wlc_bsscfg_t *cfg, bool suspend) { - wlc_info_t *wlc = cfg->wlc; + struct wlc_info *wlc = cfg->wlc; uint aci, i, j; edcf_acparam_t *edcf_acp; shm_acparams_t acp_shm; @@ -1483,7 +1446,7 @@ void wlc_edcf_setparams(wlc_bsscfg_t *cfg, bool suspend) wlc->wme_admctl = 0; for (i = 0; i < AC_COUNT; i++, edcf_acp++) { - bzero((char *)&acp_shm, sizeof(shm_acparams_t)); + memset((char *)&acp_shm, 0, sizeof(shm_acparams_t)); /* find out which ac this set of params applies to */ aci = (edcf_acp->ACI & EDCF_ACI_MASK) >> EDCF_ACI_SHIFT; ASSERT(aci < AC_COUNT); @@ -1505,8 +1468,8 @@ void wlc_edcf_setparams(wlc_bsscfg_t *cfg, bool suspend) if (acp_shm.aifs < EDCF_AIFSN_MIN || acp_shm.aifs > EDCF_AIFSN_MAX) { - WL_ERROR(("wl%d: wlc_edcf_setparams: bad aifs %d\n", - wlc->pub->unit, acp_shm.aifs)); + WL_ERROR("wl%d: wlc_edcf_setparams: bad aifs %d\n", + wlc->pub->unit, acp_shm.aifs); continue; } @@ -1548,20 +1511,19 @@ void wlc_edcf_setparams(wlc_bsscfg_t *cfg, bool suspend) } -bool wlc_timers_init(wlc_info_t *wlc, int unit) +bool wlc_timers_init(struct wlc_info *wlc, int unit) { wlc->wdtimer = wl_init_timer(wlc->wl, wlc_watchdog_by_timer, wlc, "watchdog"); if (!wlc->wdtimer) { - WL_ERROR(("wl%d: wl_init_timer for wdtimer failed\n", unit)); + WL_ERROR("wl%d: wl_init_timer for wdtimer failed\n", unit); goto fail; } wlc->radio_timer = wl_init_timer(wlc->wl, wlc_radio_timer, wlc, "radio"); if (!wlc->radio_timer) { - WL_ERROR(("wl%d: wl_init_timer for radio_timer failed\n", - unit)); + WL_ERROR("wl%d: wl_init_timer for radio_timer failed\n", unit); goto fail; } @@ -1575,7 +1537,7 @@ bool wlc_timers_init(wlc_info_t *wlc, int unit) * Initialize wlc_info default values ... * may get overrides later in this function */ -void wlc_info_init(wlc_info_t *wlc, int unit) +void wlc_info_init(struct wlc_info *wlc, int unit) { int i; /* Assume the device is there until proven otherwise */ @@ -1686,7 +1648,7 @@ void wlc_info_init(wlc_info_t *wlc, int unit) wlc->pr80838_war = true; } -static bool wlc_state_bmac_sync(wlc_info_t *wlc) +static bool wlc_state_bmac_sync(struct wlc_info *wlc) { wlc_bmac_state_t state_bmac; @@ -1700,7 +1662,7 @@ static bool wlc_state_bmac_sync(wlc_info_t *wlc) return true; } -static uint wlc_attach_module(wlc_info_t *wlc) +static uint wlc_attach_module(struct wlc_info *wlc) { uint err = 0; uint unit; @@ -1708,15 +1670,14 @@ static uint wlc_attach_module(wlc_info_t *wlc) wlc->asi = wlc_antsel_attach(wlc, wlc->osh, wlc->pub, wlc->hw); if (wlc->asi == NULL) { - WL_ERROR(("wl%d: wlc_attach: wlc_antsel_attach failed\n", - unit)); + WL_ERROR("wl%d: wlc_attach: wlc_antsel_attach failed\n", unit); err = 44; goto fail; } wlc->ampdu = wlc_ampdu_attach(wlc); if (wlc->ampdu == NULL) { - WL_ERROR(("wl%d: wlc_attach: wlc_ampdu_attach failed\n", unit)); + WL_ERROR("wl%d: wlc_attach: wlc_ampdu_attach failed\n", unit); err = 50; goto fail; } @@ -1725,13 +1686,13 @@ static uint wlc_attach_module(wlc_info_t *wlc) wlc->eventq = wlc_eventq_attach(wlc->pub, wlc, wlc->wl, wlc_process_eventq); if (wlc->eventq == NULL) { - WL_ERROR(("wl%d: wlc_attach: wlc_eventq_attachfailed\n", unit)); + WL_ERROR("wl%d: wlc_attach: wlc_eventq_attachfailed\n", unit); err = 57; goto fail; } if ((wlc_stf_attach(wlc) != 0)) { - WL_ERROR(("wl%d: wlc_attach: wlc_stf_attach failed\n", unit)); + WL_ERROR("wl%d: wlc_attach: wlc_stf_attach failed\n", unit); err = 68; goto fail; } @@ -1739,9 +1700,9 @@ static uint wlc_attach_module(wlc_info_t *wlc) return err; } -wlc_pub_t *wlc_pub(void *wlc) +struct wlc_pub *wlc_pub(void *wlc) { - return ((wlc_info_t *) wlc)->pub; + return ((struct wlc_info *) wlc)->pub; } #define CHIP_SUPPORTS_11N(wlc) 1 @@ -1750,25 +1711,25 @@ wlc_pub_t *wlc_pub(void *wlc) * The common driver entry routine. Error codes should be unique */ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, - osl_t *osh, void *regsva, uint bustype, void *btparam, - uint *perr) + struct osl_info *osh, void *regsva, uint bustype, + void *btparam, uint *perr) { - wlc_info_t *wlc; + struct wlc_info *wlc; uint err = 0; uint j; - wlc_pub_t *pub; + struct wlc_pub *pub; wlc_txq_info_t *qi; uint n_disabled; - WL_NONE(("wl%d: %s: vendor 0x%x device 0x%x\n", unit, __func__, vendor, - device)); + WL_NONE("wl%d: %s: vendor 0x%x device 0x%x\n", + unit, __func__, vendor, device); ASSERT(WSEC_MAX_RCMTA_KEYS <= WSEC_MAX_KEYS); ASSERT(WSEC_MAX_DEFAULT_KEYS == WLC_DEFAULT_KEYS); /* some code depends on packed structures */ - ASSERT(sizeof(struct ether_addr) == ETHER_ADDR_LEN); - ASSERT(sizeof(struct ether_header) == ETHER_HDR_LEN); + ASSERT(sizeof(struct ether_addr) == ETH_ALEN); + ASSERT(sizeof(struct ether_header) == ETH_HLEN); ASSERT(sizeof(d11regs_t) == SI_CORE_SIZE); ASSERT(sizeof(ofdm_phy_hdr_t) == D11_PHY_HDR_LEN); ASSERT(sizeof(cck_phy_hdr_t) == D11_PHY_HDR_LEN); @@ -1780,8 +1741,10 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, ASSERT(sizeof(struct dot11_bcn_prb) == DOT11_BCN_PRB_LEN); ASSERT(sizeof(tx_status_t) == TXSTATUS_LEN); ASSERT(sizeof(ht_cap_ie_t) == HT_CAP_IE_LEN); +#ifdef BRCM_FULLMAC ASSERT(offsetof(wl_scan_params_t, channel_list) == WL_SCAN_PARAMS_FIXED_SIZE); +#endif ASSERT(IS_ALIGNED(offsetof(wsec_key_t, data), sizeof(u32))); ASSERT(ISPOWEROF2(MA_WINDOW_SZ)); @@ -1797,8 +1760,8 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, || (WPA_CAP_4_REPLAY_CNTRS == WLC_REPLAY_CNTRS_VALUE && 4 == WLC_NUMRXIVS)); - /* allocate wlc_info_t state and its substructures */ - wlc = (wlc_info_t *) wlc_attach_malloc(osh, unit, &err, device); + /* allocate struct wlc_info state and its substructures */ + wlc = (struct wlc_info *) wlc_attach_malloc(osh, unit, &err, device); if (wlc == NULL) goto fail; wlc->osh = osh; @@ -1819,7 +1782,7 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, /* By default restrict TKIP associations from 11n STA's */ wlc->ht_wsec_restriction = WLC_HT_TKIP_RESTRICT; - /* populate wlc_info_t with default values */ + /* populate struct wlc_info with default values */ wlc_info_init(wlc, unit); /* update sta/ap related parameters */ @@ -1851,10 +1814,6 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, /* propagate *vars* from BMAC driver to high driver */ wlc_bmac_copyfrom_vars(wlc->hw, &pub->vars, &wlc->vars_size); -#ifdef WLC_HIGH_ONLY - WL_TRACE(("nvram : vars %p , vars_size %d\n", pub->vars, - wlc->vars_size)); -#endif /* set maximum allowed duty cycle */ wlc->tx_duty_cycle_ofdm = @@ -1872,19 +1831,17 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, wlc_phy_stf_chain_init(wlc->band->pi, wlc->stf->hw_txchain, wlc->stf->hw_rxchain); -#ifdef WLC_LOW /* pull up some info resulting from the low attach */ { int i; for (i = 0; i < NFIFO; i++) wlc->core->txavail[i] = wlc->hw->txavail[i]; } -#endif /* WLC_LOW */ wlc_bmac_hw_etheraddr(wlc->hw, &wlc->perm_etheraddr); bcopy((char *)&wlc->perm_etheraddr, (char *)&pub->cur_etheraddr, - ETHER_ADDR_LEN); + ETH_ALEN); for (j = 0; j < NBANDS(wlc); j++) { /* Use band 1 for single band 11a */ @@ -1942,7 +1899,7 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, goto fail; if (!wlc_timers_init(wlc, unit)) { - WL_ERROR(("wl%d: %s: wlc_init_timer failed\n", unit, __func__)); + WL_ERROR("wl%d: %s: wlc_init_timer failed\n", unit, __func__); err = 32; goto fail; } @@ -1950,8 +1907,8 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, /* depend on rateset, gmode */ wlc->cmi = wlc_channel_mgr_attach(wlc); if (!wlc->cmi) { - WL_ERROR(("wl%d: %s: wlc_channel_mgr_attach failed\n", unit, - __func__)); + WL_ERROR("wl%d: %s: wlc_channel_mgr_attach failed\n", + unit, __func__); err = 33; goto fail; } @@ -1966,8 +1923,8 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, /* allocate our initial queue */ qi = wlc_txq_alloc(wlc, osh); if (qi == NULL) { - WL_ERROR(("wl%d: %s: failed to malloc tx queue\n", unit, - __func__)); + WL_ERROR("wl%d: %s: failed to malloc tx queue\n", + unit, __func__); err = 100; goto fail; } @@ -2037,7 +1994,7 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, wlc_radio_mpc_upd(wlc); if (WLANTSEL_ENAB(wlc)) { - if ((CHIPID(wlc->pub->sih->chip)) == BCM43235_CHIP_ID) { + if ((wlc->pub->sih->chip) == BCM43235_CHIP_ID) { if ((getintvar(wlc->pub->vars, "aa2g") == 7) || (getintvar(wlc->pub->vars, "aa5g") == 7)) { wlc_bmac_antsel_set(wlc->hw, 1); @@ -2053,7 +2010,7 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, return (void *)wlc; fail: - WL_ERROR(("wl%d: %s: failed with err %d\n", unit, __func__, err)); + WL_ERROR("wl%d: %s: failed with err %d\n", unit, __func__, err); if (wlc) wlc_detach(wlc); @@ -2062,7 +2019,7 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode, return NULL; } -static void wlc_attach_antgain_init(wlc_info_t *wlc) +static void wlc_attach_antgain_init(struct wlc_info *wlc) { uint unit; unit = wlc->pub->unit; @@ -2071,7 +2028,8 @@ static void wlc_attach_antgain_init(wlc_info_t *wlc) /* default antenna gain for srom rev 1 is 2 dBm (8 qdbm) */ wlc->band->antgain = 8; } else if (wlc->band->antgain == -1) { - WL_ERROR(("wl%d: %s: Invalid antennas available in srom, using 2dB\n", unit, __func__)); + WL_ERROR("wl%d: %s: Invalid antennas available in srom, using 2dB\n", + unit, __func__); wlc->band->antgain = 8; } else { s8 gain, fract; @@ -2093,7 +2051,7 @@ static void wlc_attach_antgain_init(wlc_info_t *wlc) } } -static bool wlc_attach_stf_ant_init(wlc_info_t *wlc) +static bool wlc_attach_stf_ant_init(struct wlc_info *wlc) { int aa; uint unit; @@ -2110,7 +2068,8 @@ static bool wlc_attach_stf_ant_init(wlc_info_t *wlc) aa = (s8) getintvar(vars, (BAND_5G(bandtype) ? "aa1" : "aa0")); if ((aa < 1) || (aa > 15)) { - WL_ERROR(("wl%d: %s: Invalid antennas available in srom (0x%x), using 3.\n", unit, __func__, aa)); + WL_ERROR("wl%d: %s: Invalid antennas available in srom (0x%x), using 3\n", + unit, __func__, aa); aa = 3; } @@ -2132,136 +2091,8 @@ static bool wlc_attach_stf_ant_init(wlc_info_t *wlc) return true; } -#ifdef WLC_HIGH_ONLY -/* HIGH_ONLY bmac_attach, which sync over LOW_ONLY bmac_attach states */ -int wlc_bmac_attach(wlc_info_t *wlc, u16 vendor, u16 device, uint unit, - bool piomode, osl_t *osh, void *regsva, uint bustype, - void *btparam) -{ - wlc_bmac_revinfo_t revinfo; - uint idx = 0; - rpc_info_t *rpc = (rpc_info_t *) btparam; - ASSERT(bustype == RPC_BUS); - - /* install the rpc handle in the various state structures used by stub RPC functions */ - wlc->rpc = rpc; - wlc->hw->rpc = rpc; - wlc->hw->osh = osh; - - wlc->regs = 0; - - wlc->rpctx = wlc_rpctx_attach(wlc->pub, wlc); - if (wlc->rpctx == NULL) - return -1; - - /* - * FIFO 0 - * TX: TX_AC_BK_FIFO (TX AC Background data packets) - */ - /* Always initialized */ - ASSERT(NRPCTXBUFPOST <= NTXD); - wlc_rpctx_fifoinit(wlc->rpctx, TX_DATA_FIFO, NRPCTXBUFPOST); - wlc_rpctx_fifoinit(wlc->rpctx, TX_CTL_FIFO, NRPCTXBUFPOST); - wlc_rpctx_fifoinit(wlc->rpctx, TX_BCMC_FIFO, NRPCTXBUFPOST); - - /* VI and BK inited only if WME */ - if (WME_ENAB(wlc->pub)) { - wlc_rpctx_fifoinit(wlc->rpctx, TX_AC_BK_FIFO, NRPCTXBUFPOST); - wlc_rpctx_fifoinit(wlc->rpctx, TX_AC_VI_FIFO, NRPCTXBUFPOST); - } - - /* Allocate SB handle */ - wlc->pub->sih = osl_malloc(wlc->osh, sizeof(si_t)); - if (!wlc->pub->sih) - return -1; - bzero(wlc->pub->sih, sizeof(si_t)); - - /* sync up revinfo with BMAC */ - bzero(&revinfo, sizeof(wlc_bmac_revinfo_t)); - if (wlc_bmac_revinfo_get(wlc->hw, &revinfo) != 0) - return -1; - wlc->vendorid = (u16) revinfo.vendorid; - wlc->deviceid = (u16) revinfo.deviceid; - - wlc->pub->boardrev = (u16) revinfo.boardrev; - wlc->pub->corerev = revinfo.corerev; - wlc->pub->sromrev = (u8) revinfo.sromrev; - wlc->pub->sih->chiprev = revinfo.chiprev; - wlc->pub->sih->chip = revinfo.chip; - wlc->pub->sih->chippkg = revinfo.chippkg; - wlc->pub->sih->boardtype = revinfo.boardtype; - wlc->pub->sih->boardvendor = revinfo.boardvendor; - wlc->pub->sih->bustype = revinfo.bustype; - wlc->pub->sih->buscoretype = revinfo.buscoretype; - wlc->pub->sih->buscorerev = revinfo.buscorerev; - wlc->pub->sih->issim = (bool) revinfo.issim; - wlc->pub->sih->rpc = rpc; - - if (revinfo.nbands == 0 || revinfo.nbands > 2) - return -1; - wlc->pub->_nbands = revinfo.nbands; - - for (idx = 0; idx < wlc->pub->_nbands; idx++) { - uint bandunit, bandtype; /* To access bandstate */ - wlc_phy_t *pi = osl_malloc(wlc->osh, sizeof(wlc_phy_t)); - - if (!pi) - return -1; - bzero(pi, sizeof(wlc_phy_t)); - pi->rpc = rpc; - - bandunit = revinfo.band[idx].bandunit; - bandtype = revinfo.band[idx].bandtype; - wlc->bandstate[bandunit]->radiorev = - (u8) revinfo.band[idx].radiorev; - wlc->bandstate[bandunit]->phytype = - (u16) revinfo.band[idx].phytype; - wlc->bandstate[bandunit]->phyrev = - (u16) revinfo.band[idx].phyrev; - wlc->bandstate[bandunit]->radioid = - (u16) revinfo.band[idx].radioid; - wlc->bandstate[bandunit]->abgphy_encore = - revinfo.band[idx].abgphy_encore; - - wlc->bandstate[bandunit]->pi = pi; - wlc->bandstate[bandunit]->bandunit = bandunit; - wlc->bandstate[bandunit]->bandtype = bandtype; - } - - /* misc stuff */ - - return 0; -} - -/* Free the convenience handles */ -int wlc_bmac_detach(wlc_info_t *wlc) -{ - uint idx; - - if (wlc->pub->sih) { - osl_mfree(wlc->osh, (void *)wlc->pub->sih, sizeof(si_t)); - wlc->pub->sih = NULL; - } - - for (idx = 0; idx < MAXBANDS; idx++) - if (wlc->bandstate[idx]->pi) { - kfree(wlc->bandstate[idx]->pi); - wlc->bandstate[idx]->pi = NULL; - } - - if (wlc->rpctx) { - wlc_rpctx_detach(wlc->rpctx); - wlc->rpctx = NULL; - } - - return 0; - -} - -#endif /* WLC_HIGH_ONLY */ - -static void wlc_timers_deinit(wlc_info_t *wlc) +static void wlc_timers_deinit(struct wlc_info *wlc) { /* free timer state */ if (wlc->wdtimer) { @@ -2274,7 +2105,7 @@ static void wlc_timers_deinit(wlc_info_t *wlc) } } -static void wlc_detach_module(wlc_info_t *wlc) +static void wlc_detach_module(struct wlc_info *wlc) { if (wlc->asi) { wlc_antsel_detach(wlc->asi); @@ -2297,7 +2128,7 @@ static void wlc_detach_module(wlc_info_t *wlc) * One exception is sb register access, which is possible if crystal is turned on * After "down" state, driver should avoid software timer with the exception of radio_monitor. */ -uint wlc_detach(wlc_info_t *wlc) +uint wlc_detach(struct wlc_info *wlc) { uint i; uint callbacks = 0; @@ -2305,7 +2136,7 @@ uint wlc_detach(wlc_info_t *wlc) if (wlc == NULL) return 0; - WL_TRACE(("wl%d: %s\n", wlc->pub->unit, __func__)); + WL_TRACE("wl%d: %s\n", wlc->pub->unit, __func__); ASSERT(!wlc->pub->up); @@ -2328,15 +2159,6 @@ uint wlc_detach(wlc_info_t *wlc) /* free other state */ -#ifdef WLC_HIGH_ONLY - /* High-Only driver has an allocated copy of vars, monolithic just - * references the wlc->hw->vars which is freed in wlc_bmac_detach() - */ - if (wlc->pub->vars) { - kfree(wlc->pub->vars); - wlc->pub->vars = NULL; - } -#endif #ifdef BCMDBG if (wlc->country_ie_override) { @@ -2360,13 +2182,6 @@ uint wlc_detach(wlc_info_t *wlc) /* Detach from iovar manager */ wlc_module_unregister(wlc->pub, "wlc_iovars", wlc); - /* - if (wlc->ap) { - wlc_ap_detach(wlc->ap); - wlc->ap = NULL; - } - */ - while (wlc->tx_queues != NULL) { wlc_txq_free(wlc, wlc->osh, wlc->tx_queues); } @@ -2383,7 +2198,7 @@ uint wlc_detach(wlc_info_t *wlc) } /* update state that depends on the current value of "ap" */ -void wlc_ap_upd(wlc_info_t *wlc) +void wlc_ap_upd(struct wlc_info *wlc) { if (AP_ENAB(wlc->pub)) wlc->PLCPHdr_override = WLC_PLCP_AUTO; /* AP: short not allowed, but not enforced */ @@ -2398,7 +2213,7 @@ void wlc_ap_upd(wlc_info_t *wlc) } /* read hwdisable state and propagate to wlc flag */ -static void wlc_radio_hwdisable_upd(wlc_info_t *wlc) +static void wlc_radio_hwdisable_upd(struct wlc_info *wlc) { if (wlc->pub->wlfeatureflag & WL_SWFL_NOHWRADIO || wlc->pub->hw_off) return; @@ -2411,17 +2226,17 @@ static void wlc_radio_hwdisable_upd(wlc_info_t *wlc) } /* return true if Minimum Power Consumption should be entered, false otherwise */ -bool wlc_is_non_delay_mpc(wlc_info_t *wlc) +bool wlc_is_non_delay_mpc(struct wlc_info *wlc) { return false; } -bool wlc_ismpc(wlc_info_t *wlc) +bool wlc_ismpc(struct wlc_info *wlc) { return (wlc->mpc_delay_off == 0) && (wlc_is_non_delay_mpc(wlc)); } -void wlc_radio_mpc_upd(wlc_info_t *wlc) +void wlc_radio_mpc_upd(struct wlc_info *wlc) { bool mpc_radio, radio_state; @@ -2477,7 +2292,7 @@ void wlc_radio_mpc_upd(wlc_info_t *wlc) * centralized radio disable/enable function, * invoke radio enable/disable after updating hwradio status */ -static void wlc_radio_upd(wlc_info_t *wlc) +static void wlc_radio_upd(struct wlc_info *wlc) { if (wlc->pub->radio_disabled) wlc_radio_disable(wlc); @@ -2486,7 +2301,7 @@ static void wlc_radio_upd(wlc_info_t *wlc) } /* maintain LED behavior in down state */ -static void wlc_down_led_upd(wlc_info_t *wlc) +static void wlc_down_led_upd(struct wlc_info *wlc) { ASSERT(!wlc->pub->up); @@ -2499,7 +2314,7 @@ static void wlc_down_led_upd(wlc_info_t *wlc) } } -void wlc_radio_disable(wlc_info_t *wlc) +void wlc_radio_disable(struct wlc_info *wlc) { if (!wlc->pub->up) { wlc_down_led_upd(wlc); @@ -2510,7 +2325,7 @@ void wlc_radio_disable(wlc_info_t *wlc) wl_down(wlc->wl); } -static void wlc_radio_enable(wlc_info_t *wlc) +static void wlc_radio_enable(struct wlc_info *wlc) { if (wlc->pub->up) return; @@ -2526,10 +2341,10 @@ static void wlc_radio_enable(wlc_info_t *wlc) /* periodical query hw radio button while driver is "down" */ static void wlc_radio_timer(void *arg) { - wlc_info_t *wlc = (wlc_info_t *) arg; + struct wlc_info *wlc = (struct wlc_info *) arg; if (DEVICEREMOVED(wlc)) { - WL_ERROR(("wl%d: %s: dead chip\n", wlc->pub->unit, __func__)); + WL_ERROR("wl%d: %s: dead chip\n", wlc->pub->unit, __func__); wl_down(wlc->wl); return; } @@ -2544,7 +2359,7 @@ static void wlc_radio_timer(void *arg) wlc_radio_upd(wlc); } -static bool wlc_radio_monitor_start(wlc_info_t *wlc) +static bool wlc_radio_monitor_start(struct wlc_info *wlc) { /* Don't start the timer if HWRADIO feature is disabled */ if (wlc->radio_monitor || (wlc->pub->wlfeatureflag & WL_SWFL_NOHWRADIO)) @@ -2556,7 +2371,7 @@ static bool wlc_radio_monitor_start(wlc_info_t *wlc) return true; } -bool wlc_radio_monitor_stop(wlc_info_t *wlc) +bool wlc_radio_monitor_stop(struct wlc_info *wlc) { if (!wlc->radio_monitor) return true; @@ -2570,7 +2385,7 @@ bool wlc_radio_monitor_stop(wlc_info_t *wlc) } /* bring the driver down, but don't reset hardware */ -void wlc_out(wlc_info_t *wlc) +void wlc_out(struct wlc_info *wlc) { wlc_bmac_set_noreset(wlc->hw, true); wlc_radio_upd(wlc); @@ -2591,7 +2406,7 @@ void wlc_out(wlc_info_t *wlc) * if there is no packet pending for the FIFO, then the corresponding prec bits should be set * in prec_map. Of course, ignore this rule when block_datafifo is set */ -static bool wlc_tx_prec_map_verify(wlc_info_t *wlc) +static bool wlc_tx_prec_map_verify(struct wlc_info *wlc) { /* For non-WME, both fifos have overlapping prec_map. So it's an error only if both * fail the check. @@ -2613,7 +2428,7 @@ static bool wlc_tx_prec_map_verify(wlc_info_t *wlc) static void wlc_watchdog_by_timer(void *arg) { - wlc_info_t *wlc = (wlc_info_t *) arg; + struct wlc_info *wlc = (struct wlc_info *) arg; wlc_watchdog(arg); if (WLC_WATCHDOG_TBTT(wlc)) { /* set to normal osl watchdog period */ @@ -2626,17 +2441,17 @@ static void wlc_watchdog_by_timer(void *arg) /* common watchdog code */ static void wlc_watchdog(void *arg) { - wlc_info_t *wlc = (wlc_info_t *) arg; + struct wlc_info *wlc = (struct wlc_info *) arg; int i; wlc_bsscfg_t *cfg; - WL_TRACE(("wl%d: wlc_watchdog\n", wlc->pub->unit)); + WL_TRACE("wl%d: wlc_watchdog\n", wlc->pub->unit); if (!wlc->pub->up) return; if (DEVICEREMOVED(wlc)) { - WL_ERROR(("wl%d: %s: dead chip\n", wlc->pub->unit, __func__)); + WL_ERROR("wl%d: %s: dead chip\n", wlc->pub->unit, __func__); wl_down(wlc->wl); return; } @@ -2667,13 +2482,7 @@ static void wlc_watchdog(void *arg) if (wlc->pub->radio_disabled) return; -#ifdef WLC_LOW wlc_bmac_watchdog(wlc); -#endif -#ifdef WLC_HIGH_ONLY - /* maintenance */ - wlc_bmac_rpc_watchdog(wlc); -#endif /* occasionally sample mac stat counters to detect 16-bit counter wrap */ if ((WLC_UPDATE_STATS(wlc)) @@ -2702,10 +2511,8 @@ static void wlc_watchdog(void *arg) wlc->tempsense_lasttime = wlc->pub->now; wlc_tempsense_upd(wlc); } -#ifdef WLC_LOW /* BMAC_NOTE: for HIGH_ONLY driver, this seems being called after RPC bus failed */ ASSERT(wlc_bmac_taclear(wlc->hw, true)); -#endif /* Verify that tx_prec_map and fifos are in sync to avoid lock ups */ ASSERT(wlc_tx_prec_map_verify(wlc)); @@ -2714,9 +2521,9 @@ static void wlc_watchdog(void *arg) } /* make interface operational */ -int wlc_up(wlc_info_t *wlc) +int wlc_up(struct wlc_info *wlc) { - WL_TRACE(("wl%d: %s:\n", wlc->pub->unit, __func__)); + WL_TRACE("wl%d: %s:\n", wlc->pub->unit, __func__); /* HW is turned off so don't try to access it */ if (wlc->pub->hw_off || DEVICEREMOVED(wlc)) @@ -2728,7 +2535,7 @@ int wlc_up(wlc_info_t *wlc) } if ((wlc->pub->boardflags & BFL_FEM) - && (CHIPID(wlc->pub->sih->chip) == BCM4313_CHIP_ID)) { + && (wlc->pub->sih->chip == BCM4313_CHIP_ID)) { if (wlc->pub->boardrev >= 0x1250 && (wlc->pub->boardflags & BFL_FEM_BT)) { wlc_mhf(wlc, MHF5, MHF5_4313_GPIOCTRL, @@ -2761,7 +2568,8 @@ int wlc_up(wlc_info_t *wlc) if (!BSSCFG_STA(bsscfg) || !bsscfg->enable || !bsscfg->BSS) continue; - WL_ERROR(("wl%d.%d: wlc_up: rfdisable -> " "wlc_bsscfg_disable()\n", wlc->pub->unit, idx)); + WL_ERROR("wl%d.%d: wlc_up: rfdisable -> " "wlc_bsscfg_disable()\n", + wlc->pub->unit, idx); } } } else @@ -2822,10 +2630,10 @@ int wlc_up(wlc_info_t *wlc) } /* Initialize the base precedence map for dequeueing from txq based on WME settings */ -static void wlc_tx_prec_map_init(wlc_info_t *wlc) +static void wlc_tx_prec_map_init(struct wlc_info *wlc) { wlc->tx_prec_map = WLC_PREC_BMP_ALL; - bzero(wlc->fifo2prec_map, sizeof(u16) * NFIFO); + memset(wlc->fifo2prec_map, 0, NFIFO * sizeof(u16)); /* For non-WME, both fifos have overlapping MAXPRIO. So just disable all precedences * if either is full. @@ -2841,7 +2649,7 @@ static void wlc_tx_prec_map_init(wlc_info_t *wlc) } } -static uint wlc_down_del_timer(wlc_info_t *wlc) +static uint wlc_down_del_timer(struct wlc_info *wlc) { uint callbacks = 0; @@ -2853,7 +2661,7 @@ static uint wlc_down_del_timer(wlc_info_t *wlc) * disable the hardware, free any transient buffer state. * Return a count of the number of driver callbacks still pending. */ -uint wlc_down(wlc_info_t *wlc) +uint wlc_down(struct wlc_info *wlc) { uint callbacks = 0; @@ -2861,12 +2669,12 @@ uint wlc_down(wlc_info_t *wlc) bool dev_gone = false; wlc_txq_info_t *qi; - WL_TRACE(("wl%d: %s:\n", wlc->pub->unit, __func__)); + WL_TRACE("wl%d: %s:\n", wlc->pub->unit, __func__); /* check if we are already in the going down path */ if (wlc->going_down) { - WL_ERROR(("wl%d: %s: Driver going down so return\n", - wlc->pub->unit, __func__)); + WL_ERROR("wl%d: %s: Driver going down so return\n", + wlc->pub->unit, __func__); return 0; } if (!wlc->pub->up) @@ -2922,14 +2730,11 @@ uint wlc_down(wlc_info_t *wlc) /* wlc_bmac_down_finish has done wlc_coredisable(). so clk is off */ wlc->clk = false; -#ifdef WLC_HIGH_ONLY - wlc_rpctx_txreclaim(wlc->rpctx); -#endif /* Verify all packets are flushed from the driver */ - if (PKTALLOCED(wlc->osh) != 0) { - WL_ERROR(("%d packets not freed at wlc_down!!!!!!\n", - PKTALLOCED(wlc->osh))); + if (wlc->osh->pktalloced != 0) { + WL_ERROR("%d packets not freed at wlc_down!!!!!!\n", + wlc->osh->pktalloced); } #ifdef BCMDBG /* Since all the packets should have been freed, @@ -2943,7 +2748,7 @@ uint wlc_down(wlc_info_t *wlc) } /* Set the current gmode configuration */ -int wlc_set_gmode(wlc_info_t *wlc, u8 gmode, bool config) +int wlc_set_gmode(struct wlc_info *wlc, u8 gmode, bool config) { int ret = 0; uint i; @@ -2958,7 +2763,7 @@ int wlc_set_gmode(wlc_info_t *wlc, u8 gmode, bool config) bool preamble_restrict = false; /* Restrict association to stations that support short * preambles */ - wlcband_t *band; + struct wlcband *band; /* if N-support is enabled, allow Gmode set as long as requested * Gmode is not GMODE_LEGACY_B @@ -2985,10 +2790,10 @@ int wlc_set_gmode(wlc_info_t *wlc, u8 gmode, bool config) wlc_protection_upd(wlc, WLC_PROT_G_USER, gmode); /* Clear supported rates filter */ - bzero(&wlc->sup_rates_override, sizeof(wlc_rateset_t)); + memset(&wlc->sup_rates_override, 0, sizeof(wlc_rateset_t)); /* Clear rateset override */ - bzero(&rs, sizeof(wlc_rateset_t)); + memset(&rs, 0, sizeof(wlc_rateset_t)); switch (gmode) { case GMODE_LEGACY_B: @@ -3026,8 +2831,8 @@ int wlc_set_gmode(wlc_info_t *wlc, u8 gmode, bool config) default: /* Error */ - WL_ERROR(("wl%d: %s: invalid gmode %d\n", wlc->pub->unit, - __func__, gmode)); + WL_ERROR("wl%d: %s: invalid gmode %d\n", + wlc->pub->unit, __func__, gmode); return BCME_UNSUPPORTED; } @@ -3093,7 +2898,7 @@ int wlc_set_gmode(wlc_info_t *wlc, u8 gmode, bool config) return ret; } -static int wlc_nmode_validate(wlc_info_t *wlc, s32 nmode) +static int wlc_nmode_validate(struct wlc_info *wlc, s32 nmode) { int err = 0; @@ -3117,7 +2922,7 @@ static int wlc_nmode_validate(wlc_info_t *wlc, s32 nmode) return err; } -int wlc_set_nmode(wlc_info_t *wlc, s32 nmode) +int wlc_set_nmode(struct wlc_info *wlc, s32 nmode) { uint i; int err; @@ -3176,7 +2981,7 @@ int wlc_set_nmode(wlc_info_t *wlc, s32 nmode) return err; } -static int wlc_set_rateset(wlc_info_t *wlc, wlc_rateset_t *rs_arg) +static int wlc_set_rateset(struct wlc_info *wlc, wlc_rateset_t *rs_arg) { wlc_rateset_t rs, new; uint bandunit; @@ -3219,18 +3024,18 @@ static int wlc_set_rateset(wlc_info_t *wlc, wlc_rateset_t *rs_arg) } /* simplified integer set interface for common ioctl handler */ -int wlc_set(wlc_info_t *wlc, int cmd, int arg) +int wlc_set(struct wlc_info *wlc, int cmd, int arg) { return wlc_ioctl(wlc, cmd, (void *)&arg, sizeof(arg), NULL); } /* simplified integer get interface for common ioctl handler */ -int wlc_get(wlc_info_t *wlc, int cmd, int *arg) +int wlc_get(struct wlc_info *wlc, int cmd, int *arg) { return wlc_ioctl(wlc, cmd, arg, sizeof(int), NULL); } -static void wlc_ofdm_rateset_war(wlc_info_t *wlc) +static void wlc_ofdm_rateset_war(struct wlc_info *wlc) { u8 r; bool war = false; @@ -3246,14 +3051,16 @@ static void wlc_ofdm_rateset_war(wlc_info_t *wlc) } int -wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) +wlc_ioctl(struct wlc_info *wlc, int cmd, void *arg, int len, + struct wlc_if *wlcif) { return _wlc_ioctl(wlc, cmd, arg, len, wlcif); } /* common ioctl handler. return: 0=ok, -1=error, positive=particular error */ static int -_wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) +_wlc_ioctl(struct wlc_info *wlc, int cmd, void *arg, int len, + struct wlc_if *wlcif) { int val, *pval; bool bool_val; @@ -3265,7 +3072,7 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) uint band; rw_reg_t *r; wlc_bsscfg_t *bsscfg; - osl_t *osh; + struct osl_info *osh; wlc_bss_info_t *current_bss; /* update bsscfg pointer */ @@ -3280,7 +3087,7 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) /* If the device is turned off, then it's not "removed" */ if (!wlc->pub->hw_off && DEVICEREMOVED(wlc)) { - WL_ERROR(("wl%d: %s: dead chip\n", wlc->pub->unit, __func__)); + WL_ERROR("wl%d: %s: dead chip\n", wlc->pub->unit, __func__); wl_down(wlc->wl); return BCME_ERROR; } @@ -3300,8 +3107,8 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) bool_val = val != 0; if (cmd != WLC_SET_CHANNEL) - WL_NONE(("WLC_IOCTL: cmd %d val 0x%x (%d) len %d\n", cmd, - (uint) val, val, len)); + WL_NONE("WLC_IOCTL: cmd %d val 0x%x (%d) len %d\n", + cmd, (uint)val, val, len); bcmerror = 0; regs = wlc->regs; @@ -3321,8 +3128,8 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) default: if ((arg == NULL) || (len <= 0)) { - WL_ERROR(("wl%d: %s: Command %d needs arguments\n", - wlc->pub->unit, __func__, cmd)); + WL_ERROR("wl%d: %s: Command %d needs arguments\n", + wlc->pub->unit, __func__, cmd); bcmerror = BCME_BADARG; goto done; } @@ -3388,10 +3195,6 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) wlc_set_chanspec(wlc, chspec); wlc_enable_mac(wlc); } -#ifdef WLC_HIGH_ONLY - /* delay for channel change */ - msleep(50); -#endif break; } @@ -3659,8 +3462,8 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) /* 4322 supports antdiv in phy, no need to set it to ucode */ if (WLCISNPHY(wlc->band) && D11REV_IS(wlc->pub->corerev, 16)) { - WL_ERROR(("wl%d: can't set ucantdiv for 4322\n", - wlc->pub->unit)); + WL_ERROR("wl%d: can't set ucantdiv for 4322\n", + wlc->pub->unit); bcmerror = BCME_UNSUPPORTED; } else wlc_mhf(wlc, MHF1, MHF1_ANTDIV, @@ -3757,8 +3560,8 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) if ((radiomask == 0) || (radiomask & ~validbits) || (radioval & ~validbits) || ((radioval & ~radiomask) != 0)) { - WL_ERROR(("SET_RADIO with wrong bits 0x%x\n", - val)); + WL_ERROR("SET_RADIO with wrong bits 0x%x\n", + val); bcmerror = BCME_RANGE; break; } @@ -3788,7 +3591,7 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) break; } - bzero((char *)&key, sizeof(key)); + memset((char *)&key, 0, sizeof(key)); if (src_key) { key.index = src_key->id; key.len = src_key->len; @@ -3800,7 +3603,7 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) key.flags |= WL_PRIMARY_KEY; bcopy(src_key->ea.octet, key.ea.octet, - ETHER_ADDR_LEN); + ETH_ALEN); } bcopy((char *)&key, arg, sizeof(key)); @@ -3835,8 +3638,8 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) u16 lo; u32 hi; /* group keys in WPA-NONE (IBSS only, AES and TKIP) use a global TXIV */ - if ((bsscfg->WPA_auth & WPA_AUTH_NONE) - && ETHER_ISNULLADDR(&key->ea)) { + if ((bsscfg->WPA_auth & WPA_AUTH_NONE) && + is_zero_ether_addr(key->ea.octet)) { lo = bsscfg->wpa_none_txiv.lo; hi = bsscfg->wpa_none_txiv.hi; } else { @@ -3885,7 +3688,7 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) wlc_rateset_t rs; wl_rateset_t *ret_rs = (wl_rateset_t *) arg; - bzero(&rs, sizeof(wlc_rateset_t)); + memset(&rs, 0, sizeof(wlc_rateset_t)); wlc_default_rateset(wlc, (wlc_rateset_t *) &rs); if (len < (int)(rs.count + sizeof(rs.count))) { @@ -3913,7 +3716,7 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) break; } - bzero(&rs, sizeof(wlc_rateset_t)); + memset(&rs, 0, sizeof(wlc_rateset_t)); /* Copy only legacy rateset section */ rs.count = in_rs->count; @@ -4247,7 +4050,7 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) /* check for an empty rateset to clear the override */ if (rs.count == 0) { - bzero(&wlc->sup_rates_override, + memset(&wlc->sup_rates_override, 0, sizeof(wlc_rateset_t)); break; } @@ -4394,7 +4197,7 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) #endif case WLC_LAST: - WL_ERROR(("%s: WLC_LAST\n", __func__)); + WL_ERROR("%s: WLC_LAST\n", __func__); } done: @@ -4406,21 +4209,19 @@ _wlc_ioctl(wlc_info_t *wlc, int cmd, void *arg, int len, struct wlc_if *wlcif) } } -#ifdef WLC_LOW /* BMAC_NOTE: for HIGH_ONLY driver, this seems being called after RPC bus failed */ /* In hw_off condition, IOCTLs that reach here are deemed safe but taclear would * certainly result in getting -1 for register reads. So skip ta_clear altogether */ if (!(wlc->pub->hw_off)) ASSERT(wlc_bmac_taclear(wlc->hw, ta_ok) || !ta_ok); -#endif return bcmerror; } #if defined(BCMDBG) /* consolidated register access ioctl error checking */ -int wlc_iocregchk(wlc_info_t *wlc, uint band) +int wlc_iocregchk(struct wlc_info *wlc, uint band) { /* if band is specified, it must be the current band */ if ((band != WLC_BAND_AUTO) && (band != (uint) wlc->band->bandtype)) @@ -4440,7 +4241,7 @@ int wlc_iocregchk(wlc_info_t *wlc, uint band) #if defined(BCMDBG) /* For some ioctls, make sure that the pi pointer matches the current phy */ -int wlc_iocpichk(wlc_info_t *wlc, uint phytype) +int wlc_iocpichk(struct wlc_info *wlc, uint phytype) { if (wlc->band->phytype != phytype) return BCME_BADBAND; @@ -4474,21 +4275,21 @@ static const bcm_iovar_t *wlc_iovar_lookup(const bcm_iovar_t *table, } /* simplified integer get interface for common WLC_GET_VAR ioctl handler */ -int wlc_iovar_getint(wlc_info_t *wlc, const char *name, int *arg) +int wlc_iovar_getint(struct wlc_info *wlc, const char *name, int *arg) { return wlc_iovar_op(wlc, name, NULL, 0, arg, sizeof(s32), IOV_GET, NULL); } /* simplified integer set interface for common WLC_SET_VAR ioctl handler */ -int wlc_iovar_setint(wlc_info_t *wlc, const char *name, int arg) +int wlc_iovar_setint(struct wlc_info *wlc, const char *name, int arg) { return wlc_iovar_op(wlc, name, NULL, 0, (void *)&arg, sizeof(arg), IOV_SET, NULL); } /* simplified s8 get interface for common WLC_GET_VAR ioctl handler */ -int wlc_iovar_gets8(wlc_info_t *wlc, const char *name, s8 *arg) +int wlc_iovar_gets8(struct wlc_info *wlc, const char *name, s8 *arg) { int iovar_int; int err; @@ -4507,11 +4308,11 @@ int wlc_iovar_gets8(wlc_info_t *wlc, const char *name, s8 *arg) * calling function must keep 'iovars' until wlc_module_unregister is called. * 'iovar' must have the last entry's name field being NULL as terminator. */ -int wlc_module_register(wlc_pub_t *pub, const bcm_iovar_t *iovars, +int wlc_module_register(struct wlc_pub *pub, const bcm_iovar_t *iovars, const char *name, void *hdl, iovar_fn_t i_fn, watchdog_fn_t w_fn, down_fn_t d_fn) { - wlc_info_t *wlc = (wlc_info_t *) pub->wlc; + struct wlc_info *wlc = (struct wlc_info *) pub->wlc; int i; ASSERT(name != NULL); @@ -4537,9 +4338,9 @@ int wlc_module_register(wlc_pub_t *pub, const bcm_iovar_t *iovars, } /* unregister module callbacks */ -int wlc_module_unregister(wlc_pub_t *pub, const char *name, void *hdl) +int wlc_module_unregister(struct wlc_pub *pub, const char *name, void *hdl) { - wlc_info_t *wlc = (wlc_info_t *) pub->wlc; + struct wlc_info *wlc = (struct wlc_info *) pub->wlc; int i; if (wlc == NULL) @@ -4550,7 +4351,7 @@ int wlc_module_unregister(wlc_pub_t *pub, const char *name, void *hdl) for (i = 0; i < WLC_MAXMODULES; i++) { if (!strcmp(wlc->modulecb[i].name, name) && (wlc->modulecb[i].hdl == hdl)) { - bzero(&wlc->modulecb[i], sizeof(modulecb_t)); + memset(&wlc->modulecb[i], 0, sizeof(modulecb_t)); return 0; } } @@ -4560,7 +4361,7 @@ int wlc_module_unregister(wlc_pub_t *pub, const char *name, void *hdl) } /* Write WME tunable parameters for retransmit/max rate from wlc struct to ucode */ -static void wlc_wme_retries_write(wlc_info_t *wlc) +static void wlc_wme_retries_write(struct wlc_info *wlc) { int ac; @@ -4582,7 +4383,7 @@ static void wlc_wme_retries_write(wlc_info_t *wlc) * All pointers may point into the same buffer. */ int -wlc_iovar_op(wlc_info_t *wlc, const char *name, +wlc_iovar_op(struct wlc_info *wlc, const char *name, void *params, int p_len, void *arg, int len, bool set, struct wlc_if *wlcif) { @@ -4606,8 +4407,8 @@ wlc_iovar_op(wlc_info_t *wlc, const char *name, if (!set && (len == sizeof(int)) && !(IS_ALIGNED((unsigned long)(arg), (uint) sizeof(int)))) { - WL_ERROR(("wl%d: %s unaligned get ptr for %s\n", - wlc->pub->unit, __func__, name)); + WL_ERROR("wl%d: %s unaligned get ptr for %s\n", + wlc->pub->unit, __func__, name); ASSERT(0); } @@ -4622,11 +4423,6 @@ wlc_iovar_op(wlc_info_t *wlc, const char *name, /* iovar name not found */ if (i >= WLC_MAXMODULES) { err = BCME_UNSUPPORTED; -#ifdef WLC_HIGH_ONLY - err = - bcmsdh_iovar_op(wlc->btparam, name, params, p_len, arg, len, - set); -#endif goto exit; } @@ -4658,10 +4454,10 @@ wlc_iovar_op(wlc_info_t *wlc, const char *name, } int -wlc_iovar_check(wlc_pub_t *pub, const bcm_iovar_t *vi, void *arg, int len, +wlc_iovar_check(struct wlc_pub *pub, const bcm_iovar_t *vi, void *arg, int len, bool set) { - wlc_info_t *wlc = (wlc_info_t *) pub->wlc; + struct wlc_info *wlc = (struct wlc_info *) pub->wlc; int err = 0; s32 int_val = 0; @@ -4729,7 +4525,7 @@ wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid, const char *name, void *params, uint p_len, void *arg, int len, int val_size, struct wlc_if *wlcif) { - wlc_info_t *wlc = hdl; + struct wlc_info *wlc = hdl; wlc_bsscfg_t *bsscfg; int err = 0; s32 int_val = 0; @@ -4739,7 +4535,7 @@ wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid, bool bool_val2; wlc_bss_info_t *current_bss; - WL_TRACE(("wl%d: %s\n", wlc->pub->unit, __func__)); + WL_TRACE("wl%d: %s\n", wlc->pub->unit, __func__); bsscfg = NULL; current_bss = NULL; @@ -4762,8 +4558,8 @@ wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid, bool_val = (int_val != 0) ? true : false; bool_val2 = (int_val2 != 0) ? true : false; - WL_TRACE(("wl%d: %s: id %d\n", wlc->pub->unit, __func__, - IOV_ID(actionid))); + WL_TRACE("wl%d: %s: id %d\n", + wlc->pub->unit, __func__, IOV_ID(actionid)); /* Do the actual parameter implementation */ switch (actionid) { @@ -4821,7 +4617,7 @@ wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid, break; default: - WL_ERROR(("wl%d: %s: unsupported\n", wlc->pub->unit, __func__)); + WL_ERROR("wl%d: %s: unsupported\n", wlc->pub->unit, __func__); err = BCME_UNSUPPORTED; break; } @@ -4833,7 +4629,7 @@ wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid, } static int -wlc_iovar_rangecheck(wlc_info_t *wlc, u32 val, const bcm_iovar_t *vi) +wlc_iovar_rangecheck(struct wlc_info *wlc, u32 val, const bcm_iovar_t *vi) { int err = 0; u32 min_val = 0; @@ -4930,7 +4726,7 @@ void wlc_print_txstatus(tx_status_t *txs) #define MACSTATUPD(name) \ wlc_ctrupd_cache(macstats.name, &wlc->core->macstat_snapshot->name, &wlc->pub->_cnt->name) -void wlc_statsupd(wlc_info_t *wlc) +void wlc_statsupd(struct wlc_info *wlc) { int i; #ifdef BCMDBG @@ -4956,8 +4752,8 @@ void wlc_statsupd(wlc_info_t *wlc) /* check for rx fifo 0 overflow */ delta = (u16) (wlc->core->macstat_snapshot->rxf0ovfl - rxf0ovfl); if (delta) - WL_ERROR(("wl%d: %u rx fifo 0 overflows!\n", wlc->pub->unit, - delta)); + WL_ERROR("wl%d: %u rx fifo 0 overflows!\n", + wlc->pub->unit, delta); /* check for tx fifo underflows */ for (i = 0; i < NFIFO; i++) { @@ -4965,8 +4761,8 @@ void wlc_statsupd(wlc_info_t *wlc) (u16) (wlc->core->macstat_snapshot->txfunfl[i] - txfunfl[i]); if (delta) - WL_ERROR(("wl%d: %u tx fifo %d underflows!\n", - wlc->pub->unit, delta, i)); + WL_ERROR("wl%d: %u tx fifo %d underflows!\n", + wlc->pub->unit, delta, i); } #endif /* BCMDBG */ @@ -5015,7 +4811,7 @@ void wlc_statsupd(wlc_info_t *wlc) bool wlc_chipmatch(u16 vendor, u16 device) { if (vendor != VENDOR_BROADCOM) { - WL_ERROR(("wlc_chipmatch: unknown vendor id %04x\n", vendor)); + WL_ERROR("wlc_chipmatch: unknown vendor id %04x\n", vendor); return false; } @@ -5027,7 +4823,7 @@ bool wlc_chipmatch(u16 vendor, u16 device) if ((device == BCM43236_D11N_ID) || (device == BCM43236_D11N2G_ID)) return true; - WL_ERROR(("wlc_chipmatch: unknown device id %04x\n", device)); + WL_ERROR("wlc_chipmatch: unknown device id %04x\n", device); return false; } @@ -5182,20 +4978,12 @@ int wlc_format_ssid(char *buf, const unsigned char ssid[], uint ssid_len) } #endif /* defined(BCMDBG) */ -u16 wlc_rate_shm_offset(wlc_info_t *wlc, u8 rate) +u16 wlc_rate_shm_offset(struct wlc_info *wlc, u8 rate) { return wlc_bmac_rate_shm_offset(wlc->hw, rate); } /* Callback for device removed */ -#if defined(WLC_HIGH_ONLY) -void wlc_device_removed(void *arg) -{ - wlc_info_t *wlc = (wlc_info_t *) arg; - - wlc->device_present = false; -} -#endif /* WLC_HIGH_ONLY */ /* * Attempts to queue a packet onto a multiple-precedence queue, @@ -5207,16 +4995,16 @@ void wlc_device_removed(void *arg) * Returns true if packet consumed (queued), false if not. */ bool BCMFASTPATH -wlc_prec_enq(wlc_info_t *wlc, struct pktq *q, void *pkt, int prec) +wlc_prec_enq(struct wlc_info *wlc, struct pktq *q, void *pkt, int prec) { return wlc_prec_enq_head(wlc, q, pkt, prec, false); } bool BCMFASTPATH -wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, void *pkt, int prec, - bool head) +wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, struct sk_buff *pkt, + int prec, bool head) { - void *p; + struct sk_buff *p; int eprec = -1; /* precedence to evict from */ /* Determine precedence from which to evict packet, if any */ @@ -5226,8 +5014,8 @@ wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, void *pkt, int prec, p = pktq_peek_tail(q, &eprec); ASSERT(p != NULL); if (eprec > prec) { - WL_ERROR(("%s: Failing: eprec %d > prec %d\n", __func__, - eprec, prec)); + WL_ERROR("%s: Failing: eprec %d > prec %d\n", + __func__, eprec, prec); return false; } } @@ -5243,8 +5031,8 @@ wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, void *pkt, int prec, /* Refuse newer packet unless configured to discard oldest */ if (eprec == prec && !discard_oldest) { - WL_ERROR(("%s: No where to go, prec == %d\n", __func__, - prec)); + WL_ERROR("%s: No where to go, prec == %d\n", + __func__, prec); return false; } @@ -5256,14 +5044,14 @@ wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, void *pkt, int prec, /* Increment wme stats */ if (WME_ENAB(wlc->pub)) { WLCNTINCR(wlc->pub->_wme_cnt-> - tx_failed[WME_PRIO2AC(PKTPRIO(p))].packets); + tx_failed[WME_PRIO2AC(p->priority)].packets); WLCNTADD(wlc->pub->_wme_cnt-> - tx_failed[WME_PRIO2AC(PKTPRIO(p))].bytes, + tx_failed[WME_PRIO2AC(p->priority)].bytes, pkttotlen(wlc->osh, p)); } ASSERT(0); - PKTFREE(wlc->osh, p, true); + pkt_buf_free_skb(wlc->osh, p, true); WLCNTINCR(wlc->pub->_cnt->txnobuf); } @@ -5277,25 +5065,26 @@ wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, void *pkt, int prec, return true; } -void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, void *sdu, uint prec) +void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu, + uint prec) { - wlc_info_t *wlc = (wlc_info_t *) ctx; + struct wlc_info *wlc = (struct wlc_info *) ctx; wlc_txq_info_t *qi = wlc->active_queue; /* Check me */ struct pktq *q = &qi->q; int prio; - prio = PKTPRIO(sdu); + prio = sdu->priority; ASSERT(pktq_max(q) >= wlc->pub->tunables->datahiwat); if (!wlc_prec_enq(wlc, q, sdu, prec)) { if (!EDCF_ENAB(wlc->pub) || (wlc->pub->wlfeatureflag & WL_SWFL_FLOWCONTROL)) - WL_ERROR(("wl%d: wlc_txq_enq: txq overflow\n", - wlc->pub->unit)); + WL_ERROR("wl%d: wlc_txq_enq: txq overflow\n", + wlc->pub->unit); /* ASSERT(9 == 8); *//* XXX we might hit this condtion in case packet flooding from mac80211 stack */ - PKTFREE(wlc->osh, sdu, true); + pkt_buf_free_skb(wlc->osh, sdu, true); WLCNTINCR(wlc->pub->_cnt->txnobuf); } @@ -5317,13 +5106,14 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, void *sdu, uint prec) } bool BCMFASTPATH -wlc_sendpkt_mac80211(wlc_info_t *wlc, void *sdu, struct ieee80211_hw *hw) +wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu, + struct ieee80211_hw *hw) { u8 prio; uint fifo; void *pkt; struct scb *scb = &global_scb; - struct dot11_header *d11_header = (struct dot11_header *)PKTDATA(sdu); + struct dot11_header *d11_header = (struct dot11_header *)(sdu->data); u16 type, fc; ASSERT(sdu); @@ -5332,13 +5122,13 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, void *sdu, struct ieee80211_hw *hw) type = FC_TYPE(fc); /* 802.11 standard requires management traffic to go at highest priority */ - prio = (type == FC_TYPE_DATA ? PKTPRIO(sdu) : MAXPRIO); + prio = (type == FC_TYPE_DATA ? sdu->priority : MAXPRIO); fifo = prio2fifo[prio]; - ASSERT((uint) PKTHEADROOM(sdu) >= TXOFF); - ASSERT(!PKTSHARED(sdu)); - ASSERT(!PKTNEXT(sdu)); - ASSERT(!PKTLINK(sdu)); + ASSERT((uint) skb_headroom(sdu) >= TXOFF); + ASSERT(!(sdu->cloned)); + ASSERT(!(sdu->next)); + ASSERT(!(sdu->prev)); ASSERT(fifo < NFIFO); pkt = sdu; @@ -5352,9 +5142,9 @@ wlc_sendpkt_mac80211(wlc_info_t *wlc, void *sdu, struct ieee80211_hw *hw) return 0; } -void BCMFASTPATH wlc_send_q(wlc_info_t *wlc, wlc_txq_info_t *qi) +void BCMFASTPATH wlc_send_q(struct wlc_info *wlc, wlc_txq_info_t *qi) { - void *pkt[DOT11_MAXNUMFRAGS]; + struct sk_buff *pkt[DOT11_MAXNUMFRAGS]; int prec; u16 prec_map; int err = 0, i, count; @@ -5427,7 +5217,7 @@ void BCMFASTPATH wlc_send_q(wlc_info_t *wlc, wlc_txq_info_t *qi) * for MC frames so is used as part of the sequence number. */ static inline u16 -bcmc_fid_generate(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg, d11txh_t *txh) +bcmc_fid_generate(struct wlc_info *wlc, wlc_bsscfg_t *bsscfg, d11txh_t *txh) { u16 frameid; @@ -5441,13 +5231,14 @@ bcmc_fid_generate(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg, d11txh_t *txh) } void BCMFASTPATH -wlc_txfifo(wlc_info_t *wlc, uint fifo, void *p, bool commit, s8 txpktpend) +wlc_txfifo(struct wlc_info *wlc, uint fifo, struct sk_buff *p, bool commit, + s8 txpktpend) { u16 frameid = INVALIDFID; d11txh_t *txh; ASSERT(fifo < NFIFO); - txh = (d11txh_t *) PKTDATA(p); + txh = (d11txh_t *) (p->data); /* When a BC/MC frame is being committed to the BCMC fifo via DMA (NOT PIO), update * ucode or BSS info as appropriate. @@ -5460,21 +5251,14 @@ wlc_txfifo(wlc_info_t *wlc, uint fifo, void *p, bool commit, s8 txpktpend) if (WLC_WAR16165(wlc)) wlc_war16165(wlc, true); -#ifdef WLC_HIGH_ONLY - if (RPCTX_ENAB(wlc->pub)) { - (void)wlc_rpctx_tx(wlc->rpctx, fifo, p, commit, frameid, - txpktpend); - return; - } -#else /* Bump up pending count for if not using rpc. If rpc is used, this will be handled * in wlc_bmac_txfifo() */ if (commit) { TXPKTPENDINC(wlc, fifo, txpktpend); - WL_TRACE(("wlc_txfifo, pktpend inc %d to %d\n", txpktpend, - TXPKTPENDGET(wlc, fifo))); + WL_TRACE("wlc_txfifo, pktpend inc %d to %d\n", + txpktpend, TXPKTPENDGET(wlc, fifo)); } /* Commit BCMC sequence number in the SHM frame ID location */ @@ -5482,13 +5266,12 @@ wlc_txfifo(wlc_info_t *wlc, uint fifo, void *p, bool commit, s8 txpktpend) BCMCFID(wlc, frameid); if (dma_txfast(wlc->hw->di[fifo], p, commit) < 0) { - WL_ERROR(("wlc_txfifo: fatal, toss frames !!!\n")); + WL_ERROR("wlc_txfifo: fatal, toss frames !!!\n"); } -#endif /* WLC_HIGH_ONLY */ } static u16 -wlc_compute_airtime(wlc_info_t *wlc, ratespec_t rspec, uint length) +wlc_compute_airtime(struct wlc_info *wlc, ratespec_t rspec, uint length) { u16 usec = 0; uint mac_rate = RSPEC2RATE(rspec); @@ -5523,7 +5306,8 @@ wlc_compute_airtime(wlc_info_t *wlc, ratespec_t rspec, uint length) usec = (length << 3) / 11; break; default: - WL_ERROR(("wl%d: wlc_compute_airtime: unsupported rspec 0x%x\n", wlc->pub->unit, rspec)); + WL_ERROR("wl%d: wlc_compute_airtime: unsupported rspec 0x%x\n", + wlc->pub->unit, rspec); ASSERT((const char *)"Bad phy_rate" == NULL); break; } @@ -5533,7 +5317,7 @@ wlc_compute_airtime(wlc_info_t *wlc, ratespec_t rspec, uint length) } void BCMFASTPATH -wlc_compute_plcp(wlc_info_t *wlc, ratespec_t rspec, uint length, u8 *plcp) +wlc_compute_plcp(struct wlc_info *wlc, ratespec_t rspec, uint length, u8 *plcp) { if (IS_MCS(rspec)) { wlc_compute_mimo_plcp(rspec, length, plcp); @@ -5574,7 +5358,7 @@ wlc_compute_ofdm_plcp(ratespec_t rspec, u32 length, u8 *plcp) rate_signal = rate_info[rate] & RATE_MASK; ASSERT(rate_signal != 0); - bzero(plcp, D11_PHY_HDR_LEN); + memset(plcp, 0, D11_PHY_HDR_LEN); D11A_PHY_HDR_SRATE((ofdm_phy_hdr_t *) plcp, rate_signal); tmp = (length & 0xfff) << 5; @@ -5619,7 +5403,7 @@ static void wlc_cck_plcp_set(int rate_500, uint length, u8 *plcp) break; default: - WL_ERROR(("wlc_cck_plcp_set: unsupported rate %d\n", rate_500)); + WL_ERROR("wlc_cck_plcp_set: unsupported rate %d\n", rate_500); rate_500 = WLC_RATE_1M; usec = length << 3; break; @@ -5657,7 +5441,7 @@ static void wlc_compute_cck_plcp(ratespec_t rspec, uint length, u8 *plcp) * preamble_type use short/GF or long/MM PLCP header */ static u16 BCMFASTPATH -wlc_compute_frame_dur(wlc_info_t *wlc, ratespec_t rate, u8 preamble_type, +wlc_compute_frame_dur(struct wlc_info *wlc, ratespec_t rate, u8 preamble_type, uint next_frag_len) { u16 dur, sifs; @@ -5691,7 +5475,7 @@ wlc_compute_frame_dur(wlc_info_t *wlc, ratespec_t rate, u8 preamble_type, * frame_len next MPDU frame length in bytes */ u16 BCMFASTPATH -wlc_compute_rtscts_dur(wlc_info_t *wlc, bool cts_only, ratespec_t rts_rate, +wlc_compute_rtscts_dur(struct wlc_info *wlc, bool cts_only, ratespec_t rts_rate, ratespec_t frame_rate, u8 rts_preamble_type, u8 frame_preamble_type, uint frame_len, bool ba) { @@ -5722,7 +5506,7 @@ wlc_compute_rtscts_dur(wlc_info_t *wlc, bool cts_only, ratespec_t rts_rate, return dur; } -static bool wlc_phy_rspec_check(wlc_info_t *wlc, u16 bw, ratespec_t rspec) +static bool wlc_phy_rspec_check(struct wlc_info *wlc, u16 bw, ratespec_t rspec) { if (IS_MCS(rspec)) { uint mcs = rspec & RSPEC_RATE_MASK; @@ -5748,7 +5532,7 @@ static bool wlc_phy_rspec_check(wlc_info_t *wlc, u16 bw, ratespec_t rspec) return true; } -u16 BCMFASTPATH wlc_phytxctl1_calc(wlc_info_t *wlc, ratespec_t rspec) +u16 BCMFASTPATH wlc_phytxctl1_calc(struct wlc_info *wlc, ratespec_t rspec) { u16 phyctl1 = 0; u16 bw; @@ -5759,7 +5543,8 @@ u16 BCMFASTPATH wlc_phytxctl1_calc(wlc_info_t *wlc, ratespec_t rspec) bw = RSPEC_GET_BW(rspec); /* 10Mhz is not supported yet */ if (bw < PHY_TXC1_BW_20MHZ) { - WL_ERROR(("wlc_phytxctl1_calc: bw %d is not supported yet, set to 20L\n", bw)); + WL_ERROR("wlc_phytxctl1_calc: bw %d is not supported yet, set to 20L\n", + bw); bw = PHY_TXC1_BW_20MHZ; } @@ -5784,7 +5569,7 @@ u16 BCMFASTPATH wlc_phytxctl1_calc(wlc_info_t *wlc, ratespec_t rspec) /* get the phyctl byte from rate phycfg table */ phycfg = wlc_rate_legacy_phyctl(RSPEC2RATE(rspec)); if (phycfg == -1) { - WL_ERROR(("wlc_phytxctl1_calc: wrong legacy OFDM/CCK rate\n")); + WL_ERROR("wlc_phytxctl1_calc: wrong legacy OFDM/CCK rate\n"); ASSERT(0); phycfg = 0; } @@ -5798,16 +5583,14 @@ u16 BCMFASTPATH wlc_phytxctl1_calc(wlc_info_t *wlc, ratespec_t rspec) /* phy clock must support 40Mhz if tx descriptor uses it */ if ((phyctl1 & PHY_TXC1_BW_MASK) >= PHY_TXC1_BW_40MHZ) { ASSERT(CHSPEC_WLC_BW(wlc->chanspec) == WLC_40_MHZ); -#ifndef WLC_HIGH_ONLY ASSERT(wlc->chanspec == wlc_phy_chanspec_get(wlc->band->pi)); -#endif } #endif /* BCMDBG */ return phyctl1; } ratespec_t BCMFASTPATH -wlc_rspec_to_rts_rspec(wlc_info_t *wlc, ratespec_t rspec, bool use_rspec, +wlc_rspec_to_rts_rspec(struct wlc_info *wlc, ratespec_t rspec, bool use_rspec, u16 mimo_ctlchbw) { ratespec_t rts_rspec = 0; @@ -5863,15 +5646,15 @@ wlc_rspec_to_rts_rspec(wlc_info_t *wlc, ratespec_t rspec, bool use_rspec, * */ static u16 BCMFASTPATH -wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, - void *p, struct scb *scb, uint frag, +wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw, + struct sk_buff *p, struct scb *scb, uint frag, uint nfrags, uint queue, uint next_frag_len, wsec_key_t *key, ratespec_t rspec_override) { struct dot11_header *h; d11txh_t *txh; u8 *plcp, plcp_fallback[D11_PHY_HDR_LEN]; - osl_t *osh; + struct osl_info *osh; int len, phylen, rts_phylen; u16 fc, type, frameid, mch, phyctl, xfts, mainrates; u16 seq = 0, mcl = 0, status = 0; @@ -5911,7 +5694,7 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, osh = wlc->osh; /* locate 802.11 MAC header */ - h = (struct dot11_header *)PKTDATA(p); + h = (struct dot11_header *)(p->data); fc = ltoh16(h->fc); type = FC_TYPE(fc); @@ -5935,29 +5718,29 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, ASSERT(tx_info); /* add PLCP */ - plcp = PKTPUSH(p, D11_PHY_HDR_LEN); + plcp = skb_push(p, D11_PHY_HDR_LEN); /* add Broadcom tx descriptor header */ - txh = (d11txh_t *) PKTPUSH(p, D11_TXH_LEN); - bzero((char *)txh, D11_TXH_LEN); + txh = (d11txh_t *) skb_push(p, D11_TXH_LEN); + memset((char *)txh, 0, D11_TXH_LEN); /* setup frameid */ if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { /* non-AP STA should never use BCMC queue */ ASSERT(queue != TX_BCMC_FIFO); if (queue == TX_BCMC_FIFO) { - WL_ERROR(("wl%d: %s: ASSERT queue == TX_BCMC!\n", - WLCWLUNIT(wlc), __func__)); + WL_ERROR("wl%d: %s: ASSERT queue == TX_BCMC!\n", + WLCWLUNIT(wlc), __func__); frameid = bcmc_fid_generate(wlc, NULL, txh); } else { /* Increment the counter for first fragment */ if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) { - SCB_SEQNUM(scb, PKTPRIO(p))++; + SCB_SEQNUM(scb, p->priority)++; } /* extract fragment number from frame first */ seq = ltoh16(seq) & FRAGNUM_MASK; - seq |= (SCB_SEQNUM(scb, PKTPRIO(p)) << SEQNUM_SHIFT); + seq |= (SCB_SEQNUM(scb, p->priority) << SEQNUM_SHIFT); h->seq = htol16(seq); frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) | @@ -5981,13 +5764,6 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, if (txrate[1]->idx < 0) { txrate[1] = txrate[0]; } -#ifdef WLC_HIGH_ONLY - /* Double protection , just in case */ - if (txrate[0]->idx > HIGHEST_SINGLE_STREAM_MCS) - txrate[0]->idx = HIGHEST_SINGLE_STREAM_MCS; - if (txrate[1]->idx > HIGHEST_SINGLE_STREAM_MCS) - txrate[1]->idx = HIGHEST_SINGLE_STREAM_MCS; -#endif for (k = 0; k < hw->max_rates; k++) { is_mcs[k] = @@ -6034,7 +5810,8 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, ASSERT(RSPEC_ACTIVE(rspec[k])); rspec[k] = WLC_RATE_1M; } else { - if (WLANTSEL_ENAB(wlc) && !ETHER_ISMULTI(&h->a1)) { + if (WLANTSEL_ENAB(wlc) && + !is_multicast_ether_addr(h->a1.octet)) { /* set tx antenna config */ wlc_antsel_antcfg_get(wlc->asi, false, false, 0, 0, &antcfg, &fbantcfg); @@ -6131,7 +5908,8 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, if ((txrate[k]->flags & IEEE80211_TX_RC_MCS) && (!IS_MCS(rspec[k]))) { - WL_ERROR(("wl%d: %s: IEEE80211_TX_RC_MCS != IS_MCS(rspec)\n", WLCWLUNIT(wlc), __func__)); + WL_ERROR("wl%d: %s: IEEE80211_TX_RC_MCS != IS_MCS(rspec)\n", + WLCWLUNIT(wlc), __func__); ASSERT(0 && "Rate mismatch"); } @@ -6195,7 +5973,8 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, plcp[0]; /* DUR field for main rate */ - if ((fc != FC_PS_POLL) && !ETHER_ISMULTI(&h->a1) && !use_rifs) { + if ((fc != FC_PS_POLL) && + !is_multicast_ether_addr(h->a1.octet) && !use_rifs) { durid = wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0], next_frag_len); @@ -6213,7 +5992,7 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, /* DUR field for fallback rate */ if (fc == FC_PS_POLL) txh->FragDurFallback = h->durid; - else if (ETHER_ISMULTI(&h->a1) || use_rifs) + else if (is_multicast_ether_addr(h->a1.octet) || use_rifs) txh->FragDurFallback = 0; else { durid = wlc_compute_frame_dur(wlc, rspec[1], @@ -6225,7 +6004,7 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, if (frag == 0) mcl |= TXC_STARTMSDU; - if (!ETHER_ISMULTI(&h->a1)) + if (!is_multicast_ether_addr(h->a1.octet)) mcl |= TXC_IMMEDACK; if (BAND_5G(wlc->band->bandtype)) @@ -6260,7 +6039,7 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, txh->TxFesTimeFallback = htol16(0); /* TxFrameRA */ - bcopy((char *)&h->a1, (char *)&txh->TxFrameRA, ETHER_ADDR_LEN); + bcopy((char *)&h->a1, (char *)&txh->TxFrameRA, ETH_ALEN); /* TxFrameID */ txh->TxFrameID = htol16(frameid); @@ -6347,11 +6126,11 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, if (use_cts) { rts->fc = htol16(FC_CTS); - bcopy((char *)&h->a2, (char *)&rts->ra, ETHER_ADDR_LEN); + bcopy((char *)&h->a2, (char *)&rts->ra, ETH_ALEN); } else { rts->fc = htol16((u16) FC_RTS); bcopy((char *)&h->a1, (char *)&rts->ra, - 2 * ETHER_ADDR_LEN); + 2 * ETH_ALEN); } /* mainrate @@ -6362,9 +6141,10 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, D11A_PHY_HDR_GRATE((ofdm_phy_hdr_t *) rts_plcp) : rts_plcp[0]) << 8; } else { - bzero((char *)txh->RTSPhyHeader, D11_PHY_HDR_LEN); - bzero((char *)&txh->rts_frame, sizeof(struct dot11_rts_frame)); - bzero((char *)txh->RTSPLCPFallback, + memset((char *)txh->RTSPhyHeader, 0, D11_PHY_HDR_LEN); + memset((char *)&txh->rts_frame, 0, + sizeof(struct dot11_rts_frame)); + memset((char *)txh->RTSPLCPFallback, 0, sizeof(txh->RTSPLCPFallback)); txh->RTSDurFallback = 0; } @@ -6453,7 +6233,7 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, if (SCB_WME(scb) && qos && wlc->edcf_txop[ac]) { uint frag_dur, dur, dur_fallback; - ASSERT(!ETHER_ISMULTI(&h->a1)); + ASSERT(!is_multicast_ether_addr(h->a1.octet)); /* WME: Update TXOP threshold */ if ((!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) && (frag == 0)) { @@ -6523,19 +6303,23 @@ wlc_d11hdrs_mac80211(wlc_info_t *wlc, struct ieee80211_hw *hw, } } } else - WL_ERROR(("wl%d: %s txop invalid for rate %d\n", - wlc->pub->unit, fifo_names[queue], - RSPEC2RATE(rspec[0]))); + WL_ERROR("wl%d: %s txop invalid for rate %d\n", + wlc->pub->unit, fifo_names[queue], + RSPEC2RATE(rspec[0])); if (dur > wlc->edcf_txop[ac]) - WL_ERROR(("wl%d: %s: %s txop exceeded phylen %d/%d dur %d/%d\n", wlc->pub->unit, __func__, fifo_names[queue], phylen, wlc->fragthresh[queue], dur, wlc->edcf_txop[ac])); + WL_ERROR("wl%d: %s: %s txop exceeded phylen %d/%d dur %d/%d\n", + wlc->pub->unit, __func__, + fifo_names[queue], + phylen, wlc->fragthresh[queue], + dur, wlc->edcf_txop[ac]); } } return 0; } -void wlc_tbtt(wlc_info_t *wlc, d11regs_t *regs) +void wlc_tbtt(struct wlc_info *wlc, d11regs_t *regs) { wlc_bsscfg_t *cfg = wlc->cfg; @@ -6571,19 +6355,19 @@ void wlc_tbtt(wlc_info_t *wlc, d11regs_t *regs) } /* GP timer is a freerunning 32 bit counter, decrements at 1 us rate */ -void wlc_hwtimer_gptimer_set(wlc_info_t *wlc, uint us) +void wlc_hwtimer_gptimer_set(struct wlc_info *wlc, uint us) { ASSERT(wlc->pub->corerev >= 3); /* no gptimer in earlier revs */ W_REG(wlc->osh, &wlc->regs->gptimer, us); } -void wlc_hwtimer_gptimer_abort(wlc_info_t *wlc) +void wlc_hwtimer_gptimer_abort(struct wlc_info *wlc) { ASSERT(wlc->pub->corerev >= 3); W_REG(wlc->osh, &wlc->regs->gptimer, 0); } -static void wlc_hwtimer_gptimer_cb(wlc_info_t *wlc) +static void wlc_hwtimer_gptimer_cb(struct wlc_info *wlc) { /* when interrupt is generated, the counter is loaded with last value * written and continue to decrement. So it has to be cleaned first @@ -6596,7 +6380,7 @@ static void wlc_hwtimer_gptimer_cb(wlc_info_t *wlc) * POLICY: no macinstatus change, no bounding loop. * All dpc bounding should be handled in BMAC dpc, like txstatus and rxint */ -void wlc_high_dpc(wlc_info_t *wlc, u32 macintstatus) +void wlc_high_dpc(struct wlc_info *wlc, u32 macintstatus) { d11regs_t *regs = wlc->regs; #ifdef BCMDBG @@ -6634,8 +6418,8 @@ void wlc_high_dpc(wlc_info_t *wlc, u32 macintstatus) if (macintstatus & ~(MI_TBTT | MI_TXSTOP)) { bcm_format_flags(int_flags, macintstatus, flagstr, sizeof(flagstr)); - WL_TRACE(("wl%d: macintstatus 0x%x %s\n", wlc->pub->unit, - macintstatus, flagstr)); + WL_TRACE("wl%d: macintstatus 0x%x %s\n", + wlc->pub->unit, macintstatus, flagstr); } #endif /* BCMDBG */ @@ -6650,11 +6434,12 @@ void wlc_high_dpc(wlc_info_t *wlc, u32 macintstatus) wlc_tbtt(wlc, regs); if (macintstatus & MI_GP0) { - WL_ERROR(("wl%d: PSM microcode watchdog fired at %d (seconds). Resetting.\n", wlc->pub->unit, wlc->pub->now)); + WL_ERROR("wl%d: PSM microcode watchdog fired at %d (seconds). Resetting.\n", + wlc->pub->unit, wlc->pub->now); printk_once("%s : PSM Watchdog, chipid 0x%x, chiprev 0x%x\n", - __func__, CHIPID(wlc->pub->sih->chip), - CHIPREV(wlc->pub->sih->chiprev)); + __func__, wlc->pub->sih->chip, + wlc->pub->sih->chiprev); WLCNTINCR(wlc->pub->_cnt->psmwds); @@ -6668,7 +6453,9 @@ void wlc_high_dpc(wlc_info_t *wlc, u32 macintstatus) } if (macintstatus & MI_RFDISABLE) { - WL_ERROR(("wl%d: MAC Detected a change on the RF Disable Input 0x%x\n", wlc->pub->unit, R_REG(wlc->osh, ®s->phydebug) & PDBG_RFD)); + WL_ERROR("wl%d: MAC Detected a change on the RF Disable Input 0x%x\n", + wlc->pub->unit, + R_REG(wlc->osh, ®s->phydebug) & PDBG_RFD); /* delay the cleanup to wl_down in IBSS case */ if ((R_REG(wlc->osh, ®s->phydebug) & PDBG_RFD)) { int idx; @@ -6677,7 +6464,8 @@ void wlc_high_dpc(wlc_info_t *wlc, u32 macintstatus) if (!BSSCFG_STA(bsscfg) || !bsscfg->enable || !bsscfg->BSS) continue; - WL_ERROR(("wl%d: wlc_dpc: rfdisable -> wlc_bsscfg_disable()\n", wlc->pub->unit)); + WL_ERROR("wl%d: wlc_dpc: rfdisable -> wlc_bsscfg_disable()\n", + wlc->pub->unit); } } } @@ -6686,14 +6474,12 @@ void wlc_high_dpc(wlc_info_t *wlc, u32 macintstatus) if (!pktq_empty(&wlc->active_queue->q)) wlc_send_q(wlc, wlc->active_queue); -#ifndef WLC_HIGH_ONLY ASSERT(wlc_ps_check(wlc)); -#endif } -static void *wlc_15420war(wlc_info_t *wlc, uint queue) +static void *wlc_15420war(struct wlc_info *wlc, uint queue) { - hnddma_t *di; + struct hnddma_pub *di; void *p; ASSERT(queue < NFIFO); @@ -6715,13 +6501,14 @@ static void *wlc_15420war(wlc_info_t *wlc, uint queue) if (dma_txactive(wlc->hw->di[queue]) == 0) { WLCNTINCR(wlc->pub->_cnt->txdmawar); if (!dma_txreset(di)) - WL_ERROR(("wl%d: %s: dma_txreset[%d]: cannot stop dma\n", wlc->pub->unit, __func__, queue)); + WL_ERROR("wl%d: %s: dma_txreset[%d]: cannot stop dma\n", + wlc->pub->unit, __func__, queue); dma_txinit(di); } return p; } -static void wlc_war16165(wlc_info_t *wlc, bool tx) +static void wlc_war16165(struct wlc_info *wlc, bool tx) { if (tx) { /* the post-increment is used in STAY_AWAKE macro */ @@ -6737,14 +6524,14 @@ static void wlc_war16165(wlc_info_t *wlc, bool tx) /* process an individual tx_status_t */ /* WLC_HIGH_API */ bool BCMFASTPATH -wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) +wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2) { - void *p; + struct sk_buff *p; uint queue; d11txh_t *txh; struct scb *scb = NULL; bool free_pdu; - osl_t *osh; + struct osl_info *osh; int tx_rts, tx_frame_count, tx_rts_count; uint totlen, supr_status; bool lastframe; @@ -6768,7 +6555,7 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) ((txs-> status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT)); - WL_ERROR(("%s: INTERMEDIATE but not AMPDU\n", __func__)); + WL_ERROR("%s: INTERMEDIATE but not AMPDU\n", __func__); return false; } @@ -6789,12 +6576,12 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) if (p == NULL) goto fatal; - txh = (d11txh_t *) PKTDATA(p); + txh = (d11txh_t *) (p->data); mcl = ltoh16(txh->MacTxControlLow); if (txs->phyerr) { - WL_ERROR(("phyerr 0x%x, rate 0x%x\n", txs->phyerr, - txh->MainRates)); + WL_ERROR("phyerr 0x%x, rate 0x%x\n", + txs->phyerr, txh->MainRates); wlc_print_txdesc(txh); wlc_print_txstatus(txs); } @@ -6825,8 +6612,8 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) supr_status = txs->status & TX_STATUS_SUPR_MASK; if (supr_status == TX_STATUS_SUPR_BADCH) - WL_NONE(("%s: Pkt tx suppressed, possibly channel %d\n", - __func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec))); + WL_NONE("%s: Pkt tx suppressed, possibly channel %d\n", + __func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec)); tx_rts = htol16(txh->MacTxControlLow) & TXC_SENDRTS; tx_frame_count = @@ -6837,7 +6624,7 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) lastframe = (fc & FC_MOREFRAG) == 0; if (!lastframe) { - WL_ERROR(("Not last frame!\n")); + WL_ERROR("Not last frame!\n"); } else { u16 sfbl, lfbl; ieee80211_tx_info_clear_status(tx_info); @@ -6879,17 +6666,17 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) wlc_txfifo_complete(wlc, queue, 1); if (lastframe) { - PKTSETNEXT(p, NULL); - PKTSETLINK(p, NULL); + p->next = NULL; + p->prev = NULL; wlc->txretried = 0; /* remove PLCP & Broadcom tx descriptor header */ - PKTPULL(p, D11_PHY_HDR_LEN); - PKTPULL(p, D11_TXH_LEN); + skb_pull(p, D11_PHY_HDR_LEN); + skb_pull(p, D11_TXH_LEN); ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p); WLCNTINCR(wlc->pub->_cnt->ieee_tx_status); } else { - WL_ERROR(("%s: Not last frame => not calling tx_status\n", - __func__)); + WL_ERROR("%s: Not last frame => not calling tx_status\n", + __func__); } return false; @@ -6897,24 +6684,18 @@ wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2) fatal: ASSERT(0); if (p) - PKTFREE(osh, p, true); + pkt_buf_free_skb(osh, p, true); -#ifdef WLC_HIGH_ONLY - /* If this is a split driver, do the big-hammer here. - * If this is a monolithic driver, wlc_bmac.c:wlc_dpc() will do the big-hammer. - */ - wl_init(wlc->wl); -#endif return true; } void BCMFASTPATH -wlc_txfifo_complete(wlc_info_t *wlc, uint fifo, s8 txpktpend) +wlc_txfifo_complete(struct wlc_info *wlc, uint fifo, s8 txpktpend) { TXPKTPENDDEC(wlc, fifo, txpktpend); - WL_TRACE(("wlc_txfifo_complete, pktpend dec %d to %d\n", txpktpend, - TXPKTPENDGET(wlc, fifo))); + WL_TRACE("wlc_txfifo_complete, pktpend dec %d to %d\n", + txpktpend, TXPKTPENDGET(wlc, fifo)); /* There is more room; mark precedences related to this FIFO sendable */ WLC_TX_FIFO_ENAB(wlc, fifo); @@ -7014,7 +6795,7 @@ u32 wlc_calc_tbtt_offset(u32 bp, u32 tsf_h, u32 tsf_l) } /* Update beacon listen interval in shared memory */ -void wlc_bcn_li_upd(wlc_info_t *wlc) +void wlc_bcn_li_upd(struct wlc_info *wlc) { if (AP_ENAB(wlc->pub)) return; @@ -7028,7 +6809,7 @@ void wlc_bcn_li_upd(wlc_info_t *wlc) } static void -prep_mac80211_status(wlc_info_t *wlc, d11rxhdr_t *rxh, void *p, +prep_mac80211_status(struct wlc_info *wlc, d11rxhdr_t *rxh, struct sk_buff *p, struct ieee80211_rx_status *rx_status) { u32 tsf_l, tsf_h; @@ -7061,7 +6842,7 @@ prep_mac80211_status(wlc_info_t *wlc, d11rxhdr_t *rxh, void *p, /* qual */ rx_status->antenna = (rxh->PhyRxStatus_0 & PRXS0_RXANT_UPSUBBAND) ? 1 : 0; /* ant */ - plcp = PKTDATA(p); + plcp = p->data; rspec = wlc_compute_rspec(rxh, plcp); if (IS_MCS(rspec)) { @@ -7108,19 +6889,19 @@ prep_mac80211_status(wlc_info_t *wlc, d11rxhdr_t *rxh, void *p, rx_status->rate_idx = 11; break; default: - WL_ERROR(("%s: Unknown rate\n", __func__)); + WL_ERROR("%s: Unknown rate\n", __func__); } /* Determine short preamble and rate_idx */ preamble = 0; if (IS_CCK(rspec)) { if (rxh->PhyRxStatus_0 & PRXS0_SHORTH) - WL_ERROR(("Short CCK\n")); + WL_ERROR("Short CCK\n"); rx_status->flag |= RX_FLAG_SHORTPRE; } else if (IS_OFDM(rspec)) { rx_status->flag |= RX_FLAG_SHORTPRE; } else { - WL_ERROR(("%s: Unknown modulation\n", __func__)); + WL_ERROR("%s: Unknown modulation\n", __func__); } } @@ -7129,16 +6910,17 @@ prep_mac80211_status(wlc_info_t *wlc, d11rxhdr_t *rxh, void *p, if (rxh->RxStatus1 & RXS_DECERR) { rx_status->flag |= RX_FLAG_FAILED_PLCP_CRC; - WL_ERROR(("%s: RX_FLAG_FAILED_PLCP_CRC\n", __func__)); + WL_ERROR("%s: RX_FLAG_FAILED_PLCP_CRC\n", __func__); } if (rxh->RxStatus1 & RXS_FCSERR) { rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - WL_ERROR(("%s: RX_FLAG_FAILED_FCS_CRC\n", __func__)); + WL_ERROR("%s: RX_FLAG_FAILED_FCS_CRC\n", __func__); } } static void -wlc_recvctl(wlc_info_t *wlc, osl_t *osh, d11rxhdr_t *rxh, void *p) +wlc_recvctl(struct wlc_info *wlc, struct osl_info *osh, d11rxhdr_t *rxh, + struct sk_buff *p) { int len_mpdu; struct ieee80211_rx_status rx_status; @@ -7155,12 +6937,12 @@ wlc_recvctl(wlc_info_t *wlc, osl_t *osh, d11rxhdr_t *rxh, void *p) prep_mac80211_status(wlc, rxh, p, &rx_status); /* mac header+body length, exclude CRC and plcp header */ - len_mpdu = PKTLEN(p) - D11_PHY_HDR_LEN - DOT11_FCS_LEN; - PKTPULL(p, D11_PHY_HDR_LEN); - PKTSETLEN(p, len_mpdu); + len_mpdu = p->len - D11_PHY_HDR_LEN - DOT11_FCS_LEN; + skb_pull(p, D11_PHY_HDR_LEN); + __skb_trim(p, len_mpdu); - ASSERT(!PKTNEXT(p)); - ASSERT(!PKTLINK(p)); + ASSERT(!(p->next)); + ASSERT(!(p->prev)); ASSERT(IS_ALIGNED((unsigned long)skb->data, 2)); @@ -7168,17 +6950,17 @@ wlc_recvctl(wlc_info_t *wlc, osl_t *osh, d11rxhdr_t *rxh, void *p) ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); WLCNTINCR(wlc->pub->_cnt->ieee_rx); - PKTUNALLOC(osh); + osh->pktalloced--; return; } -void wlc_bss_list_free(wlc_info_t *wlc, wlc_bss_list_t *bss_list) +void wlc_bss_list_free(struct wlc_info *wlc, wlc_bss_list_t *bss_list) { uint index; wlc_bss_info_t *bi; if (!bss_list) { - WL_ERROR(("%s: Attempting to free NULL list\n", __func__)); + WL_ERROR("%s: Attempting to free NULL list\n", __func__); return; } /* inspect all BSS descriptor */ @@ -7201,48 +6983,48 @@ void wlc_bss_list_free(wlc_info_t *wlc, wlc_bss_list_t *bss_list) * Param 'bound' indicates max. # frames to process before break out. */ /* WLC_HIGH_API */ -void BCMFASTPATH wlc_recv(wlc_info_t *wlc, void *p) +void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p) { d11rxhdr_t *rxh; struct dot11_header *h; - osl_t *osh; + struct osl_info *osh; u16 fc; uint len; bool is_amsdu; - WL_TRACE(("wl%d: wlc_recv\n", wlc->pub->unit)); + WL_TRACE("wl%d: wlc_recv\n", wlc->pub->unit); osh = wlc->osh; /* frame starts with rxhdr */ - rxh = (d11rxhdr_t *) PKTDATA(p); + rxh = (d11rxhdr_t *) (p->data); /* strip off rxhdr */ - PKTPULL(p, wlc->hwrxoff); + skb_pull(p, wlc->hwrxoff); /* fixup rx header endianness */ ltoh16_buf((void *)rxh, sizeof(d11rxhdr_t)); /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */ if (rxh->RxStatus1 & RXS_PBPRES) { - if (PKTLEN(p) < 2) { + if (p->len < 2) { WLCNTINCR(wlc->pub->_cnt->rxrunt); - WL_ERROR(("wl%d: wlc_recv: rcvd runt of len %d\n", - wlc->pub->unit, PKTLEN(p))); + WL_ERROR("wl%d: wlc_recv: rcvd runt of len %d\n", + wlc->pub->unit, p->len); goto toss; } - PKTPULL(p, 2); + skb_pull(p, 2); } - h = (struct dot11_header *)(PKTDATA(p) + D11_PHY_HDR_LEN); - len = PKTLEN(p); + h = (struct dot11_header *)(p->data + D11_PHY_HDR_LEN); + len = p->len; if (rxh->RxStatus1 & RXS_FCSERR) { if (wlc->pub->mac80211_state & MAC80211_PROMISC_BCNS) { - WL_ERROR(("FCSERR while scanning******* - tossing\n")); + WL_ERROR("FCSERR while scanning******* - tossing\n"); goto toss; } else { - WL_ERROR(("RCSERR!!!\n")); + WL_ERROR("RCSERR!!!\n"); goto toss; } } @@ -7261,10 +7043,10 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, void *p) if (!is_amsdu) { /* CTS and ACK CTL frames are w/o a2 */ if (FC_TYPE(fc) == FC_TYPE_DATA || FC_TYPE(fc) == FC_TYPE_MNG) { - if ((ETHER_ISNULLADDR(&h->a2) || ETHER_ISMULTI(&h->a2))) { - WL_ERROR(("wl%d: %s: dropping a frame with " - "invalid src mac address, a2: %pM\n", - wlc->pub->unit, __func__, &h->a2)); + if ((is_zero_ether_addr(h->a2.octet) || + is_multicast_ether_addr(h->a2.octet))) { + WL_ERROR("wl%d: %s: dropping a frame with invalid src mac address, a2: %pM\n", + wlc->pub->unit, __func__, &h->a2); WLCNTINCR(wlc->pub->_cnt->rxbadsrcmac); goto toss; } @@ -7279,7 +7061,7 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, void *p) } if (is_amsdu) { - WL_ERROR(("%s: is_amsdu causing toss\n", __func__)); + WL_ERROR("%s: is_amsdu causing toss\n", __func__); goto toss; } @@ -7287,7 +7069,7 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, void *p) return; toss: - PKTFREE(osh, p, false); + pkt_buf_free_skb(osh, p, false); } /* calculate frame duration for Mixed-mode L-SIG spoofing, return @@ -7297,12 +7079,12 @@ void BCMFASTPATH wlc_recv(wlc_info_t *wlc, void *p) * len = 3(nsyms + nstream + 3) - 3 */ u16 BCMFASTPATH -wlc_calc_lsig_len(wlc_info_t *wlc, ratespec_t ratespec, uint mac_len) +wlc_calc_lsig_len(struct wlc_info *wlc, ratespec_t ratespec, uint mac_len) { uint nsyms, len = 0, kNdps; - WL_TRACE(("wl%d: wlc_calc_lsig_len: rate %d, len%d\n", wlc->pub->unit, - RSPEC2RATE(ratespec), mac_len)); + WL_TRACE("wl%d: wlc_calc_lsig_len: rate %d, len%d\n", + wlc->pub->unit, RSPEC2RATE(ratespec), mac_len); if (IS_MCS(ratespec)) { uint mcs = ratespec & RSPEC_RATE_MASK; @@ -7338,7 +7120,7 @@ wlc_calc_lsig_len(wlc_info_t *wlc, ratespec_t ratespec, uint mac_len) /* calculate frame duration of a given rate and length, return time in usec unit */ uint BCMFASTPATH -wlc_calc_frame_time(wlc_info_t *wlc, ratespec_t ratespec, u8 preamble_type, +wlc_calc_frame_time(struct wlc_info *wlc, ratespec_t ratespec, u8 preamble_type, uint mac_len) { uint nsyms, dur = 0, Ndps, kNdps; @@ -7346,11 +7128,12 @@ wlc_calc_frame_time(wlc_info_t *wlc, ratespec_t ratespec, u8 preamble_type, if (rate == 0) { ASSERT(0); - WL_ERROR(("wl%d: WAR: using rate of 1 mbps\n", wlc->pub->unit)); + WL_ERROR("wl%d: WAR: using rate of 1 mbps\n", wlc->pub->unit); rate = WLC_RATE_1M; } - WL_TRACE(("wl%d: wlc_calc_frame_time: rspec 0x%x, preamble_type %d, len%d\n", wlc->pub->unit, ratespec, preamble_type, mac_len)); + WL_TRACE("wl%d: wlc_calc_frame_time: rspec 0x%x, preamble_type %d, len%d\n", + wlc->pub->unit, ratespec, preamble_type, mac_len); if (IS_MCS(ratespec)) { uint mcs = ratespec & RSPEC_RATE_MASK; @@ -7408,13 +7191,14 @@ wlc_calc_frame_time(wlc_info_t *wlc, ratespec_t ratespec, u8 preamble_type, /* The opposite of wlc_calc_frame_time */ static uint -wlc_calc_frame_len(wlc_info_t *wlc, ratespec_t ratespec, u8 preamble_type, +wlc_calc_frame_len(struct wlc_info *wlc, ratespec_t ratespec, u8 preamble_type, uint dur) { uint nsyms, mac_len, Ndps, kNdps; uint rate = RSPEC2RATE(ratespec); - WL_TRACE(("wl%d: wlc_calc_frame_len: rspec 0x%x, preamble_type %d, dur %d\n", wlc->pub->unit, ratespec, preamble_type, dur)); + WL_TRACE("wl%d: wlc_calc_frame_len: rspec 0x%x, preamble_type %d, dur %d\n", + wlc->pub->unit, ratespec, preamble_type, dur); if (IS_MCS(ratespec)) { uint mcs = ratespec & RSPEC_RATE_MASK; @@ -7454,10 +7238,10 @@ wlc_calc_frame_len(wlc_info_t *wlc, ratespec_t ratespec, u8 preamble_type, } static uint -wlc_calc_ba_time(wlc_info_t *wlc, ratespec_t rspec, u8 preamble_type) +wlc_calc_ba_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type) { - WL_TRACE(("wl%d: wlc_calc_ba_time: rspec 0x%x, preamble_type %d\n", - wlc->pub->unit, rspec, preamble_type)); + WL_TRACE("wl%d: wlc_calc_ba_time: rspec 0x%x, preamble_type %d\n", + wlc->pub->unit, rspec, preamble_type); /* Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that is less than * or equal to the rate of the immediately previous frame in the FES */ @@ -7471,12 +7255,12 @@ wlc_calc_ba_time(wlc_info_t *wlc, ratespec_t rspec, u8 preamble_type) } static uint BCMFASTPATH -wlc_calc_ack_time(wlc_info_t *wlc, ratespec_t rspec, u8 preamble_type) +wlc_calc_ack_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type) { uint dur = 0; - WL_TRACE(("wl%d: wlc_calc_ack_time: rspec 0x%x, preamble_type %d\n", - wlc->pub->unit, rspec, preamble_type)); + WL_TRACE("wl%d: wlc_calc_ack_time: rspec 0x%x, preamble_type %d\n", + wlc->pub->unit, rspec, preamble_type); /* Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that is less than * or equal to the rate of the immediately previous frame in the FES */ @@ -7491,15 +7275,15 @@ wlc_calc_ack_time(wlc_info_t *wlc, ratespec_t rspec, u8 preamble_type) } static uint -wlc_calc_cts_time(wlc_info_t *wlc, ratespec_t rspec, u8 preamble_type) +wlc_calc_cts_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type) { - WL_TRACE(("wl%d: wlc_calc_cts_time: ratespec 0x%x, preamble_type %d\n", - wlc->pub->unit, rspec, preamble_type)); + WL_TRACE("wl%d: wlc_calc_cts_time: ratespec 0x%x, preamble_type %d\n", + wlc->pub->unit, rspec, preamble_type); return wlc_calc_ack_time(wlc, rspec, preamble_type); } /* derive wlc->band->basic_rate[] table from 'rateset' */ -void wlc_rate_lookup_init(wlc_info_t *wlc, wlc_rateset_t *rateset) +void wlc_rate_lookup_init(struct wlc_info *wlc, wlc_rateset_t *rateset) { u8 rate; u8 mandatory; @@ -7509,7 +7293,7 @@ void wlc_rate_lookup_init(wlc_info_t *wlc, wlc_rateset_t *rateset) uint i; /* incoming rates are in 500kbps units as in 802.11 Supported Rates */ - bzero(br, WLC_MAXRATE + 1); + memset(br, 0, WLC_MAXRATE + 1); /* For each basic rate in the rates list, make an entry in the * best basic lookup. @@ -7523,7 +7307,8 @@ void wlc_rate_lookup_init(wlc_info_t *wlc, wlc_rateset_t *rateset) rate = (rateset->rates[i] & RATE_MASK); if (rate > WLC_MAXRATE) { - WL_ERROR(("wlc_rate_lookup_init: invalid rate 0x%X in rate set\n", rateset->rates[i])); + WL_ERROR("wlc_rate_lookup_init: invalid rate 0x%X in rate set\n", + rateset->rates[i]); continue; } @@ -7588,7 +7373,7 @@ void wlc_rate_lookup_init(wlc_info_t *wlc, wlc_rateset_t *rateset) } } -static void wlc_write_rate_shm(wlc_info_t *wlc, u8 rate, u8 basic_rate) +static void wlc_write_rate_shm(struct wlc_info *wlc, u8 rate, u8 basic_rate) { u8 phy_rate, index; u8 basic_phy_rate, basic_index; @@ -7621,7 +7406,7 @@ static void wlc_write_rate_shm(wlc_info_t *wlc, u8 rate, u8 basic_rate) wlc_write_shm(wlc, (basic_table + index * 2), basic_ptr); } -static const wlc_rateset_t *wlc_rateset_get_hwrs(wlc_info_t *wlc) +static const wlc_rateset_t *wlc_rateset_get_hwrs(struct wlc_info *wlc) { const wlc_rateset_t *rs_dflt; @@ -7638,7 +7423,7 @@ static const wlc_rateset_t *wlc_rateset_get_hwrs(wlc_info_t *wlc) return rs_dflt; } -void wlc_set_ratetable(wlc_info_t *wlc) +void wlc_set_ratetable(struct wlc_info *wlc) { const wlc_rateset_t *rs_dflt; wlc_rateset_t rs; @@ -7674,7 +7459,8 @@ void wlc_set_ratetable(wlc_info_t *wlc) * Return true if the specified rate is supported by the specified band. * WLC_BAND_AUTO indicates the current band. */ -bool wlc_valid_rate(wlc_info_t *wlc, ratespec_t rspec, int band, bool verbose) +bool wlc_valid_rate(struct wlc_info *wlc, ratespec_t rspec, int band, + bool verbose) { wlc_rateset_t *hw_rateset; uint i; @@ -7701,16 +7487,17 @@ bool wlc_valid_rate(wlc_info_t *wlc, ratespec_t rspec, int band, bool verbose) return true; error: if (verbose) { - WL_ERROR(("wl%d: wlc_valid_rate: rate spec 0x%x not in hw_rateset\n", wlc->pub->unit, rspec)); + WL_ERROR("wl%d: wlc_valid_rate: rate spec 0x%x not in hw_rateset\n", + wlc->pub->unit, rspec); } return false; } -static void wlc_update_mimo_band_bwcap(wlc_info_t *wlc, u8 bwcap) +static void wlc_update_mimo_band_bwcap(struct wlc_info *wlc, u8 bwcap) { uint i; - wlcband_t *band; + struct wlcband *band; for (i = 0; i < NBANDS(wlc); i++) { if (IS_SINGLEBAND_5G(wlc->deviceid)) @@ -7734,7 +7521,7 @@ static void wlc_update_mimo_band_bwcap(wlc_info_t *wlc, u8 bwcap) wlc->mimo_band_bwcap = bwcap; } -void wlc_mod_prb_rsp_rate_table(wlc_info_t *wlc, uint frame_len) +void wlc_mod_prb_rsp_rate_table(struct wlc_info *wlc, uint frame_len) { const wlc_rateset_t *rs_dflt; wlc_rateset_t rs; @@ -7777,14 +7564,14 @@ void wlc_mod_prb_rsp_rate_table(wlc_info_t *wlc, uint frame_len) } u16 -wlc_compute_bcntsfoff(wlc_info_t *wlc, ratespec_t rspec, bool short_preamble, - bool phydelay) +wlc_compute_bcntsfoff(struct wlc_info *wlc, ratespec_t rspec, + bool short_preamble, bool phydelay) { uint bcntsfoff = 0; if (IS_MCS(rspec)) { - WL_ERROR(("wl%d: recd beacon with mcs rate; rspec 0x%x\n", - wlc->pub->unit, rspec)); + WL_ERROR("wl%d: recd beacon with mcs rate; rspec 0x%x\n", + wlc->pub->unit, rspec); } else if (IS_OFDM(rspec)) { /* tx delay from MAC through phy to air (2.1 usec) + * phy header time (preamble + PLCP SIGNAL == 20 usec) + @@ -7824,7 +7611,7 @@ wlc_compute_bcntsfoff(wlc_info_t *wlc, ratespec_t rspec, bool short_preamble, * and included up to, but not including, the 4 byte FCS. */ static void -wlc_bcn_prb_template(wlc_info_t *wlc, uint type, ratespec_t bcn_rspec, +wlc_bcn_prb_template(struct wlc_info *wlc, uint type, ratespec_t bcn_rspec, wlc_bsscfg_t *cfg, u16 *buf, int *len) { cck_phy_hdr_t *plcp; @@ -7843,7 +7630,7 @@ wlc_bcn_prb_template(wlc_info_t *wlc, uint type, ratespec_t bcn_rspec, *len = hdr_len + body_len; /* return actual size */ /* format PHY and MAC headers */ - bzero((char *)buf, hdr_len); + memset((char *)buf, 0, hdr_len); plcp = (cck_phy_hdr_t *) buf; @@ -7872,9 +7659,9 @@ wlc_bcn_prb_template(wlc_info_t *wlc, uint type, ratespec_t bcn_rspec, /* A1 filled in by MAC for prb resp, broadcast for bcn */ if (type == FC_BEACON) bcopy((const char *)ðer_bcast, (char *)&h->da, - ETHER_ADDR_LEN); - bcopy((char *)&cfg->cur_etheraddr, (char *)&h->sa, ETHER_ADDR_LEN); - bcopy((char *)&cfg->BSSID, (char *)&h->bssid, ETHER_ADDR_LEN); + ETH_ALEN); + bcopy((char *)&cfg->cur_etheraddr, (char *)&h->sa, ETH_ALEN); + bcopy((char *)&cfg->BSSID, (char *)&h->bssid, ETH_ALEN); /* SEQ filled in by MAC */ @@ -7891,7 +7678,7 @@ int wlc_get_header_len() * template updated. * Otherwise, it updates the hardware template. */ -void wlc_bss_update_beacon(wlc_info_t *wlc, wlc_bsscfg_t *cfg) +void wlc_bss_update_beacon(struct wlc_info *wlc, wlc_bsscfg_t *cfg) { int len = BCN_TMPL_LEN; @@ -7907,7 +7694,7 @@ void wlc_bss_update_beacon(wlc_info_t *wlc, wlc_bsscfg_t *cfg) u16 bcn[BCN_TMPL_LEN / 2]; u32 both_valid = MCMD_BCN0VLD | MCMD_BCN1VLD; d11regs_t *regs = wlc->regs; - osl_t *osh = NULL; + struct osl_info *osh = NULL; osh = wlc->osh; @@ -7944,7 +7731,7 @@ void wlc_bss_update_beacon(wlc_info_t *wlc, wlc_bsscfg_t *cfg) /* * Update all beacons for the system. */ -void wlc_update_beacon(wlc_info_t *wlc) +void wlc_update_beacon(struct wlc_info *wlc) { int idx; wlc_bsscfg_t *bsscfg; @@ -7957,14 +7744,14 @@ void wlc_update_beacon(wlc_info_t *wlc) } /* Write ssid into shared memory */ -void wlc_shm_ssid_upd(wlc_info_t *wlc, wlc_bsscfg_t *cfg) +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]; /* padding the ssid with zero and copy it into shm */ - bzero(ssidbuf, DOT11_MAX_SSID_LEN); + memset(ssidbuf, 0, DOT11_MAX_SSID_LEN); bcopy(ssidptr, ssidbuf, cfg->SSID_len); wlc_copyto_shm(wlc, base, ssidbuf, DOT11_MAX_SSID_LEN); @@ -7973,7 +7760,7 @@ void wlc_shm_ssid_upd(wlc_info_t *wlc, wlc_bsscfg_t *cfg) wlc_write_shm(wlc, M_SSIDLEN, (u16) cfg->SSID_len); } -void wlc_update_probe_resp(wlc_info_t *wlc, bool suspend) +void wlc_update_probe_resp(struct wlc_info *wlc, bool suspend) { int idx; wlc_bsscfg_t *bsscfg; @@ -7986,7 +7773,7 @@ void wlc_update_probe_resp(wlc_info_t *wlc, bool suspend) } void -wlc_bss_update_probe_resp(wlc_info_t *wlc, wlc_bsscfg_t *cfg, bool suspend) +wlc_bss_update_probe_resp(struct wlc_info *wlc, wlc_bsscfg_t *cfg, bool suspend) { u16 prb_resp[BCN_TMPL_LEN / 2]; int len = BCN_TMPL_LEN; @@ -8027,9 +7814,9 @@ wlc_bss_update_probe_resp(wlc_info_t *wlc, wlc_bsscfg_t *cfg, bool suspend) } /* prepares pdu for transmission. returns BCM error codes */ -int wlc_prep_pdu(wlc_info_t *wlc, void *pdu, uint *fifop) +int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifop) { - osl_t *osh; + struct osl_info *osh; uint fifo; d11txh_t *txh; struct dot11_header *h; @@ -8039,7 +7826,7 @@ int wlc_prep_pdu(wlc_info_t *wlc, void *pdu, uint *fifop) osh = wlc->osh; ASSERT(pdu); - txh = (d11txh_t *) PKTDATA(pdu); + txh = (d11txh_t *) (pdu->data); ASSERT(txh); h = (struct dot11_header *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); ASSERT(h); @@ -8066,7 +7853,7 @@ int wlc_prep_pdu(wlc_info_t *wlc, void *pdu, uint *fifop) } /* init tx reported rate mechanism */ -void wlc_reprate_init(wlc_info_t *wlc) +void wlc_reprate_init(struct wlc_info *wlc) { int i; wlc_bsscfg_t *bsscfg; @@ -8080,13 +7867,13 @@ void wlc_reprate_init(wlc_info_t *wlc) void wlc_bsscfg_reprate_init(wlc_bsscfg_t *bsscfg) { bsscfg->txrspecidx = 0; - bzero((char *)bsscfg->txrspec, sizeof(bsscfg->txrspec)); + memset((char *)bsscfg->txrspec, 0, sizeof(bsscfg->txrspec)); } /* Retrieve a consolidated set of revision information, * typically for the WLC_GET_REVINFO ioctl */ -int wlc_get_revision_info(wlc_info_t *wlc, void *buf, uint len) +int wlc_get_revision_info(struct wlc_info *wlc, void *buf, uint len) { wlc_rev_info_t *rinfo = (wlc_rev_info_t *) buf; @@ -8120,7 +7907,7 @@ int wlc_get_revision_info(wlc_info_t *wlc, void *buf, uint len) return BCME_OK; } -void wlc_default_rateset(wlc_info_t *wlc, wlc_rateset_t *rs) +void wlc_default_rateset(struct wlc_info *wlc, wlc_rateset_t *rs) { wlc_rateset_default(rs, NULL, wlc->band->phytype, wlc->band->bandtype, false, RATE_MASK_FULL, (bool) N_ENAB(wlc->pub), @@ -8128,14 +7915,14 @@ void wlc_default_rateset(wlc_info_t *wlc, wlc_rateset_t *rs) wlc->stf->txstreams); } -static void wlc_bss_default_init(wlc_info_t *wlc) +static void wlc_bss_default_init(struct wlc_info *wlc) { chanspec_t chanspec; - wlcband_t *band; + struct wlcband *band; wlc_bss_info_t *bi = wlc->default_bss; /* init default and target BSS with some sane initial values */ - bzero((char *)(bi), sizeof(wlc_bss_info_t)); + memset((char *)(bi), 0, sizeof(wlc_bss_info_t)); bi->beacon_period = ISSIM_ENAB(wlc->pub->sih) ? BEACON_INTERVAL_DEF_QT : BEACON_INTERVAL_DEFAULT; bi->dtim_period = ISSIM_ENAB(wlc->pub->sih) ? DTIM_INTERVAL_DEF_QT : @@ -8166,7 +7953,7 @@ static void wlc_bss_default_init(wlc_info_t *wlc) /* Deferred event processing */ static void wlc_process_eventq(void *arg) { - wlc_info_t *wlc = (wlc_info_t *) arg; + struct wlc_info *wlc = (struct wlc_info *) arg; wlc_event_t *etmp; while ((etmp = wlc_eventq_deq(wlc->eventq))) { @@ -8192,7 +7979,8 @@ wlc_uint64_sub(u32 *a_high, u32 *a_low, u32 b_high, u32 b_low) } static ratespec_t -mac80211_wlc_set_nrate(wlc_info_t *wlc, wlcband_t *cur_band, u32 int_val) +mac80211_wlc_set_nrate(struct wlc_info *wlc, struct wlcband *cur_band, + u32 int_val) { u8 stf = (int_val & NRATE_STF_MASK) >> NRATE_STF_SHIFT; u8 rate = int_val & NRATE_RATE_MASK; @@ -8211,8 +7999,8 @@ mac80211_wlc_set_nrate(wlc_info_t *wlc, wlcband_t *cur_band, u32 int_val) if (N_ENAB(wlc->pub) && ismcs) { /* mcs only allowed when nmode */ if (stf > PHY_TXC1_MODE_SDM) { - WL_ERROR(("wl%d: %s: Invalid stf\n", WLCWLUNIT(wlc), - __func__)); + WL_ERROR("wl%d: %s: Invalid stf\n", + WLCWLUNIT(wlc), __func__); bcmerror = BCME_RANGE; goto done; } @@ -8222,8 +8010,8 @@ mac80211_wlc_set_nrate(wlc_info_t *wlc, wlcband_t *cur_band, u32 int_val) if (!CHSPEC_IS40(wlc->home_chanspec) || ((stf != PHY_TXC1_MODE_SISO) && (stf != PHY_TXC1_MODE_CDD))) { - WL_ERROR(("wl%d: %s: Invalid mcs 32\n", - WLCWLUNIT(wlc), __func__)); + WL_ERROR("wl%d: %s: Invalid mcs 32\n", + WLCWLUNIT(wlc), __func__); bcmerror = BCME_RANGE; goto done; } @@ -8231,7 +8019,8 @@ mac80211_wlc_set_nrate(wlc_info_t *wlc, wlcband_t *cur_band, u32 int_val) } else if (rate > HIGHEST_SINGLE_STREAM_MCS) { /* mcs > 7 must use stf SDM */ if (stf != PHY_TXC1_MODE_SDM) { - WL_TRACE(("wl%d: %s: enabling SDM mode for mcs %d\n", WLCWLUNIT(wlc), __func__, rate)); + WL_TRACE("wl%d: %s: enabling SDM mode for mcs %d\n", + WLCWLUNIT(wlc), __func__, rate); stf = PHY_TXC1_MODE_SDM; } } else { @@ -8239,37 +8028,37 @@ mac80211_wlc_set_nrate(wlc_info_t *wlc, wlcband_t *cur_band, u32 int_val) if ((stf > PHY_TXC1_MODE_STBC) || (!WLC_STBC_CAP_PHY(wlc) && (stf == PHY_TXC1_MODE_STBC))) { - WL_ERROR(("wl%d: %s: Invalid STBC\n", - WLCWLUNIT(wlc), __func__)); + WL_ERROR("wl%d: %s: Invalid STBC\n", + WLCWLUNIT(wlc), __func__); bcmerror = BCME_RANGE; goto done; } } } else if (IS_OFDM(rate)) { if ((stf != PHY_TXC1_MODE_CDD) && (stf != PHY_TXC1_MODE_SISO)) { - WL_ERROR(("wl%d: %s: Invalid OFDM\n", WLCWLUNIT(wlc), - __func__)); + WL_ERROR("wl%d: %s: Invalid OFDM\n", + WLCWLUNIT(wlc), __func__); bcmerror = BCME_RANGE; goto done; } } else if (IS_CCK(rate)) { if ((cur_band->bandtype != WLC_BAND_2G) || (stf != PHY_TXC1_MODE_SISO)) { - WL_ERROR(("wl%d: %s: Invalid CCK\n", WLCWLUNIT(wlc), - __func__)); + WL_ERROR("wl%d: %s: Invalid CCK\n", + WLCWLUNIT(wlc), __func__); bcmerror = BCME_RANGE; goto done; } } else { - WL_ERROR(("wl%d: %s: Unknown rate type\n", WLCWLUNIT(wlc), - __func__)); + WL_ERROR("wl%d: %s: Unknown rate type\n", + WLCWLUNIT(wlc), __func__); bcmerror = BCME_RANGE; goto done; } /* make sure multiple antennae are available for non-siso rates */ if ((stf != PHY_TXC1_MODE_SISO) && (wlc->stf->txstreams == 1)) { - WL_ERROR(("wl%d: %s: SISO antenna but !SISO request\n", - WLCWLUNIT(wlc), __func__)); + WL_ERROR("wl%d: %s: SISO antenna but !SISO request\n", + WLCWLUNIT(wlc), __func__); bcmerror = BCME_RANGE; goto done; } @@ -8300,13 +8089,13 @@ mac80211_wlc_set_nrate(wlc_info_t *wlc, wlcband_t *cur_band, u32 int_val) return rspec; done: - WL_ERROR(("Hoark\n")); + WL_ERROR("Hoark\n"); return rate; } /* formula: IDLE_BUSY_RATIO_X_16 = (100-duty_cycle)/duty_cycle*16 */ static int -wlc_duty_cycle_set(wlc_info_t *wlc, int duty_cycle, bool isOFDM, +wlc_duty_cycle_set(struct wlc_info *wlc, int duty_cycle, bool isOFDM, bool writeToShm) { int idle_busy_ratio_x_16 = 0; @@ -8314,8 +8103,7 @@ wlc_duty_cycle_set(wlc_info_t *wlc, int duty_cycle, bool isOFDM, isOFDM ? M_TX_IDLE_BUSY_RATIO_X_16_OFDM : M_TX_IDLE_BUSY_RATIO_X_16_CCK; if (duty_cycle > 100 || duty_cycle < 0) { - WL_ERROR(("wl%d: duty cycle value off limit\n", - wlc->pub->unit)); + WL_ERROR("wl%d: duty cycle value off limit\n", wlc->pub->unit); return BCME_RANGE; } if (duty_cycle) @@ -8335,7 +8123,7 @@ wlc_duty_cycle_set(wlc_info_t *wlc, int duty_cycle, bool isOFDM, /* Read a single u16 from shared memory. * SHM 'offset' needs to be an even address */ -u16 wlc_read_shm(wlc_info_t *wlc, uint offset) +u16 wlc_read_shm(struct wlc_info *wlc, uint offset) { return wlc_bmac_read_shm(wlc->hw, offset); } @@ -8343,7 +8131,7 @@ u16 wlc_read_shm(wlc_info_t *wlc, uint offset) /* Write a single u16 to shared memory. * SHM 'offset' needs to be an even address */ -void wlc_write_shm(wlc_info_t *wlc, uint offset, u16 v) +void wlc_write_shm(struct wlc_info *wlc, uint offset, u16 v) { wlc_bmac_write_shm(wlc->hw, offset, v); } @@ -8352,7 +8140,7 @@ void wlc_write_shm(wlc_info_t *wlc, uint offset, u16 v) * SHM 'offset' needs to be an even address and * Range length 'len' must be an even number of bytes */ -void wlc_set_shm(wlc_info_t *wlc, uint offset, u16 v, int len) +void wlc_set_shm(struct wlc_info *wlc, uint offset, u16 v, int len) { /* offset and len need to be even */ ASSERT((offset & 1) == 0); @@ -8368,7 +8156,7 @@ void wlc_set_shm(wlc_info_t *wlc, uint offset, u16 v, int len) * SHM 'offset' needs to be an even address and * Buffer length 'len' must be an even number of bytes */ -void wlc_copyto_shm(wlc_info_t *wlc, uint offset, const void *buf, int len) +void wlc_copyto_shm(struct wlc_info *wlc, uint offset, const void *buf, int len) { /* offset and len need to be even */ ASSERT((offset & 1) == 0); @@ -8384,7 +8172,7 @@ void wlc_copyto_shm(wlc_info_t *wlc, uint offset, const void *buf, int len) * SHM 'offset' needs to be an even address and * Buffer length 'len' must be an even number of bytes */ -void wlc_copyfrom_shm(wlc_info_t *wlc, uint offset, void *buf, int len) +void wlc_copyfrom_shm(struct wlc_info *wlc, uint offset, void *buf, int len) { /* offset and len need to be even */ ASSERT((offset & 1) == 0); @@ -8397,71 +8185,73 @@ void wlc_copyfrom_shm(wlc_info_t *wlc, uint offset, void *buf, int len) } /* wrapper BMAC functions to for HIGH driver access */ -void wlc_mctrl(wlc_info_t *wlc, u32 mask, u32 val) +void wlc_mctrl(struct wlc_info *wlc, u32 mask, u32 val) { wlc_bmac_mctrl(wlc->hw, mask, val); } -void wlc_corereset(wlc_info_t *wlc, u32 flags) +void wlc_corereset(struct wlc_info *wlc, u32 flags) { wlc_bmac_corereset(wlc->hw, flags); } -void wlc_mhf(wlc_info_t *wlc, u8 idx, u16 mask, u16 val, int bands) +void wlc_mhf(struct wlc_info *wlc, u8 idx, u16 mask, u16 val, int bands) { wlc_bmac_mhf(wlc->hw, idx, mask, val, bands); } -u16 wlc_mhf_get(wlc_info_t *wlc, u8 idx, int bands) +u16 wlc_mhf_get(struct wlc_info *wlc, u8 idx, int bands) { return wlc_bmac_mhf_get(wlc->hw, idx, bands); } -int wlc_xmtfifo_sz_get(wlc_info_t *wlc, uint fifo, uint *blocks) +int wlc_xmtfifo_sz_get(struct wlc_info *wlc, uint fifo, uint *blocks) { return wlc_bmac_xmtfifo_sz_get(wlc->hw, fifo, blocks); } -void wlc_write_template_ram(wlc_info_t *wlc, int offset, int len, void *buf) +void wlc_write_template_ram(struct wlc_info *wlc, int offset, int len, + void *buf) { wlc_bmac_write_template_ram(wlc->hw, offset, len, buf); } -void wlc_write_hw_bcntemplates(wlc_info_t *wlc, void *bcn, int len, bool both) +void wlc_write_hw_bcntemplates(struct wlc_info *wlc, void *bcn, int len, + bool both) { wlc_bmac_write_hw_bcntemplates(wlc->hw, bcn, len, both); } void -wlc_set_addrmatch(wlc_info_t *wlc, int match_reg_offset, +wlc_set_addrmatch(struct wlc_info *wlc, int match_reg_offset, const struct ether_addr *addr) { wlc_bmac_set_addrmatch(wlc->hw, match_reg_offset, addr); } -void wlc_set_rcmta(wlc_info_t *wlc, int idx, const struct ether_addr *addr) +void wlc_set_rcmta(struct wlc_info *wlc, int idx, const struct ether_addr *addr) { wlc_bmac_set_rcmta(wlc->hw, idx, addr); } -void wlc_read_tsf(wlc_info_t *wlc, u32 *tsf_l_ptr, u32 *tsf_h_ptr) +void wlc_read_tsf(struct wlc_info *wlc, u32 *tsf_l_ptr, u32 *tsf_h_ptr) { wlc_bmac_read_tsf(wlc->hw, tsf_l_ptr, tsf_h_ptr); } -void wlc_set_cwmin(wlc_info_t *wlc, u16 newmin) +void wlc_set_cwmin(struct wlc_info *wlc, u16 newmin) { wlc->band->CWmin = newmin; wlc_bmac_set_cwmin(wlc->hw, newmin); } -void wlc_set_cwmax(wlc_info_t *wlc, u16 newmax) +void wlc_set_cwmax(struct wlc_info *wlc, u16 newmax) { wlc->band->CWmax = newmax; wlc_bmac_set_cwmax(wlc->hw, newmax); } -void wlc_fifoerrors(wlc_info_t *wlc) +void wlc_fifoerrors(struct wlc_info *wlc) { wlc_bmac_fifoerrors(wlc->hw); @@ -8469,19 +8259,16 @@ void wlc_fifoerrors(wlc_info_t *wlc) /* Search mem rw utilities */ -void wlc_pllreq(wlc_info_t *wlc, bool set, mbool req_bit) +void wlc_pllreq(struct wlc_info *wlc, bool set, mbool req_bit) { wlc_bmac_pllreq(wlc->hw, set, req_bit); } -void wlc_reset_bmac_done(wlc_info_t *wlc) +void wlc_reset_bmac_done(struct wlc_info *wlc) { -#ifdef WLC_HIGH_ONLY - wlc->reset_bmac_pending = false; -#endif } -void wlc_ht_mimops_cap_update(wlc_info_t *wlc, u8 mimops_mode) +void wlc_ht_mimops_cap_update(struct wlc_info *wlc, u8 mimops_mode) { wlc->ht_cap.cap &= ~HT_CAP_MIMO_PS_MASK; wlc->ht_cap.cap |= (mimops_mode << HT_CAP_MIMO_PS_SHIFT); @@ -8494,7 +8281,7 @@ void wlc_ht_mimops_cap_update(wlc_info_t *wlc, u8 mimops_mode) /* check for the particular priority flow control bit being set */ bool -wlc_txflowcontrol_prio_isset(wlc_info_t *wlc, wlc_txq_info_t *q, int prio) +wlc_txflowcontrol_prio_isset(struct wlc_info *wlc, wlc_txq_info_t *q, int prio) { uint prio_mask; @@ -8509,12 +8296,13 @@ wlc_txflowcontrol_prio_isset(wlc_info_t *wlc, wlc_txq_info_t *q, int prio) } /* propogate the flow control to all interfaces using the given tx queue */ -void wlc_txflowcontrol(wlc_info_t *wlc, wlc_txq_info_t *qi, bool on, int prio) +void wlc_txflowcontrol(struct wlc_info *wlc, wlc_txq_info_t *qi, + bool on, int prio) { uint prio_bits; uint cur_bits; - WL_ERROR(("%s: flow contro kicks in\n", __func__)); + WL_ERROR("%s: flow control kicks in\n", __func__); if (prio == ALLPRIO) { prio_bits = TXQ_STOP_FOR_PRIOFC_MASK; @@ -8551,7 +8339,7 @@ void wlc_txflowcontrol(wlc_info_t *wlc, wlc_txq_info_t *qi, bool on, int prio) } void -wlc_txflowcontrol_override(wlc_info_t *wlc, wlc_txq_info_t *qi, bool on, +wlc_txflowcontrol_override(struct wlc_info *wlc, wlc_txq_info_t *qi, bool on, uint override) { uint prev_override; @@ -8598,7 +8386,7 @@ wlc_txflowcontrol_override(wlc_info_t *wlc, wlc_txq_info_t *qi, bool on, } } -static void wlc_txflowcontrol_reset(wlc_info_t *wlc) +static void wlc_txflowcontrol_reset(struct wlc_info *wlc) { wlc_txq_info_t *qi; @@ -8611,10 +8399,10 @@ static void wlc_txflowcontrol_reset(wlc_info_t *wlc) } static void -wlc_txflowcontrol_signal(wlc_info_t *wlc, wlc_txq_info_t *qi, bool on, +wlc_txflowcontrol_signal(struct wlc_info *wlc, wlc_txq_info_t *qi, bool on, int prio) { - wlc_if_t *wlcif; + struct wlc_if *wlcif; for (wlcif = wlc->wlcif_list; wlcif != NULL; wlcif = wlcif->next) { if (wlcif->qi == qi && wlcif->flags & WLC_IF_LINKED) @@ -8622,7 +8410,7 @@ wlc_txflowcontrol_signal(wlc_info_t *wlc, wlc_txq_info_t *qi, bool on, } } -static wlc_txq_info_t *wlc_txq_alloc(wlc_info_t *wlc, osl_t *osh) +static wlc_txq_info_t *wlc_txq_alloc(struct wlc_info *wlc, struct osl_info *osh) { wlc_txq_info_t *qi, *p; @@ -8652,7 +8440,8 @@ static wlc_txq_info_t *wlc_txq_alloc(wlc_info_t *wlc, osl_t *osh) return qi; } -static void wlc_txq_free(wlc_info_t *wlc, osl_t *osh, wlc_txq_info_t *qi) +static void wlc_txq_free(struct wlc_info *wlc, struct osl_info *osh, + wlc_txq_info_t *qi) { wlc_txq_info_t *p; diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.h b/drivers/staging/brcm80211/sys/wlc_mac80211.h index 6a77591..5df996b 100644 --- a/drivers/staging/brcm80211/sys/wlc_mac80211.h +++ b/drivers/staging/brcm80211/sys/wlc_mac80211.h @@ -17,19 +17,10 @@ #ifndef _wlc_h_ #define _wlc_h_ -#include <wlc_types.h> - -#include <wl_dbg.h> #include <wlioctl.h> -#include <wlc_event.h> #include <wlc_phy_hal.h> #include <wlc_channel.h> -#ifdef WLC_SPLIT -#include <bcm_rpc.h> -#endif - #include <wlc_bsscfg.h> - #include <wlc_scb.h> #define MA_WINDOW_SZ 8 /* moving average window size */ @@ -220,15 +211,11 @@ extern const u8 prio2fifo[]; * (some platforms return all 0). * If clocks are present, call the sb routine which will figure out if the device is removed. */ -#ifdef WLC_HIGH_ONLY -#define DEVICEREMOVED(wlc) (!wlc->device_present) -#else #define DEVICEREMOVED(wlc) \ ((wlc->hw->clk) ? \ ((R_REG(wlc->hw->osh, &wlc->hw->regs->maccontrol) & \ (MCTL_PSM_JMP_0 | MCTL_IHR_EN)) != MCTL_IHR_EN) : \ (si_deviceremoved(wlc->hw->sih))) -#endif /* WLC_HIGH_ONLY */ #define WLCWLUNIT(wlc) ((wlc)->pub->unit) @@ -315,22 +302,20 @@ typedef struct wlc_stf { /* * core state (mac) */ -typedef struct wlccore { -#ifdef WLC_LOW +struct wlccore { uint coreidx; /* # sb enumerated core */ /* fifo */ uint *txavail[NFIFO]; /* # tx descriptors available */ s16 txpktpend[NFIFO]; /* tx admission control */ -#endif /* WLC_LOW */ macstat_t *macstat_snapshot; /* mac hw prev read values */ -} wlccore_t; +}; /* * band state (phy+ana+radio) */ -typedef struct wlcband { +struct wlcband { int bandtype; /* WLC_BAND_2G, WLC_BAND_5G */ uint bandunit; /* bandstate[] index */ @@ -359,13 +344,13 @@ typedef struct wlcband { u16 CWmin; /* The minimum size of contention window, in unit of aSlotTime */ u16 CWmax; /* The maximum size of contention window, in unit of aSlotTime */ u16 bcntsfoff; /* beacon tsf offset */ -} wlcband_t; +}; /* generic function callback takes just one arg */ typedef void (*cb_fn_t) (void *); /* tx completion callback takes 3 args */ -typedef void (*pkcb_fn_t) (wlc_info_t *wlc, uint txstatus, void *arg); +typedef void (*pkcb_fn_t) (struct wlc_info *wlc, uint txstatus, void *arg); typedef struct pkt_cb { pkcb_fn_t fn; /* function to call when tx frame completes */ @@ -398,14 +383,14 @@ typedef struct dumpcb_s { /* virtual interface */ struct wlc_if { - wlc_if_t *next; + struct wlc_if *next; u8 type; /* WLC_IFTYPE_BSS or WLC_IFTYPE_WDS */ u8 index; /* assigned in wl_add_if(), index of the wlif if any, * not necessarily corresponding to bsscfg._idx or * AID2PVBMAP(scb). */ u8 flags; /* flags for the interface */ - wl_if_t *wlif; /* pointer to wlif */ + struct wl_if *wlif; /* pointer to wlif */ struct wlc_txq_info *qi; /* pointer to associated tx queue */ union { struct scb *scb; /* pointer to scb if WLC_IFTYPE_WDS */ @@ -416,7 +401,6 @@ struct wlc_if { /* flags for the interface */ #define WLC_IF_LINKED 0x02 /* this interface is linked to a wl_if */ -#ifdef WLC_LOW typedef struct wlc_hwband { int bandtype; /* WLC_BAND_2G, WLC_BAND_5G */ uint bandunit; /* bandstate[] index */ @@ -433,20 +417,15 @@ typedef struct wlc_hwband { wlc_phy_t *pi; /* pointer to phy specific information */ bool abgphy_encore; } wlc_hwband_t; -#endif /* WLC_LOW */ struct wlc_hw_info { -#ifdef WLC_SPLIT - rpc_info_t *rpc; /* Handle to RPC module */ -#endif - osl_t *osh; /* pointer to os handle */ + struct osl_info *osh; /* pointer to os handle */ bool _piomode; /* true if pio mode */ - wlc_info_t *wlc; + struct wlc_info *wlc; /* fifo */ - hnddma_t *di[NFIFO]; /* hnddma handles, per fifo */ + struct hnddma_pub *di[NFIFO]; /* hnddma handles, per fifo */ -#ifdef WLC_LOW uint unit; /* device instance number */ /* version info */ @@ -497,31 +476,21 @@ struct wlc_hw_info { bool forcefastclk; /* true if the h/w is forcing the use of fast clk */ bool clk; /* core is out of reset and has clock */ bool sbclk; /* sb has clock */ - bmac_pmq_t *bmac_pmq; /* bmac PM states derived from ucode PMQ */ + struct bmac_pmq *bmac_pmq; /* bmac PM states derived from ucode PMQ */ bool phyclk; /* phy is out of reset and has clock */ bool dma_lpbk; /* core is in DMA loopback */ -#ifdef BCMSDIO - void *sdh; -#endif bool ucode_loaded; /* true after ucode downloaded */ -#ifdef WLC_LOW_ONLY - struct wl_timer *wdtimer; /* timer for watchdog routine */ - struct ether_addr orig_etheraddr; /* original hw ethernet address */ - u16 rpc_dngl_agg; /* rpc agg control for dongle */ - u32 mem_required_def; /* memory required to replenish RX DMA ring */ - u32 mem_required_lower; /* memory required with lower RX bound */ - u32 mem_required_least; /* minimum memory requirement to handle RX */ - -#endif /* WLC_LOW_ONLY */ u8 hw_stf_ss_opmode; /* STF single stream operation mode */ u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board */ - u32 antsel_avail; /* put antsel_info_t here if more info is needed */ -#endif /* WLC_LOW */ + u32 antsel_avail; /* + * put struct antsel_info here if more info is + * needed + */ }; /* TX Queue information @@ -541,15 +510,12 @@ typedef struct wlc_txq_info { * Principal common (os-independent) software data structure. */ struct wlc_info { - wlc_pub_t *pub; /* pointer to wlc public state */ - osl_t *osh; /* pointer to os handle */ + struct wlc_pub *pub; /* pointer to wlc public state */ + struct osl_info *osh; /* pointer to os handle */ struct wl_info *wl; /* pointer to os-specific private state */ d11regs_t *regs; /* pointer to device registers */ - wlc_hw_info_t *hw; /* HW related state used primarily by BMAC */ -#ifdef WLC_SPLIT - rpc_info_t *rpc; /* Handle to RPC module */ -#endif + struct wlc_hw_info *hw; /* HW related state used primarily by BMAC */ /* clock */ int clkreq_override; /* setting for clkreq for PCIE : Auto, 0, 1 */ @@ -566,10 +532,11 @@ struct wlc_info { bool clk; /* core is out of reset and has clock */ /* multiband */ - wlccore_t *core; /* pointer to active io core */ - wlcband_t *band; /* pointer to active per-band state */ - wlccore_t *corestate; /* per-core state (one per hw core) */ - wlcband_t *bandstate[MAXBANDS]; /* per-band state (one per phy/radio) */ + struct wlccore *core; /* pointer to active io core */ + struct wlcband *band; /* pointer to active per-band state */ + struct wlccore *corestate; /* per-core state (one per hw core) */ + /* per-band state (one per phy/radio): */ + struct wlcband *bandstate[MAXBANDS]; bool war16165; /* PCI slow clock 16165 war flag */ @@ -584,15 +551,9 @@ struct wlc_info { s8 txpwr_local_max; /* regulatory local txpwr max */ u8 txpwr_local_constraint; /* local power contraint in dB */ -#ifdef WLC_HIGH_ONLY - rpctx_info_t *rpctx; /* RPC TX module */ - bool reset_bmac_pending; /* bmac reset is in progressing */ - u32 rpc_agg; /* host agg: bit 16-31, bmac agg: bit 0-15 */ - u32 rpc_msglevel; /* host rpc: bit 16-31, bmac rpc: bit 0-15 */ -#endif - ampdu_info_t *ampdu; /* ampdu module handler */ - antsel_info_t *asi; /* antsel module handler */ + struct ampdu_info *ampdu; /* ampdu module handler */ + struct antsel_info *asi; /* antsel module handler */ wlc_cm_info_t *cmi; /* channel manager module handler */ void *btparam; /* bus type specific cookie */ @@ -792,8 +753,6 @@ struct wlc_info { ac_bitmap_t apsd_trigger_ac; /* Permissible Acess Category in which APSD Null * Trigger frames can be send */ - wlc_ap_info_t *ap; - u8 htphy_membership; /* HT PHY membership */ bool _regulatory_domain; /* 802.11d enabled? */ @@ -811,7 +770,7 @@ struct wlc_info { u16 next_bsscfg_ID; - wlc_if_t *wlcif_list; /* linked list of wlc_if structs */ + struct wlc_if *wlcif_list; /* linked list of wlc_if structs */ wlc_txq_info_t *active_queue; /* txq for the currently active transmit context */ u32 mpc_dur; /* total time (ms) in mpc mode except for the * portion since radio is turned off last time @@ -825,8 +784,8 @@ struct wlc_info { /* antsel module specific state */ struct antsel_info { - wlc_info_t *wlc; /* pointer to main wlc structure */ - wlc_pub_t *pub; /* pointer to public fn */ + struct wlc_info *wlc; /* pointer to main wlc structure */ + struct wlc_pub *pub; /* pointer to public fn */ u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board */ @@ -842,23 +801,9 @@ struct antsel_info { #define IS_MBAND_UNLOCKED(wlc) \ ((NBANDS(wlc) > 1) && !(wlc)->bandlocked) -#ifdef WLC_LOW #define WLC_BAND_PI_RADIO_CHANSPEC wlc_phy_chanspec_get(wlc->band->pi) -#else -#define WLC_BAND_PI_RADIO_CHANSPEC (wlc->chanspec) -#endif /* sum the individual fifo tx pending packet counts */ -#if defined(WLC_HIGH_ONLY) -#define TXPKTPENDTOT(wlc) (wlc_rpctx_txpktpend((wlc)->rpctx, 0, true)) -#define TXPKTPENDGET(wlc, fifo) (wlc_rpctx_txpktpend((wlc)->rpctx, (fifo), false)) -#define TXPKTPENDINC(wlc, fifo, val) (wlc_rpctx_txpktpendinc((wlc)->rpctx, (fifo), (val))) -#define TXPKTPENDDEC(wlc, fifo, val) (wlc_rpctx_txpktpenddec((wlc)->rpctx, (fifo), (val))) -#define TXPKTPENDCLR(wlc, fifo) (wlc_rpctx_txpktpendclr((wlc)->rpctx, (fifo))) -#define TXAVAIL(wlc, fifo) (wlc_rpctx_txavail((wlc)->rpctx, (fifo))) -#define GETNEXTTXP(wlc, _queue) (wlc_rpctx_getnexttxp((wlc)->rpctx, (_queue))) - -#else #define TXPKTPENDTOT(wlc) ((wlc)->core->txpktpend[0] + (wlc)->core->txpktpend[1] + \ (wlc)->core->txpktpend[2] + (wlc)->core->txpktpend[3]) #define TXPKTPENDGET(wlc, fifo) ((wlc)->core->txpktpend[(fifo)]) @@ -868,48 +813,49 @@ struct antsel_info { #define TXAVAIL(wlc, fifo) (*(wlc)->core->txavail[(fifo)]) #define GETNEXTTXP(wlc, _queue) \ dma_getnexttxp((wlc)->hw->di[(_queue)], HNDDMA_RANGE_TRANSMITTED) -#endif /* WLC_HIGH_ONLY */ #define WLC_IS_MATCH_SSID(wlc, ssid1, ssid2, len1, len2) \ - ((len1 == len2) && !bcmp(ssid1, ssid2, len1)) - -/* API shared by both WLC_HIGH and WLC_LOW driver */ -extern void wlc_high_dpc(wlc_info_t *wlc, u32 macintstatus); -extern void wlc_fatal_error(wlc_info_t *wlc); -extern void wlc_bmac_rpc_watchdog(wlc_info_t *wlc); -extern void wlc_recv(wlc_info_t *wlc, void *p); -extern bool wlc_dotxstatus(wlc_info_t *wlc, tx_status_t *txs, u32 frm_tx2); -extern void wlc_txfifo(wlc_info_t *wlc, uint fifo, void *p, bool commit, - s8 txpktpend); -extern void wlc_txfifo_complete(wlc_info_t *wlc, uint fifo, s8 txpktpend); -extern void wlc_info_init(wlc_info_t *wlc, int unit); + ((len1 == len2) && !memcmp(ssid1, ssid2, len1)) + +extern void wlc_high_dpc(struct wlc_info *wlc, u32 macintstatus); +extern void wlc_fatal_error(struct wlc_info *wlc); +extern void wlc_bmac_rpc_watchdog(struct wlc_info *wlc); +extern void wlc_recv(struct wlc_info *wlc, struct sk_buff *p); +extern bool wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2); +extern void wlc_txfifo(struct wlc_info *wlc, uint fifo, struct sk_buff *p, + bool commit, s8 txpktpend); +extern void wlc_txfifo_complete(struct wlc_info *wlc, uint fifo, s8 txpktpend); +extern void wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu, + uint prec); +extern void wlc_info_init(struct wlc_info *wlc, int unit); extern void wlc_print_txstatus(tx_status_t *txs); -extern int wlc_xmtfifo_sz_get(wlc_info_t *wlc, uint fifo, uint *blocks); -extern void wlc_write_template_ram(wlc_info_t *wlc, int offset, int len, +extern int wlc_xmtfifo_sz_get(struct wlc_info *wlc, uint fifo, uint *blocks); +extern void wlc_write_template_ram(struct wlc_info *wlc, int offset, int len, void *buf); -extern void wlc_write_hw_bcntemplates(wlc_info_t *wlc, void *bcn, int len, +extern void wlc_write_hw_bcntemplates(struct wlc_info *wlc, void *bcn, int len, bool both); #if defined(BCMDBG) -extern void wlc_get_rcmta(wlc_info_t *wlc, int idx, struct ether_addr *addr); +extern void wlc_get_rcmta(struct wlc_info *wlc, int idx, + struct ether_addr *addr); #endif -extern void wlc_set_rcmta(wlc_info_t *wlc, int idx, +extern void wlc_set_rcmta(struct wlc_info *wlc, int idx, const struct ether_addr *addr); -extern void wlc_set_addrmatch(wlc_info_t *wlc, int match_reg_offset, +extern void wlc_set_addrmatch(struct wlc_info *wlc, int match_reg_offset, const struct ether_addr *addr); -extern void wlc_read_tsf(wlc_info_t *wlc, u32 *tsf_l_ptr, +extern void wlc_read_tsf(struct wlc_info *wlc, u32 *tsf_l_ptr, u32 *tsf_h_ptr); -extern void wlc_set_cwmin(wlc_info_t *wlc, u16 newmin); -extern void wlc_set_cwmax(wlc_info_t *wlc, u16 newmax); -extern void wlc_fifoerrors(wlc_info_t *wlc); -extern void wlc_pllreq(wlc_info_t *wlc, bool set, mbool req_bit); -extern void wlc_reset_bmac_done(wlc_info_t *wlc); -extern void wlc_protection_upd(wlc_info_t *wlc, uint idx, int val); -extern void wlc_hwtimer_gptimer_set(wlc_info_t *wlc, uint us); -extern void wlc_hwtimer_gptimer_abort(wlc_info_t *wlc); +extern void wlc_set_cwmin(struct wlc_info *wlc, u16 newmin); +extern void wlc_set_cwmax(struct wlc_info *wlc, u16 newmax); +extern void wlc_fifoerrors(struct wlc_info *wlc); +extern void wlc_pllreq(struct wlc_info *wlc, bool set, mbool req_bit); +extern void wlc_reset_bmac_done(struct wlc_info *wlc); +extern void wlc_protection_upd(struct wlc_info *wlc, uint idx, int val); +extern void wlc_hwtimer_gptimer_set(struct wlc_info *wlc, uint us); +extern void wlc_hwtimer_gptimer_abort(struct wlc_info *wlc); #if defined(BCMDBG) extern void wlc_print_rxh(d11rxhdr_t *rxh); -extern void wlc_print_hdrs(wlc_info_t *wlc, const char *prefix, u8 *frame, +extern void wlc_print_hdrs(struct wlc_info *wlc, const char *prefix, u8 *frame, d11txh_t *txh, d11rxhdr_t *rxh, uint len); extern void wlc_print_txdesc(d11txh_t *txh); #endif @@ -917,124 +863,126 @@ extern void wlc_print_txdesc(d11txh_t *txh); extern void wlc_print_dot11_mac_hdr(u8 *buf, int len); #endif -#ifdef WLC_LOW -extern void wlc_setxband(wlc_hw_info_t *wlc_hw, uint bandunit); -extern void wlc_coredisable(wlc_hw_info_t *wlc_hw); -#endif +extern void wlc_setxband(struct wlc_hw_info *wlc_hw, uint bandunit); +extern void wlc_coredisable(struct wlc_hw_info *wlc_hw); -extern bool wlc_valid_rate(wlc_info_t *wlc, ratespec_t rate, int band, +extern bool wlc_valid_rate(struct wlc_info *wlc, ratespec_t rate, int band, bool verbose); -extern void wlc_ap_upd(wlc_info_t *wlc); +extern void wlc_ap_upd(struct wlc_info *wlc); /* helper functions */ -extern void wlc_shm_ssid_upd(wlc_info_t *wlc, wlc_bsscfg_t *cfg); -extern int wlc_set_gmode(wlc_info_t *wlc, u8 gmode, bool config); +extern void wlc_shm_ssid_upd(struct wlc_info *wlc, wlc_bsscfg_t *cfg); +extern int wlc_set_gmode(struct wlc_info *wlc, u8 gmode, bool config); -extern void wlc_mac_bcn_promisc_change(wlc_info_t *wlc, bool promisc); -extern void wlc_mac_bcn_promisc(wlc_info_t *wlc); -extern void wlc_mac_promisc(wlc_info_t *wlc); -extern void wlc_txflowcontrol(wlc_info_t *wlc, wlc_txq_info_t *qi, bool on, +extern void wlc_mac_bcn_promisc_change(struct wlc_info *wlc, bool promisc); +extern void wlc_mac_bcn_promisc(struct wlc_info *wlc); +extern void wlc_mac_promisc(struct wlc_info *wlc); +extern void wlc_txflowcontrol(struct wlc_info *wlc, wlc_txq_info_t *qi, bool on, int prio); -extern void wlc_txflowcontrol_override(wlc_info_t *wlc, wlc_txq_info_t *qi, +extern void wlc_txflowcontrol_override(struct wlc_info *wlc, wlc_txq_info_t *qi, bool on, uint override); -extern bool wlc_txflowcontrol_prio_isset(wlc_info_t *wlc, wlc_txq_info_t *qi, - int prio); -extern void wlc_send_q(wlc_info_t *wlc, wlc_txq_info_t *qi); -extern int wlc_prep_pdu(wlc_info_t *wlc, void *pdu, uint *fifo); +extern bool wlc_txflowcontrol_prio_isset(struct wlc_info *wlc, + wlc_txq_info_t *qi, int prio); +extern void wlc_send_q(struct wlc_info *wlc, wlc_txq_info_t *qi); +extern int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifo); -extern u16 wlc_calc_lsig_len(wlc_info_t *wlc, ratespec_t ratespec, +extern u16 wlc_calc_lsig_len(struct wlc_info *wlc, ratespec_t ratespec, uint mac_len); -extern ratespec_t wlc_rspec_to_rts_rspec(wlc_info_t *wlc, ratespec_t rspec, +extern ratespec_t wlc_rspec_to_rts_rspec(struct wlc_info *wlc, ratespec_t rspec, bool use_rspec, u16 mimo_ctlchbw); -extern u16 wlc_compute_rtscts_dur(wlc_info_t *wlc, bool cts_only, +extern u16 wlc_compute_rtscts_dur(struct wlc_info *wlc, bool cts_only, ratespec_t rts_rate, ratespec_t frame_rate, u8 rts_preamble_type, u8 frame_preamble_type, uint frame_len, bool ba); -extern void wlc_tbtt(wlc_info_t *wlc, d11regs_t *regs); +extern void wlc_tbtt(struct wlc_info *wlc, d11regs_t *regs); #if defined(BCMDBG) -extern void wlc_dump_ie(wlc_info_t *wlc, bcm_tlv_t *ie, struct bcmstrbuf *b); +extern void wlc_dump_ie(struct wlc_info *wlc, bcm_tlv_t *ie, + struct bcmstrbuf *b); #endif -extern bool wlc_ps_check(wlc_info_t *wlc); -extern void wlc_reprate_init(wlc_info_t *wlc); +extern bool wlc_ps_check(struct wlc_info *wlc); +extern void wlc_reprate_init(struct wlc_info *wlc); extern void wlc_bsscfg_reprate_init(wlc_bsscfg_t *bsscfg); extern void wlc_uint64_sub(u32 *a_high, u32 *a_low, u32 b_high, u32 b_low); extern u32 wlc_calc_tbtt_offset(u32 bi, u32 tsf_h, u32 tsf_l); /* Shared memory access */ -extern void wlc_write_shm(wlc_info_t *wlc, uint offset, u16 v); -extern u16 wlc_read_shm(wlc_info_t *wlc, uint offset); -extern void wlc_set_shm(wlc_info_t *wlc, uint offset, u16 v, int len); -extern void wlc_copyto_shm(wlc_info_t *wlc, uint offset, const void *buf, +extern void wlc_write_shm(struct wlc_info *wlc, uint offset, u16 v); +extern u16 wlc_read_shm(struct wlc_info *wlc, uint offset); +extern void wlc_set_shm(struct wlc_info *wlc, uint offset, u16 v, int len); +extern void wlc_copyto_shm(struct wlc_info *wlc, uint offset, const void *buf, int len); -extern void wlc_copyfrom_shm(wlc_info_t *wlc, uint offset, void *buf, int len); +extern void wlc_copyfrom_shm(struct wlc_info *wlc, uint offset, void *buf, + int len); -extern void wlc_update_beacon(wlc_info_t *wlc); -extern void wlc_bss_update_beacon(wlc_info_t *wlc, struct wlc_bsscfg *bsscfg); +extern void wlc_update_beacon(struct wlc_info *wlc); +extern void wlc_bss_update_beacon(struct wlc_info *wlc, + struct wlc_bsscfg *bsscfg); -extern void wlc_update_probe_resp(wlc_info_t *wlc, bool suspend); -extern void wlc_bss_update_probe_resp(wlc_info_t *wlc, wlc_bsscfg_t *cfg, +extern void wlc_update_probe_resp(struct wlc_info *wlc, bool suspend); +extern void wlc_bss_update_probe_resp(struct wlc_info *wlc, wlc_bsscfg_t *cfg, bool suspend); -extern bool wlc_ismpc(wlc_info_t *wlc); -extern bool wlc_is_non_delay_mpc(wlc_info_t *wlc); -extern void wlc_radio_mpc_upd(wlc_info_t *wlc); -extern bool wlc_prec_enq(wlc_info_t *wlc, struct pktq *q, void *pkt, int prec); -extern bool wlc_prec_enq_head(wlc_info_t *wlc, struct pktq *q, void *pkt, - int prec, bool head); -extern u16 wlc_phytxctl1_calc(wlc_info_t *wlc, ratespec_t rspec); -extern void wlc_compute_plcp(wlc_info_t *wlc, ratespec_t rate, uint length, +extern bool wlc_ismpc(struct wlc_info *wlc); +extern bool wlc_is_non_delay_mpc(struct wlc_info *wlc); +extern void wlc_radio_mpc_upd(struct wlc_info *wlc); +extern bool wlc_prec_enq(struct wlc_info *wlc, struct pktq *q, void *pkt, + int prec); +extern bool wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, + struct sk_buff *pkt, int prec, bool head); +extern u16 wlc_phytxctl1_calc(struct wlc_info *wlc, ratespec_t rspec); +extern void wlc_compute_plcp(struct wlc_info *wlc, ratespec_t rate, uint length, u8 *plcp); -extern uint wlc_calc_frame_time(wlc_info_t *wlc, ratespec_t ratespec, +extern uint wlc_calc_frame_time(struct wlc_info *wlc, ratespec_t ratespec, u8 preamble_type, uint mac_len); -extern void wlc_set_chanspec(wlc_info_t *wlc, chanspec_t chanspec); +extern void wlc_set_chanspec(struct wlc_info *wlc, chanspec_t chanspec); -extern bool wlc_timers_init(wlc_info_t *wlc, int unit); +extern bool wlc_timers_init(struct wlc_info *wlc, int unit); extern const bcm_iovar_t wlc_iovars[]; extern int wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid, const char *name, void *params, uint p_len, void *arg, - int len, int val_size, wlc_if_t *wlcif); + int len, int val_size, struct wlc_if *wlcif); #if defined(BCMDBG) -extern void wlc_print_ies(wlc_info_t *wlc, u8 *ies, uint ies_len); +extern void wlc_print_ies(struct wlc_info *wlc, u8 *ies, uint ies_len); #endif -extern int wlc_set_nmode(wlc_info_t *wlc, s32 nmode); -extern void wlc_ht_mimops_cap_update(wlc_info_t *wlc, u8 mimops_mode); -extern void wlc_mimops_action_ht_send(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg, - u8 mimops_mode); +extern int wlc_set_nmode(struct wlc_info *wlc, s32 nmode); +extern void wlc_ht_mimops_cap_update(struct wlc_info *wlc, u8 mimops_mode); +extern void wlc_mimops_action_ht_send(struct wlc_info *wlc, + wlc_bsscfg_t *bsscfg, u8 mimops_mode); -extern void wlc_switch_shortslot(wlc_info_t *wlc, bool shortslot); +extern void wlc_switch_shortslot(struct wlc_info *wlc, bool shortslot); extern void wlc_set_bssid(wlc_bsscfg_t *cfg); extern void wlc_edcf_setparams(wlc_bsscfg_t *cfg, bool suspend); -extern void wlc_wme_setparams(wlc_info_t *wlc, u16 aci, void *arg, - bool suspend); -extern void wlc_set_ratetable(wlc_info_t *wlc); +extern void wlc_set_ratetable(struct wlc_info *wlc); extern int wlc_set_mac(wlc_bsscfg_t *cfg); -extern void wlc_beacon_phytxctl_txant_upd(wlc_info_t *wlc, +extern void wlc_beacon_phytxctl_txant_upd(struct wlc_info *wlc, ratespec_t bcn_rate); -extern void wlc_mod_prb_rsp_rate_table(wlc_info_t *wlc, uint frame_len); -extern ratespec_t wlc_lowest_basic_rspec(wlc_info_t *wlc, wlc_rateset_t *rs); -extern u16 wlc_compute_bcntsfoff(wlc_info_t *wlc, ratespec_t rspec, +extern void wlc_mod_prb_rsp_rate_table(struct wlc_info *wlc, uint frame_len); +extern ratespec_t wlc_lowest_basic_rspec(struct wlc_info *wlc, + wlc_rateset_t *rs); +extern u16 wlc_compute_bcntsfoff(struct wlc_info *wlc, ratespec_t rspec, bool short_preamble, bool phydelay); -extern void wlc_radio_disable(wlc_info_t *wlc); -extern void wlc_bcn_li_upd(wlc_info_t *wlc); - -extern int wlc_get_revision_info(wlc_info_t *wlc, void *buf, uint len); -extern void wlc_out(wlc_info_t *wlc); -extern void wlc_set_home_chanspec(wlc_info_t *wlc, chanspec_t chanspec); -extern void wlc_watchdog_upd(wlc_info_t *wlc, bool tbtt); -extern bool wlc_ps_allowed(wlc_info_t *wlc); -extern bool wlc_stay_awake(wlc_info_t *wlc); -extern void wlc_wme_initparams_sta(wlc_info_t *wlc, wme_param_ie_t *pe); - -extern void wlc_bss_list_free(wlc_info_t *wlc, wlc_bss_list_t *bss_list); +extern void wlc_radio_disable(struct wlc_info *wlc); +extern void wlc_bcn_li_upd(struct wlc_info *wlc); + +extern int wlc_get_revision_info(struct wlc_info *wlc, void *buf, uint len); +extern void wlc_out(struct wlc_info *wlc); +extern void wlc_set_home_chanspec(struct wlc_info *wlc, chanspec_t chanspec); +extern void wlc_watchdog_upd(struct wlc_info *wlc, bool tbtt); +extern bool wlc_ps_allowed(struct wlc_info *wlc); +extern bool wlc_stay_awake(struct wlc_info *wlc); +extern void wlc_wme_initparams_sta(struct wlc_info *wlc, wme_param_ie_t *pe); + +extern void wlc_bss_list_free(struct wlc_info *wlc, wlc_bss_list_t *bss_list); +extern void wlc_ht_mimops_cap_update(struct wlc_info *wlc, u8 mimops_mode); #endif /* _wlc_h_ */ diff --git a/drivers/staging/brcm80211/sys/wlc_phy_shim.c b/drivers/staging/brcm80211/sys/wlc_phy_shim.c index bf8e2e1..8bd4ede 100644 --- a/drivers/staging/brcm80211/sys/wlc_phy_shim.c +++ b/drivers/staging/brcm80211/sys/wlc_phy_shim.c @@ -24,9 +24,10 @@ #include <linux/kernel.h> #include <bcmdefs.h> #include <wlc_cfg.h> -#include <linuxver.h> -#include <bcmutils.h> +#include <linux/module.h> +#include <linux/pci.h> #include <osl.h> +#include <bcmutils.h> #include <proto/802.11.h> #include <bcmwifi.h> @@ -46,6 +47,7 @@ #include <wlc_channel.h> #include <bcmsrom.h> #include <wlc_key.h> +#include <wlc_event.h> #include <wlc_mac80211.h> @@ -53,21 +55,23 @@ #include <wlc_phy_shim.h> #include <wlc_phy_hal.h> #include <wl_export.h> +#include <wl_dbg.h> /* PHY SHIM module specific state */ struct wlc_phy_shim_info { - wlc_hw_info_t *wlc_hw; /* pointer to main wlc_hw structure */ + struct wlc_hw_info *wlc_hw; /* pointer to main wlc_hw structure */ void *wlc; /* pointer to main wlc structure */ void *wl; /* pointer to os-specific private state */ }; -wlc_phy_shim_info_t *wlc_phy_shim_attach(wlc_hw_info_t *wlc_hw, +wlc_phy_shim_info_t *wlc_phy_shim_attach(struct wlc_hw_info *wlc_hw, void *wl, void *wlc) { wlc_phy_shim_info_t *physhim = NULL; physhim = kzalloc(sizeof(wlc_phy_shim_info_t), GFP_ATOMIC); if (!physhim) { - WL_ERROR(("wl%d: wlc_phy_shim_attach: out of mem\n", wlc_hw->unit)); + WL_ERROR("wl%d: wlc_phy_shim_attach: out of mem\n", + wlc_hw->unit); return NULL; } physhim->wlc_hw = wlc_hw; diff --git a/drivers/staging/brcm80211/sys/wlc_pub.h b/drivers/staging/brcm80211/sys/wlc_pub.h index a6a8c33..146a690 100644 --- a/drivers/staging/brcm80211/sys/wlc_pub.h +++ b/drivers/staging/brcm80211/sys/wlc_pub.h @@ -251,7 +251,7 @@ typedef int (*iovar_fn_t) (void *handle, const bcm_iovar_t *vi, * Public portion of "common" os-independent state structure. * The wlc handle points at this. */ -typedef struct wlc_pub { +struct wlc_pub { void *wlc; struct ieee80211_hw *ieee_hw; @@ -260,7 +260,7 @@ typedef struct wlc_pub { uint mac80211_state; uint unit; /* device instance number */ uint corerev; /* core revision */ - osl_t *osh; /* pointer to os handle */ + struct osl_info *osh; /* pointer to os handle */ si_t *sih; /* SB handle (cookie for siutils calls) */ char *vars; /* "environment" name=value */ bool up; /* interface up and running */ @@ -318,9 +318,6 @@ typedef struct wlc_pub { * is implemented properly in osl of that port * when it enables this Power Save feature. */ -#ifdef BCMSDIO - uint sdiod_drive_strength; /* SDIO drive strength */ -#endif /* BCMSDIO */ u16 boardrev; /* version # of particular board */ u8 sromrev; /* version # of the srom */ @@ -333,7 +330,7 @@ typedef struct wlc_pub { bool _lmacproto; /* lmac protocol module included and enabled */ bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */ bool _ampdumac; /* mac assist ampdu enabled or not */ -} wlc_pub_t; +}; /* wl_monitor rx status per packet */ typedef struct wl_rxsts { @@ -437,17 +434,13 @@ struct wlc_if; #define EDCF_ENAB(pub) (WME_ENAB(pub)) #define QOS_ENAB(pub) (WME_ENAB(pub) || N_ENAB(pub)) -#define MONITOR_ENAB(wlc) (bcmspace && (wlc)->monitor) - -#define PROMISC_ENAB(wlc) (bcmspace && (wlc)->promisc) - -extern void wlc_pkttag_info_move(wlc_pub_t *pub, void *pkt_from, void *pkt_to); +#define MONITOR_ENAB(wlc) ((wlc)->monitor) -#define WLPKTTAGSCB(p) (WLPKTTAG(p)->_scb) +#define PROMISC_ENAB(wlc) ((wlc)->promisc) #define WLC_PREC_COUNT 16 /* Max precedence level implemented */ -/* pri is PKTPRIO encoded in the packet. This maps the Packet priority to +/* pri is priority encoded in the packet. This maps the Packet priority to * enqueue precedence as defined in wlc_prec_map */ extern const u8 wlc_prio2prec_map[]; @@ -497,8 +490,8 @@ extern const u8 wme_fifo2ac[]; /* common functions for every port */ extern void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, - bool piomode, osl_t *osh, void *regsva, uint bustype, - void *btparam, uint *perr); + bool piomode, struct osl_info *osh, void *regsva, + uint bustype, void *btparam, uint *perr); extern uint wlc_detach(struct wlc_info *wlc); extern int wlc_up(struct wlc_info *wlc); extern uint wlc_down(struct wlc_info *wlc); @@ -517,8 +510,10 @@ extern void wlc_intrsrestore(struct wlc_info *wlc, u32 macintmask); extern bool wlc_intrsupd(struct wlc_info *wlc); extern bool wlc_isr(struct wlc_info *wlc, bool *wantdpc); extern bool wlc_dpc(struct wlc_info *wlc, bool bounded); -extern bool wlc_send80211_raw(struct wlc_info *wlc, wlc_if_t *wlcif, void *p, - uint ac); +extern bool wlc_send80211_raw(struct wlc_info *wlc, struct wlc_if *wlcif, + void *p, uint ac); +extern bool wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu, + struct ieee80211_hw *hw); extern int wlc_iovar_op(struct wlc_info *wlc, const char *name, void *params, int p_len, void *arg, int len, bool set, struct wlc_if *wlcif); @@ -527,8 +522,13 @@ extern int wlc_ioctl(struct wlc_info *wlc, int cmd, void *arg, int len, /* helper functions */ extern void wlc_statsupd(struct wlc_info *wlc); extern int wlc_get_header_len(void); +extern void wlc_mac_bcn_promisc_change(struct wlc_info *wlc, bool promisc); +extern void wlc_set_addrmatch(struct wlc_info *wlc, int match_reg_offset, + const struct ether_addr *addr); +extern void wlc_wme_setparams(struct wlc_info *wlc, u16 aci, void *arg, + bool suspend); -extern wlc_pub_t *wlc_pub(void *wlc); +extern struct wlc_pub *wlc_pub(void *wlc); /* common functions for every port */ extern int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw); @@ -554,13 +554,15 @@ extern void wlc_scb_ratesel_init_all(struct wlc_info *wlc); /* ioctl */ extern int wlc_iovar_gets8(struct wlc_info *wlc, const char *name, s8 *arg); -extern int wlc_iovar_check(wlc_pub_t *pub, const bcm_iovar_t *vi, void *arg, +extern int wlc_iovar_check(struct wlc_pub *pub, const bcm_iovar_t *vi, + void *arg, int len, bool set); -extern int wlc_module_register(wlc_pub_t *pub, const bcm_iovar_t *iovars, +extern int wlc_module_register(struct wlc_pub *pub, const bcm_iovar_t *iovars, const char *name, void *hdl, iovar_fn_t iovar_fn, watchdog_fn_t watchdog_fn, down_fn_t down_fn); -extern int wlc_module_unregister(wlc_pub_t *pub, const char *name, void *hdl); +extern int wlc_module_unregister(struct wlc_pub *pub, const char *name, + void *hdl); extern void wlc_event_if(struct wlc_info *wlc, struct wlc_bsscfg *cfg, wlc_event_t *e, const struct ether_addr *addr); extern void wlc_suspend_mac_and_wait(struct wlc_info *wlc); @@ -617,10 +619,6 @@ extern void wlc_pmkid_event(struct wlc_bsscfg *cfg); #define BAND_2G_NAME "2.4G" #define BAND_5G_NAME "5G" -#if defined(BCMSDIO) || defined(WLC_HIGH_ONLY) -void wlc_device_removed(void *arg); -#endif - /* BMAC RPC: 7 u32 params: pkttotlen, fifo, commit, fid, txpktpend, pktflag, rpc_id */ #define WLC_RPCTX_PARAMS 32 diff --git a/drivers/staging/brcm80211/sys/wlc_rate.c b/drivers/staging/brcm80211/sys/wlc_rate.c index d2d7256..ab7d0be 100644 --- a/drivers/staging/brcm80211/sys/wlc_rate.c +++ b/drivers/staging/brcm80211/sys/wlc_rate.c @@ -17,12 +17,14 @@ #include <bcmdefs.h> #include <wlc_cfg.h> #include <osl.h> -#include <linuxver.h> +#include <linux/module.h> #include <bcmutils.h> #include <siutils.h> #include <bcmendian.h> #include <wlioctl.h> +#include <sbhndpio.h> +#include <sbhnddma.h> #include <proto/802.11.h> #include <d11.h> #include <wlc_rate.h> @@ -297,7 +299,7 @@ wlc_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs, uint count; uint i; - bzero(rateset, sizeof(rateset)); + memset(rateset, 0, sizeof(rateset)); count = rs->count; for (i = 0; i < count; i++) { diff --git a/drivers/staging/brcm80211/sys/wlc_rpc.h b/drivers/staging/brcm80211/sys/wlc_rpc.h deleted file mode 100644 index db39645..0000000 --- a/drivers/staging/brcm80211/sys/wlc_rpc.h +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _WLC_RPC_H_ -#define _WLC_RPC_H_ - -#include <wlc_types.h> - -/* RPC IDs, reordering is OK. This needs to be in sync with RPC_ID_TABLE below */ -typedef enum { - WLRPC_NULL_ID = 0, - WLRPC_WLC_REG_READ_ID, - WLRPC_WLC_REG_WRITE_ID, - WLRPC_WLC_MHF_SET_ID, - WLRPC_WLC_MHF_GET_ID, - WLRPC_WLC_BMAC_UP_PREP_ID, - WLRPC_WLC_BMAC_UP_FINISH_ID, - WLRPC_WLC_BMAC_DOWN_PREP_ID, - WLRPC_WLC_BMAC_DOWN_FINISH_ID, - WLRPC_WLC_BMAC_WRITE_HW_BCNTEMPLATES_ID, - WLRPC_WLC_BMAC_RESET_ID, - WLRPC_WLC_DNGL_REBOOT_ID, - WLRPC_WLC_BMAC_RPC_TXQ_WM_SET_ID, - WLRPC_WLC_BMAC_RPC_TXQ_WM_GET_ID, - WLRPC_WLC_BMAC_RPC_AGG_SET_ID, - WLRPC_WLC_BMAC_RPC_MSGLEVEL_SET_ID, - WLRPC_WLC_BMAC_RPC_AGG_LIMIT_SET_ID, - WLRPC_WLC_BMAC_RPC_AGG_LIMIT_GET_ID, - WLRPC_WLC_BMAC_INIT_ID, - WLRPC_WLC_BMAC_SET_CWMIN_ID, - WLRPC_WLC_BMAC_MUTE_ID, - WLRPC_WLC_PHY_DOIOVAR_ID, - WLRPC_WLC_PHY_HOLD_UPD_ID, - WLRPC_WLC_PHY_MUTE_UPD_ID, - WLRPC_WLC_PHY_CLEAR_TSSI_ID, - WLRPC_WLC_PHY_ANT_RXDIV_GET_ID, - WLRPC_WLC_PHY_ANT_RXDIV_SET_ID, - WLRPC_WLC_PHY_PREAMBLE_SET_ID, - WLRPC_WLC_PHY_FREQTRACK_END_ID, - WLRPC_WLC_PHY_FREQTRACK_START_ID, - WLRPC_WLC_PHY_IOCTL_ID, - WLRPC_WLC_PHY_NOISE_SAMPLE_REQUEST_ID, - WLRPC_WLC_PHY_CAL_PERICAL_ID, - WLRPC_WLC_PHY_TXPOWER_GET_ID, - WLRPC_WLC_PHY_TXPOWER_SET_ID, - WLRPC_WLC_PHY_TXPOWER_SROMLIMIT_ID, - WLRPC_WLC_PHY_RADAR_DETECT_ENABLE_ID, - WLRPC_WLC_PHY_RADAR_DETECT_RUN_ID, - WLRPC_WLC_PHY_TEST_ISON_ID, - WLRPC_WLC_BMAC_COPYFROM_OBJMEM_ID, - WLRPC_WLC_BMAC_COPYTO_OBJMEM_ID, - WLRPC_WLC_ENABLE_MAC_ID, - WLRPC_WLC_MCTRL_ID, - WLRPC_WLC_CORERESET_ID, - WLRPC_WLC_BMAC_READ_SHM_ID, - WLRPC_WLC_BMAC_READ_TSF_ID, - WLRPC_WLC_BMAC_SET_ADDRMATCH_ID, - WLRPC_WLC_BMAC_SET_CWMAX_ID, - WLRPC_WLC_BMAC_SET_RCMTA_ID, - WLRPC_WLC_BMAC_SET_SHM_ID, - WLRPC_WLC_SUSPEND_MAC_AND_WAIT_ID, - WLRPC_WLC_BMAC_WRITE_SHM_ID, - WLRPC_WLC_BMAC_WRITE_TEMPLATE_RAM_ID, - WLRPC_WLC_TX_FIFO_SUSPEND_ID, - WLRPC_WLC_TX_FIFO_RESUME_ID, - WLRPC_WLC_TX_FIFO_SUSPENDED_ID, - WLRPC_WLC_HW_ETHERADDR_ID, - WLRPC_WLC_SET_HW_ETHERADDR_ID, - WLRPC_WLC_BMAC_CHANSPEC_SET_ID, - WLRPC_WLC_BMAC_TXANT_SET_ID, - WLRPC_WLC_BMAC_ANTSEL_TYPE_SET_ID, - WLRPC_WLC_BMAC_TXFIFO_ID, - WLRPC_WLC_RADIO_READ_HWDISABLED_ID, - WLRPC_WLC_RM_CCA_MEASURE_ID, - WLRPC_WLC_SET_SHORTSLOT_ID, - WLRPC_WLC_WAIT_FOR_WAKE_ID, - WLRPC_WLC_PHY_TXPOWER_GET_CURRENT_ID, - WLRPC_WLC_PHY_TXPOWER_HW_CTRL_GET_ID, - WLRPC_WLC_PHY_TXPOWER_HW_CTRL_SET_ID, - WLRPC_WLC_PHY_BSSINIT_ID, - WLRPC_WLC_BAND_STF_SS_SET_ID, - WLRPC_WLC_PHY_BAND_FIRST_CHANSPEC_ID, - WLRPC_WLC_PHY_TXPOWER_LIMIT_SET_ID, - WLRPC_WLC_PHY_BAND_CHANNELS_ID, - WLRPC_WLC_BMAC_REVINFO_GET_ID, - WLRPC_WLC_BMAC_STATE_GET_ID, - WLRPC_WLC_BMAC_XMTFIFO_SZ_GET_ID, - WLRPC_WLC_BMAC_XMTFIFO_SZ_SET_ID, - WLRPC_WLC_BMAC_VALIDATE_CHIP_ACCESS_ID, - WLRPC_WLC_RM_CCA_COMPLETE_ID, - WLRPC_WLC_RECV_ID, - WLRPC_WLC_DOTXSTATUS_ID, - WLRPC_WLC_HIGH_DPC_ID, - WLRPC_WLC_FATAL_ERROR_ID, - WLRPC_WLC_PHY_SET_CHANNEL_14_WIDE_FILTER_ID, - WLRPC_WLC_PHY_NOISE_AVG_ID, - WLRPC_WLC_PHYCHAIN_INIT_ID, - WLRPC_WLC_PHYCHAIN_SET_ID, - WLRPC_WLC_PHYCHAIN_GET_ID, - WLRPC_WLC_PHY_TKIP_RIFS_WAR_ID, - WLRPC_WLC_BMAC_COPYFROM_VARS_ID, - WLRPC_WLC_BMAC_RETRYLIMIT_UPD_ID, - WLRPC_WLC_BMAC_BTC_MODE_SET_ID, - WLRPC_WLC_BMAC_BTC_MODE_GET_ID, - WLRPC_WLC_BMAC_BTC_WIRE_SET_ID, - WLRPC_WLC_BMAC_BTC_WIRE_GET_ID, - WLRPC_WLC_BMAC_SET_NORESET_ID, - WLRPC_WLC_AMPDU_TXSTATUS_COMPLETE_ID, - WLRPC_WLC_BMAC_FIFOERRORS_ID, - WLRPC_WLC_PHY_TXPOWER_GET_TARGET_MIN_ID, - WLRPC_WLC_PHY_TXPOWER_GET_TARGET_MAX_ID, - WLRPC_WLC_NOISE_CB_ID, - WLRPC_WLC_BMAC_LED_HW_DEINIT_ID, - WLRPC_WLC_BMAC_LED_HW_MASK_INIT_ID, - WLRPC_WLC_PLLREQ_ID, - WLRPC_WLC_BMAC_TACLEAR_ID, - WLRPC_WLC_BMAC_SET_CLK_ID, - WLRPC_WLC_PHY_OFDM_RATESET_WAR_ID, - WLRPC_WLC_PHY_BF_PREEMPT_ENABLE_ID, - WLRPC_WLC_BMAC_DOIOVARS_ID, - WLRPC_WLC_BMAC_DUMP_ID, - WLRPC_WLC_CISWRITE_ID, - WLRPC_WLC_CISDUMP_ID, - WLRPC_WLC_UPDATE_PHY_MODE_ID, - WLRPC_WLC_RESET_BMAC_DONE_ID, - WLRPC_WLC_BMAC_LED_BLINK_EVENT_ID, - WLRPC_WLC_BMAC_LED_SET_ID, - WLRPC_WLC_BMAC_LED_BLINK_ID, - WLRPC_WLC_BMAC_LED_ID, - WLRPC_WLC_BMAC_RATE_SHM_OFFSET_ID, - WLRPC_SI_ISCORE_UP_ID, - WLRPC_WLC_BMAC_PS_SWITCH_ID, - WLRPC_WLC_PHY_STF_SSMODE_GET_ID, - WLRPC_WLC_BMAC_DEBUG_ID, - WLRPC_WLC_EXTLOG_MSG_ID, - WLRPC_WLC_EXTLOG_CFG_ID, - WLRPC_BCM_ASSERT_LOG_ID, - WLRPC_BCM_ASSERT_TYPE_ID, - WLRPC_WLC_BMAC_SET_PHYCAL_CACHE_FLAG_ID, - WLRPC_WLC_BMAC_GET_PHYCAL_CACHE_FLAG_ID, - WLRPC_WLC_PHY_CAL_CACHE_INIT_ID, - WLRPC_WLC_PHY_CAL_CACHE_DEINIT_ID, - WLRPC_WLC_BMAC_HW_UP_ID, - WLRPC_WLC_BMAC_SET_TXPWR_PERCENT_ID, - WLRPC_WLC_PHYCHAIN_ACTIVE_GET_ID, - WLRPC_WLC_BMAC_BLINK_SYNC_ID, - WLRPC_WLC_BMAC_UCODE_DBGSEL_SET_ID, - WLRPC_WLC_BMAC_UCODE_DBGSEL_GET_ID, - WLRPC_WLC_PHY_RADAR_DETECT_MODE_SET_ID, - WLRPC_WLC_PHY_ACIM_NOISEM_RESET_NPHY_ID, - WLRPC_WLC_PHY_INTERFER_SET_NPHY_ID, - WLRPC_WLC_BMAC_IFSCTL_EDCRS_SET_ID, - WLRPC_WLC_PKTENGTX, - WLRPC_WLC_BMAC_SET_DEAF, - WLRPC_WLC_BMAC_CLEAR_DEAF, - WLRPC_WLC_BMAC_BTC_FLAGS_SET_ID, - WLRPC_WLC_BMAC_BTC_FLAGS_GET_ID, - WLRPC_WLC_BMAC_SET_RCMTA_TYPE_ID, - WLRPC_WLC_BMAC_BTC_FLAGS_UPD_ID, - WLRPC_WLC_BMAC_BTC_STUCKWAR_ID, - WLRPC_WLC_BMAC_CCA_STATS_READ_ID, - WLRPC_WLC_BMAC_ANTSEL_SET_ID, - WLRPC_WLC_BMAC_SET_UCODE_LOADED, - WLRPC_WLC_PHY_LDPC_SET_ID, - - WLRPC_LAST -} wlc_rpc_id_t; - -#if defined(BCMDBG) | 0 -struct name_entry { - int id; - char *name; -}; - -#define NAME_ENTRY(x) {x, #x} - -#define RPC_ID_TABLE { \ - NAME_ENTRY(WLRPC_WLC_REG_READ_ID), \ - NAME_ENTRY(WLRPC_WLC_REG_WRITE_ID), \ - NAME_ENTRY(WLRPC_WLC_MHF_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_MHF_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_UP_PREP_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_UP_FINISH_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_DOWN_PREP_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_DOWN_FINISH_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_WRITE_HW_BCNTEMPLATES_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RESET_ID), \ - NAME_ENTRY(WLRPC_WLC_DNGL_REBOOT_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RPC_TXQ_WM_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RPC_TXQ_WM_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RPC_AGG_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RPC_MSGLEVEL_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RPC_AGG_LIMIT_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RPC_AGG_LIMIT_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_INIT_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_CWMIN_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_MUTE_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_DOIOVAR_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_HOLD_UPD_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_MUTE_UPD_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_CLEAR_TSSI_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_ANT_RXDIV_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_ANT_RXDIV_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_PREAMBLE_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_FREQTRACK_END_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_FREQTRACK_START_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_IOCTL_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_NOISE_SAMPLE_REQUEST_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_CAL_PERICAL_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_SROMLIMIT_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_RADAR_DETECT_ENABLE_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_RADAR_DETECT_RUN_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TEST_ISON_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_COPYFROM_OBJMEM_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_COPYTO_OBJMEM_ID), \ - NAME_ENTRY(WLRPC_WLC_ENABLE_MAC_ID), \ - NAME_ENTRY(WLRPC_WLC_MCTRL_ID), \ - NAME_ENTRY(WLRPC_WLC_CORERESET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_READ_SHM_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_READ_TSF_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_ADDRMATCH_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_CWMAX_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_RCMTA_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_SHM_ID), \ - NAME_ENTRY(WLRPC_WLC_SUSPEND_MAC_AND_WAIT_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_WRITE_SHM_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_WRITE_TEMPLATE_RAM_ID), \ - NAME_ENTRY(WLRPC_WLC_TX_FIFO_SUSPEND_ID), \ - NAME_ENTRY(WLRPC_WLC_TX_FIFO_RESUME_ID), \ - NAME_ENTRY(WLRPC_WLC_TX_FIFO_SUSPENDED_ID), \ - NAME_ENTRY(WLRPC_WLC_HW_ETHERADDR_ID), \ - NAME_ENTRY(WLRPC_WLC_SET_HW_ETHERADDR_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_CHANSPEC_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_TXANT_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_ANTSEL_TYPE_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_TXFIFO_ID), \ - NAME_ENTRY(WLRPC_WLC_RADIO_READ_HWDISABLED_ID), \ - NAME_ENTRY(WLRPC_WLC_RM_CCA_MEASURE_ID), \ - NAME_ENTRY(WLRPC_WLC_SET_SHORTSLOT_ID), \ - NAME_ENTRY(WLRPC_WLC_WAIT_FOR_WAKE_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_GET_CURRENT_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_HW_CTRL_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_HW_CTRL_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_BSSINIT_ID), \ - NAME_ENTRY(WLRPC_WLC_BAND_STF_SS_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_BAND_FIRST_CHANSPEC_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_LIMIT_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_BAND_CHANNELS_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_REVINFO_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_STATE_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_XMTFIFO_SZ_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_XMTFIFO_SZ_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_VALIDATE_CHIP_ACCESS_ID), \ - NAME_ENTRY(WLRPC_WLC_RM_CCA_COMPLETE_ID), \ - NAME_ENTRY(WLRPC_WLC_RECV_ID), \ - NAME_ENTRY(WLRPC_WLC_DOTXSTATUS_ID), \ - NAME_ENTRY(WLRPC_WLC_HIGH_DPC_ID), \ - NAME_ENTRY(WLRPC_WLC_FATAL_ERROR_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_SET_CHANNEL_14_WIDE_FILTER_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_NOISE_AVG_ID), \ - NAME_ENTRY(WLRPC_WLC_PHYCHAIN_INIT_ID), \ - NAME_ENTRY(WLRPC_WLC_PHYCHAIN_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHYCHAIN_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TKIP_RIFS_WAR_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_COPYFROM_VARS_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RETRYLIMIT_UPD_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_BTC_MODE_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_BTC_MODE_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_BTC_WIRE_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_BTC_WIRE_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_NORESET_ID), \ - NAME_ENTRY(WLRPC_WLC_AMPDU_TXSTATUS_COMPLETE_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_FIFOERRORS_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_GET_TARGET_MIN_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_TXPOWER_GET_TARGET_MAX_ID), \ - NAME_ENTRY(WLRPC_WLC_NOISE_CB_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_LED_HW_DEINIT_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_LED_HW_MASK_INIT_ID), \ - NAME_ENTRY(WLRPC_WLC_PLLREQ_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_TACLEAR_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_CLK_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_OFDM_RATESET_WAR_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_BF_PREEMPT_ENABLE_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_DOIOVARS_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_DUMP_ID), \ - NAME_ENTRY(WLRPC_WLC_CISWRITE_ID), \ - NAME_ENTRY(WLRPC_WLC_CISDUMP_ID), \ - NAME_ENTRY(WLRPC_WLC_UPDATE_PHY_MODE_ID), \ - NAME_ENTRY(WLRPC_WLC_RESET_BMAC_DONE_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_LED_BLINK_EVENT_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_LED_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_LED_BLINK_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_LED_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_RATE_SHM_OFFSET_ID), \ - NAME_ENTRY(WLRPC_SI_ISCORE_UP_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_PS_SWITCH_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_STF_SSMODE_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_DEBUG_ID), \ - NAME_ENTRY(WLRPC_WLC_EXTLOG_MSG_ID), \ - NAME_ENTRY(WLRPC_WLC_EXTLOG_CFG_ID), \ - NAME_ENTRY(WLRPC_BCM_ASSERT_LOG_ID), \ - NAME_ENTRY(WLRPC_BCM_ASSERT_TYPE_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_PHYCAL_CACHE_FLAG_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_GET_PHYCAL_CACHE_FLAG_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_CAL_CACHE_INIT_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_CAL_CACHE_DEINIT_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_HW_UP_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_TXPWR_PERCENT_ID), \ - NAME_ENTRY(WLRPC_WLC_PHYCHAIN_ACTIVE_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_BLINK_SYNC_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_UCODE_DBGSEL_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_UCODE_DBGSEL_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_RADAR_DETECT_MODE_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_ACIM_NOISEM_RESET_NPHY_ID), \ - NAME_ENTRY(WLRPC_WLC_PHY_INTERFER_SET_NPHY_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_IFSCTL_EDCRS_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_PKTENGTX), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_DEAF), \ - NAME_ENTRY(WLRPC_WLC_BMAC_CLEAR_DEAF), \ - NAME_ENTRY(WLRPC_WLC_BMAC_BTC_FLAGS_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_BTC_FLAGS_GET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_RCMTA_TYPE_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_CCA_STATS_READ_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_ANTSEL_SET_ID), \ - NAME_ENTRY(WLRPC_WLC_BMAC_SET_UCODE_LOADED), \ - NAME_ENTRY(WLRPC_WLC_PHY_LDPC_SET_ID), \ - {0, NULL} \ - } - -static __inline char *_wlc_rpc_id_lookup(const struct name_entry *tbl, int _id) -{ - const struct name_entry *elt = tbl; - static char __unknown[64]; - for (; elt->name != NULL; elt++) { - if (_id == elt->id) - break; - } - if (_id == elt->id) - strncpy(__unknown, elt->name, sizeof(__unknown)); - else - snprintf(__unknown, sizeof(__unknown), "ID:%d", _id); - return __unknown; -} - -#define WLC_RPC_ID_LOOKUP(tbl, _id) (_wlc_rpc_id_lookup(tbl, _id)) - -#endif /* BCMDBG */ - -/* refer to txpwr_limits_t for each elements, mcs32 is the at the end for 1 byte */ -#define TXPOWER_XDR_SZ (roundup(WLC_NUM_RATES_CCK, 4) + roundup(WLC_NUM_RATES_OFDM, 4) * 4 + \ - roundup(WLC_NUM_RATES_MCS_1_STREAM, 4) * 6 + roundup(WLC_NUM_RATES_MCS_2_STREAM, 4) * 2 + \ - roundup(1, 4)) - -#define wlc_rpc_txpwr_limits(b, txpwr, op, err) \ - do { \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->cck, WLC_NUM_RATES_CCK); \ - ASSERT(!(err)); \ - \ - /* 20 MHz Legacy OFDM rates with SISO transmission */ \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->ofdm, WLC_NUM_RATES_OFDM); \ - ASSERT(!(err)); \ - \ - /* 20 MHz Legacy OFDM rates with CDD transmission */ \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->ofdm_cdd, WLC_NUM_RATES_OFDM); \ - ASSERT(!(err)); \ - \ - /* 40 MHz Legacy OFDM rates with SISO transmission */ \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->ofdm_40_siso, WLC_NUM_RATES_OFDM); \ - ASSERT(!(err)); \ - \ - /* 40 MHz Legacy OFDM rates with CDD transmission */ \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->ofdm_40_cdd, WLC_NUM_RATES_OFDM); \ - ASSERT(!(err)); \ - \ - /* 20MHz MCS rates SISO/CDD/STBC/SDM */ \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_20_siso, WLC_NUM_RATES_MCS_1_STREAM); \ - ASSERT(!(err)); \ - \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_20_cdd, WLC_NUM_RATES_MCS_1_STREAM); \ - ASSERT(!(err)); \ - \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_20_stbc, WLC_NUM_RATES_MCS_1_STREAM); \ - ASSERT(!(err)); \ - \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_20_mimo, WLC_NUM_RATES_MCS_2_STREAM); \ - ASSERT(!(err)); \ - \ - /* 40MHz MCS rates SISO/CDD/STBC/SDM */ \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_40_siso, WLC_NUM_RATES_MCS_1_STREAM); \ - ASSERT(!(err)); \ - \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_40_cdd, WLC_NUM_RATES_MCS_1_STREAM); \ - ASSERT(!(err)); \ - \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_40_stbc, WLC_NUM_RATES_MCS_1_STREAM); \ - ASSERT(!(err)); \ - \ - (err) = bcm_xdr_##op##_u8_vec((b), (txpwr)->mcs_40_mimo, WLC_NUM_RATES_MCS_2_STREAM); \ - ASSERT(!(err)); \ - } while (0) - -typedef struct wlc_rpc_ctx { - rpc_info_t *rpc; - wlc_info_t *wlc; - wlc_hw_info_t *wlc_hw; -} wlc_rpc_ctx_t; - -static inline rpc_buf_t *wlc_rpc_buf_alloc(rpc_info_t *rpc, bcm_xdr_buf_t *b, - uint len, wlc_rpc_id_t rpc_id) -{ - rpc_buf_t *rpc_buf; - - rpc_buf = bcm_rpc_buf_alloc(rpc, len + sizeof(u32)); - - if (!rpc_buf) - return NULL; - - bcm_xdr_buf_init(b, bcm_rpc_buf_data(bcm_rpc_tp_get(rpc), rpc_buf), - len + sizeof(u32)); - - bcm_xdr_pack_u32(b, rpc_id); - - return rpc_buf; -} - -#if defined(BCMDBG) -static __inline wlc_rpc_id_t -wlc_rpc_id_get(struct rpc_info *rpc, rpc_buf_t *buf) -{ - wlc_rpc_id_t rpc_id; - bcm_xdr_buf_t b; - - bcm_xdr_buf_init(&b, bcm_rpc_buf_data(bcm_rpc_tp_get(rpc), buf), - sizeof(u32)); - - bcm_xdr_unpack_u32(&b, (u32 *)((unsigned long) & rpc_id)); - return rpc_id; -} -#endif - -static __inline int _wlc_rpc_call(struct rpc_info *rpc, rpc_buf_t *send) -{ - int _err = 0; -#if defined(BCMDBG) - wlc_rpc_id_t rpc_id = wlc_rpc_id_get(rpc, send); - /* const struct name_entry rpc_name_tbl[] = RPC_ID_TABLE; */ - static struct name_entry rpc_name_tbl[] = RPC_ID_TABLE; - WL_TRACE(("%s: Called id %s\n", __func__, - WLC_RPC_ID_LOOKUP(rpc_name_tbl, rpc_id))); -#endif - _err = bcm_rpc_call(rpc, send); - if (_err) { -#if defined(BCMDBG) - WL_ERROR(("%s: Call id %s FAILED\n", __func__, - WLC_RPC_ID_LOOKUP(rpc_name_tbl, rpc_id))); -#endif - _err = 0; - } - return _err; -} - -#define wlc_rpc_call(rpc, send) (_wlc_rpc_call(rpc, send)) - -#include <sbhnddma.h> -#include <sbhndpio.h> -#include <d11.h> - -#ifdef WLC_LOW -extern void wlc_rpc_bmac_dispatch(wlc_rpc_ctx_t *rpc_ctx, struct rpc_buf *buf); -extern void wlc_rpc_bmac_dump_txfifohist(wlc_hw_info_t *wlc_hw, - bool dump_clear); -#else -extern void wlc_rpc_high_dispatch(wlc_rpc_ctx_t *ctx, struct rpc_buf *buf); -#endif - -/* Packed structure for ease of transport across RPC bus along u32 boundary */ -typedef struct wlc_rpc_txstatus { - u32 PAD_framelen; - u32 status_frameid; - u32 sequence_lasttxtime; - u32 ackphyrxsh_phyerr; -} wlc_rpc_txstatus_t; - -static inline - void txstatus2rpc_txstatus(tx_status_t *txstatus, - wlc_rpc_txstatus_t *rpc_txstatus) -{ - rpc_txstatus->PAD_framelen = txstatus->framelen; - rpc_txstatus->status_frameid = - (txstatus->status << 16) | txstatus->frameid; - rpc_txstatus->sequence_lasttxtime = - (txstatus->sequence << 16) | txstatus->lasttxtime; - rpc_txstatus->ackphyrxsh_phyerr = - (txstatus->ackphyrxsh << 16) | txstatus->phyerr; -} - -static inline - void rpc_txstatus2txstatus(wlc_rpc_txstatus_t *rpc_txstatus, - tx_status_t *txstatus) -{ - txstatus->framelen = rpc_txstatus->PAD_framelen & 0xffff; - txstatus->status = (rpc_txstatus->status_frameid >> 16) & 0xffff; - txstatus->frameid = rpc_txstatus->status_frameid & 0xffff; - txstatus->sequence = (rpc_txstatus->sequence_lasttxtime >> 16) & 0xffff; - txstatus->lasttxtime = rpc_txstatus->sequence_lasttxtime & 0xffff; - txstatus->ackphyrxsh = (rpc_txstatus->ackphyrxsh_phyerr >> 16) & 0xffff; - txstatus->phyerr = rpc_txstatus->ackphyrxsh_phyerr & 0xffff; -} - -extern void wlc_bmac_dngl_reboot(rpc_info_t *rpc); - -#endif /* WLC_RPC_H */ diff --git a/drivers/staging/brcm80211/sys/wlc_rpctx.h b/drivers/staging/brcm80211/sys/wlc_rpctx.h deleted file mode 100644 index 7427154..0000000 --- a/drivers/staging/brcm80211/sys/wlc_rpctx.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _wlc_rpctx_h_ -#define _wlc_rpctx_h_ - -/* forward declaration */ -struct wlc_info; - -/* This controls how many packets are given to the dongle. This is required as - * NTXD needs to be power of 2 but we may not have enough memory to absorb that - * large number of frames - */ -#ifndef NRPCTXBUFPOST -#define NRPCTXBUFPOST NTXD -#endif - -#if defined(WLC_HIGH_ONLY) - -struct wlc_rpc_phy { - struct rpc_info *rpc; -}; - -#define RPCTX_ENAB(pub) (true) -extern rpctx_info_t *wlc_rpctx_attach(wlc_pub_t *pub, struct wlc_info *wlc); -extern int wlc_rpctx_fifoinit(rpctx_info_t *rpctx, uint fifo, uint ntxd); -extern void wlc_rpctx_detach(rpctx_info_t *rpctx); -extern int wlc_rpctx_dump(rpctx_info_t *rpctx, struct bcmstrbuf *b); -extern void *wlc_rpctx_getnexttxp(rpctx_info_t *rpctx, uint fifo); -extern void wlc_rpctx_txreclaim(rpctx_info_t *rpctx); -extern uint wlc_rpctx_txavail(rpctx_info_t *rpctx, uint fifo); -extern int wlc_rpctx_pkteng(rpctx_info_t *rpctx, uint fifo, void *p); -extern int wlc_rpctx_tx(rpctx_info_t *rpctx, uint fifo, void *p, bool commit, - u16 frameid, u8 txpktpend); -extern void wlc_rpctx_txpktpendinc(rpctx_info_t *rpctx, uint fifo, u8 val); -extern void wlc_rpctx_txpktpenddec(rpctx_info_t *rpctx, uint fifo, u8 val); -extern void wlc_rpctx_txpktpendclr(rpctx_info_t *rpctx, uint fifo); -extern int wlc_rpctx_txpktpend(rpctx_info_t *rpctx, uint fifo, bool all); - -#else -#define RPCTX_ENAB(pub) (false) -#define wlc_rpctx_attach(pub, wlc) (NULL) -#define wlc_rpctx_fifoinit(rpctx, fifo, ntxd) (0) -#define wlc_rpctx_detach(rpctx) ASSERT(0) -#define wlc_rpctx_txavail(rpctx, f) (false) -#define wlc_rpctx_dump(rpctx, b) (0) -#define wlc_rpctx_getnexttxp(rpctx, f) (NULL) -#define wlc_rpctx_txreclaim(rpctx) ASSERT(0) -#define wlc_rpctx_pkteng(rpctx, fifo, p) do { } while (0) -#define wlc_rpctx_tx(rpctx, f, p, c, fid, t) (0) -#define wlc_rpctx_txpktpendinc(rpctx, f, val) do { } while (0) -#define wlc_rpctx_txpktpenddec(rpctx, f, val) do { } while (0) -#define wlc_rpctx_txpktpendclr(rpctx, f) do { } while (0) -#define wlc_rpctx_txpktpend(rpctx, f, all) (0) - -#endif /* WLC_HIGH */ - -#endif /* _wlc_rpctx_h_ */ diff --git a/drivers/staging/brcm80211/sys/wlc_scb.h b/drivers/staging/brcm80211/sys/wlc_scb.h index ce26c74..fe84e99 100644 --- a/drivers/staging/brcm80211/sys/wlc_scb.h +++ b/drivers/staging/brcm80211/sys/wlc_scb.h @@ -19,7 +19,7 @@ #include <proto/802.1d.h> -extern bool wlc_aggregatable(wlc_info_t *wlc, u8 tid); +extern bool wlc_aggregatable(struct wlc_info *wlc, u8 tid); #define AMPDU_TX_BA_MAX_WSIZE 64 /* max Tx ba window size (in pdu) */ /* structure to store per-tid state for the ampdu initiator */ diff --git a/drivers/staging/brcm80211/sys/wlc_stf.c b/drivers/staging/brcm80211/sys/wlc_stf.c index 4728ad9..8975b09 100644 --- a/drivers/staging/brcm80211/sys/wlc_stf.c +++ b/drivers/staging/brcm80211/sys/wlc_stf.c @@ -15,8 +15,8 @@ */ #include <linux/kernel.h> +#include <linux/module.h> #include <wlc_cfg.h> -#include <linuxver.h> #include <bcmdefs.h> #include <osl.h> #include <bcmutils.h> @@ -25,29 +25,33 @@ #include <proto/802.11.h> #include <wlioctl.h> #include <bcmwifi.h> +#include <sbhndpio.h> +#include <sbhnddma.h> #include <d11.h> #include <wlc_rate.h> #include <wlc_pub.h> #include <wlc_key.h> #include <wlc_channel.h> #include <wlc_bsscfg.h> +#include <wlc_event.h> #include <wlc_mac80211.h> #include <wlc_scb.h> #include <wl_export.h> #include <wlc_bmac.h> #include <wlc_stf.h> +#include <wl_dbg.h> #define WLC_STF_SS_STBC_RX(wlc) (WLCISNPHY(wlc->band) && \ NREV_GT(wlc->band->phyrev, 3) && NREV_LE(wlc->band->phyrev, 6)) -static s8 wlc_stf_stbc_rx_get(wlc_info_t *wlc); -static bool wlc_stf_stbc_tx_set(wlc_info_t *wlc, s32 int_val); -static int wlc_stf_txcore_set(wlc_info_t *wlc, u8 Nsts, u8 val); -static int wlc_stf_spatial_policy_set(wlc_info_t *wlc, int val); -static void wlc_stf_stbc_rx_ht_update(wlc_info_t *wlc, int val); +static s8 wlc_stf_stbc_rx_get(struct wlc_info *wlc); +static bool wlc_stf_stbc_tx_set(struct wlc_info *wlc, s32 int_val); +static int wlc_stf_txcore_set(struct wlc_info *wlc, u8 Nsts, u8 val); +static int wlc_stf_spatial_policy_set(struct wlc_info *wlc, int val); +static void wlc_stf_stbc_rx_ht_update(struct wlc_info *wlc, int val); -static void _wlc_stf_phy_txant_upd(wlc_info_t *wlc); -static u16 _wlc_stf_phytxchain_sel(wlc_info_t *wlc, ratespec_t rspec); +static void _wlc_stf_phy_txant_upd(struct wlc_info *wlc); +static u16 _wlc_stf_phytxchain_sel(struct wlc_info *wlc, ratespec_t rspec); #define NSTS_1 1 #define NSTS_2 2 @@ -61,7 +65,7 @@ const u8 txcore_default[5] = { (0x0f) /* For Nsts = 4, enable all cores */ }; -static void wlc_stf_stbc_rx_ht_update(wlc_info_t *wlc, int val) +static void wlc_stf_stbc_rx_ht_update(struct wlc_info *wlc, int val) { ASSERT((val == HT_CAP_RX_STBC_NO) || (val == HT_CAP_RX_STBC_ONE_STREAM)); @@ -82,7 +86,7 @@ static void wlc_stf_stbc_rx_ht_update(wlc_info_t *wlc, int val) } /* every WLC_TEMPSENSE_PERIOD seconds temperature check to decide whether to turn on/off txchain */ -void wlc_tempsense_upd(wlc_info_t *wlc) +void wlc_tempsense_upd(struct wlc_info *wlc) { wlc_phy_t *pi = wlc->band->pi; uint active_chains, txchain; @@ -106,7 +110,7 @@ void wlc_tempsense_upd(wlc_info_t *wlc) } void -wlc_stf_ss_algo_channel_get(wlc_info_t *wlc, u16 *ss_algo_channel, +wlc_stf_ss_algo_channel_get(struct wlc_info *wlc, u16 *ss_algo_channel, chanspec_t chanspec) { tx_power_t power; @@ -147,12 +151,12 @@ wlc_stf_ss_algo_channel_get(wlc_info_t *wlc, u16 *ss_algo_channel, setbit(ss_algo_channel, PHY_TXC1_MODE_STBC); } -static s8 wlc_stf_stbc_rx_get(wlc_info_t *wlc) +static s8 wlc_stf_stbc_rx_get(struct wlc_info *wlc) { return (wlc->ht_cap.cap & HT_CAP_RX_STBC_MASK) >> HT_CAP_RX_STBC_SHIFT; } -static bool wlc_stf_stbc_tx_set(wlc_info_t *wlc, s32 int_val) +static bool wlc_stf_stbc_tx_set(struct wlc_info *wlc, s32 int_val) { if ((int_val != AUTO) && (int_val != OFF) && (int_val != ON)) { return false; @@ -173,7 +177,7 @@ static bool wlc_stf_stbc_tx_set(wlc_info_t *wlc, s32 int_val) return true; } -bool wlc_stf_stbc_rx_set(wlc_info_t *wlc, s32 int_val) +bool wlc_stf_stbc_rx_set(struct wlc_info *wlc, s32 int_val) { if ((int_val != HT_CAP_RX_STBC_NO) && (int_val != HT_CAP_RX_STBC_ONE_STREAM)) { @@ -190,10 +194,10 @@ bool wlc_stf_stbc_rx_set(wlc_info_t *wlc, s32 int_val) return true; } -static int wlc_stf_txcore_set(wlc_info_t *wlc, u8 Nsts, u8 core_mask) +static int wlc_stf_txcore_set(struct wlc_info *wlc, u8 Nsts, u8 core_mask) { - WL_TRACE(("wl%d: %s: Nsts %d core_mask %x\n", - wlc->pub->unit, __func__, Nsts, core_mask)); + WL_TRACE("wl%d: %s: Nsts %d core_mask %x\n", + wlc->pub->unit, __func__, Nsts, core_mask); ASSERT((Nsts > 0) && (Nsts <= MAX_STREAMS_SUPPORTED)); @@ -227,12 +231,12 @@ static int wlc_stf_txcore_set(wlc_info_t *wlc, u8 Nsts, u8 core_mask) return BCME_OK; } -static int wlc_stf_spatial_policy_set(wlc_info_t *wlc, int val) +static int wlc_stf_spatial_policy_set(struct wlc_info *wlc, int val) { int i; u8 core_mask = 0; - WL_TRACE(("wl%d: %s: val %x\n", wlc->pub->unit, __func__, val)); + WL_TRACE("wl%d: %s: val %x\n", wlc->pub->unit, __func__, val); wlc->stf->spatial_policy = (s8) val; for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) { @@ -243,7 +247,7 @@ static int wlc_stf_spatial_policy_set(wlc_info_t *wlc, int val) return BCME_OK; } -int wlc_stf_txchain_set(wlc_info_t *wlc, s32 int_val, bool force) +int wlc_stf_txchain_set(struct wlc_info *wlc, s32 int_val, bool force) { u8 txchain = (u8) int_val; u8 txstreams; @@ -274,13 +278,15 @@ int wlc_stf_txchain_set(wlc_info_t *wlc, s32 int_val, bool force) if (RSPEC_STF(wlc->bandstate[i]->rspec_override) != PHY_TXC1_MODE_SISO) { wlc->bandstate[i]->rspec_override = 0; - WL_ERROR(("%s(): temp sense override non-SISO" " rspec_override.\n", __func__)); + WL_ERROR("%s(): temp sense override non-SISO rspec_override\n", + __func__); } if (RSPEC_STF (wlc->bandstate[i]->mrspec_override) != PHY_TXC1_MODE_SISO) { wlc->bandstate[i]->mrspec_override = 0; - WL_ERROR(("%s(): temp sense override non-SISO" " mrspec_override.\n", __func__)); + WL_ERROR("%s(): temp sense override non-SISO mrspec_override\n", + __func__); } } } @@ -303,7 +309,7 @@ int wlc_stf_txchain_set(wlc_info_t *wlc, s32 int_val, bool force) return BCME_OK; } -int wlc_stf_rxchain_set(wlc_info_t *wlc, s32 int_val) +int wlc_stf_rxchain_set(struct wlc_info *wlc, s32 int_val) { u8 rxchain_cnt; u8 rxchain = (u8) int_val; @@ -367,7 +373,7 @@ int wlc_stf_rxchain_set(wlc_info_t *wlc, s32 int_val) } /* update wlc->stf->ss_opmode which represents the operational stf_ss mode we're using */ -int wlc_stf_ss_update(wlc_info_t *wlc, wlcband_t *band) +int wlc_stf_ss_update(struct wlc_info *wlc, struct wlcband *band) { int ret_code = 0; u8 prev_stf_ss; @@ -402,7 +408,7 @@ int wlc_stf_ss_update(wlc_info_t *wlc, wlcband_t *band) return ret_code; } -int wlc_stf_attach(wlc_info_t *wlc) +int wlc_stf_attach(struct wlc_info *wlc) { wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO; wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD; @@ -425,11 +431,11 @@ int wlc_stf_attach(wlc_info_t *wlc) return 0; } -void wlc_stf_detach(wlc_info_t *wlc) +void wlc_stf_detach(struct wlc_info *wlc) { } -int wlc_stf_ant_txant_validate(wlc_info_t *wlc, s8 val) +int wlc_stf_ant_txant_validate(struct wlc_info *wlc, s8 val) { int bcmerror = BCME_OK; @@ -476,7 +482,7 @@ int wlc_stf_ant_txant_validate(wlc_info_t *wlc, s8 val) * do tx-antenna selection for SISO transmissions * for NREV>=7, bit 6 and bit 7 mean antenna 0 and 1 respectively, nit6+bit7 means both cores active */ -static void _wlc_stf_phy_txant_upd(wlc_info_t *wlc) +static void _wlc_stf_phy_txant_upd(struct wlc_info *wlc) { s8 txant; @@ -517,12 +523,12 @@ static void _wlc_stf_phy_txant_upd(wlc_info_t *wlc) wlc_bmac_txant_set(wlc->hw, wlc->stf->phytxant); } -void wlc_stf_phy_txant_upd(wlc_info_t *wlc) +void wlc_stf_phy_txant_upd(struct wlc_info *wlc) { _wlc_stf_phy_txant_upd(wlc); } -void wlc_stf_phy_chain_calc(wlc_info_t *wlc) +void wlc_stf_phy_chain_calc(struct wlc_info *wlc) { /* get available rx/tx chains */ wlc->stf->hw_txchain = (u8) getintvar(wlc->pub->vars, "txchain"); @@ -559,7 +565,7 @@ void wlc_stf_phy_chain_calc(wlc_info_t *wlc) wlc_stf_spatial_policy_set(wlc, MIN_SPATIAL_EXPANSION); } -static u16 _wlc_stf_phytxchain_sel(wlc_info_t *wlc, ratespec_t rspec) +static u16 _wlc_stf_phytxchain_sel(struct wlc_info *wlc, ratespec_t rspec) { u16 phytxant = wlc->stf->phytxant; @@ -572,12 +578,12 @@ static u16 _wlc_stf_phytxchain_sel(wlc_info_t *wlc, ratespec_t rspec) return phytxant; } -u16 wlc_stf_phytxchain_sel(wlc_info_t *wlc, ratespec_t rspec) +u16 wlc_stf_phytxchain_sel(struct wlc_info *wlc, ratespec_t rspec) { return _wlc_stf_phytxchain_sel(wlc, rspec); } -u16 wlc_stf_d11hdrs_phyctl_txant(wlc_info_t *wlc, ratespec_t rspec) +u16 wlc_stf_d11hdrs_phyctl_txant(struct wlc_info *wlc, ratespec_t rspec) { u16 phytxant = wlc->stf->phytxant; u16 mask = PHY_TXC_ANT_MASK; diff --git a/drivers/staging/brcm80211/sys/wlc_stf.h b/drivers/staging/brcm80211/sys/wlc_stf.h index ee9b02a..8de6382 100644 --- a/drivers/staging/brcm80211/sys/wlc_stf.h +++ b/drivers/staging/brcm80211/sys/wlc_stf.h @@ -20,23 +20,24 @@ #define MIN_SPATIAL_EXPANSION 0 #define MAX_SPATIAL_EXPANSION 1 -extern int wlc_stf_attach(wlc_info_t *wlc); -extern void wlc_stf_detach(wlc_info_t *wlc); +extern int wlc_stf_attach(struct wlc_info *wlc); +extern void wlc_stf_detach(struct wlc_info *wlc); -extern void wlc_tempsense_upd(wlc_info_t *wlc); -extern void wlc_stf_ss_algo_channel_get(wlc_info_t *wlc, +extern void wlc_tempsense_upd(struct wlc_info *wlc); +extern void wlc_stf_ss_algo_channel_get(struct wlc_info *wlc, u16 *ss_algo_channel, chanspec_t chanspec); -extern int wlc_stf_ss_update(wlc_info_t *wlc, struct wlcband *band); -extern void wlc_stf_phy_txant_upd(wlc_info_t *wlc); -extern int wlc_stf_txchain_set(wlc_info_t *wlc, s32 int_val, bool force); -extern int wlc_stf_rxchain_set(wlc_info_t *wlc, s32 int_val); -extern bool wlc_stf_stbc_rx_set(wlc_info_t *wlc, s32 int_val); +extern int wlc_stf_ss_update(struct wlc_info *wlc, struct wlcband *band); +extern void wlc_stf_phy_txant_upd(struct wlc_info *wlc); +extern int wlc_stf_txchain_set(struct wlc_info *wlc, s32 int_val, bool force); +extern int wlc_stf_rxchain_set(struct wlc_info *wlc, s32 int_val); +extern bool wlc_stf_stbc_rx_set(struct wlc_info *wlc, s32 int_val); -extern int wlc_stf_ant_txant_validate(wlc_info_t *wlc, s8 val); -extern void wlc_stf_phy_txant_upd(wlc_info_t *wlc); -extern void wlc_stf_phy_chain_calc(wlc_info_t *wlc); -extern u16 wlc_stf_phytxchain_sel(wlc_info_t *wlc, ratespec_t rspec); -extern u16 wlc_stf_d11hdrs_phyctl_txant(wlc_info_t *wlc, ratespec_t rspec); -extern u16 wlc_stf_spatial_expansion_get(wlc_info_t *wlc, ratespec_t rspec); +extern int wlc_stf_ant_txant_validate(struct wlc_info *wlc, s8 val); +extern void wlc_stf_phy_txant_upd(struct wlc_info *wlc); +extern void wlc_stf_phy_chain_calc(struct wlc_info *wlc); +extern u16 wlc_stf_phytxchain_sel(struct wlc_info *wlc, ratespec_t rspec); +extern u16 wlc_stf_d11hdrs_phyctl_txant(struct wlc_info *wlc, ratespec_t rspec); +extern u16 wlc_stf_spatial_expansion_get(struct wlc_info *wlc, + ratespec_t rspec); #endif /* _wlc_stf_h_ */ diff --git a/drivers/staging/brcm80211/sys/wlc_types.h b/drivers/staging/brcm80211/sys/wlc_types.h index 33047eb..df6e04c 100644 --- a/drivers/staging/brcm80211/sys/wlc_types.h +++ b/drivers/staging/brcm80211/sys/wlc_types.h @@ -19,34 +19,19 @@ /* forward declarations */ -typedef struct wlc_info wlc_info_t; -typedef struct wlc_hw_info wlc_hw_info_t; -typedef struct wlc_if wlc_if_t; -typedef struct wl_if wl_if_t; -typedef struct led_info led_info_t; -typedef struct bmac_led bmac_led_t; -typedef struct bmac_led_info bmac_led_info_t; -typedef struct scb_module scb_module_t; -typedef struct ba_info ba_info_t; -typedef struct ampdu_info ampdu_info_t; -typedef struct ratesel_info ratesel_info_t; -typedef struct wlc_ap_info wlc_ap_info_t; -typedef struct wlc_auth_info wlc_auth_info_t; -typedef struct supplicant supplicant_t; -typedef struct authenticator authenticator_t; -typedef struct antsel_info antsel_info_t; -#if !defined(WLC_LOW) -typedef struct rpctx_info rpctx_info_t; -#endif -#ifdef WLC_LOW -typedef struct bmac_pmq bmac_pmq_t; -#endif +struct wlc_info; +struct wlc_hw_info; +struct wlc_if; +struct wl_if; +struct ampdu_info; +struct antsel_info; +struct bmac_pmq; struct d11init; #ifndef _hnddma_pub_ #define _hnddma_pub_ -typedef const struct hnddma_pub hnddma_t; +struct hnddma_pub; #endif /* _hnddma_pub_ */ #endif /* _wlc_types_h_ */ |