Skip to content

Commit

Permalink
net/mlx4_core: Change resource tracking ID to be 64 bit
Browse files Browse the repository at this point in the history
Currently the IDs used by the resource tracker are of type u32, so far this was
ok since all the different resources we were tracking could be encoded in 32bit.

As a preparation step for tracking of resources whose IDs need > 32 bits such
as network flow steering rules, who are 64 bit in size, move to use 64 bit
based resource IDs.

Signed-off-by: Hadar Hen Zion <hadarh@mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hadar Hen Zion authored and David S. Miller committed Jul 7, 2012
1 parent 4af1c04 commit aa1ec3d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx4/mlx4.h
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port);
/* resource tracker functions*/
int mlx4_get_slave_from_resource_id(struct mlx4_dev *dev,
enum mlx4_resource resource_type,
int resource_id, int *slave);
u64 resource_id, int *slave);
void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave_id);
int mlx4_init_resource_tracker(struct mlx4_dev *dev);

Expand Down
26 changes: 13 additions & 13 deletions drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct mac_res {
struct res_common {
struct list_head list;
struct rb_node node;
u32 res_id;
u64 res_id;
int owner;
int state;
int from_state;
Expand Down Expand Up @@ -324,7 +324,7 @@ static void *find_res(struct mlx4_dev *dev, int res_id,
res_id);
}

static int get_res(struct mlx4_dev *dev, int slave, int res_id,
static int get_res(struct mlx4_dev *dev, int slave, u64 res_id,
enum mlx4_resource type,
void *res)
{
Expand All @@ -350,7 +350,7 @@ static int get_res(struct mlx4_dev *dev, int slave, int res_id,

r->from_state = r->state;
r->state = RES_ANY_BUSY;
mlx4_dbg(dev, "res %s id 0x%x to busy\n",
mlx4_dbg(dev, "res %s id 0x%llx to busy\n",
ResourceType(type), r->res_id);

if (res)
Expand All @@ -363,7 +363,7 @@ static int get_res(struct mlx4_dev *dev, int slave, int res_id,

int mlx4_get_slave_from_resource_id(struct mlx4_dev *dev,
enum mlx4_resource type,
int res_id, int *slave)
u64 res_id, int *slave)
{

struct res_common *r;
Expand All @@ -384,7 +384,7 @@ int mlx4_get_slave_from_resource_id(struct mlx4_dev *dev,
return err;
}

static void put_res(struct mlx4_dev *dev, int slave, int res_id,
static void put_res(struct mlx4_dev *dev, int slave, u64 res_id,
enum mlx4_resource type)
{
struct res_common *r;
Expand Down Expand Up @@ -516,7 +516,7 @@ static struct res_common *alloc_xrcdn_tr(int id)
return &ret->com;
}

static struct res_common *alloc_tr(int id, enum mlx4_resource type, int slave,
static struct res_common *alloc_tr(u64 id, enum mlx4_resource type, int slave,
int extra)
{
struct res_common *ret;
Expand Down Expand Up @@ -558,7 +558,7 @@ static struct res_common *alloc_tr(int id, enum mlx4_resource type, int slave,
return ret;
}

static int add_res_range(struct mlx4_dev *dev, int slave, int base, int count,
static int add_res_range(struct mlx4_dev *dev, int slave, u64 base, int count,
enum mlx4_resource type, int extra)
{
int i;
Expand Down Expand Up @@ -727,10 +727,10 @@ static int remove_ok(struct res_common *res, enum mlx4_resource type, int extra)
}
}

static int rem_res_range(struct mlx4_dev *dev, int slave, int base, int count,
static int rem_res_range(struct mlx4_dev *dev, int slave, u64 base, int count,
enum mlx4_resource type, int extra)
{
int i;
u64 i;
int err;
struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_resource_tracker *tracker = &priv->mfunc.master.res_tracker;
Expand Down Expand Up @@ -784,7 +784,7 @@ static int qp_res_start_move_to(struct mlx4_dev *dev, int slave, int qpn,
else {
switch (state) {
case RES_QP_BUSY:
mlx4_dbg(dev, "%s: failed RES_QP, 0x%x\n",
mlx4_dbg(dev, "%s: failed RES_QP, 0x%llx\n",
__func__, r->com.res_id);
err = -EBUSY;
break;
Expand All @@ -793,7 +793,7 @@ static int qp_res_start_move_to(struct mlx4_dev *dev, int slave, int qpn,
if (r->com.state == RES_QP_MAPPED && !alloc)
break;

mlx4_dbg(dev, "failed RES_QP, 0x%x\n", r->com.res_id);
mlx4_dbg(dev, "failed RES_QP, 0x%llx\n", r->com.res_id);
err = -EINVAL;
break;

Expand All @@ -802,7 +802,7 @@ static int qp_res_start_move_to(struct mlx4_dev *dev, int slave, int qpn,
r->com.state == RES_QP_HW)
break;
else {
mlx4_dbg(dev, "failed RES_QP, 0x%x\n",
mlx4_dbg(dev, "failed RES_QP, 0x%llx\n",
r->com.res_id);
err = -EINVAL;
}
Expand Down Expand Up @@ -2794,7 +2794,7 @@ static int _move_all_busy(struct mlx4_dev *dev, int slave,
if (r->state == RES_ANY_BUSY) {
if (print)
mlx4_dbg(dev,
"%s id 0x%x is busy\n",
"%s id 0x%llx is busy\n",
ResourceType(type),
r->res_id);
++busy;
Expand Down

0 comments on commit aa1ec3d

Please sign in to comment.