From: Vladimir Oltean <olteanv@gmail.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com,
po.liu@nxp.com, xiaoliang.yang_1@nxp.com, kuba@kernel.org
Subject: [PATCH net 2/4] net: dsa: sja1105: unconditionally free old gating config
Date: Wed, 24 Jun 2020 16:54:45 +0300 [thread overview]
Message-ID: <20200624135447.3261002-3-olteanv@gmail.com> (raw)
In-Reply-To: <20200624135447.3261002-1-olteanv@gmail.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Currently sja1105_compose_gating_subschedule is not prepared to be
called for the case where we want to recompute the global tc-gate
configuration after we've deleted those actions on a port.
After deleting the tc-gate actions on the last port, max_cycle_time
would become zero, and that would incorrectly prevent
sja1105_free_gating_config from getting called.
So move the freeing function above the check for the need to apply a new
configuration.
Fixes: 834f8933d5dd ("net: dsa: sja1105: implement tc-gate using time-triggered virtual links")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
drivers/net/dsa/sja1105/sja1105_vl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105_vl.c b/drivers/net/dsa/sja1105/sja1105_vl.c
index 2b7966714e55..936b14cbb45d 100644
--- a/drivers/net/dsa/sja1105/sja1105_vl.c
+++ b/drivers/net/dsa/sja1105/sja1105_vl.c
@@ -98,6 +98,8 @@ static int sja1105_compose_gating_subschedule(struct sja1105_private *priv,
s64 its_base_time = 0;
int i, rc = 0;
+ sja1105_free_gating_config(gating_cfg);
+
list_for_each_entry(rule, &priv->flow_block.rules, list) {
if (rule->type != SJA1105_RULE_VL)
continue;
@@ -116,8 +118,6 @@ static int sja1105_compose_gating_subschedule(struct sja1105_private *priv,
dev_dbg(priv->ds->dev, "max_cycle_time %lld its_base_time %lld\n",
max_cycle_time, its_base_time);
- sja1105_free_gating_config(gating_cfg);
-
gating_cfg->base_time = its_base_time;
gating_cfg->cycle_time = max_cycle_time;
gating_cfg->num_entries = 0;
--
2.25.1
next prev parent reply other threads:[~2020-06-24 13:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 13:54 [PATCH net 0/4] Fixes for SJA1105 DSA tc-gate action Vladimir Oltean
2020-06-24 13:54 ` [PATCH net 1/4] net: dsa: sja1105: move sja1105_compose_gating_subschedule at the top Vladimir Oltean
2020-06-24 13:54 ` Vladimir Oltean [this message]
2020-06-24 13:54 ` [PATCH net 3/4] net: dsa: sja1105: recalculate gating subschedule after deleting tc-gate rules Vladimir Oltean
2020-06-24 13:54 ` [PATCH net 4/4] net: dsa: sja1105: fix tc-gate schedule with single element Vladimir Oltean
2020-06-25 23:07 ` [PATCH net 0/4] Fixes for SJA1105 DSA tc-gate action David Miller
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=20200624135447.3261002-3-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=po.liu@nxp.com \
--cc=vivien.didelot@gmail.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).