netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: ti: cpsw_ale: optimize cpsw_ale_restore()
@ 2022-11-08 13:56 Roger Quadros
  2022-11-10  3:19 ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2022-11-08 13:56 UTC (permalink / raw)
  To: davem
  Cc: edumazet, kuba, pabeni, vigneshr, srk, linux-omap, netdev,
	linux-kernel, Roger Quadros

If an entry was FREE then we don't have to restore it.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
---

Patch depends on
https://lore.kernel.org/netdev/20221104132310.31577-3-rogerq@kernel.org/T/

 drivers/net/ethernet/ti/cpsw_ale.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 0c5e783e574c..41bcf34a22f8 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -1452,12 +1452,15 @@ void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
 	}
 }
 
+/* ALE table should be cleared (ALE_CLEAR) before cpsw_ale_restore() */
 void cpsw_ale_restore(struct cpsw_ale *ale, u32 *data)
 {
-	int i;
+	int i, type;
 
 	for (i = 0; i < ale->params.ale_entries; i++) {
-		cpsw_ale_write(ale, i, data);
+		type = cpsw_ale_get_entry_type(data);
+		if (type != ALE_TYPE_FREE)
+			cpsw_ale_write(ale, i, data);
 		data += ALE_ENTRY_WORDS;
 	}
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-11 13:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 13:56 [PATCH] net: ethernet: ti: cpsw_ale: optimize cpsw_ale_restore() Roger Quadros
2022-11-10  3:19 ` Jakub Kicinski
2022-11-10  9:39   ` Roger Quadros
2022-11-10 20:32     ` Jakub Kicinski
2022-11-11 10:25       ` Roger Quadros
2022-11-11 12:03       ` Vladimir Oltean
2022-11-11 13:35         ` Roger Quadros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).