netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Claudiu Manoil <claudiu.manoil@nxp.com>
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Alex Marginean <alexandru.marginean@nxp.com>,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: Re: [PATCH net-next] enetc: Workaround for MDIO register access issue
Date: Wed, 11 Nov 2020 00:05:25 +0100	[thread overview]
Message-ID: <20201110230525.GO1456319@lunn.ch> (raw)
In-Reply-To: <20201110154304.30871-1-claudiu.manoil@nxp.com>

On Tue, Nov 10, 2020 at 05:43:04PM +0200, Claudiu Manoil wrote:
> From: Alex Marginean <alexandru.marginean@nxp.com>
> 
> Due to a hardware issue, an access to MDIO registers
> that is concurrent with other ENETC register accesses
> may lead to the MDIO access being dropped or corrupted.
> The workaround introduces locking for all register accesses
> to the ENETC register space.  To reduce performance impact,
> a readers-writers locking scheme has been implemented.
> The writer in this case is the MDIO access code (irrelevant
> whether that MDIO access is a register read or write), and
> the reader is any access code to non-MDIO ENETC registers.
> Also, the datapath functions acquire the read lock fewer times
> and use _hot accessors.  All the rest of the code uses the _wa
> accessors which lock every register access.

Hi Claudiu

The code you are adding makes no comment about the odd using of
read/writer locks. This is going to confused people.

Please could you add helpers, probably as inline functions in a
header, which take/release the read_lock and the write_lock, which
don't use the name read_ or write_. Maybe something like
enetc_lock_mdio()/enetc_unlock_mdio(), enetc_lock_reg(),
enetc_unlock_reg(). Put comments by the helpers explaining what is
going on. That should help avoid future confusion and questions.

Thanks
	Andrew

  reply	other threads:[~2020-11-10 23:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 15:43 [PATCH net-next] enetc: Workaround for MDIO register access issue Claudiu Manoil
2020-11-10 23:05 ` Andrew Lunn [this message]
2020-11-11 11:41   ` Claudiu Manoil
2020-11-10 23:25 ` Florian Fainelli
2020-11-11 11:42   ` Claudiu Manoil
2020-11-11  3:16 ` Jakub Kicinski
2020-11-11 13:04   ` Claudiu Manoil

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=20201110230525.GO1456319@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alexandru.marginean@nxp.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vladimir.oltean@nxp.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).