netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Michael Walle <michael@walle.cc>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Alexandru Marginean <alexandru.marginean@nxp.com>,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: Re: [PATCH v2 net 3/6] net: enetc: take the MDIO lock only once per NAPI poll cycle
Date: Fri, 26 Feb 2021 01:00:26 +0200	[thread overview]
Message-ID: <20210225230026.gvtm3esbmrfb5dk5@skbuf> (raw)
In-Reply-To: <YDgqI8eGDpJKxiLY@lunn.ch>

On Thu, Feb 25, 2021 at 11:52:19PM +0100, Andrew Lunn wrote:
> On Thu, Feb 25, 2021 at 02:18:32PM +0200, Vladimir Oltean wrote:
> > @@ -327,8 +329,8 @@ static void enetc_get_tx_tstamp(struct enetc_hw *hw, union enetc_tx_bd *txbd,
> >  {
> >  	u32 lo, hi, tstamp_lo;
> >  
> > -	lo = enetc_rd(hw, ENETC_SICTR0);
> > -	hi = enetc_rd(hw, ENETC_SICTR1);
> > +	lo = enetc_rd_hot(hw, ENETC_SICTR0);
> > +	hi = enetc_rd_hot(hw, ENETC_SICTR1);
> >  	tstamp_lo = le32_to_cpu(txbd->wb.tstamp);
> >  	if (lo <= tstamp_lo)
> >  		hi -= 1;
> 
> Hi Vladimir
> 
> This change is not obvious, and there is no mention of it in the
> commit message. Please could you explain it. I guess it is to do with
> enetc_get_tx_tstamp() being called with the MDIO lock held now, when
> it was not before?

I realize this is an uncharacteristically short commit message and I'm
sorry for that, if needed I can resend.

Your assumption is correct, the new call path is:

enetc_msix
-> napi_schedule
   -> enetc_poll
      -> enetc_lock_mdio
      -> enetc_clean_tx_ring
         -> enetc_get_tx_tstamp
      -> enetc_clean_rx_ring
      -> enetc_unlock_mdio

The 'hot' accessors are for normal, 'unlocked' register reads and
writes, while enetc_rd contains enetc_lock_mdio, followed by the actual
read, followed by enetc_unlock_mdio.

The goal is to eventually get rid of all the _hot stuff and always take
the lock from the top level, this would allow us to do more register
read/write batching and that would amortize the cost of the locking
overall.

  reply	other threads:[~2021-02-25 23:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25 12:18 [PATCH v2 net 0/6] Fixes for NXP ENETC driver Vladimir Oltean
2021-02-25 12:18 ` [PATCH v2 net 1/6] net: enetc: don't overwrite the RSS indirection table when initializing Vladimir Oltean
2021-02-25 12:18 ` [PATCH v2 net 2/6] net: enetc: initialize RFS/RSS memories for unused ports too Vladimir Oltean
2021-02-27 13:19   ` Michael Walle
2021-02-25 12:18 ` [PATCH v2 net 3/6] net: enetc: take the MDIO lock only once per NAPI poll cycle Vladimir Oltean
2021-02-25 22:52   ` Andrew Lunn
2021-02-25 23:00     ` Vladimir Oltean [this message]
2021-02-25 23:08       ` Vladimir Oltean
2021-02-25 12:18 ` [PATCH v2 net 4/6] net: enetc: fix incorrect TPID when receiving 802.1ad tagged packets Vladimir Oltean
2021-02-25 12:18 ` [PATCH v2 net 5/6] net: enetc: don't disable VLAN filtering in IFF_PROMISC mode Vladimir Oltean
2021-02-26 23:28   ` Jakub Kicinski
2021-02-26 23:42     ` Vladimir Oltean
2021-02-26 23:49       ` Jakub Kicinski
2021-02-27  0:16         ` Vladimir Oltean
2021-02-27  0:45           ` Jakub Kicinski
2021-02-27  0:49             ` Vladimir Oltean
2021-02-27 13:18           ` Michael Walle
2021-02-28 22:48             ` Vladimir Oltean
2021-03-01 14:36               ` Michael Walle
2021-03-01 15:08                 ` Vladimir Oltean
2021-03-01 16:26                   ` Markus Blöchl
2021-03-01 17:02                     ` Vladimir Oltean
2021-03-01 20:17                       ` Jakub Kicinski
2021-02-25 12:18 ` [PATCH v2 net 6/6] net: enetc: force the RGMII speed and duplex instead of operating in inband mode Vladimir Oltean
2021-02-25 17:14   ` Russell King - ARM Linux admin

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=20210225230026.gvtm3esbmrfb5dk5@skbuf \
    --to=olteanv@gmail.com \
    --cc=alexandru.marginean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=michael@walle.cc \
    --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).