Skip to contentSkip to conversation

Support meter PPS(packet per second) in MLX5 PMD

PATCH Superseded Li Zhang 2 participants 15 messages Mar 31, 2021 – Apr 28, 2021 Network drivers

lore
Share & tools
lore

Li Zhang

author
#0 lore raw

cover Support meter PPS(packet per second) in MLX5 PMD

Currently meter algorithms only supports rate is bytes per second(BPS). Add packet_mode flag in meter profile parameters data structure. So that it can meter traffic by packet per second.

Depends-on: series=16002 ("Support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/list/?series=16002

Li Zhang (2):
common/mlx5: add meter mode definition in PRM file net/mlx5: support meter PPS profile

 doc/guides/nics/mlx5.rst           |  1 +
 drivers/common/mlx5/mlx5_prm.h     |  8 ++++
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 74 +++++++++++++++++++++++-------
 4 files changed, 77 insertions(+), 23 deletions(-)
Signature · 1 line
2.21.0
author
#1 lore raw

PATCH 1/2 common/mlx5: add meter mode definition in PRM file

Add meter mode definition in PRM file

---
 drivers/common/mlx5/mlx5_prm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/common/mlx5/mlx5_prm.h +8 -0
index 6d6c7f38bb..0bfa607e31 100644
@@ -2297,6 +2297,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2671,6 +2678,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
Signature · 1 line
2.21.0
author
#2 lore raw

PATCH 2/2 net/mlx5: support meter PPS profile

In reply to Li Zhang

Currently meter algorithms only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697) Add packet_mode flag to support rate is packet per second. So that it can meter traffic by packet per second (PPS).

---
 doc/guides/nics/mlx5.rst           |  1 +
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 74 +++++++++++++++++++++++-------
 3 files changed, 69 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index 6e9a68baf5..1eb6d3d5da 100644
@@ -415,6 +415,7 @@ Limitations
     green: QUEUE, RSS, PORT_ID, JUMP, MARK and SET_TAG.
     yellow: must be empty.
     red: must be DROP.
+  - meter profile packet mode is supported.
 
 Statistics
 ----------
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index 879252faa1..f34fc54fa6 100644
@@ -174,7 +174,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->sq_obj.aso_wqes[0]; i < size; ++i, ++wqe) {
@@ -187,11 +186,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -642,6 +636,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res;
@@ -682,6 +677,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.packet_mode)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +57 -17

130 lines not on this page · raw message

Signature · 1 line
2.21.0
author
#3 lore raw

v2 cover Support meter PPS(packet per second) in MLX5 PMD

In reply to Li Zhang

Currently meter algorithms only supports rate is bytes per second(BPS). Add packet_mode flag in meter profile parameters data structure. So that it can meter traffic by packet per second.

Depends-on: series=16256 ("Support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/list/?series=16256

V2: Fix comments from Matan.

Li Zhang (2):
common/mlx5: add meter mode definition in PRM file net/mlx5: support meter PPS profile

 doc/guides/nics/mlx5.rst           |  1 +
 drivers/common/mlx5/mlx5_prm.h     |  8 ++++
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 74 +++++++++++++++++++++++-------
 4 files changed, 77 insertions(+), 23 deletions(-)
Signature · 1 line
2.21.0
author
#4 lore raw

PATCH v2 1/2 common/mlx5: add meter mode definition in PRM file

Add meter mode definitions in PRM file

---
 drivers/common/mlx5/mlx5_prm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/common/mlx5/mlx5_prm.h +8 -0
index c6d8060bb9..efa5ae67bf 100644
@@ -2297,6 +2297,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2671,6 +2678,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
Signature · 1 line
2.21.0
author
#5 lore raw

PATCH v2 2/2 net/mlx5: support meter PPS profile

In reply to Li Zhang

Currently meter algorithms only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697) Add packet_mode flag to support rate is packet per second. So that it can meter traffic by packet per second (PPS).

---
 doc/guides/nics/mlx5.rst           |  1 +
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 74 +++++++++++++++++++++++-------
 3 files changed, 69 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index 9d36d27fa9..cf81ad5c09 100644
@@ -416,6 +416,7 @@ Limitations
      - green: QUEUE, RSS, PORT_ID, JUMP, MARK and SET_TAG.
      - yellow: must be empty.
      - RED: must be DROP.
+  - meter profile packet mode is supported.
 
 Statistics
 ----------
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index 20cd4fe18c..da513a600c 100644
@@ -191,7 +191,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->sq_obj.aso_wqes[0]; i < size; ++i, ++wqe) {
@@ -204,11 +203,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -664,6 +658,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res;
@@ -704,6 +699,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.packet_mode)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +57 -17

130 lines not on this page · raw message

Signature · 1 line
2.21.0
author
#6 lore raw

