2011-04-19 07:13:59

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 0/2] staging: brcm80211: removal of obsolete mips code

Code cleanup. Follow up on feedback from John Linville.

Roland Vossen (2):
staging: brcm80211: removed #ifdef __mips__
staging: brcm80211: removed BCMFASTPATH macro

.../staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c | 50 +-------------------
drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c | 2 +-
drivers/staging/brcm80211/brcmsmac/wl_mac80211.c | 8 ++--
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c | 10 ++--
drivers/staging/brcm80211/brcmsmac/wlc_antsel.c | 2 +-
drivers/staging/brcm80211/brcmsmac/wlc_bmac.c | 12 ++--
drivers/staging/brcm80211/brcmsmac/wlc_main.c | 40 ++++++++--------
drivers/staging/brcm80211/brcmsmac/wlc_rate.c | 4 +-
drivers/staging/brcm80211/include/bcmdefs.h | 6 --
drivers/staging/brcm80211/include/bcmutils.h | 31 ------------
drivers/staging/brcm80211/util/bcmutils.c | 44 +++--------------
drivers/staging/brcm80211/util/hnddma.c | 37 +++------------
12 files changed, 55 insertions(+), 191 deletions(-)




2011-04-19 13:57:24

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: brcm80211: removed #ifdef __mips__

On Tue, 2011-04-19 at 15:49 +0200, Michael Büsch wrote:
> On Tue, 2011-04-19 at 15:45 +0200, Roland Vossen wrote:
> > Hello guys,
> >
> > Greg, please drop this patch set. Rest of this email is FYI only.
> >
> > Michael:
> >
> > > Are you sure? __mips__ is automagically defined by GCC, if compiling
> > > for MIPS. Maybe it should be converted to some CONFIG_... symbol.
> > > But removal seems wrong.
> >
> > You are right. The majority of the removed #ifdef __mips__ code has to
> > do with write flushing. To accomplish this, it performs a R_REG after a
> > W_REG. I assumed that writeb() and friends guarantee ordering and write
> > flushing, but after some reading I learned that this is not the case.
> >
> > I will rework the code and submit a new patch set.
> >
> > For some background info: this patch was a reaction on an email from
> > John Linville to us. John wrote:
> >
> > <quote>
> > I took a quick run through a pull of staging from today. I made a few
> > notes, but a lot of them would seem to relate to the utils stuff you
> > mention above. One general comment would be that there still seems
> > to be a lot of MIPS-specific stuff buried in the code, in particular
> > a lot of "#ifdef __mips__" stuff that if necessary should at least
> > be hidden inside the W_REG macro.
> > </quote>
>
> You should probably create a new macro W_REG_FLUSH or something like
> that, which enforces ordering by reading back the register, if required.
> That avoids ugly #ifdefs in the code.

I don't see how write flushing would be MIPS specific anyway? It's a
function of the bus (PCI), not the host architecture, no?

johannes



2011-04-19 12:10:14

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: brcm80211: removed #ifdef __mips__

On Tue, 2011-04-19 at 09:13 +0200, Roland Vossen wrote:
> Code cleanup. __mips__ was undefined for current builds.
>
> Signed-off-by: Roland Vossen <[email protected]>
> Reviewed-by: Arend van Spriel <[email protected]>
> ---
> .../staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c | 48 --------------------
> drivers/staging/brcm80211/include/bcmdefs.h | 4 --
> drivers/staging/brcm80211/include/bcmutils.h | 31 -------------
> drivers/staging/brcm80211/util/bcmutils.c | 28 -----------
> drivers/staging/brcm80211/util/hnddma.c | 23 ---------
> 5 files changed, 0 insertions(+), 134 deletions(-)
>
> diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
> index 40f0444..92133c7 100644
> --- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
> +++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
> @@ -246,15 +246,9 @@ u16 read_radio_reg(phy_info_t *pi, u16 addr)
> (D11REV_IS(pi->sh->corerev, 22)
> && (pi->pubpi.phy_type != PHY_TYPE_SSN))) {
> W_REG(&pi->regs->radioregaddr, addr);
> -#ifdef __mips__
> - (void)R_REG(&pi->regs->radioregaddr);
> -#endif

Are you sure? __mips__ is automagically defined by GCC, if compiling
for MIPS. Maybe it should be converted to some CONFIG_... symbol.
But removal seems wrong.

--
Greetings Michael.


2011-04-19 07:13:59

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 1/2] staging: brcm80211: removed #ifdef __mips__

Code cleanup. __mips__ was undefined for current builds.

