struct npc_exact_table_entry *entry = NULL;
struct npc_exact_table *table;
bool disable_cam = false;
- u32 drop_mcam_idx;
+ u32 drop_mcam_idx = -1;
int *cnt;
+ bool rc;
table = rvu->hw->table;
/* Lookup for entry which needs to be updated */
entry = __rvu_npc_exact_find_entry_by_seq_id(rvu, seq_id);
if (!entry) {
- dev_dbg(rvu->dev, "%s: failed to find entry for id=0x%x\n", __func__, seq_id);
+ dev_dbg(rvu->dev, "%s: failed to find entry for id=%d\n", __func__, seq_id);
mutex_unlock(&table->lock);
return -ENODATA;
}
(*cnt)--;
- rvu_npc_exact_get_drop_rule_info(rvu, NIX_INTF_TYPE_CGX, entry->cgx_id, entry->lmac_id,
- &drop_mcam_idx, NULL, NULL, NULL);
+ rc = rvu_npc_exact_get_drop_rule_info(rvu, NIX_INTF_TYPE_CGX, entry->cgx_id,
+ entry->lmac_id, &drop_mcam_idx, NULL, NULL, NULL);
+ if (!rc) {
+ dev_dbg(rvu->dev, "%s: failed to retrieve drop info for id=0x%x\n",
+ __func__, seq_id);
+ mutex_unlock(&table->lock);
+ return -ENODATA;
+ }
if (entry->cmd)
__rvu_npc_exact_cmd_rules_cnt_update(rvu, drop_mcam_idx, -1, &disable_cam);
u32 drop_mcam_idx;
u32 index;
u64 mdata;
+ bool rc;
int err;
u8 ways;
return err;
}
- rvu_npc_exact_get_drop_rule_info(rvu, NIX_INTF_TYPE_CGX, cgx_id, lmac_id,
- &drop_mcam_idx, NULL, NULL, NULL);
+ rc = rvu_npc_exact_get_drop_rule_info(rvu, NIX_INTF_TYPE_CGX, cgx_id, lmac_id,
+ &drop_mcam_idx, NULL, NULL, NULL);
+ if (!rc) {
+ rvu_npc_exact_dealloc_table_entry(rvu, opc_type, ways, index);
+ dev_dbg(rvu->dev, "%s: failed to get drop rule info cgx=%d lmac=%d\n",
+ __func__, cgx_id, lmac_id);
+ return -EINVAL;
+ }
+
if (cmd)
__rvu_npc_exact_cmd_rules_cnt_update(rvu, drop_mcam_idx, 1, &enable_cam);
dev_dbg(rvu->dev,
"%s: Successfully updated entry (index=%d, dmac=%pM, ways=%d opc_type=%d\n",
- __func__, hash_index, entry->mac, entry->ways, entry->opc_type);
+ __func__, entry->index, entry->mac, entry->ways, entry->opc_type);
dev_dbg(rvu->dev, "%s: Successfully updated entry (old mac=%pM new_mac=%pM\n",
__func__, old_mac, new_mac);
u8 cgx_id, lmac_id;
u32 drop_mcam_idx;
bool *promisc;
+ bool rc;
u32 cnt;
table = rvu->hw->table;
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
- rvu_npc_exact_get_drop_rule_info(rvu, NIX_INTF_TYPE_CGX, cgx_id, lmac_id,
- &drop_mcam_idx, NULL, NULL, NULL);
+ rc = rvu_npc_exact_get_drop_rule_info(rvu, NIX_INTF_TYPE_CGX, cgx_id, lmac_id,
+ &drop_mcam_idx, NULL, NULL, NULL);
+ if (!rc) {
+ dev_dbg(rvu->dev, "%s: failed to get drop rule info cgx=%d lmac=%d\n",
+ __func__, cgx_id, lmac_id);
+ return -EINVAL;
+ }
mutex_lock(&table->lock);
promisc = &table->promisc_mode[drop_mcam_idx];
u8 cgx_id, lmac_id;
u32 drop_mcam_idx;
bool *promisc;
+ bool rc;
u32 cnt;
table = rvu->hw->table;
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
- rvu_npc_exact_get_drop_rule_info(rvu, NIX_INTF_TYPE_CGX, cgx_id, lmac_id,
- &drop_mcam_idx, NULL, NULL, NULL);
+ rc = rvu_npc_exact_get_drop_rule_info(rvu, NIX_INTF_TYPE_CGX, cgx_id, lmac_id,
+ &drop_mcam_idx, NULL, NULL, NULL);
+ if (!rc) {
+ dev_dbg(rvu->dev, "%s: failed to get drop rule info cgx=%d lmac=%d\n",
+ __func__, cgx_id, lmac_id);
+ return -EINVAL;
+ }
mutex_lock(&table->lock);
promisc = &table->promisc_mode[drop_mcam_idx];