]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
devlink: Add layer 3 generic packet traps
authorAmit Cohen <amitc@mellanox.com>
Thu, 7 Nov 2019 16:42:09 +0000 (18:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Nov 2019 03:51:40 +0000 (19:51 -0800)
Add packet traps that can report packets that were dropped during layer
3 forwarding.

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 8e90a85f3bd53ab0d4eefffac614469c41928c66..dc3dc87217c977966a1166b4ab11e642d84a0a1c 100644 (file)
@@ -162,6 +162,47 @@ be added to the following table:
      - ``drop``
      - Traps packets that the device decided to drop because they could not be
        enqueued to a transmission queue which is full
+   * - ``non_ip``
+     - ``drop``
+     - Traps packets that the device decided to drop because they need to
+       undergo a layer 3 lookup, but are not IP or MPLS packets
+   * - ``uc_dip_over_mc_dmac``
+     - ``drop``
+     - Traps packets that the device decided to drop because they need to be
+       routed and they have a unicast destination IP and a multicast destination
+       MAC
+   * - ``dip_is_loopback_address``
+     - ``drop``
+     - Traps packets that the device decided to drop because they need to be
+       routed and their destination IP is the loopback address (i.e., 127.0.0.0/8
+       and ::1/128)
+   * - ``sip_is_mc``
+     - ``drop``
+     - Traps packets that the device decided to drop because they need to be
+       routed and their source IP is multicast (i.e., 224.0.0.0/8 and ff::/8)
+   * - ``sip_is_loopback_address``
+     - ``drop``
+     - Traps packets that the device decided to drop because they need to be
+       routed and their source IP is the loopback address (i.e., 127.0.0.0/8 and ::1/128)
+   * - ``ip_header_corrupted``
+     - ``drop``
+     - Traps packets that the device decided to drop because they need to be
+       routed and their IP header is corrupted: wrong checksum, wrong IP version
+       or too short Internet Header Length (IHL)
+   * - ``ipv4_sip_is_limited_bc``
+     - ``drop``
+     - Traps packets that the device decided to drop because they need to be
+       routed and their source IP is limited broadcast (i.e., 255.255.255.255/32)
+   * - ``ipv6_mc_dip_reserved_scope``
+     - ``drop``
+     - Traps IPv6 packets that the device decided to drop because they need to
+       be routed and their IPv6 multicast destination IP has a reserved scope
+       (i.e., ffx0::/16)
+   * - ``ipv6_mc_dip_interface_local_scope``
+     - ``drop``
+     - 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)
 
 Driver-specific Packet Traps
 ============================
index 6bf3b9e0595ae64416be79380fc9abe2523505d6..df7814d55bf93d0e4d46a083d7ccb78a5aa8e985 100644 (file)
@@ -569,6 +569,15 @@ enum devlink_trap_generic_id {
        DEVLINK_TRAP_GENERIC_ID_BLACKHOLE_ROUTE,
        DEVLINK_TRAP_GENERIC_ID_TTL_ERROR,
        DEVLINK_TRAP_GENERIC_ID_TAIL_DROP,
+       DEVLINK_TRAP_GENERIC_ID_NON_IP_PACKET,
+       DEVLINK_TRAP_GENERIC_ID_UC_DIP_MC_DMAC,
+       DEVLINK_TRAP_GENERIC_ID_DIP_LB,
+       DEVLINK_TRAP_GENERIC_ID_SIP_MC,
+       DEVLINK_TRAP_GENERIC_ID_SIP_LB,
+       DEVLINK_TRAP_GENERIC_ID_CORRUPTED_IP_HDR,
+       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,
 
        /* Add new generic trap IDs above */
        __DEVLINK_TRAP_GENERIC_ID_MAX,
@@ -607,6 +616,24 @@ enum devlink_trap_group_generic_id {
        "ttl_value_is_too_small"
 #define DEVLINK_TRAP_GENERIC_NAME_TAIL_DROP \
        "tail_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_NON_IP_PACKET \
+       "non_ip"
+#define DEVLINK_TRAP_GENERIC_NAME_UC_DIP_MC_DMAC \
+       "uc_dip_over_mc_dmac"
+#define DEVLINK_TRAP_GENERIC_NAME_DIP_LB \
+       "dip_is_loopback_address"
+#define DEVLINK_TRAP_GENERIC_NAME_SIP_MC \
+       "sip_is_mc"
+#define DEVLINK_TRAP_GENERIC_NAME_SIP_LB \
+       "sip_is_loopback_address"
+#define DEVLINK_TRAP_GENERIC_NAME_CORRUPTED_IP_HDR \
+       "ip_header_corrupted"
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_SIP_BC \
+       "ipv4_sip_is_limited_bc"
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_RESERVED_SCOPE \
+       "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_GROUP_GENERIC_NAME_L2_DROPS \
        "l2_drops"
index 97e9a22469295d61ed831c2101dca0905e27ac76..9bbe2162f22ff3c2e68933805f0c6d475423bc8d 100644 (file)
@@ -7602,6 +7602,15 @@ static const struct devlink_trap devlink_trap_generic[] = {
        DEVLINK_TRAP(BLACKHOLE_ROUTE, DROP),
        DEVLINK_TRAP(TTL_ERROR, EXCEPTION),
        DEVLINK_TRAP(TAIL_DROP, DROP),
+       DEVLINK_TRAP(NON_IP_PACKET, DROP),
+       DEVLINK_TRAP(UC_DIP_MC_DMAC, DROP),
+       DEVLINK_TRAP(DIP_LB, DROP),
+       DEVLINK_TRAP(SIP_MC, DROP),
+       DEVLINK_TRAP(SIP_LB, DROP),
+       DEVLINK_TRAP(CORRUPTED_IP_HDR, DROP),
+       DEVLINK_TRAP(IPV4_SIP_BC, DROP),
+       DEVLINK_TRAP(IPV6_MC_DIP_RESERVED_SCOPE, DROP),
+       DEVLINK_TRAP(IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE, DROP),
 };
 
 #define DEVLINK_TRAP_GROUP(_id)                                                      \