v3 cover Support meter PPS(packet per second) in MLX5 PMD

In reply to Li Zhang

Currently meter algorithms only supports rate is bytes per second(BPS). Add packet_mode flag in meter profile parameters data structure. So that it can meter traffic by packet per second.

Depends-on: series=16312 ("Support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/list/?series=16312

Depends-on: series=16302 ("support meter policy operations")
https://patchwork.dpdk.org/project/dpdk/list/?series=16302

V2: Fix comments about commit-log.
V3: Fix comments about Depends-on and rebase.

Li Zhang (2):
common/mlx5: add meter mode definition in PRM file net/mlx5: support meter PPS profile

 doc/guides/nics/mlx5.rst           |  1 +
 drivers/common/mlx5/mlx5_prm.h     |  8 ++++
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 74 +++++++++++++++++++++++-------
 4 files changed, 77 insertions(+), 23 deletions(-)
Signature · 1 line
2.27.0
author
#7 lore raw

PATCH v3 1/2 common/mlx5: add meter mode definition in PRM file

Add meter mode definitions in PRM file

---
 drivers/common/mlx5/mlx5_prm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/common/mlx5/mlx5_prm.h +8 -0
index c6d8060bb9..efa5ae67bf 100644
@@ -2297,6 +2297,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2671,6 +2678,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
Signature · 1 line
2.27.0
author
#8 lore raw

PATCH v3 2/2 net/mlx5: support meter PPS profile

In reply to Li Zhang

Currently meter algorithms only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697) Add packet_mode flag to support rate is packet per second. So that it can meter traffic by packet per second (PPS).

---
 doc/guides/nics/mlx5.rst           |  1 +
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 74 +++++++++++++++++++++++-------
 3 files changed, 69 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index 1e67a91ee7..3990db16b7 100644
@@ -416,6 +416,7 @@ Limitations
      - green: QUEUE, RSS, PORT_ID, JUMP, MARK and SET_TAG.
      - yellow: must be empty.
      - RED: must be DROP.
+  - meter profile packet mode is supported.
 
 Statistics
 ----------
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index 20cd4fe18c..da513a600c 100644
@@ -191,7 +191,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->sq_obj.aso_wqes[0]; i < size; ++i, ++wqe) {
@@ -204,11 +203,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -664,6 +658,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res;
@@ -704,6 +699,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.packet_mode)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +57 -17

130 lines not on this page · raw message

Signature · 1 line
2.27.0
author
#9 lore raw

v4 cover Support meter PPS(packet per second) in MLX5 PMD

In reply to Li Zhang

Currently meter algorithms only supports rate is bytes per second(BPS). Add packet_mode flag in meter profile parameters data structure. So that it can meter traffic by packet per second.

Depends-on: series=16312 ("Support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/list/?series=16312

Depends-on: series=16535 ("support meter policy operations")
https://patchwork.dpdk.org/project/dpdk/list/?series=16535

v4:
* Rebase.
V3:
* Rebase.
* Fix comments about Depends-on.
V2:
* Fix comments about commit-log

Li Zhang (2):
common/mlx5: add meter mode definition in PRM file net/mlx5: support meter PPS profile

 doc/guides/nics/mlx5.rst           |  1 +
 drivers/common/mlx5/mlx5_prm.h     |  8 ++++
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 74 +++++++++++++++++++++++-------
 4 files changed, 77 insertions(+), 23 deletions(-)
Signature · 1 line
2.27.0
author
#10 lore raw

PATCH v4 1/2 common/mlx5: add meter mode definition in PRM file

Add meter mode definitions in PRM file

---
 drivers/common/mlx5/mlx5_prm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/common/mlx5/mlx5_prm.h +8 -0
index c6d8060bb9..efa5ae67bf 100644
@@ -2297,6 +2297,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2671,6 +2678,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
Signature · 1 line
2.27.0
author
#11 lore raw

PATCH v4 2/2 net/mlx5: support meter PPS profile

In reply to Li Zhang

Currently meter algorithms only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697) Add packet_mode flag to support rate is packet per second. So that it can meter traffic by packet per second (PPS).

---
 doc/guides/nics/mlx5.rst           |  1 +
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 74 +++++++++++++++++++++++-------
 3 files changed, 69 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index b27a9a69f6..2bb4f18a08 100644
@@ -416,6 +416,7 @@ Limitations
      - green: QUEUE, RSS, PORT_ID, JUMP, MARK and SET_TAG.
      - yellow: must be empty.
      - RED: must be DROP.
+  - meter profile packet mode is supported.
 
 Statistics
 ----------
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index 20cd4fe18c..da513a600c 100644
@@ -191,7 +191,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->sq_obj.aso_wqes[0]; i < size; ++i, ++wqe) {
@@ -204,11 +203,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -664,6 +658,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res;
@@ -704,6 +699,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.packet_mode)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +57 -17

