mlx5-next HW bits and definitions updates 2022-06-08
Subsystems (5)
cover mlx5-next HW bits and definitions updates 2022-06-08
From: Saeed Mahameed <[email protected]>
Updates to mlx5 HW bits and definitions for upcoming rdma and netdev features.
Jianbo Liu (2):
net/mlx5: Add IFC bits and enums for flow meter net/mlx5: Add support EXECUTE_ASO action for flow entry
Ofer Levi (1):
net/mlx5: Add bits and fields to support enhanced CQE compression
Saeed Mahameed (1):
net/mlx5: Add HW definitions of vport debug counters
Shay Drory (2):
net/mlx5: group fdb cleanup to single function
net/mlx5: Remove not used MLX5_CAP_BITS_RW_MASK
.../net/ethernet/mellanox/mlx5/core/fs_cmd.c | 33 ++++ .../net/ethernet/mellanox/mlx5/core/fs_core.c | 18 ++- .../net/ethernet/mellanox/mlx5/core/main.c | 7 - include/linux/mlx5/device.h | 36 ++--- include/linux/mlx5/fs.h | 14 ++ include/linux/mlx5/mlx5_ifc.h | 144 ++++++++++++++++-- 6 files changed, 207 insertions(+), 45 deletions(-)
Signature · 1 line
2.36.1
PATCH 1/6 net/mlx5: Add IFC bits and enums for flow meter
From: Jianbo Liu <[email protected]>
Add/extend structure layouts and defines for flow meter.
--- include/linux/mlx5/device.h | 1 + include/linux/mlx5/mlx5_ifc.h | 114 ++++++++++++++++++++++++++++++++-- 2 files changed, 111 insertions(+), 4 deletions(-)
include/linux/mlx5/device.h +1 -0
@@ -455,6 +455,7 @@ enum {MLX5_OPCODE_UMR =0x25 , + MLX5_OPCODE_ACCESS_ASO = 0x2d, }; enum {
include/linux/mlx5/mlx5_ifc.h +110 -4
168 lines not on this page · raw message
Signature · 1 line
2.36.1
PATCH 2/6 net/mlx5: Add HW definitions of vport debug counters
In reply to Saeed MahameedFrom: Saeed Mahameed <[email protected]>
total_q_under_processor_handle - number of queues in error state due to an async error or errored command.
send_queue_priority_update_flow - number of QP/SQ priority/SL update events.
cq_overrun - number of times CQ entered an error state due to an overflow.
async_eq_overrun -number of time an EQ mapped to async events was overrun.
comp_eq_overrun - number of time an EQ mapped to completion events was overrun.
quota_exceeded_command - number of commands issued and failed due to quota exceeded.
invalid_command - number of commands issued and failed dues to any reason other than quota exceeded.
--- include/linux/mlx5/mlx5_ifc.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
include/linux/mlx5/mlx5_ifc.h +19 -4
@@ -1438,7 +1438,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {u8 reserved_at_120[0xa ];u8 log_max_ra_req_dc[0x6 ]; -u8 reserved_at_130[0xa ]; +u8 reserved_at_130[0x9 ]; +u8 vnic_env_cq_overrun[0x1 ];u8 log_max_ra_res_dc[0x6 ];u8 reserved_at_140[0x5 ];
@@ -1633,7 +1634,11 @@ struct mlx5_ifc_cmd_hca_cap_bits {u8 nic_receive_steering_discard[0x1 ];u8 receive_discard_vport_down[0x1 ];u8 transmit_discard_vport_down[0x1 ]; -u8 reserved_at_343[0x5 ]; +u8 eq_overrun_count[0x1 ]; +u8 reserved_at_344[0x1 ]; +u8 invalid_command_count[0x1 ]; +u8 quota_exceeded_count[0x1 ]; +u8 reserved_at_347[0x1 ];u8 log_max_flow_counter_bulk[0x8 ];u8 max_flow_counter_15_0[0x10 ];
@@ -3438,11 +3443,21 @@ struct mlx5_ifc_vnic_diagnostic_statistics_bits {u8 transmit_discard_vport_down[0x40 ]; -u8 reserved_at_140[0xa0 ]; +u8 async_eq_overrun[0x20 ]; + +u8 comp_eq_overrun[0x20 ]; + +u8 reserved_at_180[0x20 ]; + +u8 invalid_command[0x20 ]; + +u8 quota_exceeded_command[0x20 ];u8 internal_rq_out_of_buffer[0x20 ]; -u8 reserved_at_200[0xe00 ]; +u8 cq_overrun[0x20 ]; + +u8 reserved_at_220[0xde0 ]; };struct mlx5_ifc_traffic_counter_bits {
Signature · 1 line
2.36.1
PATCH 3/6 net/mlx5: Add support EXECUTE_ASO action for flow entry
In reply to Saeed MahameedFrom: Jianbo Liu <[email protected]>
Attach flow meter to FTE with object id and index.
Use metadata register C5 to store the packet color meter result.
--- .../net/ethernet/mellanox/mlx5/core/fs_cmd.c | 33 +++++++++++++++++++ include/linux/mlx5/fs.h | 14 ++++++++ 2 files changed, 47 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +33 -0
@@ -479,6 +479,30 @@ static int mlx5_set_extended_dest(struct mlx5_core_dev *dev,return 0 ; } + +static void +mlx5_cmd_set_fte_flow_meter (struct fs_fte *fte,void *in_flow_context) +{ +void *exe_aso_ctrl; +void *execute_aso; + + execute_aso =MLX5_ADDR_OF (flow_context, in_flow_context, + execute_aso[0 ]); +MLX5_SET (execute_aso, execute_aso, valid,1 ); +MLX5_SET (execute_aso, execute_aso, aso_object_id, + fte->action.exe_aso.object_id); + + exe_aso_ctrl =MLX5_ADDR_OF (execute_aso, execute_aso, exe_aso_ctrl); +MLX5_SET (exe_aso_ctrl_flow_meter, exe_aso_ctrl, return_reg_id, + fte->action.exe_aso.return_reg_id); +MLX5_SET (exe_aso_ctrl_flow_meter, exe_aso_ctrl, aso_type, + fte->action.exe_aso.type); +MLX5_SET (exe_aso_ctrl_flow_meter, exe_aso_ctrl, init_color, + fte->action.exe_aso.flow_meter.init_color); +MLX5_SET (exe_aso_ctrl_flow_meter, exe_aso_ctrl, meter_id, + fte->action.exe_aso.flow_meter.meter_idx); +} + static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, int opmod, int modify_mask, struct mlx5_flow_table *ft,
@@ -663,6 +687,15 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, list_size); } +if (fte->action.action &MLX5_FLOW_CONTEXT_ACTION_EXECUTE_ASO ) { +if (fte->action.exe_aso.type ==MLX5_EXE_ASO_FLOW_METER ) { +mlx5_cmd_set_fte_flow_meter (fte, in_flow_context); + }else { + err = -EOPNOTSUPP ; + goto err_out; + } + } + err =mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); err_out:kvfree (in);
include/linux/mlx5/fs.h +14 -0
@@ -212,6 +212,19 @@ struct mlx5_flow_group * mlx5_create_flow_group(struct mlx5_flow_table *ft, u32 *in);void mlx5_destroy_flow_group (struct mlx5_flow_group *fg); +struct mlx5_exe_aso { +u32 object_id; +u8 type; +u8 return_reg_id; +union { +u32 ctrl_data; +struct { +u8 meter_idx; +u8 init_color; + } flow_meter; + }; +}; +struct mlx5_fs_vlan {u16 ethtype;u16 vid;
@@ -237,6 +250,7 @@ struct mlx5_flow_act {struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH ];struct ib_counters *counters;struct mlx5_flow_group *fg; +struct mlx5_exe_aso exe_aso; };#define MLX5_DECLARE_FLOW_ACT (name) \
Signature · 1 line
2.36.1
PATCH 4/6 net/mlx5: group fdb cleanup to single function
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
Currently, the allocation of fdb software objects are done is single function, oppose to the cleanup of them.
Group the cleanup of fdb software objects to single function.
--- .../net/ethernet/mellanox/mlx5/core/fs_core.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +10 -8
@@ -2866,6 +2866,14 @@ static int create_fdb_bypass(struct mlx5_flow_steering *steering)return 0 ; } +static void cleanup_fdb_root_ns (struct mlx5_flow_steering *steering) +{ +cleanup_root_ns (steering->fdb_root_ns); + steering->fdb_root_ns =NULL ; +kfree (steering->fdb_sub_ns); + steering->fdb_sub_ns =NULL ; +} +static int init_fdb_root_ns (struct mlx5_flow_steering *steering) {struct fs_prio *maj_prio;
@@ -2916,10 +2924,7 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering)return 0 ; out_err: -cleanup_root_ns (steering->fdb_root_ns); -kfree (steering->fdb_sub_ns); - steering->fdb_sub_ns =NULL ; - steering->fdb_root_ns =NULL ; +cleanup_fdb_root_ns (steering);return err; }
@@ -3079,10 +3084,7 @@ void mlx5_fs_core_cleanup(struct mlx5_core_dev *dev)struct mlx5_flow_steering *steering = dev->priv.steering;cleanup_root_ns (steering->root_ns); -cleanup_root_ns (steering->fdb_root_ns); - steering->fdb_root_ns =NULL ; -kfree (steering->fdb_sub_ns); - steering->fdb_sub_ns =NULL ; +cleanup_fdb_root_ns (steering);cleanup_root_ns (steering->port_sel_root_ns);cleanup_root_ns (steering->sniffer_rx_root_ns);cleanup_root_ns (steering->sniffer_tx_root_ns);
Signature · 1 line
2.36.1
PATCH 5/6 net/mlx5: Remove not used MLX5_CAP_BITS_RW_MASK
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
Remove not used MLX5_CAP_BITS_RW_MASK.
While at it, remove CAP_MASK, MLX5_CAP_OFF_CMDIF_CSUM and MLX5_DEV_CAP_FLAG_*, since MLX5_CAP_BITS_RW_MASK was their only user.
--- .../net/ethernet/mellanox/mlx5/core/main.c | 7 ------- include/linux/mlx5/device.h | 19 ------------------- 2 files changed, 26 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +0 -7
@@ -314,13 +314,6 @@ struct mlx5_reg_host_endianness {u8 rsvd[15 ]; }; -#define CAP_MASK (pos, size) ((u64)((1 << (size)) - 1) << (pos)) - -enum { -MLX5_CAP_BITS_RW_MASK =CAP_MASK (MLX5_CAP_OFF_CMDIF_CSUM ,2 ) | -MLX5_DEV_CAP_FLAG_DCT , -}; -static u16 to_fw_pkey_sz (struct mlx5_core_dev *dev,u32 size) {switch (size) {
include/linux/mlx5/device.h +0 -19
@@ -386,21 +386,6 @@ enum { MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG = 9, }; -enum { -MLX5_DEV_CAP_FLAG_XRC =1LL <<3 , -MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR =1LL <<8 , -MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR =1LL <<9 , -MLX5_DEV_CAP_FLAG_APM =1LL <<17 , -MLX5_DEV_CAP_FLAG_ATOMIC =1LL <<18 , -MLX5_DEV_CAP_FLAG_BLOCK_MCAST =1LL <<23 , -MLX5_DEV_CAP_FLAG_ON_DMND_PG =1LL <<24 , -MLX5_DEV_CAP_FLAG_CQ_MODER =1LL <<29 , -MLX5_DEV_CAP_FLAG_RESIZE_CQ =1LL <<30 , -MLX5_DEV_CAP_FLAG_DCT =1LL <<37 , -MLX5_DEV_CAP_FLAG_SIG_HAND_OVER =1LL <<40 , -MLX5_DEV_CAP_FLAG_CMDIF_CSUM =3LL <<46 , -}; -enum {MLX5_ROCE_VERSION_1 =0 ,MLX5_ROCE_VERSION_2 =2 ,
@@ -496,10 +481,6 @@ enum {MLX5_MAX_PAGE_SHIFT =31 }; -enum { -MLX5_CAP_OFF_CMDIF_CSUM =46 , -}; -enum {/* * Max wqe size for rdma read is 512 bytes, so this
Signature · 1 line
2.36.1
PATCH 6/6 net/mlx5: Add bits and fields to support enhanced CQE compression
In reply to Saeed MahameedFrom: Ofer Levi <[email protected]>
Expose ifc bits and add needed structure fields and methods to support enhanced CQE compression feature.
The enhanced CQE compression feature improves cpu utiliziation with better packet latency from nic to host.
--- include/linux/mlx5/device.h | 16 +++++++++++++++- include/linux/mlx5/mlx5_ifc.h | 7 +++++-- 2 files changed, 20 insertions(+), 3 deletions(-)
include/linux/mlx5/device.h +15 -1
@@ -822,7 +822,10 @@ struct mlx5_cqe64 {__be32 timestamp_l;__be32 sop_drop_qpn;__be16 wqe_counter; -u8 signature; +union { +u8 signature; +u8 validity_iteration_count; + };u8 op_own; };
@@ -854,6 +857,11 @@ enum { MLX5_CQE_FORMAT_CSUM_STRIDX = 0x3, }; +enum { +MLX5_CQE_COMPRESS_LAYOUT_BASIC =0 , +MLX5_CQE_COMPRESS_LAYOUT_ENHANCED =1 , +}; +#define MLX5_MINI_CQE_ARRAY_SIZE 8static inline u8 mlx5_get_cqe_format (struct mlx5_cqe64 *cqe)
@@ -866,6 +874,12 @@ static inline u8 get_cqe_opcode(struct mlx5_cqe64 *cqe)return cqe->op_own >>4 ; } +static inline u8 get_cqe_enhanced_num_mini_cqes (struct mlx5_cqe64 *cqe) +{ +/* num_of_mini_cqes is zero based */ +return get_cqe_opcode (cqe) +1 ; +} +static inline u8 get_cqe_lro_tcppsh (struct mlx5_cqe64 *cqe) {return (cqe->lro.tcppsh_abort_dupack >>6 ) &1 ;
include/linux/mlx5/mlx5_ifc.h +5 -2
@@ -1736,7 +1736,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {u8 log_max_dci_errored_streams[0x5 ];u8 reserved_at_598[0x8 ]; -u8 reserved_at_5a0[0x13 ]; +u8 reserved_at_5a0[0x10 ]; +u8 enhanced_cqe_compression[0x1 ]; +u8 reserved_at_5b1[0x2 ];u8 log_max_dek[0x5 ];u8 reserved_at_5b8[0x4 ];u8 mini_cqe_resp_stride_index[0x1 ];
@@ -4136,7 +4138,8 @@ struct mlx5_ifc_cqc_bits {u8 cqe_comp_en[0x1 ];u8 mini_cqe_res_format[0x2 ];u8 st[0x4 ]; -u8 reserved_at_18[0x8 ]; +u8 reserved_at_18[0x6 ]; +u8 cqe_compression_layout[0x2 ];u8 reserved_at_20[0x20 ];
Signature · 1 line
2.36.1
Quoted 12 lines · Saeed Mahameed
From: Saeed Mahameed <[email protected]>
Updates to mlx5 HW bits and definitions for upcoming rdma and netdev features.
Jianbo Liu (2):
net/mlx5: Add IFC bits and enums for flow meter net/mlx5: Add supportEXECUTE_ASOaction for flow entryOfer Levi (1):
net/mlx5: Add bits and fields to support enhanced CQE compression
Quoted 7 lines
Saeed Mahameed (1):
net/mlx5: Add HW definitions of vport debug countersShay Drory (2):
net/mlx5: group fdb cleanup to single function
net/mlx5: Remove not usedMLX5_CAP_BITS_RW_MASK
Series applied to mlx5-next