|
@@ -44,8 +44,6 @@
|
|
|
#include <linux/skbuff.h>
|
|
|
#include <linux/if_vlan.h>
|
|
|
#include <linux/log2.h>
|
|
|
-#include <linux/debugfs.h>
|
|
|
-#include <linux/seq_file.h>
|
|
|
#include <linux/string.h>
|
|
|
|
|
|
#include "pci_hw.h"
|
|
@@ -57,8 +55,6 @@
|
|
|
|
|
|
static const char mlxsw_pci_driver_name[] = "mlxsw_pci";
|
|
|
|
|
|
-static struct dentry *mlxsw_pci_dbg_root;
|
|
|
-
|
|
|
#define mlxsw_pci_write32(mlxsw_pci, reg, val) \
|
|
|
iowrite32be(val, (mlxsw_pci)->hw_addr + (MLXSW_PCI_ ## reg))
|
|
|
#define mlxsw_pci_read32(mlxsw_pci, reg) \
|
|
@@ -71,21 +67,6 @@ enum mlxsw_pci_queue_type {
|
|
|
MLXSW_PCI_QUEUE_TYPE_EQ,
|
|
|
};
|
|
|
|
|
|
-static const char *mlxsw_pci_queue_type_str(enum mlxsw_pci_queue_type q_type)
|
|
|
-{
|
|
|
- switch (q_type) {
|
|
|
- case MLXSW_PCI_QUEUE_TYPE_SDQ:
|
|
|
- return "sdq";
|
|
|
- case MLXSW_PCI_QUEUE_TYPE_RDQ:
|
|
|
- return "rdq";
|
|
|
- case MLXSW_PCI_QUEUE_TYPE_CQ:
|
|
|
- return "cq";
|
|
|
- case MLXSW_PCI_QUEUE_TYPE_EQ:
|
|
|
- return "eq";
|
|
|
- }
|
|
|
- BUG();
|
|
|
-}
|
|
|
-
|
|
|
#define MLXSW_PCI_QUEUE_TYPE_COUNT 4
|
|
|
|
|
|
static const u16 mlxsw_pci_doorbell_type_offset[] = {
|
|
@@ -174,7 +155,6 @@ struct mlxsw_pci {
|
|
|
} comp;
|
|
|
} cmd;
|
|
|
struct mlxsw_bus_info bus_info;
|
|
|
- struct dentry *dbg_dir;
|
|
|
};
|
|
|
|
|
|
static void mlxsw_pci_queue_tasklet_schedule(struct mlxsw_pci_queue *q)
|
|
@@ -261,21 +241,11 @@ static u8 mlxsw_pci_sdq_count(struct mlxsw_pci *mlxsw_pci)
|
|
|
return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_SDQ);
|
|
|
}
|
|
|
|
|
|
-static u8 mlxsw_pci_rdq_count(struct mlxsw_pci *mlxsw_pci)
|
|
|
-{
|
|
|
- return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_RDQ);
|
|
|
-}
|
|
|
-
|
|
|
static u8 mlxsw_pci_cq_count(struct mlxsw_pci *mlxsw_pci)
|
|
|
{
|
|
|
return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_CQ);
|
|
|
}
|
|
|
|
|
|
-static u8 mlxsw_pci_eq_count(struct mlxsw_pci *mlxsw_pci)
|
|
|
-{
|
|
|
- return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_EQ);
|
|
|
-}
|
|
|
-
|
|
|
static struct mlxsw_pci_queue *
|
|
|
__mlxsw_pci_queue_get(struct mlxsw_pci *mlxsw_pci,
|
|
|
enum mlxsw_pci_queue_type q_type, u8 q_num)
|
|
@@ -390,26 +360,6 @@ static void mlxsw_pci_sdq_fini(struct mlxsw_pci *mlxsw_pci,
|
|
|
mlxsw_cmd_hw2sw_sdq(mlxsw_pci->core, q->num);
|
|
|
}
|
|
|
|
|
|
-static int mlxsw_pci_sdq_dbg_read(struct seq_file *file, void *data)
|
|
|
-{
|
|
|
- struct mlxsw_pci *mlxsw_pci = dev_get_drvdata(file->private);
|
|
|
- struct mlxsw_pci_queue *q;
|
|
|
- int i;
|
|
|
- static const char hdr[] =
|
|
|
- "NUM PROD_COUNT CONS_COUNT COUNT\n";
|
|
|
-
|
|
|
- seq_printf(file, hdr);
|
|
|
- for (i = 0; i < mlxsw_pci_sdq_count(mlxsw_pci); i++) {
|
|
|
- q = mlxsw_pci_sdq_get(mlxsw_pci, i);
|
|
|
- spin_lock_bh(&q->lock);
|
|
|
- seq_printf(file, "%3d %10d %10d %5d\n",
|
|
|
- i, q->producer_counter, q->consumer_counter,
|
|
|
- q->count);
|
|
|
- spin_unlock_bh(&q->lock);
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static int mlxsw_pci_wqe_frag_map(struct mlxsw_pci *mlxsw_pci, char *wqe,
|
|
|
int index, char *frag_data, size_t frag_len,
|
|
|
int direction)
|
|
@@ -544,26 +494,6 @@ static void mlxsw_pci_rdq_fini(struct mlxsw_pci *mlxsw_pci,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static int mlxsw_pci_rdq_dbg_read(struct seq_file *file, void *data)
|
|
|
-{
|
|
|
- struct mlxsw_pci *mlxsw_pci = dev_get_drvdata(file->private);
|
|
|
- struct mlxsw_pci_queue *q;
|
|
|
- int i;
|
|
|
- static const char hdr[] =
|
|
|
- "NUM PROD_COUNT CONS_COUNT COUNT\n";
|
|
|
-
|
|
|
- seq_printf(file, hdr);
|
|
|
- for (i = 0; i < mlxsw_pci_rdq_count(mlxsw_pci); i++) {
|
|
|
- q = mlxsw_pci_rdq_get(mlxsw_pci, i);
|
|
|
- spin_lock_bh(&q->lock);
|
|
|
- seq_printf(file, "%3d %10d %10d %5d\n",
|
|
|
- i, q->producer_counter, q->consumer_counter,
|
|
|
- q->count);
|
|
|
- spin_unlock_bh(&q->lock);
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static int mlxsw_pci_cq_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
|
|
|
struct mlxsw_pci_queue *q)
|
|
|
{
|
|
@@ -601,27 +531,6 @@ static void mlxsw_pci_cq_fini(struct mlxsw_pci *mlxsw_pci,
|
|
|
mlxsw_cmd_hw2sw_cq(mlxsw_pci->core, q->num);
|
|
|
}
|
|
|
|
|
|
-static int mlxsw_pci_cq_dbg_read(struct seq_file *file, void *data)
|
|
|
-{
|
|
|
- struct mlxsw_pci *mlxsw_pci = dev_get_drvdata(file->private);
|
|
|
-
|
|
|
- struct mlxsw_pci_queue *q;
|
|
|
- int i;
|
|
|
- static const char hdr[] =
|
|
|
- "NUM CONS_INDEX SDQ_COUNT RDQ_COUNT COUNT\n";
|
|
|
-
|
|
|
- seq_printf(file, hdr);
|
|
|
- for (i = 0; i < mlxsw_pci_cq_count(mlxsw_pci); i++) {
|
|
|
- q = mlxsw_pci_cq_get(mlxsw_pci, i);
|
|
|
- spin_lock_bh(&q->lock);
|
|
|
- seq_printf(file, "%3d %10d %10d %10d %5d\n",
|
|
|
- i, q->consumer_counter, q->u.cq.comp_sdq_count,
|
|
|
- q->u.cq.comp_rdq_count, q->count);
|
|
|
- spin_unlock_bh(&q->lock);
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static void mlxsw_pci_cqe_sdq_handle(struct mlxsw_pci *mlxsw_pci,
|
|
|
struct mlxsw_pci_queue *q,
|
|
|
u16 consumer_counter_limit,
|
|
@@ -775,27 +684,6 @@ static void mlxsw_pci_eq_fini(struct mlxsw_pci *mlxsw_pci,
|
|
|
mlxsw_cmd_hw2sw_eq(mlxsw_pci->core, q->num);
|
|
|
}
|
|
|
|
|
|
-static int mlxsw_pci_eq_dbg_read(struct seq_file *file, void *data)
|
|
|
-{
|
|
|
- struct mlxsw_pci *mlxsw_pci = dev_get_drvdata(file->private);
|
|
|
- struct mlxsw_pci_queue *q;
|
|
|
- int i;
|
|
|
- static const char hdr[] =
|
|
|
- "NUM CONS_COUNT EV_CMD EV_COMP EV_OTHER COUNT\n";
|
|
|
-
|
|
|
- seq_printf(file, hdr);
|
|
|
- for (i = 0; i < mlxsw_pci_eq_count(mlxsw_pci); i++) {
|
|
|
- q = mlxsw_pci_eq_get(mlxsw_pci, i);
|
|
|
- spin_lock_bh(&q->lock);
|
|
|
- seq_printf(file, "%3d %10d %10d %10d %10d %5d\n",
|
|
|
- i, q->consumer_counter, q->u.eq.ev_cmd_count,
|
|
|
- q->u.eq.ev_comp_count, q->u.eq.ev_other_count,
|
|
|
- q->count);
|
|
|
- spin_unlock_bh(&q->lock);
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static void mlxsw_pci_eq_cmd_event(struct mlxsw_pci *mlxsw_pci, char *eqe)
|
|
|
{
|
|
|
mlxsw_pci->cmd.comp.status = mlxsw_pci_eqe_cmd_status_get(eqe);
|
|
@@ -866,7 +754,6 @@ struct mlxsw_pci_queue_ops {
|
|
|
void (*fini)(struct mlxsw_pci *mlxsw_pci,
|
|
|
struct mlxsw_pci_queue *q);
|
|
|
void (*tasklet)(unsigned long data);
|
|
|
- int (*dbg_read)(struct seq_file *s, void *data);
|
|
|
u16 elem_count;
|
|
|
u8 elem_size;
|
|
|
};
|
|
@@ -875,7 +762,6 @@ static const struct mlxsw_pci_queue_ops mlxsw_pci_sdq_ops = {
|
|
|
.type = MLXSW_PCI_QUEUE_TYPE_SDQ,
|
|
|
.init = mlxsw_pci_sdq_init,
|
|
|
.fini = mlxsw_pci_sdq_fini,
|
|
|
- .dbg_read = mlxsw_pci_sdq_dbg_read,
|
|
|
.elem_count = MLXSW_PCI_WQE_COUNT,
|
|
|
.elem_size = MLXSW_PCI_WQE_SIZE,
|
|
|
};
|
|
@@ -884,7 +770,6 @@ static const struct mlxsw_pci_queue_ops mlxsw_pci_rdq_ops = {
|
|
|
.type = MLXSW_PCI_QUEUE_TYPE_RDQ,
|
|
|
.init = mlxsw_pci_rdq_init,
|
|
|
.fini = mlxsw_pci_rdq_fini,
|
|
|
- .dbg_read = mlxsw_pci_rdq_dbg_read,
|
|
|
.elem_count = MLXSW_PCI_WQE_COUNT,
|
|
|
.elem_size = MLXSW_PCI_WQE_SIZE
|
|
|
};
|
|
@@ -894,7 +779,6 @@ static const struct mlxsw_pci_queue_ops mlxsw_pci_cq_ops = {
|
|
|
.init = mlxsw_pci_cq_init,
|
|
|
.fini = mlxsw_pci_cq_fini,
|
|
|
.tasklet = mlxsw_pci_cq_tasklet,
|
|
|
- .dbg_read = mlxsw_pci_cq_dbg_read,
|
|
|
.elem_count = MLXSW_PCI_CQE_COUNT,
|
|
|
.elem_size = MLXSW_PCI_CQE_SIZE
|
|
|
};
|
|
@@ -904,7 +788,6 @@ static const struct mlxsw_pci_queue_ops mlxsw_pci_eq_ops = {
|
|
|
.init = mlxsw_pci_eq_init,
|
|
|
.fini = mlxsw_pci_eq_fini,
|
|
|
.tasklet = mlxsw_pci_eq_tasklet,
|
|
|
- .dbg_read = mlxsw_pci_eq_dbg_read,
|
|
|
.elem_count = MLXSW_PCI_EQE_COUNT,
|
|
|
.elem_size = MLXSW_PCI_EQE_SIZE
|
|
|
};
|
|
@@ -982,9 +865,7 @@ static int mlxsw_pci_queue_group_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
|
|
|
const struct mlxsw_pci_queue_ops *q_ops,
|
|
|
u8 num_qs)
|
|
|
{
|
|
|
- struct pci_dev *pdev = mlxsw_pci->pdev;
|
|
|
struct mlxsw_pci_queue_type_group *queue_group;
|
|
|
- char tmp[16];
|
|
|
int i;
|
|
|
int err;
|
|
|
|
|
@@ -1001,10 +882,6 @@ static int mlxsw_pci_queue_group_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
|
|
|
}
|
|
|
queue_group->count = num_qs;
|
|
|
|
|
|
- sprintf(tmp, "%s_stats", mlxsw_pci_queue_type_str(q_ops->type));
|
|
|
- debugfs_create_devm_seqfile(&pdev->dev, tmp, mlxsw_pci->dbg_dir,
|
|
|
- q_ops->dbg_read);
|
|
|
-
|
|
|
return 0;
|
|
|
|
|
|
err_queue_init:
|
|
@@ -1850,14 +1727,6 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|
|
mlxsw_pci->bus_info.device_name = pci_name(mlxsw_pci->pdev);
|
|
|
mlxsw_pci->bus_info.dev = &pdev->dev;
|
|
|
|
|
|
- mlxsw_pci->dbg_dir = debugfs_create_dir(mlxsw_pci->bus_info.device_name,
|
|
|
- mlxsw_pci_dbg_root);
|
|
|
- if (!mlxsw_pci->dbg_dir) {
|
|
|
- dev_err(&pdev->dev, "Failed to create debugfs dir\n");
|
|
|
- err = -ENOMEM;
|
|
|
- goto err_dbg_create_dir;
|
|
|
- }
|
|
|
-
|
|
|
err = mlxsw_core_bus_device_register(&mlxsw_pci->bus_info,
|
|
|
&mlxsw_pci_bus, mlxsw_pci);
|
|
|
if (err) {
|
|
@@ -1868,8 +1737,6 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|
|
return 0;
|
|
|
|
|
|
err_bus_device_register:
|
|
|
- debugfs_remove_recursive(mlxsw_pci->dbg_dir);
|
|
|
-err_dbg_create_dir:
|
|
|
pci_disable_msix(mlxsw_pci->pdev);
|
|
|
err_msix_init:
|
|
|
err_sw_reset:
|
|
@@ -1890,7 +1757,6 @@ static void mlxsw_pci_remove(struct pci_dev *pdev)
|
|
|
struct mlxsw_pci *mlxsw_pci = pci_get_drvdata(pdev);
|
|
|
|
|
|
mlxsw_core_bus_device_unregister(mlxsw_pci->core);
|
|
|
- debugfs_remove_recursive(mlxsw_pci->dbg_dir);
|
|
|
pci_disable_msix(mlxsw_pci->pdev);
|
|
|
iounmap(mlxsw_pci->hw_addr);
|
|
|
pci_release_regions(mlxsw_pci->pdev);
|
|
@@ -1914,15 +1780,11 @@ EXPORT_SYMBOL(mlxsw_pci_driver_unregister);
|
|
|
|
|
|
static int __init mlxsw_pci_module_init(void)
|
|
|
{
|
|
|
- mlxsw_pci_dbg_root = debugfs_create_dir(mlxsw_pci_driver_name, NULL);
|
|
|
- if (!mlxsw_pci_dbg_root)
|
|
|
- return -ENOMEM;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
static void __exit mlxsw_pci_module_exit(void)
|
|
|
{
|
|
|
- debugfs_remove_recursive(mlxsw_pci_dbg_root);
|
|
|
}
|
|
|
|
|
|
module_init(mlxsw_pci_module_init);
|