1. 16 Aug, 2023 5 commits
    • Ido Schimmel's avatar
      nexthop: Do not increment dump sentinel at the end of the dump · db1428f6
      Ido Schimmel authored
      The nexthop and nexthop bucket dump callbacks previously returned a
      positive return code even when the dump was complete, prompting the core
      netlink code to invoke the callback again, until returning zero.
      
      Zero was only returned by these callbacks when no information was filled
      in the provided skb, which was achieved by incrementing the dump
      sentinel at the end of the dump beyond the ID of the last nexthop.
      
      This is no longer necessary as when the dump is complete these callbacks
      return zero.
      
      Remove the unnecessary increment.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20230813164856.2379822-3-idosch@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      db1428f6
    • Ido Schimmel's avatar
      nexthop: Simplify nexthop bucket dump · 23ab9324
      Ido Schimmel authored
      Before commit f10d3d9d ("nexthop: Make nexthop bucket dump more
      efficient"), rtm_dump_nexthop_bucket_nh() returned a non-zero return
      code for each resilient nexthop group whose buckets it dumped,
      regardless if it encountered an error or not.
      
      This meant that the sentinel ('dd->ctx->nh.idx') used by the function
      that walked the different nexthops could not be used as a sentinel for
      the bucket dump, as otherwise buckets from the same group would be
      dumped over and over again.
      
      This was dealt with by adding another sentinel ('dd->ctx->done_nh_idx')
      that was incremented by rtm_dump_nexthop_bucket_nh() after successfully
      dumping all the buckets from a given group.
      
      After the previously mentioned commit this sentinel is no longer
      necessary since the function no longer returns a non-zero return code
      when successfully dumping all the buckets from a given group.
      
      Remove this sentinel and simplify the code.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20230813164856.2379822-2-idosch@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      23ab9324
    • Jakub Kicinski's avatar
      Merge branch 'seg6-add-next-c-sid-support-for-srv6-end-x-behavior' · 1e02d758
      Jakub Kicinski authored
      Andrea Mayer says:
      
      ====================
      seg6: add NEXT-C-SID support for SRv6 End.X behavior
      
      In the Segment Routing (SR) architecture a list of instructions, called
      segments, can be added to the packet headers to influence the forwarding and
      processing of the packets in an SR enabled network.
      
      Considering the Segment Routing over IPv6 data plane (SRv6) [1], the segment
      identifiers (SIDs) are IPv6 addresses (128 bits) and the segment list (SID
      List) is carried in the Segment Routing Header (SRH). A segment may correspond
      to a "behavior" that is executed by a node when the packet is received.
      The Linux kernel currently supports a large subset of the behaviors described
      in [2] (e.g., End, End.X, End.T and so on).
      
      In some SRv6 scenarios, the number of segments carried by the SID List may
      increase dramatically, reducing the MTU (Maximum Transfer Unit) size and/or
      limiting the processing power of legacy hardware devices (due to longer IPv6
      headers).
      
      The NEXT-C-SID mechanism [3] extends the SRv6 architecture by providing several
      ways to efficiently represent the SID List.
      By leveraging the NEXT-C-SID, it is possible to encode several SRv6 segments
      within a single 128 bit SID address (also referenced as Compressed SID
      Container). In this way, the length of the SID List can be drastically reduced.
      
      The NEXT-C-SID mechanism is built upon the "flavors" framework defined in [2].
      This framework is already supported by the Linux SRv6 subsystem and is used to
      modify and/or extend a subset of existing behaviors.
      
      In this patchset, we extend the SRv6 End.X behavior in order to support the
      NEXT-C-SID mechanism.
      
      In details, the patchset is made of:
       - patch 1/2: add NEXT-C-SID support for SRv6 End.X behavior;
       - patch 2/2: add selftest for NEXT-C-SID in SRv6 End.X behavior.
      
      From the user space perspective, we do not need to change the iproute2 code to
      support the NEXT-C-SID flavor for the SRv6 End.X behavior. However, we will
      update the man page considering the NEXT-C-SID flavor applied to the SRv6 End.X
      behavior in a separate patch.
      
      [1] - https://datatracker.ietf.org/doc/html/rfc8754
      [2] - https://datatracker.ietf.org/doc/html/rfc8986
      [3] - https://datatracker.ietf.org/doc/html/draft-ietf-spring-srv6-srh-compression
      ====================
      
      Link: https://lore.kernel.org/r/20230812180926.16689-1-andrea.mayer@uniroma2.itSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1e02d758
    • Paolo Lungaroni's avatar
      selftests: seg6: add selftest for NEXT-C-SID flavor in SRv6 End.X behavior · 1c53717c
      Paolo Lungaroni authored
      This selftest is designed for testing the support of NEXT-C-SID flavor
      for SRv6 End.X behavior. It instantiates a virtual network composed of
      several nodes: hosts and SRv6 routers. Each node is realized using a
      network namespace that is properly interconnected to others through veth
      pairs, according to the topology depicted in the selftest script file.
      The test considers SRv6 routers implementing IPv4/IPv6 L3 VPNs leveraged
      by hosts for communicating with each other. Such routers i) apply
      different SRv6 Policies to the traffic received from connected hosts,
      considering the IPv4 or IPv6 protocols; ii) use the NEXT-C-SID
      compression mechanism for encoding several SRv6 segments within a single
      128-bit SID address, referred to as a Compressed SID (C-SID) container.
      
      The NEXT-C-SID is provided as a "flavor" of the SRv6 End.X behavior,
      enabling it to properly process the C-SID containers. The correct
      execution of the enabled NEXT-C-SID SRv6 End.X behavior is verified
      through reachability tests carried out between hosts belonging to the
      same VPN.
      Signed-off-by: default avatarPaolo Lungaroni <paolo.lungaroni@uniroma2.it>
      Co-developed-by: default avatarAndrea Mayer <andrea.mayer@uniroma2.it>
      Signed-off-by: default avatarAndrea Mayer <andrea.mayer@uniroma2.it>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20230812180926.16689-3-andrea.mayer@uniroma2.itSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1c53717c
    • Andrea Mayer's avatar
      seg6: add NEXT-C-SID support for SRv6 End.X behavior · 7458575a
      Andrea Mayer authored
      The NEXT-C-SID mechanism described in [1] offers the possibility of
      encoding several SRv6 segments within a single 128 bit SID address. Such
      a SID address is called a Compressed SID (C-SID) container. In this way,
      the length of the SID List can be drastically reduced.
      
      A SID instantiated with the NEXT-C-SID flavor considers an IPv6 address
      logically structured in three main blocks: i) Locator-Block; ii)
      Locator-Node Function; iii) Argument.
      
                              C-SID container
      +------------------------------------------------------------------+
      |     Locator-Block      |Loc-Node|            Argument            |
      |                        |Function|                                |
      +------------------------------------------------------------------+
      <--------- B -----------> <- NF -> <------------- A --------------->
      
         (i) The Locator-Block can be any IPv6 prefix available to the provider;
      
        (ii) The Locator-Node Function represents the node and the function to
             be triggered when a packet is received on the node;
      
       (iii) The Argument carries the remaining C-SIDs in the current C-SID
             container.
      
      This patch leverages the NEXT-C-SID mechanism previously introduced in the
      Linux SRv6 subsystem [2] to support SID compression capabilities in the
      SRv6 End.X behavior [3].
      An SRv6 End.X behavior with NEXT-C-SID flavor works as an End.X behavior
      but it is capable of processing the compressed SID List encoded in C-SID
      containers.
      
      An SRv6 End.X behavior with NEXT-C-SID flavor can be configured to support
      user-provided Locator-Block and Locator-Node Function lengths. In this
      implementation, such lengths must be evenly divisible by 8 (i.e. must be
      byte-aligned), otherwise the kernel informs the user about invalid
      values with a meaningful error code and message through netlink_ext_ack.
      
      If Locator-Block and/or Locator-Node Function lengths are not provided
      by the user during configuration of an SRv6 End.X behavior instance with
      NEXT-C-SID flavor, the kernel will choose their default values i.e.,
      32-bit Locator-Block and 16-bit Locator-Node Function.
      
      [1] - https://datatracker.ietf.org/doc/html/draft-ietf-spring-srv6-srh-compression
      [2] - https://lore.kernel.org/all/20220912171619.16943-1-andrea.mayer@uniroma2.it/
      [3] - https://datatracker.ietf.org/doc/html/rfc8986#name-endx-l3-cross-connectSigned-off-by: default avatarAndrea Mayer <andrea.mayer@uniroma2.it>
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20230812180926.16689-2-andrea.mayer@uniroma2.itSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7458575a
  2. 15 Aug, 2023 12 commits
  3. 14 Aug, 2023 23 commits