lkml.org 
[lkml]   [2020]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 529/639] net/sched: cbs: Set default link speed to 10 Mbps in cbs_set_port_rate
    Date
    From: Vladimir Oltean <olteanv@gmail.com>

    [ Upstream commit 1c6c09a0ae62fa3ea8f8ead2ac3920e6fff2de64 ]

    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>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 b3c8d04929df2..289f66b9238d3 100644
    --- a/net/sched/sch_cbs.c
    +++ b/net/sched/sch_cbs.c
    @@ -185,11 +185,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);

    @@ -307,11 +302,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.20.1


    \
     
     \ /
      Last update: 2020-01-24 12:30    [W:2.911 / U:1.216 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site