lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1330078389-8203-17-git-send-email-jeffrey.t.kirsher@intel.com>
Date:	Fri, 24 Feb 2012 02:13:09 -0800
From:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>
To:	davem@...emloft.net
Cc:	Tushar Dave <tushar.n.dave@...el.com>, netdev@...r.kernel.org,
	gospo@...hat.com, sassmann@...hat.com,
	Joe Perches <joe@...ches.com>,
	Jeff Kirsher <jeffrey.t.kirsher@...el.com>
Subject: [net-next 16/16] v2 e1000: Neaten e1000_dump function

From: Tushar Dave <tushar.n.dave@...el.com>

Use pr_<level> for printk
Use temporary instead of multiple pr_conts
Coalesce formats.

Save a few bytes of object code too:

$ size drivers/net/ethernet/intel/e1000/e1000_main.o*
   text	   data	    bss	    dec	    hex	filename
  60507	    369	  14120	  74996	  124f4
drivers/net/ethernet/intel/e1000/e1000_main.o.new
  60717	    369	  14176	  75262	  125fe
drivers/net/ethernet/intel/e1000/e1000_main.o.old

Removed printing of pktdata.

Signed-off-by: Joe Perches <joe@...ches.com>
Signed-off-by: Tushar Dave <tushar.n.dave@...el.com>
Tested-by: Aaron Brown <aaron.f.brown@...el.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
---
 drivers/net/ethernet/intel/e1000/e1000_main.c |  113 +++++++++++--------------
 1 files changed, 50 insertions(+), 63 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 8aa8097..6419a88 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -3261,16 +3261,16 @@ static void e1000_regdump(struct e1000_adapter *adapter)
 	u32 *regs_buff = regs;
 	int i = 0;
 
-	char *reg_name[] = {
-	"CTRL",  "STATUS",
-	"RCTL", "RDLEN", "RDH", "RDT", "RDTR",
-	"TCTL", "TDBAL", "TDBAH", "TDLEN", "TDH", "TDT",
-	"TIDV", "TXDCTL", "TADV", "TARC0",
-	"TDBAL1", "TDBAH1", "TDLEN1", "TDH1", "TDT1",
-	"TXDCTL1", "TARC1",
-	"CTRL_EXT", "ERT", "RDBAL", "RDBAH",
-	"TDFH", "TDFT", "TDFHS", "TDFTS", "TDFPC",
-	"RDFH", "RDFT", "RDFHS", "RDFTS", "RDFPC"
+	static const char * const reg_name[] = {
+		"CTRL",  "STATUS",
+		"RCTL", "RDLEN", "RDH", "RDT", "RDTR",
+		"TCTL", "TDBAL", "TDBAH", "TDLEN", "TDH", "TDT",
+		"TIDV", "TXDCTL", "TADV", "TARC0",
+		"TDBAL1", "TDBAH1", "TDLEN1", "TDH1", "TDT1",
+		"TXDCTL1", "TARC1",
+		"CTRL_EXT", "ERT", "RDBAL", "RDBAH",
+		"TDFH", "TDFT", "TDFHS", "TDFTS", "TDFPC",
+		"RDFH", "RDFT", "RDFHS", "RDFTS", "RDFPC"
 	};
 
 	regs_buff[0]  = er32(CTRL);
@@ -3316,10 +3316,8 @@ static void e1000_regdump(struct e1000_adapter *adapter)
 	regs_buff[37] = er32(RDFPC);
 
 	pr_info("Register dump\n");
-	for (i = 0; i < NUM_REGS; i++) {
-		printk(KERN_INFO "%-15s  %08x\n",
-		reg_name[i], regs_buff[i]);
-	}
+	for (i = 0; i < NUM_REGS; i++)
+		pr_info("%-15s  %08x\n", reg_name[i], regs_buff[i]);
 }
 
 /*
@@ -3370,10 +3368,8 @@ static void e1000_dump(struct e1000_adapter *adapter)
 	 *   +----------------------------------------------------------------+
 	 *   63       48 47     40 39  36 35    32 31     24 23  20 19        0
 	 */
-	printk(KERN_INFO "Tc[desc]     [Ce CoCsIpceCoS] [MssHlRSCm0Plen] [bi->dma       ]"
-	       " leng  ntw timestmp         bi->skb\n");
-	printk(KERN_INFO "Td[desc]     [address 63:0  ] [VlaPoRSCm1Dlen] [bi->dma       ]"
-	       " leng  ntw timestmp         bi->skb\n");
+	pr_info("Tc[desc]     [Ce CoCsIpceCoS] [MssHlRSCm0Plen] [bi->dma       ] leng  ntw timestmp         bi->skb\n");
+	pr_info("Td[desc]     [address 63:0  ] [VlaPoRSCm1Dlen] [bi->dma       ] leng  ntw timestmp         bi->skb\n");
 
 	if (!netif_msg_tx_done(adapter))
 		goto rx_ring_summary;
@@ -3383,27 +3379,23 @@ static void e1000_dump(struct e1000_adapter *adapter)
 		struct e1000_buffer *buffer_info = &tx_ring->buffer_info[i];
 		struct my_u { u64 a; u64 b; };
 		struct my_u *u = (struct my_u *)tx_desc;
