Skip to content

Commit 9a32562

Browse files
idoschdavem330
authored andcommitted
mlxsw: Remove debugfs interface
We don't use it during development and we can't extend it either, so remove it. Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent add641e commit 9a32562

File tree

2 files changed

+0
-315
lines changed

2 files changed

+0
-315
lines changed

drivers/net/ethernet/mellanox/mlxsw/core.c

Lines changed: 0 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
#include <linux/export.h>
4141
#include <linux/err.h>
4242
#include <linux/if_link.h>
43-
#include <linux/debugfs.h>
44-
#include <linux/seq_file.h>
45-
#include <linux/u64_stats_sync.h>
4643
#include <linux/netdevice.h>
4744
#include <linux/completion.h>
4845
#include <linux/skbuff.h>
@@ -74,23 +71,9 @@ static DEFINE_SPINLOCK(mlxsw_core_driver_list_lock);
7471

7572
static const char mlxsw_core_driver_name[] = "mlxsw_core";
7673

77-
static struct dentry *mlxsw_core_dbg_root;
78-
7974
static struct workqueue_struct *mlxsw_wq;
8075
static struct workqueue_struct *mlxsw_owq;
8176

82-
struct mlxsw_core_pcpu_stats {
83-
u64 trap_rx_packets[MLXSW_TRAP_ID_MAX];
84-
u64 trap_rx_bytes[MLXSW_TRAP_ID_MAX];
85-
u64 port_rx_packets[MLXSW_PORT_MAX_PORTS];
86-
u64 port_rx_bytes[MLXSW_PORT_MAX_PORTS];
87-
struct u64_stats_sync syncp;
88-
u32 trap_rx_dropped[MLXSW_TRAP_ID_MAX];
89-
u32 port_rx_dropped[MLXSW_PORT_MAX_PORTS];
90-
u32 trap_rx_invalid;
91-
u32 port_rx_invalid;
92-
};
93-
9477
struct mlxsw_core_port {
9578
struct devlink_port devlink_port;
9679
void *port_driver_priv;
@@ -121,12 +104,6 @@ struct mlxsw_core {
121104
spinlock_t trans_list_lock; /* protects trans_list writes */
122105
bool use_emad;
123106
} emad;
124-
struct mlxsw_core_pcpu_stats __percpu *pcpu_stats;
125-
struct dentry *dbg_dir;
126-
struct {
127-
struct debugfs_blob_wrapper vsd_blob;
128-
struct debugfs_blob_wrapper psid_blob;
129-
} dbg;
130107
struct {
131108
u8 *mapping; /* lag_id+port_index to local_port mapping */
132109
} lag;
@@ -703,91 +680,6 @@ static int mlxsw_emad_reg_access(struct mlxsw_core *mlxsw_core,
703680
* Core functions
704681
*****************/
705682

706-
static int mlxsw_core_rx_stats_dbg_read(struct seq_file *file, void *data)
707-
{
708-
struct mlxsw_core *mlxsw_core = file->private;
709-
struct mlxsw_core_pcpu_stats *p;
710-
u64 rx_packets, rx_bytes;
711-
u64 tmp_rx_packets, tmp_rx_bytes;
712-
u32 rx_dropped, rx_invalid;
713-
unsigned int start;
714-
int i;
715-
int j;
716-
static const char hdr[] =
717-
" NUM RX_PACKETS RX_BYTES RX_DROPPED\n";
718-
719-
seq_printf(file, hdr);
720-
for (i = 0; i < MLXSW_TRAP_ID_MAX; i++) {
721-
rx_packets = 0;
722-
rx_bytes = 0;
723-
rx_dropped = 0;
724-
for_each_possible_cpu(j) {
725-
p = per_cpu_ptr(mlxsw_core->pcpu_stats, j);
726-
do {
727-
start = u64_stats_fetch_begin(&p->syncp);
728-
tmp_rx_packets = p->trap_rx_packets[i];
729-
tmp_rx_bytes = p->trap_rx_bytes[i];
730-
} while (u64_stats_fetch_retry(&p->syncp, start));
731-
732-
rx_packets += tmp_rx_packets;
733-
rx_bytes += tmp_rx_bytes;
734-
rx_dropped += p->trap_rx_dropped[i];
735-
}
736-
seq_printf(file, "trap %3d %12llu %12llu %10u\n",
737-
i, rx_packets, rx_bytes, rx_dropped);
738-
}
739-
rx_invalid = 0;
740-
for_each_possible_cpu(j) {
741-
p = per_cpu_ptr(mlxsw_core->pcpu_stats, j);
742-
rx_invalid += p->trap_rx_invalid;
743-
}
744-
seq_printf(file, "trap INV %10u\n",
745-
rx_invalid);
746-
747-
for (i = 0; i < MLXSW_PORT_MAX_PORTS; i++) {
748-
rx_packets = 0;
749-
rx_bytes = 0;
750-
rx_dropped = 0;
751-
for_each_possible_cpu(j) {
752-
p = per_cpu_ptr(mlxsw_core->pcpu_stats, j);
753-
do {
754-
start = u64_stats_fetch_begin(&p->syncp);
755-
tmp_rx_packets = p->port_rx_packets[i];
756-
tmp_rx_bytes = p->port_rx_bytes[i];
757-
} while (u64_stats_fetch_retry(&p->syncp, start));
758-
759-
rx_packets += tmp_rx_packets;
760-
rx_bytes += tmp_rx_bytes;
761-
rx_dropped += p->port_rx_dropped[i];
762-
}
763-
seq_printf(file, "port %3d %12llu %12llu %10u\n",
764-
i, rx_packets, rx_bytes, rx_dropped);
765-
}
766-
rx_invalid = 0;
767-
for_each_possible_cpu(j) {
768-
p = per_cpu_ptr(mlxsw_core->pcpu_stats, j);
769-
rx_invalid += p->port_rx_invalid;
770-
}
771-
seq_printf(file, "port INV %10u\n",
772-
rx_invalid);
773-
return 0;
774-
}
775-
776-
static int mlxsw_core_rx_stats_dbg_open(struct inode *inode, struct file *f)
777-
{
778-
struct mlxsw_core *mlxsw_core = inode->i_private;
779-
780-
return single_open(f, mlxsw_core_rx_stats_dbg_read, mlxsw_core);
781-
}
782-
783-
static const struct file_operations mlxsw_core_rx_stats_dbg_ops = {
784-
.owner = THIS_MODULE,
785-
.open = mlxsw_core_rx_stats_dbg_open,
786-
.release = single_release,
787-
.read = seq_read,
788-
.llseek = seq_lseek
789-
};
790-
791683
int mlxsw_core_driver_register(struct mlxsw_driver *mlxsw_driver)
792684
{
793685
spin_lock(&mlxsw_core_driver_list_lock);
@@ -835,32 +727,6 @@ static void mlxsw_core_driver_put(const char *kind)
835727
spin_unlock(&mlxsw_core_driver_list_lock);
836728
}
837729

838-
static int mlxsw_core_debugfs_init(struct mlxsw_core *mlxsw_core)
839-
{
840-
const struct mlxsw_bus_info *bus_info = mlxsw_core->bus_info;
841-
842-
mlxsw_core->dbg_dir = debugfs_create_dir(bus_info->device_name,
843-
mlxsw_core_dbg_root);
844-
if (!mlxsw_core->dbg_dir)
845-
return -ENOMEM;
846-
debugfs_create_file("rx_stats", S_IRUGO, mlxsw_core->dbg_dir,
847-
mlxsw_core, &mlxsw_core_rx_stats_dbg_ops);
848-
mlxsw_core->dbg.vsd_blob.data = (void *) &bus_info->vsd;
849-
mlxsw_core->dbg.vsd_blob.size = sizeof(bus_info->vsd);
850-
debugfs_create_blob("vsd", S_IRUGO, mlxsw_core->dbg_dir,
851-
&mlxsw_core->dbg.vsd_blob);
852-
mlxsw_core->dbg.psid_blob.data = (void *) &bus_info->psid;
853-
mlxsw_core->dbg.psid_blob.size = sizeof(bus_info->psid);
854-
debugfs_create_blob("psid", S_IRUGO, mlxsw_core->dbg_dir,
855-
&mlxsw_core->dbg.psid_blob);
856-
return 0;
857-
}
858-
859-
static void mlxsw_core_debugfs_fini(struct mlxsw_core *mlxsw_core)
860-
{
861-
debugfs_remove_recursive(mlxsw_core->dbg_dir);
862-
}
863-
864730
static int mlxsw_devlink_port_split(struct devlink *devlink,
865731
unsigned int port_index,
866732
unsigned int count)
@@ -1101,13 +967,6 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
1101967
mlxsw_core->bus_priv = bus_priv;
1102968
mlxsw_core->bus_info = mlxsw_bus_info;
1103969

1104-
mlxsw_core->pcpu_stats =
1105-
netdev_alloc_pcpu_stats(struct mlxsw_core_pcpu_stats);
1106-
if (!mlxsw_core->pcpu_stats) {
1107-
err = -ENOMEM;
1108-
goto err_alloc_stats;
1109-
}
1110-
1111970
err = mlxsw_bus->init(bus_priv, mlxsw_core, mlxsw_driver->profile,
1112971
&mlxsw_core->res);
1113972
if (err)
@@ -1148,15 +1007,8 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
11481007
goto err_driver_init;
11491008
}
11501009

1151-
err = mlxsw_core_debugfs_init(mlxsw_core);
1152-
if (err)
1153-
goto err_debugfs_init;
1154-
11551010
return 0;
11561011

1157-
err_debugfs_init:
1158-
if (mlxsw_core->driver->fini)
1159-
mlxsw_core->driver->fini(mlxsw_core);
11601012
err_driver_init:
11611013
mlxsw_thermal_fini(mlxsw_core->thermal);
11621014
err_thermal_init:
@@ -1169,8 +1021,6 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
11691021
err_alloc_lag_mapping:
11701022
mlxsw_bus->fini(bus_priv);
11711023
err_bus_init:
1172-
free_percpu(mlxsw_core->pcpu_stats);
1173-
err_alloc_stats:
11741024
devlink_free(devlink);
11751025
err_devlink_alloc:
11761026
mlxsw_core_driver_put(device_kind);
@@ -1183,15 +1033,13 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core)
11831033
const char *device_kind = mlxsw_core->bus_info->device_kind;
11841034
struct devlink *devlink = priv_to_devlink(mlxsw_core);
11851035

