netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Vadym Kochan <vadym.kochan@plvision.eu>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@mellanox.com>,
	Ido Schimmel <idosch@mellanox.com>, Andrew Lunn <andrew@lunn.ch>,
	Oleksandr Mazur <oleksandr.mazur@plvision.eu>,
	Serhiy Boiko <serhiy.boiko@plvision.eu>,
	Serhiy Pshyk <serhiy.pshyk@plvision.eu>,
	Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu>,
	Taras Chornyi <taras.chornyi@plvision.eu>,
	Andrii Savka <andrii.savka@plvision.eu>,
	netdev <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mickey Rachamim <mickeyr@marvell.com>
Subject: Re: [PATCH net-next v7 1/6] net: marvell: prestera: Add driver for Prestera family ASIC devices
Date: Tue, 8 Sep 2020 12:38:04 +0300	[thread overview]
Message-ID: <CAHp75VdyahsNyOK9_7mFGHFg_O47jVQWro-mhU0n=1K17Eeg8Q@mail.gmail.com> (raw)
In-Reply-To: <20200908083514.GB3562@plvision.eu>

On Tue, Sep 8, 2020 at 11:35 AM Vadym Kochan <vadym.kochan@plvision.eu> wrote:
> On Fri, Sep 04, 2020 at 10:12:07PM +0300, Andy Shevchenko wrote:
> > On Fri, Sep 4, 2020 at 7:52 PM Vadym Kochan <vadym.kochan@plvision.eu> wrote:

...

> > > +       words[3] |= FIELD_PREP(PRESTERA_W3_HW_DEV_NUM, (dsa->hw_dev_num >> 5));
> >
> > Ditto.
> >
> I am not sure 5 needs to be defined as macro as it just moves
> hw_dev_num's higher bits into the last word.

And why 5? I want 6, for example!

...

> > > +       err = prestera_switch_init(sw);
> > > +       if (err) {
> > > +               kfree(sw);
> >
> > > +               return err;
> > > +       }
> > > +
> > > +       return 0;
> >
> > return err;
> >
> why not keep 'return 0' as indication of success point ?

Simple longer, but I'm not insisting. Your choice.

...

> > > +                       if (b == 0)
> > > +                               continue;
> > > +
> > > +                       prestera_sdma_rx_desc_set_next(sdma,
> > > +                                                      ring->bufs[b - 1].desc,
> > > +                                                      buf->desc_dma);
> > > +
> > > +                       if (b == PRESTERA_SDMA_RX_DESC_PER_Q - 1)
> > > +                               prestera_sdma_rx_desc_set_next(sdma, buf->desc,
> > > +                                                              head->desc_dma);
> >
> > I guess knowing what the allowed range of bnum the above can be optimized.
> >
> You mean to replace PRESTERA_SDMA_RX_DESC_PER_Q by bnum ?

I don't know what you meant in above. It might be a bug, it might be
that bnum is redundant and this definition may be used everywhere...
But I believe there is room for improvement when I see pattern like

  for (i < X) {
    ...
    if (i == 0) {
      ...
    } else if (i == X - 1) {
      ...
    }
  }

Either it can be while-loop (or do-while) with better semantics for
the first and last item to handle or something else.
Example from another review [1] in case you wonder how changes can be
made. Just think about it.

[1]: https://www.spinics.net/lists/linux-pci/msg60826.html (before)
https://www.spinics.net/lists/linux-pci/msg62043.html (after)

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2020-09-08  9:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 16:52 [PATCH net-next v7 0/6] net: marvell: prestera: Add Switchdev driver for Prestera family ASIC device 98DX3255 (AC3x) Vadym Kochan
2020-09-04 16:52 ` [PATCH net-next v7 1/6] net: marvell: prestera: Add driver for Prestera family ASIC devices Vadym Kochan
2020-09-04 19:12   ` Andy Shevchenko
2020-09-07  7:30     ` Vadym Kochan
2020-09-07  7:55       ` Andy Shevchenko
2020-09-09 14:17         ` Vadym Kochan
2020-09-08  8:35     ` Vadym Kochan
2020-09-08  9:38       ` Andy Shevchenko [this message]
2020-09-09 14:00         ` Vadym Kochan
2020-09-09 14:09           ` Andy Shevchenko
2020-09-10  8:25     ` Vadym Kochan
2020-09-10 11:28       ` Andy Shevchenko
2020-09-04 16:52 ` [PATCH net-next v7 2/6] net: marvell: prestera: Add PCI interface support Vadym Kochan
2020-09-04 19:25   ` Andy Shevchenko
2020-09-04 16:52 ` [PATCH net-next v7 3/6] net: marvell: prestera: Add basic devlink support Vadym Kochan
2020-09-04 16:52 ` [PATCH net-next v7 4/6] net: marvell: prestera: Add ethtool interface support Vadym Kochan
2020-09-04 19:38   ` Andy Shevchenko
2020-09-04 16:52 ` [PATCH net-next v7 5/6] net: marvell: prestera: Add Switchdev driver implementation Vadym Kochan
2020-09-04 19:41   ` Andy Shevchenko
2020-09-10  7:03     ` Vadym Kochan
2020-09-04 16:52 ` [PATCH net-next v7 6/6] dt-bindings: marvell,prestera: Add description for device-tree bindings Vadym Kochan

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='CAHp75VdyahsNyOK9_7mFGHFg_O47jVQWro-mhU0n=1K17Eeg8Q@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=andrii.savka@plvision.eu \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mickeyr@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=oleksandr.mazur@plvision.eu \
    --cc=serhiy.boiko@plvision.eu \
    --cc=serhiy.pshyk@plvision.eu \
    --cc=taras.chornyi@plvision.eu \
    --cc=vadym.kochan@plvision.eu \
    --cc=volodymyr.mytnyk@plvision.eu \
    /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).