1. 28 Aug, 2017 17 commits
    • William Tu's avatar
      gre: add collect_md mode to ERSPAN tunnel · 1a66a836
      William Tu authored
      Similar to gre, vxlan, geneve, ipip tunnels, allow ERSPAN tunnels to
      operate in 'collect metadata' mode.  bpf_skb_[gs]et_tunnel_key() helpers
      can make use of it right away.  OVS can use it as well in the future.
      Signed-off-by: default avatarWilliam Tu <u9012063@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a66a836
    • William Tu's avatar
      gre: refactor the gre_fb_xmit · 862a03c3
      William Tu authored
      The patch refactors the gre_fb_xmit function, by creating
      prepare_fb_xmit function for later ERSPAN collect_md mode patch.
      Signed-off-by: default avatarWilliam Tu <u9012063@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      862a03c3
    • David Ahern's avatar
      Revert "ipv4: make net_protocol const" · 03157937
      David Ahern authored
      This reverts commit aa8db499.
      
      Early demux structs can not be made const. Doing so results in:
      [   84.967355] BUG: unable to handle kernel paging request at ffffffff81684b10
      [   84.969272] IP: proc_configure_early_demux+0x1e/0x3d
      [   84.970544] PGD 1a0a067
      [   84.970546] P4D 1a0a067
      [   84.971212] PUD 1a0b063
      [   84.971733] PMD 80000000016001e1
      
      [   84.972669] Oops: 0003 [#1] SMP
      [   84.973065] Modules linked in: ip6table_filter ip6_tables veth vrf
      [   84.973833] CPU: 0 PID: 955 Comm: sysctl Not tainted 4.13.0-rc6+ #22
      [   84.974612] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
      [   84.975855] task: ffff88003854ce00 task.stack: ffffc900005a4000
      [   84.976580] RIP: 0010:proc_configure_early_demux+0x1e/0x3d
      [   84.977253] RSP: 0018:ffffc900005a7dd0 EFLAGS: 00010246
      [   84.977891] RAX: ffffffff81684b10 RBX: 0000000000000001 RCX: 0000000000000000
      [   84.978759] RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000000
      [   84.979628] RBP: ffffc900005a7dd0 R08: 0000000000000000 R09: 0000000000000000
      [   84.980501] R10: 0000000000000001 R11: 0000000000000008 R12: 0000000000000001
      [   84.981373] R13: ffffffffffffffea R14: ffffffff81a9b4c0 R15: 0000000000000002
      [   84.982249] FS:  00007feb237b7700(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
      [   84.983231] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   84.983941] CR2: ffffffff81684b10 CR3: 0000000038492000 CR4: 00000000000406f0
      [   84.984817] Call Trace:
      [   84.985133]  proc_tcp_early_demux+0x29/0x30
      
      I think this is the second time such a patch has been reverted.
      
      Cc: Bhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      03157937
    • Bhumika Goyal's avatar
      RDS: make rhashtable_params const · 8209432a
      Bhumika Goyal authored
      Make this const as it is either used during a copy operation or passed
      to a const argument of the function rhltable_init
      Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
      Acked-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8209432a
    • Bhumika Goyal's avatar
      ipv4: make net_protocol const · aa8db499
      Bhumika Goyal authored
      Make these const as they are only passed to a const argument of the
      function inet_add_protocol.
      Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aa8db499
    • Bhumika Goyal's avatar
      bridge: make ebt_table const · eb73ddeb
      Bhumika Goyal authored
      Make this const as it is only passed to a const argument of the function
      ebt_register_table.
      Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eb73ddeb
    • David S. Miller's avatar
      Merge branch 'sockmap-uapi-updates-and-fixes' · 7a483899
      David S. Miller authored
      John Fastabend says:
      
      ====================
      sockmap UAPI updates and fixes
      
      This series updates sockmap UAPI, adds additional test cases and
      provides a couple fixes.
      
      First the UAPI changes. The original API added two sockmap specific
      API artifacts (a) a new map_flags field with a sockmap specific update
      command and (b) a new sockmap specific attach field in the attach data
      structure. After this series instead of attaching programs with a
      single command now two commands are used to attach programs to maps
      individually. This allows us to add new programs easily in the future
      and avoids any specific sockmap data structure additions. The
      map_flags field is also removed and instead we allow socks to be
      added to multiple maps that may or may not have programs attached.
      This allows users to decide if a sock should run a SK_SKB program type
      on receive based on the map it is attached to. This is a nice
      improvement. See patches for specific details.
      
      More test cases were added to test above changes and also stress test
      the interface.
      
      Finally two fixes/improvements were made. First a missing rcu
      section was added. Second now sockmap can build without KCM being
      used to trigger 'y' on CONFIG_STREAM_PARSER by selecting a new
      BPF config option.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7a483899
    • John Fastabend's avatar
      bpf: test_maps add sockmap stress test · 3f0d6a16
      John Fastabend authored
      Sockmap is a bit different than normal stress tests that can run
      in parallel as is. We need to reuse the same socket pool and map
      pool to get good stress test cases.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3f0d6a16
    • John Fastabend's avatar
      bpf: sockmap requires STREAM_PARSER add Kconfig entry · 08848246
      John Fastabend authored
      SOCKMAP uses strparser code (compiled with Kconfig option
      CONFIG_STREAM_PARSER) to run the parser BPF program. Without this
      config option set sockmap wont be compiled. However, at the moment
      the only way to pull in the strparser code is to enable KCM.
      
      To resolve this create a BPF specific config option to pull
      only the strparser piece in that sockmap needs. This also
      allows folks who want to use BPF/syscall/maps but don't need
      sockmap to easily opt out.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      08848246
    • John Fastabend's avatar
      bpf: sockmap indicate sock events to listeners · 78aeaaef
      John Fastabend authored
      After userspace pushes sockets into a sockmap it may not be receiving
      data (assuming stream_{parser|verdict} programs are attached). But, it
      may still want to manage the socks. A common pattern is to poll/select
      for a POLLRDHUP event so we can close the sock.
      
      This patch adds the logic to wake up these listeners.
      
      Also add TCP_SYN_SENT to the list of events to handle. We don't want
      to break the connection just because we happen to be in this state.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      78aeaaef
    • John Fastabend's avatar
      bpf: harden sockmap program attach to ensure correct map type · 81374aaa
      John Fastabend authored
      When attaching a program to sockmap we need to check map type
      is correct.
      
      Fixes: 174a79ff ("bpf: sockmap with sk redirect support")
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      81374aaa
    • John Fastabend's avatar
      bpf: more SK_SKB selftests · ed85054d
      John Fastabend authored
      Tests packet read/writes and additional skb fields.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ed85054d
    • John Fastabend's avatar
      bpf: additional sockmap self tests · 6fd28865
      John Fastabend authored
      Add some more sockmap tests to cover,
      
       - forwarding to NULL entries
       - more than two maps to test list ops
       - forwarding to different map
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6fd28865
    • John Fastabend's avatar
      bpf: sockmap add missing rcu_read_(un)lock in smap_data_ready · d26e597d
      John Fastabend authored
      References to psock must be done inside RCU critical section.
      
      Fixes: 174a79ff ("bpf: sockmap with sk redirect support")
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d26e597d
    • John Fastabend's avatar
      bpf: sockmap, remove STRPARSER map_flags and add multi-map support · 2f857d04
      John Fastabend authored
      The addition of map_flags BPF_SOCKMAP_STRPARSER flags was to handle a
      specific use case where we want to have BPF parse program disabled on
      an entry in a sockmap.
      
      However, Alexei found the API a bit cumbersome and I agreed. Lets
      remove the STRPARSER flag and support the use case by allowing socks
      to be in multiple maps. This allows users to create two maps one with
      programs attached and one without. When socks are added to maps they
      now inherit any programs attached to the map. This is a nice
      generalization and IMO improves the API.
      
      The API rules are less ambiguous and do not need a flag:
      
        - When a sock is added to a sockmap we have two cases,
      
           i. The sock map does not have any attached programs so
              we can add sock to map without inheriting bpf programs.
              The sock may exist in 0 or more other maps.
      
          ii. The sock map has an attached BPF program. To avoid duplicate
              bpf programs we only add the sock entry if it does not have
              an existing strparser/verdict attached, returning -EBUSY if
              a program is already attached. Otherwise attach the program
              and inherit strparser/verdict programs from the sock map.
      
      This allows for socks to be in a multiple maps for redirects and
      inherit a BPF program from a single map.
      
      Also this patch simplifies the logic around BPF_{EXIST|NOEXIST|ANY}
      flags. In the original patch I tried to be extra clever and only
      update map entries when necessary. Now I've decided the complexity
      is not worth it. If users constantly update an entry with the same
      sock for no reason (i.e. update an entry without actually changing
      any parameters on map or sock) we still do an alloc/release. Using
      this and allowing multiple entries of a sock to exist in a map the
      logic becomes much simpler.
      
      Note: Now that multiple maps are supported the "maps" pointer called
      when a socket is closed becomes a list of maps to remove the sock from.
      To keep the map up to date when a sock is added to the sockmap we must
      add the map/elem in the list. Likewise when it is removed we must
      remove it from the list. This results in searching the per psock list
      on delete operation. On TCP_CLOSE events we walk the list and remove
      the psock from all map/entry locations. I don't see any perf
      implications in this because at most I have a psock in two maps. If
      a psock were to be in many maps its possibly this might be noticeable
      on delete but I can't think of a reason to dup a psock in many maps.
      The sk_callback_lock is used to protect read/writes to the list. This
      was convenient because in all locations we were taking the lock
      anyways just after working on the list. Also the lock is per sock so
      in normal cases we shouldn't see any contention.
      Suggested-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Fixes: 174a79ff ("bpf: sockmap with sk redirect support")
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2f857d04
    • John Fastabend's avatar
      bpf: convert sockmap field attach_bpf_fd2 to type · 464bc0fd
      John Fastabend authored
      In the initial sockmap API we provided strparser and verdict programs
      using a single attach command by extending the attach API with a the
      attach_bpf_fd2 field.
      
      However, if we add other programs in the future we will be adding a
      field for every new possible type, attach_bpf_fd(3,4,..). This
      seems a bit clumsy for an API. So lets push the programs using two
      new type fields.
      
         BPF_SK_SKB_STREAM_PARSER
         BPF_SK_SKB_STREAM_VERDICT
      
      This has the advantage of having a readable name and can easily be
      extended in the future.
      
      Updates to samples and sockmap included here also generalize tests
      slightly to support upcoming patch for multiple map support.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Fixes: 174a79ff ("bpf: sockmap with sk redirect support")
      Suggested-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      464bc0fd
    • David Wu's avatar
      ARM: dts: rk3228-evb: Fix the compiling error · 901c5d2f
      David Wu authored
      This patch solves the following error:
      arch/arm/boot/dts/rk3228-evb.dtb: ERROR (phandle_references): Reference to non-existent node or label "phy0"
      
      Fixess db40f15b ("ARM: dts: rk3228-evb: Enable the integrated PHY for gmac")
      Signed-off-by: default avatarDavid Wu <david.wu@rock-chips.com>
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      901c5d2f
  2. 26 Aug, 2017 18 commits
  3. 25 Aug, 2017 5 commits