Commit 5c32bac9 authored by Andre Guedes's avatar Andre Guedes Committed by Jeff Kirsher

igc: Use netdev log helpers in igc_dump.c

In igc_dump.c we print log messages using dev_* and pr_* helpers,
generating inconsistent output with the rest of the driver. Since this
is a network device driver, we should preferably use netdev_* helpers
because they append the interface name to the message, helping making
sense out of the logs.

This patch converts all dev_* and pr_* calls to netdev_*.

Quick note about igc_rings_dump(): This function is always called with
valid adapter->netdev so there is not need to check it.
Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 916a3c65
...@@ -47,6 +47,7 @@ static const struct igc_reg_info igc_reg_info_tbl[] = { ...@@ -47,6 +47,7 @@ static const struct igc_reg_info igc_reg_info_tbl[] = {
/* igc_regdump - register printout routine */ /* igc_regdump - register printout routine */
static void igc_regdump(struct igc_hw *hw, struct igc_reg_info *reginfo) static void igc_regdump(struct igc_hw *hw, struct igc_reg_info *reginfo)
{ {
struct net_device *dev = igc_get_hw_dev(hw);
int n = 0; int n = 0;
char rname[16]; char rname[16];
u32 regs[8]; u32 regs[8];
...@@ -101,13 +102,14 @@ static void igc_regdump(struct igc_hw *hw, struct igc_reg_info *reginfo) ...@@ -101,13 +102,14 @@ static void igc_regdump(struct igc_hw *hw, struct igc_reg_info *reginfo)
regs[n] = rd32(IGC_TXDCTL(n)); regs[n] = rd32(IGC_TXDCTL(n));
break; break;
default: default:
pr_info("%-15s %08x\n", reginfo->name, rd32(reginfo->ofs)); netdev_info(dev, "%-15s %08x\n", reginfo->name,
rd32(reginfo->ofs));
return; return;
} }
snprintf(rname, 16, "%s%s", reginfo->name, "[0-3]"); snprintf(rname, 16, "%s%s", reginfo->name, "[0-3]");
pr_info("%-15s %08x %08x %08x %08x\n", rname, regs[0], regs[1], netdev_info(dev, "%-15s %08x %08x %08x %08x\n", rname, regs[0], regs[1],
regs[2], regs[3]); regs[2], regs[3]);
} }
/* igc_rings_dump - Tx-rings and Rx-rings */ /* igc_rings_dump - Tx-rings and Rx-rings */
...@@ -125,39 +127,34 @@ void igc_rings_dump(struct igc_adapter *adapter) ...@@ -125,39 +127,34 @@ void igc_rings_dump(struct igc_adapter *adapter)
if (!netif_msg_hw(adapter)) if (!netif_msg_hw(adapter))
return; return;
/* Print netdevice Info */ netdev_info(netdev, "Device info: state %016lX trans_start %016lX\n",
if (netdev) { netdev->state, dev_trans_start(netdev));
dev_info(&adapter->pdev->dev, "Net device Info\n");
pr_info("Device Name state trans_start\n");
pr_info("%-15s %016lX %016lX\n", netdev->name,
netdev->state, dev_trans_start(netdev));
}
/* Print TX Ring Summary */ /* Print TX Ring Summary */
if (!netdev || !netif_running(netdev)) if (!netif_running(netdev))
goto exit; goto exit;
dev_info(&adapter->pdev->dev, "TX Rings Summary\n"); netdev_info(netdev, "TX Rings Summary\n");
pr_info("Queue [NTU] [NTC] [bi(ntc)->dma ] leng ntw timestamp\n"); netdev_info(netdev, "Queue [NTU] [NTC] [bi(ntc)->dma ] leng ntw timestamp\n");
for (n = 0; n < adapter->num_tx_queues; n++) { for (n = 0; n < adapter->num_tx_queues; n++) {
struct igc_tx_buffer *buffer_info; struct igc_tx_buffer *buffer_info;
tx_ring = adapter->tx_ring[n]; tx_ring = adapter->tx_ring[n];
buffer_info = &tx_ring->tx_buffer_info[tx_ring->next_to_clean]; buffer_info = &tx_ring->tx_buffer_info[tx_ring->next_to_clean];
pr_info(" %5d %5X %5X %016llX %04X %p %016llX\n", netdev_info(netdev, "%5d %5X %5X %016llX %04X %p %016llX\n",
n, tx_ring->next_to_use, tx_ring->next_to_clean, n, tx_ring->next_to_use, tx_ring->next_to_clean,
(u64)dma_unmap_addr(buffer_info, dma), (u64)dma_unmap_addr(buffer_info, dma),
dma_unmap_len(buffer_info, len), dma_unmap_len(buffer_info, len),
buffer_info->next_to_watch, buffer_info->next_to_watch,
(u64)buffer_info->time_stamp); (u64)buffer_info->time_stamp);
} }
/* Print TX Rings */ /* Print TX Rings */
if (!netif_msg_tx_done(adapter)) if (!netif_msg_tx_done(adapter))
goto rx_ring_summary; goto rx_ring_summary;
dev_info(&adapter->pdev->dev, "TX Rings Dump\n"); netdev_info(netdev, "TX Rings Dump\n");
/* Transmit Descriptor Formats /* Transmit Descriptor Formats
* *
...@@ -172,10 +169,11 @@ void igc_rings_dump(struct igc_adapter *adapter) ...@@ -172,10 +169,11 @@ void igc_rings_dump(struct igc_adapter *adapter)
for (n = 0; n < adapter->num_tx_queues; n++) { for (n = 0; n < adapter->num_tx_queues; n++) {
tx_ring = adapter->tx_ring[n]; tx_ring = adapter->tx_ring[n];
pr_info("------------------------------------\n"); netdev_info(netdev, "------------------------------------\n");
pr_info("TX QUEUE INDEX = %d\n", tx_ring->queue_index); netdev_info(netdev, "TX QUEUE INDEX = %d\n",
pr_info("------------------------------------\n"); tx_ring->queue_index);
pr_info("T [desc] [address 63:0 ] [PlPOCIStDDM Ln] [bi->dma ] leng ntw timestamp bi->skb\n"); netdev_info(netdev, "------------------------------------\n");
netdev_info(netdev, "T [desc] [address 63:0 ] [PlPOCIStDDM Ln] [bi->dma ] leng ntw timestamp bi->skb\n");
for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) {
const char *next_desc; const char *next_desc;
...@@ -194,14 +192,14 @@ void igc_rings_dump(struct igc_adapter *adapter) ...@@ -194,14 +192,14 @@ void igc_rings_dump(struct igc_adapter *adapter)
else else
next_desc = ""; next_desc = "";
pr_info("T [0x%03X] %016llX %016llX %016llX %04X %p %016llX %p%s\n", netdev_info(netdev, "T [0x%03X] %016llX %016llX %016llX %04X %p %016llX %p%s\n",
i, le64_to_cpu(u0->a), i, le64_to_cpu(u0->a),
le64_to_cpu(u0->b), le64_to_cpu(u0->b),
(u64)dma_unmap_addr(buffer_info, dma), (u64)dma_unmap_addr(buffer_info, dma),
dma_unmap_len(buffer_info, len), dma_unmap_len(buffer_info, len),
buffer_info->next_to_watch, buffer_info->next_to_watch,
(u64)buffer_info->time_stamp, (u64)buffer_info->time_stamp,
buffer_info->skb, next_desc); buffer_info->skb, next_desc);
if (netif_msg_pktdata(adapter) && buffer_info->skb) if (netif_msg_pktdata(adapter) && buffer_info->skb)
print_hex_dump(KERN_INFO, "", print_hex_dump(KERN_INFO, "",
...@@ -214,19 +212,19 @@ void igc_rings_dump(struct igc_adapter *adapter) ...@@ -214,19 +212,19 @@ void igc_rings_dump(struct igc_adapter *adapter)
/* Print RX Rings Summary */ /* Print RX Rings Summary */
rx_ring_summary: rx_ring_summary:
dev_info(&adapter->pdev->dev, "RX Rings Summary\n"); netdev_info(netdev, "RX Rings Summary\n");
pr_info("Queue [NTU] [NTC]\n"); netdev_info(netdev, "Queue [NTU] [NTC]\n");
for (n = 0; n < adapter->num_rx_queues; n++) { for (n = 0; n < adapter->num_rx_queues; n++) {
rx_ring = adapter->rx_ring[n]; rx_ring = adapter->rx_ring[n];
pr_info(" %5d %5X %5X\n", netdev_info(netdev, "%5d %5X %5X\n", n, rx_ring->next_to_use,
n, rx_ring->next_to_use, rx_ring->next_to_clean); rx_ring->next_to_clean);
} }
/* Print RX Rings */ /* Print RX Rings */
if (!netif_msg_rx_status(adapter)) if (!netif_msg_rx_status(adapter))
goto exit; goto exit;
dev_info(&adapter->pdev->dev, "RX Rings Dump\n"); netdev_info(netdev, "RX Rings Dump\n");
/* Advanced Receive Descriptor (Read) Format /* Advanced Receive Descriptor (Read) Format
* 63 1 0 * 63 1 0
...@@ -251,11 +249,12 @@ void igc_rings_dump(struct igc_adapter *adapter) ...@@ -251,11 +249,12 @@ void igc_rings_dump(struct igc_adapter *adapter)
for (n = 0; n < adapter->num_rx_queues; n++) { for (n = 0; n < adapter->num_rx_queues; n++) {
rx_ring = adapter->rx_ring[n]; rx_ring = adapter->rx_ring[n];
pr_info("------------------------------------\n"); netdev_info(netdev, "------------------------------------\n");
pr_info("RX QUEUE INDEX = %d\n", rx_ring->queue_index); netdev_info(netdev, "RX QUEUE INDEX = %d\n",
pr_info("------------------------------------\n"); rx_ring->queue_index);
pr_info("R [desc] [ PktBuf A0] [ HeadBuf DD] [bi->dma ] [bi->skb] <-- Adv Rx Read format\n"); netdev_info(netdev, "------------------------------------\n");
pr_info("RWB[desc] [PcsmIpSHl PtRs] [vl er S cks ln] ---------------- [bi->skb] <-- Adv Rx Write-Back format\n"); netdev_info(netdev, "R [desc] [ PktBuf A0] [ HeadBuf DD] [bi->dma ] [bi->skb] <-- Adv Rx Read format\n");
netdev_info(netdev, "RWB[desc] [PcsmIpSHl PtRs] [vl er S cks ln] ---------------- [bi->skb] <-- Adv Rx Write-Back format\n");
for (i = 0; i < rx_ring->count; i++) { for (i = 0; i < rx_ring->count; i++) {
const char *next_desc; const char *next_desc;
...@@ -275,18 +274,18 @@ void igc_rings_dump(struct igc_adapter *adapter) ...@@ -275,18 +274,18 @@ void igc_rings_dump(struct igc_adapter *adapter)
if (staterr & IGC_RXD_STAT_DD) { if (staterr & IGC_RXD_STAT_DD) {
/* Descriptor Done */ /* Descriptor Done */
pr_info("%s[0x%03X] %016llX %016llX ---------------- %s\n", netdev_info(netdev, "%s[0x%03X] %016llX %016llX ---------------- %s\n",
"RWB", i, "RWB", i,
le64_to_cpu(u0->a), le64_to_cpu(u0->a),
le64_to_cpu(u0->b), le64_to_cpu(u0->b),
next_desc); next_desc);
} else { } else {
pr_info("%s[0x%03X] %016llX %016llX %016llX %s\n", netdev_info(netdev, "%s[0x%03X] %016llX %016llX %016llX %s\n",
"R ", i, "R ", i,
le64_to_cpu(u0->a), le64_to_cpu(u0->a),
le64_to_cpu(u0->b), le64_to_cpu(u0->b),
(u64)buffer_info->dma, (u64)buffer_info->dma,
next_desc); next_desc);
if (netif_msg_pktdata(adapter) && if (netif_msg_pktdata(adapter) &&
buffer_info->dma && buffer_info->page) { buffer_info->dma && buffer_info->page) {
...@@ -314,8 +313,8 @@ void igc_regs_dump(struct igc_adapter *adapter) ...@@ -314,8 +313,8 @@ void igc_regs_dump(struct igc_adapter *adapter)
struct igc_reg_info *reginfo; struct igc_reg_info *reginfo;
/* Print Registers */ /* Print Registers */
dev_info(&adapter->pdev->dev, "Register Dump\n"); netdev_info(adapter->netdev, "Register Dump\n");
pr_info(" Register Name Value\n"); netdev_info(adapter->netdev, "Register Name Value\n");
for (reginfo = (struct igc_reg_info *)igc_reg_info_tbl; for (reginfo = (struct igc_reg_info *)igc_reg_info_tbl;
reginfo->name; reginfo++) { reginfo->name; reginfo++) {
igc_regdump(hw, reginfo); igc_regdump(hw, reginfo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment