30 Sep, 2015
1 commit
-
[ Upstream commit 211c504a444710b1d8ce3431ac19f2578602ca27 ]
In case we need to divert reads/writes using the slave MII bus, we may have
already fetched a valid PHY interface property from Device Tree, and that
mode is used by the PHY driver to make configuration decisions.If we could not fetch the "phy-mode" property, we will assign p->phy_interface
to PHY_INTERFACE_MODE_NA, such that we can actually check for that condition as
to whether or not we should override the interface value.Fixes: 19334920eaf7 ("net: dsa: Set valid phy interface type")
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller
Signed-off-by: Greg Kroah-Hartman
01 Jun, 2015
1 commit
-
While shuffling some code around, dsa_switch_setup_one() was introduced,
and it was modified to return either an error code using ERR_PTR() or a
NULL pointer when running out of memory or failing to setup a switch.This is a problem for its caler: dsa_switch_setup() which uses IS_ERR()
and expects to find an error code, not a NULL pointer, so we still try
to proceed with dsa_switch_setup() and operate on invalid memory
addresses. This can be easily reproduced by having e.g: the bcm_sf2
driver built-in, but having no such switch, such that drv->setup will
fail.Fix this by using PTR_ERR() consistently which is both more informative
and avoids for the caller to use IS_ERR_OR_NULL().Fixes: df197195a5248 ("net: dsa: split dsa_switch_setup into two functions")
Reported-by: Andrew Lunn
Signed-off-by: Florian Fainelli
Tested-by: Andrew Lunn
Signed-off-by: David S. Miller
30 Apr, 2015
1 commit
-
eeprom-length is a switch property, not a dsa property, and thus
needs to be attached to the switch node, not to the dsa node.Reported-by: Andrew Lunn
Fixes: 6793abb4e849 ("net: dsa: Add support for switch EEPROM access")
Signed-off-by: Guenter Roeck
Acked-by: Andrew Lunn
Signed-off-by: David S. Miller
18 Apr, 2015
1 commit
-
Since commit da4759c (sysfs: Use only return value from is_visible for
the file mode), it is possible to reduce the permissions of a file.So declare temp1_max with the DEVICE_ATTR_RW macro and remove the write
permission in dsa_hwmon_attrs_visible if set_temp_limit isn't provided.Signed-off-by: Vivien Didelot
Reviewed-by: Guenter Roeck
Signed-off-by: David S. Miller
07 Apr, 2015
2 commits
-
Conflicts:
drivers/net/ethernet/mellanox/mlx4/cmd.c
net/core/fib_rules.c
net/ipv4/fib_frontend.cThe fib_rules.c and fib_frontend.c conflicts were locking adjustments
in 'net' overlapping addition and removal of code in 'net-next'.The mlx4 conflict was a bug fix in 'net' happening in the same
place a constant was being replaced with a more suitable macro.Signed-off-by: David S. Miller
-
According to description in 'include/net/dsa.h', in cascade switches
configurations where there are more than one interconnected devices,
'rtable' array in 'dsa_chip_data' structure is used to indicate which
port on this switch should be used to send packets to that are destined
for corresponding switch.However, dsa_of_setup_routing_table() fills 'rtable' with port numbers
of the _target_ switch, but not current one.This commit removes redundant devicetree parsing and adds needed port
number as a function argument. So dsa_of_setup_routing_table() now just
looks for target switch number by parsing parent of 'link' device node.To remove possible misunderstandings with the way of determining target
switch number, a corresponding comment was added to the source code and
to the DSA device tree bindings documentation file.This was tested on a custom board with two Marvell 88E6095 switches with
following corresponding routing tables: { -1, 10 } and { 8, -1 }.Signed-off-by: Pavel Nakonechny
Reviewed-by: Andrew Lunn
Reviewed-by: Florian Fainelli
Signed-off-by: David S. Miller
03 Apr, 2015
1 commit
-
Don't use dev->iflink anymore.
CC: Florian Fainelli
Signed-off-by: Nicolas Dichtel
Signed-off-by: David S. Miller
30 Mar, 2015
1 commit
-
Provide callbacks for ndo_fdb_add, ndo_fdb_del, and ndo_fdb_dump.
Reviewed-by: Andrew Lunn
Tested-by: Andrew Lunn
Signed-off-by: Guenter Roeck
Signed-off-by: David S. Miller
26 Mar, 2015
1 commit
-
Master change notifications may occur other than when joining or
leaving a bridge, for example when being added to or removed from
a bond or Open vSwitch. In that case, do nothing instead of asking
the switch driver to remove a port from a bridge that it didn't join.Signed-off-by: Guenter Roeck
Acked-by: Florian Fainelli
Signed-off-by: David S. Miller
21 Mar, 2015
1 commit
-
Change bd76a116707bd2381da36cf7c3183df11293f1d6 made all DSA drivers
depend on NET_DSA rather than selecting them. However, as the only way
to select this option was to actually select a driver, it made DSA
impossible to enable at all.This patch adds an explicit entry which the user will have to enable
prior selecting a driver.Signed-off-by: Mathieu Olivari
Signed-off-by: David S. Miller
17 Mar, 2015
1 commit
-
This would fix randconfig compile error:
net/built-in.o: In function `netdev_switch_fib_ipv4_abort':
(.text+0xf7811): undefined reference to `fib_flush_external'Also it fixes following warnings:
warning: (NET_DSA) selects NET_SWITCHDEV which has unmet direct dependencies (NET && INET)warning: (NET_DSA_MV88E6060 && NET_DSA_MV88E6131 && NET_DSA_MV88E6123_61_65 && NET_DSA_MV88E6171 && NET_DSA_MV88E6352 && NET_DSA_BCM_SF2) selects NET_DSA which has unmet direct dependencies (NET && HAVE_NET_DSA && NET_SWITCHDEV)
Reported-by: Randy Dunlap
Suggested-by: Alexei Starovoitov
Signed-off-by: Jiri Pirko
Signed-off-by: David S. Miller
16 Mar, 2015
1 commit
-
Move swdev wrappers over to new swdev ops (from previous ndo ops). No
functional changes to the implementation.Signed-off-by: Scott Feldman
rocker: move to new swdev ops
Signed-off-by: Scott Feldman
dsa: move to new swdev ops
Signed-off-by: Scott Feldman
Signed-off-by: David S. Miller
15 Mar, 2015
1 commit
-
Commit cd28a1a9baee7 ("net: dsa: fully divert PHY reads/writes if
requested") introduced a check for particular PHYs that need to be
accessed using the slave MII bus created by DSA, but this check was too
inclusive. This would prevent fixed PHYs from being successfully
registered because those should not go through the slave MII bus created
by DSA.Make sure we check that the PHY is not a fixed PHY to prevent that from
happening.Fixes: cd28a1a9baee7 ("net: dsa: fully divert PHY reads/writes if requested")
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller
12 Mar, 2015
2 commits
-
In case a PHY is found via Device Tree, and is also flagged by the
switch driver as needing indirect reads/writes using the switch driver
implemented MDIO bus, make sure that we bind this PHY to the slave MII
bus in order for this to happen.Without this, we would succeed in having the PHY driver probe()'s
function to use slave MII bus read/write functions, because this is done
during dsa_slave_mii_init(), but past that point, the PHY driver would
not go through these diverted reads and writes.Fixes: 0d8bcdd383b88 ("net: dsa: allow for more complex PHY setups")
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
In preparation for dealing with indirect reads and writes towards
certain PHY devices, move the code which deals with binding the PHY
device to the slave MII bus created by DSA to its own function:
dsa_slave_phy_connect().Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller
10 Mar, 2015
1 commit
-
Using of_find_device_by_node() restricts the search to platform_device that
match the specified device_node pointer. This is not even remotely true for
network devices backed by a pci_device for instance.of_find_net_device_by_node() allows us to do a more thorough lookup to find the
struct net_device corresponding to a particular device_node pointer.For symetry with the non-OF code path, we hold the net_device pointer in
dsa_probe() just like what dev_to_net_dev() does when we call this
function.Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller
06 Mar, 2015
5 commits
-
Extract the core logic that setups a 'struct dsa_switch_tree' and
removes it, update dsa_probe() and dsa_remove() to use the two helper
functions. This will be useful to allow for other callers to setup
this structure differently.Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
In order to support the new DSA device driver model, a dsa_switch should
be able to advertise the type of tagging protocol supported by the
underlying switch device. This also removes constraints on how tagging
can be stacked to each other.Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
Split the part of dsa_switch_setup() which is responsible for allocating
and initializing a 'struct dsa_switch' and the part which is doing a
given switch device setup and slave network device creation.This is a preliminary change to allow a separate caller of
dsa_switch_setup_one() which may have externally initialized the
dsa_switch structure, outside of dsa_switch_setup().Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
In preparation for allowing a different model to register DSA switches,
update dsa_of_probe() and dsa_probe() to return -EPROBE_DEFER where
appropriate.Failure to find a phandle or Device Tree property is still fatal, but
looking up the internal device structure associated with a Device Tree
node is something that might need to be delayed based on driver probe
ordering.Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
In preparation for allowing a different mechanism to register DSA switch
devices and driver, update dsa_of_probe and dsa_of_remove to take a
struct device pointer since neither of these two functions uses the
struct platform_device pointer.Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller
26 Feb, 2015
3 commits
-
To avoid race conditions when using the ds->ports[] array,
we need to check if the accessed port has been initialized.
Introduce and use helper function dsa_is_port_initialized
for that purpose and use it where needed.Signed-off-by: Guenter Roeck
Signed-off-by: David S. Miller -
In order to support bridging offloads in DSA switch drivers, select
NET_SWITCHDEV to get access to the port_stp_update and parent_get_id
NDOs that we are required to implement.To facilitate the integratation at the DSA driver level, we implement 3
types of operations:- port_join_bridge
- port_leave_bridge
- port_stp_updateDSA will resolve which switch ports that are currently bridge port
members as some Switch hardware/drivers need to know about that to limit
the register programming to just the relevant registers (especially for
slow MDIO buses).We also take care of setting the correct STP state when slave network
devices are brought up/down while being bridge members.Finally, when a port is leaving the bridge, we make sure we set in
BR_STATE_FORWARDING state, otherwise the bridge layer would leave it
disabled as a result of having left the bridge.Signed-off-by: Florian Fainelli
Reviewed-by: Guenter Roeck
Tested-by: Guenter Roeck
Signed-off-by: David S. Miller -
A network device notifier can be called for one or more of the created
slave devices before all slave devices have been registered. This can
result in a mismatch between ds->phys_port_mask and the registered devices
by the time the call is made, and it can result in a slave device being
added to a bridge before its entry in ds->ports[] has been initialized.Rework the initialization code to initialize entries in ds->ports[] in
dsa_slave_create. With this change, dsa_slave_create no longer needs
to return slave_dev but can return an error code instead.Signed-off-by: Guenter Roeck
Signed-off-by: David S. Miller
18 Feb, 2015
1 commit
-
If the phy interface mode is not found in devicetree, or if devicetree
is not configured, of_get_phy_mode returns -ENODEV. The current code
sets the phy interface mode to the return value from of_get_phy_mode
without checking if it is valid.This invalid phy interface mode is passed as parameter to of_phy_connect
or to phy_connect_direct. This sets the phy interface mode to the invalid
value, which in turn causes problems for any code using phydev->interface.Fixes: b31f65fb4383 ("net: dsa: slave: Fix autoneg for phys on switch MDIO bus")
Fixes: 0d8bcdd383b8 ("net: dsa: allow for more complex PHY setups")
Cc: Florian Fainelli
Cc: Andrew Lunn
Signed-off-by: Guenter Roeck
Acked-by: Florian Fainelli
Signed-off-by: David S. Miller
10 Feb, 2015
1 commit
-
dsa_slave_phy_setup() finds the phy for the port via device tree and
using of_phy_connect(), or it uses the fall back of taking a phy from
the switch internal mdio bus and calling phy_connect_direct(). Either
way, if a phy is found, phy_attach_direct() is called to attach the
phy to the slave device.In dsa_slave_create(), a second call to phy_attach() is made. This
results in the warning "PHY already attached". Remove this second,
redundant attaching of the phy.Signed-off-by: Andrew Lunn
Acked-by: Florian Fainelli
Tested-by: Florian Fainelli
Signed-off-by: David S. Miller
08 Feb, 2015
1 commit
-
The number of connected switches was sourced from the number of
children to the DSA node, change it to the number of available
children, skipping any disabled switches.Fixes: 5e95329b701c4 ("dsa: add device tree bindings to register DSA switches")
Signed-off-by: Tobias Waldekranz
Acked-by: Florian Fainelli
Signed-off-by: David S. Miller
26 Jan, 2015
1 commit
-
When registering a mdio bus, Linux assumes than every port has a PHY and tries
to scan it. If a switch port has no PHY registered, DSA will fail to register
the slave MII bus. To fix this, set the slave MII bus PHY mask to the switch
PHYs mask.As an example, if we use a Marvell MV88E6352 (which is a 7-port switch with no
registered PHYs for port 5 and port 6), with the following declared names:static struct dsa_chip_data switch_cdata = {
[...]
.port_names[0] = "sw0",
.port_names[1] = "sw1",
.port_names[2] = "sw2",
.port_names[3] = "sw3",
.port_names[4] = "sw4",
.port_names[5] = "cpu",
};DSA will fail to create the switch instance. With the PHY mask set for the
slave MII bus, only the PHY for ports 0-4 will be scanned and the instance will
be successfully created.Signed-off-by: Vivien Didelot
Tested-by: Florian Fainelli
Acked-by: Florian Fainelli
Signed-off-by: David S. Miller
15 Dec, 2014
1 commit
-
Pull driver core update from Greg KH:
"Here's the set of driver core patches for 3.19-rc1.They are dominated by the removal of the .owner field in platform
drivers. They touch a lot of files, but they are "simple" changes,
just removing a line in a structure.Other than that, a few minor driver core and debugfs changes. There
are some ath9k patches coming in through this tree that have been
acked by the wireless maintainers as they relied on the debugfs
changes.Everything has been in linux-next for a while"
* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
fs: debugfs: add forward declaration for struct device type
firmware class: Deletion of an unnecessary check before the function call "vunmap"
firmware loader: fix hung task warning dump
devcoredump: provide a one-way disable function
device: Add dev__once variants
ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
ath: use seq_file api for ath9k debugfs files
debugfs: add helper function to create device related seq_file
drivers/base: cacheinfo: remove noisy error boot message
Revert "core: platform: add warning if driver has no owner"
drivers: base: support cpu cache information interface to userspace via sysfs
drivers: base: add cpu_device_create to support per-cpu devices
topology: replace custom attribute macros with standard DEVICE_ATTR*
cpumask: factor out show_cpumap into separate helper function
driver core: Fix unbalanced device reference in drivers_probe
driver core: fix race with userland in device_add()
sysfs/kernfs: make read requests on pre-alloc files use the buffer.
sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
fs: sysfs: return EGBIG on write if offset is larger than file size
...
12 Dec, 2014
2 commits
-
In case we cannot attach to our slave netdevice PHY, error out and
propagate that error up to the caller: dsa_slave_create().Fixes: 0d8bcdd383b8 ("net: dsa: allow for more complex PHY setups")
Signed-off-by: Andrey Volkov
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller -
In case there is no PHY at the designated address on the internal
switch, we would basically de-reference a null pointer here:dsa_slave_phy_setup(...)
{
p->phy = ds->slave_mii_bus->phy_map[p->port];
phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
^------This can be triggered when the platform configuration (platform_data or
Device Tree) indicates there should be a PHY device at this address, but
the HW is non-responsive, such that we cannot attach a PHY device at
this specific location.Fix this by checking the return value prior to calling
phy_connect_direct().CC: Andrew Lunn
Fixes: b31f65fb4383 ("net: dsa: slave: Fix autoneg for phys on switch MDIO bus")
Reported-by: Brian Norris
Signed-off-by: Andrey Volkov
Signed-off-by: Florian Fainelli
Signed-off-by: David S. Miller
17 Nov, 2014
2 commits
-
kcalloc manages count*sizeof overflow.
Signed-off-by: Fabian Frederick
Signed-off-by: David S. Miller -
kmalloc_array manages count*sizeof overflow.
Signed-off-by: Fabian Frederick
Signed-off-by: David S. Miller
12 Nov, 2014
1 commit
-
Neaten and standardize the logging output.
Other miscellanea:
o Use pr_notice_once instead of a guard flag.
o Convert existing pr_ uses too.Signed-off-by: Joe Perches
Signed-off-by: David S. Miller
07 Nov, 2014
2 commits
-
When the ports phys are connected to the switches internal MDIO bus,
we need to connect the phy to the slave netdev, otherwise
auto-negotiation etc, does not work.Signed-off-by: Andrew Lunn
Signed-off-by: David S. Miller
04 Nov, 2014
1 commit
-
…l/git/wsa/linux into driver-core-next
Remove all .owner fields from platform drivers
02 Nov, 2014
1 commit
-
Conflicts:
drivers/net/phy/marvell.cSimple overlapping changes in drivers/net/phy/marvell.c
Signed-off-by: David S. Miller
31 Oct, 2014
2 commits
-
Add support for reading switch registers with 'ethtool -d'.
Signed-off-by: Guenter Roeck
Signed-off-by: David S. Miller -
On some chips it is possible to access the switch eeprom.
Add infrastructure support for it.Signed-off-by: Guenter Roeck
Signed-off-by: David S. Miller