summaryrefslogtreecommitdiff
path: root/net/core/devlink.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-10-02 16:31:56 -0700
committerDavid S. Miller <davem@davemloft.net>2020-10-02 16:31:56 -0700
commit5a38b4fc010412beda7e6e4284401559356f5827 (patch)
treed30d2966e4b54167b2100a9cccf8cb670d6a340b /net/core/devlink.c
parent34ad937770d7f17f18f66bdd6b860306a3344d16 (diff)
parent061d631f7de24cae30a1f931f18df643cba58246 (diff)
Merge branch 'dpaa2-eth-add-devlink-parser-error-drop-trap-support'
Ioana Ciornei says: ==================== dpaa2-eth: add devlink parser error drop trap support This patch set adds support in the dpaa2-eth driver for a new group of devlink drop traps - PARSER_ERROR_DROPS. The first patch adds a new generic trap group and associated traps, their definitions in devlink and their corresponding entries in the Documentation. Because there might be more devices (besides DPAA2) which do not support changing the action independently on each trap, a nre devlink callback is introduced - .trap_group_action_set(). If this callback is populated, it will take precedence over .trap_action_set() when the user requests changing the action on all the traps in a group. The next patches add basic linkage with devlink for the dpaa2-eth driver and support for the newly added PARSER_ERROR_DROPS. Nothing special here, just setting up the Rx error queue, interpreting the parse result, and then reporting any frame received on that queue to devlink. Changes in v2: - fix build error in 3/4 Changes in v3: - removed a commented line in 4/4 - added an extack in 4/4 - fixed up a warning on 32bit in 4/4 - reworded the trap_group_action_set() description in 2/4 ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/devlink.c')
-rw-r--r--net/core/devlink.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 6f2863e717a9..2a95f7f27a54 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -6720,6 +6720,24 @@ __devlink_trap_group_action_set(struct devlink *devlink,
struct devlink_trap_item *trap_item;
int err;
+ if (devlink->ops->trap_group_action_set) {
+ err = devlink->ops->trap_group_action_set(devlink, group_item->group,
+ trap_action, extack);
+ if (err)
+ return err;
+
+ list_for_each_entry(trap_item, &devlink->trap_list, list) {
+ if (strcmp(trap_item->group_item->group->name, group_name))
+ continue;
+ if (trap_item->action != trap_action &&
+ trap_item->trap->type != DEVLINK_TRAP_TYPE_DROP)
+ continue;
+ trap_item->action = trap_action;
+ }
+
+ return 0;
+ }
+
list_for_each_entry(trap_item, &devlink->trap_list, list) {
if (strcmp(trap_item->group_item->group->name, group_name))
continue;
@@ -8925,6 +8943,22 @@ static const struct devlink_trap devlink_trap_generic[] = {
DEVLINK_TRAP(FLOW_ACTION_SAMPLE, CONTROL),
DEVLINK_TRAP(FLOW_ACTION_TRAP, CONTROL),
DEVLINK_TRAP(EARLY_DROP, DROP),
+ DEVLINK_TRAP(VXLAN_PARSING, DROP),
+ DEVLINK_TRAP(LLC_SNAP_PARSING, DROP),
+ DEVLINK_TRAP(VLAN_PARSING, DROP),
+ DEVLINK_TRAP(PPPOE_PPP_PARSING, DROP),
+ DEVLINK_TRAP(MPLS_PARSING, DROP),
+ DEVLINK_TRAP(ARP_PARSING, DROP),
+ DEVLINK_TRAP(IP_1_PARSING, DROP),
+ DEVLINK_TRAP(IP_N_PARSING, DROP),
+ DEVLINK_TRAP(GRE_PARSING, DROP),
+ DEVLINK_TRAP(UDP_PARSING, DROP),
+ DEVLINK_TRAP(TCP_PARSING, DROP),
+ DEVLINK_TRAP(IPSEC_PARSING, DROP),
+ DEVLINK_TRAP(SCTP_PARSING, DROP),
+ DEVLINK_TRAP(DCCP_PARSING, DROP),
+ DEVLINK_TRAP(GTP_PARSING, DROP),
+ DEVLINK_TRAP(ESP_PARSING, DROP),
};
#define DEVLINK_TRAP_GROUP(_id) \
@@ -8959,6 +8993,7 @@ static const struct devlink_trap_group devlink_trap_group_generic[] = {
DEVLINK_TRAP_GROUP(PTP_GENERAL),
DEVLINK_TRAP_GROUP(ACL_SAMPLE),
DEVLINK_TRAP_GROUP(ACL_TRAP),
+ DEVLINK_TRAP_GROUP(PARSER_ERROR_DROPS),
};
static int devlink_trap_generic_verify(const struct devlink_trap *trap)