Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1653528
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V2 2/3] net-next: dsa: add multi cpu port support |
| Date | 2017-05-30 21:50 +0200 |
| Message-ID | <tMVjs-34l-15@gated-at.bofh.it> (permalink) |
| References | <tMMSR-6dU-9@gated-at.bofh.it> <tMMSR-6dU-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi John,
John Crispin <john@phrozen.org> writes:
> +static inline bool dsa_is_upstream_port(struct dsa_switch *ds, int p)
> +{
> + return dsa_is_cpu_port(ds, p) || dsa_is_dsa_port(ds, p);
> +}
This looks confusing to me. What DSA calls an "upstream" port for the
moment is the port which goes to the CPU interface.
CPU0 (eth0)
|
| sw0 sw1 sw2
[p0 p1 p2]--[p0 p1 p2]--[p0 p1 p2]
| | | |
eth1 eth2 eth3 eth4
So in the example above, sw1p0 is an upstream port, but sw1p2 is not.
This is why dsa_upstream_port makes use of ds->rtable.
> @@ -1140,11 +1140,16 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
> struct net_device *master;
> struct net_device *slave_dev;
> struct dsa_slave_priv *p;
> + int port_cpu = ds->ports[port].upstream;
ds->ports[port] is p->dp.
> int ret;
>
> - master = ds->dst->master_netdev;
> - if (ds->master_netdev)
> + if (port_cpu && ds->ports[port_cpu].ethernet)
0 is a valid port index for a CPU, e.g. Marvell 88E6390.
> + master = ds->ports[port_cpu].ethernet;
> + else if (ds->master_netdev)
> master = ds->master_netdev;
> + else
> + master = ds->dst->master_netdev;
> + master->dsa_ptr = (void *)ds->dst;
>
> slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv), name,
> NET_NAME_UNKNOWN, ether_setup);
> @@ -1173,6 +1178,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
> p->dp = &ds->ports[port];
> INIT_LIST_HEAD(&p->mall_tc_list);
> p->xmit = dst->tag_ops->xmit;
> + p->master = master;
I'm a bit confused why we need all these references to net devices. We
now have ds->master_netdev, dst->master_netdev, dp->ethernet and
p->master...
Wouldn't it be simpler if we only had dp->ethernet (or whichever more
explicit name) for the conduit interface used to send/receive frames?
Maybe I am missing something, in which case I'm sorry in advance.
Thanks,
Vivien
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V2 2/3] net-next: dsa: add multi cpu port support John Crispin <john@phrozen.org> - 2017-05-30 12:50 +0200
Re: [PATCH V2 2/3] net-next: dsa: add multi cpu port support Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 21:50 +0200
Re: [PATCH V2 2/3] net-next: dsa: add multi cpu port support Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 22:00 +0200
Re: [PATCH V2 2/3] net-next: dsa: add multi cpu port support Florian Fainelli <f.fainelli@gmail.com> - 2017-05-31 01:00 +0200
Re: [PATCH V2 2/3] net-next: dsa: add multi cpu port support Andrew Lunn <andrew@lunn.ch> - 2017-05-31 02:10 +0200
Re: [PATCH V2 2/3] net-next: dsa: add multi cpu port support Florian Fainelli <f.fainelli@gmail.com> - 2017-05-31 02:20 +0200
Re: [PATCH V2 2/3] net-next: dsa: add multi cpu port support Andrew Lunn <andrew@lunn.ch> - 2017-05-31 03:00 +0200
csiph-web