Skip to content

Commit 59be75d

Browse files
vladimirolteankuba-moo
authored andcommitted
net: enetc: fix MAC Merge layer remaining enabled until a link down event
Current enetc_set_mm() is designed to set the priv->active_offloads bit ENETC_F_QBU for enetc_mm_link_state_update() to act on, but if the link is already up, it modifies the ENETC_MMCSR_ME ("Merge Enable") bit directly. The problem is that it only *sets* ENETC_MMCSR_ME if the link is up, it doesn't *clear* it if needed. So subsequent enetc_get_mm() calls still see tx-enabled as true, up until a link down event, which is when enetc_mm_link_state_update() will get called. This is not a functional issue as far as I can assess. It has only come up because I'd like to uphold a simple API rule in core ethtool code: the pMAC cannot be disabled if TX is going to be enabled. Currently, the fact that TX remains enabled for longer than expected (after the enetc_set_mm() call that disables it) is going to violate that rule, which is how it was caught. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 787e614 commit 59be75d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/net/ethernet/freescale/enetc/enetc_ethtool.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,13 @@ static int enetc_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg,
10411041
else
10421042
priv->active_offloads &= ~ENETC_F_QBU;
10431043

1044-
/* If link is up, enable MAC Merge right away */
1045-
if (!!(priv->active_offloads & ENETC_F_QBU) &&
1046-
!(val & ENETC_MMCSR_LINK_FAIL))
1047-
val |= ENETC_MMCSR_ME;
1044+
/* If link is up, enable/disable MAC Merge right away */
1045+
if (!(val & ENETC_MMCSR_LINK_FAIL)) {
1046+
if (!!(priv->active_offloads & ENETC_F_QBU))
1047+
val |= ENETC_MMCSR_ME;
1048+
else
1049+
val &= ~ENETC_MMCSR_ME;
1050+
}
10481051

10491052
val &= ~ENETC_MMCSR_VT_MASK;
10501053
val |= ENETC_MMCSR_VT(cfg->verify_time);

0 commit comments

Comments
 (0)