public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail•com>
To: xiyou.wangcong@gmail•com, jiri@resnulli•us, davem@davemloft•net,
	vinicius.gomes@intel•com, vedang.patel@intel•com,
	leandro.maciel.dorileo@intel•com
Cc: netdev@vger•kernel.org, Vladimir Oltean <olteanv@gmail•com>
Subject: [PATCH v2 net 3/3] net/sched: cbs: Set default link speed to 10 Mbps in cbs_set_port_rate
Date: Fri, 30 Aug 2019 04:07:23 +0300	[thread overview]
Message-ID: <20190830010723.32096-4-olteanv@gmail.com> (raw)
In-Reply-To: <20190830010723.32096-1-olteanv@gmail.com>

The discussion to be made is absolutely the same as in the case of
previous patch ("taprio: Set default link speed to 10 Mbps in
taprio_set_picos_per_byte"). Nothing is lost when setting a default.

Cc: Leandro Dorileo <leandro.maciel.dorileo@intel•com>
Fixes: e0a7683d30e9 ("net/sched: cbs: fix port_rate miscalculation")
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel•com>
Signed-off-by: Vladimir Oltean <olteanv@gmail•com>
---
Changes in v2:
None.

 net/sched/sch_cbs.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
index 732e109c3055..810645b5c086 100644
--- a/net/sched/sch_cbs.c
+++ b/net/sched/sch_cbs.c
@@ -181,11 +181,6 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)
 	s64 credits;
 	int len;
 
-	if (atomic64_read(&q->port_rate) == -1) {
-		WARN_ONCE(1, "cbs: dequeue() called with unknown port rate.");
-		return NULL;
-	}
-
 	if (q->credits < 0) {
 		credits = timediff_to_credits(now - q->last, q->idleslope);
 
@@ -303,11 +298,19 @@ static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q,
 static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q)
 {
 	struct ethtool_link_ksettings ecmd;
+	int speed = SPEED_10;
 	int port_rate = -1;
+	int err;
+
+	err = __ethtool_get_link_ksettings(dev, &ecmd);
+	if (err < 0)
+		goto skip;
+
+	if (ecmd.base.speed != SPEED_UNKNOWN)
+		speed = ecmd.base.speed;
 
-	if (!__ethtool_get_link_ksettings(dev, &ecmd) &&
-	    ecmd.base.speed != SPEED_UNKNOWN)
-		port_rate = ecmd.base.speed * 1000 * BYTES_PER_KBIT;
+skip:
+	port_rate = speed * 1000 * BYTES_PER_KBIT;
 
 	atomic64_set(&q->port_rate, port_rate);
 	netdev_dbg(dev, "cbs: set %s's port_rate to: %lld, linkspeed: %d\n",
-- 
2.17.1


  parent reply	other threads:[~2019-08-30  1:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30  1:07 [PATCH v2 net 0/3] Fix issues in tc-taprio and tc-cbs Vladimir Oltean
2019-08-30  1:07 ` [PATCH v2 net 1/3] taprio: Fix kernel panic in taprio_destroy Vladimir Oltean
2019-08-30 22:30   ` Vinicius Costa Gomes
2019-08-30  1:07 ` [PATCH v2 net 2/3] taprio: Set default link speed to 10 Mbps in taprio_set_picos_per_byte Vladimir Oltean
2019-08-30  1:07 ` Vladimir Oltean [this message]
2019-09-01  1:46 ` [PATCH v2 net 0/3] Fix issues in tc-taprio and tc-cbs 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=20190830010723.32096-4-olteanv@gmail.com \
    --to=olteanv@gmail$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=jiri@resnulli$(echo .)us \
    --cc=leandro.maciel.dorileo@intel$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=vedang.patel@intel$(echo .)com \
    --cc=vinicius.gomes@intel$(echo .)com \
    --cc=xiyou.wangcong@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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