Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4050874ybe; Mon, 9 Sep 2019 03:27:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaktvGxv2eB8ZCpCnT0HPMFbDTLvvIlr72qJY357PHyExXdtOJX0voYIB6cWgKoOtrP1aJ X-Received: by 2002:a50:d084:: with SMTP id v4mr23988504edd.48.1568024825377; Mon, 09 Sep 2019 03:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568024825; cv=none; d=google.com; s=arc-20160816; b=u3gn9uwN8JKtLS8eW3phN+swVJhT3AYA0G/D3aiKJGZPmd6PtL8wU0bC5atLNkwtZV goGM0EQc7j3o87qkVpku+XvJs8z0BMPV28mY5QP91FkR54qIXQU6Jgem48b/XgNjUnPM PyzOASUFLj3pUIH8LpxWH38qLV84QM7kxuKaYV/AXMmE8y1iVCNsygwcRIrkmTf0vdYU 0c8gQwpWyLf81ZXO20z9cJdY/nEAznDcQ+B4+ICUXL1KAouNTi1RE32B5Nh9zlGgYC6B Fh1kJ5CQqUsF+tStawSACuxbuUZJwqSu3USYADdembPI5PkeWD2LcHNufzNHSukDIvDk Pcqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QqhJ2dEVBAFk84CWeXU0nFS8QB4z6mlAgrLGcjX2XAA=; b=TrIQ9KWnypShhK/J+XY9fHex6c6SqZyXUxtiXsCeweFhptjUyQoPevj11pt/9cmQtq XbXSdvEVXLqlQILLSvSoeABLNraOlBs8E8qswD8Jd3UO4YNTtHH09Y9z1E34n7DL0Tj2 ynRgIPVLithH2kaoCOeYWuaAabsPVvoBIXTlyutw8w378UcTSQsN0aw7fVNbpk0dbCZx I8zMDCdY/EJNrhkJMjKcSIHHZs0X7A43tUPtChATseRMuMjU84UEeV8llf7ig5xQmtvT V1+dmtn4aDs1++b5mycUwjBN6y4cG4JShq/H5Ikw+cyVp+OQNbvi1vQb9xRsR34Ns161 to0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I5n9xi+B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si7100790ejw.309.2019.09.09.03.26.41; Mon, 09 Sep 2019 03:27:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I5n9xi+B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732679AbfIHMvf (ORCPT + 99 others); Sun, 8 Sep 2019 08:51:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:42934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732615AbfIHMv1 (ORCPT ); Sun, 8 Sep 2019 08:51:27 -0400 Received: from localhost (unknown [62.28.240.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C4A2218AC; Sun, 8 Sep 2019 12:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567947087; bh=l2YNntziq5/IXjI2hxmN5NXKaQAoKbhgICVAzS5Y+CM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5n9xi+BI24PLCGydYhBoeEgPSctlt6He3El4rr/WhlmX4BB+ghUWsQWSv3bLpenl Qu+tOy67IMFabdkzW4yVwtW0/h3LpJlMEXq8Bdr+TYe7iDisgfW8ZZgMT3XHdlQ7pB /9Be6D69pL09o3CzlyCFDZpP+TQfzwUxNO1Xtjlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leandro Dorileo , Vinicius Costa Gomes , Vladimir Oltean , "David S. Miller" Subject: [PATCH 5.2 14/94] net/sched: cbs: Set default link speed to 10 Mbps in cbs_set_port_rate Date: Sun, 8 Sep 2019 13:41:10 +0100 Message-Id: <20190908121150.841099193@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121150.420989666@linuxfoundation.org> References: <20190908121150.420989666@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean 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 Fixes: e0a7683d30e9 ("net/sched: cbs: fix port_rate miscalculation") Acked-by: Vinicius Costa Gomes Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_cbs.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) --- a/net/sched/sch_cbs.c +++ b/net/sched/sch_cbs.c @@ -181,11 +181,6 @@ static struct sk_buff *cbs_dequeue_soft( 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 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",