netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Vladimir Oltean <olteanv@gmail.com>,
	vivien.didelot@gmail.com, andrew@lunn.ch, davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v2 net-next 2/3] net: dsa: Make deferred_xmit private to sja1105
Date: Sat, 4 Jan 2020 20:39:16 -0800	[thread overview]
Message-ID: <06cfe113-745c-5a67-1eae-b1305943f46f@gmail.com> (raw)
In-Reply-To: <20200104003711.18366-3-olteanv@gmail.com>



On 1/3/2020 4:37 PM, Vladimir Oltean wrote:
> There are 3 things that are wrong with the DSA deferred xmit mechanism:
> 
> 1. Its introduction has made the DSA hotpath ever so slightly more
>    inefficient for everybody, since DSA_SKB_CB(skb)->deferred_xmit needs
>    to be initialized to false for every transmitted frame, in order to
>    figure out whether the driver requested deferral or not (a very rare
>    occasion, rare even for the only driver that does use this mechanism:
>    sja1105). That was necessary to avoid kfree_skb from freeing the skb.
> 
> 2. Because L2 PTP is a link-local protocol like STP, it requires
>    management routes and deferred xmit with this switch. But as opposed
>    to STP, the deferred work mechanism needs to schedule the packet
>    rather quickly for the TX timstamp to be collected in time and sent
>    to user space. But there is no provision for controlling the
>    scheduling priority of this deferred xmit workqueue. Too bad this is
>    a rather specific requirement for a feature that nobody else uses
>    (more below).
> 
> 3. Perhaps most importantly, it makes the DSA core adhere a bit too
>    much to the NXP company-wide policy "Innovate Where It Doesn't
>    Matter". The sja1105 is probably the only DSA switch that requires
>    some frames sent from the CPU to be routed to the slave port via an
>    out-of-band configuration (register write) rather than in-band (DSA
>    tag). And there are indeed very good reasons to not want to do that:
>    if that out-of-band register is at the other end of a slow bus such
>    as SPI, then you limit that Ethernet flow's throughput to effectively
>    the throughput of the SPI bus. So hardware vendors should definitely
>    not be encouraged to design this way. We do _not_ want more
>    widespread use of this mechanism.
> 
> Luckily we have a solution for each of the 3 issues:
> 
> For 1, we can just remove that variable in the skb->cb and counteract
> the effect of kfree_skb with skb_get, much to the same effect. The
> advantage, of course, being that anybody who doesn't use deferred xmit
> doesn't need to do any extra operation in the hotpath.
> 
> For 2, we can create a kernel thread for each port's deferred xmit work.
> If the user switch ports are named swp0, swp1, swp2, the kernel threads
> will be named swp0_xmit, swp1_xmit, swp2_xmit (there appears to be a 15
> character length limit on kernel thread names). With this, the user can
> change the scheduling priority with chrt $(pidof swp2_xmit).
> 
> For 3, we can actually move the entire implementation to the sja1105
> driver.
> 
> So this patch deletes the generic implementation from the DSA core and
> adds a new one, more adequate to the requirements of PTP TX
> timestamping, in sja1105_main.c.
> 
> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Vladimir Oltean <olteanv@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks for addressing this so quickly.
-- 
Florian

  reply	other threads:[~2020-01-05  4:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04  0:37 [PATCH v2 net-next 0/3] Improvements to the DSA deferred xmit Vladimir Oltean
2020-01-04  0:37 ` [PATCH v2 net-next 1/3] net: dsa: sja1105: Always send through management routes in slot 0 Vladimir Oltean
2020-01-05  4:42   ` Florian Fainelli
2020-01-04  0:37 ` [PATCH v2 net-next 2/3] net: dsa: Make deferred_xmit private to sja1105 Vladimir Oltean
2020-01-05  4:39   ` Florian Fainelli [this message]
2020-01-04  0:37 ` [PATCH v2 net-next 3/3] net: dsa: tag_sja1105: Slightly improve the Xmas tree in sja1105_xmit Vladimir Oltean
2020-01-05  4:40   ` Florian Fainelli
2020-01-05 23:13 ` [PATCH v2 net-next 0/3] Improvements to the DSA deferred xmit 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=06cfe113-745c-5a67-1eae-b1305943f46f@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.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).