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

Florian Fainelli
2020-07-11T20:38:51Z

On 7/10/2020 4:36 AM, Kurt Kanzenbach wrote:
> From: Kamil Alkhouri <kamil.alkhouri@hs-offenburg.de>
>
> 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 <kamil.alkhouri@hs-offenburg.de>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>

Are not you missing an depends on PTP_1588_CLOCK somewhere?

> ---

[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?
--
Florian