@@ -384,7 +384,8 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
384
384
NIX_INTF_RX , & entry , true);
385
385
}
386
386
387
- void rvu_npc_disable_promisc_entry (struct rvu * rvu , u16 pcifunc , int nixlf )
387
+ static void npc_enadis_promisc_entry (struct rvu * rvu , u16 pcifunc ,
388
+ int nixlf , bool enable )
388
389
{
389
390
struct npc_mcam * mcam = & rvu -> hw -> mcam ;
390
391
int blkaddr , index ;
@@ -399,7 +400,17 @@ void rvu_npc_disable_promisc_entry(struct rvu *rvu, u16 pcifunc, int nixlf)
399
400
400
401
index = npc_get_nixlf_mcam_index (mcam , pcifunc ,
401
402
nixlf , NIXLF_PROMISC_ENTRY );
402
- npc_enable_mcam_entry (rvu , mcam , blkaddr , index , false);
403
+ npc_enable_mcam_entry (rvu , mcam , blkaddr , index , enable );
404
+ }
405
+
406
+ void rvu_npc_disable_promisc_entry (struct rvu * rvu , u16 pcifunc , int nixlf )
407
+ {
408
+ npc_enadis_promisc_entry (rvu , pcifunc , nixlf , false);
409
+ }
410
+
411
+ void rvu_npc_enable_promisc_entry (struct rvu * rvu , u16 pcifunc , int nixlf )
412
+ {
413
+ npc_enadis_promisc_entry (rvu , pcifunc , nixlf , true);
403
414
}
404
415
405
416
void rvu_npc_install_bcast_match_entry (struct rvu * rvu , u16 pcifunc ,
@@ -512,11 +523,59 @@ void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
512
523
NPC_AF_MCAMEX_BANKX_ACTION (index , bank ), * (u64 * )& action );
513
524
}
514
525
515
- void rvu_npc_disable_mcam_entries (struct rvu * rvu , u16 pcifunc , int nixlf )
526
+ static void npc_enadis_default_entries (struct rvu * rvu , u16 pcifunc ,
527
+ int nixlf , bool enable )
516
528
{
517
529
struct npc_mcam * mcam = & rvu -> hw -> mcam ;
518
530
struct nix_rx_action action ;
519
- int blkaddr , index , bank ;
531
+ int index , bank , blkaddr ;
532
+
533
+ blkaddr = rvu_get_blkaddr (rvu , BLKTYPE_NPC , 0 );
534
+ if (blkaddr < 0 )
535
+ return ;
536
+
537
+ /* Ucast MCAM match entry of this PF/VF */
538
+ index = npc_get_nixlf_mcam_index (mcam , pcifunc ,
539
+ nixlf , NIXLF_UCAST_ENTRY );
540
+ npc_enable_mcam_entry (rvu , mcam , blkaddr , index , enable );
541
+
542
+ /* For PF, ena/dis promisc and bcast MCAM match entries */
543
+ if (pcifunc & RVU_PFVF_FUNC_MASK )
544
+ return ;
545
+
546
+ /* For bcast, enable/disable only if it's action is not
547
+ * packet replication, incase if action is replication
548
+ * then this PF's nixlf is removed from bcast replication
549
+ * list.
550
+ */
551
+ index = npc_get_nixlf_mcam_index (mcam , pcifunc ,
552
+ nixlf , NIXLF_BCAST_ENTRY );
553
+ bank = npc_get_bank (mcam , index );
554
+ * (u64 * )& action = rvu_read64 (rvu , blkaddr ,
555
+ NPC_AF_MCAMEX_BANKX_ACTION (index & (mcam -> banksize - 1 ), bank ));
556
+ if (action .op != NIX_RX_ACTIONOP_MCAST )
557
+ npc_enable_mcam_entry (rvu , mcam ,
558
+ blkaddr , index , enable );
559
+ if (enable )
560
+ rvu_npc_enable_promisc_entry (rvu , pcifunc , nixlf );
561
+ else
562
+ rvu_npc_disable_promisc_entry (rvu , pcifunc , nixlf );
563
+ }
564
+
565
+ void rvu_npc_disable_default_entries (struct rvu * rvu , u16 pcifunc , int nixlf )
566
+ {
567
+ npc_enadis_default_entries (rvu , pcifunc , nixlf , false);
568
+ }
569
+
570
+ void rvu_npc_enable_default_entries (struct rvu * rvu , u16 pcifunc , int nixlf )
571
+ {
572
+ npc_enadis_default_entries (rvu , pcifunc , nixlf , true);
573
+ }
574
+
575
+ void rvu_npc_disable_mcam_entries (struct rvu * rvu , u16 pcifunc , int nixlf )
576
+ {
577
+ struct npc_mcam * mcam = & rvu -> hw -> mcam ;
578
+ int blkaddr ;
520
579
521
580
blkaddr = rvu_get_blkaddr (rvu , BLKTYPE_NPC , 0 );
522
581
if (blkaddr < 0 )
@@ -532,29 +591,7 @@ void rvu_npc_disable_mcam_entries(struct rvu *rvu, u16 pcifunc, int nixlf)
532
591
533
592
mutex_unlock (& mcam -> lock );
534
593
535
- /* Disable ucast MCAM match entry of this PF/VF */
536
- index = npc_get_nixlf_mcam_index (mcam , pcifunc ,
537
- nixlf , NIXLF_UCAST_ENTRY );
538
- npc_enable_mcam_entry (rvu , mcam , blkaddr , index , false);
539
-
540
- /* For PF, disable promisc and bcast MCAM match entries */
541
- if (!(pcifunc & RVU_PFVF_FUNC_MASK )) {
542
- index = npc_get_nixlf_mcam_index (mcam , pcifunc ,
543
- nixlf , NIXLF_BCAST_ENTRY );
544
- /* For bcast, disable only if it's action is not
545
- * packet replication, incase if action is replication
546
- * then this PF's nixlf is removed from bcast replication
547
- * list.
548
- */
549
- bank = npc_get_bank (mcam , index );
550
- index &= (mcam -> banksize - 1 );
551
- * (u64 * )& action = rvu_read64 (rvu , blkaddr ,
552
- NPC_AF_MCAMEX_BANKX_ACTION (index , bank ));
553
- if (action .op != NIX_RX_ACTIONOP_MCAST )
554
- npc_enable_mcam_entry (rvu , mcam , blkaddr , index , false);
555
-
556
- rvu_npc_disable_promisc_entry (rvu , pcifunc , nixlf );
557
- }
594
+ rvu_npc_disable_default_entries (rvu , pcifunc , nixlf );
558
595
}
559
596
560
597
#define SET_KEX_LD (intf , lid , ltype , ld , cfg ) \
0 commit comments