Signed-off-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
---
.../staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c | 48 --------------------
drivers/staging/brcm80211/include/bcmdefs.h | 4 --
drivers/staging/brcm80211/include/bcmutils.h | 31 -------------
drivers/staging/brcm80211/util/bcmutils.c | 28 -----------
drivers/staging/brcm80211/util/hnddma.c | 23 ---------
5 files changed, 0 insertions(+), 134 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
index 40f0444..92133c7 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
@@ -246,15 +246,9 @@ u16 read_radio_reg(phy_info_t *pi, u16 addr)
(D11REV_IS(pi->sh->corerev, 22)
&& (pi->pubpi.phy_type != PHY_TYPE_SSN))) {
W_REG(&pi->regs->radioregaddr, addr);
-#ifdef __mips__
- (void)R_REG(&pi->regs->radioregaddr);
-#endif
data = R_REG(&pi->regs->radioregdata);
} else {
W_REG(&pi->regs->phy4waddr, addr);
-#ifdef __mips__
- (void)R_REG(&pi->regs->phy4waddr);
-#endif

#ifdef __ARM_ARCH_4T__
__asm__(" .align 4 ");
@@ -280,15 +274,9 @@ void write_radio_reg(phy_info_t *pi, u16 addr, u16 val)
&& (pi->pubpi.phy_type != PHY_TYPE_SSN))) {

W_REG(&pi->regs->radioregaddr, addr);
-#ifdef __mips__
- (void)R_REG(&pi->regs->radioregaddr);
-#endif
W_REG(&pi->regs->radioregdata, val);
} else {
W_REG(&pi->regs->phy4waddr, addr);
-#ifdef __mips__
- (void)R_REG(&pi->regs->phy4waddr);
-#endif
W_REG(&pi->regs->phy4wdatalo, val);
}

@@ -311,28 +299,16 @@ static u32 read_radio_id(phy_info_t *pi)
u32 b0, b1, b2;

W_REG(&pi->regs->radioregaddr, 0);
-#ifdef __mips__
- (void)R_REG(&pi->regs->radioregaddr);
-#endif
b0 = (u32) R_REG(&pi->regs->radioregdata);
W_REG(&pi->regs->radioregaddr, 1);
-#ifdef __mips__
- (void)R_REG(&pi->regs->radioregaddr);
-#endif
b1 = (u32) R_REG(&pi->regs->radioregdata);
W_REG(&pi->regs->radioregaddr, 2);
-#ifdef __mips__
- (void)R_REG(&pi->regs->radioregaddr);
-#endif
b2 = (u32) R_REG(&pi->regs->radioregdata);

id = ((b0 & 0xf) << 28) | (((b2 << 8) | b1) << 12) | ((b0 >> 4)
& 0xf);
} else {
W_REG(&pi->regs->phy4waddr, RADIO_IDCODE);
-#ifdef __mips__
- (void)R_REG(&pi->regs->phy4waddr);
-#endif
id = (u32) R_REG(&pi->regs->phy4wdatalo);
id |= (u32) R_REG(&pi->regs->phy4wdatahi) << 16;
}
@@ -396,10 +372,6 @@ u16 read_phy_reg(phy_info_t *pi, u16 addr)
regs = pi->regs;

W_REG(&regs->phyregaddr, addr);
-#ifdef __mips__
- (void)R_REG(&regs->phyregaddr);
-#endif
-
pi->phy_wreg = 0;
return R_REG(&regs->phyregdata);
}
@@ -410,13 +382,6 @@ void write_phy_reg(phy_info_t *pi, u16 addr, u16 val)

regs = pi->regs;

-#ifdef __mips__
- W_REG(&regs->phyregaddr, addr);
- (void)R_REG(&regs->phyregaddr);
- W_REG(&regs->phyregdata, val);
- if (addr == 0x72)
- (void)R_REG(&regs->phyregdata);
-#else
W_REG((u32 *)(&regs->phyregaddr),
addr | (val << 16));
if (pi->sh->bustype == PCI_BUS) {
@@ -425,7 +390,6 @@ void write_phy_reg(phy_info_t *pi, u16 addr, u16 val)
(void)R_REG(&regs->phyversion);
}
}
-#endif
}

void and_phy_reg(phy_info_t *pi, u16 addr, u16 val)
@@ -435,10 +399,6 @@ void and_phy_reg(phy_info_t *pi, u16 addr, u16 val)
regs = pi->regs;

W_REG(&regs->phyregaddr, addr);
-#ifdef __mips__
- (void)R_REG(&regs->phyregaddr);
-#endif
-
W_REG(&regs->phyregdata, (R_REG(&regs->phyregdata) & val));
pi->phy_wreg = 0;
}
@@ -450,10 +410,6 @@ void or_phy_reg(phy_info_t *pi, u16 addr, u16 val)
regs = pi->regs;

W_REG(&regs->phyregaddr, addr);
-#ifdef __mips__
- (void)R_REG(&regs->phyregaddr);
-#endif
-
W_REG(&regs->phyregdata, (R_REG(&regs->phyregdata) | val));
pi->phy_wreg = 0;
}
@@ -465,10 +421,6 @@ void mod_phy_reg(phy_info_t *pi, u16 addr, u16 mask, u16 val)
regs = pi->regs;

W_REG(&regs->phyregaddr, addr);
-#ifdef __mips__
- (void)R_REG(&regs->phyregaddr);
-#endif
-
W_REG(&regs->phyregdata,
((R_REG(&regs->phyregdata) & ~mask) | (val & mask)));
pi->phy_wreg = 0;
diff --git a/drivers/staging/brcm80211/include/bcmdefs.h b/drivers/staging/brcm80211/include/bcmdefs.h
index 22a389e..5d1a620 100644
--- a/drivers/staging/brcm80211/include/bcmdefs.h
+++ b/drivers/staging/brcm80211/include/bcmdefs.h
@@ -36,11 +36,7 @@

#define AUTO (-1) /* Auto = -1 */

-#ifdef mips
-#define BCMFASTPATH __attribute__ ((__section__(".text.fastpath")))
-#else
#define BCMFASTPATH
-#endif

