aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.h
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2007-12-12 14:19:12 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:57:30 -0500
commit47bf4246a357d36762c9e7c282d7307152eb92e1 (patch)
tree91f28518be9daf3a2e26efd9efa9bdbb4b664454 /drivers/net/bnx2.h
parent110d0ef9907b519fed1607c73b3ae883f270561e (diff)
[BNX2]: Add init. code to handle RX pages.
Add new fields to keep track of the pages and the page rings. Add functions to allocate and free pages. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2.h')
-rw-r--r--drivers/net/bnx2.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 8354efc1111d..93c2436cb8b9 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -335,6 +335,7 @@ struct l2_fhdr {
335#define BNX2_L2CTX_HOST_PG_BDIDX 0x00000044 335#define BNX2_L2CTX_HOST_PG_BDIDX 0x00000044
336#define BNX2_L2CTX_PG_BUF_SIZE 0x00000048 336#define BNX2_L2CTX_PG_BUF_SIZE 0x00000048
337#define BNX2_L2CTX_RBDC_KEY 0x0000004c 337#define BNX2_L2CTX_RBDC_KEY 0x0000004c
338#define BNX2_L2CTX_RBDC_JUMBO_KEY 0x3ffe
338#define BNX2_L2CTX_NX_PG_BDHADDR_HI 0x00000050 339#define BNX2_L2CTX_NX_PG_BDHADDR_HI 0x00000050
339#define BNX2_L2CTX_NX_PG_BDHADDR_LO 0x00000054 340#define BNX2_L2CTX_NX_PG_BDHADDR_LO 0x00000054
340 341
@@ -4450,6 +4451,14 @@ struct l2_fhdr {
4450#define BNX2_MQ_MEM_RD_DATA2_VALUE (0x3fffffffL<<0) 4451#define BNX2_MQ_MEM_RD_DATA2_VALUE (0x3fffffffL<<0)
4451#define BNX2_MQ_MEM_RD_DATA2_VALUE_XI (0x7fffffffL<<0) 4452#define BNX2_MQ_MEM_RD_DATA2_VALUE_XI (0x7fffffffL<<0)
4452 4453
4454#define BNX2_MQ_MAP_L2_3 0x00003d2c
4455#define BNX2_MQ_MAP_L2_3_MQ_OFFSET (0xffL<<0)
4456#define BNX2_MQ_MAP_L2_3_SZ (0x3L<<8)
4457#define BNX2_MQ_MAP_L2_3_CTX_OFFSET (0x2ffL<<10)
4458#define BNX2_MQ_MAP_L2_3_BIN_OFFSET (0x7L<<23)
4459#define BNX2_MQ_MAP_L2_3_ARM (0x3L<<26)
4460#define BNX2_MQ_MAP_L2_3_ENA (0x1L<<31)
4461#define BNX2_MQ_MAP_L2_3_DEFAULT 0x82004646
4453 4462
4454/* 4463/*
4455 * tsch_reg definition 4464 * tsch_reg definition
@@ -6360,9 +6369,11 @@ struct l2_fhdr {
6360#define MAX_TX_DESC_CNT (TX_DESC_CNT - 1) 6369#define MAX_TX_DESC_CNT (TX_DESC_CNT - 1)
6361 6370
6362#define MAX_RX_RINGS 4 6371#define MAX_RX_RINGS 4
6372#define MAX_RX_PG_RINGS 16
6363#define RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct rx_bd)) 6373#define RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct rx_bd))
6364#define MAX_RX_DESC_CNT (RX_DESC_CNT - 1) 6374#define MAX_RX_DESC_CNT (RX_DESC_CNT - 1)
6365#define MAX_TOTAL_RX_DESC_CNT (MAX_RX_DESC_CNT * MAX_RX_RINGS) 6375#define MAX_TOTAL_RX_DESC_CNT (MAX_RX_DESC_CNT * MAX_RX_RINGS)
6376#define MAX_TOTAL_RX_PG_DESC_CNT (MAX_RX_DESC_CNT * MAX_RX_PG_RINGS)
6366 6377
6367#define NEXT_TX_BD(x) (((x) & (MAX_TX_DESC_CNT - 1)) == \ 6378#define NEXT_TX_BD(x) (((x) & (MAX_TX_DESC_CNT - 1)) == \
6368 (MAX_TX_DESC_CNT - 1)) ? \ 6379 (MAX_TX_DESC_CNT - 1)) ? \
@@ -6375,6 +6386,7 @@ struct l2_fhdr {
6375 (x) + 2 : (x) + 1 6386 (x) + 2 : (x) + 1
6376 6387
6377#define RX_RING_IDX(x) ((x) & bp->rx_max_ring_idx) 6388#define RX_RING_IDX(x) ((x) & bp->rx_max_ring_idx)
6389#define RX_PG_RING_IDX(x) ((x) & bp->rx_max_pg_ring_idx)
6378 6390
6379#define RX_RING(x) (((x) & ~MAX_RX_DESC_CNT) >> (BCM_PAGE_BITS - 4)) 6391#define RX_RING(x) (((x) & ~MAX_RX_DESC_CNT) >> (BCM_PAGE_BITS - 4))
6380#define RX_IDX(x) ((x) & MAX_RX_DESC_CNT) 6392#define RX_IDX(x) ((x) & MAX_RX_DESC_CNT)
@@ -6413,7 +6425,13 @@ struct sw_bd {
6413 DECLARE_PCI_UNMAP_ADDR(mapping) 6425 DECLARE_PCI_UNMAP_ADDR(mapping)
6414}; 6426};
6415 6427
6428struct sw_pg {
6429 struct page *page;
6430 DECLARE_PCI_UNMAP_ADDR(mapping)
6431};
6432
6416#define SW_RXBD_RING_SIZE (sizeof(struct sw_bd) * RX_DESC_CNT) 6433#define SW_RXBD_RING_SIZE (sizeof(struct sw_bd) * RX_DESC_CNT)
6434#define SW_RXPG_RING_SIZE (sizeof(struct sw_pg) * RX_DESC_CNT)
6417#define RXBD_RING_SIZE (sizeof(struct rx_bd) * RX_DESC_CNT) 6435#define RXBD_RING_SIZE (sizeof(struct rx_bd) * RX_DESC_CNT)
6418#define SW_TXBD_RING_SIZE (sizeof(struct sw_bd) * TX_DESC_CNT) 6436#define SW_TXBD_RING_SIZE (sizeof(struct sw_bd) * TX_DESC_CNT)
6419#define TXBD_RING_SIZE (sizeof(struct tx_bd) * TX_DESC_CNT) 6437#define TXBD_RING_SIZE (sizeof(struct tx_bd) * TX_DESC_CNT)
@@ -6520,15 +6538,21 @@ struct bnx2 {
6520 u32 rx_buf_size; /* with alignment */ 6538 u32 rx_buf_size; /* with alignment */
6521 u32 rx_copy_thresh; 6539 u32 rx_copy_thresh;
6522 u32 rx_max_ring_idx; 6540 u32 rx_max_ring_idx;
6541 u32 rx_max_pg_ring_idx;
6523 6542
6524 u32 rx_prod_bseq; 6543 u32 rx_prod_bseq;
6525 u16 rx_prod; 6544 u16 rx_prod;
6526 u16 rx_cons; 6545 u16 rx_cons;
6527 6546
6547 u16 rx_pg_prod;
6548 u16 rx_pg_cons;
6549
6528 u32 rx_csum; 6550 u32 rx_csum;
6529 6551
6530 struct sw_bd *rx_buf_ring; 6552 struct sw_bd *rx_buf_ring;
6531 struct rx_bd *rx_desc_ring[MAX_RX_RINGS]; 6553 struct rx_bd *rx_desc_ring[MAX_RX_RINGS];
6554 struct sw_pg *rx_pg_ring;
6555 struct rx_bd *rx_pg_desc_ring[MAX_RX_PG_RINGS];
6532 6556
6533 /* TX constants */ 6557 /* TX constants */
6534 struct tx_bd *tx_desc_ring; 6558 struct tx_bd *tx_desc_ring;
@@ -6616,6 +6640,10 @@ struct bnx2 {
6616 int rx_ring_size; 6640 int rx_ring_size;
6617 dma_addr_t rx_desc_mapping[MAX_RX_RINGS]; 6641 dma_addr_t rx_desc_mapping[MAX_RX_RINGS];
6618 6642
6643 int rx_max_pg_ring;
6644 int rx_pg_ring_size;
6645 dma_addr_t rx_pg_desc_mapping[MAX_RX_PG_RINGS];
6646
6619 u16 tx_quick_cons_trip; 6647 u16 tx_quick_cons_trip;
6620 u16 tx_quick_cons_trip_int; 6648 u16 tx_quick_cons_trip_int;
6621 u16 rx_quick_cons_trip; 6649 u16 rx_quick_cons_trip;