[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc28d967fbffd53f61a1d42332ee7bc64435df7c.1702314695.git.ecree.xilinx@gmail.com>
Date: Mon, 11 Dec 2023 17:18:31 +0000
From: <edward.cree@....com>
To: <linux-net-drivers@....com>, <davem@...emloft.net>, <kuba@...nel.org>,
<pabeni@...hat.com>, <edumazet@...gle.com>
CC: Edward Cree <ecree.xilinx@...il.com>, <netdev@...r.kernel.org>,
<habetsm.xilinx@...il.com>, Jonathan Cooper <jonathan.s.cooper@....com>
Subject: [PATCH net-next 6/7] sfc: add debugfs entries for filter table status
From: Edward Cree <ecree.xilinx@...il.com>
Filter table management is complicated by the possibility of overflow
kicking us into a promiscuous fallback for either unicast or multicast.
Expose the internal flags that drive this.
Since the table state (efx->filter_state) has a separate, shorter
lifetime than struct efx_nic, put its debugfs nodes in a subdirectory
(efx->filter_state->debug_dir) so that they can be cleaned up easily
before the filter_state is freed.
Reviewed-by: Jonathan Cooper <jonathan.s.cooper@....com>
Signed-off-by: Edward Cree <ecree.xilinx@...il.com>
---
drivers/net/ethernet/sfc/debugfs.h | 4 ++++
drivers/net/ethernet/sfc/mcdi_filters.c | 18 ++++++++++++++++++
drivers/net/ethernet/sfc/mcdi_filters.h | 4 ++++
3 files changed, 26 insertions(+)
diff --git a/drivers/net/ethernet/sfc/debugfs.h b/drivers/net/ethernet/sfc/debugfs.h
index 3e8d2e2b5bad..7a96f3798cbd 100644
--- a/drivers/net/ethernet/sfc/debugfs.h
+++ b/drivers/net/ethernet/sfc/debugfs.h
@@ -39,6 +39,10 @@
* index. (This may differ from both the kernel core TX queue index and
* the hardware queue label of the TXQ.)
* The directory will contain a symlink to the owning channel.
+ *
+ * * "filters/" (&efx_mcdi_filter_table.debug_dir).
+ * This contains parameter files for the NIC receive filter table
+ * (@efx->filter_state).
*/
void efx_fini_debugfs_netdev(struct net_device *net_dev);
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c
index 4ff6586116ee..a4ab45082c8f 100644
--- a/drivers/net/ethernet/sfc/mcdi_filters.c
+++ b/drivers/net/ethernet/sfc/mcdi_filters.c
@@ -1348,6 +1348,20 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining)
INIT_LIST_HEAD(&table->vlan_list);
init_rwsem(&table->lock);
+#ifdef CONFIG_DEBUG_FS
+ table->debug_dir = debugfs_create_dir("filters", efx->debug_dir);
+ debugfs_create_bool("uc_promisc", 0444, table->debug_dir,
+ &table->uc_promisc);
+ debugfs_create_bool("mc_promisc", 0444, table->debug_dir,
+ &table->mc_promisc);
+ debugfs_create_bool("mc_promisc_last", 0444, table->debug_dir,
+ &table->mc_promisc_last);
+ debugfs_create_bool("mc_overflow", 0444, table->debug_dir,
+ &table->mc_overflow);
+ debugfs_create_bool("mc_chaining", 0444, table->debug_dir,
+ &table->mc_chaining);
+#endif
+
efx->filter_state = table;
return 0;
@@ -1518,6 +1532,10 @@ void efx_mcdi_filter_table_remove(struct efx_nic *efx)
return;
vfree(table->entry);
+#ifdef CONFIG_DEBUG_FS
+ /* Remove debugfs entries pointing into @table */
+ debugfs_remove_recursive(table->debug_dir);
+#endif
kfree(table);
}
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.h b/drivers/net/ethernet/sfc/mcdi_filters.h
index c0d6558b9fd2..897843ade3ec 100644
--- a/drivers/net/ethernet/sfc/mcdi_filters.h
+++ b/drivers/net/ethernet/sfc/mcdi_filters.h
@@ -91,6 +91,10 @@ struct efx_mcdi_filter_table {
bool vlan_filter;
/* Entries on the vlan_list are added/removed under filter_sem */
struct list_head vlan_list;
+#ifdef CONFIG_DEBUG_FS
+ /* filter table debugfs directory */
+ struct dentry *debug_dir;
+#endif
};
int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining);
Powered by blists - more mailing lists