/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2020 Broadcom
+ * Copyright(c) 2014-2021 Broadcom
* All rights reserved.
*/
BNXT_ULP_MARK_VALID)
#define ULP_MARK_DB_ENTRY_IS_INVALID(mark_info) (!((mark_info)->flags &\
BNXT_ULP_MARK_VALID))
+#define ULP_MARK_DB_ENTRY_SET_VFR_ID(mark_info) ((mark_info)->flags |=\
+ BNXT_ULP_MARK_VFR_ID)
#define ULP_MARK_DB_ENTRY_IS_VFR_ID(mark_info) ((mark_info)->flags &\
BNXT_ULP_MARK_VFR_ID)
#define ULP_MARK_DB_ENTRY_IS_GLOBAL_HW_FID(mark_info) ((mark_info)->flags &\
goto mem_error;
/* Need to allocate 2 * Num flows to account for hash type bit.*/
- mark_tbl->lfid_num_entries = dparms->lfid_entries;
+ mark_tbl->lfid_num_entries = dparms->mark_db_lfid_entries;
mark_tbl->lfid_tbl = rte_zmalloc("ulp_rx_em_flow_mark_table",
mark_tbl->lfid_num_entries *
sizeof(struct bnxt_lfid_mark_info),
goto mem_error;
/* Need to allocate 2 * Num flows to account for hash type bit */
- mark_tbl->gfid_num_entries = dparms->gfid_entries;
+ mark_tbl->gfid_num_entries = dparms->mark_db_gfid_entries;
+ if (!mark_tbl->gfid_num_entries)
+ goto gfid_not_required;
+
mark_tbl->gfid_tbl = rte_zmalloc("ulp_rx_eem_flow_mark_table",
mark_tbl->gfid_num_entries *
sizeof(struct bnxt_gfid_mark_info),
mark_tbl->gfid_num_entries - 1,
mark_tbl->gfid_mask);
+gfid_not_required:
/* Add the mark tbl to the ulp context. */
bnxt_ulp_cntxt_ptr2_mark_db_set(ctxt, mark_tbl);
return 0;
mem_error:
- rte_free(mark_tbl->gfid_tbl);
- rte_free(mark_tbl->lfid_tbl);
- rte_free(mark_tbl);
+ if (mark_tbl) {
+ rte_free(mark_tbl->gfid_tbl);
+ rte_free(mark_tbl->lfid_tbl);
+ rte_free(mark_tbl);
+ }
BNXT_TF_DBG(DEBUG, "Failed to allocate memory for mark mgr\n");
return -ENOMEM;
}
ULP_MARK_DB_ENTRY_IS_INVALID(&mtbl->gfid_tbl[idx]))
return -EINVAL;
- BNXT_TF_DBG(DEBUG, "Get GFID[0x%0x] = 0x%0x\n",
- idx, mtbl->gfid_tbl[idx].mark_id);
-
*vfr_flag = ULP_MARK_DB_ENTRY_IS_VFR_ID(&mtbl->gfid_tbl[idx]);
*mark = mtbl->gfid_tbl[idx].mark_id;
} else {
ULP_MARK_DB_ENTRY_IS_INVALID(&mtbl->lfid_tbl[idx]))
return -EINVAL;
- BNXT_TF_DBG(DEBUG, "Get LFID[0x%0x] = 0x%0x\n",
- idx, mtbl->lfid_tbl[idx].mark_id);
-
*vfr_flag = ULP_MARK_DB_ENTRY_IS_VFR_ID(&mtbl->lfid_tbl[idx]);
*mark = mtbl->lfid_tbl[idx].mark_id;
}
BNXT_TF_DBG(ERR, "Mark index greater than allocated\n");
return -EINVAL;
}
+ BNXT_TF_DBG(DEBUG, "Set LFID[0x%0x] = 0x%0x\n", fid, mark);
mtbl->lfid_tbl[fid].mark_id = mark;
ULP_MARK_DB_ENTRY_SET_VALID(&mtbl->lfid_tbl[fid]);
+
+ if (mark_flag & BNXT_ULP_MARK_VFR_ID)
+ ULP_MARK_DB_ENTRY_SET_VFR_ID(&mtbl->lfid_tbl[fid]);
}
return 0;