From: Simon Horman <simon.horman@corigine.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Michal Kubecek <mkubecek@suse.cz>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
Petr Machata <petrm@nvidia.com>,
Danielle Ratson <danieller@nvidia.com>,
Pranavi Somisetty <pranavi.somisetty@amd.com>,
Harini Katakam <harini.katakam@amd.com>,
Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Kurt Kanzenbach <kurt@linutronix.de>,
Gerhard Engleder <gerhard@engleder-embedded.com>,
Ferenc Fejes <ferenc.fejes@ericsson.com>,
Aaron Conole <aconole@redhat.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 net-next 1/9] net: enetc: fix MAC Merge layer remaining enabled until a link down event
Date: Thu, 20 Apr 2023 16:22:04 +0200 [thread overview]
Message-ID: <ZEFKjPR/VL6llxDm@corigine.com> (raw)
In-Reply-To: <20230418111459.811553-2-vladimir.oltean@nxp.com>
On Tue, Apr 18, 2023 at 02:14:51PM +0300, Vladimir Oltean wrote:
> 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>
> ---
> v1->v2: none
>
> drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> index 838750a03cf6..ee1ea71fe79e 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
> @@ -1041,10 +1041,13 @@ static int enetc_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg,
> else
> priv->active_offloads &= ~ENETC_F_QBU;
>
> - /* If link is up, enable MAC Merge right away */
> - if (!!(priv->active_offloads & ENETC_F_QBU) &&
> - !(val & ENETC_MMCSR_LINK_FAIL))
> - val |= ENETC_MMCSR_ME;
> + /* If link is up, enable/disable MAC Merge right away */
> + if (!(val & ENETC_MMCSR_LINK_FAIL)) {
> + if (!!(priv->active_offloads & ENETC_F_QBU))
nit: The !!() seems unnecessary,
I wonder if it can be written in a simpler way as:
if (priv->active_offloads & ENETC_F_QBU)
> + val |= ENETC_MMCSR_ME;
> + else
> + val &= ~ENETC_MMCSR_ME;
> + }
>
> val &= ~ENETC_MMCSR_VT_MASK;
> val |= ENETC_MMCSR_VT(cfg->verify_time);
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-04-20 14:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 11:14 [PATCH v2 net-next 0/9] ethtool mm API consolidation Vladimir Oltean
2023-04-18 11:14 ` [PATCH v2 net-next 1/9] net: enetc: fix MAC Merge layer remaining enabled until a link down event Vladimir Oltean
2023-04-20 14:22 ` Simon Horman [this message]
2023-04-20 17:03 ` Vladimir Oltean
2023-04-21 9:01 ` Simon Horman
2023-04-18 11:14 ` [PATCH v2 net-next 2/9] net: enetc: report mm tx-active based on tx-enabled and verify-status Vladimir Oltean
2023-04-20 14:40 ` Simon Horman
2023-04-18 11:14 ` [PATCH v2 net-next 3/9] net: enetc: only commit preemptible TCs to hardware when MM TX is active Vladimir Oltean
2023-04-20 14:42 ` Simon Horman
2023-04-20 16:34 ` Vladimir Oltean
2023-04-20 16:49 ` Simon Horman
2023-04-18 11:14 ` [PATCH v2 net-next 4/9] net: enetc: include MAC Merge / FP registers in register dump Vladimir Oltean
2023-04-20 14:38 ` Simon Horman
2023-04-20 16:58 ` Vladimir Oltean
2023-04-21 9:03 ` Simon Horman
2023-04-18 11:14 ` [PATCH v2 net-next 5/9] net: ethtool: mm: sanitize some UAPI configurations Vladimir Oltean
2023-04-20 14:43 ` Simon Horman
2023-04-18 11:14 ` [PATCH v2 net-next 6/9] selftests: forwarding: sch_tbf_*: Add a pre-run hook Vladimir Oltean
2023-04-18 11:14 ` [PATCH v2 net-next 7/9] selftests: forwarding: generalize bail_on_lldpad from mlxsw Vladimir Oltean
2023-04-18 11:14 ` [PATCH v2 net-next 8/9] selftests: forwarding: introduce helper for standard ethtool counters Vladimir Oltean
2023-04-18 11:14 ` [PATCH v2 net-next 9/9] selftests: forwarding: add a test for MAC Merge layer Vladimir Oltean
2023-04-21 3:10 ` [PATCH v2 net-next 0/9] ethtool mm API consolidation patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZEFKjPR/VL6llxDm@corigine.com \
--to=simon.horman@corigine.com \
--cc=aconole@redhat.com \
--cc=claudiu.manoil@nxp.com \
--cc=danieller@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ferenc.fejes@ericsson.com \
--cc=gerhard@engleder-embedded.com \
--cc=harini.katakam@amd.com \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=pranavi.somisetty@amd.com \
--cc=vinicius.gomes@intel.com \
--cc=vladimir.oltean@nxp.com \
--cc=xiaoliang.yang_1@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).