netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Conor Dooley <conor.dooley@microchip.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	daire.mcnamara@microchip.com, nicolas.ferre@microchip.com,
	claudiu.beznea@microchip.com, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH v2 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs
Date: Fri, 21 Apr 2023 16:05:19 +0200	[thread overview]
Message-ID: <ZEKYH0FblGmAOkiP@corigine.com> (raw)
In-Reply-To: <20230420-absinthe-broiler-b992997c6cc5@wendy>

On Thu, Apr 20, 2023 at 08:18:35AM +0100, Conor Dooley wrote:
> Jaukb, Simon,
> 
> On Wed, Apr 19, 2023 at 06:02:22PM -0700, Jakub Kicinski wrote:
> > On Tue, 18 Apr 2023 16:28:25 +0200 Simon Horman wrote:
> 
> [readding the context]
> 
> > > > static const struct macb_config sama7g5_gem_config = {
> > > > @@ -4986,8 +4985,17 @@ static int macb_probe(struct platform_device *pdev)
> > > >       bp->tx_clk = tx_clk;
> > > >       bp->rx_clk = rx_clk;
> > > >       bp->tsu_clk = tsu_clk;
> > > > -     if (macb_config)
> > > > +     if (macb_config) {
> > > > +             if (hw_is_gem(bp->regs, bp->native_io)) {
> > > > +                     if (macb_config->max_tx_length)
> > > > +                             bp->max_tx_length = macb_config->max_tx_length;
> > > > +                     else
> > > > +                             bp->max_tx_length = GEM_MAX_TX_LEN;
> > > > +             } else {
> > > > +                     bp->max_tx_length = MACB_MAX_TX_LEN;
> > > > +             }
> 
> > > no need to refresh the patch on my account.
> > > But can the above be simplified as:
> > > 
> > >                if (macb_is_gem(bp) && hw_is_gem(bp->regs, bp->native_io))
> > >                        bp->max_tx_length = macb_config->max_tx_length;
> > >                else
> > >                        bp->max_tx_length = MACB_MAX_TX_LEN;
> > 
> > I suspect that DaveM agreed, because patch is set to Changes Requested
> > in patchwork :) 
> > 
> > Daire, please respin with Simon's suggestion.
> 
> I'm feeling a bit stupid reading this suggestion as I am not sure how it
> is supposed to work :(

Hi Conor, all,

just to clarify, my suggestion was at a slightly higher level regarding
the arrangement of logic statements:

	if (a)
		if (b)

	vs

	if (a && b)

I think your concerns are deeper and, in my reading of them, ought
to be addressed.

> Firstly, why macb_is_gem() and hw_is_gem()? They both do the same thing,
> except last time around we established that macb_is_gem() cannot return
> anything other than false at this point.
> What have I missed here?
> 
> Secondly, is it guaranteed that macb_config::max_tx_length is even
> set?
> 
> Also, another question...
> Is it even possible for `if (macb_config)` to be false?
> Isn't it either going to be set to &default_gem_config or to
> match->data, no? The driver is pretty inconsistent about if it checks
> whether macb_config is non-NULL before accessing it, but from reading
> .probe, it seems to be like it is always set to something valid at this
> point.
> 
> (btw Daire, Nicolas' email has no h in it)
> 
> Cheers,
> Conor.



  reply	other threads:[~2023-04-21 14:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 14:00 [PATCH v2 0/1] Adjust macb max_tx_len for mpfs daire.mcnamara
2023-04-17 14:00 ` [PATCH v2 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs daire.mcnamara
2023-04-18 14:28   ` Simon Horman
2023-04-20  1:02     ` Jakub Kicinski
2023-04-20  7:18       ` Conor Dooley
2023-04-21 14:05         ` Simon Horman [this message]
2023-04-21 16:39           ` Conor Dooley
2023-04-21 17:43             ` Simon Horman

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=ZEKYH0FblGmAOkiP@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.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).