[PATCH v1 17/20] net/ntnic: extend flow dump with MBR configuration
Serhii Iliushyk
sil-plv at napatech.com
Wed Oct 1 17:09:59 CEST 2025
add dump of MBR init configuration and extend dump of MBR rules
Signed-off-by: Serhii Iliushyk <sil-plv at napatech.com>
---
.../profile_inline/flow_api_hw_db_inline.c | 36 ++++++++++++--
.../flow_api_profile_inline_config.h | 48 +++++++++++++++++++
2 files changed, 81 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c
index 17a0332a06..db40bfd368 100644
--- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c
+++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c
@@ -23,6 +23,13 @@
#define HW_DB_FT_TYPE_FLM 0
#define HW_DB_FT_TYPE_KM 1
+
+/******************************************************************************/
+/* MBR Configuration support */
+/******************************************************************************/
+static int8_t hw_db_pkt_layer_dyn[] = NTNIC_FLOW_MBR_PKT_LAYER_PER_GROUP;
+static int8_t hw_db_pkt_layer_ofs[] = NTNIC_FLOW_MBR_PKT_LAYER_OFFSET_PER_GROUP;
+
/******************************************************************************/
/* Handle */
/******************************************************************************/
@@ -533,11 +540,34 @@ void nthw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const struc
&db->flm[idxs[i].id2].ft[idxs[i].id1].data;
fprintf(file, " FLM_FT %" PRIu32 "\n", idxs[i].id1);
- if (data->is_group_zero)
+ if (data->is_group_zero) {
fprintf(file, " Jump to %d\n", data->jump);
+ } else {
+ uint32_t group_orig = 0;
- else
- fprintf(file, " Group %d\n", data->group);
+ if (nthw_flow_group_translate_get_orig_group(ndev->group_handle,
+ data->group,
+ &group_orig) < 0) {
+ fprintf(file, " Encoded group: %d\n", data->group);
+
+ } else {
+ fprintf(file, " Group %d, encoded group: %d\n",
+ group_orig, data->group);
+ }
+
+ const int dyn_group_orig =
+ group_orig >= sizeof(hw_db_pkt_layer_dyn) ?
+ hw_db_pkt_layer_dyn[0] :
+ hw_db_pkt_layer_dyn[group_orig];
+
+ const int ofs_group_orig =
+ group_orig >= sizeof(hw_db_pkt_layer_ofs) ?
+ hw_db_pkt_layer_ofs[0] :
+ hw_db_pkt_layer_ofs[group_orig];
+
+ fprintf(file, " BYT dyn %d, ofs %d\n",
+ dyn_group_orig, ofs_group_orig);
+ }
fprintf(file, " ACTION_SET id %d\n", data->action_set.ids);
break;
diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h
index c665cab16a..4be5740f1a 100644
--- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h
+++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h
@@ -93,6 +93,54 @@
*/
#define NTNIC_FLOW_PERIODIC_STATS_BYTE_TIMEOUT 23
+/*
+ * Protocol offset for packet bytes that should be used for calculations.
+ * The number of bytes (N) used for counting bytes in the FLM is determined
+ * as follows:
+ *
+ * N = FrameLength - NTNIC_FLOW_MBR_PKT_LAYER - NTNIC_FLOW_MBR_PKT_LAYER_OFFSET
+ *
+ * The frame length includes the FCS.
+ *
+ * 0: Start of frame; always zero.
+ * 1: Layer 2 header.
+ * 2: First VLAN.
+ * 3: First MPLS.
+ * 4: Layer 3 header.
+ * 5: The Identification field of IPv4 or IPv6.
+ * 6: The final IP destination address.
+ * 7: Layer 4 header.
+ * 8: Layer 4 payload.
+ * 9: Tunnel payload.
+ * 10: Tunneled layer 2 header.
+ * 11: First tunneled VLAN.
+ * 12: First tunneled MPLS.
+ * 13: Tunneled Layer 3 header.
+ * 14: The Identification field of tunneled IPv4 or IPv6.
+ * 15: The final tunneled IP destination address.
+ * 16: Tunneled layer 4 header.
+ * 17: Tunneled layer 4 payload.
+ *
+ * Default value : {0} - to count whole packet for all groups
+ * NOTE: In case that value for given `group` is not defined, then value for group 0 is used.
+ *
+ * Example: {4, 13, 13}
+ * - count size of packet starting at:
+ * - OUTER layer 3 for groups 0, 3 and above
+ * - INNER layer 3 for groups 1 and 2
+ */
+#define NTNIC_FLOW_MBR_PKT_LAYER_PER_GROUP {0}
+
+/*
+ * Offset relative to the NTNIC_FLOW_MBR_PKT_LAYER. This is an 8 bit signed value.
+ *
+ * Default value: {-20} - to account for minimum spacing of 20B between frames for all groups
+ * NOTE: In case that value for given `group` is not defined, then value for group 0 is used.
+ *
+ * Example: {0} - do not apply any offset for any group
+ */
+#define NTNIC_FLOW_MBR_PKT_LAYER_OFFSET_PER_GROUP {-20}
+
/*
* This define sets the percentage of the full processing capacity
* being reserved for scan operations. The scanner is responsible
--
2.45.0
More information about the dev
mailing list