[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190528122136.30476-4-idosch@idosch.org>
Date: Tue, 28 May 2019 15:21:27 +0300
From: Ido Schimmel <idosch@...sch.org>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, jiri@...lanox.com, mlxsw@...lanox.com,
dsahern@...il.com, roopa@...ulusnetworks.com,
nikolay@...ulusnetworks.com, andy@...yhouse.net,
pablo@...filter.org, jakub.kicinski@...ronome.com,
pieter.jansenvanvuuren@...ronome.com, andrew@...n.ch,
f.fainelli@...il.com, vivien.didelot@...oirfairelinux.com,
Ido Schimmel <idosch@...lanox.com>
Subject: [RFC PATCH net-next 03/12] devlink: Add generic packet traps and groups
From: Ido Schimmel <idosch@...lanox.com>
Add generic packet traps and groups that can report dropped packets as
well as exceptions such as TTL error.
Signed-off-by: Ido Schimmel <idosch@...lanox.com>
---
include/net/devlink.h | 46 +++++++++++++++++++++++++++++++++++++++++++
net/core/devlink.c | 14 +++++++++++++
2 files changed, 60 insertions(+)
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 7f090cb072f4..6cfa1ab36e3f 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -525,18 +525,64 @@ struct devlink_trap {
};
enum devlink_trap_generic_id {
+ DEVLINK_TRAP_GENERIC_ID_INGRESS_SMAC_MC_DROP,
+ DEVLINK_TRAP_GENERIC_ID_INGRESS_VLAN_TAG_ALLOW_DROP,
+ DEVLINK_TRAP_GENERIC_ID_INGRESS_VLAN_FILTER_DROP,
+ DEVLINK_TRAP_GENERIC_ID_INGRESS_STP_FILTER_DROP,
+ DEVLINK_TRAP_GENERIC_ID_UC_EMPTY_TX_LIST_DROP,
+ DEVLINK_TRAP_GENERIC_ID_MC_EMPTY_TX_LIST_DROP,
+ DEVLINK_TRAP_GENERIC_ID_UC_LOOPBACK_FILTER_DROP,
+ DEVLINK_TRAP_GENERIC_ID_BLACKHOLE_ROUTE_DROP,
+ DEVLINK_TRAP_GENERIC_ID_TTL_ERROR_EXCEPTION,
+ DEVLINK_TRAP_GENERIC_ID_TAIL_DROP,
+ DEVLINK_TRAP_GENERIC_ID_EARLY_DROP,
+
/* Add new generic trap IDs above */
__DEVLINK_TRAP_GENERIC_ID_MAX,
DEVLINK_TRAP_GENERIC_ID_MAX = __DEVLINK_TRAP_GENERIC_ID_MAX - 1,
};
enum devlink_trap_group_generic_id {
+ DEVLINK_TRAP_GROUP_GENERIC_ID_L2_DROPS,
+ DEVLINK_TRAP_GROUP_GENERIC_ID_L3_DROPS,
+ DEVLINK_TRAP_GROUP_GENERIC_ID_BUFFER_DROPS,
+
/* Add new generic trap group IDs above */
__DEVLINK_TRAP_GROUP_GENERIC_ID_MAX,
DEVLINK_TRAP_GROUP_GENERIC_ID_MAX =
__DEVLINK_TRAP_GROUP_GENERIC_ID_MAX - 1,
};
+#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_SMAC_MC_DROP \
+ "ingress_smac_mc_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_VLAN_TAG_ALLOW_DROP \
+ "ingress_vlan_tag_allow_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_VLAN_FILTER_DROP \
+ "ingress_vlan_filter_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_STP_FILTER_DROP \
+ "ingress_stp_filter_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_UC_EMPTY_TX_LIST_DROP \
+ "uc_empty_tx_list_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_MC_EMPTY_TX_LIST_DROP \
+ "mc_empty_tx_list_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_UC_LOOPBACK_FILTER_DROP \
+ "uc_loopback_filter_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_BLACKHOLE_ROUTE_DROP \
+ "blackhole_route_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_TTL_ERROR_EXCEPTION \
+ "ttl_error_exception"
+#define DEVLINK_TRAP_GENERIC_NAME_TAIL_DROP \
+ "tail_drop"
+#define DEVLINK_TRAP_GENERIC_NAME_EARLY_DROP \
+ "early_drop"
+
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L2_DROPS \
+ "l2_drops"
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L3_DROPS \
+ "l3_drops"
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_BUFFER_DROPS \
+ "buffer_drops"
+
#define DEVLINK_TRAP_GENERIC(_type, _init_action, _id, _group, _metadata_cap) \
{ \
.type = DEVLINK_TRAP_TYPE_##_type, \
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 96a7ce6701e6..ef22e2d061fc 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -7236,6 +7236,17 @@ EXPORT_SYMBOL_GPL(devlink_region_snapshot_create);
}
static const struct devlink_trap devlink_trap_generic[] = {
+ DEVLINK_TRAP(INGRESS_SMAC_MC_DROP, DROP),
+ DEVLINK_TRAP(INGRESS_VLAN_TAG_ALLOW_DROP, DROP),
+ DEVLINK_TRAP(INGRESS_VLAN_FILTER_DROP, DROP),
+ DEVLINK_TRAP(INGRESS_STP_FILTER_DROP, DROP),
+ DEVLINK_TRAP(UC_EMPTY_TX_LIST_DROP, DROP),
+ DEVLINK_TRAP(MC_EMPTY_TX_LIST_DROP, DROP),
+ DEVLINK_TRAP(UC_LOOPBACK_FILTER_DROP, DROP),
+ DEVLINK_TRAP(BLACKHOLE_ROUTE_DROP, DROP),
+ DEVLINK_TRAP(TTL_ERROR_EXCEPTION, EXCEPTION),
+ DEVLINK_TRAP(TAIL_DROP, DROP),
+ DEVLINK_TRAP(EARLY_DROP, DROP),
};
#define DEVLINK_TRAP_GROUP(_id) \
@@ -7245,6 +7256,9 @@ static const struct devlink_trap devlink_trap_generic[] = {
}
static const struct devlink_trap_group devlink_trap_group_generic[] = {
+ DEVLINK_TRAP_GROUP(L2_DROPS),
+ DEVLINK_TRAP_GROUP(L3_DROPS),
+ DEVLINK_TRAP_GROUP(BUFFER_DROPS),
};
static int devlink_trap_generic_verify(const struct devlink_trap *trap)
--
2.20.1
Powered by blists - more mailing lists