netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net, Tushar Dave <tushar.n.dave@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com
Subject: Re: [net-next 02/11] e1000: Adding e1000_dump function
Date: Tue, 07 Feb 2012 07:40:03 -0800	[thread overview]
Message-ID: <1328629203.4837.6.camel@joe2Laptop> (raw)
In-Reply-To: <1328618038-5008-3-git-send-email-jeffrey.t.kirsher@intel.com>

On Tue, 2012-02-07 at 04:33 -0800, Jeff Kirsher wrote:
> diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c

trivia:

> @@ -3239,6 +3239,228 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
>  	return NETDEV_TX_OK;
>  }
>  
> +#define NUM_REGS 38 /* 1 based count */
> +static void e1000_regdump(struct e1000_adapter *adapter)
> +{
> +	struct e1000_hw *hw = &adapter->hw;
> +	u32 regs[NUM_REGS];
> +	u32 *regs_buff = regs;
> +	int i = 0;
> +
> +	char *reg_name[] = {

static const char * const reg_name[]
(and the layout is poor)

> +	"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"
> +	};
> +	pr_info("Register dump\n");
> +	for (i = 0; i < NUM_REGS; i++) {
> +		printk(KERN_INFO "%-15s  %08x\n",
> +		reg_name[i], regs_buff[i]);
> +	}

		pr_info(%-15s  %08x\n", reg_name[i], regs_buff[i]);

[]
> +static void e1000_dump(struct e1000_adapter *adapter)
[]
> +	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

> +
> +	if (!netif_msg_tx_done(adapter))
> +		goto rx_ring_summary;
> +
> +	for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) {
> +		struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i);
> +		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);
> +		if (i == tx_ring->next_to_use &&bet i == tx_ring->next_to_clean)
> +			printk(KERN_CONT" NTC/U\n");
> +		else if (i == tx_ring->next_to_use)
> +			printk(KERN_CONT " NTU\n");
> +		else if (i == tx_ring->next_to_clean)
> +			printk(KERN_CONT " NTC\n");
> +		else
> +			printk(KERN_CONT "\n");
> +


better to use a temporary char * for NTC/NTU/NTC/""
and use a single pr_info()

> +	for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) {
> +		struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i);
> +		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);
> +		if (i == rx_ring->next_to_use)
> +			printk(KERN_CONT " NTU\n");
> +		else if (i == rx_ring->next_to_clean)
> +			printk(KERN_CONT " NTC\n");
> +		else
> +			printk(KERN_CONT "\n");

temporary here too

  reply	other threads:[~2012-02-07 15:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 12:33 [net-next 00/11][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-02-07 12:33 ` [net-next 01/11] igbvf: refactor Interrupt Throttle Rate code Jeff Kirsher
2012-02-07 12:33 ` [net-next 02/11] e1000: Adding e1000_dump function Jeff Kirsher
2012-02-07 15:40   ` Joe Perches [this message]
2012-02-07 18:19     ` [PATCH net-next] e1000: Neaten " Joe Perches
2012-02-07 19:09       ` Dave, Tushar N
2012-02-07 17:38   ` [net-next 02/11] e1000: Adding " Michal Kubeček
2012-02-08 18:39     ` Dave, Tushar N
2012-02-09  9:08       ` Jan Beulich
2012-02-13  8:24       ` Michal Kubeček
2012-02-07 12:33 ` [net-next 03/11] e1000e: add missing initializers reported when compiling with W=1 Jeff Kirsher
2012-02-07 12:33 ` [net-next 04/11] e1000e: cleanup - check return values consistently Jeff Kirsher
2012-02-07 12:33 ` [net-next 05/11] e1000e: cleanup e1000_init_mac_params_80003es2lan() Jeff Kirsher
2012-02-07 12:33 ` [net-next 06/11] e1000e: cleanup e1000_init_mac_params_82571() Jeff Kirsher
2012-02-07 12:33 ` [net-next 07/11] e1000e: cleanup e1000_set_phys_id Jeff Kirsher
2012-02-07 12:33 ` [net-next 08/11] e1000e: cleanup - use braces in both branches of a conditional statement Jeff Kirsher
2012-02-07 12:33 ` [net-next 09/11] e1000e: fix checkpatch warning from MINMAX test Jeff Kirsher
2012-02-07 12:33 ` [net-next 10/11] e1000e: fix sparse warnings with -D__CHECK_ENDIAN__ Jeff Kirsher
2012-02-07 12:58   ` David Laight
2012-02-07 17:16     ` David Miller
2012-02-07 12:33 ` [net-next 11/11] e1000e: minor whitespace and indentation cleanup Jeff Kirsher
2012-02-07 17:27 ` [net-next 00/11][pull request] Intel Wired LAN Driver Updates David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1328629203.4837.6.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    --cc=tushar.n.dave@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).