]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
net: dsa: mv88e6xxx: fix few issues in mv88e6390x_port_set_cmode
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 23 Mar 2019 18:41:32 +0000 (19:41 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Wed, 3 Apr 2019 18:11:40 +0000 (13:11 -0500)
commitda2a78add0777a2e515b4ab503c530015ae54a7e
treea7a65c5b9d6d691f7c513be59578426be19751c7
parent2f94bb4a00952d00f29025df8438e1f090f365b3
net: dsa: mv88e6xxx: fix few issues in mv88e6390x_port_set_cmode

BugLink: https://bugs.launchpad.net/bugs/1823060
[ Upstream commit 5ceaeb99ffb4dc002d20f6ac243c19a85e2c7a76 ]

This patches fixes few issues in mv88e6390x_port_set_cmode().

1. When entering the function the old cmode may be 0, in this case
   mv88e6390x_serdes_get_lane() returns -ENODEV. As result we bail
   out and have no chance to set a new mode. Therefore deal properly
   with -ENODEV.

2. Once we have disabled power and irq, let's set the cached cmode to 0.
   This reflects the actual status and is cleaner if we bail out with an
   error in the following function calls.

3. The cached cmode is used by mv88e6390x_serdes_get_lane(),
   mv88e6390_serdes_power_lane() and mv88e6390_serdes_irq_enable().
   Currently we set the cached mode to the new one at the very end of
   the function only, means until then we use the old one what may be
   wrong.

4. When calling mv88e6390_serdes_irq_enable() we use the lane value
   belonging to the old cmode. Get the lane belonging to the new cmode
   before calling this function.

It's hard to provide a good "Fixes" tag because quite a few smaller
changes have been done to the code in question recently.

Fixes: d235c48b40d3 ("net: dsa: mv88e6xxx: power serdes on/off for 10G interfaces on 6390X")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/net/dsa/mv88e6xxx/port.c