/* Bus types */
#define SI_BUS 0 /* SOC Interconnect */
diff --git a/drivers/staging/brcm80211/include/bcmutils.h b/drivers/staging/brcm80211/include/bcmutils.h
index f2e81e5..3a6d500 100644
--- a/drivers/staging/brcm80211/include/bcmutils.h
+++ b/drivers/staging/brcm80211/include/bcmutils.h
@@ -299,43 +299,12 @@ extern void osl_assert(char *exp, char *file, int line);

/* register access macros */
#ifndef IL_BIGENDIAN
-#ifndef __mips__
#define R_REG(r) (\
SELECT_BUS_READ(sizeof(*(r)) == sizeof(u8) ? \
readb((volatile u8*)(r)) : \
sizeof(*(r)) == sizeof(u16) ? readw((volatile u16*)(r)) : \
readl((volatile u32*)(r)), OSL_READ_REG(r)) \
)
-#else /* __mips__ */
-#define R_REG(r) (\
- SELECT_BUS_READ( \
- ({ \
- __typeof(*(r)) __osl_v; \
- __asm__ __volatile__("sync"); \
- switch (sizeof(*(r))) { \
- case sizeof(u8): \
- __osl_v = readb((volatile u8*)(r)); \
- break; \
- case sizeof(u16): \
- __osl_v = readw((volatile u16*)(r)); \
- break; \
- case sizeof(u32): \
- __osl_v = \
- readl((volatile u32*)(r)); \
- break; \
- } \
- __asm__ __volatile__("sync"); \
- __osl_v; \
- }), \
- ({ \
- __typeof(*(r)) __osl_v; \
- __asm__ __volatile__("sync"); \
- __osl_v = OSL_READ_REG(r); \
- __asm__ __volatile__("sync"); \
- __osl_v; \
- })) \
-)
-#endif /* __mips__ */

#define W_REG(r, v) do { \
SELECT_BUS_WRITE( \
diff --git a/drivers/staging/brcm80211/util/bcmutils.c b/drivers/staging/brcm80211/util/bcmutils.c
index fcb091e..df1b6fe 100644
--- a/drivers/staging/brcm80211/util/bcmutils.c
+++ b/drivers/staging/brcm80211/util/bcmutils.c
@@ -724,37 +724,9 @@ u32 hndcrc32(u8 *pdata, /* pointer to array of data to process */
)
{
u8 *pend;
-#ifdef __mips__
- u8 tmp[4];
- unsigned long *tptr = (unsigned long *) tmp;
-
- /* in case the beginning of the buffer isn't aligned */
- pend = (u8 *) ((uint) (pdata + 3) & 0xfffffffc);
- nbytes -= (pend - pdata);
- while (pdata < pend)
- CRC_INNER_LOOP(32, crc, *pdata++);
-
- /* handle bulk of data as 32-bit words */
- pend = pdata + (nbytes & 0xfffffffc);
- while (pdata < pend) {
- *tptr = *(unsigned long *) pdata;
- pdata += sizeof(unsigned long *);
- CRC_INNER_LOOP(32, crc, tmp[0]);
- CRC_INNER_LOOP(32, crc, tmp[1]);
- CRC_INNER_LOOP(32, crc, tmp[2]);
- CRC_INNER_LOOP(32, crc, tmp[3]);
- }
-
- /* 1-3 bytes at end of buffer */
- pend = pdata + (nbytes & 0x03);
- while (pdata < pend)
- CRC_INNER_LOOP(32, crc, *pdata++);
-#else
pend = pdata + nbytes;
while (pdata < pend)
CRC_INNER_LOOP(32, crc, *pdata++);
-#endif /* __mips__ */
-
return crc;
}
/*
diff --git a/drivers/staging/brcm80211/util/hnddma.c b/drivers/staging/brcm80211/util/hnddma.c
index 26eeb1f..134caf2 100644
--- a/drivers/staging/brcm80211/util/hnddma.c
+++ b/drivers/staging/brcm80211/util/hnddma.c
@@ -27,10 +27,6 @@
#include <sbhnddma.h>
#include <hnddma.h>

-#if defined(__mips__)
-#include <asm/addrspace.h>
-#endif
-
#ifdef BRCM_FULLMAC
#error "hnddma.c shouldn't be needed for FULLMAC"
#endif
@@ -350,9 +346,6 @@ struct hnddma_pub *dma_attach(char *name, si_t *sih,
di->dataoffsetlow = di->ddoffsetlow;
di->dataoffsethigh = di->ddoffsethigh;
}
-#if defined(__mips__) && defined(IL_BIGENDIAN)
- di->dataoffsetlow = di->dataoffsetlow + SI_SDRAM_SWAPPED;
-#endif /* defined(__mips__) && defined(IL_BIGENDIAN) */
/* WAR64450 : DMACtl.Addr ext fields are not supported in SDIOD core. */
if ((ai_coreid(sih) == SDIOD_CORE_ID)
&& ((ai_corerev(sih) > 0) && (ai_corerev(sih) <= 2)))
@@ -467,12 +460,7 @@ dma64_dd_upd(dma_info_t *di, dma64dd_t *ddring, dmaaddr_t pa, uint outidx,
u32 ctrl2 = bufcount & D64_CTRL2_BC_MASK;

/* PCI bus with big(>1G) physical address, use address extension */
-#if defined(__mips__) && defined(IL_BIGENDIAN)
- if ((di->dataoffsetlow == SI_SDRAM_SWAPPED)
- || !(PHYSADDRLO(pa) & PCI32ADDR_HIGH)) {
-#else
if ((di->dataoffsetlow == 0) || !(PHYSADDRLO(pa) & PCI32ADDR_HIGH)) {
-#endif /* defined(__mips__) && defined(IL_BIGENDIAN) */
W_SM(&ddring[outidx].addrlow,
BUS_SWAP32(PHYSADDRLO(pa) + di->dataoffsetlow));
W_SM(&ddring[outidx].addrhigh,
@@ -726,17 +714,6 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)

len = le16_to_cpu(*(u16 *) (head->data));
DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
-
-#if defined(__mips__)
-#define OSL_UNCACHED(va) ((void *)KSEG1ADDR((va)))
- if (!len) {
- while (!(len = *(u16 *) OSL_UNCACHED(head->data)))
- udelay(1);
-
- *(u16 *) (head->data) = cpu_to_le16((u16) len);
- }
-#endif /* defined(__mips__) */
-
/* set actual length */
pkt_len = min((di->rxoffset + len), di->rxbufsize);
__skb_trim(head, pkt_len);
--
1.7.1



2011-04-20 07:41:09

by Roland Vossen

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: brcm80211: removed #ifdef __mips__

On 04/19/2011 03:57 PM, Johannes Berg wrote:
> I don't see how write flushing would be MIPS specific anyway? It's a
> function of the bus (PCI), not the host architecture, no?

Since I am not the original author of that piece of code, I had to make
some inquiries, hence my non immediate response.

It turns out that the read-after-write construct was introduced in the
code to ensure write order for certain Broadcom chips. Those chips are:
bcm4706, bcm4716, bcm4717, bcm4718. All these chips contain a MIPS
processor.

The #ifdef __mips__ in the code is broader than just those chips. The
side effect is that other broadcom chips with a mips processor also
execute the extra read, leading to some I/O overhead, which is acceptable.

Bye, Roland.


2011-04-19 07:13:59

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 2/2] staging: brcm80211: removed BCMFASTPATH macro

Code cleanup. BCMFASTPATH expanded to an empty string.

Signed-off-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
---
.../staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c | 2 +-
drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c | 2 +-
drivers/staging/brcm80211/brcmsmac/wl_mac80211.c | 8 ++--
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c | 10 ++--
drivers/staging/brcm80211/brcmsmac/wlc_antsel.c | 2 +-
drivers/staging/brcm80211/brcmsmac/wlc_bmac.c | 12 +++---
drivers/staging/brcm80211/brcmsmac/wlc_main.c | 40 ++++++++++----------
drivers/staging/brcm80211/brcmsmac/wlc_rate.c | 4 +-
drivers/staging/brcm80211/include/bcmdefs.h | 2 -
drivers/staging/brcm80211/util/bcmutils.c | 16 ++++----
drivers/staging/brcm80211/util/hnddma.c | 14 +++---
11 files changed, 55 insertions(+), 57 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
index 92133c7..2e5f5d9 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
@@ -2716,7 +2716,7 @@ void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core)
}
}

