]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
devlink: Add layer 3 generic packet exception traps
authorAmit Cohen <amitc@mellanox.com>
Thu, 7 Nov 2019 16:42:14 +0000 (18:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Nov 2019 03:51:40 +0000 (19:51 -0800)
Add layer 3 generic packet exception traps that can report trapped
packets and documentation of the traps.

Unlike drop traps, these exception traps also need to inject the packet
to the kernel's receive path. For example, a packet that was trapped due
to unreachable neighbour need to be injected into the kernel so that it
will trigger an ARP request or a neighbour solicitation message.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/devlink-trap.rst
include/net/devlink.h
net/core/devlink.c

index dc3dc87217c977966a1166b4ab11e642d84a0a1c..dc9659ca06fa0deb95874048f9e039471f4c66b2 100644 (file)
@@ -203,6 +203,26 @@ be added to the following table:
      - Traps IPv6 packets that the device decided to drop because they need to
        be routed and their IPv6 multicast destination IP has an interface-local scope
        (i.e., ffx1::/16)
+   * - ``mtu_value_is_too_small``
+     - ``exception``
+     - Traps packets that should have been routed by the device, but were bigger
+       than the MTU of the egress interface
+   * - ``unresolved_neigh``
+     - ``exception``
+     - Traps packets that did not have a matching IP neighbour after routing
+   * - ``mc_reverse_path_forwarding``
+     - ``exception``
+     - Traps multicast IP packets that failed reverse-path forwarding (RPF)
+       check during multicast routing
+   * - ``reject_route``
+     - ``exception``
+     - Traps packets that hit reject routes (i.e., "unreachable", "prohibit")
+   * - ``ipv4_lpm_miss``
+     - ``exception``
+     - Traps unicast IPv4 packets that did not match any route
+   * - ``ipv6_lpm_miss``
+     - ``exception``
+     - Traps unicast IPv6 packets that did not match any route
 
 Driver-specific Packet Traps
 ============================
index df7814d55bf93d0e4d46a083d7ccb78a5aa8e985..8d6b5846822c731a56d262d250cc0019d48d46e2 100644 (file)
@@ -578,6 +578,12 @@ enum devlink_trap_generic_id {
        DEVLINK_TRAP_GENERIC_ID_IPV4_SIP_BC,
        DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_RESERVED_SCOPE,
        DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE,
+       DEVLINK_TRAP_GENERIC_ID_MTU_ERROR,
+       DEVLINK_TRAP_GENERIC_ID_UNRESOLVED_NEIGH,
+       DEVLINK_TRAP_GENERIC_ID_RPF,
+       DEVLINK_TRAP_GENERIC_ID_REJECT_ROUTE,
+       DEVLINK_TRAP_GENERIC_ID_IPV4_LPM_UNICAST_MISS,
+       DEVLINK_TRAP_GENERIC_ID_IPV6_LPM_UNICAST_MISS,
 
        /* Add new generic trap IDs above */
        __DEVLINK_TRAP_GENERIC_ID_MAX,
@@ -634,6 +640,18 @@ enum devlink_trap_group_generic_id {
        "ipv6_mc_dip_reserved_scope"
 #define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE \
        "ipv6_mc_dip_interface_local_scope"
+#define DEVLINK_TRAP_GENERIC_NAME_MTU_ERROR \
+       "mtu_value_is_too_small"
+#define DEVLINK_TRAP_GENERIC_NAME_UNRESOLVED_NEIGH \
+       "unresolved_neigh"
+#define DEVLINK_TRAP_GENERIC_NAME_RPF \
+       "mc_reverse_path_forwarding"
+#define DEVLINK_TRAP_GENERIC_NAME_REJECT_ROUTE \
+       "reject_route"
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_LPM_UNICAST_MISS \
+       "ipv4_lpm_miss"
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_LPM_UNICAST_MISS \
+       "ipv6_lpm_miss"
 
 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_L2_DROPS \
        "l2_drops"
index 9bbe2162f22ff3c2e68933805f0c6d475423bc8d..ff53f7d29dea90376ce6a30298d48d42b252fc03 100644 (file)
@@ -7611,6 +7611,12 @@ static const struct devlink_trap devlink_trap_generic[] = {
        DEVLINK_TRAP(IPV4_SIP_BC, DROP),
        DEVLINK_TRAP(IPV6_MC_DIP_RESERVED_SCOPE, DROP),
        DEVLINK_TRAP(IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE, DROP),
+       DEVLINK_TRAP(MTU_ERROR, EXCEPTION),
+       DEVLINK_TRAP(UNRESOLVED_NEIGH, EXCEPTION),
+       DEVLINK_TRAP(RPF, EXCEPTION),
+       DEVLINK_TRAP(REJECT_ROUTE, EXCEPTION),
+       DEVLINK_TRAP(IPV4_LPM_UNICAST_MISS, EXCEPTION),
+       DEVLINK_TRAP(IPV6_LPM_UNICAST_MISS, EXCEPTION),
 };
 
 #define DEVLINK_TRAP_GROUP(_id)                                                      \