1. 07 Jan, 2022 11 commits
    • Amit Cohen's avatar
      mlxsw: Introduce flex key elements for Spectrum-4 · 07ff1359
      Amit Cohen authored
      Spectrum-4 ASIC will support more virtual routers and local ports
      compared to the existing ASICs. Therefore, the virtual router and local
      port ACL key elements need to be increased.
      
      Introduce new key elements for Spectrum-4 to be aligned with the elements
      used already for other Spectrum ASICs.
      
      The key blocks layout is the same for Spectrum-4, so use the existing
      code for encode_block() and clear_block(), just create separate blocks.
      
      Note that size of `VIRT_ROUTER_MSB` is 4 bits in Spectrum-4,
      therefore declare it using `MLXSW_AFK_ELEMENT_INST_U32()`, in order to
      be able to set `.avoid_size_check` to true.
      Otherwise, `mlxsw_afk_blocks_check()` will fail and warn.
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      07ff1359
    • Amit Cohen's avatar
      mlxsw: Rename virtual router flex key element · 6d5d8ebb
      Amit Cohen authored
      In Spectrum-4, the size of the virtual router ACL key element increased
      from 11 bits to 12 bits.
      
      In order to reuse the existing virtual router ACL key element
      enumerators for Spectrum-4, rename 'VIRT_ROUTER_8_10' and
      'VIRT_ROUTER_0_7' to 'VIRT_ROUTER_MSB' and 'VIRT_ROUTER_LSB',
      respectively.
      
      No functional changes intended.
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6d5d8ebb
    • Jakub Kicinski's avatar
      Merge branch 'dpaa2-eth-small-cleanup' · 42379b95
      Jakub Kicinski authored
      Ioana Ciornei says:
      
      ====================
      dpaa2-eth: small cleanup
      
      These 3 patches are just part of a small cleanup on the dpaa2-eth and
      the dpaa2-switch drivers.
      
      In case we are hitting a case in which the fwnode of the root dprc
      device we initiate a deferred probe. On the dpaa2-switch side, if we are
      on the remove path, make sure that we check for a non-NULL pointer
      before accessing the port private structure.
      ====================
      
      Link: https://lore.kernel.org/r/20220106135905.81923-1-ioana.ciornei@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      42379b95
    • Ioana Ciornei's avatar
      dpaa2-switch: check if the port priv is valid · d1a9b841
      Ioana Ciornei authored
      Before accessing the port private structure make sure that there is
      still a non-NULL pointer there. A NULL pointer access can happen when we
      are on the remove path, some switch ports are unregistered and some are
      in the process of unregistering.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d1a9b841
    • Ioana Ciornei's avatar
      dpaa2-mac: return -EPROBE_DEFER from dpaa2_mac_open in case the fwnode is not set · 4e30e98c
      Ioana Ciornei authored
      We could get into a situation when the fwnode of the parent device is
      not yet set because its probe didn't yet finish. When this happens, any
      caller of the dpaa2_mac_open() will not have the fwnode available, thus
      cause problems at the PHY connect time.
      
      Avoid this by just returning -EPROBE_DEFER from the dpaa2_mac_open when
      this happens.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4e30e98c
    • Robert-Ionut Alexa's avatar
      dpaa2-mac: bail if the dpmacs fwnode is not found · 5b1e38c0
      Robert-Ionut Alexa authored
      The parent pointer node handler must be declared with a NULL
      initializer. Before using it, a check must be performed to make
      sure that a valid address has been assigned to it.
      Signed-off-by: default avatarRobert-Ionut Alexa <robert-ionut.alexa@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5b1e38c0
    • Jakub Kicinski's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 257367c0
      Jakub Kicinski authored
      Alexei Starovoitov says:
      
      ====================
      pull-request: bpf-next 2022-01-06
      
      We've added 41 non-merge commits during the last 2 day(s) which contain
      a total of 36 files changed, 1214 insertions(+), 368 deletions(-).
      
      The main changes are:
      
      1) Various fixes in the verifier, from Kris and Daniel.
      
      2) Fixes in sockmap, from John.
      
      3) bpf_getsockopt fix, from Kuniyuki.
      
      4) INET_POST_BIND fix, from Menglong.
      
      5) arm64 JIT fix for bpf pseudo funcs, from Hou.
      
      6) BPF ISA doc improvements, from Christoph.
      
      * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (41 commits)
        bpf: selftests: Add bind retry for post_bind{4, 6}
        bpf: selftests: Use C99 initializers in test_sock.c
        net: bpf: Handle return value of BPF_CGROUP_RUN_PROG_INET{4,6}_POST_BIND()
        bpf/selftests: Test bpf_d_path on rdonly_mem.
        libbpf: Add documentation for bpf_map batch operations
        selftests/bpf: Don't rely on preserving volatile in PT_REGS macros in loop3
        xdp: Add xdp_do_redirect_frame() for pre-computed xdp_frames
        xdp: Move conversion to xdp_frame out of map functions
        page_pool: Store the XDP mem id
        page_pool: Add callback to init pages when they are allocated
        xdp: Allow registering memory model without rxq reference
        samples/bpf: xdpsock: Add timestamp for Tx-only operation
        samples/bpf: xdpsock: Add time-out for cleaning Tx
        samples/bpf: xdpsock: Add sched policy and priority support
        samples/bpf: xdpsock: Add cyclic TX operation capability
        samples/bpf: xdpsock: Add clockid selection support
        samples/bpf: xdpsock: Add Dest and Src MAC setting for Tx-only operation
        samples/bpf: xdpsock: Add VLAN support for Tx-only operation
        libbpf 1.0: Deprecate bpf_object__find_map_by_offset() API
        libbpf 1.0: Deprecate bpf_map__is_offload_neutral()
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20220107013626.53943-1-alexei.starovoitov@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      257367c0
    • Alexei Starovoitov's avatar
      Merge branch 'net: bpf: handle return value of post_bind{4,6} and add selftests for it' · eff14fcd
      Alexei Starovoitov authored
      Menglong Dong says:
      
      ====================
      
      From: Menglong Dong <imagedong@tencent.com>
      
      The return value of BPF_CGROUP_RUN_PROG_INET{4,6}_POST_BIND() in
      __inet_bind() is not handled properly. While the return value
      is non-zero, it will set inet_saddr and inet_rcv_saddr to 0 and
      exit:
      
              err = BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk);
              if (err) {
                      inet->inet_saddr = inet->inet_rcv_saddr = 0;
                      goto out_release_sock;
              }
      
      Let's take UDP for example and see what will happen. For UDP
      socket, it will be added to 'udp_prot.h.udp_table->hash' and
      'udp_prot.h.udp_table->hash2' after the sk->sk_prot->get_port()
      called success. If 'inet->inet_rcv_saddr' is specified here,
      then 'sk' will be in the 'hslot2' of 'hash2' that it don't belong
      to (because inet_saddr is changed to 0), and UDP packet received
      will not be passed to this sock. If 'inet->inet_rcv_saddr' is not
      specified here, the sock will work fine, as it can receive packet
      properly, which is wired, as the 'bind()' is already failed.
      
      To undo the get_port() operation, introduce the 'put_port' field
      for 'struct proto'. For TCP proto, it is inet_put_port(); For UDP
      proto, it is udp_lib_unhash(); For icmp proto, it is
      ping_unhash().
      
      Therefore, after sys_bind() fail caused by
      BPF_CGROUP_RUN_PROG_INET4_POST_BIND(), it will be unbinded, which
      means that it can try to be binded to another port.
      
      The second patch use C99 initializers in test_sock.c
      
      The third patch is the selftests for this modification.
      
      Changes since v4:
      - use C99 initializers in test_sock.c before adding the test case
      
      Changes since v3:
      - add the third patch which use C99 initializers in test_sock.c
      
      Changes since v2:
      - NULL check for sk->sk_prot->put_port
      
      Changes since v1:
      - introduce 'put_port' field for 'struct proto'
      - add selftests for it
      ====================
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      eff14fcd
    • Menglong Dong's avatar
      bpf: selftests: Add bind retry for post_bind{4, 6} · f7342481
      Menglong Dong authored
      With previous patch, kernel is able to 'put_port' after sys_bind()
      fails. Add the test for that case: rebind another port after
      sys_bind() fails. If the bind success, it means previous bind
      operation is already undoed.
      Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20220106132022.3470772-4-imagedong@tencent.com
      f7342481
    • Menglong Dong's avatar
      bpf: selftests: Use C99 initializers in test_sock.c · 6fd92c7f
      Menglong Dong authored
      Use C99 initializers for the initialization of 'tests' in test_sock.c.
      Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20220106132022.3470772-3-imagedong@tencent.com
      6fd92c7f
    • Menglong Dong's avatar
      net: bpf: Handle return value of BPF_CGROUP_RUN_PROG_INET{4,6}_POST_BIND() · 91a760b2
      Menglong Dong authored
      The return value of BPF_CGROUP_RUN_PROG_INET{4,6}_POST_BIND() in
      __inet_bind() is not handled properly. While the return value
      is non-zero, it will set inet_saddr and inet_rcv_saddr to 0 and
      exit:
      
      	err = BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk);
      	if (err) {
      		inet->inet_saddr = inet->inet_rcv_saddr = 0;
      		goto out_release_sock;
      	}
      
      Let's take UDP for example and see what will happen. For UDP
      socket, it will be added to 'udp_prot.h.udp_table->hash' and
      'udp_prot.h.udp_table->hash2' after the sk->sk_prot->get_port()
      called success. If 'inet->inet_rcv_saddr' is specified here,
      then 'sk' will be in the 'hslot2' of 'hash2' that it don't belong
      to (because inet_saddr is changed to 0), and UDP packet received
      will not be passed to this sock. If 'inet->inet_rcv_saddr' is not
      specified here, the sock will work fine, as it can receive packet
      properly, which is wired, as the 'bind()' is already failed.
      
      To undo the get_port() operation, introduce the 'put_port' field
      for 'struct proto'. For TCP proto, it is inet_put_port(); For UDP
      proto, it is udp_lib_unhash(); For icmp proto, it is
      ping_unhash().
      
      Therefore, after sys_bind() fail caused by
      BPF_CGROUP_RUN_PROG_INET4_POST_BIND(), it will be unbinded, which
      means that it can try to be binded to another port.
      Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20220106132022.3470772-2-imagedong@tencent.com
      91a760b2
  2. 06 Jan, 2022 29 commits