Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1222162 > unrolled thread
| Started by | LABBE Corentin <clabbe.montjoie@gmail.com> |
|---|---|
| First post | 2015-09-10 14:40 +0200 |
| Last post | 2015-09-15 22:40 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
stmmac: improve logging LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-09-10 14:40 +0200
[PATCH v2 5/5] stmmac: replace if (netif_msg_type) by their netif_xxx counterpart LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-09-10 14:40 +0200
Re: [PATCH v2 5/5] stmmac: replace if (netif_msg_type) by their netif_xxx counterpart Joe Perches <joe@perches.com> - 2015-09-10 18:30 +0200
[PATCH v2 2/5] stmmac: replace hardcoded function name by __func__ LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-09-10 14:40 +0200
Re: stmmac: improve logging David Miller <davem@davemloft.net> - 2015-09-15 22:40 +0200
| From | LABBE Corentin <clabbe.montjoie@gmail.com> |
|---|---|
| Date | 2015-09-10 14:40 +0200 |
| Subject | stmmac: improve logging |
| Message-ID | <q79iW-1uR-3@gated-at.bofh.it> |
Hello This patch series try to improve logging of the stmmac driver. Changes since v1 - Use netdev_xxx instead of dev_xxx - Use netif_xxx instead of "if (netif_msg_type) dev_xxx" Regards -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | LABBE Corentin <clabbe.montjoie@gmail.com> |
|---|---|
| Date | 2015-09-10 14:40 +0200 |
| Subject | [PATCH v2 5/5] stmmac: replace if (netif_msg_type) by their netif_xxx counterpart |
| Message-ID | <q79iX-1uR-33@gated-at.bofh.it> |
| In reply to | #1222162 |
As sugested by Joe Perches, we could replace all
if (netif_msg_type(priv)) dev_xxx(priv->devices, ...)
by the simplier macro netif_xxx(priv, hw, priv->dev, ...)
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 62 ++++++++++-------------
1 file changed, 27 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 08778b9..477078a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -650,11 +650,13 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
if (priv->dma_cap.atime_stamp && priv->extend_desc)
priv->adv_ts = 1;
- if (netif_msg_hw(priv) && priv->dma_cap.time_stamp)
- netdev_dbg(priv->dev, "IEEE 1588-2002 Time Stamp supported\n");
+ if (priv->dma_cap.time_stamp)
+ netif_dbg(priv, hw, priv->dev,
+ "IEEE 1588-2002 Time Stamp supported\n");
- if (netif_msg_hw(priv) && priv->adv_ts)
- netdev_dbg(priv->dev, "IEEE 1588-2008 Advanced Time Stamp supported\n");
+ if (priv->adv_ts)
+ netif_dbg(priv, hw, priv->dev,
+ "IEEE 1588-2008 Advanced Time Stamp supported\n");
priv->hw->ptp = &stmmac_ptp;
priv->hwts_tx_en = 0;
@@ -733,10 +735,9 @@ static void stmmac_adjust_link(struct net_device *dev)
stmmac_hw_fix_mac_speed(priv);
break;
default:
- if (netif_msg_link(priv))
- netdev_warn(priv->dev,
- "%s: Speed (%d) not 10/100\n",
- dev->name, phydev->speed);
+ netif_warn(priv, link, priv->dev,
+ "%s: Speed (%d) not 10/100\n",
+ dev->name, phydev->speed);
break;
}
@@ -1038,18 +1039,15 @@ static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
priv->dma_buf_sz = bfsize;
- if (netif_msg_probe(priv))
- netdev_dbg(priv->dev, "%s: txsize %d, rxsize %d, bfsize %d\n",
- __func__, txsize, rxsize, bfsize);
+ netif_dbg(priv, probe, priv->dev, "%s: txsize %d, rxsize %d, bfsize %d\n",
+ __func__, txsize, rxsize, bfsize);
- if (netif_msg_probe(priv)) {
- netdev_dbg(priv->dev, "(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n",
- __func__, (u32)priv->dma_rx_phy,
- (u32)priv->dma_tx_phy);
+ netif_dbg(priv, probe, priv->dev, "(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n",
+ __func__, (u32)priv->dma_rx_phy, (u32)priv->dma_tx_phy);
+
+ /* RX INITIALIZATION */
+ netif_dbg(priv, probe, priv->dev, "SKB addresses:\nskb\t\tskb data\tdma data\n");
- /* RX INITIALIZATION */
- netdev_dbg(priv->dev, "SKB addresses:\nskb\t\tskb data\tdma data\n");
- }
for (i = 0; i < rxsize; i++) {
struct dma_desc *p;
@@ -1062,11 +1060,9 @@ static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
if (ret)
goto err_init_rx_buffers;
- if (netif_msg_probe(priv))
- netdev_dbg(priv->dev, "[%p]\t[%p]\t[%x]\n",
- priv->rx_skbuff[i],
- priv->rx_skbuff[i]->data,
- (unsigned int)priv->rx_skbuff_dma[i]);
+ netif_dbg(priv, probe, priv->dev, "[%p]\t[%p]\t[%x]\n",
+ priv->rx_skbuff[i], priv->rx_skbuff[i]->data,
+ (unsigned int)priv->rx_skbuff_dma[i]);
}
priv->cur_rx = 0;
priv->dirty_rx = (unsigned int)(i - rxsize);
@@ -1346,9 +1342,8 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
stmmac_get_tx_hwtstamp(priv, entry, skb);
}
- if (netif_msg_tx_done(priv))
- netdev_dbg(priv->dev, "%s: curr %d, dirty %d\n",
- __func__, priv->cur_tx, priv->dirty_tx);
+ netif_dbg(priv, tx_done, priv->dev, "%s: curr %d, dirty %d\n",
+ __func__, priv->cur_tx, priv->dirty_tx);
if (likely(priv->tx_skbuff_dma[entry].buf)) {
if (priv->tx_skbuff_dma[entry].map_as_page)
@@ -1385,9 +1380,8 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
netif_tx_lock(priv->dev);
if (netif_queue_stopped(priv->dev) &&
stmmac_tx_avail(priv) > STMMAC_TX_THRESH(priv)) {
- if (netif_msg_tx_done(priv))
- netdev_dbg(priv->dev, "%s: restart transmit\n",
- __func__);
+ netif_dbg(priv, tx_done, priv->dev, "%s: restart transmit\n",
+ __func__);
netif_wake_queue(priv->dev);
}
netif_tx_unlock(priv->dev);
@@ -2065,9 +2059,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
print_pkt(skb->data, skb->len);
}
if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) {
- if (netif_msg_hw(priv))
- netdev_dbg(priv->dev,
- "%s: stop transmitted packets\n", __func__);
+ netif_dbg(priv, hw, priv->dev,
+ "%s: stop transmitted packets\n", __func__);
netif_stop_queue(dev);
}
@@ -2155,9 +2148,8 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
priv->hw->mode->refill_desc3(priv, p);
- if (netif_msg_rx_status(priv))
- netdev_dbg(priv->dev,
- "refill entry #%d\n", entry);
+ netif_dbg(priv, rx_status, priv->dev,
+ "refill entry #%d\n", entry);
}
wmb();
priv->hw->desc->set_rx_owner(p);
--
2.4.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2015-09-10 18:30 +0200 |
| Subject | Re: [PATCH v2 5/5] stmmac: replace if (netif_msg_type) by their netif_xxx counterpart |
| Message-ID | <q7cTx-6MC-43@gated-at.bofh.it> |
| In reply to | #1222164 |
On Thu, 2015-09-10 at 14:37 +0200, LABBE Corentin wrote: > replace all > if (netif_msg_type(priv)) dev_xxx(priv->devices, ...) > by the simplier macro netif_xxx(priv, hw, priv->dev, ...) Thanks. Trivia: > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c [] > @@ -733,10 +735,9 @@ static void stmmac_adjust_link(struct net_device *dev) > stmmac_hw_fix_mac_speed(priv); > break; > default: > - if (netif_msg_link(priv)) > - netdev_warn(priv->dev, > - "%s: Speed (%d) not 10/100\n", > - dev->name, phydev->speed); > + netif_warn(priv, link, priv->dev, > + "%s: Speed (%d) not 10/100\n", > + dev->name, phydev->speed); Maybe add another patch removing dev->name where used in logging as it's likely redundant. > @@ -1038,18 +1039,15 @@ static int init_dma_desc_rings(struct net_device *dev, gfp_t flags) > > priv->dma_buf_sz = bfsize; > > - if (netif_msg_probe(priv)) > - netdev_dbg(priv->dev, "%s: txsize %d, rxsize %d, bfsize %d\n", > - __func__, txsize, rxsize, bfsize); > + netif_dbg(priv, probe, priv->dev, "%s: txsize %d, rxsize %d, bfsize %d\n", > + __func__, txsize, rxsize, bfsize); And another removing __func__ from the _dbg uses as it's relatively low value and dynamic debug can add it. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | LABBE Corentin <clabbe.montjoie@gmail.com> |
|---|---|
| Date | 2015-09-10 14:40 +0200 |
| Subject | [PATCH v2 2/5] stmmac: replace hardcoded function name by __func__ |
| Message-ID | <q79iX-1uR-43@gated-at.bofh.it> |
| In reply to | #1222162 |
Some printing have the function name hardcoded. It is better to use __func__ instead. Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1cfce6e..b016f04 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -831,7 +831,7 @@ static int stmmac_init_phy(struct net_device *dev) snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id, priv->plat->phy_addr); - netdev_dbg(priv->dev, "stmmac_init_phy: trying to attach to %s\n", + netdev_dbg(priv->dev, "%s: trying to attach to %s\n", __func__, phy_id_fmt); phydev = phy_connect(dev, phy_id_fmt, &stmmac_adjust_link, @@ -862,8 +862,8 @@ static int stmmac_init_phy(struct net_device *dev) phy_disconnect(phydev); return -ENODEV; } - netdev_dbg(priv->dev, "stmmac_init_phy: %s: attached to PHY (UID 0x%x) Link = %d\n", - dev->name, phydev->phy_id, phydev->link); + netdev_dbg(priv->dev, "%s: %s: attached to PHY (UID 0x%x) Link = %d\n", + __func__, dev->name, phydev->phy_id, phydev->link); priv->phydev = phydev; -- 2.4.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2015-09-15 22:40 +0200 |
| Message-ID | <q95bb-7Wo-3@gated-at.bofh.it> |
| In reply to | #1222162 |
From: LABBE Corentin <clabbe.montjoie@gmail.com> Date: Thu, 10 Sep 2015 14:37:28 +0200 > This patch series try to improve logging of the stmmac driver. > > Changes since v1 > - Use netdev_xxx instead of dev_xxx > - Use netif_xxx instead of "if (netif_msg_type) dev_xxx" This series does not apply cleanly to the current tree, please respin. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web