History

net/mlx5: Add flow counter bulk allocation hardware bits and command

Add a handle to invoke the new FW capability of allocating a bulk of flow counters.

Gavi Teitz committed 7 years ago

Commit 8536a6b1 parent 6f06e043 files · +31 −3Browse files

Unified · Split

3 files
  1. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +9 −1
  2. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h +3 −0
  3. include/linux/mlx5/mlx5_ifc.h +19 −2
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c+9−1
@@ -566,7 +566,9 @@ static int mlx5_cmd_delete_fte(struct mlx5_flow_root_namespace *ns, · 565 unmodified lines
566566 return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
567567 }
568568
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)
570572 {
571573 u32 in[MLX5_ST_SZ_DW(alloc_flow_counter_in)] = {0};
572574 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
574576
575577 MLX5_SET(alloc_flow_counter_in, in, opcode,
576578 MLX5_CMD_OP_ALLOC_FLOW_COUNTER);
579+ MLX5_SET(alloc_flow_counter_in, in, flow_counter_bulk, alloc_bitmask);
577580
578581 err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
579582 if (!err)
@@ -581,6 +584,11 @@ int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id) · 1 unmodified line
581584 return err;
582585 }
583586
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+
584592 int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id)
585593 {
586594 u32 in[MLX5_ST_SZ_DW(dealloc_flow_counter_in)] = {0};
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h+3−0
@@ -78,6 +78,9 @@ struct mlx5_flow_cmds { · 77 unmodified lines
7878 };
7979
8080 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);
8184 int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id);
8285 int mlx5_cmd_fc_query(struct mlx5_core_dev *dev, u32 id,
8386 u64 *packets, u64 *bytes);
include/linux/mlx5/mlx5_ifc.h+19−2
@@ -1040,6 +1040,21 @@ enum { · 1039 unmodified lines
10401040 MLX5_UCTX_CAP_INTERNAL_DEV_RES = 1UL << 1,
10411041 };
10421042
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+
10431058 struct mlx5_ifc_cmd_hca_cap_bits {
10441059 u8 reserved_at_0[0x30];
10451060 u8 vhca_id[0x10];
@@ -1244,7 +1259,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 198 unmodified lines
12441259 u8 reserved_at_2e0[0x7];
12451260 u8 max_qp_mcg[0x19];
12461261
1247− u8 reserved_at_300[0x18];
1262+ u8 reserved_at_300[0x10];
1263+ u8 flow_counter_bulk_alloc[0x8];
12481264 u8 log_max_mcg[0x8];
12491265
12501266 u8 reserved_at_320[0x3];
@@ -7815,7 +7831,8 @@ struct mlx5_ifc_alloc_flow_counter_in_bits { · 6564 unmodified lines
78157831 u8 reserved_at_20[0x10];
78167832 u8 op_mod[0x10];
78177833
7818− u8 reserved_at_40[0x40];
7834+ u8 reserved_at_40[0x38];
7835+ u8 flow_counter_bulk[0x8];
78197836 };
78207837
78217838 struct mlx5_ifc_add_vxlan_udp_dport_out_bits {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t