20 Jul, 2016
1 commit
-
Add a new function for DSA drivers to handle the switchdev
SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute.The ageing time is passed as milliseconds.
Also because we can have multiple logical bridges on top of a physical
switch and ageing time are switch-wide, call the driver function with
the fastest ageing time in use on the chip instead of the requested one.Signed-off-by: Vivien Didelot
Reviewed-by: Andrew Lunn
Signed-off-by: David S. Miller
13 Jul, 2016
1 commit
-
Fixes the following sparse warning:
net/dsa/dsa2.c:680:6: warning:
symbol '_dsa_unregister_switch' was not declared. Should it be static?Signed-off-by: Wei Yongjun
Signed-off-by: David S. Miller
09 Jul, 2016
1 commit
-
The routing table of every switch in a tree is currently initialized to
all zeros. This is an issue since 0 is a valid port number.Add a DSA_RTABLE_NONE=-1 constant to initialize the signed values of the
routing table pointing to other switches.This fixes the device mapping of the mv88e6xxx driver where the port
pointing to the switch itself and to non-existent switches was wrongly
configured to be 0. It is now set to the expected 0xf value.Signed-off-by: Vivien Didelot
Reviewed-by: Andrew Lunn
Signed-off-by: David S. Miller
09 Jun, 2016
5 commits
-
Now that we can properly support multiple distinct trees in the system,
using a global variable: dsa_cpu_port_ethtool_ops is getting clobbered
as soon as the second switch tree gets probed, and we don't want that.We need to move this to be dynamically allocated, and since we can't
really be comparing addresses anymore to determine first time
initialization versus any other times, just move this to dsa.c and
dsa2.c where the remainder of the dst/ds initialization happens.The operations teardown restores the master netdev's ethtool_ops to its
original ethtool_ops pointer (typically within the Ethernet driver)Signed-off-by: Florian Fainelli
Reviewed-by: Andrew Lunn
Signed-off-by: David S. Miller -
Add a helper function: dsa_cpu_port_ethtool_init() which initializes a
custom ethtool_ops structure with custom DSA ethtool operations for CPU
ports. This is a preliminary change to move the initialization outside
of net/dsa/slave.c.Reviewed-by: Vivien Didelot
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
Mimic what net/dsa/dsa.c does and provide a slave MII bus by default
which will be created if the driver implements a phy_read method.Reviewed-by: Andrew Lunn
Reviewed-by: Vivien Didelot
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
Some drivers rely on these two bitmasks to contain the correct values
for them to successfully probe and initialize at drv->setup() time,
calculate correct values to put in both masks as early as possible in
dsa_get_ports_dn().Reviewed-by: Andrew Lunn
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
In case we have multiples trees and switches with the same index, we
need to add another discriminating id: the switch tree.Reviewed-by: Andrew Lunn
Reviewed-by: Vivien Didelot
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller
05 Jun, 2016
11 commits
-
The existing DSA binding has a number of limitations and problems. The
main problem is that it cannot represent a switch as a linux device,
hanging off some bus. It is limited to one CPU port. The DSA platform
device is artificial, and does not really represent hardware.Implement a new binding which can be embedded into any type of node on
a bus to represent one switch device, and its links to other switches.Signed-off-by: Andrew Lunn
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
The switch may want to instantiate its own MDIO bus. Only do it
centrally if the switch has not already created one, and the read op
is implemented.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Signed-off-by: David S. Miller -
Replace the two switch statements with an array lookup, and store the
result in the dsa tree structure. The drivers no longer need to know
the selected tag protocol, so remove it from the dsa switch structure.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller -
Refactor the code to setup a single DSA/CPU port into a function of
its own, and export it, so it can be used by the new binding.Similarly, refactor the destroy code into a function. When destroying
the ports, don't put the of node. They should be released at the end
along with the normal ports.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller -
The new binding will not have a chip data structure, it will place the
routing directly into the switch structure. To enable backwards
compatibility, copy the routing from the chip data into the switch
structure.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller -
With a maximum of four switches, the size of the routing table is the
same as the pointer to it. Removing it makes the code simpler.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller -
Move the port device node structure into the port structure, from the
chip data. This information is needed in the next step of implementing
the new binding.The chip data structure is used while parsing the whole old binding,
before the individual switch structures exist. With the new bindings,
this is reversed, the switches exist first, and the interconnections
between the switches is derived from the individual switch
bindings. Thus this chip data structure becomes unneeded.Signed-off-by: Andrew Lunn
eviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller -
There are going to be more per-port members added to the switch
structure. So add a port structure and move the netdev into it.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller -
The platform data nr_chips is used when validating a received packet,
to ensure it comes from a know switch chip. The number of possible
switches is limited to DSA_MAX_SWITCHES, so use this as the first
validation step. The new binding allows holes in the dst->ds[] array,
so also ensure ensure there is a valid dsa_switch for this packet.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller -
The DSA layer should no longer assume the switch is connected to an
MDIO bus. As a result, we cannot use the address on the MDIO bus when
forming the name of the switches internal MDIO bus for its builtin and
possibly external PHYs. The switch index is sufficient to make the
name unique, so drop the MDIO address.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller -
The new binding does not make use of dsa_chip_data, a.k.a cd. When
retrieving the size of the EEPROM attached to a switch, don't assume
there is a cd attached to the switch structure.Signed-off-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Reviewed-by: Vivien Didelot
Signed-off-by: David S. Miller
12 May, 2016
3 commits
-
The dsa_switch structure contains a dsa_chip_data member called pd.
However in the rest of the code, pd is used for dsa_platform_data.
This is confusing. Rename it cd, which is already often used in dsa.c
and slave.c for this data type.Signed-off-by: Andrew Lunn
Signed-off-by: David S. Miller -
The switch drivers only use the master_dev member for dev_info()
messages. Now that the device is passed to the old style probe, and
new style drivers are probed as true linux drivers, this is no longer
needed.Signed-off-by: Andrew Lunn
Signed-off-by: David S. Miller -
Resetting the switch is something the driver does, not the framework.
So move the parsing of this property into the driver.There are no in kernel users of this property, so moving it does not
break anything. There is however a board which will make use of this
property making its way into the kernel.Signed-off-by: Andrew Lunn
Signed-off-by: David S. Miller
29 Apr, 2016
1 commit
-
This patch overloads the DSA master netdev, aka CPU Ethernet MAC to also
include switch-side statistics, which is useful for debugging purposes,
when the switch is not properly connected to the Ethernet MAC (duplex
mismatch, (RG)MII electrical issues etc.).We accomplish this by retaining the original copy of the master netdev's
ethtool_ops, and just overload the 3 operations we care about:
get_sset_count, get_strings and get_ethtool_stats so as to intercept
these calls and call into the original master_netdev ethtool_ops, plus
our own.We take this approach as opposed to providing a set of DSA helper
functions that would retrive the CPU port's statistics, because the
entire purpose of DSA is to allow unmodified Ethernet MAC drivers to be
used as CPU conduit interfaces, therefore, statistics overlay in such
drivers would simply not scale.The new ethtool -S output would therefore look like this now:
statistics
p_Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller
22 Apr, 2016
1 commit
-
Having the tag protocol in dsa_switch_driver for setup time and in
dsa_switch_tree for runtime is enough. Remove dsa_switch's one.Signed-off-by: Vivien Didelot
Signed-off-by: David S. Miller
20 Apr, 2016
1 commit
-
The dsa_slave_priv structure does not need a pointer to its net_device.
Kill it.Signed-off-by: Vivien Didelot
Signed-off-by: David S. Miller
18 Apr, 2016
1 commit
-
Change the dsa_switch_driver.probe function to return a const char *.
Signed-off-by: Vivien Didelot
Reviewed-by: Andrew Lunn
Signed-off-by: David S. Miller
14 Apr, 2016
4 commits
-
The phys in phys_port_mask suggests this mask is about PHYs. In fact,
it means physical ports. Rename to enabled_port_mask, indicating
external enabled ports of the switch, which is hopefully less
confusing.Signed-off-by: Andrew Lunn
Tested-by: Vivien Didelot
Acked-by: Florian Fainelli
Signed-off-by: David S. Miller -
The drivers now allocate their own memory for private usage. Remove
the allocation from the core code.Signed-off-by: Andrew Lunn
Acked-by: Florian Fainelli
Tested-by: Vivien Didelot
Signed-off-by: David S. Miller -
Now the switch devices have a dev pointer, make use of it for allocating
the drivers private data structures using a devm_kzalloc().Signed-off-by: Andrew Lunn
Acked-by: Florian Fainelli
Tested-by: Vivien Didelot
Signed-off-by: David S. Miller -
By passing a device structure to the switch devices, it allows them
to use devm_* methods for resource management.Signed-off-by: Andrew Lunn
Acked-by: Florian Fainelli
Tested-by: Vivien Didelot
Signed-off-by: David S. Miller
09 Apr, 2016
3 commits
-
The switchdev design implies that a software error should not happen in
the commit phase since it must have been previously reported in the
prepare phase. If an hardware error occurs during the commit phase,
there is nothing switchdev can do about it.The DSA layer separates port_vlan_prepare and port_vlan_add for
simplicity and convenience. If an hardware error occurs during the
commit phase, there is no need to report it outside the driver itself.Make the DSA port_vlan_add routine return void for explicitness.
Signed-off-by: Vivien Didelot
Signed-off-by: David S. Miller -
The switchdev design implies that a software error should not happen in
the commit phase since it must have been previously reported in the
prepare phase. If an hardware error occurs during the commit phase,
there is nothing switchdev can do about it.The DSA layer separates port_fdb_prepare and port_fdb_add for simplicity
and convenience. If an hardware error occurs during the commit phase,
there is no need to report it outside the DSA driver itself.Make the DSA port_fdb_add routine return void for explicitness.
Signed-off-by: Vivien Didelot
Signed-off-by: David S. Miller -
The DSA layer doesn't care about the return code of the port_stp_update
routine, so make it void in the layer and the DSA drivers.Replace the useless dsa_slave_stp_update function with a
dsa_slave_stp_state function used to reply to the switchdev
SWITCHDEV_ATTR_ID_PORT_STP_STATE attribute.In the meantime, rename port_stp_update to port_stp_state_set to
explicit the state change.Signed-off-by: Vivien Didelot
Signed-off-by: David S. Miller
15 Mar, 2016
7 commits
-
Rework the netdev event handler, similar to what the Mellanox Spectrum
driver does, to easily welcome more events later (for example
NETDEV_PRECHANGEUPPER) and use netdev helpers (such as
netif_is_bridge_master).Signed-off-by: Vivien Didelot
Acked-by: Jiri Pirko
Acked-by: Ido Schimmel
Signed-off-by: David S. Miller -
netdev_upper_dev_unlink() which notifies NETDEV_CHANGEUPPER, returns
void, as well as del_nbp(). So there's no advantage to catch an eventual
error from the port_bridge_leave routine at the DSA level.Make this routine void for the DSA layer and its existing drivers.
Signed-off-by: Vivien Didelot
Acked-by: Jiri Pirko
Signed-off-by: David S. Miller -
Rename DSA port_join_bridge and port_leave_bridge routines to
respectively port_bridge_join and port_bridge_leave in order to respect
an implicit Port::Bridge namespace.Signed-off-by: Vivien Didelot
Acked-by: Jiri Pirko
Signed-off-by: David S. Miller -
The fixed phys delete function simply removed the fixed phy from the
internal linked list and freed the memory. It however did not
unregister the associated phy device. This meant it was still possible
to find the phy device on the mdio bus.Make fixed_phy_del() an internal function and add a
fixed_phy_unregister() to unregisters the phy device and then uses
fixed_phy_del() to free resources.Modify DSA to use this new API function, so we don't leak phys.
Signed-off-by: Andrew Lunn
Signed-off-by: David S. Miller -
All ports types can have a fixed PHY associated with it. Remove the
check which limits removal to only CPU and DSA ports.Signed-off-by: Andrew Lunn
Signed-off-by: David S. Miller -
The phy is disconnected from the slave in dsa_slave_destroy(). Don't
destroy fixed link phys until after this, since there can be fixed
linked phys connected to ports.Signed-off-by: Andrew Lunn
Signed-off-by: David S. Miller -
When the phy is disconnected, the parent pointer to the netdev it was
attached to is set to NULL. The code then tries to suspend the phy,
but dsa_slave_fixed_link_update needs the parent pointer to determine
which switch the phy is connected to. So it dereferenced a NULL
pointer. Check for this condition.Signed-off-by: Andrew Lunn
Signed-off-by: David S. Miller