From: Herve Codina <herve.codina@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Yury Norov <yury.norov@gmail.com>,
netdev@vger.kernel.org,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-kernel@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Mark Brown <broonie@kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linuxppc-dev@lists.ozlabs.org,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v4 4/5] net: wan: fsl_qmc_hdlc: Add runtime timeslots changes support
Date: Fri, 23 Feb 2024 17:46:35 +0100 [thread overview]
Message-ID: <20240223174635.43e8b2f4@bootlin.com> (raw)
In-Reply-To: <Zddslpw398MJ49SS@smile.fi.intel.com>
Hi Andy,
On Thu, 22 Feb 2024 17:47:34 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
...
> > +static int qmc_hdlc_xlate_slot_map(struct qmc_hdlc *qmc_hdlc,
> > + u32 slot_map, struct qmc_chan_ts_info *ts_info)
> > +{
> > + DECLARE_BITMAP(ts_mask_avail, 64);
> > + DECLARE_BITMAP(ts_mask, 64);
> > + DECLARE_BITMAP(map, 64);
>
> Perhaps more 1:1 naming?
>
> DECLARE_BITMAP(rx_ts_mask_avail, 64);
> DECLARE_BITMAP(tx_ts_mask, 64);
> DECLARE_BITMAP(slot_map, 64);
I disagree.
I first check that ts_info->rx_ts_mask_avail and ts_info->tx_ts_mask_avail are
identical then I use one of them to create the ts_mask_avail.
Then I compute the ts_mask and update both ts_info->tx_ts_mask and
ts_info->rx_ts_mask.
ts_mask_avail and ts_mask bitmaps are used for tx and rx.
I could name them txrx_ts_mask* but that doesn't do much.
For DECLARE_BITMAP(slot_map, 64), slot_map is the name of the function
parameter...
I think we can keep 'map' for the bitmap here.
>
> > + /* Tx and Rx available masks must be identical */
> > + if (ts_info->rx_ts_mask_avail != ts_info->tx_ts_mask_avail) {
> > + dev_err(qmc_hdlc->dev, "tx and rx available timeslots mismatch (0x%llx, 0x%llx)\n",
> > + ts_info->rx_ts_mask_avail, ts_info->tx_ts_mask_avail);
> > + return -EINVAL;
> > + }
> > +
> > + bitmap_from_u64(ts_mask_avail, ts_info->rx_ts_mask_avail);
> > + bitmap_from_u64(map, slot_map);
> > + bitmap_scatter(ts_mask, map, ts_mask_avail, 64);
> > +
> > + if (bitmap_weight(ts_mask, 64) != bitmap_weight(map, 64)) {
> > + dev_err(qmc_hdlc->dev, "Cannot translate timeslots %*pb -> (%*pb, %*pb)\n",
> > + 64, map, 64, ts_mask_avail, 64, ts_mask);
>
>
> You can save a bit of code and stack:
Will be updated in the next iteration.
...
> > + ret = qmc_chan_get_ts_info(qmc_hdlc->qmc_chan, &ts_info);
> > + if (ret) {
> > + dev_err(qmc_hdlc->dev, "get QMC channel ts info failed %d\n", ret);
> > + return ret;
>
> return dev_err_probe(...);
Will be updated too :)
>
> > + }
>
Thanks for the review,
Hervé
WARNING: multiple messages have this Message-ID (diff)
From: Herve Codina <herve.codina@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Yury Norov <yury.norov@gmail.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, Andrew Lunn <andrew@lunn.ch>,
Mark Brown <broonie@kernel.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v4 4/5] net: wan: fsl_qmc_hdlc: Add runtime timeslots changes support
Date: Fri, 23 Feb 2024 17:46:35 +0100 [thread overview]
Message-ID: <20240223174635.43e8b2f4@bootlin.com> (raw)
In-Reply-To: <Zddslpw398MJ49SS@smile.fi.intel.com>
Hi Andy,
On Thu, 22 Feb 2024 17:47:34 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
...
> > +static int qmc_hdlc_xlate_slot_map(struct qmc_hdlc *qmc_hdlc,
> > + u32 slot_map, struct qmc_chan_ts_info *ts_info)
> > +{
> > + DECLARE_BITMAP(ts_mask_avail, 64);
> > + DECLARE_BITMAP(ts_mask, 64);
> > + DECLARE_BITMAP(map, 64);
>
> Perhaps more 1:1 naming?
>
> DECLARE_BITMAP(rx_ts_mask_avail, 64);
> DECLARE_BITMAP(tx_ts_mask, 64);
> DECLARE_BITMAP(slot_map, 64);
I disagree.
I first check that ts_info->rx_ts_mask_avail and ts_info->tx_ts_mask_avail are
identical then I use one of them to create the ts_mask_avail.
Then I compute the ts_mask and update both ts_info->tx_ts_mask and
ts_info->rx_ts_mask.
ts_mask_avail and ts_mask bitmaps are used for tx and rx.
I could name them txrx_ts_mask* but that doesn't do much.
For DECLARE_BITMAP(slot_map, 64), slot_map is the name of the function
parameter...
I think we can keep 'map' for the bitmap here.
>
> > + /* Tx and Rx available masks must be identical */
> > + if (ts_info->rx_ts_mask_avail != ts_info->tx_ts_mask_avail) {
> > + dev_err(qmc_hdlc->dev, "tx and rx available timeslots mismatch (0x%llx, 0x%llx)\n",
> > + ts_info->rx_ts_mask_avail, ts_info->tx_ts_mask_avail);
> > + return -EINVAL;
> > + }
> > +
> > + bitmap_from_u64(ts_mask_avail, ts_info->rx_ts_mask_avail);
> > + bitmap_from_u64(map, slot_map);
> > + bitmap_scatter(ts_mask, map, ts_mask_avail, 64);
> > +
> > + if (bitmap_weight(ts_mask, 64) != bitmap_weight(map, 64)) {
> > + dev_err(qmc_hdlc->dev, "Cannot translate timeslots %*pb -> (%*pb, %*pb)\n",
> > + 64, map, 64, ts_mask_avail, 64, ts_mask);
>
>
> You can save a bit of code and stack:
Will be updated in the next iteration.
...
> > + ret = qmc_chan_get_ts_info(qmc_hdlc->qmc_chan, &ts_info);
> > + if (ret) {
> > + dev_err(qmc_hdlc->dev, "get QMC channel ts info failed %d\n", ret);
> > + return ret;
>
> return dev_err_probe(...);
Will be updated too :)
>
> > + }
>
Thanks for the review,
Hervé
next prev parent reply other threads:[~2024-02-23 16:47 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 14:22 [PATCH v4 0/5] Add support for QMC HDLC Herve Codina
2024-02-22 14:22 ` Herve Codina
2024-02-22 14:22 ` [PATCH v4 1/5] net: wan: " Herve Codina
2024-02-22 14:22 ` Herve Codina
2024-02-22 15:29 ` Andy Shevchenko
2024-02-22 15:29 ` Andy Shevchenko
2024-02-22 16:45 ` Herve Codina
2024-02-22 16:45 ` Herve Codina
2024-02-22 16:56 ` Andy Shevchenko
2024-02-22 16:56 ` Andy Shevchenko
2024-02-22 17:45 ` Herve Codina
2024-02-22 17:45 ` Herve Codina
2024-02-22 14:22 ` [PATCH v4 2/5] MAINTAINERS: Add the Freescale QMC HDLC driver entry Herve Codina
2024-02-22 14:22 ` Herve Codina
2024-02-22 14:22 ` [PATCH v4 3/5] lib/bitmap: Introduce bitmap_scatter() and bitmap_gather() helpers Herve Codina
2024-02-22 14:22 ` Herve Codina
2024-02-22 15:39 ` Andy Shevchenko
2024-02-22 15:39 ` Andy Shevchenko
2024-02-22 15:40 ` Andy Shevchenko
2024-02-22 15:40 ` Andy Shevchenko
2024-02-22 16:49 ` Herve Codina
2024-02-22 16:49 ` Herve Codina
2024-02-22 21:50 ` Yury Norov
2024-02-22 21:50 ` Yury Norov
2024-02-23 10:07 ` Herve Codina
2024-02-23 10:07 ` Herve Codina
2024-02-22 14:22 ` [PATCH v4 4/5] net: wan: fsl_qmc_hdlc: Add runtime timeslots changes support Herve Codina
2024-02-22 14:22 ` Herve Codina
2024-02-22 15:47 ` Andy Shevchenko
2024-02-22 15:47 ` Andy Shevchenko
2024-02-23 16:46 ` Herve Codina [this message]
2024-02-23 16:46 ` Herve Codina
2024-02-22 14:22 ` [PATCH v4 5/5] net: wan: fsl_qmc_hdlc: Add framer support Herve Codina
2024-02-22 14:22 ` Herve Codina
2024-02-22 15:49 ` Andy Shevchenko
2024-02-22 15:49 ` Andy Shevchenko
2024-02-29 12:56 ` Herve Codina
2024-02-29 12:56 ` Herve Codina
2024-02-29 13:58 ` Andy Shevchenko
2024-02-29 13:58 ` Andy Shevchenko
2024-02-29 14:15 ` Herve Codina
2024-02-29 14:15 ` Herve Codina
2024-02-22 15:50 ` [PATCH v4 0/5] Add support for QMC HDLC Andy Shevchenko
2024-02-22 15:50 ` Andy Shevchenko
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=20240223174635.43e8b2f4@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vadim.fedorenko@linux.dev \
--cc=yury.norov@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.