Skip to content

Commit f3b7a65

Browse files
committed
Merge branch 'mlx5-next' into wip/leon-for-next
* mlx5-next: net/mlx5: Check device memory pointer before usage net/mlx5: fs, fix RDMA TRANSPORT init cleanup flow net/mlx5: Add IFC bits for PCIe Congestion Event object net/mlx5: Small refactor for general object capabilities
2 parents 7788278 + 70f238c commit f3b7a65

5 files changed

Lines changed: 77 additions & 21 deletions

File tree

drivers/infiniband/hw/mlx5/dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static struct ib_dm *handle_alloc_dm_memic(struct ib_ucontext *ctx,
282282
int err;
283283
u64 address;
284284

285-
if (!MLX5_CAP_DEV_MEM(dm_db->dev, memic))
285+
if (!dm_db || !MLX5_CAP_DEV_MEM(dm_db->dev, memic))
286286
return ERR_PTR(-EOPNOTSUPP);
287287

288288
dm = kzalloc(sizeof(*dm), GFP_KERNEL);

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,6 +3247,7 @@ init_rdma_transport_rx_root_ns_one(struct mlx5_flow_steering *steering,
32473247
{
32483248
struct mlx5_flow_root_namespace *root_ns;
32493249
struct fs_prio *prio;
3250+
int ret;
32503251
int i;
32513252

32523253
steering->rdma_transport_rx_root_ns[vport_idx] =
@@ -3258,11 +3259,17 @@ init_rdma_transport_rx_root_ns_one(struct mlx5_flow_steering *steering,
32583259

32593260
for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) {
32603261
prio = fs_create_prio(&root_ns->ns, i, 1);
3261-
if (IS_ERR(prio))
3262-
return PTR_ERR(prio);
3262+
if (IS_ERR(prio)) {
3263+
ret = PTR_ERR(prio);
3264+
goto err;
3265+
}
32633266
}
32643267
set_prio_attrs(root_ns);
32653268
return 0;
3269+
3270+
err:
3271+
cleanup_root_ns(root_ns);
3272+
return ret;
32663273
}
32673274

32683275
static int
@@ -3271,6 +3278,7 @@ init_rdma_transport_tx_root_ns_one(struct mlx5_flow_steering *steering,
32713278
{
32723279
struct mlx5_flow_root_namespace *root_ns;
32733280
struct fs_prio *prio;
3281+
int ret;
32743282
int i;
32753283

32763284
steering->rdma_transport_tx_root_ns[vport_idx] =
@@ -3282,11 +3290,17 @@ init_rdma_transport_tx_root_ns_one(struct mlx5_flow_steering *steering,
32823290

32833291
for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) {
32843292
prio = fs_create_prio(&root_ns->ns, i, 1);
3285-
if (IS_ERR(prio))
3286-
return PTR_ERR(prio);
3293+
if (IS_ERR(prio)) {
3294+
ret = PTR_ERR(prio);
3295+
goto err;
3296+
}
32873297
}
32883298
set_prio_attrs(root_ns);
32893299
return 0;
3300+
3301+
err:
3302+
cleanup_root_ns(root_ns);
3303+
return ret;
32903304
}
32913305

32923306
static int init_rdma_transport_rx_root_ns(struct mlx5_flow_steering *steering)

drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct mlx5_dm *mlx5_dm_create(struct mlx5_core_dev *dev)
3030

3131
dm = kzalloc(sizeof(*dm), GFP_KERNEL);
3232
if (!dm)
33-
return ERR_PTR(-ENOMEM);
33+
return NULL;
3434

3535
spin_lock_init(&dm->lock);
3636

@@ -96,7 +96,7 @@ struct mlx5_dm *mlx5_dm_create(struct mlx5_core_dev *dev)
9696
err_steering:
9797
kfree(dm);
9898

99-
return ERR_PTR(-ENOMEM);
99+
return NULL;
100100
}
101101

102102
void mlx5_dm_cleanup(struct mlx5_core_dev *dev)

drivers/net/ethernet/mellanox/mlx5/core/main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,9 +1102,6 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)
11021102
}
11031103

11041104
dev->dm = mlx5_dm_create(dev);
1105-
if (IS_ERR(dev->dm))
1106-
mlx5_core_warn(dev, "Failed to init device memory %ld\n", PTR_ERR(dev->dm));
1107-
11081105
dev->tracer = mlx5_fw_tracer_create(dev);
11091106
dev->hv_vhca = mlx5_hv_vhca_create(dev);
11101107
dev->rsc_dump = mlx5_rsc_dump_create(dev);

