fix mac80211 callback in brcmsmac and brcmfmac refactor
PATCH v2 5/17 brcm80211: smac: removed down-on-watchdog MPC functionality
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Softmac would bring its interface down on a certain Minimum Power Save related condition, without Mac80211 intervention. Because Mac80211 should be the only party initiating interfaces going up and down, this functionality has been removed. All notions of 'MPC' have been removed in the code as well.
--- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 3 +- drivers/net/wireless/brcm80211/brcmsmac/main.c | 45 +++---------------- drivers/net/wireless/brcm80211/brcmsmac/main.h | 3 - drivers/net/wireless/brcm80211/brcmsmac/pub.h | 2 +- drivers/net/wireless/brcm80211/include/defs.h | 1 - 5 files changed, 9 insertions(+), 45 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +1 -2
@@ -1078,8 +1078,7 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device, wl->pub->ieee_hw = hw; -/* disable mpc */ -brcms_c_set_radio_mpc (wl->wlc); +brcms_c_set_radio_mon (wl->wlc);/* register our interrupt handler */ if (request_irq (irq, brcms_isr,IRQF_SHARED ,KBUILD_MODNAME , wl)) {
drivers/net/wireless/brcm80211/brcmsmac/main.c +7 -38
99 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/main.h +0 -3
@@ -427,7 +427,6 @@ struct brcms_txq_info {* bandinit_pending: track band init in auto band. * radio_monitor: radio timer is running. * going_down: down path intermediate variable. -* mpc_delay_off: delay radio disable by # of watchdog cnt. * wdtimer: timer for watchdog routine. * radio_timer: timer for hw radio button monitor routine. * monitor: monitor (MPDU sniffing) mode.
@@ -518,8 +517,6 @@ struct brcms_c_info {bool radio_monitor;bool going_down; -u8 mpc_delay_off; -struct brcms_timer *wdtimer;struct brcms_timer *radio_timer;
drivers/net/wireless/brcm80211/brcmsmac/pub.h +1 -1
@@ -596,7 +596,7 @@ extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval);extern int brcms_c_set_tx_power (struct brcms_c_info *wlc,int txpwr);extern int brcms_c_get_tx_power (struct brcms_c_info *wlc); -extern void brcms_c_set_radio_mpc (struct brcms_c_info *wlc); +extern void brcms_c_set_radio_mon (struct brcms_c_info *wlc);extern bool brcms_c_check_radio_disabled (struct brcms_c_info *wlc);#endif /* _BRCM_PUB_H_ */
drivers/net/wireless/brcm80211/include/defs.h +0 -1
@@ -62,7 +62,6 @@#define WL_RADIO_SW_DISABLE (1<<0)#define WL_RADIO_HW_DISABLE (1<<1) -#define WL_RADIO_MPC_DISABLE (1<<2)/* some countries don't support any channel */ #define WL_RADIO_COUNTRY_DISABLE (1<<3)
Signature · 1 line
1.7.4.1
PATCH v2 2/17 brcm80211: fmac: use brcmf_del_if for all net devices
In reply to Arend van SprielFrom: Franky Lin <[email protected]>
Use brcmf_del_if for primary and virtual net device interfaces. This is part of the net device interface clean up for fullmac.
--- .../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 55 +++++++++---------- 1 files changed, 26 insertions(+), 29 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +26 -29
@@ -893,6 +893,16 @@ static int brcmf_netdev_open(struct net_device *ndev)return ret; } +static const struct net_device_ops brcmf_netdev_ops_pri = { + .ndo_open = brcmf_netdev_open, + .ndo_stop = brcmf_netdev_stop, + .ndo_get_stats = brcmf_netdev_get_stats, + .ndo_do_ioctl = brcmf_netdev_ioctl_entry, + .ndo_start_xmit = brcmf_netdev_start_xmit, + .ndo_set_mac_address = brcmf_netdev_set_mac_address, + .ndo_set_rx_mode = brcmf_netdev_set_multicast_list +}; +int brcmf_add_if (struct brcmf_info *drvr_priv,int ifidx,struct net_device *ndev,char *name,u8 *mac_addr,u32 flags,u8 bssidx)
@@ -977,14 +987,23 @@ void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx)brcmf_dbg (ERROR ,"Null interface\n" );return ; } - ifp->state =BRCMF_E_IF_DEL ; - ifp->idx = ifidx; -if (ifp->ndev !=NULL ) { -netif_stop_queue (ifp->ndev); +if (ifp->ndev) { +if (ifidx ==0 ) { +if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { +rtnl_lock (); +brcmf_netdev_stop (ifp->ndev); +rtnl_unlock (); + } + }else { +netif_stop_queue (ifp->ndev); + } +unregister_netdev (ifp->ndev); -free_netdev (ifp->ndev); drvr_priv->iflist[ifidx] =NULL ; +if (ifidx ==0 ) +brcmf_cfg80211_detach (drvr_priv->pub.config); +free_netdev (ifp->ndev);kfree (ifp); } }
@@ -1123,16 +1142,6 @@ int brcmf_bus_start(struct brcmf_pub *drvr)return 0 ; } -static struct net_device_ops brcmf_netdev_ops_pri = { - .ndo_open = brcmf_netdev_open, - .ndo_stop = brcmf_netdev_stop, - .ndo_get_stats = brcmf_netdev_get_stats, - .ndo_do_ioctl = brcmf_netdev_ioctl_entry, - .ndo_start_xmit = brcmf_netdev_start_xmit, - .ndo_set_mac_address = brcmf_netdev_set_mac_address, - .ndo_set_rx_mode = brcmf_netdev_set_multicast_list -}; -int brcmf_net_attach (struct brcmf_pub *drvr,int ifidx) {struct brcmf_info *drvr_priv = drvr->info;
@@ -1210,21 +1219,13 @@ void brcmf_detach(struct brcmf_pub *drvr)if (drvr) { drvr_priv = drvr->info;if (drvr_priv) { -struct brcmf_if *ifp;int i; -for (i =1 ; i <BRCMF_MAX_IFS ; i++) +/* make sure primary interface removed last */ +for (i =BRCMF_MAX_IFS -1 ; i >-1 ; i--)if (drvr_priv->iflist[i])brcmf_del_if (drvr_priv, i); - ifp = drvr_priv->iflist[0 ]; -if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { -rtnl_lock (); -brcmf_netdev_stop (ifp->ndev); -rtnl_unlock (); -unregister_netdev (ifp->ndev); - } -cancel_work_sync (&drvr_priv->setmacaddr_work);cancel_work_sync (&drvr_priv->multicast_work);
@@ -1233,10 +1234,6 @@ void brcmf_detach(struct brcmf_pub *drvr)if (drvr->prot)brcmf_proto_detach (drvr); -brcmf_cfg80211_detach (drvr->config); - -free_netdev (ifp->ndev); -kfree (ifp);kfree (drvr_priv); } }
Signature · 1 line
1.7.4.1
PATCH v2 6/17 brcm80211: smac: removed down-on-rf-kill functionality
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Softmac would bring its interface down on an RF kill switch condition, without Mac80211 intervention. Because Mac80211 should be the only party initiating interfaces going up and down, this functionality has been removed.
--- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 2 - drivers/net/wireless/brcm80211/brcmsmac/main.c | 67 -------------------- drivers/net/wireless/brcm80211/brcmsmac/pub.h | 1 - 3 files changed, 0 insertions(+), 70 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +0 -2
@@ -1078,8 +1078,6 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device, wl->pub->ieee_hw = hw; -brcms_c_set_radio_mon (wl->wlc); -/* register our interrupt handler */ if (request_irq (irq, brcms_isr,IRQF_SHARED ,KBUILD_MODNAME , wl)) {wiphy_err (wl->wiphy,"wl%d: request_irq() failed\n" , unit);
drivers/net/wireless/brcm80211/brcmsmac/main.c +0 -67
116 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/pub.h +0 -1
@@ -596,7 +596,6 @@ extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval);extern int brcms_c_set_tx_power (struct brcms_c_info *wlc,int txpwr);extern int brcms_c_get_tx_power (struct brcms_c_info *wlc); -extern void brcms_c_set_radio_mon (struct brcms_c_info *wlc);extern bool brcms_c_check_radio_disabled (struct brcms_c_info *wlc);#endif /* _BRCM_PUB_H_ */
Signature · 1 line
1.7.4.1
PATCH v2 8/17 brcm80211: smac: fixed inconsistency in transmit mute
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Transmit was muted in two ways: full mute and a partial mute called 'pre ism cac time' mute. But, this 'pre ism cac time' mute was done at one place in the code (when tx_mute == false), and overridden later on in another place in code.
To fix this, the 'pre ism cac time' mute has been replaced by a non mute.
--- drivers/net/wireless/brcm80211/brcmsmac/main.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/main.c +8 -8
@@ -2453,11 +2453,11 @@ static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw, }/* precondition: requires the mac core to be enabled */ -static void brcms_b_mute (struct brcms_hardware *wlc_hw,bool on,u32 flags) +static void brcms_b_mute (struct brcms_hardware *wlc_hw,bool mute_tx) {static const u8 null_ether_addr[ETH_ALEN ] = {0 ,0 ,0 ,0 ,0 ,0 }; -if (on) { +if (mute_tx) {/* suspend tx fifos */ brcms_b_tx_fifo_suspend (wlc_hw,TX_DATA_FIFO );brcms_b_tx_fifo_suspend (wlc_hw,TX_CTL_FIFO );
@@ -2479,9 +2479,9 @@ static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool on, u32 flags) wlc_hw->etheraddr); } -wlc_phy_mute_upd (wlc_hw->band->pi, on, flags); +wlc_phy_mute_upd (wlc_hw->band->pi, mute_tx,0 ); -if (on) +if (mute_tx)brcms_c_ucode_mute_override_set (wlc_hw);else brcms_c_ucode_mute_override_clear (wlc_hw);
@@ -3892,7 +3892,7 @@ static void brcms_c_set_home_chanspec(struct brcms_c_info *wlc, u16 chanspec)void brcms_b_set_chanspec (struct brcms_hardware *wlc_hw,u16 chanspec, -bool mute,struct txpwr_limits *txpwr) +bool mute_tx,struct txpwr_limits *txpwr) {uint bandunit;
@@ -3918,7 +3918,7 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec, } } -wlc_phy_initcal_enable (wlc_hw->band->pi, !mute); +wlc_phy_initcal_enable (wlc_hw->band->pi, !mute_tx);if (!wlc_hw->up) {if (wlc_hw->clk)
@@ -3930,7 +3930,7 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,wlc_phy_txpower_limit_set (wlc_hw->band->pi, txpwr, chanspec);/* Update muting of the channel */ -brcms_b_mute (wlc_hw, mute,0 ); +brcms_b_mute (wlc_hw, mute_tx); } }
@@ -8341,7 +8341,7 @@ void brcms_c_init(struct brcms_c_info *wlc)/* suspend the tx fifos and mute the phy for preism cac time */ if (mute_tx) -brcms_b_mute (wlc->hw,ON ,PHY_MUTE_FOR_PREISM ); +brcms_b_mute (wlc->hw, true);/* clear tx flow control */ brcms_c_txflowcontrol_reset (wlc);
Signature · 1 line
1.7.4.1
PATCH v2 11/17 brcm80211: smac: changed check to confirm STA only support
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
The driver currently only supports STA operation. However, in brcms_ops_add_interface() also AP and SSID mode were accepted.
--- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +1 -5
@@ -341,11 +341,7 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)struct brcms_info *wl = hw->priv;/* Just STA for now */ -if (vif->type !=NL80211_IFTYPE_AP && - vif->type !=NL80211_IFTYPE_MESH_POINT && - vif->type !=NL80211_IFTYPE_STATION && - vif->type !=NL80211_IFTYPE_WDS && - vif->type !=NL80211_IFTYPE_ADHOC ) { +if (vif->type !=NL80211_IFTYPE_STATION ) {wiphy_err (hw->wiphy,"%s: Attempt to add type %d, only" " STA for now\n" , __func__, vif->type);return -EOPNOTSUPP ;
Signature · 1 line
1.7.4.1
PATCH v2 12/17 brcm80211: smac: rename buffer endianess conversion functions
In reply to Arend van SprielThe functions ltoh16_buf() and htol16_buf() have been renamed to le16_to_cpu_buf() and cpu_to_le16_buf() for more clarity what it does.
--- drivers/net/wireless/brcm80211/brcmsmac/srom.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/srom.c +5 -5
@@ -617,14 +617,14 @@ static uint mask_width(u16 mask)return 0 ; } -static inline void ltoh16_buf (u16 *buf,unsigned int size) +static inline void le16_to_cpu_buf (u16 *buf,unsigned int size) { size /=2 ;while (size--) *(buf + size) =le16_to_cpu (*(__le16 *)(buf + size)); } -static inline void htol16_buf (u16 *buf,unsigned int size) +static inline void cpu_to_le16_buf (u16 *buf,unsigned int size) { size /=2 ;while (size--)
@@ -807,7 +807,7 @@ sprom_read_pci(struct si_pub *sih, u8 __iomem *sprom, uint wordoff, err = -EIO ; else/* now correct the endianness of the byte array */ -ltoh16_buf (buf ,nbytes ); +le16_to_cpu_buf (buf ,nbytes );return err; }
@@ -837,13 +837,13 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)return -ENODATA ;/* fixup the endianness so crc8 will pass */ -htol16_buf (buf, bufsz); +cpu_to_le16_buf (buf, bufsz);if (crc8 (brcms_srom_crc8_table, (u8 *) buf,SROM4_WORDS *2 ,CRC8_INIT_VALUE ) !=CRC8_GOOD_VALUE (brcms_srom_crc8_table)) err = -EIO ;/* now correct the endianness of the byte array */ -ltoh16_buf (buf, bufsz); +le16_to_cpu_buf (buf, bufsz);return err; }
Signature · 1 line
1.7.4.1
PATCH v2 13/17 brcm80211: smac: use sk_buff list for handling frames in receive path
In reply to Arend van SprielIn the receive path the frames are obtained from the dma using multiple sk_buff that were linked using the skb next pointer. This has been changed and it now used sk_buff lists and skb_queue functions instead.
--- drivers/net/wireless/brcm80211/brcmsmac/dma.c | 38 ++++++++++++++---------- drivers/net/wireless/brcm80211/brcmsmac/dma.h | 3 +- drivers/net/wireless/brcm80211/brcmsmac/main.c | 21 +++++-------- 3 files changed, 32 insertions(+), 30 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/dma.c +22 -16
@@ -14,7 +14,6 @@* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <linux/slab.h> -#include <linux/skbuff.h> #include <linux/delay.h> #include <linux/pci.h>
@@ -901,7 +900,7 @@ static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall)/* * !! rx entry routine -* returns a pointer to the next frame received, or NULL if there are no more +* returns the number packages in the next frame, or 0 if there are no more * if DMA_CTRL_RXMULTI is defined, DMA scattering(multiple buffers) is * supported with pkts chain * otherwise, it's treated as giant pkt and will be tossed.
@@ -909,38 +908,40 @@ static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall)* buffer data. After it reaches the max size of buffer, the data continues * in next DMA descriptor buffer WITHOUT DMA header */ -struct sk_buff *dma_rx (struct dma_pub *pub) +int dma_rx (struct dma_pub *pub,struct sk_buff_head *skb_list) {struct dma_info *di = (struct dma_info *)pub; -struct sk_buff *p, *head, *tail; +struct sk_buff_head dma_frames; +struct sk_buff *p, *next;uint len;uint pkt_len;int resid =0 ; +int pktcnt =1 ; +skb_queue_head_init (&dma_frames); next_frame: - head =_dma_getnextrxp (di, false); -if (head ==NULL ) -return NULL ; + p =_dma_getnextrxp (di, false); +if (p ==NULL ) +return 0 ; - len =le16_to_cpu (*(__le16 *) (head->data)); + len =le16_to_cpu (*(__le16 *) (p->data));DMA_TRACE (("%s: dma_rx len %d\n" , di->name, len)); -dma_spin_for_len (len, head); +dma_spin_for_len (len, p);/* set actual length */ pkt_len =min ((di->rxoffset + len), di->rxbufsize); -__skb_trim (head, pkt_len); +__skb_trim (p, pkt_len); +skb_queue_tail (&dma_frames, p); resid = len - (di->rxbufsize - di->rxoffset);/* check for single or multi-buffer rx */ if (resid >0 ) { - tail = head;while ((resid >0 ) && (p =_dma_getnextrxp (di, false))) { - tail->next = p; pkt_len =min_t (uint, resid, di->rxbufsize);__skb_trim (p, pkt_len); - - tail = p; +skb_queue_tail (&dma_frames, p); resid -= di->rxbufsize; + pktcnt++; }#ifdef BCMDBG
@@ -959,13 +960,18 @@ struct sk_buff *dma_rx(struct dma_pub *pub)if ((di->dma.dmactrlflags &DMA_CTRL_RXMULTI ) ==0 ) {DMA_ERROR (("%s: dma_rx: bad frame length (%d)\n" , di->name, len)); -brcmu_pkt_buf_free_skb (head); + skb_queue_walk_safe(&dma_frames, p, next) { +skb_unlink (p, &dma_frames); +brcmu_pkt_buf_free_skb (p); + } di->dma.rxgiants++; + pktcnt =1 ; goto next_frame; } } -return head; +skb_queue_splice_tail (&dma_frames, skb_list); +return pktcnt; }static bool dma64_rxidle (struct dma_info *di)
drivers/net/wireless/brcm80211/brcmsmac/dma.h +2 -1
@@ -18,6 +18,7 @@#define _BRCM_DMA_H_#include <linux/delay.h> +#include <linux/skbuff.h> #include "types.h" /* forward structure declarations */ /* map/unmap direction */
@@ -80,7 +81,7 @@ extern struct dma_pub *dma_attach(char *name, struct si_pub *sih, uint nrxpost, uint rxoffset, uint *msg_level);void dma_rxinit (struct dma_pub *pub); -struct sk_buff *dma_rx (struct dma_pub *pub); +int dma_rx (struct dma_pub *pub,struct sk_buff_head *skb_list);bool dma_rxfill (struct dma_pub *pub);bool dma_rxreset (struct dma_pub *pub);bool dma_txreset (struct dma_pub *pub);
drivers/net/wireless/brcm80211/brcmsmac/main.c +8 -13
@@ -8115,21 +8115,17 @@ static bool brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) { struct sk_buff *p; -struct sk_buff *head =NULL ; -struct sk_buff *tail =NULL ; +struct sk_buff *next =NULL ; +struct sk_buff_head recv_frames; +uint n =0 ;uint bound_limit = bound ?RXBND :-1 ;BCMMSG (wlc_hw->wlc->wiphy,"wl%d\n" , wlc_hw->unit); -/* gather received frames */ -while ((p =dma_rx (wlc_hw->di[fifo]))) { +skb_queue_head_init (&recv_frames); -if (!tail) - head = tail = p; -else { - tail->prev = p; - tail = p; - } +/* gather received frames */ +while (dma_rx (wlc_hw->di[fifo], &recv_frames)) {/* !give others some time to run! */ if (++n >= bound_limit)
@@ -8140,12 +8136,11 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)dma_rxfill (wlc_hw->di[fifo]);/* process each frame */ -while ((p = head) !=NULL ) { + skb_queue_walk_safe(&recv_frames, p, next) {struct d11rxhdr_le *rxh_le;struct d11rxhdr *rxh; - head = head->prev; - p->prev =NULL ; +skb_unlink (p, &recv_frames); rxh_le = (struct d11rxhdr_le *)p->data; rxh = (struct d11rxhdr *)p->data;
Signature · 1 line
1.7.4.1
PATCH v2 14/17 brcm80211: fmac: use brcmf_add_if for all net devices
In reply to Arend van SprielFrom: Franky Lin <[email protected]>
Use brcmf_add_if for primary and virtual net device interfaces. This is part of the net device interface clean up for fullmac.
--- drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 3 +- .../net/wireless/brcm80211/brcmfmac/dhd_common.c | 5 +- .../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 125 ++++++++------------ drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 7 +- 4 files changed, 54 insertions(+), 86 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd.h +1 -2
@@ -729,8 +729,7 @@ extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx,extern void brcmf_c_init (void );extern int brcmf_add_if (struct brcmf_info *drvr_priv,int ifidx, -struct net_device *ndev,char *name,u8 *mac_addr, -u32 flags,u8 bssidx); +char *name,u8 *mac_addr);extern void brcmf_del_if (struct brcmf_info *drvr_priv,int ifidx);/* Send packet to dongle via data channel */
drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +2 -3
@@ -488,10 +488,9 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,if (ifevent->ifidx >0 && ifevent->ifidx <BRCMF_MAX_IFS ) {if (ifevent->action ==BRCMF_E_IF_ADD ) -brcmf_add_if (drvr_priv, ifevent->ifidx,NULL , +brcmf_add_if (drvr_priv, ifevent->ifidx, event->ifname, - pvt_data->eth.h_dest, - ifevent->flags, ifevent->bssidx); + pvt_data->eth.h_dest);else brcmf_del_if (drvr_priv, ifevent->ifidx); }else {
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +47 -78
185 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +4 -3
@@ -4546,9 +4546,10 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, goto fail; } } -/* Ok, have the per-port tell the stack we're open for business */ -if (brcmf_net_attach (bus->drvr,0 ) !=0 ) { -brcmf_dbg (ERROR ,"Net attach failed!!\n" ); + +/* add interface and open for business */ +if (brcmf_add_if ((struct brcmf_info *)bus->drvr,0 ,"wlan%d" ,NULL )) { +brcmf_dbg (ERROR ,"Add primary net device interface failed!!\n" ); goto fail; }
Signature · 1 line
1.7.4.1
PATCH v2 15/17 brcm80211: fmac: store brcmf_if in net device private data
In reply to Arend van SprielFrom: Franky Lin <[email protected]>
Make a proper use of private data area of net device by storing interface related data structure instead of generic driver data
--- drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 1 - .../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 165 +++++++------------- 2 files changed, 56 insertions(+), 110 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd.h +0 -1
@@ -123,7 +123,6 @@/* For supporting multiple interfaces */ #define BRCMF_MAX_IFS 16#define BRCMF_DEL_IF -0xe -#define BRCMF_BAD_IF -0xf#define DOT11_BSSTYPE_ANY 2#define DOT11_MAX_DEFAULT_KEYS 4
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +56 -109
319 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v2 17/17 brcm80211: smac: change buffer endianess convert function interface
In reply to Arend van SprielThe buffer endianess conversion functions in srom.c had a size argument giving number of bytes but the function converts words. Providing the number of words to the function is more sensible so that is done in this patch.
--- drivers/net/wireless/brcm80211/brcmsmac/srom.c | 33 +++++++++++------------- 1 files changed, 15 insertions(+), 18 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/srom.c +15 -18
@@ -617,18 +617,16 @@ static uint mask_width(u16 mask)return 0 ; } -static inline void le16_to_cpu_buf (u16 *buf,unsigned int size) +static inline void le16_to_cpu_buf (u16 *buf,uint nwords) { - size /=2 ; -while (size--) - *(buf + size) =le16_to_cpu (*(__le16 *)(buf + size)); +while (nwords--) + *(buf + nwords) =le16_to_cpu (*(__le16 *)(buf + nwords)); } -static inline void cpu_to_le16_buf (u16 *buf,unsigned int size) +static inline void cpu_to_le16_buf (u16 *buf,uint nwords) { - size /=2 ; -while (size--) - *(__le16 *)(buf + size) =cpu_to_le16 (*(buf + size)); +while (nwords--) + *(__le16 *)(buf + nwords) =cpu_to_le16 (*(buf + nwords)); }/*
@@ -807,12 +805,12 @@ sprom_read_pci(struct si_pub *sih, u8 __iomem *sprom, uint wordoff, err = -EIO ; else/* now correct the endianness of the byte array */ -le16_to_cpu_buf (buf ,nbytes ); +le16_to_cpu_buf (buf ,nwords );return err; } -static int otp_read_pci (struct si_pub *sih,u16 *buf,uint bufsz) +static int otp_read_pci (struct si_pub *sih,u16 *buf,uint nwords) {u8 *otp;uint sz =OTP_SZ_MAX /2 ;/* size in words */
@@ -824,7 +822,8 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz) err =otp_read_region (sih,OTP_HW_RGN , (u16 *) otp, &sz); -memcpy (buf, otp, bufsz); + sz =min_t (uint, sz, nwords); +memcpy (buf, otp, sz *2 );kfree (otp);
@@ -836,14 +835,12 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)*/ return -ENODATA ; -/* fixup the endianness so crc8 will pass */ -cpu_to_le16_buf (buf, bufsz); -if (crc8 (brcms_srom_crc8_table, (u8 *) buf,SROM4_WORDS *2 , +if (crc8 (brcms_srom_crc8_table, (u8 *) buf, sz *2 ,CRC8_INIT_VALUE ) !=CRC8_GOOD_VALUE (brcms_srom_crc8_table)) err = -EIO ; - -/* now correct the endianness of the byte array */ -le16_to_cpu_buf (buf, bufsz); +else +/* now correct the endianness of the byte array */ +le16_to_cpu_buf (buf, sz);return err; }
@@ -880,7 +877,7 @@ static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap) sromrev = srom[SROM4_CRCREV ] &0xff ; }else {/* Use OTP if SPROM not available */ - err =otp_read_pci (sih, srom,SROM_MAX ); + err =otp_read_pci (sih, srom,SROM4_WORDS );if (err ==0 )/* OTP only contain SROM rev8/rev9 for now */ sromrev = srom[SROM4_CRCREV ] &0xff ;
Signature · 1 line
1.7.4.1
v2 cover fix mac80211 callback in brcmsmac and brcmfmac refactor
Johannes Berg commented on our use of the start/stop callbacks in brcmsmac and we changed those callbacks. In rfkill testing it revealed a problem which has been fixed in this series as well.
The brcmfmac driver had some restructuring in preparation of USB support for new devices.
This patch series applies to the wireless-testing repository and depends on the series posted on Oct 18, 2011 with message id:
Message-ID: <[email protected]>
It replaces the patch series sent earlier with message id:
Message-ID: <[email protected]>
Arend van Spriel (3):
brcm80211: smac: rename buffer endianess conversion functions
brcm80211: smac: use sk_buff list for handling frames in receive path
brcm80211: smac: change buffer endianess convert function interface
Franky Lin (5):
brcm80211: fmac: allow wd timer to be disabled when bus down
brcm80211: fmac: use brcmf_del_if for all net devices
brcm80211: fmac: use brcmf_add_if for all net devices
brcm80211: fmac: store brcmf_if in net device private data
brcm80211: fmac: remove state from brcmf_if in fullmac
Roland Vossen (9):
brcm80211: smac: removed MPC related code
brcm80211: smac: removed MPC related variables
brcm80211: smac: removed down-on-watchdog MPC functionality
brcm80211: smac: removed down-on-rf-kill functionality
brcm80211: smac: bugfix for tx mute in brcms_b_init()
brcm80211: smac: fixed inconsistency in transmit mute
brcm80211: smac: modified Mac80211 callback interface
brcm80211: smac: mute transmit on ops_start
brcm80211: smac: changed check to confirm STA only support
drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 5 +- .../net/wireless/brcm80211/brcmfmac/dhd_common.c | 5 +- .../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 301 +++++++------------- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 15 +- drivers/net/wireless/brcm80211/brcmsmac/dma.c | 38 ++- drivers/net/wireless/brcm80211/brcmsmac/dma.h | 3 +- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 100 +++---- .../net/wireless/brcm80211/brcmsmac/mac80211_if.h | 1 + drivers/net/wireless/brcm80211/brcmsmac/main.c | 219 ++------------ drivers/net/wireless/brcm80211/brcmsmac/main.h | 11 - drivers/net/wireless/brcm80211/brcmsmac/pub.h | 4 +- drivers/net/wireless/brcm80211/brcmsmac/srom.c | 33 +-- drivers/net/wireless/brcm80211/include/defs.h | 1 - 13 files changed, 232 insertions(+), 504 deletions(-)
Signature · 1 line
1.7.4.1
PATCH v2 1/17 brcm80211: fmac: allow wd timer to be disabled when bus down
From: Franky Lin <[email protected]>
Watchdog timer should be able to be stopped even firmware is not loaded.
--- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +4 -4
@@ -4579,10 +4579,6 @@ struct device *brcmf_bus_get_device(struct brcmf_bus *bus)void brcmf_sdbrcm_wd_timer (struct brcmf_bus *bus,uint wdtick) { -/* don't start the wd until fw is loaded */ -if (bus->drvr->busstate ==BRCMF_BUS_DOWN ) -return ; -/* Totally stop the timer */ if (!wdtick && bus->wd_timer_valid == true) {del_timer_sync (&bus->timer);
@@ -4591,6 +4587,10 @@ brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick)return ; } +/* don't start the wd until fw is loaded */ +if (bus->drvr->busstate ==BRCMF_BUS_DOWN ) +return ; +if (wdtick) {if (bus->save_ms !=BRCMF_WD_POLL_MS ) {if (bus->wd_timer_valid == true)
Signature · 1 line
1.7.4.1
PATCH v2 3/17 brcm80211: smac: removed MPC related code
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
The chip init sequence enables MPC (Minimum Power Consumption), but the driver disables it after that. As there are no interfaces to enable this mode the related code is unused (member variable wlc->mpc is false).
--- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 2 +- drivers/net/wireless/brcm80211/brcmsmac/main.c | 70 ++------------------ drivers/net/wireless/brcm80211/brcmsmac/main.h | 2 - drivers/net/wireless/brcm80211/brcmsmac/pub.h | 2 +- 4 files changed, 8 insertions(+), 68 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +1 -1
@@ -1079,7 +1079,7 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device, wl->pub->ieee_hw = hw;/* disable mpc */ -brcms_c_set_radio_mpc (wl->wlc, false); +brcms_c_set_radio_mpc (wl->wlc);/* register our interrupt handler */ if (request_irq (irq, brcms_isr,IRQF_SHARED ,KBUILD_MODNAME , wl)) {
drivers/net/wireless/brcm80211/brcmsmac/main.c +6 -64
108 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmsmac/main.h +0 -2
@@ -427,7 +427,6 @@ struct brcms_txq_info {* bandinit_pending: track band init in auto band. * radio_monitor: radio timer is running. * going_down: down path intermediate variable. -* mpc: enable minimum power consumption. * mpc_dlycnt: # of watchdog cnt before turn disable radio. * mpc_offcnt: # of watchdog cnt that radio is disabled. * mpc_delay_off: delay radio disable by # of watchdog cnt.
@@ -522,7 +521,6 @@ struct brcms_c_info {bool radio_monitor;bool going_down; -bool mpc;u8 mpc_dlycnt;u8 mpc_offcnt;u8 mpc_delay_off;
drivers/net/wireless/brcm80211/brcmsmac/pub.h +1 -1
@@ -596,7 +596,7 @@ extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval);extern int brcms_c_set_tx_power (struct brcms_c_info *wlc,int txpwr);extern int brcms_c_get_tx_power (struct brcms_c_info *wlc); -extern void brcms_c_set_radio_mpc (struct brcms_c_info *wlc,bool mpc); +extern void brcms_c_set_radio_mpc (struct brcms_c_info *wlc);extern bool brcms_c_check_radio_disabled (struct brcms_c_info *wlc);#endif /* _BRCM_PUB_H_ */
Signature · 1 line
1.7.4.1
PATCH v2 4/17 brcm80211: smac: removed MPC related variables
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Several member variables were never read.
--- drivers/net/wireless/brcm80211/brcmsmac/main.c | 8 ++------ drivers/net/wireless/brcm80211/brcmsmac/main.h | 6 ------ 2 files changed, 2 insertions(+), 12 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/main.c +2 -6
@@ -4303,10 +4303,6 @@ static void brcms_c_radio_timer(void *arg)return ; } -/* cap mpc off count */ -if (wlc->mpc_offcnt <BRCMS_MPC_MAX_DELAYCNT ) - wlc->mpc_offcnt++; -brcms_c_radio_hwdisable_upd (wlc);brcms_c_radio_upd (wlc); }
@@ -4488,7 +4484,7 @@ static void brcms_c_info_init(struct brcms_c_info *wlc, int unit) wlc->pub->bcmerror =0 ;/* initialize mpc delay */ - wlc->mpc_delay_off = wlc->mpc_dlycnt =BRCMS_MPC_MIN_DELAYCNT ; + wlc->mpc_delay_off =BRCMS_MPC_MIN_DELAYCNT ; }static uint brcms_c_attach_module (struct brcms_c_info *wlc)
@@ -8447,7 +8443,7 @@ void brcms_c_init(struct brcms_c_info *wlc)W_REG (&wlc->regs->rfdisabledly,RFDISABLE_DEFAULT );/* initialize mpc delay */ - wlc->mpc_delay_off = wlc->mpc_dlycnt =BRCMS_MPC_MIN_DELAYCNT ; + wlc->mpc_delay_off =BRCMS_MPC_MIN_DELAYCNT ;/* * Initialize WME parameters; if they haven't been set by some other
drivers/net/wireless/brcm80211/brcmsmac/main.h +0 -6
@@ -427,10 +427,7 @@ struct brcms_txq_info {* bandinit_pending: track band init in auto band. * radio_monitor: radio timer is running. * going_down: down path intermediate variable. -* mpc_dlycnt: # of watchdog cnt before turn disable radio. -* mpc_offcnt: # of watchdog cnt that radio is disabled. * mpc_delay_off: delay radio disable by # of watchdog cnt. -* prev_non_delay_mpc: prev state brcms_c_is_non_delay_mpc. * wdtimer: timer for watchdog routine. * radio_timer: timer for hw radio button monitor routine. * monitor: monitor (MPDU sniffing) mode.
@@ -521,10 +518,7 @@ struct brcms_c_info {bool radio_monitor;bool going_down; -u8 mpc_dlycnt; -u8 mpc_offcnt;u8 mpc_delay_off; -u8 prev_non_delay_mpc;struct brcms_timer *wdtimer;struct brcms_timer *radio_timer;
Signature · 1 line
1.7.4.1
PATCH v2 7/17 brcm80211: smac: bugfix for tx mute in brcms_b_init()
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Transmit can only be muted if the mac core is enabled. When brcms_b_init() is called, the mac core is suspended. Brcms_b_init() calls a transmit mute function that requires an enabled mac core. This code path is never taken, but would have been taken in subsequent patches.
--- drivers/net/wireless/brcm80211/brcmsmac/main.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/main.c +8 -8
@@ -2452,6 +2452,7 @@ static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw, } } +/* precondition: requires the mac core to be enabled */ static void brcms_b_mute (struct brcms_hardware *wlc_hw,bool on,u32 flags) {static const u8 null_ether_addr[ETH_ALEN ] = {0 ,0 ,0 ,0 ,0 ,0 };
@@ -3354,8 +3355,7 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc) }void -static brcms_b_init (struct brcms_hardware *wlc_hw,u16 chanspec, -bool mute) { +static brcms_b_init (struct brcms_hardware *wlc_hw,u16 chanspec) {u32 macintmask;bool fastclk;struct brcms_c_info *wlc = wlc_hw->wlc;
@@ -3380,10 +3380,6 @@ static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec,/* core-specific initialization */ brcms_b_coreinit (wlc); -/* suspend the tx fifos and mute the phy for preism cac time */ -if (mute) -brcms_b_mute (wlc_hw,ON ,PHY_MUTE_FOR_PREISM ); -/* band-specific inits */ brcms_b_bsinit (wlc, chanspec);
@@ -8261,7 +8257,7 @@ void brcms_c_init(struct brcms_c_info *wlc) {struct d11regs __iomem *regs;u16 chanspec; -bool mute = false; +bool mute_tx = false;BCMMSG (wlc->wiphy,"wl%d\n" , wlc->pub->unit);
@@ -8277,7 +8273,7 @@ void brcms_c_init(struct brcms_c_info *wlc)else chanspec =brcms_c_init_chanspec (wlc); -brcms_b_init (wlc->hw, chanspec, mute); +brcms_b_init (wlc->hw, chanspec);/* update beacon listen interval */ brcms_c_bcn_li_upd (wlc);
@@ -8343,6 +8339,10 @@ void brcms_c_init(struct brcms_c_info *wlc)/* ..now really unleash hell (allow the MAC out of suspend) */ brcms_c_enable_mac (wlc); +/* suspend the tx fifos and mute the phy for preism cac time */ +if (mute_tx) +brcms_b_mute (wlc->hw,ON ,PHY_MUTE_FOR_PREISM ); +/* clear tx flow control */ brcms_c_txflowcontrol_reset (wlc);
Signature · 1 line
1.7.4.1
PATCH v2 9/17 brcm80211: smac: modified Mac80211 callback interface
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Upon ops_start(), a Mac80211 driver should enable receive functionality to support monitor mode. Also, upon ops_stop(), it should disable rx.
Driver did not follow this rule so code has been changed.
--- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 84 +++++++++----------- 1 files changed, 37 insertions(+), 47 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +37 -47
@@ -284,6 +284,7 @@ static int brcms_ops_start(struct ieee80211_hw *hw) {struct brcms_info *wl = hw->priv;bool blocked; +int err;ieee80211_wake_queues (hw);spin_lock_bh (&wl->lock);
@@ -292,20 +293,48 @@ static int brcms_ops_start(struct ieee80211_hw *hw)if (!blocked)wiphy_rfkill_stop_polling (wl->pub->ieee_hw->wiphy); -return 0 ; +spin_lock_bh (&wl->lock); +if (!wl->pub->up) + err =brcms_up (wl); +else + err = -ENODEV ; +spin_unlock_bh (&wl->lock); + +if (err !=0 ) +wiphy_err (hw->wiphy,"%s: brcms_up() returned %d\n" , __func__, + err); +return err; }static void brcms_ops_stop (struct ieee80211_hw *hw) { +struct brcms_info *wl = hw->priv; +int status; +ieee80211_stop_queues (hw); + +if (wl->wlc ==NULL ) +return ; + +spin_lock_bh (&wl->lock); + status =brcms_c_chipmatch (wl->wlc->hw->vendorid, + wl->wlc->hw->deviceid); +spin_unlock_bh (&wl->lock); +if (!status) { +wiphy_err (wl->wiphy, +"wl: brcms_ops_stop: chipmatch failed\n" ); +return ; + } + +/* put driver in down state */ +spin_lock_bh (&wl->lock); +brcms_down (wl); +spin_unlock_bh (&wl->lock); }static int brcms_ops_add_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) { -struct brcms_info *wl; -int err; -/* Just STA for now */ if (vif->type != NL80211_IFTYPE_AP && vif->type != NL80211_IFTYPE_MESH_POINT &&
@@ -317,32 +346,12 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)return -EOPNOTSUPP ; } - wl = hw->priv; -spin_lock_bh (&wl->lock); -if (!wl->pub->up) - err =brcms_up (wl); -else - err = -ENODEV ; -spin_unlock_bh (&wl->lock); - -if (err !=0 ) -wiphy_err (hw->wiphy,"%s: brcms_up() returned %d\n" , __func__, - err); - -return err; +return 0 ; }static void brcms_ops_remove_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) { -struct brcms_info *wl; - - wl = hw->priv; - -/* put driver in down state */ -spin_lock_bh (&wl->lock); -brcms_down (wl); -spin_unlock_bh (&wl->lock); }static int brcms_ops_config (struct ieee80211_hw *hw,u32 changed)
@@ -874,37 +883,18 @@ static void brcms_free(struct brcms_info *wl) }/* -* called from both kernel as from this kernel module. +* called from both kernel as from this kernel module (error flow on attach) * precondition: perimeter lock is not acquired. */ static void brcms_remove (struct pci_dev *pdev) { -struct brcms_info *wl; -struct ieee80211_hw *hw; -int status; - - hw =pci_get_drvdata (pdev); - wl = hw->priv; -if (!wl) { -pr_err ("wl: brcms_remove: pci_get_drvdata failed\n" ); -return ; - } +struct ieee80211_hw *hw =pci_get_drvdata (pdev); +struct brcms_info *wl = hw->priv; -spin_lock_bh (&wl->lock); - status =brcms_c_chipmatch (pdev->vendor, pdev->device); -spin_unlock_bh (&wl->lock); -if (!status) { -wiphy_err (wl->wiphy,"wl: brcms_remove: chipmatch " -"failed\n" ); -return ; - }if (wl->wlc) {wiphy_rfkill_set_hw_state (wl->pub->ieee_hw->wiphy, false);wiphy_rfkill_stop_polling (wl->pub->ieee_hw->wiphy);ieee80211_unregister_hw (hw); -spin_lock_bh (&wl->lock); -brcms_down (wl); -spin_unlock_bh (&wl->lock); }pci_disable_device (pdev);
Signature · 1 line
1.7.4.1
PATCH v2 10/17 brcm80211: smac: mute transmit on ops_start
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Monitor mode functionality (not functional yet) requires transmit to be muted after ops_start() is called, transmit is unmuted when the first interface is added.
--- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 11 +++++++++-- .../net/wireless/brcm80211/brcmsmac/mac80211_if.h | 1 + drivers/net/wireless/brcm80211/brcmsmac/main.c | 10 ++++++++-- drivers/net/wireless/brcm80211/brcmsmac/pub.h | 3 ++- 4 files changed, 20 insertions(+), 5 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +9 -2
@@ -294,6 +294,9 @@ static int brcms_ops_start(struct ieee80211_hw *hw)wiphy_rfkill_stop_polling (wl->pub->ieee_hw->wiphy);spin_lock_bh (&wl->lock); +/* avoid acknowledging frames before a non-monitor device is added */ + wl->mute_tx = true; +if (!wl->pub->up) err =brcms_up (wl);else
@@ -335,6 +338,8 @@ static void brcms_ops_stop(struct ieee80211_hw *hw)static int brcms_ops_add_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) { +struct brcms_info *wl = hw->priv; +/* Just STA for now */ if (vif->type != NL80211_IFTYPE_AP && vif->type != NL80211_IFTYPE_MESH_POINT &&
@@ -346,6 +351,9 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)return -EOPNOTSUPP ; } + wl->mute_tx = false; +brcms_c_mute (wl->wlc, false); +return 0 ; }
@@ -1303,8 +1311,7 @@ void brcms_init(struct brcms_info *wl) {BCMMSG (wl->pub->ieee_hw->wiphy,"wl%d\n" , wl->pub->unit);brcms_reset (wl); - -brcms_c_init (wl->wlc); +brcms_c_init (wl->wlc, wl->mute_tx); }/*
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h +1 -0
@@ -80,6 +80,7 @@ struct brcms_info {struct brcms_firmware fw;struct wiphy *wiphy;struct brcms_ucode ucode; +bool mute_tx; };/* misc callbacks */
drivers/net/wireless/brcm80211/brcmsmac/main.c +8 -2
@@ -2396,6 +2396,7 @@ void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask)W_REG (&wlc_hw->regs->macintmask, wlc->macintmask); } +/* assumes that the d11 MAC is enabled */ static void brcms_b_tx_fifo_suspend (struct brcms_hardware *wlc_hw,uint tx_fifo) {
@@ -2487,6 +2488,12 @@ static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool mute_tx)brcms_c_ucode_mute_override_clear (wlc_hw); } +void +brcms_c_mute (struct brcms_c_info *wlc,bool mute_tx) +{ +brcms_b_mute (wlc->hw, mute_tx); +} +/* * Read and clear macintmask and macintstatus and intstatus registers. * This routine should be called with interrupts off
@@ -8253,11 +8260,10 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)return wlc->macintstatus !=0 ; } -void brcms_c_init (struct brcms_c_info *wlc) +void brcms_c_init (struct brcms_c_info *wlc,bool mute_tx) {struct d11regs __iomem *regs;u16 chanspec; -bool mute_tx = false;BCMMSG (wlc->wiphy,"wl%d\n" , wlc->pub->unit);
drivers/net/wireless/brcm80211/brcmsmac/pub.h +2 -1
@@ -540,7 +540,7 @@ extern int brcms_c_up(struct brcms_c_info *wlc);extern uint brcms_c_down (struct brcms_c_info *wlc);extern bool brcms_c_chipmatch (u16 vendor,u16 device); -extern void brcms_c_init (struct brcms_c_info *wlc); +extern void brcms_c_init (struct brcms_c_info *wlc,bool mute_tx);extern void brcms_c_reset (struct brcms_c_info *wlc);extern void brcms_c_intrson (struct brcms_c_info *wlc);
@@ -597,5 +597,6 @@ extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc,extern int brcms_c_set_tx_power (struct brcms_c_info *wlc,int txpwr);extern int brcms_c_get_tx_power (struct brcms_c_info *wlc);extern bool brcms_c_check_radio_disabled (struct brcms_c_info *wlc); +extern void brcms_c_mute (struct brcms_c_info *wlc,bool on);#endif /* _BRCM_PUB_H_ */
Signature · 1 line
1.7.4.1
PATCH v2 16/17 brcm80211: fmac: remove state from brcmf_if in fullmac
In reply to Arend van SprielFrom: Franky Lin <[email protected]>
The usage of state decrease readability. Optimize the code flow to get rid of it
--- drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 1 - .../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd.h +0 -1
@@ -122,7 +122,6 @@/* For supporting multiple interfaces */ #define BRCMF_MAX_IFS 16 -#define BRCMF_DEL_IF -0xe#define DOT11_BSSTYPE_ANY 2#define DOT11_MAX_DEFAULT_KEYS 4
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +2 -8
@@ -58,7 +58,6 @@ struct brcmf_if {struct net_device *ndev;struct net_device_stats stats;int idx;/* iface idx in dongle */ -int state;/* interface state */ u8 mac_addr[ETH_ALEN ];/* assigned MAC address */ };
@@ -456,12 +455,10 @@ void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb,skb_mac_header (skb), &event, &data); -if (drvr_priv->iflist[ifidx] && - !drvr_priv->iflist[ifidx]->state) +if (drvr_priv->iflist[ifidx]) { ifp = drvr_priv->iflist[ifidx]; - -if (ifp->ndev) ifp->ndev->last_rx = jiffies; + } drvr->dstats.rx_bytes += skb->len; drvr->rx_packets++;/* Local count */
@@ -896,7 +893,6 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, char *name, u8 *mac_addr) ifp->ndev = ndev; ifp->info = drvr_priv; drvr_priv->iflist[ifidx] = ifp; - ifp->state =BRCMF_E_IF_ADD ; ifp->idx = ifidx;if (mac_addr !=NULL )memcpy (&ifp->mac_addr, mac_addr,ETH_ALEN );
@@ -910,7 +906,6 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, char *name, u8 *mac_addr)brcmf_dbg (TRACE ," ==== pid:%x, net_device for if:%s created ===\n" , current->pid, ifp->ndev->name); - ifp->state =0 ;return 0 ; }
@@ -926,7 +921,6 @@ void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx)brcmf_dbg (ERROR ,"Null interface\n" );return ; } - ifp->state =BRCMF_E_IF_DEL ;if (ifp->ndev) {if (ifidx ==0 ) {if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
Signature · 1 line
1.7.4.1