1. 11 Nov, 2017 17 commits
    • Michael Grzeschik's avatar
      net: macb: add of_node_put to error paths · 66ee6a06
      Michael Grzeschik authored
      We add the call of_node_put(bp->phy_node) to all associated error
      paths for memory clean up.
      Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      66ee6a06
    • Michael Grzeschik's avatar
      net: macb: add of_phy_deregister_fixed_link to error paths · 9ce98140
      Michael Grzeschik authored
      We add the call of_phy_deregister_fixed_link to all associated
      error paths for memory clean up.
      Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9ce98140
    • Miquel Raynal's avatar
      net: mvpp2: fix GOP statistics loop start and stop conditions · e5c500eb
      Miquel Raynal authored
      GOP statistics from all ports of one instance of the driver are gathered
      with one work recalled in loop in a workqueue. The loop is started when
      a port is up, and stopped when a port is down. This last condition is
      obviously wrong.
      
      Fix this by having a work per port. This way, starting and stoping it
      when the port is up or down will be fine, while minimizing unnecessary
      CPU usage.
      
      Fixes: 118d6298 ("net: mvpp2: add ethtool GOP statistics")
      Reported-by: default avatarStefan Chulski <stefanc@marvell.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@free-electrons.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e5c500eb
    • David S. Miller's avatar
      Merge branch 'hns3-bug-fixes' · fc981359
      David S. Miller authored
      Lipeng says:
      
      ====================
      net: hns3: Bug fixes & Code improvements in HNS3 driver
      
      This patch-set introduces some bug fixes and code improvements.
      As [patch 1/2] depends on the patch {5392902d net: hns3: Consistently using
      GENMASK in hns3 driver}, which exists in net-next, not exists in net, so
      push this serise to nex-next.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fc981359
    • Fuyun Liang's avatar
      net: hns3: cleanup mac auto-negotiation state query in hclge_update_speed_duplex · c040366b
      Fuyun Liang authored
      When checking whether auto-negotiation is on, driver only needs to
      check the value of mac.autoneg(SW) directly, and does not need to
      query it from hardware. Because this value is always synchronized
      with the auto-negotiation state of hardware.
      
      This patch removes mac auto-negotiation state query in
      hclge_update_speed_duplex().
      
      Fixes: 46a3df9f (net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support)
      Signed-off-by: default avatarFuyun Liang <liangfuyun1@huawei.com>
      Signed-off-by: default avatarLipeng <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c040366b
    • Fuyun Liang's avatar
      net: hns3: fix a bug when getting phy address from NCL_config file · 39e2151f
      Fuyun Liang authored
      Driver gets phy address from NCL_config file and uses the phy address
      to initialize phydev. There are 5 bits for phy address. And C22 phy
      address has 5 bits. So 0-31 are all valid address for phy. If there
      is no phy, it will crash. Because driver always get a valid phy address.
      
      This patch fixes the phy address to 8 bits, and use 0xff to indicate
      invalid phy address.
      
      Fixes: 46a3df9f (net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support)
      Signed-off-by: default avatarFuyun Liang <liangfuyun1@huawei.com>
      Signed-off-by: default avatarLipeng <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      39e2151f
    • David Ahern's avatar
      net: netlink: Update attr validation to require exact length for some types · 28033ae4
      David Ahern authored
      Attributes using NLA_U* and NLA_S* (where * is 8, 16,32 and 64) are
      expected to be an exact length. Split these data types from
      nla_attr_minlen into nla_attr_len and update validate_nla to require
      the attribute to have exact length for them.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      28033ae4
    • Maciej Żenczykowski's avatar
      net: ipv6: sysctl to specify IPv6 ND traffic class · 2210d6b2
      Maciej Żenczykowski authored
      Add a per-device sysctl to specify the default traffic class to use for
      kernel originated IPv6 Neighbour Discovery packets.
      
      Currently this includes:
      
        - Router Solicitation (ICMPv6 type 133)
          ndisc_send_rs() -> ndisc_send_skb() -> ip6_nd_hdr()
      
        - Neighbour Solicitation (ICMPv6 type 135)
          ndisc_send_ns() -> ndisc_send_skb() -> ip6_nd_hdr()
      
        - Neighbour Advertisement (ICMPv6 type 136)
          ndisc_send_na() -> ndisc_send_skb() -> ip6_nd_hdr()
      
        - Redirect (ICMPv6 type 137)
          ndisc_send_redirect() -> ndisc_send_skb() -> ip6_nd_hdr()
      
      and if the kernel ever gets around to generating RA's,
      it would presumably also include:
      
        - Router Advertisement (ICMPv6 type 134)
          (radvd daemon could pick up on the kernel setting and use it)
      
      Interface drivers may examine the Traffic Class value and translate
      the DiffServ Code Point into a link-layer appropriate traffic
      prioritization scheme.  An example of mapping IETF DSCP values to
      IEEE 802.11 User Priority values can be found here:
      
          https://tools.ietf.org/html/draft-ietf-tsvwg-ieee-802-11
      
      The expected primary use case is to properly prioritize ND over wifi.
      
      Testing:
        jzem22:~# cat /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        0
        jzem22:~# echo -1 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        -bash: echo: write error: Invalid argument
        jzem22:~# echo 256 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        -bash: echo: write error: Invalid argument
        jzem22:~# echo 0 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        jzem22:~# echo 255 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        jzem22:~# cat /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        255
        jzem22:~# echo 34 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        jzem22:~# cat /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        34
      
        jzem22:~# echo $[0xDC] > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        jzem22:~# tcpdump -v -i eth0 icmp6 and src host jzem22.pgc and dst host fe80::1
        tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
        IP6 (class 0xdc, hlim 255, next-header ICMPv6 (58) payload length: 24)
        jzem22.pgc > fe80::1: [icmp6 sum ok] ICMP6, neighbor advertisement,
        length 24, tgt is jzem22.pgc, Flags [solicited]
      
      (based on original change written by Erik Kline, with minor changes)
      
      v2: fix 'suspicious rcu_dereference_check() usage'
          by explicitly grabbing the rcu_read_lock.
      
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: default avatarErik Kline <ek@google.com>
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2210d6b2
    • Samuel Mendoza-Jonas's avatar
      net/ncsi: Don't return error on normal response · 04bad8bd
      Samuel Mendoza-Jonas authored
      Several response handlers return EBUSY if the data corresponding to the
      command/response pair is already set. There is no reason to return an
      error here; the channel is advertising something as enabled because we
      told it to enable it, and it's possible that the feature has been
      enabled previously.
      Signed-off-by: default avatarSamuel Mendoza-Jonas <sam@mendozajonas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04bad8bd
    • Samuel Mendoza-Jonas's avatar
      net/ncsi: Improve general state logging · 9ef8690b
      Samuel Mendoza-Jonas authored
      The NCSI driver is mostly silent which becomes a headache when trying to
      determine what has occurred on the NCSI connection. This adds additional
      logging in a few key areas such as state transitions and calling out
      certain errors more visibly.
      Signed-off-by: default avatarSamuel Mendoza-Jonas <sam@mendozajonas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9ef8690b
    • David S. Miller's avatar
      Merge branch 'bpftool-show-filenames-of-pinned-objects' · a8a6f1e4
      David S. Miller authored
      Prashant Bhole says:
      
      ====================
      tools: bpftool: show filenames of pinned objects
      
      This patchset adds support to show pinned objects in object details.
      
      Patch1 adds a funtionality to open a path in bpf-fs regardless of its object
      type.
      
      Patch2 adds actual functionality by scanning the bpf-fs once and adding
      object information in hash table, with object id as a key. One object may be
      associated with multiple paths because an object can be pinned multiple times
      
      Patch3 adds command line option to enable this functionality. Making it optional
      because scanning bpf-fs can be costly.
      ====================
      Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      a8a6f1e4
    • Prashant Bhole's avatar
      tools: bpftool: optionally show filenames of pinned objects · c541b734
      Prashant Bhole authored
      Making it optional to show file names of pinned objects because
      it scans complete bpf-fs filesystem which is costly.
      Added option -f|--bpffs. Documentation updated.
      Signed-off-by: default avatarPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c541b734
    • Prashant Bhole's avatar
      tools: bpftool: show filenames of pinned objects · 4990f1f4
      Prashant Bhole authored
      Added support to show filenames of pinned objects.
      
      For example:
      
      root@test# ./bpftool prog
      3: tracepoint  name tracepoint__irq  tag f677a7dd722299a3
          loaded_at Oct 26/11:39  uid 0
          xlated 160B  not jited  memlock 4096B  map_ids 4
          pinned /sys/fs/bpf/softirq_prog
      
      4: tracepoint  name tracepoint__irq  tag ea5dc530d00b92b6
          loaded_at Oct 26/11:39  uid 0
          xlated 392B  not jited  memlock 4096B  map_ids 4,6
      
      root@test# ./bpftool --json --pretty prog
      [{
              "id": 3,
              "type": "tracepoint",
              "name": "tracepoint__irq",
              "tag": "f677a7dd722299a3",
              "loaded_at": "Oct 26/11:39",
              "uid": 0,
              "bytes_xlated": 160,
              "jited": false,
              "bytes_memlock": 4096,
              "map_ids": [4
              ],
              "pinned": ["/sys/fs/bpf/softirq_prog"
              ]
          },{
              "id": 4,
              "type": "tracepoint",
              "name": "tracepoint__irq",
              "tag": "ea5dc530d00b92b6",
              "loaded_at": "Oct 26/11:39",
              "uid": 0,
              "bytes_xlated": 392,
              "jited": false,
              "bytes_memlock": 4096,
              "map_ids": [4,6
              ],
              "pinned": []
          }
      ]
      
      root@test# ./bpftool map
      4: hash  name start  flags 0x0
          key 4B  value 16B  max_entries 10240  memlock 1003520B
          pinned /sys/fs/bpf/softirq_map1
      5: hash  name iptr  flags 0x0
          key 4B  value 8B  max_entries 10240  memlock 921600B
      
      root@test# ./bpftool --json --pretty map
      [{
              "id": 4,
              "type": "hash",
              "name": "start",
              "flags": 0,
              "bytes_key": 4,
              "bytes_value": 16,
              "max_entries": 10240,
              "bytes_memlock": 1003520,
              "pinned": ["/sys/fs/bpf/softirq_map1"
              ]
          },{
              "id": 5,
              "type": "hash",
              "name": "iptr",
              "flags": 0,
              "bytes_key": 4,
              "bytes_value": 8,
              "max_entries": 10240,
              "bytes_memlock": 921600,
              "pinned": []
          }
      ]
      Signed-off-by: default avatarPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4990f1f4
    • Prashant Bhole's avatar
      tools: bpftool: open pinned object without type check · 18527196
      Prashant Bhole authored
      This was needed for opening any file in bpf-fs without knowing
      its object type
      Signed-off-by: default avatarPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18527196
    • David S. Miller's avatar
      Merge branch 'BPF-directed-error-injection' · 329fca60
      David S. Miller authored
      Josef Bacik says:
      
      ====================
      Add the ability to do BPF directed error injection
      
      I'm sending this through Dave since it'll conflict with other BPF changes in his
      tree, but since it touches tracing as well Dave would like a review from
      somebody on the tracing side.
      
      v4->v5:
      - disallow kprobe_override programs from being put in the prog map array so we
        don't tail call into something we didn't check.  This allows us to make the
        normal path still fast without a bunch of percpu operations.
      
      v3->v4:
      - fix a build error found by kbuild test bot (I didn't wait long enough
        apparently.)
      - Added a warning message as per Daniels suggestion.
      
      v2->v3:
      - added a ->kprobe_override flag to bpf_prog.
      - added some sanity checks to disallow attaching bpf progs that have
        ->kprobe_override set that aren't for ftrace kprobes.
      - added the trace_kprobe_ftrace helper to check if the trace_event_call is a
        ftrace kprobe.
      - renamed bpf_kprobe_state to bpf_kprobe_override, fixed it so we only read this
        value in the kprobe path, and thus only write to it if we're overriding or
        clearing the override.
      
      v1->v2:
      - moved things around to make sure that bpf_override_return could really only be
        used for an ftrace kprobe.
      - killed the special return values from trace_call_bpf.
      - renamed pc_modified to bpf_kprobe_state so bpf_override_return could tell if
        it was being called from an ftrace kprobe context.
      - reworked the logic in kprobe_perf_func to take advantage of bpf_kprobe_state.
      - updated the test as per Alexei's review.
      
      - Original message -
      
      A lot of our error paths are not well tested because we have no good way of
      injecting errors generically.  Some subystems (block, memory) have ways to
      inject errors, but they are random so it's hard to get reproduceable results.
      
      With BPF we can add determinism to our error injection.  We can use kprobes and
      other things to verify we are injecting errors at the exact case we are trying
      to test.  This patch gives us the tool to actual do the error injection part.
      It is very simple, we just set the return value of the pt_regs we're given to
      whatever we provide, and then override the PC with a dummy function that simply
      returns.
      
      Right now this only works on x86, but it would be simple enough to expand to
      other architectures.  Thanks,
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      329fca60
    • Josef Bacik's avatar
      samples/bpf: add a test for bpf_override_return · eafb3401
      Josef Bacik authored
      This adds a basic test for bpf_override_return to verify it works.  We
      override the main function for mounting a btrfs fs so it'll return
      -ENOMEM and then make sure that trying to mount a btrfs fs will fail.
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eafb3401
    • Josef Bacik's avatar
      bpf: add a bpf_override_function helper · dd0bb688
      Josef Bacik authored
      Error injection is sloppy and very ad-hoc.  BPF could fill this niche
      perfectly with it's kprobe functionality.  We could make sure errors are
      only triggered in specific call chains that we care about with very
      specific situations.  Accomplish this with the bpf_override_funciton
      helper.  This will modify the probe'd callers return value to the
      specified value and set the PC to an override function that simply
      returns, bypassing the originally probed function.  This gives us a nice
      clean way to implement systematic error injection for all of our code
      paths.
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dd0bb688
  2. 10 Nov, 2017 23 commits