]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mlxsw: spectrum: Add packet traps for BFD packets
authorIdo Schimmel <idosch@mellanox.com>
Mon, 25 May 2020 23:05:55 +0000 (02:05 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 27 May 2020 03:33:58 +0000 (20:33 -0700)
Bidirectional Forwarding Detection (BFD) provides "low-overhead,
short-duration detection of failures in the path between adjacent
forwarding engines" (RFC 5880).

This is accomplished by exchanging BFD packets between the two
forwarding engines. Up until now these packets were trapped via the
general local delivery (i.e., IP2ME) trap which also traps a lot of
other packets that are not as time-sensitive as BFD packets.

Expose dedicated traps for BFD packets so that user space could
configure a dedicated policer for them.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/reg.h
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/trap.h

index 586a2f37fd120690038e13d8c99897ad7907759b..38fa7304af0c3aecf65af52c2e511199261bad31 100644 (file)
@@ -5548,6 +5548,7 @@ enum mlxsw_reg_htgt_trap_group {
        MLXSW_REG_HTGT_TRAP_GROUP_SP_PKT_SAMPLE,
        MLXSW_REG_HTGT_TRAP_GROUP_SP_FLOW_LOGGING,
        MLXSW_REG_HTGT_TRAP_GROUP_SP_FID_MISS,
+       MLXSW_REG_HTGT_TRAP_GROUP_SP_BFD,
        MLXSW_REG_HTGT_TRAP_GROUP_SP_DUMMY,
        MLXSW_REG_HTGT_TRAP_GROUP_SP_L2_DISCARDS,
        MLXSW_REG_HTGT_TRAP_GROUP_SP_L3_DISCARDS,
index 5cb7fd650156c1e4868f49e7c1e5bfb0756e9730..c598ae9ed1061f8e6775fe017d858cc6006e3de0 100644 (file)
@@ -4093,6 +4093,8 @@ static const struct mlxsw_listener mlxsw_sp_listener[] = {
        MLXSW_SP_RXL_MARK(ROUTER_ALERT_IPV6, TRAP_TO_CPU, IP2ME, false),
        MLXSW_SP_RXL_MARK(IPV4_VRRP, TRAP_TO_CPU, VRRP, false),
        MLXSW_SP_RXL_MARK(IPV6_VRRP, TRAP_TO_CPU, VRRP, false),
+       MLXSW_SP_RXL_MARK(IPV4_BFD, TRAP_TO_CPU, BFD, false),
+       MLXSW_SP_RXL_MARK(IPV6_BFD, TRAP_TO_CPU, BFD, false),
        MLXSW_SP_RXL_NO_MARK(DISCARD_ING_ROUTER_SIP_CLASS_E, FORWARD,
                             ROUTER_EXP, false),
        MLXSW_SP_RXL_NO_MARK(DISCARD_ING_ROUTER_MC_DMAC, FORWARD,
@@ -4185,6 +4187,10 @@ static int mlxsw_sp_cpu_policers_set(struct mlxsw_core *mlxsw_core)
                        rate = 360;
                        burst_size = 7;
                        break;
+               case MLXSW_REG_HTGT_TRAP_GROUP_SP_BFD:
+                       rate = 20 * 1024;
+                       burst_size = 10;
+                       break;
                default:
                        continue;
                }
@@ -4226,6 +4232,7 @@ static int mlxsw_sp_trap_groups_set(struct mlxsw_core *mlxsw_core)
                case MLXSW_REG_HTGT_TRAP_GROUP_SP_PIM:
                case MLXSW_REG_HTGT_TRAP_GROUP_SP_PTP0:
                case MLXSW_REG_HTGT_TRAP_GROUP_SP_VRRP:
+               case MLXSW_REG_HTGT_TRAP_GROUP_SP_BFD:
                        priority = 5;
                        tc = 5;
                        break;
index 1b89472a090861f2aa57493f180c3e1d55bc63c4..28e60697d14ee428209897d2d81a9cdaf47d2276 100644 (file)
@@ -66,6 +66,8 @@ enum {
        MLXSW_TRAP_ID_IPIP_DECAP_ERROR = 0xB1,
        MLXSW_TRAP_ID_NVE_DECAP_ARP = 0xB8,
        MLXSW_TRAP_ID_NVE_ENCAP_ARP = 0xBD,
+       MLXSW_TRAP_ID_IPV4_BFD = 0xD0,
+       MLXSW_TRAP_ID_IPV6_BFD = 0xD1,
        MLXSW_TRAP_ID_ROUTER_ALERT_IPV4 = 0xD6,
        MLXSW_TRAP_ID_ROUTER_ALERT_IPV6 = 0xD7,
        MLXSW_TRAP_ID_DISCARD_NON_ROUTABLE = 0x11A,