Subject: Re: [PATCH v1 3/8] net: dsa: hellcreek: Add PTP clock support

From: Kurt Kanzenbach <[email-masked]>
Date: Mon, 13 Jul 2020 08:34:01 +0200

On Sat Jul 11 2020, Florian Fainelli wrote:
> On 7/10/2020 4:36 AM, Kurt Kanzenbach wrote:
>> From: Kamil Alkhouri <[email-masked]>
>> 
>> The switch has internal PTP hardware clocks. Add support for it. There are three
>> clocks:
>> 
>>  * Synchronized
>>  * Syntonized
>>  * Free running
>> 
>> Currently the synchronized clock is exported to user space which is a good
>> default for the beginning. The free running clock might be exported later
>> e.g. for implementing 802.1AS-2011/2020 Time Aware Bridges (TAB). The switch
>> also supports cross time stamping for that purpose.
>> 
>> The implementation adds support setting/getting the time as well as offset and
>> frequency adjustments. However, the clock only holds a partial timeofday
>> timestamp. This is why we track the seconds completely in software (see overflow
>> work and last_ts).
>> 
>> Furthermore, add the PTP multicast addresses into the FDB to forward that
>> packages only to the CPU port where they are processed by a PTP program.
>> 
>> Signed-off-by: Kamil Alkhouri <[email-masked]>
>> Signed-off-by: Kurt Kanzenbach <[email-masked]>
>
> Are not you missing an depends on PTP_1588_CLOCK somewhere?

Most likely. Thanks!

>
>> ---
>
> [snip]
>
>>  
>> +static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
>> +{
>> +	static struct hellcreek_fdb_entry ptp = {
>> +		/* MAC: 01-1B-19-00-00-00 */
>> +		.mac	      = { 0x01, 0x1b, 0x19, 0x00, 0x00, 0x00 },
>> +		.portmask     = 0x03,	/* Management ports */
>
> Should not this depend on the actual number of ports enabled by the user
> and so it would be more logical to program those entries (or update
> them) at port_enable() time?

For me this is a switch configuration. It means forward all PTP traffic
to the switch's CPU port and therefore it doesn't depend on the enabled
ports.

Thanks,
Kurt