Skip to content

Commit 10c24eb

Browse files
IoanaCiorneidavem330
authored andcommitted
devlink: add parser error drop packet traps
Add parser error drop packet traps, so that capable device driver could register them with devlink. The new packet trap group holds any drops of packets which were marked by the device as erroneous during header parsing. Add documentation for every added packet trap and packet trap group. Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 34ad937 commit 10c24eb

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

Documentation/networking/devlink/devlink-trap.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,73 @@ be added to the following table:
409409
- ``drop``
410410
- Traps packets dropped due to the RED (Random Early Detection) algorithm
411411
(i.e., early drops)
412+
* - ``vxlan_parsing``
413+
- ``drop``
414+
- Traps packets dropped due to an error in the VXLAN header parsing which
415+
might be because of packet truncation or the I flag is not set.
416+
* - ``llc_snap_parsing``
417+
- ``drop``
418+
- Traps packets dropped due to an error in the LLC+SNAP header parsing
419+
* - ``vlan_parsing``
420+
- ``drop``
421+
- Traps packets dropped due to an error in the VLAN header parsing. Could
422+
include unexpected packet truncation.
423+
* - ``pppoe_ppp_parsing``
424+
- ``drop``
425+
- Traps packets dropped due to an error in the PPPoE+PPP header parsing.
426+
This could include finding a session ID of 0xFFFF (which is reserved and
427+
not for use), a PPPoE length which is larger than the frame received or
428+
any common error on this type of header
429+
* - ``mpls_parsing``
430+
- ``drop``
431+
- Traps packets dropped due to an error in the MPLS header parsing which
432+
could include unexpected header truncation
433+
* - ``arp_parsing``
434+
- ``drop``
435+
- Traps packets dropped due to an error in the ARP header parsing
436+
* - ``ip_1_parsing``
437+
- ``drop``
438+
- Traps packets dropped due to an error in the first IP header parsing.
439+
This packet trap could include packets which do not pass an IP checksum
440+
check, a header length check (a minimum of 20 bytes), which might suffer
441+
from packet truncation thus the total length field exceeds the received
442+
packet length etc
443+
* - ``ip_n_parsing``
444+
- ``drop``
445+
- Traps packets dropped due to an error in the parsing of the last IP
446+
header (the inner one in case of an IP over IP tunnel). The same common
447+
error checking is performed here as for the ip_1_parsing trap
448+
* - ``gre_parsing``
449+
- ``drop``
450+
- Traps packets dropped due to an error in the GRE header parsing
451+
* - ``udp_parsing``
452+
- ``drop``
453+
- Traps packets dropped due to an error in the UDP header parsing.
454+
This packet trap could include checksum errorrs, an improper UDP
455+
length detected (smaller than 8 bytes) or detection of header
456+
truncation.
457+
* - ``tcp_parsing``
458+
- ``drop``
459+
- Traps packets dropped due to an error in the TCP header parsing.
460+
This could include TCP checksum errors, improper combination of SYN, FIN
461+
and/or RESET etc.
462+
* - ``ipsec_parsing``
463+
- ``drop``
464+
- Traps packets dropped due to an error in the IPSEC header parsing
465+
* - ``sctp_parsing``
466+
- ``drop``
467+
- Traps packets dropped due to an error in the SCTP header parsing.
468+
This would mean that port number 0 was used or that the header is
469+
truncated.
470+
* - ``dccp_parsing``
471+
- ``drop``
472+
- Traps packets dropped due to an error in the DCCP header parsing
473+
* - ``gtp_parsing``
474+
- ``drop``
475+
- Traps packets dropped due to an error in the GTP header parsing
476+
* - ``esp_parsing``
477+
- ``drop``
478+
- Traps packets dropped due to an error in the ESP header parsing
412479

