]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
[BNX2]: Use CPU native page size
authorMichael Chan <mchan@broadcom.com>
Tue, 13 Jun 2006 22:03:47 +0000 (15:03 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 18 Jun 2006 04:30:49 +0000 (21:30 -0700)
Use CPU native page size to determine various ring sizes. This allows
order-0 memory allocations on all systems.

Added check to limit the page size to 16K since that's the maximum rx
ring size that will be used. This will prevent using unnecessarily
large page sizes on some architectures with large page sizes.
[Suggested by David Miller]

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bnx2.c
drivers/net/bnx2.h

index c6510e17551bfae849ae433a6d694362c7f034fa..738c980ddfe7b357268ad22e6c36c1eb8722f8f1 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/irq.h>
 #include <linux/delay.h>
 #include <asm/byteorder.h>
+#include <asm/page.h>
 #include <linux/time.h>
 #include <linux/ethtool.h>
 #include <linux/mii.h>
index cc36b75b2b39f5bc9bba47da8b8f6a53cf3e1e2f..5845e334941b4f8e71ca80ad5c674bf7a7ffd5e9 100644 (file)
@@ -3750,7 +3750,12 @@ struct l2_fhdr {
 #define DMA_READ_CHANS 5
 #define DMA_WRITE_CHANS        3
 
-#define BCM_PAGE_BITS  12
+/* Use CPU native page size up to 16K for the ring sizes.  */
+#if (PAGE_SHIFT > 14)
+#define BCM_PAGE_BITS  14
+#else
+#define BCM_PAGE_BITS  PAGE_SHIFT
+#endif
 #define BCM_PAGE_SIZE  (1 << BCM_PAGE_BITS)
 
 #define TX_DESC_CNT  (BCM_PAGE_SIZE / sizeof(struct tx_bd))
@@ -3773,7 +3778,7 @@ struct l2_fhdr {
 
 #define RX_RING_IDX(x) ((x) & bp->rx_max_ring_idx)
 
-#define RX_RING(x) (((x) & ~MAX_RX_DESC_CNT) >> 8)
+#define RX_RING(x) (((x) & ~MAX_RX_DESC_CNT) >> (BCM_PAGE_BITS - 4))
 #define RX_IDX(x) ((x) & MAX_RX_DESC_CNT)
 
 /* Context size. */