diff options
author | Michael Weiser <michael.weiser@gmx.de> | 2016-11-14 18:58:06 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-15 22:05:54 -0500 |
commit | b8ca3387fe94ad5a7142f0b3de5aedf7389234c3 (patch) | |
tree | 9c635b21a18f21c06d2d6e347a879ba55d0233ba | |
parent | f8be0d78be6e7f199116a5e644ee20ff0ce413f7 (diff) | |
download | linux-b8ca3387fe94ad5a7142f0b3de5aedf7389234c3.tar.bz2 |
net: ethernet: sun4i-emac: Allow to enable netif messages
sun4i-emac has the ability to print a number of diagnostic messages using
dev_dbg depending on message level settings implemented using netif_msg_*
macros. But there's no way to actually enable them.
Add the ability to switch diagnostic messages on using either a module
parameter debug or ethtool -s <netif> msglvl <flags>.
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/allwinner/sun4i-emac.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index af27f9dbedf2..74012196bce9 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -37,6 +37,11 @@ #define EMAC_MAX_FRAME_LEN 0x0600 +#define EMAC_DEFAULT_MSG_ENABLE 0x0000 +static int debug = -1; /* defaults above */; +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "debug message flags"); + /* Transmit timeout, default 5 seconds. */ static int watchdog = 5000; module_param(watchdog, int, 0400); @@ -225,11 +230,27 @@ static void emac_get_drvinfo(struct net_device *dev, strlcpy(info->bus_info, dev_name(&dev->dev), sizeof(info->bus_info)); } +static u32 emac_get_msglevel(struct net_device *dev) +{ + struct emac_board_info *db = netdev_priv(dev); + + return db->msg_enable; +} + +static void emac_set_msglevel(struct net_device *dev, u32 value) +{ + struct emac_board_info *db = netdev_priv(dev); + + db->msg_enable = value; +} + static const struct ethtool_ops emac_ethtool_ops = { .get_drvinfo = emac_get_drvinfo, .get_link = ethtool_op_get_link, .get_link_ksettings = phy_ethtool_get_link_ksettings, .set_link_ksettings = phy_ethtool_set_link_ksettings, + .get_msglevel = emac_get_msglevel, + .set_msglevel = emac_set_msglevel, }; static unsigned int emac_setup(struct net_device *ndev) @@ -804,6 +825,7 @@ static int emac_probe(struct platform_device *pdev) db->dev = &pdev->dev; db->ndev = ndev; db->pdev = pdev; + db->msg_enable = netif_msg_init(debug, EMAC_DEFAULT_MSG_ENABLE); spin_lock_init(&db->lock); |