Skip to content

Commit aa1ec3d

Browse files
Hadar Hen Ziondavem330
authored andcommitted
net/mlx4_core: Change resource tracking ID to be 64 bit
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>
1 parent 4af1c04 commit aa1ec3d

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎drivers/net/ethernet/mellanox/mlx4/mlx4.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port);
10331033
/* resource tracker functions*/
10341034
int mlx4_get_slave_from_resource_id(struct mlx4_dev *dev,
10351035
enum mlx4_resource resource_type,
1036-
int resource_id, int *slave);
1036+
u64 resource_id, int *slave);
10371037
void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave_id);
10381038
int mlx4_init_resource_tracker(struct mlx4_dev *dev);
10391039

‎drivers/net/ethernet/mellanox/mlx4/resource_tracker.c‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct mac_res {
5858
struct res_common {
5959
struct list_head list;
6060
struct rb_node node;
61-
u32 res_id;
61+
u64 res_id;
6262
int owner;
6363
int state;
6464
int from_state;
@@ -324,7 +324,7 @@ static void *find_res(struct mlx4_dev *dev, int res_id,
324324
res_id);
325325
}
326326

327-
static int get_res(struct mlx4_dev *dev, int slave, int res_id,
327+
static int get_res(struct mlx4_dev *dev, int slave, u64 res_id,
328328
enum mlx4_resource type,
329329
void *res)
330330
{
@@ -350,7 +350,7 @@ static int get_res(struct mlx4_dev *dev, int slave, int res_id,
350350

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

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

364364
int mlx4_get_slave_from_resource_id(struct mlx4_dev *dev,
365365
enum mlx4_resource type,
366-
int res_id, int *slave)
366+
u64 res_id, int *slave)
367367
{
368368

369369
struct res_common *r;
@@ -384,7 +384,7 @@ int mlx4_get_slave_from_resource_id(struct mlx4_dev *dev,
384384
return err;
385385
}
386386

387-
static void put_res(struct mlx4_dev *dev, int slave, int res_id,
387+
static void put_res(struct mlx4_dev *dev, int slave, u64 res_id,
388388
enum mlx4_resource type)
389389
{
390390
struct res_common *r;
@@ -516,7 +516,7 @@ static struct res_common *alloc_xrcdn_tr(int id)
516516
return &ret->com;
517517
}
518518

519-
static struct res_common *alloc_tr(int id, enum mlx4_resource type, int slave,
519+
static struct res_common *alloc_tr(u64 id, enum mlx4_resource type, int slave,
520520
int extra)
521521
{
522522
struct res_common *ret;
@@ -558,7 +558,7 @@ static struct res_common *alloc_tr(int id, enum mlx4_resource type, int slave,
558558
return ret;
559559
}
560560

561-
static int add_res_range(struct mlx4_dev *dev, int slave, int base, int count,
561+
static int add_res_range(struct mlx4_dev *dev, int slave, u64 base, int count,
562562
enum mlx4_resource type, int extra)
563563
{
564564
int i;
@@ -727,10 +727,10 @@ static int remove_ok(struct res_common *res, enum mlx4_resource type, int extra)
727727
}
728728
}
729729

730-
static int rem_res_range(struct mlx4_dev *dev, int slave, int base, int count,
730+
static int rem_res_range(struct mlx4_dev *dev, int slave, u64 base, int count,
731731
enum mlx4_resource type, int extra)
732732
{
733-
int i;
733+
u64 i;
734734
int err;
735735
struct mlx4_priv *priv = mlx4_priv(dev);
736736
struct mlx4_resource_tracker *tracker = &priv->mfunc.master.res_tracker;
@@ -784,7 +784,7 @@ static int qp_res_start_move_to(struct mlx4_dev *dev, int slave, int qpn,
784784
else {
785785
switch (state) {
786786
case RES_QP_BUSY:
787-
mlx4_dbg(dev, "%s: failed RES_QP, 0x%x\n",
787+
mlx4_dbg(dev, "%s: failed RES_QP, 0x%llx\n",
788788
__func__, r->com.res_id);
789789
err = -EBUSY;
790790
break;
@@ -793,7 +793,7 @@ static int qp_res_start_move_to(struct mlx4_dev *dev, int slave, int qpn,
793793
if (r->com.state == RES_QP_MAPPED && !alloc)
794794
break;
795795

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

@@ -802,7 +802,7 @@ static int qp_res_start_move_to(struct mlx4_dev *dev, int slave, int qpn,
802802
r->com.state == RES_QP_HW)
803803
break;
804804
else {
805-
mlx4_dbg(dev, "failed RES_QP, 0x%x\n",
805+
mlx4_dbg(dev, "failed RES_QP, 0x%llx\n",
806806
r->com.res_id);
807807
err = -EINVAL;
808808
}
@@ -2794,7 +2794,7 @@ static int _move_all_busy(struct mlx4_dev *dev, int slave,
27942794
if (r->state == RES_ANY_BUSY) {
27952795
if (print)
27962796
mlx4_dbg(dev,
2797-
"%s id 0x%x is busy\n",
2797+
"%s id 0x%llx is busy\n",
27982798
ResourceType(type),
27992799
r->res_id);
28002800
++busy;

0 commit comments

Comments
 (0)