Re: [PATCH RFC net-next 1/3] net: dsa: allow for multiple CPU ports

From: DENG Qingfang
Date: Sun Apr 11 2021 - 23:35:39 EST


On Sat, Apr 10, 2021 at 03:34:47PM +0200, Ansuel Smith wrote:
> Allow for multiple CPU ports in a DSA switch tree. By default the first
> CPU port is assigned mimic the original assignement logic. A DSA driver
> can define a function to declare a preferred CPU port based on the
> provided port. If the function doesn't have a preferred port the CPU
> port is assigned using a round-robin way starting from the last assigned
> CPU port.
> Examples:
> There are two CPU port but no port_get_preferred_cpu is provided:
> - The old logic is used. Every port is assigned to the first cpu port.
> There are two CPU port but the port_get_preferred_cpu return -1:
> - The port is assigned using a round-robin way since no preference is
> provided.
> There are two CPU port and the port_get_preferred_cpu define only one
> port and the rest with -1: (wan port with CPU1 and the rest no
> preference)
> lan1 <-> eth0
> lan2 <-> eth1
> lan3 <-> eth0
> lan4 <-> eth1
> wan <-> eth1
> There are two CPU port and the port_get_preferred assign a preference
> for every port: (wan port with CPU1 everything else CPU0)
> lan1 <-> eth0
> lan2 <-> eth0
> lan3 <-> eth0
> lan4 <-> eth0
> wan <-> eth1

So, drivers will read the name of every port and decide which CPU port
does it use?

>
> Signed-off-by: Marek Beh�arek.behun@xxxxxx>
> Signed-off-by: Ansuel Smith <ansuelsmth@xxxxxxxxx>