+ struct bnxt_ulp_mark_tbl *mtbl;
+ uint32_t idx = 0;
+ bool is_gfid;
+
+ if (!ctxt) {
+ BNXT_TF_DBG(ERR, "Invalid ulp context\n");
+ return -EINVAL;
+ }
+
+ mtbl = bnxt_ulp_cntxt_ptr2_mark_db_get(ctxt);
+ if (!mtbl) {
+ BNXT_TF_DBG(ERR, "Unable to get Mark DB\n");
+ return -EINVAL;
+ }
+
+ is_gfid = (mark_flag & BNXT_ULP_MARK_GLOBAL_HW_FID);
+ if (is_gfid) {
+ idx = ulp_mark_db_idx_get(is_gfid, fid, mtbl);
+ if (idx >= mtbl->gfid_num_entries) {
+ BNXT_TF_DBG(ERR, "Mark index greater than allocated\n");
+ return -EINVAL;
+ }
+ BNXT_TF_DBG(DEBUG, "Set GFID[0x%0x] = 0x%0x\n", idx, mark);
+ mtbl->gfid_tbl[idx].mark_id = mark;
+ ULP_MARK_DB_ENTRY_SET_VALID(&mtbl->gfid_tbl[idx]);
+
+ } else {
+ /* For the LFID, the FID is used as the index */
+ if (fid >= mtbl->lfid_num_entries) {
+ 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;