Skip to content

Commit ec4f5b3

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Use different trap group for externally routed packets
Cited commit mistakenly removed the trap group for externally routed packets (e.g., via the management interface) and grouped locally routed and externally routed packet traps under the same group, thereby subjecting them to the same policer. This can result in problems, for example, when FRR is restarted and suddenly all transient traffic is trapped to the CPU because of a default route through the management interface. Locally routed packets required to re-establish a BGP connection will never reach the CPU and the routing tables will not be re-populated. Fix this by using a different trap group for externally routed packets. Fixes: 8110668 ("mlxsw: spectrum_trap: Register layer 3 control traps") Reported-by: Alex Veber <[email protected]> Tested-by: Alex Veber <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 89ab533 commit ec4f5b3

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

Documentation/networking/devlink/devlink-trap.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ narrow. The description of these groups must be added to the following table:
486486
- Contains packet traps for packets that should be locally delivered after
487487
routing, but do not match more specific packet traps (e.g.,
488488
``ipv4_bgp``)
489+
* - ``external_delivery``
490+
- Contains packet traps for packets that should be routed through an
491+
external interface (e.g., management interface) that does not belong to
492+
the same device (e.g., switch ASIC) as the ingress interface
489493
* - ``ipv6``
490494
- Contains packet traps for various IPv6 control packets (e.g., Router
491495
Advertisements)

drivers/net/ethernet/mellanox/mlxsw/reg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5536,6 +5536,7 @@ enum mlxsw_reg_htgt_trap_group {
55365536
MLXSW_REG_HTGT_TRAP_GROUP_SP_MULTICAST,
55375537
MLXSW_REG_HTGT_TRAP_GROUP_SP_NEIGH_DISCOVERY,
55385538
MLXSW_REG_HTGT_TRAP_GROUP_SP_ROUTER_EXP,
5539+
MLXSW_REG_HTGT_TRAP_GROUP_SP_EXTERNAL_ROUTE,
55395540
MLXSW_REG_HTGT_TRAP_GROUP_SP_IP2ME,
55405541
MLXSW_REG_HTGT_TRAP_GROUP_SP_DHCP,
55415542
MLXSW_REG_HTGT_TRAP_GROUP_SP_EVENT,

drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ mlxsw_sp_trap_policer_items_arr[] = {
328328
{
329329
.policer = MLXSW_SP_TRAP_POLICER(18, 1024, 128),
330330
},
331+
{
332+
.policer = MLXSW_SP_TRAP_POLICER(19, 1024, 512),
333+
},
331334
};
332335

333336
static const struct mlxsw_sp_trap_group_item mlxsw_sp_trap_group_items_arr[] = {
@@ -421,6 +424,11 @@ static const struct mlxsw_sp_trap_group_item mlxsw_sp_trap_group_items_arr[] = {
421424
.hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_IP2ME,
422425
.priority = 2,
423426
},
427+
{
428+
.group = DEVLINK_TRAP_GROUP_GENERIC(EXTERNAL_DELIVERY, 19),
429+
.hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_EXTERNAL_ROUTE,
430+
.priority = 1,
431+
},
424432
{
425433
.group = DEVLINK_TRAP_GROUP_GENERIC(IPV6, 15),
426434
.hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_IPV6,
@@ -882,11 +890,11 @@ static const struct mlxsw_sp_trap_item mlxsw_sp_trap_items_arr[] = {
882890
},
883891
},
884892
{
885-
.trap = MLXSW_SP_TRAP_CONTROL(EXTERNAL_ROUTE, LOCAL_DELIVERY,
893+
.trap = MLXSW_SP_TRAP_CONTROL(EXTERNAL_ROUTE, EXTERNAL_DELIVERY,
886894
TRAP),
887895
.listeners_arr = {
888-
MLXSW_SP_RXL_MARK(RTR_INGRESS0, IP2ME, TRAP_TO_CPU,
889-
false),
896+
MLXSW_SP_RXL_MARK(RTR_INGRESS0, EXTERNAL_ROUTE,
897+
TRAP_TO_CPU, false),
890898
},
891899
},
892900
{

include/net/devlink.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ enum devlink_trap_group_generic_id {
718718
DEVLINK_TRAP_GROUP_GENERIC_ID_PIM,
719719
DEVLINK_TRAP_GROUP_GENERIC_ID_UC_LB,
720720
DEVLINK_TRAP_GROUP_GENERIC_ID_LOCAL_DELIVERY,
721+
DEVLINK_TRAP_GROUP_GENERIC_ID_EXTERNAL_DELIVERY,
721722
DEVLINK_TRAP_GROUP_GENERIC_ID_IPV6,
722723
DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_EVENT,
723724
DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_GENERAL,
@@ -915,6 +916,8 @@ enum devlink_trap_group_generic_id {
915916
"uc_loopback"
916917
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_LOCAL_DELIVERY \
917918
"local_delivery"
919+
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_EXTERNAL_DELIVERY \
920+
"external_delivery"
918921
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_IPV6 \
919922
"ipv6"
920923
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PTP_EVENT \

net/core/devlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8567,6 +8567,7 @@ static const struct devlink_trap_group devlink_trap_group_generic[] = {
85678567
DEVLINK_TRAP_GROUP(PIM),
85688568
DEVLINK_TRAP_GROUP(UC_LB),
85698569
DEVLINK_TRAP_GROUP(LOCAL_DELIVERY),
8570+
DEVLINK_TRAP_GROUP(EXTERNAL_DELIVERY),
85708571
DEVLINK_TRAP_GROUP(IPV6),
85718572
DEVLINK_TRAP_GROUP(PTP_EVENT),
85728573
DEVLINK_TRAP_GROUP(PTP_GENERAL),

0 commit comments

Comments
 (0)