@@ -367,6 +367,18 @@ int hw_mod_cat_cfn_flush(struct flow_api_backend_s *be, int start_idx, int count
int hw_mod_cat_cfn_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index, int word_off,
uint32_t value);
/* KCE/KCS/FTE KM */
+int hw_mod_cat_kce_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+ int start_idx, int count);
+int hw_mod_cat_kce_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_kce_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t *value);
+int hw_mod_cat_kcs_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+ int start_idx, int count);
+int hw_mod_cat_kcs_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_kcs_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t *value);
int hw_mod_cat_fte_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
int start_idx, int count);
int hw_mod_cat_fte_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
@@ -374,6 +386,18 @@ int hw_mod_cat_fte_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
int hw_mod_cat_fte_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
enum km_flm_if_select_e if_num, int index, uint32_t *value);
/* KCE/KCS/FTE FLM */
+int hw_mod_cat_kce_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+ int start_idx, int count);
+int hw_mod_cat_kce_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_kce_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t *value);
+int hw_mod_cat_kcs_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+ int start_idx, int count);
+int hw_mod_cat_kcs_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_kcs_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t *value);
int hw_mod_cat_fte_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
int start_idx, int count);
int hw_mod_cat_fte_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
@@ -384,10 +408,14 @@ int hw_mod_cat_fte_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
int hw_mod_cat_cte_flush(struct flow_api_backend_s *be, int start_idx, int count);
int hw_mod_cat_cte_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
uint32_t value);
+int hw_mod_cat_cte_get(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+ uint32_t *value);
int hw_mod_cat_cts_flush(struct flow_api_backend_s *be, int start_idx, int count);
int hw_mod_cat_cts_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
uint32_t value);
+int hw_mod_cat_cts_get(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+ uint32_t *value);
int hw_mod_cat_cot_flush(struct flow_api_backend_s *be, int start_idx, int count);
int hw_mod_cat_cot_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
@@ -638,7 +666,21 @@ int hw_mod_flm_reset(struct flow_api_backend_s *be);
int hw_mod_flm_control_flush(struct flow_api_backend_s *be);
int hw_mod_flm_control_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value);
+int hw_mod_flm_status_update(struct flow_api_backend_s *be);
+int hw_mod_flm_status_get(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t *value);
+
int hw_mod_flm_scan_flush(struct flow_api_backend_s *be);
+int hw_mod_flm_scan_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value);
+
+int hw_mod_flm_load_bin_flush(struct flow_api_backend_s *be);
+int hw_mod_flm_load_bin_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value);
+
+int hw_mod_flm_prio_flush(struct flow_api_backend_s *be);
+int hw_mod_flm_prio_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value);
+
+int hw_mod_flm_pst_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_flm_pst_set(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
+ uint32_t value);
int hw_mod_flm_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
@@ -902,6 +902,95 @@ static int hw_mod_cat_kce_flush(struct flow_api_backend_s *be, enum km_flm_if_se
return be->iface->cat_kce_flush(be->be_dev, &be->cat, km_if_idx, start_idx, count);
}
+int hw_mod_cat_kce_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+ int start_idx, int count)
+{
+ return hw_mod_cat_kce_flush(be, if_num, 0, start_idx, count);
+}
+
+int hw_mod_cat_kce_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+ int start_idx, int count)
+{
+ return hw_mod_cat_kce_flush(be, if_num, 1, start_idx, count);
+}
+
+static int hw_mod_cat_kce_mod(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int km_if_id, int index,
+ uint32_t *value, int get)
+{
+ if ((unsigned int)index >= (be->cat.nb_cat_funcs / 8)) {
+ INDEX_TOO_LARGE_LOG;
+ return INDEX_TOO_LARGE;
+ }
+
+ /* find KM module */
+ int km_if_idx = find_km_flm_module_interface_index(be, if_num, km_if_id);
+
+ if (km_if_idx < 0)
+ return km_if_idx;
+
+ switch (_VER_) {
+ case 18:
+ switch (field) {
+ case HW_CAT_KCE_ENABLE_BM:
+ GET_SET(be->cat.v18.kce[index].enable_bm, value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ /* end case 18 */
+ case 21:
+ switch (field) {
+ case HW_CAT_KCE_ENABLE_BM:
+ GET_SET(be->cat.v21.kce[index].enable_bm[km_if_idx], value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ /* end case 21 */
+
+ default:
+ UNSUP_VER_LOG;
+ return UNSUP_VER;
+ }
+
+ return 0;
+}
+
+int hw_mod_cat_kce_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t value)
+{
+ return hw_mod_cat_kce_mod(be, field, if_num, 0, index, &value, 0);
+}
+
+int hw_mod_cat_kce_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t *value)
+{
+ return hw_mod_cat_kce_mod(be, field, if_num, 0, index, value, 1);
+}
+
+int hw_mod_cat_kce_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t value)
+{
+ return hw_mod_cat_kce_mod(be, field, if_num, 1, index, &value, 0);
+}
+
+int hw_mod_cat_kce_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t *value)
+{
+ return hw_mod_cat_kce_mod(be, field, if_num, 1, index, value, 1);
+}
+
/*
* KCS
*/
@@ -925,6 +1014,95 @@ static int hw_mod_cat_kcs_flush(struct flow_api_backend_s *be, enum km_flm_if_se
return be->iface->cat_kcs_flush(be->be_dev, &be->cat, km_if_idx, start_idx, count);
}
+int hw_mod_cat_kcs_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+ int start_idx, int count)
+{
+ return hw_mod_cat_kcs_flush(be, if_num, 0, start_idx, count);
+}
+
+int hw_mod_cat_kcs_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+ int start_idx, int count)
+{
+ return hw_mod_cat_kcs_flush(be, if_num, 1, start_idx, count);
+}
+
+static int hw_mod_cat_kcs_mod(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int km_if_id, int index,
+ uint32_t *value, int get)
+{
+ if ((unsigned int)index >= be->cat.nb_cat_funcs) {
+ INDEX_TOO_LARGE_LOG;
+ return INDEX_TOO_LARGE;
+ }
+
+ /* find KM module */
+ int km_if_idx = find_km_flm_module_interface_index(be, if_num, km_if_id);
+
+ if (km_if_idx < 0)
+ return km_if_idx;
+
+ switch (_VER_) {
+ case 18:
+ switch (field) {
+ case HW_CAT_KCS_CATEGORY:
+ GET_SET(be->cat.v18.kcs[index].category, value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ /* end case 18 */
+ case 21:
+ switch (field) {
+ case HW_CAT_KCS_CATEGORY:
+ GET_SET(be->cat.v21.kcs[index].category[km_if_idx], value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ /* end case 21 */
+
+ default:
+ UNSUP_VER_LOG;
+ return UNSUP_VER;
+ }
+
+ return 0;
+}
+
+int hw_mod_cat_kcs_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t value)
+{
+ return hw_mod_cat_kcs_mod(be, field, if_num, 0, index, &value, 0);
+}
+
+int hw_mod_cat_kcs_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t *value)
+{
+ return hw_mod_cat_kcs_mod(be, field, if_num, 0, index, value, 1);
+}
+
+int hw_mod_cat_kcs_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t value)
+{
+ return hw_mod_cat_kcs_mod(be, field, if_num, 1, index, &value, 0);
+}
+
+int hw_mod_cat_kcs_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+ enum km_flm_if_select_e if_num, int index, uint32_t *value)
+{
+ return hw_mod_cat_kcs_mod(be, field, if_num, 1, index, value, 1);
+}
+
/*
* FTE
*/
@@ -1094,6 +1272,12 @@ int hw_mod_cat_cte_set(struct flow_api_backend_s *be, enum hw_cat_e field, int i
return hw_mod_cat_cte_mod(be, field, index, &value, 0);
}
+int hw_mod_cat_cte_get(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+ uint32_t *value)
+{
+ return hw_mod_cat_cte_mod(be, field, index, value, 1);
+}
+
int hw_mod_cat_cts_flush(struct flow_api_backend_s *be, int start_idx, int count)
{
int addr_size = (_VER_ < 15) ? 8 : ((be->cat.cts_num + 1) / 2);
@@ -1154,6 +1338,12 @@ int hw_mod_cat_cts_set(struct flow_api_backend_s *be, enum hw_cat_e field, int i
return hw_mod_cat_cts_mod(be, field, index, &value, 0);
}
+int hw_mod_cat_cts_get(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+ uint32_t *value)
+{
+ return hw_mod_cat_cts_mod(be, field, index, value, 1);
+}
+
int hw_mod_cat_cot_flush(struct flow_api_backend_s *be, int start_idx, int count)
{
if (count == ALL_ENTRIES)
@@ -293,11 +293,268 @@ int hw_mod_flm_control_set(struct flow_api_backend_s *be, enum hw_flm_e field, u
return hw_mod_flm_control_mod(be, field, &value, 0);
}
+int hw_mod_flm_status_update(struct flow_api_backend_s *be)
+{
+ return be->iface->flm_status_update(be->be_dev, &be->flm);
+}
+
+static int hw_mod_flm_status_mod(struct flow_api_backend_s *be, enum hw_flm_e field,
+ uint32_t *value, int get)
+{
+ switch (_VER_) {
+ case 25:
+ switch (field) {
+ case HW_FLM_STATUS_CALIB_SUCCESS:
+ GET_SET(be->flm.v25.status->calib_success, value);
+ break;
+
+ case HW_FLM_STATUS_CALIB_FAIL:
+ GET_SET(be->flm.v25.status->calib_fail, value);
+ break;
+
+ case HW_FLM_STATUS_INITDONE:
+ GET_SET(be->flm.v25.status->initdone, value);
+ break;
+
+ case HW_FLM_STATUS_IDLE:
+ GET_SET(be->flm.v25.status->idle, value);
+ break;
+
+ case HW_FLM_STATUS_CRITICAL:
+ GET_SET(be->flm.v25.status->critical, value);
+ break;
+
+ case HW_FLM_STATUS_PANIC:
+ GET_SET(be->flm.v25.status->panic, value);
+ break;
+
+ case HW_FLM_STATUS_CRCERR:
+ GET_SET(be->flm.v25.status->crcerr, value);
+ break;
+
+ case HW_FLM_STATUS_EFT_BP:
+ GET_SET(be->flm.v25.status->eft_bp, value);
+ break;
+
+ case HW_FLM_STATUS_CACHE_BUFFER_CRITICAL:
+ GET_SET(be->flm.v25.status->cache_buf_critical, value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ default:
+ UNSUP_VER_LOG;
+ return UNSUP_VER;
+ }
+
+ return 0;
+}
+
+int hw_mod_flm_status_get(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t *value)
+{
+ return hw_mod_flm_status_mod(be, field, value, 1);
+}
+
int hw_mod_flm_scan_flush(struct flow_api_backend_s *be)
{
return be->iface->flm_scan_flush(be->be_dev, &be->flm);
}
+static int hw_mod_flm_scan_mod(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t *value,
+ int get)
+{
+ switch (_VER_) {
+ case 25:
+ switch (field) {
+ case HW_FLM_SCAN_I:
+ GET_SET(be->flm.v25.scan->i, value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ default:
+ UNSUP_VER_LOG;
+ return UNSUP_VER;
+ }
+
+ return 0;
+}
+
+int hw_mod_flm_scan_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value)
+{
+ return hw_mod_flm_scan_mod(be, field, &value, 0);
+}
+
+int hw_mod_flm_load_bin_flush(struct flow_api_backend_s *be)
+{
+ return be->iface->flm_load_bin_flush(be->be_dev, &be->flm);
+}
+
+static int hw_mod_flm_load_bin_mod(struct flow_api_backend_s *be, enum hw_flm_e field,
+ uint32_t *value, int get)
+{
+ switch (_VER_) {
+ case 25:
+ switch (field) {
+ case HW_FLM_LOAD_BIN:
+ GET_SET(be->flm.v25.load_bin->bin, value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ default:
+ UNSUP_VER_LOG;
+ return UNSUP_VER;
+ }
+
+ return 0;
+}
+
+int hw_mod_flm_load_bin_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value)
+{
+ return hw_mod_flm_load_bin_mod(be, field, &value, 0);
+}
+
+int hw_mod_flm_prio_flush(struct flow_api_backend_s *be)
+{
+ return be->iface->flm_prio_flush(be->be_dev, &be->flm);
+}
+
+static int hw_mod_flm_prio_mod(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t *value,
+ int get)
+{
+ switch (_VER_) {
+ case 25:
+ switch (field) {
+ case HW_FLM_PRIO_LIMIT0:
+ GET_SET(be->flm.v25.prio->limit0, value);
+ break;
+
+ case HW_FLM_PRIO_FT0:
+ GET_SET(be->flm.v25.prio->ft0, value);
+ break;
+
+ case HW_FLM_PRIO_LIMIT1:
+ GET_SET(be->flm.v25.prio->limit1, value);
+ break;
+
+ case HW_FLM_PRIO_FT1:
+ GET_SET(be->flm.v25.prio->ft1, value);
+ break;
+
+ case HW_FLM_PRIO_LIMIT2:
+ GET_SET(be->flm.v25.prio->limit2, value);
+ break;
+
+ case HW_FLM_PRIO_FT2:
+ GET_SET(be->flm.v25.prio->ft2, value);
+ break;
+
+ case HW_FLM_PRIO_LIMIT3:
+ GET_SET(be->flm.v25.prio->limit3, value);
+ break;
+
+ case HW_FLM_PRIO_FT3:
+ GET_SET(be->flm.v25.prio->ft3, value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ default:
+ UNSUP_VER_LOG;
+ return UNSUP_VER;
+ }
+
+ return 0;
+}
+
+int hw_mod_flm_prio_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value)
+{
+ return hw_mod_flm_prio_mod(be, field, &value, 0);
+}
+
+int hw_mod_flm_pst_flush(struct flow_api_backend_s *be, int start_idx, int count)
+{
+ if (count == ALL_ENTRIES)
+ count = be->flm.nb_pst_profiles;
+
+ if ((unsigned int)(start_idx + count) > be->flm.nb_pst_profiles) {
+ INDEX_TOO_LARGE_LOG;
+ return INDEX_TOO_LARGE;
+ }
+
+ return be->iface->flm_pst_flush(be->be_dev, &be->flm, start_idx, count);
+}
+
+static int hw_mod_flm_pst_mod(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
+ uint32_t *value, int get)
+{
+ switch (_VER_) {
+ case 25:
+ switch (field) {
+ case HW_FLM_PST_PRESET_ALL:
+ if (get) {
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ memset(&be->flm.v25.pst[index], (uint8_t)*value,
+ sizeof(struct flm_v25_pst_s));
+ break;
+
+ case HW_FLM_PST_BP:
+ GET_SET(be->flm.v25.pst[index].bp, value);
+ break;
+
+ case HW_FLM_PST_PP:
+ GET_SET(be->flm.v25.pst[index].pp, value);
+ break;
+
+ case HW_FLM_PST_TP:
+ GET_SET(be->flm.v25.pst[index].tp, value);
+ break;
+
+ default:
+ UNSUP_FIELD_LOG;
+ return UNSUP_FIELD;
+ }
+
+ break;
+
+ default:
+ UNSUP_VER_LOG;
+ return UNSUP_VER;
+ }
+
+ return 0;
+}
+
+int hw_mod_flm_pst_set(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
+ uint32_t value)
+{
+ return hw_mod_flm_pst_mod(be, field, index, &value, 0);
+}
+
int hw_mod_flm_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count)
{
if (count == ALL_ENTRIES)
@@ -9,6 +9,14 @@
#include "flow_api_hw_db_inline.h"
#include "rte_common.h"
+#define HW_DB_FT_LOOKUP_KEY_A 0
+
+#define HW_DB_FT_TYPE_KM 1
+#define HW_DB_FT_LOOKUP_KEY_A 0
+#define HW_DB_FT_LOOKUP_KEY_C 2
+
+#define HW_DB_FT_TYPE_FLM 0
+#define HW_DB_FT_TYPE_KM 1
/******************************************************************************/
/* Handle */
/******************************************************************************/
@@ -59,6 +67,23 @@ struct hw_db_inline_resource_db {
int ref;
} *cat;
+ struct hw_db_inline_resource_db_flm_rcp {
+ struct hw_db_inline_resource_db_flm_ft {
+ struct hw_db_inline_flm_ft_data data;
+ struct hw_db_flm_ft idx;
+ int ref;
+ } *ft;
+
+ struct hw_db_inline_resource_db_flm_match_set {
+ struct hw_db_match_set_idx idx;
+ int ref;
+ } *match_set;
+
+ struct hw_db_inline_resource_db_flm_cfn_map {
+ int cfn_idx;
+ } *cfn_map;
+ } *flm;
+
struct hw_db_inline_resource_db_km_rcp {
struct hw_db_inline_km_rcp_data data;
int ref;
@@ -70,6 +95,7 @@ struct hw_db_inline_resource_db {
} *km;
uint32_t nb_cat;
+ uint32_t nb_flm_ft;
uint32_t nb_km_ft;
uint32_t nb_km_rcp;
@@ -173,6 +199,13 @@ int hw_db_inline_create(struct flow_nic_dev *ndev, void **db_handle)
}
*db_handle = db;
+
+ /* Preset data */
+
+ db->flm[0].ft[1].idx.type = HW_DB_IDX_TYPE_FLM_FT;
+ db->flm[0].ft[1].idx.id1 = 1;
+ db->flm[0].ft[1].ref = 1;
+
return 0;
}
@@ -235,6 +268,11 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct
*(struct hw_db_tpe_ext_idx *)&idxs[i]);
break;
+ case HW_DB_IDX_TYPE_FLM_FT:
+ hw_db_inline_flm_ft_deref(ndev, db_handle,
+ *(struct hw_db_flm_ft *)&idxs[i]);
+ break;
+
case HW_DB_IDX_TYPE_KM_RCP:
hw_db_inline_km_deref(ndev, db_handle, *(struct hw_db_km_idx *)&idxs[i]);
break;
@@ -286,6 +324,9 @@ const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle,
case HW_DB_IDX_TYPE_TPE_EXT:
return &db->tpe_ext[idxs[i].ids].data;
+ case HW_DB_IDX_TYPE_FLM_FT:
+ return NULL; /* FTs can't be easily looked up */
+
case HW_DB_IDX_TYPE_KM_RCP:
return &db->km[idxs[i].id1].data;
@@ -307,6 +348,61 @@ const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle,
/* Filter */
/******************************************************************************/
+/*
+ * lookup refers to key A/B/C/D, and can have values 0, 1, 2, and 3.
+ */
+static void hw_db_set_ft(struct flow_nic_dev *ndev, int type, int cfn_index, int lookup,
+ int flow_type, int enable)
+{
+ (void)type;
+ (void)enable;
+
+ const int max_lookups = 4;
+ const int cat_funcs = (int)ndev->be.cat.nb_cat_funcs / 8;
+
+ int fte_index = (8 * flow_type + cfn_index / cat_funcs) * max_lookups + lookup;
+ int fte_field = cfn_index % cat_funcs;
+
+ uint32_t current_bm = 0;
+ uint32_t fte_field_bm = 1 << fte_field;
+
+ switch (type) {
+ case HW_DB_FT_TYPE_FLM:
+ hw_mod_cat_fte_flm_get(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST, fte_index,
+ ¤t_bm);
+ break;
+
+ case HW_DB_FT_TYPE_KM:
+ hw_mod_cat_fte_km_get(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST, fte_index,
+ ¤t_bm);
+ break;
+
+ default:
+ break;
+ }
+
+ uint32_t final_bm = enable ? (fte_field_bm | current_bm) : (~fte_field_bm & current_bm);
+
+ if (current_bm != final_bm) {
+ switch (type) {
+ case HW_DB_FT_TYPE_FLM:
+ hw_mod_cat_fte_flm_set(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST,
+ fte_index, final_bm);
+ hw_mod_cat_fte_flm_flush(&ndev->be, KM_FLM_IF_FIRST, fte_index, 1);
+ break;
+
+ case HW_DB_FT_TYPE_KM:
+ hw_mod_cat_fte_km_set(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST,
+ fte_index, final_bm);
+ hw_mod_cat_fte_km_flush(&ndev->be, KM_FLM_IF_FIRST, fte_index, 1);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
/*
* Setup a filter to match:
* All packets in CFN checks
@@ -348,6 +444,17 @@ int hw_db_inline_setup_mbr_filter(struct flow_nic_dev *ndev, uint32_t cat_hw_id,
if (hw_mod_cat_cte_flush(&ndev->be, cat_hw_id, 1))
return -1;
+ /* KM: Match all FTs for look-up A */
+ for (int i = 0; i < 16; ++i)
+ hw_db_set_ft(ndev, HW_DB_FT_TYPE_KM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_A, i, 1);
+
+ /* FLM: Match all FTs for look-up A */
+ for (int i = 0; i < 16; ++i)
+ hw_db_set_ft(ndev, HW_DB_FT_TYPE_FLM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_A, i, 1);
+
+ /* FLM: Match FT=ft_argument for look-up C */
+ hw_db_set_ft(ndev, HW_DB_FT_TYPE_FLM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_C, ft, 1);
+
/* Make all CFN checks TRUE */
if (hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_SET_ALL_DEFAULTS, cat_hw_id, 0, 0))
return -1;
@@ -1252,6 +1359,133 @@ void hw_db_inline_km_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struct
km_rcp->ft[cat_offset + idx.id1].ref = 0;
}
}
+/******************************************************************************/
+/* FLM FT */
+/******************************************************************************/
+
+static int hw_db_inline_flm_ft_compare(const struct hw_db_inline_flm_ft_data *data1,
+ const struct hw_db_inline_flm_ft_data *data2)
+{
+ return data1->is_group_zero == data2->is_group_zero && data1->jump == data2->jump &&
+ data1->action_set.raw == data2->action_set.raw;
+}
+
+struct hw_db_flm_ft hw_db_inline_flm_ft_default(struct flow_nic_dev *ndev, void *db_handle,
+ const struct hw_db_inline_flm_ft_data *data)
+{
+ struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+ struct hw_db_inline_resource_db_flm_rcp *flm_rcp = &db->flm[data->jump];
+ struct hw_db_flm_ft idx = { .raw = 0 };
+
+ idx.type = HW_DB_IDX_TYPE_FLM_FT;
+ idx.id1 = 0;
+ idx.id2 = data->group & 0xff;
+
+ if (data->is_group_zero) {
+ idx.error = 1;
+ return idx;
+ }
+
+ if (flm_rcp->ft[idx.id1].ref > 0) {
+ if (!hw_db_inline_flm_ft_compare(data, &flm_rcp->ft[idx.id1].data)) {
+ idx.error = 1;
+ return idx;
+ }
+
+ hw_db_inline_flm_ft_ref(ndev, db, idx);
+ return idx;
+ }
+
+ memcpy(&flm_rcp->ft[idx.id1].data, data, sizeof(struct hw_db_inline_flm_ft_data));
+ flm_rcp->ft[idx.id1].idx.raw = idx.raw;
+ flm_rcp->ft[idx.id1].ref = 1;
+
+ return idx;
+}
+
+struct hw_db_flm_ft hw_db_inline_flm_ft_add(struct flow_nic_dev *ndev, void *db_handle,
+ const struct hw_db_inline_flm_ft_data *data)
+{
+ struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+ struct hw_db_inline_resource_db_flm_rcp *flm_rcp = &db->flm[data->group];
+ struct hw_db_flm_ft idx = { .raw = 0 };
+ int found = 0;
+
+ idx.type = HW_DB_IDX_TYPE_FLM_FT;
+ idx.id1 = 0;
+ idx.id2 = data->group & 0xff;
+
+ /* RCP 0 always uses FT 1; i.e. use unhandled FT for disabled RCP */
+ if (data->group == 0) {
+ idx.id1 = 1;
+ return idx;
+ }
+
+ if (data->is_group_zero) {
+ idx.id3 = 1;
+ return idx;
+ }
+
+ /* FLM_FT records 0, 1 and last (15) are reserved */
+ /* NOTE: RES_FLM_FLOW_TYPE resource is global and it cannot be used in _add() and _deref()
+ * to track usage of FLM_FT recipes which are group specific.
+ */
+ for (uint32_t i = 2; i < db->nb_flm_ft; ++i) {
+ if (!found && flm_rcp->ft[i].ref <= 0 &&
+ !flow_nic_is_resource_used(ndev, RES_FLM_FLOW_TYPE, i)) {
+ found = 1;
+ idx.id1 = i;
+ }
+
+ if (flm_rcp->ft[i].ref > 0 &&
+ hw_db_inline_flm_ft_compare(data, &flm_rcp->ft[i].data)) {
+ idx.id1 = i;
+ hw_db_inline_flm_ft_ref(ndev, db, idx);
+ return idx;
+ }
+ }
+
+ if (!found) {
+ idx.error = 1;
+ return idx;
+ }
+
+ memcpy(&flm_rcp->ft[idx.id1].data, data, sizeof(struct hw_db_inline_flm_ft_data));
+ flm_rcp->ft[idx.id1].idx.raw = idx.raw;
+ flm_rcp->ft[idx.id1].ref = 1;
+
+ return idx;
+}
+
+void hw_db_inline_flm_ft_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_flm_ft idx)
+{
+ (void)ndev;
+ struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+
+ if (!idx.error && idx.id3 == 0)
+ db->flm[idx.id2].ft[idx.id1].ref += 1;
+}
+
+void hw_db_inline_flm_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_flm_ft idx)
+{
+ (void)ndev;
+ (void)db_handle;
+ struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+ struct hw_db_inline_resource_db_flm_rcp *flm_rcp;
+
+ if (idx.error || idx.id2 == 0 || idx.id3 > 0)
+ return;
+
+ flm_rcp = &db->flm[idx.id2];
+
+ flm_rcp->ft[idx.id1].ref -= 1;
+
+ if (flm_rcp->ft[idx.id1].ref > 0)
+ return;
+
+ flm_rcp->ft[idx.id1].ref = 0;
+ memset(&flm_rcp->ft[idx.id1], 0x0, sizeof(struct hw_db_inline_resource_db_flm_ft));
+}
/******************************************************************************/
/* HSH */
@@ -32,6 +32,10 @@ struct hw_db_idx {
HW_DB_IDX;
};
+struct hw_db_match_set_idx {
+ HW_DB_IDX;
+};
+
struct hw_db_action_set_idx {
HW_DB_IDX;
};
@@ -106,6 +110,13 @@ struct hw_db_tpe_ext_idx {
HW_DB_IDX;
};
+struct hw_db_flm_idx {
+ HW_DB_IDX;
+};
+struct hw_db_flm_ft {
+ HW_DB_IDX;
+};
+
struct hw_db_km_idx {
HW_DB_IDX;
};
@@ -128,6 +139,7 @@ enum hw_db_idx_type {
HW_DB_IDX_TYPE_TPE_EXT,
HW_DB_IDX_TYPE_KM_RCP,
+ HW_DB_IDX_TYPE_FLM_FT,
HW_DB_IDX_TYPE_KM_FT,
HW_DB_IDX_TYPE_HSH,
};
@@ -211,6 +223,17 @@ struct hw_db_inline_km_ft_data {
struct hw_db_action_set_idx action_set;
};
+struct hw_db_inline_flm_ft_data {
+ /* Group zero flows should set jump. */
+ /* Group nonzero flows should set group. */
+ int is_group_zero;
+ union {
+ int jump;
+ int group;
+ };
+ struct hw_db_action_set_idx action_set;
+};
+
/**/
int hw_db_inline_create(struct flow_nic_dev *ndev, void **db_handle);
@@ -277,6 +300,16 @@ void hw_db_inline_km_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struct
/**/
+void hw_db_inline_flm_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_flm_idx idx);
+
+struct hw_db_flm_ft hw_db_inline_flm_ft_default(struct flow_nic_dev *ndev, void *db_handle,
+ const struct hw_db_inline_flm_ft_data *data);
+struct hw_db_flm_ft hw_db_inline_flm_ft_add(struct flow_nic_dev *ndev, void *db_handle,
+ const struct hw_db_inline_flm_ft_data *data);
+void hw_db_inline_flm_ft_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_flm_ft idx);
+void hw_db_inline_flm_ft_deref(struct flow_nic_dev *ndev, void *db_handle,
+ struct hw_db_flm_ft idx);
+
int hw_db_inline_setup_mbr_filter(struct flow_nic_dev *ndev, uint32_t cat_hw_id, uint32_t ft,
uint32_t qsl_hw_id);
@@ -11,6 +11,7 @@
#include "flow_api.h"
#include "flow_api_engine.h"
#include "flow_api_hw_db_inline.h"
+#include "flow_api_profile_inline_config.h"
#include "flow_id_table.h"
#include "stream_binary_flow_api.h"
@@ -47,6 +48,128 @@ static int rx_queue_idx_to_hw_id(const struct flow_eth_dev *dev, int id)
return -1;
}
+/*
+ * Flow Matcher functionality
+ */
+
+static int flm_sdram_calibrate(struct flow_nic_dev *ndev)
+{
+ int success = 0;
+ uint32_t fail_value = 0;
+ uint32_t value = 0;
+
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_PRESET_ALL, 0x0);
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_SPLIT_SDRAM_USAGE, 0x10);
+ hw_mod_flm_control_flush(&ndev->be);
+
+ /* Wait for ddr4 calibration/init done */
+ for (uint32_t i = 0; i < 1000000; ++i) {
+ hw_mod_flm_status_update(&ndev->be);
+ hw_mod_flm_status_get(&ndev->be, HW_FLM_STATUS_CALIB_SUCCESS, &value);
+ hw_mod_flm_status_get(&ndev->be, HW_FLM_STATUS_CALIB_FAIL, &fail_value);
+
+ if (value & 0x80000000) {
+ success = 1;
+ break;
+ }
+
+ if (fail_value != 0)
+ break;
+
+ nt_os_wait_usec(1);
+ }
+
+ if (!success) {
+ NT_LOG(ERR, FILTER, "FLM initialization failed - SDRAM calibration failed");
+ NT_LOG(ERR, FILTER,
+ "Calibration status: success 0x%08" PRIx32 " - fail 0x%08" PRIx32,
+ value, fail_value);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int flm_sdram_reset(struct flow_nic_dev *ndev, int enable)
+{
+ int success = 0;
+
+ /*
+ * Make sure no lookup is performed during init, i.e.
+ * disable every category and disable FLM
+ */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_ENABLE, 0x0);
+ hw_mod_flm_control_flush(&ndev->be);
+
+ /* Wait for FLM to enter Idle state */
+ for (uint32_t i = 0; i < 1000000; ++i) {
+ uint32_t value = 0;
+ hw_mod_flm_status_update(&ndev->be);
+ hw_mod_flm_status_get(&ndev->be, HW_FLM_STATUS_IDLE, &value);
+
+ if (value) {
+ success = 1;
+ break;
+ }
+
+ nt_os_wait_usec(1);
+ }
+
+ if (!success) {
+ NT_LOG(ERR, FILTER, "FLM initialization failed - Never idle");
+ return -1;
+ }
+
+ success = 0;
+
+ /* Start SDRAM initialization */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_INIT, 0x1);
+ hw_mod_flm_control_flush(&ndev->be);
+
+ for (uint32_t i = 0; i < 1000000; ++i) {
+ uint32_t value = 0;
+ hw_mod_flm_status_update(&ndev->be);
+ hw_mod_flm_status_get(&ndev->be, HW_FLM_STATUS_INITDONE, &value);
+
+ if (value) {
+ success = 1;
+ break;
+ }
+
+ nt_os_wait_usec(1);
+ }
+
+ if (!success) {
+ NT_LOG(ERR, FILTER,
+ "FLM initialization failed - SDRAM initialization incomplete");
+ return -1;
+ }
+
+ /* Set the INIT value back to zero to clear the bit in the SW register cache */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_INIT, 0x0);
+ hw_mod_flm_control_flush(&ndev->be);
+
+ /* Enable FLM */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_ENABLE, enable);
+ hw_mod_flm_control_flush(&ndev->be);
+
+ int nb_rpp_per_ps = ndev->be.flm.nb_rpp_clock_in_ps;
+ int nb_load_aps_max = ndev->be.flm.nb_load_aps_max;
+ uint32_t scan_i_value = 0;
+
+ if (NTNIC_SCANNER_LOAD > 0) {
+ scan_i_value = (1 / (nb_rpp_per_ps * 0.000000000001)) /
+ (nb_load_aps_max * NTNIC_SCANNER_LOAD);
+ }
+
+ hw_mod_flm_scan_set(&ndev->be, HW_FLM_SCAN_I, scan_i_value);
+ hw_mod_flm_scan_flush(&ndev->be);
+
+ return 0;
+}
+
+
+
struct flm_flow_key_def_s {
union {
struct {
@@ -2354,11 +2477,11 @@ static int setup_flow_flm_actions(struct flow_eth_dev *dev,
const struct nic_flow_def *fd,
const struct hw_db_inline_qsl_data *qsl_data,
const struct hw_db_inline_hsh_data *hsh_data,
- uint32_t group __rte_unused,
+ uint32_t group,
uint32_t local_idxs[],
uint32_t *local_idx_counter,
- uint16_t *flm_rpl_ext_ptr __rte_unused,
- uint32_t *flm_ft __rte_unused,
+ uint16_t *flm_rpl_ext_ptr,
+ uint32_t *flm_ft,
uint32_t *flm_scrub __rte_unused,
struct rte_flow_error *error)
{
@@ -2507,6 +2630,25 @@ static int setup_flow_flm_actions(struct flow_eth_dev *dev,
return -1;
}
+ /* Setup FLM FT */
+ struct hw_db_inline_flm_ft_data flm_ft_data = {
+ .is_group_zero = 0,
+ .group = group,
+ };
+ struct hw_db_flm_ft flm_ft_idx = empty_pattern
+ ? hw_db_inline_flm_ft_default(dev->ndev, dev->ndev->hw_db_handle, &flm_ft_data)
+ : hw_db_inline_flm_ft_add(dev->ndev, dev->ndev->hw_db_handle, &flm_ft_data);
+ local_idxs[(*local_idx_counter)++] = flm_ft_idx.raw;
+
+ if (flm_ft_idx.error) {
+ NT_LOG(ERR, FILTER, "Could not reference FLM FT resource");
+ flow_nic_set_error(ERR_MATCH_RESOURCE_EXHAUSTION, error);
+ return -1;
+ }
+
+ if (flm_ft)
+ *flm_ft = flm_ft_idx.id1;
+
return 0;
}
@@ -2514,7 +2656,7 @@ static struct flow_handle *create_flow_filter(struct flow_eth_dev *dev, struct n
const struct rte_flow_attr *attr,
uint16_t forced_vlan_vid __rte_unused, uint16_t caller_id,
struct rte_flow_error *error, uint32_t port_id,
- uint32_t num_dest_port __rte_unused, uint32_t num_queues __rte_unused,
+ uint32_t num_dest_port, uint32_t num_queues,
uint32_t *packet_data, uint32_t *packet_mask __rte_unused,
struct flm_flow_key_def_s *key_def __rte_unused)
{
@@ -2808,6 +2950,21 @@ static struct flow_handle *create_flow_filter(struct flow_eth_dev *dev, struct n
km_write_data_match_entry(&fd->km, 0);
}
+ /* Setup FLM FT */
+ struct hw_db_inline_flm_ft_data flm_ft_data = {
+ .is_group_zero = 1,
+ .jump = fd->jump_to_group != UINT32_MAX ? fd->jump_to_group : 0,
+ };
+ struct hw_db_flm_ft flm_ft_idx =
+ hw_db_inline_flm_ft_add(dev->ndev, dev->ndev->hw_db_handle, &flm_ft_data);
+ fh->db_idxs[fh->db_idx_counter++] = flm_ft_idx.raw;
+
+ if (flm_ft_idx.error) {
+ NT_LOG(ERR, FILTER, "Could not reference FLM FT resource");
+ flow_nic_set_error(ERR_MATCH_RESOURCE_EXHAUSTION, error);
+ goto error_out;
+ }
+
nic_insert_flow(dev->ndev, fh);
}
@@ -3024,6 +3181,63 @@ int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)
NT_VIOLATING_MBR_QSL) < 0)
goto err_exit0;
+ /* FLM */
+ if (flm_sdram_calibrate(ndev) < 0)
+ goto err_exit0;
+
+ if (flm_sdram_reset(ndev, 1) < 0)
+ goto err_exit0;
+
+ /* Learn done status */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_LDS, 0);
+ /* Learn fail status */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_LFS, 1);
+ /* Learn ignore status */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_LIS, 1);
+ /* Unlearn done status */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_UDS, 0);
+ /* Unlearn ignore status */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_UIS, 0);
+ /* Relearn done status */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_RDS, 0);
+ /* Relearn ignore status */
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_RIS, 0);
+ hw_mod_flm_control_set(&ndev->be, HW_FLM_CONTROL_RBL, 4);
+ hw_mod_flm_control_flush(&ndev->be);
+
+ /* Set the sliding windows size for flm load */
+ uint32_t bin = (uint32_t)(((FLM_LOAD_WINDOWS_SIZE * 1000000000000ULL) /
+ (32ULL * ndev->be.flm.nb_rpp_clock_in_ps)) -
+ 1ULL);
+ hw_mod_flm_load_bin_set(&ndev->be, HW_FLM_LOAD_BIN, bin);
+ hw_mod_flm_load_bin_flush(&ndev->be);
+
+ hw_mod_flm_prio_set(&ndev->be, HW_FLM_PRIO_LIMIT0,
+ 0); /* Drop at 100% FIFO fill level */
+ hw_mod_flm_prio_set(&ndev->be, HW_FLM_PRIO_FT0, 1);
+ hw_mod_flm_prio_set(&ndev->be, HW_FLM_PRIO_LIMIT1,
+ 14); /* Drop at 87,5% FIFO fill level */
+ hw_mod_flm_prio_set(&ndev->be, HW_FLM_PRIO_FT1, 1);
+ hw_mod_flm_prio_set(&ndev->be, HW_FLM_PRIO_LIMIT2,
+ 10); /* Drop at 62,5% FIFO fill level */
+ hw_mod_flm_prio_set(&ndev->be, HW_FLM_PRIO_FT2, 1);
+ hw_mod_flm_prio_set(&ndev->be, HW_FLM_PRIO_LIMIT3,
+ 6); /* Drop at 37,5% FIFO fill level */
+ hw_mod_flm_prio_set(&ndev->be, HW_FLM_PRIO_FT3, 1);
+ hw_mod_flm_prio_flush(&ndev->be);
+
+ /* TODO How to set and use these limits */
+ for (uint32_t i = 0; i < ndev->be.flm.nb_pst_profiles; ++i) {
+ hw_mod_flm_pst_set(&ndev->be, HW_FLM_PST_BP, i,
+ NTNIC_FLOW_PERIODIC_STATS_BYTE_LIMIT);
+ hw_mod_flm_pst_set(&ndev->be, HW_FLM_PST_PP, i,
+ NTNIC_FLOW_PERIODIC_STATS_PKT_LIMIT);
+ hw_mod_flm_pst_set(&ndev->be, HW_FLM_PST_TP, i,
+ NTNIC_FLOW_PERIODIC_STATS_BYTE_TIMEOUT);
+ }
+
+ hw_mod_flm_pst_flush(&ndev->be, 0, ALL_ENTRIES);
+
ndev->id_table_handle = ntnic_id_table_create();
if (ndev->id_table_handle == NULL)
@@ -3052,6 +3266,8 @@ int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)
#endif
if (ndev->flow_mgnt_prepared) {
+ flm_sdram_reset(ndev, 0);
+
flow_nic_free_resource(ndev, RES_KM_FLOW_TYPE, 0);
flow_nic_free_resource(ndev, RES_KM_CATEGORY, 0);
new file mode 100644
@@ -0,0 +1,58 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_API_PROFILE_INLINE_CONFIG_H_
+#define _FLOW_API_PROFILE_INLINE_CONFIG_H_
+
+/*
+ * Statistics are generated each time the byte counter crosses a limit.
+ * If BYTE_LIMIT is zero then the byte counter does not trigger statistics
+ * generation.
+ *
+ * Format: 2^(BYTE_LIMIT + 15) bytes
+ * Valid range: 0 to 31
+ *
+ * Example: 2^(8 + 15) = 2^23 ~~ 8MB
+ */
+#define NTNIC_FLOW_PERIODIC_STATS_BYTE_LIMIT 8
+
+/*
+ * Statistics are generated each time the packet counter crosses a limit.
+ * If PKT_LIMIT is zero then the packet counter does not trigger statistics
+ * generation.
+ *
+ * Format: 2^(PKT_LIMIT + 11) pkts
+ * Valid range: 0 to 31
+ *
+ * Example: 2^(5 + 11) = 2^16 pkts ~~ 64K pkts
+ */
+#define NTNIC_FLOW_PERIODIC_STATS_PKT_LIMIT 5
+
+/*
+ * Statistics are generated each time flow time (measured in ns) crosses a
+ * limit.
+ * If BYTE_TIMEOUT is zero then the flow time does not trigger statistics
+ * generation.
+ *
+ * Format: 2^(BYTE_TIMEOUT + 15) ns
+ * Valid range: 0 to 31
+ *
+ * Example: 2^(23 + 15) = 2^38 ns ~~ 275 sec
+ */
+#define NTNIC_FLOW_PERIODIC_STATS_BYTE_TIMEOUT 23
+
+/*
+ * This define sets the percentage of the full processing capacity
+ * being reserved for scan operations. The scanner is responsible
+ * for detecting aged out flows and meters with statistics timeout.
+ *
+ * A high scanner load percentage will make this detection more precise
+ * but will also give lower packet processing capacity.
+ *
+ * The percentage is given as a decimal number, e.g. 0.01 for 1%, which is the recommended value.
+ */
+#define NTNIC_SCANNER_LOAD 0.01
+
+#endif /* _FLOW_API_PROFILE_INLINE_CONFIG_H_ */
@@ -16,6 +16,14 @@
#define ARRAY_SIZE(arr) RTE_DIM(arr)
#endif
+/*
+ * Windows size in seconds for measuring FLM load
+ * and Port load.
+ * The windows size must max be 3 min in order to
+ * prevent overflow.
+ */
+#define FLM_LOAD_WINDOWS_SIZE 2ULL
+
#define PCIIDENT_TO_DOMAIN(pci_ident) ((uint16_t)(((unsigned int)(pci_ident) >> 16) & 0xFFFFU))
#define PCIIDENT_TO_BUSNR(pci_ident) ((uint8_t)(((unsigned int)(pci_ident) >> 8) & 0xFFU))
#define PCIIDENT_TO_DEVNR(pci_ident) ((uint8_t)(((unsigned int)(pci_ident) >> 3) & 0x1FU))