netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Hariprasad Shenai <hariprasad@chelsio.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, leedom@chelsio.com, nirranjan@chelsio.com
Subject: Re: [PATCH net-next 2/4] cxgb4: For T4, don't read the Firmware Mailbox Control register
Date: Wed, 30 Sep 2015 17:50:55 +0300	[thread overview]
Message-ID: <560BF6CF.8050208@cogentembedded.com> (raw)
In-Reply-To: <1443623089-10039-3-git-send-email-hariprasad@chelsio.com>

Hello.

On 09/30/2015 05:24 PM, Hariprasad Shenai wrote:

> T4 doesn't have the Shadow copy of the register which we can read without
> side effect. So don't read mbox control register for T4 adapter
>
> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
> ---
>   drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 18 +++++++++++++-----
>   1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> index 0a87a32..c20b41c 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> @@ -1134,12 +1134,20 @@ static int mbox_show(struct seq_file *seq, void *v)
>   	unsigned int mbox = (uintptr_t)seq->private & 7;
>   	struct adapter *adap = seq->private - mbox;
>   	void __iomem *addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A);
> -	unsigned int ctrl_reg = (is_t4(adap->params.chip)
> -				 ? CIM_PF_MAILBOX_CTRL_A
> -				 : CIM_PF_MAILBOX_CTRL_SHADOW_COPY_A);
> -	void __iomem *ctrl = adap->regs + PF_REG(mbox, ctrl_reg);
>
> -	i = MBOWNER_G(readl(ctrl));
> +	/* For T4 we don't have a shadow copy of the Mailbox Control register.
> +	 * And since reading that real register causes a side effect of
> +	 * granting ownership, we're best of simply not reading it at all.
> +	 */
> +	if (is_t4(adap->params.chip))
> +		i = 4; /* index of "<unread>" */

    The kernel CodingStyle dictates that you should enclose all branches in {} 
if at least one branch has it.

> +	else {
> +		unsigned int ctrl_reg = CIM_PF_MAILBOX_CTRL_SHADOW_COPY_A;
> +		void __iomem *ctrl = adap->regs + PF_REG(mbox, ctrl_reg);
> +
> +		i = MBOWNER_G(readl(ctrl));
> +	}
> +
>   	seq_printf(seq, "mailbox owned by %s\n\n", owner[i]);
>
>   	for (i = 0; i < MBOX_LEN; i += 8)

MBR, Sergei

  reply	other threads:[~2015-09-30 14:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 14:24 [PATCH net-next 0/4] cxgb4: Trivial fixes for cxgb4 Hariprasad Shenai
2015-09-30 14:24 ` [PATCH net-next 1/4] cxgb4 : Update T4/T5/T6 register ranges Hariprasad Shenai
2015-09-30 14:24 ` [PATCH net-next 2/4] cxgb4: For T4, don't read the Firmware Mailbox Control register Hariprasad Shenai
2015-09-30 14:50   ` Sergei Shtylyov [this message]
2015-09-30 14:24 ` [PATCH net-next 3/4] cxgb4: Adds a new Device Log Facility FW_DEVLOG_FACILITY_CF Hariprasad Shenai
2015-09-30 14:24 ` [PATCH net-next 4/4] cxgb4: Report correct link speed for unsupported ones Hariprasad Shenai

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=560BF6CF.8050208@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=hariprasad@chelsio.com \
    --cc=leedom@chelsio.com \
    --cc=netdev@vger.kernel.org \
    --cc=nirranjan@chelsio.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).