aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c69
1 files changed, 45 insertions, 24 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 84439152e499..230dea623895 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -8001,19 +8001,25 @@ void bnx2x_free_mem(struct bnx2x *bp)
8001 8001
8002int bnx2x_alloc_mem_cnic(struct bnx2x *bp) 8002int bnx2x_alloc_mem_cnic(struct bnx2x *bp)
8003{ 8003{
8004 if (!CHIP_IS_E1x(bp)) 8004 if (!CHIP_IS_E1x(bp)) {
8005 /* size = the status block + ramrod buffers */ 8005 /* size = the status block + ramrod buffers */
8006 BNX2X_PCI_ALLOC(bp->cnic_sb.e2_sb, &bp->cnic_sb_mapping, 8006 bp->cnic_sb.e2_sb = BNX2X_PCI_ALLOC(&bp->cnic_sb_mapping,
8007 sizeof(struct host_hc_status_block_e2)); 8007 sizeof(struct host_hc_status_block_e2));
8008 else 8008 if (!bp->cnic_sb.e2_sb)
8009 BNX2X_PCI_ALLOC(bp->cnic_sb.e1x_sb, 8009 goto alloc_mem_err;
8010 &bp->cnic_sb_mapping, 8010 } else {
8011 sizeof(struct 8011 bp->cnic_sb.e1x_sb = BNX2X_PCI_ALLOC(&bp->cnic_sb_mapping,
8012 host_hc_status_block_e1x)); 8012 sizeof(struct host_hc_status_block_e1x));
8013 if (!bp->cnic_sb.e1x_sb)
8014 goto alloc_mem_err;
8015 }
8013 8016
8014 if (CONFIGURE_NIC_MODE(bp) && !bp->t2) 8017 if (CONFIGURE_NIC_MODE(bp) && !bp->t2) {
8015 /* allocate searcher T2 table, as it wasn't allocated before */ 8018 /* allocate searcher T2 table, as it wasn't allocated before */
8016 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); 8019 bp->t2 = BNX2X_PCI_ALLOC(&bp->t2_mapping, SRC_T2_SZ);
8020 if (!bp->t2)
8021 goto alloc_mem_err;
8022 }
8017 8023
8018 /* write address to which L5 should insert its values */ 8024 /* write address to which L5 should insert its values */
8019 bp->cnic_eth_dev.addr_drv_info_to_mcp = 8025 bp->cnic_eth_dev.addr_drv_info_to_mcp =
@@ -8034,15 +8040,22 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
8034{ 8040{
8035 int i, allocated, context_size; 8041 int i, allocated, context_size;
8036 8042
8037 if (!CONFIGURE_NIC_MODE(bp) && !bp->t2) 8043 if (!CONFIGURE_NIC_MODE(bp) && !bp->t2) {
8038 /* allocate searcher T2 table */ 8044 /* allocate searcher T2 table */
8039 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); 8045 bp->t2 = BNX2X_PCI_ALLOC(&bp->t2_mapping, SRC_T2_SZ);
8046 if (!bp->t2)
8047 goto alloc_mem_err;
8048 }
8040 8049
8041 BNX2X_PCI_ALLOC(bp->def_status_blk, &bp->def_status_blk_mapping, 8050 bp->def_status_blk = BNX2X_PCI_ALLOC(&bp->def_status_blk_mapping,
8042 sizeof(struct host_sp_status_block)); 8051 sizeof(struct host_sp_status_block));
8052 if (!bp->def_status_blk)
8053 goto alloc_mem_err;
8043 8054
8044 BNX2X_PCI_ALLOC(bp->slowpath, &bp->slowpath_mapping, 8055 bp->slowpath = BNX2X_PCI_ALLOC(&bp->slowpath_mapping,
8045 sizeof(struct bnx2x_slowpath)); 8056 sizeof(struct bnx2x_slowpath));
8057 if (!bp->slowpath)
8058 goto alloc_mem_err;
8046 8059
8047 /* Allocate memory for CDU context: 8060 /* Allocate memory for CDU context:
8048 * This memory is allocated separately and not in the generic ILT 8061 * This memory is allocated separately and not in the generic ILT
@@ -8062,12 +8075,16 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
8062 for (i = 0, allocated = 0; allocated < context_size; i++) { 8075 for (i = 0, allocated = 0; allocated < context_size; i++) {
8063 bp->context[i].size = min(CDU_ILT_PAGE_SZ, 8076 bp->context[i].size = min(CDU_ILT_PAGE_SZ,
8064 (context_size - allocated)); 8077 (context_size - allocated));
8065 BNX2X_PCI_ALLOC(bp->context[i].vcxt, 8078 bp->context[i].vcxt = BNX2X_PCI_ALLOC(&bp->context[i].cxt_mapping,
8066 &bp->context[i].cxt_mapping, 8079 bp->context[i].size);
8067 bp->context[i].size); 8080 if (!bp->context[i].vcxt)
8081 goto alloc_mem_err;
8068 allocated += bp->context[i].size; 8082 allocated += bp->context[i].size;
8069 } 8083 }
8070 BNX2X_ALLOC(bp->ilt->lines, sizeof(struct ilt_line) * ILT_MAX_LINES); 8084 bp->ilt->lines = kcalloc(ILT_MAX_LINES, sizeof(struct ilt_line),
8085 GFP_KERNEL);
8086 if (!bp->ilt->lines)
8087 goto alloc_mem_err;
8071 8088
8072 if (bnx2x_ilt_mem_op(bp, ILT_MEMOP_ALLOC)) 8089 if (bnx2x_ilt_mem_op(bp, ILT_MEMOP_ALLOC))
8073 goto alloc_mem_err; 8090 goto alloc_mem_err;
@@ -8076,11 +8093,15 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
8076 goto alloc_mem_err; 8093 goto alloc_mem_err;
8077 8094
8078 /* Slow path ring */ 8095 /* Slow path ring */
8079 BNX2X_PCI_ALLOC(bp->spq, &bp->spq_mapping, BCM_PAGE_SIZE); 8096 bp->spq = BNX2X_PCI_ALLOC(&bp->spq_mapping, BCM_PAGE_SIZE);
8097 if (!bp->spq)
8098 goto alloc_mem_err;
8080 8099
8081 /* EQ */ 8100 /* EQ */
8082 BNX2X_PCI_ALLOC(bp->eq_ring, &bp->eq_mapping, 8101 bp->eq_ring = BNX2X_PCI_ALLOC(&bp->eq_mapping,
8083 BCM_PAGE_SIZE * NUM_EQ_PAGES); 8102 BCM_PAGE_SIZE * NUM_EQ_PAGES);
8103 if (!bp->eq_ring)
8104 goto alloc_mem_err;
8084 8105
8085 return 0; 8106 return 0;
8086 8107
@@ -11954,7 +11975,7 @@ static int bnx2x_init_mcast_macs_list(struct bnx2x *bp,
11954{ 11975{
11955 int mc_count = netdev_mc_count(bp->dev); 11976 int mc_count = netdev_mc_count(bp->dev);
11956 struct bnx2x_mcast_list_elem *mc_mac = 11977 struct bnx2x_mcast_list_elem *mc_mac =
11957 kzalloc(sizeof(*mc_mac) * mc_count, GFP_ATOMIC); 11978 kcalloc(mc_count, sizeof(*mc_mac), GFP_ATOMIC);
11958 struct netdev_hw_addr *ha; 11979 struct netdev_hw_addr *ha;
11959 11980
11960 if (!mc_mac) 11981 if (!mc_mac)