1. Oct 06, 2018
  2. Oct 05, 2018
    • Cong Wang's avatar
      net_sched: convert idrinfo->lock from spinlock to a mutex · 95278dda
      Cong Wang authored
      In commit ec3ed293 ("net_sched: change tcf_del_walker() to take idrinfo->lock")
      we move fl_hw_destroy_tmplt() to a workqueue to avoid blocking
      with the spinlock held. Unfortunately, this causes a lot of
      troubles here:
      
      1. tcf_chain_destroy() could be called right after we queue the work
         but before the work runs. This is a use-after-free.
      
      2. The chain refcnt is already 0, we can't even just hold it again.
         We can check refcnt==1 but it is ugly.
      
      3. The chain with refcnt 0 is still visible in its block, which means
         it could be still found and used!
      
      4. The block has a refcnt too, we can't hold it without introducing a
         proper API either.
      
      We can make it working but the end result is ugly. Instead of wasting
      time on reviewing it, let's just convert the troubling spinlock to
      a mutex, which allows us to use non-atomic allocations too.
      
      Fixes: ec3ed293
      
       ("net_sched: change tcf_del_walker() to take idrinfo->lock")
      Reported-by: default avatarIdo Schimmel <idosch@idosch.org>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Vlad Buslov <vladbu@mellanox.com>
      Cc: Jiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Tested-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      95278dda
    • David Ahern's avatar
      net/neigh: Extend dump filter to proxy neighbor dumps · 6f52f80e
      David Ahern authored
      
      
      Move the attribute parsing from neigh_dump_table to neigh_dump_info, and
      pass the filter arguments down to neigh_dump_table in a new struct. Add
      the filter option to proxy neigh dumps as well to make them consistent.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f52f80e
    • David S. Miller's avatar
      Merge branch 'net-metrics-consolidate' · 2970f2a8
      David S. Miller authored
      David Ahern says:
      
      ====================
      net: Consolidate metrics handling for ipv4 and ipv6
      
      As part of the IPv6 fib info refactoring, the intent was to make metrics
      handling for ipv6 identical to ipv4. One oversight in ip6_dst_destroy
      led to confusion and a couple of incomplete attempts at finding and
      fixing the resulting memory leak which was ultimately resolved by
      ce7ea4af
      
       ("ipv6: fix memory leak on dst->_metrics").
      
      Refactor metrics hanlding make the code really identical for v4 and v6,
      and add a few test cases.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2970f2a8
    • David Ahern's avatar
      fib_tests: Add tests for metrics on routes · a0e11da7
      David Ahern authored
      
      
      Add ipv4 and ipv6 test cases for metrics (mtu) when fib entries are
      created. Can be used with kmemleak to see leaks with both fib entries
      and dst_entry.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a0e11da7
    • David Ahern's avatar
      net: Move free of dst_metrics to helper · 1620a336
      David Ahern authored
      
      
      Move the refcounting and potential free of dst metrics associated
      for ipv4 and ipv6 to a common helper.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1620a336
    • David Ahern's avatar
      net: common metrics init helper for dst_entry · e1255ed4
      David Ahern authored
      
      
      ipv4 and ipv6 both use refcounted metrics if FIB entries have metrics set.
      Move the common initialization code to a helper and use for both protocols.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e1255ed4
    • David Ahern's avatar
      net: Move free of fib_metrics to helper · cc5f0eb2
      David Ahern authored
      
      
      Move the refcounting and potential free of dst metrics associated
      with a fib entry to a helper and use it in both ipv4 and ipv6.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc5f0eb2
    • David Ahern's avatar
      net: common metrics init helper for FIB entries · 767a2217
      David Ahern authored
      
      
      Consolidate initialization of ipv4 and ipv6 metrics when fib entries
      are created into a single helper, ip_fib_metrics_init, that handles
      the call to ip_metrics_convert.
      
      If no metrics are defined for the fib entry, then the metrics is set
      to dst_default_metrics.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      767a2217
    • Jakub Kicinski's avatar
      net: sched: remove unused helpers · d26d4b19
      Jakub Kicinski authored
      
      
      tcf_block_dev() doesn't seem to be used anywhere in the tree.
      
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d26d4b19
    • Hangbin Liu's avatar
      geneve: allow to clear ttl inherit · a97d97ba
      Hangbin Liu authored
      As Michal remaind, we should allow to clear ttl inherit. Then we will
      have three states:
      
      1. set the flag, and do ttl inherit.
      2. do not set the flag, use configured ttl value, or default ttl (0) if
         not set.
      3. disable ttl inherit, use previous configured ttl value, or default ttl (0).
      
      Fixes: 52d0d404
      
       ("geneve: add ttl inherit support")
      CC: Michal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a97d97ba
    • Vinicius Costa Gomes's avatar
      tc: Add support for configuring the taprio scheduler · 5a781ccb
      Vinicius Costa Gomes authored
      
      
      This traffic scheduler allows traffic classes states (transmission
      allowed/not allowed, in the simplest case) to be scheduled, according
      to a pre-generated time sequence. This is the basis of the IEEE
      802.1Qbv specification.
      
      Example configuration:
      
      tc qdisc replace dev enp3s0 parent root handle 100 taprio \
                num_tc 3 \
      	  map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
      	  queues 1@0 1@1 2@2 \
      	  base-time 1528743495910289987 \
      	  sched-entry S 01 300000 \
      	  sched-entry S 02 300000 \
      	  sched-entry S 04 300000 \
      	  clockid CLOCK_TAI
      
      The configuration format is similar to mqprio. The main difference is
      the presence of a schedule, built by multiple "sched-entry"
      definitions, each entry has the following format:
      
           sched-entry <CMD> <GATE MASK> <INTERVAL>
      
      The only supported <CMD> is "S", which means "SetGateStates",
      following the IEEE 802.1Qbv-2015 definition (Table 8-6). <GATE MASK>
      is a bitmask where each bit is a associated with a traffic class, so
      bit 0 (the least significant bit) being "on" means that traffic class
      0 is "active" for that schedule entry. <INTERVAL> is a time duration
      in nanoseconds that specifies for how long that state defined by <CMD>
      and <GATE MASK> should be held before moving to the next entry.
      
      This schedule is circular, that is, after the last entry is executed
      it starts from the first one, indefinitely.
      
      The other parameters can be defined as follows:
      
       - base-time: specifies the instant when the schedule starts, if
        'base-time' is a time in the past, the schedule will start at
      
       	      base-time + (N * cycle-time)
      
         where N is the smallest integer so the resulting time is greater
         than "now", and "cycle-time" is the sum of all the intervals of the
         entries in the schedule;
      
       - clockid: specifies the reference clock to be used;
      
      The parameters should be similar to what the IEEE 802.1Q family of
      specification defines.
      
      Signed-off-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a781ccb
    • David S. Miller's avatar
      Merge branch 'bnxt_en-devlink-param-updates' · 34f8c58f
      David S. Miller authored
      
      
      Vasundhara Volam says:
      
      ====================
      bnxt_en: devlink param updates
      
      This patchset adds support for 3 generic and 1 driver-specific devlink
      parameters. Add documentation for these configuration parameters.
      
      Also, this patchset adds support to return proper error code if
      HWRM_NVM_GET/SET_VARIABLE commands return error code
      HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED.
      
      v3->v4:
      -Remove extra definition of NVM_OFF_HW_TC_OFFLOAD from bnxt_devlink.h
      -Remove type information for generic parameters from
      devlink-params-bnxt.txt
      
      v2->v3:
      -Remove description of generic parameters from devlink-params-bnxt.txt
      
      v1->v2:
      -Remove hw_tc_offload parameter.
      -Update all patches with Cc of MAINTAINERS.
      -Add more description in commit message for device specific parameter.
      -Add a new Documentation/networking/devlink-params.txt with some
      generic devlink parameters information.
      -Add a new Documentation/networking/devlink-params-bnxt.txt with devlink
      parameters information that are supported by bnxt_en driver.
      ====================
      
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      34f8c58f