In case the net_device is not up, there is no need to call
dpmac_mac_stop(). Guard the call by checking the IFF_UP flag.
This patch will also solve the following warning generated by removing a
dpmac that is not up.
[ 40.942937] called from state READY
[ 40.946442] WARNING: CPU: 0 PID: 755 at drivers/net/phy/phy.c:838
phy_stop+0x6c/0x78
[ 40.954171] Modules linked in:
[ 40.957214] CPU: 0 PID: 755 Comm: bash Tainted: G W
5.4.0-03629-gfd7102c32b2c-dirty #911
[ 40.966592] Hardware name: NXP Layerscape LX2160ARDB (DT)
[ 40.971978] pstate: 40000005 (nZcv daif -PAN -UAO)
[ 40.976756] pc : phy_stop+0x6c/0x78
[ 40.980232] lr : phy_stop+0x6c/0x78
(..)
[ 41.066487] Call trace:
[ 41.068922] phy_stop+0x6c/0x78
[ 41.072052] dpaa2_mac_stop.part.4+0x34/0x5c
[ 41.076309] dpaa2_mac_remove+0x9c/0xa8
Also, remove the IFF_UP flag from the mac netdev since the PHY is not
anymore started at probe time but is rather started/stopped on ifconfig
up/down.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Both the LINK_UP_REQ and the LINK_DOWN_REQ IRQs can be received in the
same time when a reset is performed on the DPMAC's partner.
Handle first the link down and then the link up so that we do not
trigger a phylib WARNING like the following:
[ 446.272011] called from state NOLINK
[ 446.275604] WARNING: CPU: 0 PID: 473 at drivers/net/phy/phy.c:874
phy_start+0x44/0xa8
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
In case nothing changed in the link configuration do not call
dpmac_set_link_state().
This is needed in case of the following sequence of commands.
$ ip link set dev eth1 up; ip link set dev eth2 down
Phylib brings the link down when the aneg is started on the phy which
translates in a link down from phy in MC and confuses the MC linkman.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Create a different ordered workqueue per dpaa2-ethsw instance. Without
this change, we overwrite the global queue and leak memory when probing
multiple instances of the driver.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1573491058-24766-5-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Register a different switchdev blocking notifier block per ethsw
instance. When probing multiple dpaa2-ethsw instances, without this the
register will fail.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1573491058-24766-4-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Register a different switchdev notifier block per ethsw instance.
When probing multiple dpaa2-ethsw instances, without this the register
will fail.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1573491058-24766-3-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Register a different net_device notifier block per ethsw instance.
When probing multiple dpaa2-ethsw instances, without this the register
will fail.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1573491058-24766-2-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Avoid triggering stack trace when retrieving interface counters via
ifconfig by allocating MC portal with atomic I/O enabled.
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Set limits on the MTU to accommodate netdevice update. There is no need to
check the limits before setting the new value.
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Improve ethtool support by adding ops for:
- driver info
- link status
- auto-negotiation setting and result
- speed setting and result
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
This contains the following patches migrated from sdk-v2.0.x branch:
dpaa2-evb: Added Edge Virtual Bridge driver
dpaa2-evb: Add VLAN_8021Q dependency
dpaa2-evb: Update dpdmux binary interface to 5.0
dpaa2-evb: Add support to set max frame length.
dpaa2-evb: Fix interrupt handling
dpaa2-evb: Add object version check
staging: dpaa2-evb: update dpdmux command ids set for MC v10.x
dpaa2-evb: replace uintX_t types by kernel preferred kernel uX types
dpaa2-evb: uprev binary interface to v6.0
dpaa2-evb: move comments from declaration to definition
dpaa2-evb: delete extraneous tabs
dpaa2-evb: align function parameters
dpaa2-evb: convert mc command build/parse to use C structs
Initial patches have been signed-off by:
Alex Marginean <alexandru.marginean@freescale.com>
J. German Rivera <German.Rivera@freescale.com>
Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Mihaela Panescu <mihaela.panescu@freescale.com>
Catalin Horghidan <catalin.horghidan@nxp.com>
Ioana Ciornei <ioana.ciornei@nxp.com>
Stuart Yoder <stuart.yoder@freescale.com>
Updated FLIBs to the latest available for MC 10.x and fixed check-patch
warnings. Updated maintainer to myself and removed the DPAA2 Ethernet
dependency.
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Fix a limitation that affects the networking behavior when the user
issues ifconfig down/up on a DPNI and the link remains down.
The actual problem was that the mac driver was not aware of the
dpni link change event. Now, the event is sent by firmware and
phylib state machine is manipulated conveniently.
Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
We used to set PHY_INTERFACE_MODE_XGMII as a placeholder
for interface modes listed by MC but not defined in the
linux kernel. Some of these modes have been added in upstream,
so update the interface mode array to better match actual PHYs.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Read the configured dpmac options and depending on the supported
features set the according advertising bit.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
This patch is formed from 2 parts:
- first it moves the code that determines the if_mode to the
beginning so that it's used for both fixed link and phy mode.
- secondly, when in fixed link mode, call the phy_connect_phy
function as needed.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
For MC versions that support it, use the new DPMAC link APIs, which
allow setting/getting of advertised and supported link modes.
A mapping between DPMAC link modes and phydev ones is created to
help converting from one to the other.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Add v2 of dpmac_set_link_state() and dpmac_get_link_cfg() commands.
The new version allows setting & getting advertised and supported
link options.
Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
The instruction writing link state value in the MC command
structure wasn't correct, but it happened to work nonetheless.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Read the current API version exposed by the DPMAC object.
Add a check at probe time to make sure it is compatible with
the set of MC commands we intend to use on it.
Also, print the version number through ethtool driver info.
Signed-off-by: Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
If the a dpmac node defines its phy mode in the device tree using
the 'phy-mode' or the 'phy-connection-type' attributes this will take
precedence over the interface mode reported by the MC in the
dpmac attributes structure.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Keep in sync the PHY type settings in DPC and Linux device tree.
If the dpmac is connected to a fixed link PHY based on dpc config,
treat it as a fixed-link device, regardless of whether the "phy-handle"
property is present in the device tree node or not.
Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
- move dpaa2_mac_open and dpaa2_mac_stop out of
CONFIG_FSL_DPAA2_MAC_NETDEVS, since their implementation is necessary
regardless of it
- reorder ndo ops to match function implementation order
- update comment to describe the phy connection mode that's to be used -
it no longer depends on DPC, but on the device tree
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
free_netdev (put_device) already handles freeing the private data
structure, and KASAN will complain due to a free after free if we
explicitly do the same afterwards.
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
The MAC driver may need to issue MC commands while in atomic
context (e.g. dpaa2_mac_get_stats can be called from a critical
section), so we need to use MC portals that don't sleep while
waiting for a command response to arrive.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Ethtool ops get/set_settings() are deprecated, so implement
get/set_link_ksettings() instead.
These now call the corresponding phy_ethtool_ksettings_*
generic functions, as the old ones also got deprecated
and removed from the kernel entirely.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Introduce the DPAA2 mac driver, which manages Datapath
Media Access Control (DPMAC) objects discovered on the
MC bus.
This driver works as a proxy between phylib including phy
drivers and the Management Complex firmware. It receives
updates on link state changes from PHY lib and forwards
them to the Management Complex and receives interrupts
from the Management Complex whenever a request is made to
change the link state.
This is a squashed commit containing contributions of the
following owners:
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com>
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
Signed-off-by: Itai Katz <itai.katz@freescale.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Add the command build/parse APIs for operating on DPMAC
objects through the DPAA2 Management Complex.
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Link settings can be changed only when the interface is down. Disable
and re-enable the interface, if necessary, behind the scenes so that we do
not force users to an if down/up sequence.
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-11-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The register_netdev() call should be made only when ready to process any
user request on the interface. Move the call to be the last one issued
in the probe sequence.
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-10-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In the current state, the dpaa2-ethsw driver supports only one bridge
per DPSW object. Reword the error message so that this information is
much more clear.
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-9-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The ethsw_add_vlan() function is already called only when the VLAN is
not yet configured on the switch. Remove the redundant check.
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-8-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The ethtool core already zeroes the memory before calling
.get_ethtool_stats() thus making the memset unnecessary. Remove it.
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-7-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use a bool instead of an u8 in ethsw_set_learning() and
ethsw_port_set_flood() to encode an binary type property.
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-6-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Since ethtool will be loud enough if the .set_link_ksettings() callback
fails, remove the debug messages which do not add additional
information.
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-5-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
At probe time, only the DPSW object should be enabled without the
associated ports, which will get enabled on dev_open. Remove the
ethsw_open() and ethsw_stop() functions and replace them only with
dpsw_enable()/_disable().
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-3-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>