-void BCMFASTPATH wlc_phy_rssi_compute(wlc_phy_t *pih, void *ctx)
+void wlc_phy_rssi_compute(wlc_phy_t *pih, void *ctx)
{
wlc_d11rxhdr_t *wlc_rxhdr = (wlc_d11rxhdr_t *) ctx;
d11rxhdr_t *rxh = &wlc_rxhdr->rxhdr;
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c
index 56e0ba1..a099f7f 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c
@@ -21438,7 +21438,7 @@ static void wlc_phy_rssi_cal_nphy_rev2(phy_info_t *pi, u8 rssi_type)
wlc_phy_resetcca_nphy(pi);
}

-int BCMFASTPATH
+int
wlc_phy_rssi_compute_nphy(phy_info_t *pi, wlc_d11rxhdr_t *wlc_rxh)
{
d11rxhdr_t *rxh = &wlc_rxh->rxhdr;
diff --git a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
index 43938f4..9e092a2 100644
--- a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
+++ b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
@@ -1465,7 +1465,7 @@ uint wl_reset(struct wl_info *wl)
* These are interrupt on/off entry points. Disable interrupts
* during interrupt state transition.
*/
-void BCMFASTPATH wl_intrson(struct wl_info *wl)
+void wl_intrson(struct wl_info *wl)
{
unsigned long flags;

@@ -1482,7 +1482,7 @@ bool wl_alloc_dma_resources(struct wl_info *wl, uint addrwidth)
return true;
}

-u32 BCMFASTPATH wl_intrsoff(struct wl_info *wl)
+u32 wl_intrsoff(struct wl_info *wl)
{
unsigned long flags;
u32 status;
@@ -1539,7 +1539,7 @@ void wl_down(struct wl_info *wl)
WL_LOCK(wl);
}

-static irqreturn_t BCMFASTPATH wl_isr(int irq, void *dev_id)
+static irqreturn_t wl_isr(int irq, void *dev_id)
{
struct wl_info *wl;
bool ours, wantdpc;
@@ -1566,7 +1566,7 @@ static irqreturn_t BCMFASTPATH wl_isr(int irq, void *dev_id)
return IRQ_RETVAL(ours);
}

-static void BCMFASTPATH wl_dpc(unsigned long data)
+static void wl_dpc(unsigned long data)
{
struct wl_info *wl;

diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
index f217cd8..c72a243 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
@@ -447,7 +447,7 @@ static void wlc_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f)
}
}

