From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: "Karumanchi, Vineeth" <vineeth@amd.com>,
vineeth.karumanchi@amd.com, nicolas.ferre@microchip.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com
Cc: git@amd.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 3/6] net: macb: Add IEEE 802.1Qbv TAPRIO REPLACE command offload support
Date: Thu, 31 Jul 2025 12:07:15 +0300 [thread overview]
Message-ID: <61d545dd-c32c-4cc3-94fb-53954eee365b@tuxon.dev> (raw)
In-Reply-To: <c296f03f-0146-4416-94ca-df262aa359d4@amd.com>
On 29.07.2025 11:59, Karumanchi, Vineeth wrote:
> Hi Claudiu,
>
> Thanks for the review.
>
> On 7/26/2025 5:55 PM, claudiu beznea (tuxon) wrote:
>>
>>
>> On 7/22/25 18:41, Vineeth Karumanchi wrote:
>>> Implement Time-Aware Traffic Scheduling (TAPRIO) hardware offload for
>
> <..>
>
>>
>> as it is used along with conf->num_entries which has size_t type.
>>
>>> +
>>> + /* Validate queue configuration */
>>> + if (bp->num_queues < 1 || bp->num_queues > MACB_MAX_QUEUES) {
>>
>> Can this happen?
>
> Yes, GEM in Zynq devices has single queue.
I was asking as it looked to me that this validates the number of queues
the IP supports, which should have already been validated in probe.
>
> Currently, TAPRIO offload validation depends solely on the presence
> of .ndo_setup_tc. On Zynq-based devices, if the user configures the
> scheduler using tc replace, the operation fails at this point.
I can't see how. That should translate into:
if (1 < 1 || 1 > 8)
which is in the end:
if (0)
Maybe it fails due to some other condition?
>
> <...>
>
>>> + /* All validations passed - proceed with hardware configuration */
>>> + spin_lock_irqsave(&bp->lock, flags);
>>
>> You can use guard(spinlock_irqsave)(&bp->lock) or
>> scoped_guard(spinlock_irqsave, &bp->lock)
>>
>
> ok, will leverage scoped_guard(spinlock_irqsave, &bp->lock).
>
>>> +
>>> + /* Disable ENST queues if running before configuring */
>>> + if (gem_readl(bp, ENST_CONTROL))
>>
>> Is this read necessary?
>>
>
> Not necessary, I thought of disabling only if enabled.
> But, will disable directly.
>
>>> + gem_writel(bp, ENST_CONTROL,
>>> + GENMASK(bp->num_queues - 1, 0) <<
>>> GEM_ENST_DISABLE_QUEUE_OFFSET);
>>
>> This could be replaced by GEM_BF(GENMASK(...), ENST_DISABLE_QUEUE) if you
>> define GEM_ENST_DISABLE_QUEUE_SIZE along with GEM_ENST_DISABLE_QUEUE_OFFSET.
>>
>
> I can leverage bp->queue_mask << GEM_ENST_DISABLE_QUEUE_OFFSET.
> And remove GEM_ENST_ENABLE_QUEUE(hw_q) and GEM_ENST_DISABLE_QUEUE(hw_q)
> implementations.
>
>>> +
>>> + for (i = 0; i < conf->num_entries; i++) {
>>> + queue = &bp->queues[enst_queue[i].queue_id];
>>> + /* Configure queue timing registers */
>>> + queue_writel(queue, ENST_START_TIME,
>>> enst_queue[i].start_time_mask);
>>> + queue_writel(queue, ENST_ON_TIME, enst_queue[i].on_time_bytes);
>>> + queue_writel(queue, ENST_OFF_TIME, enst_queue[i].off_time_bytes);
>>> + }
>>> +
>>> + /* Enable ENST for all configured queues in one write */
>>> + gem_writel(bp, ENST_CONTROL, configured_queues);
>>
>> Can this function be executed while other queues are configured? If so,
>> would the configured_queues contains it (as well as conf)?
>>
>
> No, the tc add/replace command re-configures all queues, replacing any
> previous setup. Parameters such as START_TIME, ON_TIME, and CYCLE_TIME are
> recalculated based on the new configuration.
>
>>> + spin_unlock_irqrestore(&bp->lock, flags);
>>> +
>>> + netdev_info(ndev, "TAPRIO configuration completed successfully: %lu
>>> entries, %d queues configured\n",
>>> + conf->num_entries, hweight32(configured_queues));
>>> +
>>> +cleanup:
>>> + kfree(enst_queue);
>>
>> With the suggestions above, this could be dropped.
>>
>
> ok.
Please check the documentation pointed by Andrew. With that, my suggestion
here should be dropped.
Thank you,
Claudiu
>
>
>> Thank you,
>> Claudiu
>>
>>> + return err;
>>> +}
>>> +
>>> static const struct net_device_ops macb_netdev_ops = {
>>> .ndo_open = macb_open,
>>> .ndo_stop = macb_close,
>>
>
> Thanks
next prev parent reply other threads:[~2025-07-31 9:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 15:41 [PATCH net-next 0/6] net: macb: Add TAPRIO traffic scheduling support Vineeth Karumanchi
2025-07-22 15:41 ` [PATCH net-next 1/6] net: macb: Define ENST hardware registers for time-aware scheduling Vineeth Karumanchi
2025-07-26 12:23 ` claudiu beznea (tuxon)
2025-07-22 15:41 ` [PATCH net-next 2/6] net: macb: Integrate ENST timing parameters and hardware unit conversion Vineeth Karumanchi
2025-07-26 12:24 ` claudiu beznea (tuxon)
2025-07-22 15:41 ` [PATCH net-next 3/6] net: macb: Add IEEE 802.1Qbv TAPRIO REPLACE command offload support Vineeth Karumanchi
2025-07-23 10:02 ` kernel test robot
2025-07-26 12:25 ` claudiu beznea (tuxon)
2025-07-26 15:32 ` Andrew Lunn
2025-07-29 8:59 ` Karumanchi, Vineeth
2025-07-31 9:07 ` Claudiu Beznea [this message]
2025-07-22 15:41 ` [PATCH net-next 4/6] net: macb: Implement TAPRIO DESTROY command offload for gate cleanup Vineeth Karumanchi
2025-07-26 12:26 ` claudiu beznea (tuxon)
2025-07-22 15:41 ` [PATCH net-next 5/6] net: macb: Implement TAPRIO TC offload command interface Vineeth Karumanchi
2025-07-26 12:29 ` claudiu beznea (tuxon)
2025-07-29 9:38 ` Karumanchi, Vineeth
2025-07-31 9:07 ` Claudiu Beznea
2025-07-28 16:31 ` kernel test robot
2025-07-22 15:41 ` [PATCH net-next 6/6] net: macb: Add MACB_CAPS_QBV capability flag for IEEE 802.1Qbv support Vineeth Karumanchi
2025-07-23 19:05 ` Simon Horman
2025-07-29 9:42 ` Karumanchi, Vineeth
2025-07-24 0:46 ` kernel test robot
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=61d545dd-c32c-4cc3-94fb-53954eee365b@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=git@amd.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=vineeth.karumanchi@amd.com \
--cc=vineeth@amd.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).