sfc: Optimise falcon_writel_page_locked() for page > 0
authorBen Hutchings <bhutchings@solarflare.com>
Fri, 20 Mar 2009 13:27:13 +0000 (13:27 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Mar 2009 02:06:56 +0000 (19:06 -0700)
The bug this function works around only applies to the first set of
page-mapped registers; other pages can be written without locking.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/sfc/falcon_io.h

index c16da3149fa9ddc6d4fde23482a3f91c08147be3..8883092dae9768ee0d0516b518b5b3cd491af251 100644 (file)
@@ -238,18 +238,21 @@ static inline void falcon_writel_page(struct efx_nic *efx, efx_dword_t *value,
 /* Write dword to Falcon page-mapped register with an extra lock.
  *
  * As for falcon_writel_page(), but for a register that suffers from
- * SFC bug 3181. Take out a lock so the BIU collector cannot be
- * confused. */
+ * SFC bug 3181.  If writing to page 0, take out a lock so the BIU
+ * collector cannot be confused.
+ */
 static inline void falcon_writel_page_locked(struct efx_nic *efx,
                                             efx_dword_t *value,
                                             unsigned int reg,
                                             unsigned int page)
 {
-       unsigned long flags;
+       unsigned long flags = 0;
 
-       spin_lock_irqsave(&efx->biu_lock, flags);
+       if (page == 0)
+               spin_lock_irqsave(&efx->biu_lock, flags);
        falcon_writel(efx, value, FALCON_PAGED_REG(page, reg));
-       spin_unlock_irqrestore(&efx->biu_lock, flags);
+       if (page == 0)
+               spin_unlock_irqrestore(&efx->biu_lock, flags);
 }
 
 #endif /* EFX_FALCON_IO_H */