1. 21 Jul, 2021 11 commits
    • David S. Miller's avatar
      Merge branch 'ipv6-ioam' · 7c804e91
      David S. Miller authored
      Justin Iurman says:
      
      ====================
      Support for the IOAM Pre-allocated Trace with IPv6
      
      v5:
       - Refine types, min/max and default values for new sysctls
       - Introduce a "_wide" sysctl for each "ioam6_id" sysctl
       - Add more validation on headers before processing data
       - RCU for sc <> ns pointers + appropriate accessors
       - Generic Netlink policies are now per op, not per family anymore
       - Address other comments/remarks from Jakub (thanks again)
       - Revert "__packed" to "__attribute__((packed))" for uapi headers
       - Add tests to cover the functionality added, as requested by David Ahern
      
      v4:
       - Address warnings from checkpatch (ignore errors related to unnamed bitfields
         in the first patch)
       - Use of hweight32 (thanks Jakub)
       - Remove inline keyword from static functions in C files and let the compiler
         decide what to do (thanks Jakub)
      
      v3:
       - Fix warning "unused label 'out_unregister_genl'" by adding conditional macro
       - Fix lwtunnel output redirect bug: dst cache useless in this case, use
         orig_output instead
      
      v2:
       - Fix warning with static for __ioam6_fill_trace_data
       - Fix sparse warning with __force when casting __be64 to __be32
       - Fix unchecked dereference when removing IOAM namespaces or schemas
       - exthdrs.c: Don't drop by default (now: ignore) to match the act bits "00"
       - Add control plane support for the inline insertion (lwtunnel)
       - Provide uapi structures
       - Use __net_timestamp if skb->tstamp is empty
       - Add note about the temporary IANA allocation
       - Remove support for "removable" TLVs
       - Remove support for virtual/anonymous tunnel decapsulation
      
      In-situ Operations, Administration, and Maintenance (IOAM) records
      operational and telemetry information in a packet while it traverses
      a path between two points in an IOAM domain. It is defined in
      draft-ietf-ippm-ioam-data [1]. IOAM data fields can be encapsulated
      into a variety of protocols. The IPv6 encapsulation is defined in
      draft-ietf-ippm-ioam-ipv6-options [2], via extension headers. IOAM
      can be used to complement OAM mechanisms based on e.g. ICMP or other
      types of probe packets.
      
      This patchset implements support for the Pre-allocated Trace, carried
      by a Hop-by-Hop. Therefore, a new IPv6 Hop-by-Hop TLV option is
      introduced, see IANA [3]. The three other IOAM options are not included
      in this patchset (Incremental Trace, Proof-of-Transit and Edge-to-Edge).
      The main idea behind the IOAM Pre-allocated Trace is that a node
      pre-allocates some room in packets for IOAM data. Then, each IOAM node
      on the path will insert its data. There exist several interesting use-
      cases, e.g. Fast failure detection/isolation or Smart service selection.
      Another killer use-case is what we have called Cross-Layer Telemetry,
      see the demo video on its repository [4], that aims to make the entire
      stack (L2/L3 -> L7) visible for distributed tracing tools (e.g. Jaeger),
      instead of the current L5 -> L7 limited view. So, basically, this is a
      nice feature for the Linux Kernel.
      
      This patchset also provides support for the control plane part, but only for the
      inline insertion (host-to-host use case), through lightweight tunnels. Indeed,
      for in-transit traffic, the solution is to have an IPv6-in-IPv6 encapsulation,
      which brings some difficulties and still requires a little bit of work and
      discussion (ie anonymous tunnel decapsulation and multi egress resolution).
      
      - Patch 1: IPv6 IOAM headers definition
      - Patch 2: Data plane support for Pre-allocated Trace
      - Patch 3: IOAM Generic Netlink API
      - Patch 4: Support for IOAM injection with lwtunnels
      - Patch 5: Documentation for new IOAM sysctls
      - Patch 6: Test for the IOAM insertion with IPv6
      
        [1] https://tools.ietf.org/html/draft-ietf-ippm-ioam-data
        [2] https://tools.ietf.org/html/draft-ietf-ippm-ioam-ipv6-options
        [3] https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#ipv6-parameters-2
        [4] https://github.com/iurmanj/cross-layer-telemetry
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7c804e91
    • Justin Iurman's avatar
      selftests: net: Test for the IOAM insertion with IPv6 · 968691c7
      Justin Iurman authored
      This test evaluates the IOAM insertion for IPv6 by checking the IOAM data
      integrity on the receiver.
      
      The topology is formed by 3 nodes: Alpha (sender), Beta (router in-between)
      and Gamma (receiver). An IOAM domain is configured from Alpha to Gamma only,
      which means not on the reverse path. When Gamma is the destination, Alpha
      adds an IOAM option (Pre-allocated Trace) inside a Hop-by-hop and fills the
      trace with its own IOAM data. Beta and Gamma also fill the trace. The IOAM
      data integrity is checked on Gamma, by comparing with the pre-defined IOAM
      configuration (see below).
      
          +-------------------+            +-------------------+
          |                   |            |                   |
          |    alpha netns    |            |    gamma netns    |
          |                   |            |                   |
          |  +-------------+  |            |  +-------------+  |
          |  |    veth0    |  |            |  |    veth0    |  |
          |  |  db01::2/64 |  |            |  |  db02::2/64 |  |
          |  +-------------+  |            |  +-------------+  |
          |         .         |            |         .         |
          +-------------------+            +-------------------+
                    .                                .
                    .                                .
                    .                                .
          +----------------------------------------------------+
          |         .                                .         |
          |  +-------------+                  +-------------+  |
          |  |    veth0    |                  |    veth1    |  |
          |  |  db01::1/64 | ................ |  db02::1/64 |  |
          |  +-------------+                  +-------------+  |
          |                                                    |
          |                      beta netns                    |
          |                                                    |
          +--------------------------+-------------------------+
      
      ~~~~~~~~~~~~~~~~~~~~~~
      | IOAM configuration |
      ~~~~~~~~~~~~~~~~~~~~~~
      
      Alpha
      +-----------------------------------------------------------+
      | Type                | Value                               |
      +-----------------------------------------------------------+
      | Node ID             | 1                                   |
      +-----------------------------------------------------------+
      | Node Wide ID        | 11111111                            |
      +-----------------------------------------------------------+
      | Ingress ID          | 0xffff (default value)              |
      +-----------------------------------------------------------+
      | Ingress Wide ID     | 0xffffffff (default value)          |
      +-----------------------------------------------------------+
      | Egress ID           | 101                                 |
      +-----------------------------------------------------------+
      | Egress Wide ID      | 101101                              |
      +-----------------------------------------------------------+
      | Namespace Data      | 0xdeadbee0                          |
      +-----------------------------------------------------------+
      | Namespace Wide Data | 0xcafec0caf00dc0de                  |
      +-----------------------------------------------------------+
      | Schema ID           | 777                                 |
      +-----------------------------------------------------------+
      | Schema Data         | something that will be 4n-aligned   |
      +-----------------------------------------------------------+
      
      Note: When Gamma is the destination, Alpha adds an IOAM Pre-allocated Trace
            option inside a Hop-by-hop, where 164 bytes are pre-allocated for the
            trace, with 123 as the IOAM-Namespace and with 0xfff00200 as the trace
            type (= all available options at this time). As a result, and based on
            IOAM configurations here, only both Alpha and Beta should be capable of
            inserting their IOAM data while Gamma won't have enough space and will
            set the overflow bit.
      
      Beta
      +-----------------------------------------------------------+
      | Type                | Value                               |
      +-----------------------------------------------------------+
      | Node ID             | 2                                   |
      +-----------------------------------------------------------+
      | Node Wide ID        | 22222222                            |
      +-----------------------------------------------------------+
      | Ingress ID          | 201                                 |
      +-----------------------------------------------------------+
      | Ingress Wide ID     | 201201                              |
      +-----------------------------------------------------------+
      | Egress ID           | 202                                 |
      +-----------------------------------------------------------+
      | Egress Wide ID      | 202202                              |
      +-----------------------------------------------------------+
      | Namespace Data      | 0xdeadbee1                          |
      +-----------------------------------------------------------+
      | Namespace Wide Data | 0xcafec0caf11dc0de                  |
      +-----------------------------------------------------------+
      | Schema ID           | 0xffffff (= None)                   |
      +-----------------------------------------------------------+
      | Schema Data         |                                     |
      +-----------------------------------------------------------+
      
      Gamma
      +-----------------------------------------------------------+
      | Type                | Value                               |
      +-----------------------------------------------------------+
      | Node ID             | 3                                   |
      +-----------------------------------------------------------+
      | Node Wide ID        | 33333333                            |
      +-----------------------------------------------------------+
      | Ingress ID          | 301                                 |
      +-----------------------------------------------------------+
      | Ingress Wide ID     | 301301                              |
      +-----------------------------------------------------------+
      | Egress ID           | 0xffff (default value)              |
      +-----------------------------------------------------------+
      | Egress Wide ID      | 0xffffffff (default value)          |
      +-----------------------------------------------------------+
      | Namespace Data      | 0xdeadbee2                          |
      +-----------------------------------------------------------+
      | Namespace Wide Data | 0xcafec0caf22dc0de                  |
      +-----------------------------------------------------------+
      | Schema ID           | 0xffffff (= None)                   |
      +-----------------------------------------------------------+
      | Schema Data         |                                     |
      +-----------------------------------------------------------+
      Signed-off-by: default avatarJustin Iurman <justin.iurman@uliege.be>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      968691c7
    • Justin Iurman's avatar
      ipv6: ioam: Documentation for new IOAM sysctls · de8e80a5
      Justin Iurman authored
      Add documentation for new IOAM sysctls:
       - ioam6_id and ioam6_id_wide: two per-namespace sysctls
       - ioam6_enabled, ioam6_id and ioam6_id_wide: three per-interface sysctls
      
      Example of IOAM configuration based on the following simple topology:
      
       _____              _____              _____
      |     | eth0  eth0 |     | eth1  eth0 |     |
      |  A  |.----------.|  B  |.----------.|  C  |
      |_____|            |_____|            |_____|
      
      1) Node and interface IDs can be configured for IOAM:
      
        # IOAM ID of A = 1, IOAM ID of A.eth0 = 11
        (A) sysctl -w net.ipv6.ioam6_id=1
        (A) sysctl -w net.ipv6.conf.eth0.ioam6_id=11
      
        # IOAM ID of B = 2, IOAM ID of B.eth0 = 21, IOAM ID of B.eth1 = 22
        (B) sysctl -w net.ipv6.ioam6_id=2
        (B) sysctl -w net.ipv6.conf.eth0.ioam6_id=21
        (B) sysctl -w net.ipv6.conf.eth1.ioam6_id=22
      
        # IOAM ID of C = 3, IOAM ID of C.eth0 = 31
        (C) sysctl -w net.ipv6.ioam6_id=3
        (C) sysctl -w net.ipv6.conf.eth0.ioam6_id=31
      
        Note that "_wide" IDs equivalents can be configured the same way.
      
      2) Each node can be configured to form an IOAM domain. For instance,
         we allow IOAM from A to C only (not the reverse path), i.e. enable
         IOAM on ingress for B.eth0 and C.eth0:
      
        (B) sysctl -w net.ipv6.conf.eth0.ioam6_enabled=1
        (C) sysctl -w net.ipv6.conf.eth0.ioam6_enabled=1
      
      3) An IOAM domain (e.g. ID=123) is defined and made known to each node:
      
        (A) ip ioam namespace add 123
        (B) ip ioam namespace add 123
        (C) ip ioam namespace add 123
      
      4) Finally, an IOAM Pre-allocated Trace can be inserted in traffic sent
         by A when C (e.g. db02::2) is the destination:
      
        (A) ip -6 route add db02::2/128 encap ioam6 trace type 0x800000 ns 123
            size 12 dev eth0
      Signed-off-by: default avatarJustin Iurman <justin.iurman@uliege.be>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      de8e80a5
    • Justin Iurman's avatar
      ipv6: ioam: Support for IOAM injection with lwtunnels · 3edede08
      Justin Iurman authored
      Add support for the IOAM inline insertion (only for the host-to-host use case)
      which is per-route configured with lightweight tunnels. The target is iproute2
      and the patch is ready. It will be posted as soon as this patchset is merged.
      Here is an overview:
      
      $ ip -6 ro ad fc00::1/128 encap ioam6 trace type 0x800000 ns 1 size 12 dev eth0
      
      This example configures an IOAM Pre-allocated Trace option attached to the
      fc00::1/128 prefix. The IOAM namespace (ns) is 1, the size of the pre-allocated
      trace data block is 12 octets (size) and only the first IOAM data (bit 0:
      hop_limit + node id) is included in the trace (type) represented as a bitfield.
      
      The reason why the in-transit (IPv6-in-IPv6 encapsulation) use case is not
      implemented is explained on the patchset cover.
      Signed-off-by: default avatarJustin Iurman <justin.iurman@uliege.be>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3edede08
    • Justin Iurman's avatar
      ipv6: ioam: IOAM Generic Netlink API · 8c6f6fa6
      Justin Iurman authored
      Add Generic Netlink commands to allow userspace to configure IOAM
      namespaces and schemas. The target is iproute2 and the patch is ready.
      It will be posted as soon as this patchset is merged. Here is an overview:
      
      $ ip ioam
      Usage:	ip ioam { COMMAND | help }
      	ip ioam namespace show
      	ip ioam namespace add ID [ data DATA32 ] [ wide DATA64 ]
      	ip ioam namespace del ID
      	ip ioam schema show
      	ip ioam schema add ID DATA
      	ip ioam schema del ID
      	ip ioam namespace set ID schema { ID | none }
      Signed-off-by: default avatarJustin Iurman <justin.iurman@uliege.be>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8c6f6fa6
    • Justin Iurman's avatar
      ipv6: ioam: Data plane support for Pre-allocated Trace · 9ee11f0f
      Justin Iurman authored
      Implement support for processing the IOAM Pre-allocated Trace with IPv6,
      see [1] and [2]. Introduce a new IPv6 Hop-by-Hop TLV option, see IANA [3].
      
      A new per-interface sysctl is introduced. The value is a boolean to accept (=1)
      or ignore (=0, by default) IPv6 IOAM options on ingress for an interface:
       - net.ipv6.conf.XXX.ioam6_enabled
      
      Two other sysctls are introduced to define IOAM IDs, represented by an integer.
      They are respectively per-namespace and per-interface:
       - net.ipv6.ioam6_id
       - net.ipv6.conf.XXX.ioam6_id
      
      The value of the first one represents the IOAM ID of the node itself (u32; max
      and default value = U32_MAX>>8, due to hop limit concatenation) while the other
      represents the IOAM ID of an interface (u16; max and default value = U16_MAX).
      
      Each "ioam6_id" sysctl has a "_wide" equivalent:
       - net.ipv6.ioam6_id_wide
       - net.ipv6.conf.XXX.ioam6_id_wide
      
      The value of the first one represents the wide IOAM ID of the node itself (u64;
      max and default value = U64_MAX>>8, due to hop limit concatenation) while the
      other represents the wide IOAM ID of an interface (u32; max and default value
      = U32_MAX).
      
      The use of short and wide equivalents is not exclusive, a deployment could
      choose to leverage both. For example, net.ipv6.conf.XXX.ioam6_id (short format)
      could be an identifier for a physical interface, whereas
      net.ipv6.conf.XXX.ioam6_id_wide (wide format) could be an identifier for a
      logical sub-interface. Documentation about new sysctls is provided at the end
      of this patchset.
      
      Two relativistic hash tables are used: one for IOAM namespaces, the other for
      IOAM schemas. A namespace can only have a single active schema and a schema
      can only be attached to a single namespace (1:1 relationship).
      
        [1] https://tools.ietf.org/html/draft-ietf-ippm-ioam-ipv6-options
        [2] https://tools.ietf.org/html/draft-ietf-ippm-ioam-data
        [3] https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#ipv6-parameters-2Signed-off-by: default avatarJustin Iurman <justin.iurman@uliege.be>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9ee11f0f
    • Justin Iurman's avatar
      uapi: IPv6 IOAM headers definition · db67f219
      Justin Iurman authored
      This patch provides the IPv6 IOAM option header [1] as well as the IOAM
      Trace header [2]. An IOAM option must be 4n-aligned. Here is an overview of
      a Hop-by-Hop with an IOAM Trace option:
      
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |  Next header  |  Hdr Ext Len  |    Padding    |    Padding    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |  Option Type  |  Opt Data Len |    Reserved   |   IOAM Type   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |         Namespace-ID          | NodeLen | Flags | RemainingLen|
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                IOAM-Trace-Type                |    Reserved   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<-+
      |                                                               |  |
      |                         node data [n]                         |  |
      |                                                               |  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  D
      |                                                               |  a
      |                         node data [n-1]                       |  t
      |                                                               |  a
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ~                             ...                               ~  S
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  p
      |                                                               |  a
      |                         node data [1]                         |  c
      |                                                               |  e
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  |
      |                                                               |  |
      |                         node data [0]                         |  |
      |                                                               |  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<-+
      
      The IOAM option header starts at "Option Type" and ends after "IOAM
      Type". The IOAM Trace header starts at "Namespace-ID" and ends after
      "IOAM-Trace-Type/Reserved".
      
      IOAM Type: either Pre-allocated Trace (=0), Incremental Trace (=1),
      Proof-of-Transit (=2) or Edge-to-Edge (=3). Note that both the
      Pre-allocated Trace and the Incremental Trace look the same. The two
      others are not implemented.
      
      Namespace-ID: IOAM namespace identifier, not to be confused with network
      namespaces. It adds further context to IOAM options and associated data,
      and allows devices which are IOAM capable to determine whether IOAM
      options must be processed or ignored. It can also be used by an operator
      to distinguish different operational domains or to identify different
      sets of devices.
      
      NodeLen: Length of data added by each node. It depends on the Trace
      Type.
      
      Flags: Only the Overflow (O) flag for now. The O flag is set by a
      transit node when there are not enough octets left to record its data.
      
      RemainingLen: Remaining free space to record data.
      
      IOAM-Trace-Type: Bit field where each bit corresponds to a specific kind
      of IOAM data. See [2] for a detailed list.
      
        [1] https://tools.ietf.org/html/draft-ietf-ippm-ioam-ipv6-options
        [2] https://tools.ietf.org/html/draft-ietf-ippm-ioam-dataSigned-off-by: default avatarJustin Iurman <justin.iurman@uliege.be>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      db67f219
    • Vladimir Oltean's avatar
      net: switchdev: recurse into __switchdev_handle_fdb_del_to_device · 71f4f89a
      Vladimir Oltean authored
      The difference between __switchdev_handle_fdb_del_to_device and
      switchdev_handle_del_to_device is that the former takes an extra
      orig_dev argument, while the latter starts with dev == orig_dev.
      
      We should recurse into the variant that does not lose the orig_dev along
      the way. This is relevant when deleting FDB entries pointing towards a
      bridge (dev changes to the lower interfaces, but orig_dev shouldn't).
      
      The addition helper already recurses properly, just the deletion one
      doesn't.
      
      Fixes: 8ca07176 ("net: switchdev: introduce a fanout helper for SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71f4f89a
    • Vladimir Oltean's avatar
      net: switchdev: remove stray semicolon in switchdev_handle_fdb_del_to_device shim · 94111dfc
      Vladimir Oltean authored
      With the semicolon at the end, the compiler sees the shim function as a
      declaration and not as a definition, and warns:
      
      'switchdev_handle_fdb_del_to_device' declared 'static' but never defined
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: 8ca07176 ("net: switchdev: introduce a fanout helper for SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Tested-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      94111dfc
    • Vladimir Oltean's avatar
      net: phy: at803x: finish the phy id checking simplification · f5621a01
      Vladimir Oltean authored
      The blamed commit was probably not tested on net-next, since it did not
      refactor the extra phy id check introduced in commit b856150c ("net:
      phy: at803x: mask 1000 Base-X link mode").
      
      Fixes: 8887ca54 ("net: phy: at803x: simplify custom phy id matching")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Acked-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f5621a01
    • Russell King (Oracle)'s avatar
      net: phylink: cleanup ksettings_set · 7cefb0b0
      Russell King (Oracle) authored
      We only need to fiddle about with the supported mask after we have
      validated the user's requested parameters. Simplify and streamline the
      code by moving the linkmode copy and update of the autoneg bit after
      validating the user's request.
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7cefb0b0
  2. 20 Jul, 2021 29 commits