Add a handle to invoke the new FW capability of allocating a bulk of flow counters.
Unified · Split
| @@ -566,7 +566,9 @@ static int mlx5_cmd_delete_fte(struct mlx5_flow_root_namespace *ns, · 565 unmodified lines | ||
| 566 | 566 | return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | −int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) | |
| 569 | +int mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, | |
| 570 | + enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask, | |
| 571 | + u32 *id) | |
| 570 | 572 | { |
| 571 | 573 | u32 in[MLX5_ST_SZ_DW(alloc_flow_counter_in)] = {0}; |
| 572 | 574 | u32 out[MLX5_ST_SZ_DW(alloc_flow_counter_out)] = {0}; |
| @@ -574,6 +576,7 @@ int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) · 1 unmodified line | ||
| 574 | 576 | |
| 575 | 577 | MLX5_SET(alloc_flow_counter_in, in, opcode, |
| 576 | 578 | MLX5_CMD_OP_ALLOC_FLOW_COUNTER); |
| 579 | + MLX5_SET(alloc_flow_counter_in, in, flow_counter_bulk, alloc_bitmask); | |
| 577 | 580 | |
| 578 | 581 | err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
| 579 | 582 | if (!err) |
| @@ -581,6 +584,11 @@ int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) · 1 unmodified line | ||
| 581 | 584 | return err; |
| 582 | 585 | } |
| 583 | 586 | |
| 587 | +int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) | |
| 588 | +{ | |
| 589 | + return mlx5_cmd_fc_bulk_alloc(dev, 0, id); | |
| 590 | +} | |
| 591 | + | |
| 584 | 592 | int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id) |
| 585 | 593 | { |
| 586 | 594 | u32 in[MLX5_ST_SZ_DW(dealloc_flow_counter_in)] = {0}; |
| @@ -78,6 +78,9 @@ struct mlx5_flow_cmds { · 77 unmodified lines | ||
| 78 | 78 | }; |
| 79 | 79 | |
| 80 | 80 | int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id); |
| 81 | +int mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, | |
| 82 | + enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask, | |
| 83 | + u32 *id); | |
| 81 | 84 | int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id); |
| 82 | 85 | int mlx5_cmd_fc_query(struct mlx5_core_dev *dev, u32 id, |
| 83 | 86 | u64 *packets, u64 *bytes); |
| @@ -1040,6 +1040,21 @@ enum { · 1039 unmodified lines | ||
| 1040 | 1040 | MLX5_UCTX_CAP_INTERNAL_DEV_RES = 1UL << 1, |
| 1041 | 1041 | }; |
| 1042 | 1042 | |
| 1043 | +#define MLX5_FC_BULK_SIZE_FACTOR 128 | |
| 1044 | + | |
| 1045 | +enum mlx5_fc_bulk_alloc_bitmask { | |
| 1046 | + MLX5_FC_BULK_128 = (1 << 0), | |
| 1047 | + MLX5_FC_BULK_256 = (1 << 1), | |
| 1048 | + MLX5_FC_BULK_512 = (1 << 2), | |
| 1049 | + MLX5_FC_BULK_1024 = (1 << 3), | |
| 1050 | + MLX5_FC_BULK_2048 = (1 << 4), | |
| 1051 | + MLX5_FC_BULK_4096 = (1 << 5), | |
| 1052 | + MLX5_FC_BULK_8192 = (1 << 6), | |
| 1053 | + MLX5_FC_BULK_16384 = (1 << 7), | |
| 1054 | +}; | |
| 1055 | + | |
| 1056 | +#define MLX5_FC_BULK_NUM_FCS(fc_enum) (MLX5_FC_BULK_SIZE_FACTOR * (fc_enum)) | |
| 1057 | + | |
| 1043 | 1058 | struct mlx5_ifc_cmd_hca_cap_bits { |
| 1044 | 1059 | u8 reserved_at_0[0x30]; |
| 1045 | 1060 | u8 vhca_id[0x10]; |
| @@ -1244,7 +1259,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 198 unmodified lines | ||
| 1244 | 1259 | u8 reserved_at_2e0[0x7]; |
| 1245 | 1260 | u8 max_qp_mcg[0x19]; |
| 1246 | 1261 | |
| 1247 | − u8 reserved_at_300[0x18]; | |
| 1262 | + u8 reserved_at_300[0x10]; | |
| 1263 | + u8 flow_counter_bulk_alloc[0x8]; | |
| 1248 | 1264 | u8 log_max_mcg[0x8]; |
| 1249 | 1265 | |
| 1250 | 1266 | u8 reserved_at_320[0x3]; |
| @@ -7815,7 +7831,8 @@ struct mlx5_ifc_alloc_flow_counter_in_bits { · 6564 unmodified lines | ||
| 7815 | 7831 | u8 reserved_at_20[0x10]; |
| 7816 | 7832 | u8 op_mod[0x10]; |
| 7817 | 7833 | |
| 7818 | − u8 reserved_at_40[0x40]; | |
| 7834 | + u8 reserved_at_40[0x38]; | |
| 7835 | + u8 flow_counter_bulk[0x8]; | |
| 7819 | 7836 | }; |
| 7820 | 7837 | |
| 7821 | 7838 | struct mlx5_ifc_add_vxlan_udp_dport_out_bits { |