Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255470
b: refs/heads/master
c: 11f23aa
h: refs/heads/master
v: v3
  • Loading branch information
Eddie Wai authored and David S. Miller committed Jun 9, 2011
1 parent 20c72bf commit 2afc8cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 101c40c8cb0d10c30f423805f9f5b7a75956832d
refs/heads/master: 11f23aa8ccd56786f0a6f04211cf59b3fab2ce08
14 changes: 9 additions & 5 deletions trunk/drivers/net/cnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,12 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
}
EXPORT_SYMBOL(cnic_unregister_driver);

static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id)
static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id,
u32 next)
{
id_tbl->start = start_id;
id_tbl->max = size;
id_tbl->next = 0;
id_tbl->next = next;
spin_lock_init(&id_tbl->lock);
id_tbl->table = kzalloc(DIV_ROUND_UP(size, 32) * 4, GFP_KERNEL);
if (!id_tbl->table)
Expand Down Expand Up @@ -3804,14 +3805,17 @@ static void cnic_cm_free_mem(struct cnic_dev *dev)
static int cnic_cm_alloc_mem(struct cnic_dev *dev)
{
struct cnic_local *cp = dev->cnic_priv;
u32 port_id;

cp->csk_tbl = kzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ,
GFP_KERNEL);
if (!cp->csk_tbl)
return -ENOMEM;

get_random_bytes(&port_id, sizeof(port_id));
port_id %= CNIC_LOCAL_PORT_RANGE;
if (cnic_init_id_tbl(&cp->csk_port_tbl, CNIC_LOCAL_PORT_RANGE,
CNIC_LOCAL_PORT_MIN)) {
CNIC_LOCAL_PORT_MIN, port_id)) {
cnic_cm_free_mem(dev);
return -ENOMEM;
}
Expand Down Expand Up @@ -4829,15 +4833,15 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
pfid = cp->pfid;

ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ,
cp->iscsi_start_cid);
cp->iscsi_start_cid, 0);

if (ret)
return -ENOMEM;

if (BNX2X_CHIP_IS_E2(cp->chip_id)) {
ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl,
BNX2X_FCOE_NUM_CONNECTIONS,
cp->fcoe_start_cid);
cp->fcoe_start_cid, 0);

if (ret)
return -ENOMEM;
Expand Down

0 comments on commit 2afc8cf

Please sign in to comment.