include/linux/mlx5/mlx5_ifc.h

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12501,17 +12501,6 @@ struct mlx5_ifc_affiliated_event_header_bits {
1250112501
u8 obj_id[0x20];
1250212502
};
1250312503

12504-
enum {
12505-
MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT_ULL(0xc),
12506-
MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC = BIT_ULL(0x13),
12507-
MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT_ULL(0x20),
12508-
MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_FLOW_METER_ASO = BIT_ULL(0x24),
12509-
};
12510-
12511-
enum {
12512-
MLX5_HCA_CAP_2_GENERAL_OBJECT_TYPES_RDMA_CTRL = BIT_ULL(0x13),
12513-
};
12514-
1251512504
enum {
1251612505
MLX5_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = 0xc,
1251712506
MLX5_GENERAL_OBJECT_TYPES_IPSEC = 0x13,
@@ -12520,9 +12509,28 @@ enum {
1252012509
MLX5_GENERAL_OBJECT_TYPES_MACSEC = 0x27,
1252112510
MLX5_GENERAL_OBJECT_TYPES_INT_KEK = 0x47,
1252212511
MLX5_GENERAL_OBJECT_TYPES_RDMA_CTRL = 0x53,
12512+
MLX5_GENERAL_OBJECT_TYPES_PCIE_CONG_EVENT = 0x58,
1252312513
MLX5_GENERAL_OBJECT_TYPES_FLOW_TABLE_ALIAS = 0xff15,
1252412514
};
1252512515

12516+
enum {
12517+
MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY =
12518+
BIT_ULL(MLX5_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY),
12519+
MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC =
12520+
BIT_ULL(MLX5_GENERAL_OBJECT_TYPES_IPSEC),
12521+
MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER =
12522+
BIT_ULL(MLX5_GENERAL_OBJECT_TYPES_SAMPLER),
12523+
MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_FLOW_METER_ASO =
12524+
BIT_ULL(MLX5_GENERAL_OBJECT_TYPES_FLOW_METER_ASO),
12525+
};
12526+
12527+
enum {
12528+
MLX5_HCA_CAP_2_GENERAL_OBJECT_TYPES_RDMA_CTRL =
12529+
BIT_ULL(MLX5_GENERAL_OBJECT_TYPES_RDMA_CTRL - 0x40),
12530+
MLX5_HCA_CAP_2_GENERAL_OBJECT_TYPES_PCIE_CONG_EVENT =
12531+
BIT_ULL(MLX5_GENERAL_OBJECT_TYPES_PCIE_CONG_EVENT - 0x40),
12532+
};
12533+
1252612534
enum {
1252712535
MLX5_IPSEC_OBJECT_ICV_LEN_16B,
1252812536
};
@@ -13279,4 +13287,41 @@ struct mlx5_ifc_mrtcq_reg_bits {
1327913287
u8 reserved_at_80[0x180];
1328013288
};
1328113289

13290+
struct mlx5_ifc_pcie_cong_event_obj_bits {
13291+
u8 modify_select_field[0x40];
13292+
13293+
u8 inbound_event_en[0x1];
13294+
u8 outbound_event_en[0x1];
13295+
u8 reserved_at_42[0x1e];
13296+
13297+
u8 reserved_at_60[0x1];
13298+
u8 inbound_cong_state[0x3];
13299+
u8 reserved_at_64[0x1];
13300+
u8 outbound_cong_state[0x3];
13301+
u8 reserved_at_68[0x18];
13302+
13303+
u8 inbound_cong_low_threshold[0x10];
13304+
u8 inbound_cong_high_threshold[0x10];
13305+
13306+
u8 outbound_cong_low_threshold[0x10];
13307+
u8 outbound_cong_high_threshold[0x10];
13308+
13309+
u8 reserved_at_e0[0x340];
13310+
};
13311+
13312+
struct mlx5_ifc_pcie_cong_event_cmd_in_bits {
13313+
struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
13314+
struct mlx5_ifc_pcie_cong_event_obj_bits cong_obj;
13315+
};
13316+
13317+
struct mlx5_ifc_pcie_cong_event_cmd_out_bits {
13318+
struct mlx5_ifc_general_obj_out_cmd_hdr_bits hdr;
13319+
struct mlx5_ifc_pcie_cong_event_obj_bits cong_obj;
13320+
};
13321+
13322+
enum mlx5e_pcie_cong_event_mod_field {
13323+
MLX5_PCIE_CONG_EVENT_MOD_EVENT_EN = BIT(0),
13324+
MLX5_PCIE_CONG_EVENT_MOD_THRESH = BIT(2),
13325+
};
13326+
1328213327
#endif /* MLX5_IFC_H */

0 commit comments

Comments
 (0)