-static void BCMFASTPATH
+static void
wlc_ampdu_agg(struct ampdu_info *ampdu, struct scb *scb, struct sk_buff *p,
uint prec)
{
@@ -465,7 +465,7 @@ wlc_ampdu_agg(struct ampdu_info *ampdu, struct scb *scb, struct sk_buff *p,
return;
}

-int BCMFASTPATH
+int
wlc_sendampdu(struct ampdu_info *ampdu, struct wlc_txq_info *qi,
struct sk_buff **pdu, int prec)
{
@@ -861,7 +861,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct wlc_txq_info *qi,
return err;
}

-void BCMFASTPATH
+void
wlc_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
struct sk_buff *p, tx_status_t *txs)
{
@@ -933,7 +933,7 @@ rate_status(struct wlc_info *wlc, struct ieee80211_tx_info *tx_info,

#define SHORTNAME "AMPDU status"

-static void BCMFASTPATH
+static void
wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
struct sk_buff *p, tx_status_t *txs,
u32 s1, u32 s2)
@@ -1233,7 +1233,7 @@ static void ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur)
}
}

-u8 BCMFASTPATH
+u8
wlc_ampdu_null_delim_cnt(struct ampdu_info *ampdu, struct scb *scb,
ratespec_t rspec, int phylen)
{
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_antsel.c b/drivers/staging/brcm80211/brcmsmac/wlc_antsel.c
index 7a154ab..c003d67 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_antsel.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_antsel.c
@@ -200,7 +200,7 @@ wlc_antsel_init_cfg(struct antsel_info *asi, wlc_antselcfg_t *antsel,
}
}

