@@ -1199,8 +1199,9 @@ static int rvu_npc_exact_del_table_entry_by_id(struct rvu *rvu, u32 seq_id)
1199
1199
struct npc_exact_table_entry * entry = NULL ;
1200
1200
struct npc_exact_table * table ;
1201
1201
bool disable_cam = false;
1202
- u32 drop_mcam_idx ;
1202
+ u32 drop_mcam_idx = -1 ;
1203
1203
int * cnt ;
1204
+ bool rc ;
1204
1205
1205
1206
table = rvu -> hw -> table ;
1206
1207
@@ -1209,7 +1210,7 @@ static int rvu_npc_exact_del_table_entry_by_id(struct rvu *rvu, u32 seq_id)
1209
1210
/* Lookup for entry which needs to be updated */
1210
1211
entry = __rvu_npc_exact_find_entry_by_seq_id (rvu , seq_id );
1211
1212
if (!entry ) {
1212
- dev_dbg (rvu -> dev , "%s: failed to find entry for id=0x%x \n" , __func__ , seq_id );
1213
+ dev_dbg (rvu -> dev , "%s: failed to find entry for id=%d \n" , __func__ , seq_id );
1213
1214
mutex_unlock (& table -> lock );
1214
1215
return - ENODATA ;
1215
1216
}
@@ -1223,8 +1224,14 @@ static int rvu_npc_exact_del_table_entry_by_id(struct rvu *rvu, u32 seq_id)
1223
1224
1224
1225
(* cnt )-- ;
1225
1226
1226
- rvu_npc_exact_get_drop_rule_info (rvu , NIX_INTF_TYPE_CGX , entry -> cgx_id , entry -> lmac_id ,
1227
- & drop_mcam_idx , NULL , NULL , NULL );
1227
+ rc = rvu_npc_exact_get_drop_rule_info (rvu , NIX_INTF_TYPE_CGX , entry -> cgx_id ,
1228
+ entry -> lmac_id , & drop_mcam_idx , NULL , NULL , NULL );
1229
+ if (!rc ) {
1230
+ dev_dbg (rvu -> dev , "%s: failed to retrieve drop info for id=0x%x\n" ,
1231
+ __func__ , seq_id );
1232
+ mutex_unlock (& table -> lock );
1233
+ return - ENODATA ;
1234
+ }
1228
1235
1229
1236
if (entry -> cmd )
1230
1237
__rvu_npc_exact_cmd_rules_cnt_update (rvu , drop_mcam_idx , -1 , & disable_cam );
@@ -1276,6 +1283,7 @@ static int rvu_npc_exact_add_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id,
1276
1283
u32 drop_mcam_idx ;
1277
1284
u32 index ;
1278
1285
u64 mdata ;
1286
+ bool rc ;
1279
1287
int err ;
1280
1288
u8 ways ;
1281
1289
@@ -1304,8 +1312,15 @@ static int rvu_npc_exact_add_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_id,
1304
1312
return err ;
1305
1313
}
1306
1314
1307
- rvu_npc_exact_get_drop_rule_info (rvu , NIX_INTF_TYPE_CGX , cgx_id , lmac_id ,
1308
- & drop_mcam_idx , NULL , NULL , NULL );
1315
+ rc = rvu_npc_exact_get_drop_rule_info (rvu , NIX_INTF_TYPE_CGX , cgx_id , lmac_id ,
1316
+ & drop_mcam_idx , NULL , NULL , NULL );
1317
+ if (!rc ) {
1318
+ rvu_npc_exact_dealloc_table_entry (rvu , opc_type , ways , index );
1319
+ dev_dbg (rvu -> dev , "%s: failed to get drop rule info cgx=%d lmac=%d\n" ,
1320
+ __func__ , cgx_id , lmac_id );
1321
+ return - EINVAL ;
1322
+ }
1323
+
1309
1324
if (cmd )
1310
1325
__rvu_npc_exact_cmd_rules_cnt_update (rvu , drop_mcam_idx , 1 , & enable_cam );
1311
1326
@@ -1388,7 +1403,7 @@ static int rvu_npc_exact_update_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_
1388
1403
1389
1404
dev_dbg (rvu -> dev ,
1390
1405
"%s: Successfully updated entry (index=%d, dmac=%pM, ways=%d opc_type=%d\n" ,
1391
- __func__ , hash_index , entry -> mac , entry -> ways , entry -> opc_type );
1406
+ __func__ , entry -> index , entry -> mac , entry -> ways , entry -> opc_type );
1392
1407
1393
1408
dev_dbg (rvu -> dev , "%s: Successfully updated entry (old mac=%pM new_mac=%pM\n" ,
1394
1409
__func__ , old_mac , new_mac );
@@ -1414,13 +1429,19 @@ int rvu_npc_exact_promisc_disable(struct rvu *rvu, u16 pcifunc)
1414
1429
u8 cgx_id , lmac_id ;
1415
1430
u32 drop_mcam_idx ;
1416
1431
bool * promisc ;
1432
+ bool rc ;
1417
1433
u32 cnt ;
1418
1434
1419
1435
table = rvu -> hw -> table ;
1420
1436
1421
1437
rvu_get_cgx_lmac_id (rvu -> pf2cgxlmac_map [pf ], & cgx_id , & lmac_id );
1422
- rvu_npc_exact_get_drop_rule_info (rvu , NIX_INTF_TYPE_CGX , cgx_id , lmac_id ,
1423
- & drop_mcam_idx , NULL , NULL , NULL );
1438
+ rc = rvu_npc_exact_get_drop_rule_info (rvu , NIX_INTF_TYPE_CGX , cgx_id , lmac_id ,
1439
+ & drop_mcam_idx , NULL , NULL , NULL );
1440
+ if (!rc ) {
1441
+ dev_dbg (rvu -> dev , "%s: failed to get drop rule info cgx=%d lmac=%d\n" ,
1442
+ __func__ , cgx_id , lmac_id );
1443
+ return - EINVAL ;
1444
+ }
1424
1445
1425
1446
mutex_lock (& table -> lock );
1426
1447
promisc = & table -> promisc_mode [drop_mcam_idx ];
@@ -1459,13 +1480,19 @@ int rvu_npc_exact_promisc_enable(struct rvu *rvu, u16 pcifunc)
1459
1480
u8 cgx_id , lmac_id ;
1460
1481
u32 drop_mcam_idx ;
1461
1482
bool * promisc ;
1483
+ bool rc ;
1462
1484
u32 cnt ;
1463
1485
1464
1486
table = rvu -> hw -> table ;
1465
1487
1466
1488
rvu_get_cgx_lmac_id (rvu -> pf2cgxlmac_map [pf ], & cgx_id , & lmac_id );
1467
- rvu_npc_exact_get_drop_rule_info (rvu , NIX_INTF_TYPE_CGX , cgx_id , lmac_id ,
1468
- & drop_mcam_idx , NULL , NULL , NULL );
1489
+ rc = rvu_npc_exact_get_drop_rule_info (rvu , NIX_INTF_TYPE_CGX , cgx_id , lmac_id ,
1490
+ & drop_mcam_idx , NULL , NULL , NULL );
1491
+ if (!rc ) {
1492
+ dev_dbg (rvu -> dev , "%s: failed to get drop rule info cgx=%d lmac=%d\n" ,
1493
+ __func__ , cgx_id , lmac_id );
1494
+ return - EINVAL ;
1495
+ }
1469
1496
1470
1497
mutex_lock (& table -> lock );
1471
1498
promisc = & table -> promisc_mode [drop_mcam_idx ];
0 commit comments