130 lines not on this page · raw message

Signature · 1 line
2.27.0
author
#12 lore raw

v5 cover Support meter PPS(packet per second) in MLX5 PMD

In reply to Li Zhang

Currently meter algorithms only supports rate is bytes per second(BPS). Add packet_mode flag in meter profile parameters data structure. So that it can meter traffic by packet per second.

Depends-on: series=16312 ("Support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/list/?series=16312

Depends-on: series=16535 ("support meter policy operations")
https://patchwork.dpdk.org/project/dpdk/list/?series=16535

V5:
* Fix comments about release-note and merge two patches. v4:
* Rebase.
V3:
* Rebase.
* Fix comments about Depends-on.
V2:
* Fix comments about commit-log

Li Zhang (1):
net/mlx5: support meter PPS profile

 doc/guides/nics/mlx5.rst               |  1 +
 doc/guides/rel_notes/release_21_05.rst |  1 +
 drivers/common/mlx5/mlx5_prm.h         |  8 +++
 drivers/net/mlx5/mlx5_flow_aso.c       | 17 +++---
 drivers/net/mlx5/mlx5_flow_meter.c     | 74 ++++++++++++++++++++------
 5 files changed, 78 insertions(+), 23 deletions(-)
Signature · 1 line
2.27.0
author
#13 lore raw

PATCH v5 1/1 net/mlx5: support meter PPS profile

Currently meter algorithms only supports bytes units for meter profiles. Using ASO feature, the driver can support metering in per packet units.

Add support for packet units in meter profiles.

---
 doc/guides/nics/mlx5.rst               |  1 +
 doc/guides/rel_notes/release_21_05.rst |  1 +
 drivers/common/mlx5/mlx5_prm.h         |  8 +++
 drivers/net/mlx5/mlx5_flow_aso.c       | 17 +++---
 drivers/net/mlx5/mlx5_flow_meter.c     | 74 ++++++++++++++++++++------
 5 files changed, 78 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index b27a9a69f6..2bb4f18a08 100644
@@ -416,6 +416,7 @@ Limitations
      - green: QUEUE, RSS, PORT_ID, JUMP, MARK and SET_TAG.
      - yellow: must be empty.
      - RED: must be DROP.
+  - meter profile packet mode is supported.
 
 Statistics
 ----------
doc/guides/rel_notes/release_21_05.rst +1 -0
index 58d70bd19f..133a0dbbf2 100644
@@ -164,6 +164,7 @@ New Features
   * Support push VLAN on ingress traffic and pop VLAN on egress traffic in E-Switch mode.
   * Added support for pre-defined meter policy API.
   * Added support for ASO (Advanced Steering Operation) meter.
+  * Added support for ASO metering by PPS (packet per second).
 
 * **Updated NXP DPAA driver.**
 
drivers/common/mlx5/mlx5_prm.h +8 -0
index c6d8060bb9..efa5ae67bf 100644
@@ -2297,6 +2297,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2671,6 +2678,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index 20cd4fe18c..da513a600c 100644
@@ -191,7 +191,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->sq_obj.aso_wqes[0]; i < size; ++i, ++wqe) {
@@ -204,11 +203,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -664,6 +658,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res;
@@ -704,6 +699,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.packet_mode)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +57 -17

130 lines not on this page · raw message

Signature · 1 line
2.27.0
#14 lore raw
In reply to Li Zhang

Hi,

Quoted 41 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Tuesday, April 27, 2021 1:42 PM
To: Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: [PATCH v5 0/1] Support meter PPS(packet per second) in MLX5 PMD

Currently meter algorithms only supports rate is bytes per second(BPS). Add packet_mode flag in meter profile parameters data structure. So that it can meter traffic by packet per second.

Depends-on: series=16312 ("Support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/list/?series=16312

Depends-on: series=16535 ("support meter policy operations")
https://patchwork.dpdk.org/project/dpdk/list/?series=16535

V5:
* Fix comments about release-note and merge two patches. v4:
* Rebase.
V3:
* Rebase.
* Fix comments about Depends-on.
V2:
* Fix comments about commit-log

Li Zhang (1):
net/mlx5: support meter PPS profile

 doc/guides/nics/mlx5.rst               |  1 +
 doc/guides/rel_notes/release_21_05.rst |  1 +
 drivers/common/mlx5/mlx5_prm.h         |  8 +++
 drivers/net/mlx5/mlx5_flow_aso.c       | 17 +++---
 drivers/net/mlx5/mlx5_flow_meter.c     | 74 ++++++++++++++++++++------
 5 files changed, 78 insertions(+), 23 deletions(-)
Quoted 2 lines

--
2.27.0

Series applied to next-net-mlx,
Raslan Darawsheh