413480
Driver-specific Packet Traps
414481
============================
@@ -509,6 +576,9 @@ narrow. The description of these groups must be added to the following table:
509576
* - ``acl_trap``
510577
- Contains packet traps for packets that were trapped (logged) by the
511578
device during ACL processing
579+
* - ``parser_error_drops``
580+
- Contains packet traps for packets that were marked by the device during
581+
parsing as erroneous
512582

513583
Packet Trap Policers
514584
====================

include/net/devlink.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,22 @@ enum devlink_trap_generic_id {
784784
DEVLINK_TRAP_GENERIC_ID_FLOW_ACTION_SAMPLE,
785785
DEVLINK_TRAP_GENERIC_ID_FLOW_ACTION_TRAP,
786786
DEVLINK_TRAP_GENERIC_ID_EARLY_DROP,
787+
DEVLINK_TRAP_GENERIC_ID_VXLAN_PARSING,
788+
DEVLINK_TRAP_GENERIC_ID_LLC_SNAP_PARSING,
789+
DEVLINK_TRAP_GENERIC_ID_VLAN_PARSING,
790+
DEVLINK_TRAP_GENERIC_ID_PPPOE_PPP_PARSING,
791+
DEVLINK_TRAP_GENERIC_ID_MPLS_PARSING,
792+
DEVLINK_TRAP_GENERIC_ID_ARP_PARSING,
793+
DEVLINK_TRAP_GENERIC_ID_IP_1_PARSING,
794+
DEVLINK_TRAP_GENERIC_ID_IP_N_PARSING,
795+
DEVLINK_TRAP_GENERIC_ID_GRE_PARSING,
796+
DEVLINK_TRAP_GENERIC_ID_UDP_PARSING,
797+
DEVLINK_TRAP_GENERIC_ID_TCP_PARSING,
798+
DEVLINK_TRAP_GENERIC_ID_IPSEC_PARSING,
799+
DEVLINK_TRAP_GENERIC_ID_SCTP_PARSING,
800+
DEVLINK_TRAP_GENERIC_ID_DCCP_PARSING,
801+
DEVLINK_TRAP_GENERIC_ID_GTP_PARSING,
802+
DEVLINK_TRAP_GENERIC_ID_ESP_PARSING,
787803

788804
/* Add new generic trap IDs above */
789805
__DEVLINK_TRAP_GENERIC_ID_MAX,
@@ -819,6 +835,7 @@ enum devlink_trap_group_generic_id {
819835
DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_GENERAL,
820836
DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_SAMPLE,
821837
DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_TRAP,
838+
DEVLINK_TRAP_GROUP_GENERIC_ID_PARSER_ERROR_DROPS,
822839

823840
/* Add new generic trap group IDs above */
824841
__DEVLINK_TRAP_GROUP_GENERIC_ID_MAX,
@@ -974,6 +991,39 @@ enum devlink_trap_group_generic_id {
974991
"flow_action_trap"
975992
#define DEVLINK_TRAP_GENERIC_NAME_EARLY_DROP \
976993
"early_drop"
994+
#define DEVLINK_TRAP_GENERIC_NAME_VXLAN_PARSING \
995+
"vxlan_parsing"
996+
#define DEVLINK_TRAP_GENERIC_NAME_LLC_SNAP_PARSING \
997+
"llc_snap_parsing"
998+
#define DEVLINK_TRAP_GENERIC_NAME_VLAN_PARSING \
999+
"vlan_parsing"
1000+
#define DEVLINK_TRAP_GENERIC_NAME_PPPOE_PPP_PARSING \
1001+
"pppoe_ppp_parsing"
1002+
#define DEVLINK_TRAP_GENERIC_NAME_MPLS_PARSING \
1003+
"mpls_parsing"
1004+
#define DEVLINK_TRAP_GENERIC_NAME_ARP_PARSING \
1005+
"arp_parsing"
1006+
#define DEVLINK_TRAP_GENERIC_NAME_IP_1_PARSING \
1007+
"ip_1_parsing"
1008+
#define DEVLINK_TRAP_GENERIC_NAME_IP_N_PARSING \
1009+
"ip_n_parsing"
1010+
#define DEVLINK_TRAP_GENERIC_NAME_GRE_PARSING \
1011+
"gre_parsing"
1012+
#define DEVLINK_TRAP_GENERIC_NAME_UDP_PARSING \
1013+
"udp_parsing"
1014+
#define DEVLINK_TRAP_GENERIC_NAME_TCP_PARSING \
1015+
"tcp_parsing"
1016+
#define DEVLINK_TRAP_GENERIC_NAME_IPSEC_PARSING \
1017+
"ipsec_parsing"
1018+
#define DEVLINK_TRAP_GENERIC_NAME_SCTP_PARSING \
1019+
"sctp_parsing"
1020+
#define DEVLINK_TRAP_GENERIC_NAME_DCCP_PARSING \
1021+
"dccp_parsing"
1022+
#define DEVLINK_TRAP_GENERIC_NAME_GTP_PARSING \
1023+
"gtp_parsing"
1024+
#define DEVLINK_TRAP_GENERIC_NAME_ESP_PARSING \
1025+
"esp_parsing"
1026+
9771027

9781028
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L2_DROPS \
9791029
"l2_drops"
@@ -1025,6 +1075,8 @@ enum devlink_trap_group_generic_id {
10251075
"acl_sample"
10261076
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_TRAP \
10271077
"acl_trap"
1078+
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PARSER_ERROR_DROPS \
1079+
"parser_error_drops"
10281080

10291081
#define DEVLINK_TRAP_GENERIC(_type, _init_action, _id, _group_id, \
10301082
_metadata_cap) \

net/core/devlink.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8925,6 +8925,22 @@ static const struct devlink_trap devlink_trap_generic[] = {
89258925
DEVLINK_TRAP(FLOW_ACTION_SAMPLE, CONTROL),
89268926
DEVLINK_TRAP(FLOW_ACTION_TRAP, CONTROL),
89278927
DEVLINK_TRAP(EARLY_DROP, DROP),
8928+
DEVLINK_TRAP(VXLAN_PARSING, DROP),
8929+
DEVLINK_TRAP(LLC_SNAP_PARSING, DROP),
8930+
DEVLINK_TRAP(VLAN_PARSING, DROP),
8931+
DEVLINK_TRAP(PPPOE_PPP_PARSING, DROP),
8932+
DEVLINK_TRAP(MPLS_PARSING, DROP),
8933+
DEVLINK_TRAP(ARP_PARSING, DROP),
8934+
DEVLINK_TRAP(IP_1_PARSING, DROP),
8935+
DEVLINK_TRAP(IP_N_PARSING, DROP),
8936+
DEVLINK_TRAP(GRE_PARSING, DROP),
8937+
DEVLINK_TRAP(UDP_PARSING, DROP),
8938+
DEVLINK_TRAP(TCP_PARSING, DROP),
8939+
DEVLINK_TRAP(IPSEC_PARSING, DROP),
8940+
DEVLINK_TRAP(SCTP_PARSING, DROP),
8941+
DEVLINK_TRAP(DCCP_PARSING, DROP),
8942+
DEVLINK_TRAP(GTP_PARSING, DROP),
8943+
DEVLINK_TRAP(ESP_PARSING, DROP),
89288944
};
89298945

89308946
#define DEVLINK_TRAP_GROUP(_id) \
@@ -8959,6 +8975,7 @@ static const struct devlink_trap_group devlink_trap_group_generic[] = {
89598975
DEVLINK_TRAP_GROUP(PTP_GENERAL),
89608976
DEVLINK_TRAP_GROUP(ACL_SAMPLE),
89618977
DEVLINK_TRAP_GROUP(ACL_TRAP),
8978+
DEVLINK_TRAP_GROUP(PARSER_ERROR_DROPS),
89628979
};
89638980

89648981
static int devlink_trap_generic_verify(const struct devlink_trap *trap)

0 commit comments

Comments
 (0)