Skip to content

Commit 4d533e0

Browse files
ogerlitzSaeed Mahameed
authored andcommitted
net/mlx5: Enable setting hairpin queue size
Allow to specify the size of the hairpin queues along with the packet buffer data size from the core setup code. If the driver doesn't provide this, the FW applies proper value that matches the provided data size and a FW chosen RQ stride size. Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 3f6d08d commit 4d533e0

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ static int mlx5_hairpin_create_rq(struct mlx5_core_dev *mdev,
413413
MLX5_SET(rqc, rqc, counter_set_id, params->q_counter);
414414

415415
MLX5_SET(wq, wq, log_hairpin_data_sz, params->log_data_size);
416+
MLX5_SET(wq, wq, log_hairpin_num_packets, params->log_num_packets);
416417

417418
return mlx5_core_create_rq(mdev, in, MLX5_ST_SZ_BYTES(create_rq_in), rqn);
418419
}
@@ -430,6 +431,7 @@ static int mlx5_hairpin_create_sq(struct mlx5_core_dev *mdev,
430431
MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST);
431432

432433
MLX5_SET(wq, wq, log_hairpin_data_sz, params->log_data_size);
434+
MLX5_SET(wq, wq, log_hairpin_num_packets, params->log_num_packets);
433435

434436
return mlx5_core_create_sq(mdev, in, MLX5_ST_SZ_BYTES(create_sq_in), sqn);
435437
}

include/linux/mlx5/mlx5_ifc.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
10311031
u8 log_max_hairpin_queues[0x5];
10321032
u8 reserved_at_3c8[0x3];
10331033
u8 log_max_hairpin_wq_data_sz[0x5];
1034-
u8 reserved_at_3d0[0xb];
1034+
u8 reserved_at_3d0[0x3];
1035+
u8 log_max_hairpin_num_packets[0x5];
1036+
u8 reserved_at_3d8[0x3];
10351037
u8 log_max_wq_sz[0x5];
10361038

10371039
u8 nic_vport_change_event[0x1];
@@ -1172,7 +1174,9 @@ struct mlx5_ifc_wq_bits {
11721174
u8 reserved_at_118[0x3];
11731175
u8 log_wq_sz[0x5];
11741176

1175-
u8 reserved_at_120[0xb];
1177+
u8 reserved_at_120[0x3];
1178+
u8 log_hairpin_num_packets[0x5];
1179+
u8 reserved_at_128[0x3];
11761180
u8 log_hairpin_data_sz[0x5];
11771181
u8 reserved_at_130[0x5];
11781182

include/linux/mlx5/transobj.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ void mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn);
7777

7878
struct mlx5_hairpin_params {
7979
u8 log_data_size;
80+
u8 log_num_packets;
8081
u16 q_counter;
8182
int num_channels;
8283
};

0 commit comments

Comments
 (0)