Re: [PATCH net-next 08/13] net: dsa: hellcreek: deny tc-taprio changes to per-tc max SDU

Kurt Kanzenbach
2022-09-15T06:16:04Z

[-- Attachment #1: Type: text/plain, Size: 2656 bytes --]

On Wed Sep 14 2022, Vladimir Oltean wrote:
> On Wed, Sep 14, 2022 at 08:13:53PM +0200, Kurt Kanzenbach wrote:
>> I'd rather like to see that feature implemented :-). Something like below.
>>
>> From 3d44683979bf50960125fa3005b1142af61525c7 Mon Sep 17 00:00:00 2001
>> From: Kurt Kanzenbach <kurt@linutronix.de>
>> Date: Wed, 14 Sep 2022 19:51:40 +0200
>> Subject: [PATCH] net: dsa: hellcreek: Offload per-tc max SDU from tc-taprio
>>
>> Add support for configuring the max SDU per priority and per port. If not
>> specified, keep the default.
>>
>> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>> ---
>
> Nice :) Do you also want the iproute2 patch, so you can test it?

Sure. I see you posted that patch already.

>
>> drivers/net/dsa/hirschmann/hellcreek.c | 61 +++++++++++++++++++++++---
>> drivers/net/dsa/hirschmann/hellcreek.h | 7 +++
>> 2 files changed, 61 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
>> index 5ceee71d9a25..1b22710e1641 100644
>> --- a/drivers/net/dsa/hirschmann/hellcreek.c
>> +++ b/drivers/net/dsa/hirschmann/hellcreek.c
>> @@ -128,6 +128,16 @@ static void hellcreek_select_prio(struct hellcreek *hellcreek, int prio)
>> hellcreek_write(hellcreek, val, HR_PSEL);
>> }
>>
>> +static void hellcreek_select_port_prio(struct hellcreek *hellcreek, int port,
>> + int prio)
>> +{
>> + u16 val = port << HR_PSEL_PTWSEL_SHIFT;
>> +
>> + val |= prio << HR_PSEL_PRTCWSEL_SHIFT;
>> +
>> + hellcreek_write(hellcreek, val, HR_PSEL);
>> +}
>> +
>> static void hellcreek_select_counter(struct hellcreek *hellcreek, int counter)
>> {
>> u16 val = counter << HR_CSEL_SHIFT;
>> @@ -1537,6 +1547,42 @@ hellcreek_port_prechangeupper(struct dsa_switch *ds, int port,
>> return ret;
>> }
>>
>> +static void hellcreek_setup_maxsdu(struct hellcreek *hellcreek, int port,
>> + const struct tc_taprio_qopt_offload *schedule)
>> +{
>> + int tc;
>> +
>> + for (tc = 0; tc < 8; ++tc) {
>> + u16 val;
>> +
>> + if (!schedule->max_sdu[tc])
>> + continue;
>> +
>> + hellcreek_select_port_prio(hellcreek, port, tc);
>> +
>> + val = (schedule->max_sdu[tc] & HR_PTPRTCCFG_MAXSDU_MASK)
>> + << HR_PTPRTCCFG_MAXSDU_SHIFT;
>> +
>> + hellcreek_write(hellcreek, val, HR_PTPRTCCFG);
>
> So the maxSDU hardware register tracks exactly the L2 payload size, like
> the software variable does, or does it include the Ethernet header size
> and/or FCS?

This is something I'm not sure about. I'll ask the HW engineer when he's
back from vacation.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]