-void BCMFASTPATH
+void
wlc_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel,
u8 antselid, u8 fbantselid, u8 *antcfg,
u8 *fbantcfg)
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
index fc61584..af0d9ca 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
@@ -256,7 +256,7 @@ static u32 WLBANDINITFN(wlc_setband_inact) (struct wlc_info *wlc, uint bandunit)
* Return true if more frames need to be processed. false otherwise.
* Param 'bound' indicates max. # frames to process before break out.
*/
-static bool BCMFASTPATH
+static bool
wlc_bmac_recv(struct wlc_hw_info *wlc_hw, uint fifo, bool bound)
{
struct sk_buff *p;
@@ -305,7 +305,7 @@ wlc_bmac_recv(struct wlc_hw_info *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(struct wlc_info *wlc, bool bounded)
+bool wlc_dpc(struct wlc_info *wlc, bool bounded)
{
u32 macintstatus;
struct wlc_hw_info *wlc_hw = wlc->hw;
@@ -2975,7 +2975,7 @@ bool wlc_intrsupd(struct wlc_info *wlc)
* *wantdpc will be set to true if further wlc_dpc() processing is required,
* false otherwise.
*/
-bool BCMFASTPATH wlc_isr(struct wlc_info *wlc, bool *wantdpc)
+bool wlc_isr(struct wlc_info *wlc, bool *wantdpc)
{
struct wlc_hw_info *wlc_hw = wlc->hw;
u32 macintstatus;
@@ -3004,7 +3004,7 @@ bool BCMFASTPATH wlc_isr(struct wlc_info *wlc, bool *wantdpc)

}

-static bool BCMFASTPATH
+static bool
wlc_bmac_dotxstatus(struct wlc_hw_info *wlc_hw, tx_status_t *txs, u32 s2)
{
/* discard intermediate indications for ucode with one legitimate case:
@@ -3023,7 +3023,7 @@ wlc_bmac_dotxstatus(struct wlc_hw_info *wlc_hw, tx_status_t *txs, u32 s2)
/* process tx completion events in BMAC
* Return true if more tx status need to be processed. false otherwise.
*/
-static bool BCMFASTPATH
+static bool
wlc_bmac_txstatus(struct wlc_hw_info *wlc_hw, bool bound, bool *fatal)
{
bool morepending = false;
@@ -3253,7 +3253,7 @@ void wlc_bmac_band_stf_ss_set(struct wlc_hw_info *wlc_hw, u8 stf_mode)
wlc_upd_ofdm_pctl1_table(wlc_hw);
}

-void BCMFASTPATH
+void
wlc_bmac_read_tsf(struct wlc_hw_info *wlc_hw, u32 *tsf_l_ptr,
u32 *tsf_h_ptr)
{
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_main.c b/drivers/staging/brcm80211/brcmsmac/wlc_main.c
index 46bf93b..c043045 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_main.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_main.c
@@ -243,7 +243,7 @@ static const u8 acbitmap2maxprio[] = {
#define WLC_REPLAY_CNTRS_VALUE WPA_CAP_16_REPLAY_CNTRS

/* local prototypes */
-static u16 BCMFASTPATH wlc_d11hdrs_mac80211(struct wlc_info *wlc,
+static u16 wlc_d11hdrs_mac80211(struct wlc_info *wlc,
struct ieee80211_hw *hw,
struct sk_buff *p,
struct scb *scb, uint frag,
@@ -4818,13 +4818,13 @@ static u16 wlc_rate_shm_offset(struct wlc_info *wlc, u8 rate)
*
* Returns true if packet consumed (queued), false if not.
*/
-bool BCMFASTPATH
+bool
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
+bool
wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, struct sk_buff *pkt,
int prec, bool head)
{
@@ -4880,7 +4880,7 @@ wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, struct sk_buff *pkt,
return true;
}

-void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
+void wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
uint prec)
{
struct wlc_info *wlc = (struct wlc_info *) ctx;
@@ -4921,7 +4921,7 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
}
}

-bool BCMFASTPATH
+bool
wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu,
struct ieee80211_hw *hw)
{
@@ -4946,7 +4946,7 @@ wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu,
return 0;
}

-void BCMFASTPATH wlc_send_q(struct wlc_info *wlc)
+void wlc_send_q(struct wlc_info *wlc)
{
struct sk_buff *pkt[DOT11_MAXNUMFRAGS];
int prec;
@@ -5033,7 +5033,7 @@ bcmc_fid_generate(struct wlc_info *wlc, struct wlc_bsscfg *bsscfg,
return frameid;
}

-void BCMFASTPATH
+void
wlc_txfifo(struct wlc_info *wlc, uint fifo, struct sk_buff *p, bool commit,
s8 txpktpend)
{
@@ -5116,7 +5116,7 @@ wlc_compute_airtime(struct wlc_info *wlc, ratespec_t rspec, uint length)
return usec;
}

-void BCMFASTPATH
+void
wlc_compute_plcp(struct wlc_info *wlc, ratespec_t rspec, uint length, u8 *plcp)
{
if (IS_MCS(rspec)) {
@@ -5144,7 +5144,7 @@ static void wlc_compute_mimo_plcp(ratespec_t rspec, uint length, u8 *plcp)
}

/* Rate: 802.11 rate code, length: PSDU length in octets */
-static void BCMFASTPATH
+static void
wlc_compute_ofdm_plcp(ratespec_t rspec, u32 length, u8 *plcp)
{
u8 rate_signal;
@@ -5236,7 +5236,7 @@ static void wlc_compute_cck_plcp(struct wlc_info *wlc, ratespec_t rspec,
* next_frag_len next MPDU length in bytes
* preamble_type use short/GF or long/MM PLCP header
*/
-static u16 BCMFASTPATH
+static u16
wlc_compute_frame_dur(struct wlc_info *wlc, ratespec_t rate, u8 preamble_type,
uint next_frag_len)
{
@@ -5270,7 +5270,7 @@ wlc_compute_frame_dur(struct wlc_info *wlc, ratespec_t rate, u8 preamble_type,
* rate next MPDU rate in unit of 500kbps
* frame_len next MPDU frame length in bytes
*/
-u16 BCMFASTPATH
+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)
@@ -5302,7 +5302,7 @@ wlc_compute_rtscts_dur(struct wlc_info *wlc, bool cts_only, ratespec_t rts_rate,
return dur;
}

-u16 BCMFASTPATH wlc_phytxctl1_calc(struct wlc_info *wlc, ratespec_t rspec)
+u16 wlc_phytxctl1_calc(struct wlc_info *wlc, ratespec_t rspec)
{
u16 phyctl1 = 0;
u16 bw;
@@ -5348,7 +5348,7 @@ u16 BCMFASTPATH wlc_phytxctl1_calc(struct wlc_info *wlc, ratespec_t rspec)
return phyctl1;
}

-ratespec_t BCMFASTPATH
+ratespec_t
wlc_rspec_to_rts_rspec(struct wlc_info *wlc, ratespec_t rspec, bool use_rspec,
u16 mimo_ctlchbw)
{
@@ -5404,7 +5404,7 @@ wlc_rspec_to_rts_rspec(struct wlc_info *wlc, ratespec_t rspec, bool use_rspec,
* headroom == D11_PHY_HDR_LEN + D11_TXH_LEN (D11_TXH_LEN is now 104 bytes)
*
*/
-static u16 BCMFASTPATH
+static u16
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,
@@ -6197,7 +6197,7 @@ static void wlc_war16165(struct wlc_info *wlc, bool tx)

/* process an individual tx_status_t */
/* WLC_HIGH_API */
-bool BCMFASTPATH
+bool
wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
{
struct sk_buff *p;
@@ -6355,7 +6355,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)

}

-void BCMFASTPATH
+void
wlc_txfifo_complete(struct wlc_info *wlc, uint fifo, s8 txpktpend)
{
TXPKTPENDDEC(wlc, fifo, txpktpend);
@@ -6660,7 +6660,7 @@ void wlc_bss_list_free(struct wlc_info *wlc, struct wlc_bss_list *bss_list)
* Param 'bound' indicates max. # frames to process before break out.
*/
/* WLC_HIGH_API */
-void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
+void wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
{
d11rxhdr_t *rxh;
struct ieee80211_hdr *h;
@@ -6759,7 +6759,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
* Formula given by HT PHY Spec v 1.13
* len = 3(nsyms + nstream + 3) - 3
*/
-u16 BCMFASTPATH
+u16
wlc_calc_lsig_len(struct wlc_info *wlc, ratespec_t ratespec, uint mac_len)
{
uint nsyms, len = 0, kNdps;
@@ -6799,7 +6799,7 @@ wlc_calc_lsig_len(struct wlc_info *wlc, ratespec_t ratespec, uint mac_len)
}

/* calculate frame duration of a given rate and length, return time in usec unit */
-uint BCMFASTPATH
+uint
wlc_calc_frame_time(struct wlc_info *wlc, ratespec_t ratespec, u8 preamble_type,
uint mac_len)
{
@@ -6929,7 +6929,7 @@ wlc_calc_ba_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type)
FCS_LEN));
}

-static uint BCMFASTPATH
+static uint
wlc_calc_ack_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type)
{
uint dur = 0;
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_rate.c b/drivers/staging/brcm80211/brcmsmac/wlc_rate.c
index 87a2f62..87b252d 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_rate.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_rate.c
@@ -332,7 +332,7 @@ wlc_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs,
}

/* calculate the rate of a rx'd frame and return it as a ratespec */
-ratespec_t BCMFASTPATH wlc_compute_rspec(d11rxhdr_t *rxh, u8 *plcp)
+ratespec_t wlc_compute_rspec(d11rxhdr_t *rxh, u8 *plcp)
{
int phy_type;
ratespec_t rspec = PHY_TXC1_BW_20MHZ << RSPEC_BW_SHIFT;
@@ -466,7 +466,7 @@ wlc_rateset_default(wlc_rateset_t *rs_tgt, const wlc_rateset_t *rs_hw,
mcsallow ? txstreams : 1);
}

-s16 BCMFASTPATH wlc_rate_legacy_phyctl(uint rate)
+s16 wlc_rate_legacy_phyctl(uint rate)
{
uint i;
for (i = 0; i < LEGACY_PHYCFG_TABLE_SIZE; i++)
diff --git a/drivers/staging/brcm80211/include/bcmdefs.h b/drivers/staging/brcm80211/include/bcmdefs.h
index 5d1a620..854f14f 100644
--- a/drivers/staging/brcm80211/include/bcmdefs.h
+++ b/drivers/staging/brcm80211/include/bcmdefs.h
@@ -36,8 +36,6 @@

#define AUTO (-1) /* Auto = -1 */

-#define BCMFASTPATH
-
/* Bus types */
#define SI_BUS 0 /* SOC Interconnect */
#define PCI_BUS 1 /* PCI target */
diff --git a/drivers/staging/brcm80211/util/bcmutils.c b/drivers/staging/brcm80211/util/bcmutils.c
index df1b6fe..9d5e627 100644
--- a/drivers/staging/brcm80211/util/bcmutils.c
+++ b/drivers/staging/brcm80211/util/bcmutils.c
@@ -32,7 +32,7 @@
/* Global ASSERT type flag */
u32 g_assert_type;

-struct sk_buff *BCMFASTPATH pkt_buf_get_skb(uint len)
+struct sk_buff *pkt_buf_get_skb(uint len)
{
struct sk_buff *skb;

@@ -46,7 +46,7 @@ struct sk_buff *BCMFASTPATH pkt_buf_get_skb(uint len)
}

/* Free the driver packet. Free the tag if present */
-void BCMFASTPATH pkt_buf_free_skb(struct sk_buff *skb)
+void pkt_buf_free_skb(struct sk_buff *skb)
{
struct sk_buff *nskb;
int nest = 0;
@@ -101,7 +101,7 @@ uint pktfrombuf(struct sk_buff *p, uint offset, int len,
return ret;
}
/* return total length of buffer chain */
-uint BCMFASTPATH pkttotlen(struct sk_buff *p)
+uint pkttotlen(struct sk_buff *p)
{
uint total;

@@ -115,7 +115,7 @@ uint BCMFASTPATH pkttotlen(struct sk_buff *p)
* osl multiple-precedence packet queue
* hi_prec is always >= the number of the highest non-empty precedence
*/
-struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec,
+struct sk_buff *pktq_penq(struct pktq *pq, int prec,
struct sk_buff *p)
{
struct pktq_prec *q;
@@ -141,7 +141,7 @@ struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec,
return p;
}

-struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec,
+struct sk_buff *pktq_penq_head(struct pktq *pq, int prec,
struct sk_buff *p)
{
struct pktq_prec *q;
@@ -166,7 +166,7 @@ struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec,
return p;
}

-struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec)
+struct sk_buff *pktq_pdeq(struct pktq *pq, int prec)
{
struct pktq_prec *q;
struct sk_buff *p;
@@ -190,7 +190,7 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec)
return p;
}

-struct sk_buff *BCMFASTPATH pktq_pdeq_tail(struct pktq *pq, int prec)
+struct sk_buff *pktq_pdeq_tail(struct pktq *pq, int prec)
{
struct pktq_prec *q;
struct sk_buff *p, *prev;
@@ -331,7 +331,7 @@ int pktq_mlen(struct pktq *pq, uint prec_bmp)
return len;
}
/* Priority dequeue from a specific set of precedences */
-struct sk_buff *BCMFASTPATH pktq_mdeq(struct pktq *pq, uint prec_bmp,
+struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp,
int *prec_out)
{
struct pktq_prec *q;
diff --git a/drivers/staging/brcm80211/util/hnddma.c b/drivers/staging/brcm80211/util/hnddma.c
index 134caf2..7d9a99d 100644
--- a/drivers/staging/brcm80211/util/hnddma.c
+++ b/drivers/staging/brcm80211/util/hnddma.c
@@ -700,7 +700,7 @@ _dma_rx_param_get(dma_info_t *di, u16 *rxoffset, u16 *rxbufsize)
* After it reaches the max size of buffer, the data continues in next DMA descriptor
* buffer WITHOUT DMA header
*/
-static void *BCMFASTPATH _dma_rx(dma_info_t *di)
+static void *_dma_rx(dma_info_t *di)
{
struct sk_buff *p, *head, *tail;
uint len;
@@ -761,7 +761,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
* this will stall the rx dma and user might want to call rxfill again asap
* This unlikely happens on memory-rich NIC, but often on memory-constrained dongle
*/
-static bool BCMFASTPATH _dma_rxfill(dma_info_t *di)
+static bool _dma_rxfill(dma_info_t *di)
{
struct sk_buff *p;
u16 rxin, rxout;
@@ -896,7 +896,7 @@ static void _dma_rxreclaim(dma_info_t *di)
pkt_buf_free_skb(p);
}

-static void *BCMFASTPATH _dma_getnextrxp(dma_info_t *di, bool forceall)
+static void *_dma_getnextrxp(dma_info_t *di, bool forceall)
{
if (di->nrxd == 0)
return NULL;
@@ -1111,7 +1111,7 @@ static bool dma64_txsuspended(dma_info_t *di)
D64_XC_SE);
}

-static void BCMFASTPATH dma64_txreclaim(dma_info_t *di, txd_range_t range)
+static void dma64_txreclaim(dma_info_t *di, txd_range_t range)
{
void *p;

@@ -1358,7 +1358,7 @@ static int dma64_txunframed(dma_info_t *di, void *buf, uint len, bool commit)
* WARNING: call must check the return value for error.
* the error(toss frames) could be fatal and cause many subsequent hard to debug problems
*/
-static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
+static int dma64_txfast(dma_info_t *di, struct sk_buff *p0,
bool commit)
{
struct sk_buff *p, *next;
@@ -1480,7 +1480,7 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
* If range is HNDDMA_RANGE_ALL, reclaim all txd(s) posted to the ring and
* return associated packet regardless of the value of hardware pointers.
*/
-static void *BCMFASTPATH dma64_getnexttxp(dma_info_t *di, txd_range_t range)
+static void *dma64_getnexttxp(dma_info_t *di, txd_range_t range)
{
u16 start, end, i;
u16 active_desc;
@@ -1573,7 +1573,7 @@ static void *BCMFASTPATH dma64_getnexttxp(dma_info_t *di, txd_range_t range)
}

/* if forcing, dma engine must be disabled */
-static void *BCMFASTPATH dma64_getnextrxp(dma_info_t *di, bool forceall)
+static void *dma64_getnextrxp(dma_info_t *di, bool forceall)
{
uint i, curr;
void *rxp;
--
1.7.1



2011-04-19 13:46:15

by Roland Vossen

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: brcm80211: removed #ifdef __mips__

Hello guys,

Greg, please drop this patch set. Rest of this email is FYI only.

Michael:

> Are you sure? __mips__ is automagically defined by GCC, if compiling
> for MIPS. Maybe it should be converted to some CONFIG_... symbol.
> But removal seems wrong.

You are right. The majority of the removed #ifdef __mips__ code has to
do with write flushing. To accomplish this, it performs a R_REG after a
W_REG. I assumed that writeb() and friends guarantee ordering and write
flushing, but after some reading I learned that this is not the case.

I will rework the code and submit a new patch set.

For some background info: this patch was a reaction on an email from
John Linville to us. John wrote:

<quote>
I took a quick run through a pull of staging from today. I made a few
notes, but a lot of them would seem to relate to the utils stuff you
mention above. One general comment would be that there still seems
to be a lot of MIPS-specific stuff buried in the code, in particular
a lot of "#ifdef __mips__" stuff that if necessary should at least
be hidden inside the W_REG macro.
</quote>

Thanks, Roland.


2011-04-19 13:49:32

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: brcm80211: removed #ifdef __mips__

On Tue, 2011-04-19 at 15:45 +0200, Roland Vossen wrote:
> Hello guys,
>
> Greg, please drop this patch set. Rest of this email is FYI only.
>
> Michael:
>
> > Are you sure? __mips__ is automagically defined by GCC, if compiling
> > for MIPS. Maybe it should be converted to some CONFIG_... symbol.
> > But removal seems wrong.
>
> You are right. The majority of the removed #ifdef __mips__ code has to
> do with write flushing. To accomplish this, it performs a R_REG after a
> W_REG. I assumed that writeb() and friends guarantee ordering and write
> flushing, but after some reading I learned that this is not the case.
>
> I will rework the code and submit a new patch set.
>
> For some background info: this patch was a reaction on an email from
> John Linville to us. John wrote:
>
> <quote>
> I took a quick run through a pull of staging from today. I made a few
> notes, but a lot of them would seem to relate to the utils stuff you
> mention above. One general comment would be that there still seems
> to be a lot of MIPS-specific stuff buried in the code, in particular
> a lot of "#ifdef __mips__" stuff that if necessary should at least
> be hidden inside the W_REG macro.
> </quote>

You should probably create a new macro W_REG_FLUSH or something like
that, which enforces ordering by reading back the register, if required.
That avoids ugly #ifdefs in the code.

--
Greetings Michael.