From: <Arun.Ramadoss@microchip.com>
To: <andrew@lunn.ch>, <olteanv@gmail.com>, <davem@davemloft.net>,
<Woojung.Huh@microchip.com>, <pabeni@redhat.com>,
<o.rempel@pengutronix.de>, <edumazet@google.com>,
<f.fainelli@gmail.com>, <kuba@kernel.org>
Cc: <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 v5 4/9] net: dsa: microchip: add multi queue support for KSZ88X3 variants
Date: Tue, 9 Apr 2024 14:14:04 +0000 [thread overview]
Message-ID: <78e905b30c3c19ca74a651c0a541965abafda266.camel@microchip.com> (raw)
In-Reply-To: <20240409081851.3530641-5-o.rempel@pengutronix.de>
Hi Oleksij,
>
> -static void ksz8795_set_prio_queue(struct ksz_device *dev, int port,
> int queue)
> +static int ksz8_port_queue_split(struct ksz_device *dev, int port,
> int queues)
> {
> - u8 hi, lo;
> + u8 mask_4q, mask_2q;
> + u8 reg_4q, reg_2q;
> + u8 data_4q = 0;
> + u8 data_2q = 0;
> + int ret;
>
> - /* Number of queues can only be 1, 2, or 4. */
> - switch (queue) {
> - case 4:
> - case 3:
> - queue = PORT_QUEUE_SPLIT_4;
> - break;
> - case 2:
> - queue = PORT_QUEUE_SPLIT_2;
> - break;
> - default:
> - queue = PORT_QUEUE_SPLIT_1;
> + if (ksz_is_ksz88x3(dev)) {
> + mask_4q = KSZ8873_PORT_4QUEUE_SPLIT_EN;
> + mask_2q = KSZ8873_PORT_2QUEUE_SPLIT_EN;
> + reg_4q = REG_PORT_CTRL_0;
> + reg_2q = REG_PORT_CTRL_2;
> +
> + /* KSZ8795 family switches have Weighted Fair
> Queueing (WFQ)
> + * enabled by default. Enable it for KSZ8873 family
> switches
> + * too. Default value for KSZ8873 family is strict
> priority,
> + * which should be enabled by using
> TC_SETUP_QDISC_ETS, not
> + * by default.
> + */
> + ret = ksz_rmw8(dev, REG_SW_CTRL_3,
> WEIGHTED_FAIR_QUEUE_ENABLE,
> + WEIGHTED_FAIR_QUEUE_ENABLE);
> + if (ret)
> + return ret;
> + } else {
> + mask_4q = KSZ8795_PORT_4QUEUE_SPLIT_EN;
> + mask_2q = KSZ8795_PORT_2QUEUE_SPLIT_EN;
> + reg_4q = REG_PORT_CTRL_13;
> + reg_2q = REG_PORT_CTRL_0;
> +
> + /* TODO: this is legacy from initial KSZ8795 driver,
> should be
> + * moved to appropriate place in the future.
> + */
> + ret = ksz_rmw8(dev, REG_SW_CTRL_19,
> + SW_OUT_RATE_LIMIT_QUEUE_BASED,
> + SW_OUT_RATE_LIMIT_QUEUE_BASED);
> + if (ret)
> + return ret;
> }
> - ksz_pread8(dev, port, REG_PORT_CTRL_0, &lo);
> - ksz_pread8(dev, port, P_DROP_TAG_CTRL, &hi);
> - lo &= ~PORT_QUEUE_SPLIT_L;
> - if (queue & PORT_QUEUE_SPLIT_2)
> - lo |= PORT_QUEUE_SPLIT_L;
> - hi &= ~PORT_QUEUE_SPLIT_H;
> - if (queue & PORT_QUEUE_SPLIT_4)
> - hi |= PORT_QUEUE_SPLIT_H;
> - ksz_pwrite8(dev, port, REG_PORT_CTRL_0, lo);
> - ksz_pwrite8(dev, port, P_DROP_TAG_CTRL, hi);
> -
> - /* Default is port based for egress rate limit. */
> - if (queue != PORT_QUEUE_SPLIT_1)
> - ksz_cfg(dev, REG_SW_CTRL_19,
> SW_OUT_RATE_LIMIT_QUEUE_BASED,
> - true);
> +
> + if (queues == 4)
> + data_4q = mask_4q;
> + if (queues == 2)
> + data_2q = mask_2q;
nitpick: it should be else if.
Otherwise:
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> +
> + ret = ksz_prmw8(dev, port, reg_4q, mask_4q, data_4q);
> + if (ret)
> + return ret;
> +
> + return ksz_prmw8(dev, port, reg_2q, mask_2q, data_2q);
> }
>
>
next prev parent reply other threads:[~2024-04-09 14:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 8:18 [PATCH net-next v5 0/9] Enhanced DCB and DSCP Support for KSZ Switches Oleksij Rempel
2024-04-09 8:18 ` [PATCH net-next v5 1/9] net: dsa: add support for DCB get/set apptrust configuration Oleksij Rempel
2024-04-09 14:03 ` Daniel Machon
2024-04-09 8:18 ` [PATCH net-next v5 2/9] net: dsa: microchip: add IPV information support Oleksij Rempel
2024-04-09 8:18 ` [PATCH net-next v5 3/9] net: add IEEE 802.1q specific helpers Oleksij Rempel
2024-04-09 16:08 ` Vladimir Oltean
2024-04-09 8:18 ` [PATCH net-next v5 4/9] net: dsa: microchip: add multi queue support for KSZ88X3 variants Oleksij Rempel
2024-04-09 14:14 ` Arun.Ramadoss [this message]
2024-04-09 8:18 ` [PATCH net-next v5 5/9] net: dsa: microchip: add support for different DCB app configurations Oleksij Rempel
2024-04-09 13:53 ` Arun.Ramadoss
2024-04-09 8:18 ` [PATCH net-next v5 6/9] net: dsa: microchip: dcb: add special handling for KSZ88X3 family Oleksij Rempel
2024-04-09 13:58 ` Arun.Ramadoss
2024-04-09 8:18 ` [PATCH net-next v5 7/9] net: dsa: microchip: enable ETS support for KSZ989X variants Oleksij Rempel
2024-04-09 8:18 ` [PATCH net-next v5 8/9] net: dsa: microchip: init predictable IPV to queue mapping for all non KSZ8xxx variants Oleksij Rempel
2024-04-09 8:18 ` [PATCH net-next v5 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=78e905b30c3c19ca74a651c0a541965abafda266.camel@microchip.com \
--to=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=o.rempel@pengutronix.de \
--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
Powered by JetHome