Hi, this is my attempt to solve the multi-CPU port issue for DSA. Patch 1 adds code for handling multiple CPU ports in a DSA switch tree. If more than one CPU port is found in a tree, the code assigns CPU ports to user/DSA ports in a round robin way. So for the simplest case where we have one switch with N ports, 2 of them of type CPU connected to eth0 and eth1, and the other ports labels being lan1, lan2, ..., the code assigns them to CPU ports this way: lan1 <-> eth0 lan2 <-> eth1 lan3 <-> eth0 lan4 <-> eth1 lan5 <-> eth0 ...
Patch 2 adds a new operation to the net device operations structure. Currently we use the iflink property of a net device to report to which CPU port a given switch port si connected to. The ip link utility from iproute2 reports this as "lan1@eth0". We add a new net device operation, ndo_set_iflink, which can be used to set this property. We call this function from the netlink handlers. Patch 3 implements this new ndo_set_iflink operation for DSA slave device. Thus the userspace can request a change of CPU port of a given port. I am also sending patch for iproute2-next, to add support for setting this iflink value. Marek Marek Behún (3): net: dsa: allow for multiple CPU ports net: add ndo for setting the iflink property net: dsa: implement ndo_set_netlink for chaning port's CPU port include/linux/netdevice.h | 5 +++ include/net/dsa.h | 11 ++++- net/core/dev.c | 15 +++++++ net/core/rtnetlink.c | 7 ++++ net/dsa/dsa2.c | 84 +++++++++++++++++++++++++-------------- net/dsa/slave.c | 35 ++++++++++++++++ 6 files changed, 126 insertions(+), 31 deletions(-) -- 2.21.0