On 06/06/2017 11:25 AM, Vivien Didelot wrote: > Hi Florian, > > Florian Fainelli <f.faine...@gmail.com> writes: > >> This patch series prepares the ground for adding mutliple CPU port support to > > multiple > >> DSA, and starts by removing redundant pieces of information such as >> master_netdev which is cpu_dp->ethernet. Finally drivers are moved away from > > cpu_dp->netdev > >> directly accessing ds->dst->cpu_dp and use appropriate helper functions. >> >> Note that if you have Device Tree blobs/platform configurations that are >> currently listing multiple CPU ports, the proposed behavior in >> dsa_ds_get_cpu_dp() will be to return the last bit set in ds->cpu_port_mask. >> >> Future plans include: >> - making dst->cpu_dp a flexible data structure (array, list, you name it) >> - having the ability for drivers to return a default/preferred CPU port (if >> necessary) > > The overall patchset looks good. I have questions for future work > though. > > I am still not sure that we need CPU port references in > dsa_switch_tree. When device tree or pdata is parsed, we have allocated > dsa_switch and dsa_port structures. We should be able validate and > assign all ds->ports[x].cpu_dp, before setting up the switches and > creating the slave devices. What do you think?
True, we should be able to do that, thanks for the suggestion. > > Also I see dsa_ptr becoming a pointer to the assosicated dsa_port, and > dsa_port should contain the tagging ops for quick access. That is more > rigourous with the physical representation and much easier for > transparent multi-CPU port support. Ultimately, I agree we should probably have dev->dsa_ptr be the actual CPU port within the switch, and from the switch be able to go to the collection of switches (dst). This should indeed be a bit more optimized as there should be less traversal of structures in such a case. Thanks! -- Florian