1186-
mlxsw_core_debugfs_fini(mlxsw_core);
11871036
if (mlxsw_core->driver->fini)
11881037
mlxsw_core->driver->fini(mlxsw_core);
11891038
mlxsw_thermal_fini(mlxsw_core->thermal);
11901039
devlink_unregister(devlink);
11911040
mlxsw_emad_fini(mlxsw_core);
11921041
kfree(mlxsw_core->lag.mapping);
11931042
mlxsw_core->bus->fini(mlxsw_core->bus_priv);
1194-
free_percpu(mlxsw_core->pcpu_stats);
11951043
devlink_free(devlink);
11961044
mlxsw_core_driver_put(device_kind);
11971045
}
@@ -1639,7 +1487,6 @@ void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
16391487
{
16401488
struct mlxsw_rx_listener_item *rxl_item;
16411489
const struct mlxsw_rx_listener *rxl;
1642-
struct mlxsw_core_pcpu_stats *pcpu_stats;
16431490
u8 local_port;
16441491
bool found = false;
16451492

@@ -1678,26 +1525,10 @@ void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
16781525
if (!found)
16791526
goto drop;
16801527

1681-
pcpu_stats = this_cpu_ptr(mlxsw_core->pcpu_stats);
1682-
u64_stats_update_begin(&pcpu_stats->syncp);
1683-
pcpu_stats->port_rx_packets[local_port]++;
1684-
pcpu_stats->port_rx_bytes[local_port] += skb->len;
1685-
pcpu_stats->trap_rx_packets[rx_info->trap_id]++;
1686-
pcpu_stats->trap_rx_bytes[rx_info->trap_id] += skb->len;
1687-
u64_stats_update_end(&pcpu_stats->syncp);
1688-
16891528
rxl->func(skb, local_port, rxl_item->priv);
16901529
return;
16911530

16921531
drop:
1693-
if (rx_info->trap_id >= MLXSW_TRAP_ID_MAX)
1694-
this_cpu_inc(mlxsw_core->pcpu_stats->trap_rx_invalid);
1695-
else
1696-
this_cpu_inc(mlxsw_core->pcpu_stats->trap_rx_dropped[rx_info->trap_id]);
1697-
if (local_port >= MLXSW_PORT_MAX_PORTS)
1698-
this_cpu_inc(mlxsw_core->pcpu_stats->port_rx_invalid);
1699-
else
1700-
this_cpu_inc(mlxsw_core->pcpu_stats->port_rx_dropped[local_port]);
17011532
dev_kfree_skb(skb);
17021533
}
17031534
EXPORT_SYMBOL(mlxsw_core_skb_receive);
@@ -1926,23 +1757,15 @@ static int __init mlxsw_core_module_init(void)
19261757
err = -ENOMEM;
19271758
goto err_alloc_ordered_workqueue;
19281759
}
1929-
mlxsw_core_dbg_root = debugfs_create_dir(mlxsw_core_driver_name, NULL);
1930-
if (!mlxsw_core_dbg_root) {
1931-
err = -ENOMEM;
1932-
goto err_debugfs_create_dir;
1933-
}
19341760
return 0;
19351761

1936-
err_debugfs_create_dir:
1937-
destroy_workqueue(mlxsw_owq);
19381762
err_alloc_ordered_workqueue:
19391763
destroy_workqueue(mlxsw_wq);
19401764
return err;
19411765
}
19421766

19431767
static void __exit mlxsw_core_module_exit(void)
19441768
{
1945-
debugfs_remove_recursive(mlxsw_core_dbg_root);
19461769
destroy_workqueue(mlxsw_owq);
19471770
destroy_workqueue(mlxsw_wq);
19481771
}

0 commit comments

Comments
 (0)