On Sat, Aug 05, 2017 at 10:21:41AM +0200, Richard Cochran wrote:
> On Sat, Jul 15, 2017 at 09:33:10PM +0800, Hangbin Liu wrote:
> > Pass struct interface so we can use ts_iface in HW filter.
>
> So the problem is that the raw layer should use
>
> name = iface->ts_iface
>
> but the others need
>
> name = iface->name
>
> Let's avoid touching so many files by solving this differently...
>
> > -int transport_open(struct transport *t, const char *name,
> > +int transport_open(struct transport *t, struct interface *iface,
> > struct fdarray *fda, enum timestamp_type tt)
> > {
> const char *name;
>
> switch (t->type) {
> case TRANS_IEEE_802_3:
> name = iface->ts_iface;
> break;
> default:
> name = iface->name;
> break;
> }
>
> > return t->open(t, name, fda, tt);
We need ts_iface in sk_timestamping_init. e.g.
--- a/udp.c
+++ b/udp.c
@@ -152,12 +152,13 @@ enum { MC_PRIMARY, MC_PDELAY };
static struct in_addr mcast_addr[2];
-static int udp_open(struct transport *t, const char *name, struct fdarray *fda,
- enum timestamp_type ts_type)
+static int udp_open(struct transport *t, struct interface *iface,
+ struct fdarray *fda, enum timestamp_type ts_type)
{
struct udp *udp = container_of(t, struct udp, t);
uint8_t event_dscp, general_dscp;
int efd, gfd, ttl;
+ char *name = iface->name;
ttl = config_get_int(t->cfg, name, "udp_ttl");
udp->mac.len = 0;
@@ -180,7 +181,7 @@ static int udp_open(struct transport *t, const char *name,
struct fdarray *fda,
if (gfd < 0)
goto no_general;
- if (sk_timestamping_init(efd, name, ts_type, TRANS_UDP_IPV4))
+ if (sk_timestamping_init(efd, iface->ts_iface, ts_type, TRANS_UDP_IPV4))
goto no_timestamping;
So I passed struct interface to t->open().
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel