Subject: Re: [PATCH v3 5/8] net: dsa: hellcreek: Add TAPRIO offloading support

From: Kurt Kanzenbach <[email-masked]>
Date: Tue, 25 Aug 2020 11:42:02 +0200

On Mon Aug 24 2020, Vinicius Costa Gomes wrote:
> Hi Kurt,
>
> Kurt Kanzenbach <[email-masked]> writes:
>
>>>> +static void hellcreek_setup_tc_mapping(struct hellcreek *hellcreek,
>>>> +				       struct net_device *netdev)
>>>> +{
>>>> +	int i, j;
>>>> +
>>>> +	/* Setup mapping between traffic classes and port queues. */
>>>> +	for (i = 0; i < netdev_get_num_tc(netdev); ++i) {
>>>> +		for (j = 0; j < netdev->tc_to_txq[i].count; ++j) {
>>>> +			const int queue = j + netdev->tc_to_txq[i].offset;
>>>> +
>>>> +			hellcreek_select_prio(hellcreek, i);
>>>> +			hellcreek_write(hellcreek,
>>>> +					queue << HR_PRTCCFG_PCP_TC_MAP_SHIFT,
>>>> +					HR_PRTCCFG);
>>>> +		}
>>>> +	}
>>>> +}
>>>
>>> What other driver have you seen that does this?
>>>
>>
>> Probably none.
>>
>> With TAPRIO traffic classes and the mapping to queues can be
>> configured. The switch can also map traffic classes. That sounded like a
>> good match to me.
>
> The only reason I could think that you would need this that *right now*
> taprio has pretty glaring oversight: that in the offload parameters each entry
> 'gate_mask' reference the "Traffic Class" (i.e. bit 0 is Traffic Class
> 0), and it really should be the HW queue.
>
> I have a patch that does the conversion on taprio before talking to the
> driver. Do you think it would help you avoid doing this on the driver
> side?

I think so. As Vladimir pointed out, the driver should setup an identity
mapping which I already did by default.

Can you point me your patch?

Thanks,
Kurt