netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Arun.Ramadoss@microchip.com
Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	Woojung.Huh@microchip.com, pabeni@redhat.com,
	edumazet@google.com, f.fainelli@gmail.com, kuba@kernel.org,
	kernel@pengutronix.de, dsahern@kernel.org, san@skov.dk,
	willemb@google.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, horms@kernel.org,
	UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next v3 8/9] net: dsa: microchip: init predictable IPV to queue mapping for all non KSZ8xxx variants
Date: Mon, 8 Apr 2024 07:00:39 +0200	[thread overview]
Message-ID: <ZhN5923xUnC3LI0M@pengutronix.de> (raw)
In-Reply-To: <39a736262d87b06ad65e67753c440a1d489c8f8c.camel@microchip.com>

Hi Arun,

On Mon, Apr 08, 2024 at 03:41:46AM +0000, Arun.Ramadoss@microchip.com wrote:
> Hi Oleksij,
> 
> > +static int ksz9477_set_default_prio_queue_mapping(struct ksz_device
> > *dev,
> > +                                                 int port)
> > +{
> > +       u32 queue_map = 0;
> > +       int ipv;
> 
> Just a suggestion for readability: if you can use common variable for
> counter variable like cnt or n similar to return variable ret, it will
> be easier to follow instead of ipv here, queue in other function. 

Sorry, I disagree here. Variable name should describe the purpose of it,
especially if things got complicated. If other function uses "queue" as
variable name but actually ipv is the meaning of it, then it should be
renamed.

> > +
> > +       for (ipv = 0; ipv < dev->info->num_ipvs; ipv++) {
> > +               int queue;
> > +
> > +               /* Traffic Type (TT) is corresponding to the Internal
> > Priority
> > +                * Value (IPV) in the switch. Traffic Class (TC) is
> > +                * corresponding to the queue in the switch.
> > +                */
> > +               queue = ieee8021q_tt_to_tc(ipv, dev->info-
> > >num_tx_queues);
> > +               if (queue < 0)
> > +                       return queue;
> 
> what happens if the num_tx_queues value passed is other than 1 to 8.
> For ex: if it is 9, then ieee8021q_tt_to_tc( ) generates pr_warn as
> invalid number of queue and return queue as 0. if will not execute, so
> queue_map will be updated. Do we need check for valid range of values
> instead of just queue < 0. 
> 
> Not sure this scenario can occur.  

Good point, I should fix ieee8021q_tt_to_tc(), it should return -EINVAL
instead.

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2024-04-08  5:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  9:52 [PATCH net-next v3 0/9] Enhanced DCB and DSCP Support for KSZ Switches Oleksij Rempel
2024-04-05  9:52 ` [PATCH net-next v3 1/9] net: dsa: add support for DCB get/set apptrust configuration Oleksij Rempel
2024-04-05  9:52 ` [PATCH net-next v3 2/9] net: dsa: microchip: add IPV information support Oleksij Rempel
2024-04-05  9:52 ` [PATCH net-next v3 3/9] net: add IEEE 802.1q specific helpers Oleksij Rempel
2024-04-05  9:52 ` [PATCH net-next v3 4/9] net: dsa: microchip: add multi queue support for KSZ88X3 variants Oleksij Rempel
2024-04-05  9:52 ` [PATCH net-next v3 5/9] net: dsa: microchip: add support for different DCB app configurations Oleksij Rempel
2024-04-05  9:52 ` [PATCH net-next v3 6/9] net: dsa: microchip: dcb: add special handling for KSZ88X3 family Oleksij Rempel
2024-04-05  9:52 ` [PATCH net-next v3 7/9] net: dsa: microchip: enable ETS support for KSZ989X variants Oleksij Rempel
2024-04-08  3:52   ` Arun.Ramadoss
2024-04-05  9:52 ` [PATCH net-next v3 8/9] net: dsa: microchip: init predictable IPV to queue mapping for all non KSZ8xxx variants Oleksij Rempel
2024-04-08  3:41   ` Arun.Ramadoss
2024-04-08  5:00     ` Oleksij Rempel [this message]
2024-04-05  9:52 ` [PATCH net-next v3 9/9] net: dsa: microchip: let DCB code do PCP and DSCP policy configuration Oleksij Rempel

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=ZhN5923xUnC3LI0M@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=Arun.Ramadoss@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=horms@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=san@skov.dk \
    --cc=willemb@google.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).