]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
devlink: Add 'control' trap type
authorIdo Schimmel <idosch@mellanox.com>
Fri, 29 May 2020 18:36:40 +0000 (21:36 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Jun 2020 18:49:23 +0000 (11:49 -0700)
This type is used for traps that trap control packets such as ARP
request and IGMP query to the CPU.

Do not report such packets to the kernel's drop monitor as they were not
dropped by the device no encountered an exception during forwarding.

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

index 5b97327caefc1f55df4e76694f2d87480080c414..6c293cfa23ee6b4bc4f6fc24c7743b88ae65c5d4 100644 (file)
@@ -55,7 +55,7 @@ The following diagram provides a general overview of ``devlink-trap``::
                           |                |
                           +-------^--------+
                                   |
-                                  |
+                                  | Non-control traps
                                   |
                              +----+----+
                              |         |      Kernel's Rx path
@@ -97,6 +97,12 @@ The ``devlink-trap`` mechanism supports the following packet trap types:
     processed by ``devlink`` and injected to the kernel's Rx path. Changing the
     action of such traps is not allowed, as it can easily break the control
     plane.
+  * ``control``: Trapped packets were trapped by the device because these are
+    control packets required for the correct functioning of the control plane.
+    For example, ARP request and IGMP query packets. Packets are injected to
+    the kernel's Rx path, but not reported to the kernel's drop monitor.
+    Changing the action of such traps is not allowed, as it can easily break
+    the control plane.
 
 .. _Trap-Actions:
 
index 16305932a9507f4ed9cbe6d4ed940513b3a5cb46..08563e6a424d235f082781be46077d92883acd82 100644 (file)
@@ -253,10 +253,16 @@ enum devlink_trap_action {
  *                               control plane for resolution. Trapped packets
  *                               are processed by devlink and injected to
  *                               the kernel's Rx path.
+ * @DEVLINK_TRAP_TYPE_CONTROL: Packet was trapped because it is required for
+ *                             the correct functioning of the control plane.
+ *                             For example, an ARP request packet. Trapped
+ *                             packets are injected to the kernel's Rx path,
+ *                             but not reported to drop monitor.
  */
 enum devlink_trap_type {
        DEVLINK_TRAP_TYPE_DROP,
        DEVLINK_TRAP_TYPE_EXCEPTION,
+       DEVLINK_TRAP_TYPE_CONTROL,
 };
 
 enum {
index d6298917b0771560ece7cf43b25b36ccb65d8b1b..47c28e0f848fadce1e2362eed116eb0e14180458 100644 (file)
@@ -8847,6 +8847,13 @@ void devlink_trap_report(struct devlink *devlink, struct sk_buff *skb,
        devlink_trap_stats_update(trap_item->stats, skb->len);
        devlink_trap_stats_update(trap_item->group_item->stats, skb->len);
 
+       /* Control packets were not dropped by the device or encountered an
+        * exception during forwarding and therefore should not be reported to
+        * the kernel's drop monitor.
+        */
+       if (trap_item->trap->type == DEVLINK_TRAP_TYPE_CONTROL)
+               return;
+
        devlink_trap_report_metadata_fill(&hw_metadata, trap_item,
                                          in_devlink_port, fa_cookie);
        net_dm_hw_report(skb, &hw_metadata);