net: mvpp2: fix detection of 10G SFP modules
authorBaruch Siach <baruch@tkos.co.il>
Tue, 4 Dec 2018 14:03:52 +0000 (16:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Dec 2018 13:15:22 +0000 (14:15 +0100)
commitf124acc92c839a862fb46a6cf049017f389a7637
treeb0bea7f7cf2faf2cb1ec33382d75687bf8a2529e
parent42d040e2c7b97ff2ff5c1cb5d097aa6a057d0ba2
net: mvpp2: fix detection of 10G SFP modules

[ Upstream commit 01b3fd5ac97caffb8e5d5bd85086da33db3b361f ]

The mvpp2_phylink_validate() relies on the interface field of
phylink_link_state to determine valid link modes. However, when called
from phylink_sfp_module_insert() this field in not initialized. The
default switch case then excludes 10G link modes. This allows 10G SFP
modules that are detected correctly to be configured at max rate of
2.5G.

Catch the uninitialized PHY mode case, and allow 10G rates.

Fixes: d97c9f4ab000b ("net: mvpp2: 1000baseX support")
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: Antoine Tenart <antoine.tenart@bootlin.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c