From: Ido Schimmel <ido...@mellanox.com>

Only including this patch so that people could easily apply the series.
I'm aware David takes care of syncing the kernel headers.

Signed-off-by: Ido Schimmel <ido...@mellanox.com>
---
 include/uapi/linux/devlink.h | 68 ++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 3b6a9e6be3ac..bd38d009df0d 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -16,6 +16,7 @@
 #define DEVLINK_GENL_NAME "devlink"
 #define DEVLINK_GENL_VERSION 0x1
 #define DEVLINK_GENL_MCGRP_CONFIG_NAME "config"
+#define DEVLINK_GENL_MCGRP_TRAP_NAME "trap"
 
 enum devlink_command {
        /* don't change the order or add anything between, this is ABI! */
@@ -105,6 +106,17 @@ enum devlink_command {
 
        DEVLINK_CMD_FLASH_UPDATE,
 
+       DEVLINK_CMD_TRAP_GET,           /* can dump */
+       DEVLINK_CMD_TRAP_SET,
+       DEVLINK_CMD_TRAP_NEW,
+       DEVLINK_CMD_TRAP_DEL,
+       DEVLINK_CMD_TRAP_REPORT,
+
+       DEVLINK_CMD_TRAP_GROUP_GET,     /* can dump */
+       DEVLINK_CMD_TRAP_GROUP_SET,
+       DEVLINK_CMD_TRAP_GROUP_NEW,
+       DEVLINK_CMD_TRAP_GROUP_DEL,
+
        /* add new commands above here */
        __DEVLINK_CMD_MAX,
        DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
@@ -184,6 +196,47 @@ enum devlink_param_fw_load_policy_value {
        DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH,
 };
 
+enum {
+       DEVLINK_ATTR_STATS_RX_PACKETS,
+       DEVLINK_ATTR_STATS_RX_BYTES,
+
+       __DEVLINK_ATTR_STATS_MAX,
+       DEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1
+};
+
+/**
+ * enum devlink_trap_action - Packet trap action.
+ * @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not
+ *                            sent to the CPU.
+ * @DEVLINK_TRAP_ACTION_TRAP: The sole copy of the packet is sent to the CPU.
+ */
+enum devlink_trap_action {
+       DEVLINK_TRAP_ACTION_DROP,
+       DEVLINK_TRAP_ACTION_TRAP,
+};
+
+/**
+ * enum devlink_trap_type - Packet trap type.
+ * @DEVLINK_TRAP_TYPE_DROP: Trap reason is a drop. Trapped packets are only
+ *                          processed by devlink and not injected to the
+ *                          kernel's Rx path.
+ * @DEVLINK_TRAP_TYPE_EXCEPTION: Trap reason is an exception. Packet was not
+ *                               forwarded as intended due to an exception
+ *                               (e.g., missing neighbour entry) and trapped to
+ *                               control plane for resolution. Trapped packets
+ *                               are processed by devlink and injected to
+ *                               the kernel's Rx path.
+ */
+enum devlink_trap_type {
+       DEVLINK_TRAP_TYPE_DROP,
+       DEVLINK_TRAP_TYPE_EXCEPTION,
+};
+
+enum {
+       /* Trap can report input port as metadata */
+       DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT,
+};
+
 enum devlink_attr {
        /* don't change the order or add anything between, this is ABI! */
        DEVLINK_ATTR_UNSPEC,
@@ -332,6 +385,21 @@ enum devlink_attr {
        DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME,    /* string */
        DEVLINK_ATTR_FLASH_UPDATE_COMPONENT,    /* string */
 
+       DEVLINK_ATTR_STATS,                             /* nested */
+
+       DEVLINK_ATTR_TRAP_NAME,                         /* string */
+       DEVLINK_ATTR_TRAP_REPORT_ENABLED,               /* u8 */
+       /* enum devlink_trap_action */
+       DEVLINK_ATTR_TRAP_ACTION,                       /* u8 */
+       /* enum devlink_trap_type */
+       DEVLINK_ATTR_TRAP_TYPE,                         /* u8 */
+       DEVLINK_ATTR_TRAP_GENERIC,                      /* flag */
+       DEVLINK_ATTR_TRAP_METADATA,                     /* nested */
+       DEVLINK_ATTR_TRAP_TIMESTAMP,                    /* struct timespec */
+       DEVLINK_ATTR_TRAP_IN_PORT,                      /* nested */
+       DEVLINK_ATTR_TRAP_PAYLOAD,                      /* binary */
+       DEVLINK_ATTR_TRAP_GROUP_NAME,                   /* string */
+
        /* add new attributes above here, update the policy in devlink.c */
 
        __DEVLINK_ATTR_MAX,
-- 
2.20.1

Reply via email to