summaryrefslogtreecommitdiff
path: root/drivers/net/ivshmem-net.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2017-01-01 15:46:26 +0100
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit828f803c30ca5399c6b4e47f0b865c66b72ba706 (patch)
tree3e76ed912c823f0f384a01d3f445a846b4f573e0 /drivers/net/ivshmem-net.c
parent6378925389476b6fb28c89c18d21166c73d4ad66 (diff)
ivshmem-net: Add ethtool register dump
Helps debugging inconsistent states. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> (cherry picked from commit 78591727e5d0330ed0010044829204a847ed3978)
Diffstat (limited to 'drivers/net/ivshmem-net.c')
-rw-r--r--drivers/net/ivshmem-net.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/ivshmem-net.c b/drivers/net/ivshmem-net.c
index 09484d652add..c52727ef40c1 100644
--- a/drivers/net/ivshmem-net.c
+++ b/drivers/net/ivshmem-net.c
@@ -748,10 +748,41 @@ static void ivshm_net_get_ethtool_stats(struct net_device *ndev,
memset(&in->stats, 0, sizeof(in->stats));
}
+#define IVSHM_NET_REGS_LEN (3 * sizeof(u32) + 6 * sizeof(u16))
+
+static int ivshm_net_get_regs_len(struct net_device *ndev)
+{
+ return IVSHM_NET_REGS_LEN;
+}
+
+static void ivshm_net_get_regs(struct net_device *ndev,
+ struct ethtool_regs *regs, void *p)
+{
+ struct ivshm_net *in = netdev_priv(ndev);
+ u32 *reg32 = p;
+ u16 *reg16;
+
+ *reg32++ = in->lstate;
+ *reg32++ = in->rstate;
+ *reg32++ = in->qlen;
+
+ reg16 = (u16 *)reg32;
+
+ *reg16++ = in->tx.vr.avail ? in->tx.vr.avail->idx : 0;
+ *reg16++ = in->tx.vr.used ? in->tx.vr.used->idx : 0;
+ *reg16++ = in->tx.vr.avail ? vring_avail_event(&in->tx.vr) : 0;
+
+ *reg16++ = in->rx.vr.avail ? in->rx.vr.avail->idx : 0;
+ *reg16++ = in->rx.vr.used ? in->rx.vr.used->idx : 0;
+ *reg16++ = in->rx.vr.avail ? vring_avail_event(&in->rx.vr) : 0;
+}
+
static const struct ethtool_ops ivshm_net_ethtool_ops = {
.get_sset_count = ivshm_net_get_sset_count,
.get_strings = ivshm_net_get_strings,
.get_ethtool_stats = ivshm_net_get_ethtool_stats,
+ .get_regs_len = ivshm_net_get_regs_len,
+ .get_regs = ivshm_net_get_regs,
};
static int ivshm_net_probe(struct pci_dev *pdev,