1. 11 Apr, 2019 2 commits
    • Leandro Dorileo's avatar
      net/sched: cbs: fix port_rate miscalculation · e0a7683d
      Leandro Dorileo authored
      The Credit Based Shaper heavily depends on link speed to calculate
      the scheduling credits, we can't properly calculate the credits if the
      device has failed to report the link speed.
      
      In that case we can't dequeue packets assuming a wrong port rate that will
      result into an inconsistent credit distribution.
      
      This patch makes sure we fail to dequeue case:
      
      1) __ethtool_get_link_ksettings() reports error or 2) the ethernet driver
      failed to set the ksettings' speed value (setting link speed to
      SPEED_UNKNOWN).
      
      Additionally we properly re calculate the port rate whenever the link speed
      is changed.
      
      Fixes: 3d0bd028 ("net/sched: Add support for HW offloading for CBS")
      Signed-off-by: default avatarLeandro Dorileo <leandro.maciel.dorileo@intel.com>
      Reviewed-by: default avatarVedang Patel <vedang.patel@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e0a7683d
    • Leandro Dorileo's avatar
      net/sched: taprio: fix picos_per_byte miscalculation · 7b9eba7b
      Leandro Dorileo authored
      The Time Aware Priority Scheduler is heavily dependent to link speed,
      it relies on it to calculate transmission bytes per cycle, we can't
      properly calculate the so called budget if the device has failed
      to report the link speed.
      
      In that case we can't dequeue packets assuming a wrong budget.
      This patch makes sure we fail to dequeue case:
      
      1) __ethtool_get_link_ksettings() reports error or 2) the ethernet
      driver failed to set the ksettings' speed value (setting link speed
      to SPEED_UNKNOWN).
      
      Additionally we re calculate the budget whenever the link speed is
      changed.
      
      Fixes: 5a781ccb ("tc: Add support for configuring the taprio scheduler")
      Signed-off-by: default avatarLeandro Dorileo <leandro.maciel.dorileo@intel.com>
      Reviewed-by: default avatarVedang Patel <vedang.patel@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7b9eba7b
  2. 10 Apr, 2019 8 commits
    • Jakub Kicinski's avatar
      net: strparser: fix comment · 93e21254
      Jakub Kicinski authored
      Fix comment.
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93e21254
    • David Ahern's avatar
      ipv4: Handle RTA_GATEWAY set to 0 · d73f80f9
      David Ahern authored
      Govindarajulu reported a regression with Network Manager which sends an
      RTA_GATEWAY attribute with the address set to 0. Fixup the handling of
      RTA_GATEWAY to only set fc_gw_family if the gateway address is actually
      set.
      
      Fixes: f35b794b ("ipv4: Prepare fib_config for IPv6 gateway")
      Reported-by: default avatarGovindarajulu Varadarajan <govind.varadar@gmail.com>
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d73f80f9
    • David S. Miller's avatar
      Merge branch 'net-sched-move-back-qlen-to-per-CPU-accounting' · 44b9b6ca
      David S. Miller authored
      Paolo Abeni says:
      
      ====================
      net: sched: move back qlen to per CPU accounting
      
      The commit 46b1c18f ("net: sched: put back q.qlen into a single location")
      introduced some measurable regression in the contended scenarios for
      lock qdisc.
      
      As Eric suggested we could replace q.qlen access with calls to qdisc_is_empty()
      in the datapath and revert the above commit. The TC subsystem updates
      qdisc->is_empty in a somewhat loose way: notably 'is_empty' is set only when
      the qdisc dequeue() calls return a NULL ptr. That is, the invocation after
      the last packet is dequeued.
      
      The above is good enough for BYPASS implementation - the only downside is that
      we end up avoiding the optimization for a very small time-frame - but will
      break hard things when internal structures consistency for classful qdisc
      relies on child qdisc_is_empty().
      
      A more strict 'is_empty' update adds a relevant complexity to its life-cycle, so
      this series takes a different approach: we allow lockless qdisc to switch from
      per CPU accounting to global stats accounting when the NOLOCK bit is cleared.
      Since most pieces of infrastructure are already in place, this requires very
      little changes to the pfifo_fast qdisc, and any later NOLOCK qdisc can hook
      there with little effort - no need to maintain two different implementations.
      
      The first 2 patches removes direct qlen access from non core TC code, the 3rd
      and 4th patches place and use the infrastructure to allow stats account
      switching and the 5th patch is the actual revert.
      
       v1 -> v2:
        - fixed build issues
        - more descriptive commit message for patch 5/5
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44b9b6ca
    • Paolo Abeni's avatar
      Revert: "net: sched: put back q.qlen into a single location" · 73eb628d
      Paolo Abeni authored
      This revert commit 46b1c18f ("net: sched: put back q.qlen into
      a single location").
      After the previous patch, when a NOLOCK qdisc is enslaved to a
      locking qdisc it switches to global stats accounting. As a consequence,
      when a classful qdisc accesses directly a child qdisc's qlen, such
      qdisc is not doing per CPU accounting and qlen value is consistent.
      
      In the control path nobody uses directly qlen since commit
      e5f0e8f8 ("net: sched: introduce and use qdisc tree flush/purge
      helpers"), so we can remove the contented atomic ops from the
      datapath.
      
      v1 -> v2:
       - complete the qdisc_qstats_atomic_qlen_dec() ->
         qdisc_qstats_cpu_qlen_dec() replacement, fix build issue
       - more descriptive commit message
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      73eb628d
    • Paolo Abeni's avatar
      net: sched: when clearing NOLOCK, clear TCQ_F_CPUSTATS, too · 8a53e616
      Paolo Abeni authored
      Since stats updating is always consistent with TCQ_F_CPUSTATS flag,
      we can disable it at qdisc creation time flipping such bit.
      
      In my experiments, if the NOLOCK flag is cleared, per CPU stats
      accounting does not give any measurable performance gain, but it
      waste some memory.
      
      Let's clear TCQ_F_CPUSTATS together with NOLOCK, when enslaving
      a NOLOCK qdisc to 'lock' one.
      
      Use stats update helper inside pfifo_fast, to cope correctly with
      TCQ_F_CPUSTATS flag change.
      
      As a side effect, q.qlen value for any child qdiscs is always
      consistent for all lock classfull qdiscs.
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8a53e616
    • Paolo Abeni's avatar
      net: sched: always do stats accounting according to TCQ_F_CPUSTATS · 9c01c9f1
      Paolo Abeni authored
      The core sched implementation checks independently for NOLOCK flag
      to acquire/release the root spin lock and for qdisc_is_percpu_stats()
      to account per CPU values in many places.
      
      This change update the last few places checking the TCQ_F_NOLOCK to
      do per CPU stats accounting according to qdisc_is_percpu_stats()
      value.
      
      The above allows to clean dev_requeue_skb() implementation a bit
      and makes stats update always consistent with a single flag.
      
      v1 -> v2:
       - do not move qdisc_is_empty definition, fix build issue
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c01c9f1
    • Paolo Abeni's avatar
      net: sched: prefer qdisc_is_empty() over direct qlen access · 1f5e6fdd
      Paolo Abeni authored
      When checking for root qdisc queue length, do not access directly q.qlen.
      In the following patches we will move back qlen accounting to per CPU
      values for NOLOCK qdiscs.
      
      Instead, prefer the qdisc_is_empty() helper usage.
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f5e6fdd
    • Paolo Abeni's avatar
      net: caif: avoid using qdisc_qlen() · b0a231a2
      Paolo Abeni authored
      Such helper does not cope correctly with NOLOCK qdiscs.
      In the following patches we will move back qlen to per CPU
      values for such qdiscs, so qdisc_qlen_sum() is not an option,
      too.
      Instead, use qlen only for lock qdiscs, and always set
      flow off for NOLOCK qdiscs with a not empty tx queue.
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b0a231a2
  3. 09 Apr, 2019 9 commits
  4. 08 Apr, 2019 21 commits