]> git.baikalelectronics.ru Git - kernel.git/commit
net: thunderx: Correctly distinguish between VF and LMAC count
authorPavel Fedin <p.fedin@samsung.com>
Tue, 8 Dec 2015 07:37:44 +0000 (10:37 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Dec 2015 03:44:55 +0000 (22:44 -0500)
commit3d20d2cae84505ecc4161605dd5acd686439ab9e
tree15d0f645273f80035bfc03131ab53c001f5867f7
parent3fee7fb5eba2279fd336cf48270c5e586bdd7b7e
net: thunderx: Correctly distinguish between VF and LMAC count

Commit 5c46df075483
("net: thunderx: Enable BGX LMAC's RX/TX only after VF is up")
introduces lmac_cnt member and starts verifying VF number against it.
This is plain wrong, and works only because currently we have hardcoded
1:1 mapping between VFs and LMACs, and in this case num_vf_en and
lmac_cnt are always equal. However in future this may change, and the
code will badly misbehave. The worst consequence of this is failure to
deliver link status messages, causing VFs to go defunct because since
commit f03d718de3ba ("net: thunderx: Switchon carrier only upon
interface link up") VF will not fully bring itself up without it.

This patch fixes the potential problem by doing VF number checks against
the num_vf_en. Since lmac_cnt is not used anywhere else, it is removed.

Additionally some duplicated code is factored out into nic_enable_vf()

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/thunder/nic_main.c