1 From 978b13baa79b68f3471cc2c5110a2e45aab9ca61 Mon Sep 17 00:00:00 2001
2 From: Ioana Ciornei <ioana.ciornei@nxp.com>
3 Date: Tue, 10 Dec 2019 17:26:06 +0200
4 Subject: [PATCH] staging: fsl-dpaa2/mac: do not call dpmac_set_link_state()
7 In case nothing changed in the link configuration do not call
8 dpmac_set_link_state().
9 This is needed in case of the following sequence of commands.
11 $ ip link set dev eth1 up; ip link set dev eth2 down
13 Phylib brings the link down when the aneg is started on the phy which
14 translates in a link down from phy in MC and confuses the MC linkman.
16 Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
18 drivers/staging/fsl-dpaa2/mac/mac.c | 16 ++++++++++------
19 1 file changed, 10 insertions(+), 6 deletions(-)
21 --- a/drivers/staging/fsl-dpaa2/mac/mac.c
22 +++ b/drivers/staging/fsl-dpaa2/mac/mac.c
23 @@ -158,12 +158,16 @@ static void dpaa2_mac_link_changed(struc
24 netif_carrier_off(netdev);
27 - if (priv->old_state.up != state.up ||
28 - priv->old_state.rate != state.rate ||
29 - priv->old_state.options != state.options) {
30 - priv->old_state = state;
31 - phy_print_status(phydev);
33 + /* Call the dpmac_set_link_state() only if there is a change in the
34 + * link configuration
36 + if (priv->old_state.up == state.up &&
37 + priv->old_state.rate == state.rate &&
38 + priv->old_state.options == state.options)
41 + priv->old_state = state;
42 + phy_print_status(phydev);
44 if (cmp_dpmac_ver(priv, DPMAC_LINK_AUTONEG_VER_MAJOR,
45 DPMAC_LINK_AUTONEG_VER_MINOR) < 0) {