Hi Richard,

Thanks for your comments. Here are the replies.

On Sat, Jun 17, 2017 at 07:21:08AM +0200, Richard Cochran wrote:
> > Here are the brief descriptions.
> > 
> > 1. add slave info in struct interface, something like
> >    struct interface {
> >            STAILQ_ENTRY(interface) list;
> >            char name[MAX_IFNAME_SIZE + 1];
> >            char slave[MAX_IFNAME_SIZE + 1];
> >            int index;
> >            int slave_index;
> >            int linkup;
> >            int slave_changed;
> 
> I don't think this new state is needed, because...

Which state? all the new elements or just the last slave_changed variable?
> 
> >            struct sk_ts_info ts_info;
> >    };
> > 2. get current interface's active slave via netlink message when
> > config_create_interface()
> > 3. set clock's PHC index to active slave's PHC index when clock_create()
> 
> ... step 2 can also be done in clock_create(), can't it?

In clock_create()

STAILQ_FOREACH(iface, &config->interfaces, list) {
        if (iface->ts_info.valid &&
            ((iface->ts_info.so_timestamping & required_modes) != 
required_modes)) {
                ...
            }
}

we get iface from config and check iface->ts_info.valid. The ts_info need to
be current slave's ts_info. What I parepared to do is something like

        strncpy(iface->name, name, MAX_IFNAME_SIZE);
-       sk_get_ts_info(iface->name, &iface->ts_info);
+       rtnl_link_info(iface);
+
+       if (iface->slave) {
+               sk_get_ts_info(iface->slave, &iface->ts_info);
+       } else {
+               sk_get_ts_info(iface->name, &iface->ts_info);
+       }

in config_create_interface(). That we get interface's slave info and ts_info
during config.

So what you want is to get new ts_info in clock_create() and do not store
slave information in struct interface, right?
> 
> > 4. when bond/team fail over, get new active slave index
> 
> How do you detect fail over?

via rtnl_link_status() callback, we can get bond slave info in
rta->rta_type == IFLA_BOND_ACTIVE_SLAVE.
> 
> > 5. update clock phc info via clock_switch_phc(), update port status
> > via port_dispatch()
> > 6. Use automatic mode in phc2sys to automatically sync correct PHC.
> 
> Another question:  The sockets must be bound to the slave interface,
> and not to the bonding master interface, correct?  If so, there is

Yes.
> more work to do than clock_switch_phc() at fail over time.

Yes, we also need to reset port phc index to new phc, set port re-initialize via
port_dispatch(p, EV_INITIALIZE, 0). Open/renew transport with slave name. etc.
And maybe more that I don't know. Please correct me if I missed anything when
I post the patch set.

> 
> > Limits and unresolved issues:
> > 1. Only support bond/team active-backup
> > 2. Only works with phc2sys automatic mode. But how about manual
> > config? -s bond0?
> 
> I think phc2sys will also need some work.

hmm, I'm looking what we should do to make phc2sys aware the node changed
and reconfig it.

run_pmc_events(node);
if (node->state_changed) {
        reconfigure(node);
}

> 
> > 3. What about vlan?
> 
> VLAN already works with normal (non-bonding) interfaces.  Not sure
> about the bonding case.

I think we can talk about this later.
> 
> > 4. What if new active slave do not support required timestamp flags.
> > Just report fail?
> 
> Yes, just let the port become FAULTY.

OK, got it.

Thanks
Hangbin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to