-		printk(KERN_INFO "T%c[0x%03X]    %016llX %016llX %016llX %04X  %3X "
-		       "%016llX %p",
-		       ((le64_to_cpu(u->b) & (1<<20)) ? 'd' : 'c'), i,
-		       le64_to_cpu(u->a), le64_to_cpu(u->b),
-		       (u64)buffer_info->dma, buffer_info->length,
-		       buffer_info->next_to_watch, (u64)buffer_info->time_stamp,
-		       buffer_info->skb);
+		const char *type;
+
 		if (i == tx_ring->next_to_use && i == tx_ring->next_to_clean)
-			printk(KERN_CONT" NTC/U\n");
+			type = "NTC/U";
 		else if (i == tx_ring->next_to_use)
-			printk(KERN_CONT " NTU\n");
+			type = "NTU";
 		else if (i == tx_ring->next_to_clean)
-			printk(KERN_CONT " NTC\n");
+			type = "NTC";
 		else
-			printk(KERN_CONT "\n");
-
-
-		if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
-			print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
-					16, 1, phys_to_virt(buffer_info->dma),
-					buffer_info->length, true);
+			type = "";
+
+		pr_info("T%c[0x%03X]    %016llX %016llX %016llX %04X  %3X %016llX %p %s\n",
+			((le64_to_cpu(u->b) & (1<<20)) ? 'd' : 'c'), i,
+			le64_to_cpu(u->a), le64_to_cpu(u->b),
+			(u64)buffer_info->dma, buffer_info->length,
+			buffer_info->next_to_watch,
+			(u64)buffer_info->time_stamp, buffer_info->skb, type);
 	}
 
 rx_ring_summary:
@@ -3421,8 +3413,7 @@ rx_ring_summary:
 	 * +-----------------------------------------------------+
 	 * 63       48 47    40 39      32 31         16 15      0
 	 */
-	printk(KERN_INFO "R[desc]      [address 63:0  ] [vl er S cks ln] "
-		"[bi->dma       ] [bi->skb]\n");
+	pr_info("R[desc]      [address 63:0  ] [vl er S cks ln] [bi->dma       ] [bi->skb]\n");
 
 	if (!netif_msg_rx_status(adapter))
 		goto exit;
@@ -3432,44 +3423,40 @@ rx_ring_summary:
 		struct e1000_buffer *buffer_info = &rx_ring->buffer_info[i];
 		struct my_u { u64 a; u64 b; };
 		struct my_u *u = (struct my_u *)rx_desc;
-		printk(KERN_INFO "R[0x%03X]     %016llX %016llX %016llX %p",
-			i, le64_to_cpu(u->a), le64_to_cpu(u->b),
-			(u64)buffer_info->dma, buffer_info->skb);
+		const char *type;
+
 		if (i == rx_ring->next_to_use)
-			printk(KERN_CONT " NTU\n");
+			type = "NTU";
 		else if (i == rx_ring->next_to_clean)
-			printk(KERN_CONT " NTC\n");
+			type = "NTC";
 		else
-			printk(KERN_CONT "\n");
-
-		if (netif_msg_pktdata(adapter))
-			print_hex_dump(KERN_INFO, "",
-				DUMP_PREFIX_ADDRESS, 16, 1,
-				phys_to_virt(buffer_info->dma),
-				buffer_info->length, true);
+			type = "";
 
+		pr_info("R[0x%03X]     %016llX %016llX %016llX %p %s\n",
+			i, le64_to_cpu(u->a), le64_to_cpu(u->b),
+			(u64)buffer_info->dma, buffer_info->skb, type);
 	} /* for */
 
 	/* dump the descriptor caches */
 	/* rx */
-	printk(KERN_INFO "e1000: Rx descriptor cache in 64bit format\n");
+	pr_info("Rx descriptor cache in 64bit format\n");
 	for (i = 0x6000; i <= 0x63FF ; i += 0x10) {
-		printk(KERN_INFO "R%04X: %08X|%08X %08X|%08X\n",
-				i,
-				readl(adapter->hw.hw_addr + i+4),
-				readl(adapter->hw.hw_addr + i),
-				readl(adapter->hw.hw_addr + i+12),
-				readl(adapter->hw.hw_addr + i+8));
+		pr_info("R%04X: %08X|%08X %08X|%08X\n",
+			i,
+			readl(adapter->hw.hw_addr + i+4),
+			readl(adapter->hw.hw_addr + i),
+			readl(adapter->hw.hw_addr + i+12),
+			readl(adapter->hw.hw_addr + i+8));
 	}
 	/* tx */
-	printk(KERN_INFO "e1000: Tx descriptor cache in 64bit format\n");
+	pr_info("Tx descriptor cache in 64bit format\n");
 	for (i = 0x7000; i <= 0x73FF ; i += 0x10) {
-		printk(KERN_INFO "T%04X: %08X|%08X %08X|%08X\n",
-				i,
-				readl(adapter->hw.hw_addr + i+4),
-				readl(adapter->hw.hw_addr + i),
-				readl(adapter->hw.hw_addr + i+12),
-				readl(adapter->hw.hw_addr + i+8));
+		pr_info("T%04X: %08X|%08X %08X|%08X\n",
+			i,
+			readl(adapter->hw.hw_addr + i+4),
+			readl(adapter->hw.hw_addr + i),
+			readl(adapter->hw.hw_addr + i+12),
+			readl(adapter->hw.hw_addr + i+8));
 	}
 exit:
 	return;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