bnx2: Add BNX2 prefix to descriptor structures and macros
for namespace consistency. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e503e06624
commit
2bc4078e92
4 changed files with 181 additions and 172 deletions
|
@ -724,7 +724,7 @@ static void cnic_free_dma(struct cnic_dev *dev, struct cnic_dma *dma)
|
|||
|
||||
for (i = 0; i < dma->num_pages; i++) {
|
||||
if (dma->pg_arr[i]) {
|
||||
dma_free_coherent(&dev->pcidev->dev, BCM_PAGE_SIZE,
|
||||
dma_free_coherent(&dev->pcidev->dev, BNX2_PAGE_SIZE,
|
||||
dma->pg_arr[i], dma->pg_map_arr[i]);
|
||||
dma->pg_arr[i] = NULL;
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma,
|
|||
|
||||
for (i = 0; i < pages; i++) {
|
||||
dma->pg_arr[i] = dma_alloc_coherent(&dev->pcidev->dev,
|
||||
BCM_PAGE_SIZE,
|
||||
BNX2_PAGE_SIZE,
|
||||
&dma->pg_map_arr[i],
|
||||
GFP_ATOMIC);
|
||||
if (dma->pg_arr[i] == NULL)
|
||||
|
@ -792,8 +792,8 @@ static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma,
|
|||
if (!use_pg_tbl)
|
||||
return 0;
|
||||
|
||||
dma->pgtbl_size = ((pages * 8) + BCM_PAGE_SIZE - 1) &
|
||||
~(BCM_PAGE_SIZE - 1);
|
||||
dma->pgtbl_size = ((pages * 8) + BNX2_PAGE_SIZE - 1) &
|
||||
~(BNX2_PAGE_SIZE - 1);
|
||||
dma->pgtbl = dma_alloc_coherent(&dev->pcidev->dev, dma->pgtbl_size,
|
||||
&dma->pgtbl_map, GFP_ATOMIC);
|
||||
if (dma->pgtbl == NULL)
|
||||
|
@ -898,8 +898,8 @@ static int cnic_alloc_context(struct cnic_dev *dev)
|
|||
if (CHIP_NUM(cp) == CHIP_NUM_5709) {
|
||||
int i, k, arr_size;
|
||||
|
||||
cp->ctx_blk_size = BCM_PAGE_SIZE;
|
||||
cp->cids_per_blk = BCM_PAGE_SIZE / 128;
|
||||
cp->ctx_blk_size = BNX2_PAGE_SIZE;
|
||||
cp->cids_per_blk = BNX2_PAGE_SIZE / 128;
|
||||
arr_size = BNX2_MAX_CID / cp->cids_per_blk *
|
||||
sizeof(struct cnic_ctx);
|
||||
cp->ctx_arr = kzalloc(arr_size, GFP_KERNEL);
|
||||
|
@ -931,7 +931,7 @@ static int cnic_alloc_context(struct cnic_dev *dev)
|
|||
for (i = 0; i < cp->ctx_blks; i++) {
|
||||
cp->ctx_arr[i].ctx =
|
||||
dma_alloc_coherent(&dev->pcidev->dev,
|
||||
BCM_PAGE_SIZE,
|
||||
BNX2_PAGE_SIZE,
|
||||
&cp->ctx_arr[i].mapping,
|
||||
GFP_KERNEL);
|
||||
if (cp->ctx_arr[i].ctx == NULL)
|
||||
|
@ -1011,7 +1011,7 @@ static int __cnic_alloc_uio_rings(struct cnic_uio_dev *udev, int pages)
|
|||
if (udev->l2_ring)
|
||||
return 0;
|
||||
|
||||
udev->l2_ring_size = pages * BCM_PAGE_SIZE;
|
||||
udev->l2_ring_size = pages * BNX2_PAGE_SIZE;
|
||||
udev->l2_ring = dma_alloc_coherent(&udev->pdev->dev, udev->l2_ring_size,
|
||||
&udev->l2_ring_map,
|
||||
GFP_KERNEL | __GFP_COMP);
|
||||
|
@ -2898,7 +2898,7 @@ static int cnic_l2_completion(struct cnic_local *cp)
|
|||
u16 hw_cons, sw_cons;
|
||||
struct cnic_uio_dev *udev = cp->udev;
|
||||
union eth_rx_cqe *cqe, *cqe_ring = (union eth_rx_cqe *)
|
||||
(udev->l2_ring + (2 * BCM_PAGE_SIZE));
|
||||
(udev->l2_ring + (2 * BNX2_PAGE_SIZE));
|
||||
u32 cmd;
|
||||
int comp = 0;
|
||||
|
||||
|
@ -4366,7 +4366,7 @@ static int cnic_setup_5709_context(struct cnic_dev *dev, int valid)
|
|||
u32 idx = cp->ctx_arr[i].cid / cp->cids_per_blk;
|
||||
u32 val;
|
||||
|
||||
memset(cp->ctx_arr[i].ctx, 0, BCM_PAGE_SIZE);
|
||||
memset(cp->ctx_arr[i].ctx, 0, BNX2_PAGE_SIZE);
|
||||
|
||||
CNIC_WR(dev, BNX2_CTX_HOST_PAGE_TBL_DATA0,
|
||||
(cp->ctx_arr[i].mapping & 0xffffffff) | valid_bit);
|
||||
|
@ -4508,7 +4508,7 @@ static void cnic_init_bnx2_tx_ring(struct cnic_dev *dev)
|
|||
u32 cid_addr, tx_cid, sb_id;
|
||||
u32 val, offset0, offset1, offset2, offset3;
|
||||
int i;
|
||||
struct tx_bd *txbd;
|
||||
struct bnx2_tx_bd *txbd;
|
||||
dma_addr_t buf_map, ring_map = udev->l2_ring_map;
|
||||
struct status_block *s_blk = cp->status_blk.gen;
|
||||
|
||||
|
@ -4554,7 +4554,7 @@ static void cnic_init_bnx2_tx_ring(struct cnic_dev *dev)
|
|||
txbd = udev->l2_ring;
|
||||
|
||||
buf_map = udev->l2_buf_map;
|
||||
for (i = 0; i < MAX_TX_DESC_CNT; i++, txbd++) {
|
||||
for (i = 0; i < BNX2_MAX_TX_DESC_CNT; i++, txbd++) {
|
||||
txbd->tx_bd_haddr_hi = (u64) buf_map >> 32;
|
||||
txbd->tx_bd_haddr_lo = (u64) buf_map & 0xffffffff;
|
||||
}
|
||||
|
@ -4574,7 +4574,7 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev)
|
|||
struct cnic_uio_dev *udev = cp->udev;
|
||||
u32 cid_addr, sb_id, val, coal_reg, coal_val;
|
||||
int i;
|
||||
struct rx_bd *rxbd;
|
||||
struct bnx2_rx_bd *rxbd;
|
||||
struct status_block *s_blk = cp->status_blk.gen;
|
||||
dma_addr_t ring_map = udev->l2_ring_map;
|
||||
|
||||
|
@ -4610,8 +4610,8 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev)
|
|||
val = BNX2_L2CTX_L2_STATUSB_NUM(sb_id);
|
||||
cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val);
|
||||
|
||||
rxbd = udev->l2_ring + BCM_PAGE_SIZE;
|
||||
for (i = 0; i < MAX_RX_DESC_CNT; i++, rxbd++) {
|
||||
rxbd = udev->l2_ring + BNX2_PAGE_SIZE;
|
||||
for (i = 0; i < BNX2_MAX_RX_DESC_CNT; i++, rxbd++) {
|
||||
dma_addr_t buf_map;
|
||||
int n = (i % cp->l2_rx_ring_size) + 1;
|
||||
|
||||
|
@ -4621,11 +4621,11 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev)
|
|||
rxbd->rx_bd_haddr_hi = (u64) buf_map >> 32;
|
||||
rxbd->rx_bd_haddr_lo = (u64) buf_map & 0xffffffff;
|
||||
}
|
||||
val = (u64) (ring_map + BCM_PAGE_SIZE) >> 32;
|
||||
val = (u64) (ring_map + BNX2_PAGE_SIZE) >> 32;
|
||||
cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val);
|
||||
rxbd->rx_bd_haddr_hi = val;
|
||||
|
||||
val = (u64) (ring_map + BCM_PAGE_SIZE) & 0xffffffff;
|
||||
val = (u64) (ring_map + BNX2_PAGE_SIZE) & 0xffffffff;
|
||||
cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val);
|
||||
rxbd->rx_bd_haddr_lo = val;
|
||||
|
||||
|
@ -4691,10 +4691,10 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
|
|||
|
||||
val = CNIC_RD(dev, BNX2_MQ_CONFIG);
|
||||
val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE;
|
||||
if (BCM_PAGE_BITS > 12)
|
||||
if (BNX2_PAGE_BITS > 12)
|
||||
val |= (12 - 8) << 4;
|
||||
else
|
||||
val |= (BCM_PAGE_BITS - 8) << 4;
|
||||
val |= (BNX2_PAGE_BITS - 8) << 4;
|
||||
|
||||
CNIC_WR(dev, BNX2_MQ_CONFIG, val);
|
||||
|
||||
|
@ -4724,13 +4724,13 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
|
|||
|
||||
/* Initialize the kernel work queue context. */
|
||||
val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE |
|
||||
(BCM_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ;
|
||||
(BNX2_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ;
|
||||
cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_TYPE, val);
|
||||
|
||||
val = (BCM_PAGE_SIZE / sizeof(struct kwqe) - 1) << 16;
|
||||
val = (BNX2_PAGE_SIZE / sizeof(struct kwqe) - 1) << 16;
|
||||
cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val);
|
||||
|
||||
val = ((BCM_PAGE_SIZE / sizeof(struct kwqe)) << 16) | KWQ_PAGE_CNT;
|
||||
val = ((BNX2_PAGE_SIZE / sizeof(struct kwqe)) << 16) | KWQ_PAGE_CNT;
|
||||
cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val);
|
||||
|
||||
val = (u32) ((u64) cp->kwq_info.pgtbl_map >> 32);
|
||||
|
@ -4750,13 +4750,13 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
|
|||
|
||||
/* Initialize the kernel complete queue context. */
|
||||
val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE |
|
||||
(BCM_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ;
|
||||
(BNX2_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ;
|
||||
cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_TYPE, val);
|
||||
|
||||
val = (BCM_PAGE_SIZE / sizeof(struct kcqe) - 1) << 16;
|
||||
val = (BNX2_PAGE_SIZE / sizeof(struct kcqe) - 1) << 16;
|
||||
cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val);
|
||||
|
||||
val = ((BCM_PAGE_SIZE / sizeof(struct kcqe)) << 16) | KCQ_PAGE_CNT;
|
||||
val = ((BNX2_PAGE_SIZE / sizeof(struct kcqe)) << 16) | KCQ_PAGE_CNT;
|
||||
cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val);
|
||||
|
||||
val = (u32) ((u64) cp->kcq1.dma.pgtbl_map >> 32);
|
||||
|
@ -4895,10 +4895,10 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev,
|
|||
u32 cli = cp->ethdev->iscsi_l2_client_id;
|
||||
u32 val;
|
||||
|
||||
memset(txbd, 0, BCM_PAGE_SIZE);
|
||||
memset(txbd, 0, BNX2_PAGE_SIZE);
|
||||
|
||||
buf_map = udev->l2_buf_map;
|
||||
for (i = 0; i < MAX_TX_DESC_CNT; i += 3, txbd += 3) {
|
||||
for (i = 0; i < BNX2_MAX_TX_DESC_CNT; i += 3, txbd += 3) {
|
||||
struct eth_tx_start_bd *start_bd = &txbd->start_bd;
|
||||
struct eth_tx_parse_bd_e1x *pbd_e1x =
|
||||
&((txbd + 1)->parse_bd_e1x);
|
||||
|
@ -4954,9 +4954,9 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev,
|
|||
struct cnic_local *cp = dev->cnic_priv;
|
||||
struct cnic_uio_dev *udev = cp->udev;
|
||||
struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (udev->l2_ring +
|
||||
BCM_PAGE_SIZE);
|
||||
BNX2_PAGE_SIZE);
|
||||
struct eth_rx_cqe_next_page *rxcqe = (struct eth_rx_cqe_next_page *)
|
||||
(udev->l2_ring + (2 * BCM_PAGE_SIZE));
|
||||
(udev->l2_ring + (2 * BNX2_PAGE_SIZE));
|
||||
struct host_sp_status_block *sb = cp->bnx2x_def_status_blk;
|
||||
int i;
|
||||
u32 cli = cp->ethdev->iscsi_l2_client_id;
|
||||
|
@ -4980,20 +4980,20 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev,
|
|||
rxbd->addr_lo = cpu_to_le32(buf_map & 0xffffffff);
|
||||
}
|
||||
|
||||
val = (u64) (ring_map + BCM_PAGE_SIZE) >> 32;
|
||||
val = (u64) (ring_map + BNX2_PAGE_SIZE) >> 32;
|
||||
rxbd->addr_hi = cpu_to_le32(val);
|
||||
data->rx.bd_page_base.hi = cpu_to_le32(val);
|
||||
|
||||
val = (u64) (ring_map + BCM_PAGE_SIZE) & 0xffffffff;
|
||||
val = (u64) (ring_map + BNX2_PAGE_SIZE) & 0xffffffff;
|
||||
rxbd->addr_lo = cpu_to_le32(val);
|
||||
data->rx.bd_page_base.lo = cpu_to_le32(val);
|
||||
|
||||
rxcqe += BNX2X_MAX_RCQ_DESC_CNT;
|
||||
val = (u64) (ring_map + (2 * BCM_PAGE_SIZE)) >> 32;
|
||||
val = (u64) (ring_map + (2 * BNX2_PAGE_SIZE)) >> 32;
|
||||
rxcqe->addr_hi = cpu_to_le32(val);
|
||||
data->rx.cqe_page_base.hi = cpu_to_le32(val);
|
||||
|
||||
val = (u64) (ring_map + (2 * BCM_PAGE_SIZE)) & 0xffffffff;
|
||||
val = (u64) (ring_map + (2 * BNX2_PAGE_SIZE)) & 0xffffffff;
|
||||
rxcqe->addr_lo = cpu_to_le32(val);
|
||||
data->rx.cqe_page_base.lo = cpu_to_le32(val);
|
||||
|
||||
|
@ -5258,8 +5258,8 @@ static void cnic_shutdown_rings(struct cnic_dev *dev)
|
|||
msleep(10);
|
||||
}
|
||||
clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags);
|
||||
rx_ring = udev->l2_ring + BCM_PAGE_SIZE;
|
||||
memset(rx_ring, 0, BCM_PAGE_SIZE);
|
||||
rx_ring = udev->l2_ring + BNX2_PAGE_SIZE;
|
||||
memset(rx_ring, 0, BNX2_PAGE_SIZE);
|
||||
}
|
||||
|
||||
static int cnic_register_netdev(struct cnic_dev *dev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue