octeontx2-af: FLR handler for exact match table.
authorRatheesh Kannoth <rkannoth@marvell.com>
Wed, 6 Jul 2022 03:44:35 +0000 (09:14 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Jul 2022 07:16:47 +0000 (08:16 +0100)
FLR handler should remove/free all exact match table resources
corresponding to each interface.

Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/rvu.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h

index 1b6e9efbb8ec6c8794e20b25d5ed156263e78225..88b9856a7b39e982f8f1a1c929b9ec0445e2d3f8 100644 (file)
@@ -2555,6 +2555,9 @@ static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr)
 
 static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)
 {
+       if (rvu_npc_exact_has_match_table(rvu))
+               rvu_npc_exact_reset(rvu, pcifunc);
+
        mutex_lock(&rvu->flr_lock);
        /* Reset order should reflect inter-block dependencies:
         * 1. Reset any packet/work sources (NIX, CPT, TIM)
index ef790a54743af869d46a8f682243c81cc0bc0147..25125e91a0164d2857bffb514eacc6f5773ea198 100644 (file)
@@ -1170,6 +1170,33 @@ void rvu_npc_exact_disable_feature(struct rvu *rvu)
        rvu->hw->cap.npc_exact_match_enabled = false;
 }
 
+/**
+ *     rvu_npc_exact_reset - Delete and free all entry which match pcifunc.
+ *      @rvu: resource virtualization unit.
+ *     @pcifunc: PCI func to match.
+ */
+void rvu_npc_exact_reset(struct rvu *rvu, u16 pcifunc)
+{
+       struct npc_exact_table *table = rvu->hw->table;
+       struct npc_exact_table_entry *tmp, *iter;
+       u32 seq_id;
+
+       mutex_lock(&table->lock);
+       list_for_each_entry_safe(iter, tmp, &table->lhead_gbl, glist) {
+               if (pcifunc != iter->pcifunc)
+                       continue;
+
+               seq_id = iter->seq_id;
+               dev_dbg(rvu->dev, "%s: resetting pcifun=%d seq_id=%u\n", __func__,
+                       pcifunc, seq_id);
+
+               mutex_unlock(&table->lock);
+               rvu_npc_exact_del_table_entry_by_id(rvu, seq_id);
+               mutex_lock(&table->lock);
+       }
+       mutex_unlock(&table->lock);
+}
+
 /**
  *      rvu_npc_exact_init - initialize exact match table
  *      @rvu: resource virtualization unit.
index 7adb5c5c508209785349b30739dcc3526cfe6133..0a4aeddbadcad1bfa96adf891da76ca247e82a65 100644 (file)
@@ -187,5 +187,6 @@ int rvu_npc_exact_init(struct rvu *rvu);
 
 bool rvu_npc_exact_can_disable_feature(struct rvu *rvu);
 void rvu_npc_exact_disable_feature(struct rvu *rvu);
+void rvu_npc_exact_reset(struct rvu *rvu, u16 pcifunc);
 
 #endif /* RVU_NPC_HASH_H */