Skip to content

Commit eb9da2c

Browse files
committed
Merge branch 'mlxsw-resilient-nh-groups'
Ido Schimmel says: ==================== mlxsw: Add support for resilient nexthop groups This patchset adds support for resilient nexthop groups in mlxsw. As far as the hardware is concerned, resilient groups are the same as regular groups. The differences lie in how mlxsw manages the individual adjacency entries (nexthop buckets) that make up the group. The first difference is that unlike regular groups the driver needs to periodically update the kernel about activity of nexthop buckets so that the kernel will not treat the buckets as idle, given traffic is offloaded from the CPU to the ASIC. This is similar to what mlxsw is already doing with respect to neighbour entries. The update interval is set to 1 second to allow for short idle timers. The second difference is that nexthop buckets that correspond to an unresolved neighbour must be programmed to the device, as the size of the group must remain fixed. This is achieved by programming such entries with trap action, in order to trigger neighbour resolution by the kernel. The third difference is atomic replacement of individual nexthop buckets. While the driver periodically updates the kernel about activity of nexthop buckets, it is possible for a bucket to become active just before the kernel decides to replace it with a different nexthop. To avoid such situations and connections being reset, the driver instructs the device to only replace an adjacency entry if it is inactive. Failures are propagated back to the nexthop code. Patchset overview: Patches raspberrypi#1-raspberrypi#7 gradually add support for resilient nexthop groups Patch raspberrypi#8 finally enables such groups to be programmed to the device Patches raspberrypi#9-raspberrypi#10 add mlxsw-specific selftests ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 3c85a8b + ffd3e9b commit eb9da2c

9 files changed

Lines changed: 594 additions & 23 deletions

File tree

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

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8130,6 +8130,60 @@ mlxsw_reg_rtdp_ipip4_pack(char *payload, u16 irif,
81308130
mlxsw_reg_rtdp_ipip_expected_gre_key_set(payload, expected_gre_key);
81318131
}
81328132

8133+
/* RATRAD - Router Adjacency Table Activity Dump Register
8134+
* ------------------------------------------------------
8135+
* The RATRAD register is used to dump and optionally clear activity bits of
8136+
* router adjacency table entries.
8137+
*/
8138+
#define MLXSW_REG_RATRAD_ID 0x8022
8139+
#define MLXSW_REG_RATRAD_LEN 0x210
8140+
8141+
MLXSW_REG_DEFINE(ratrad, MLXSW_REG_RATRAD_ID, MLXSW_REG_RATRAD_LEN);
8142+
8143+
enum {
8144+
/* Read activity */
8145+
MLXSW_REG_RATRAD_OP_READ_ACTIVITY,
8146+
/* Read and clear activity */
8147+
MLXSW_REG_RATRAD_OP_READ_CLEAR_ACTIVITY,
8148+
};
8149+
8150+
/* reg_ratrad_op
8151+
* Access: Operation
8152+
*/
8153+
MLXSW_ITEM32(reg, ratrad, op, 0x00, 30, 2);
8154+
8155+
/* reg_ratrad_ecmp_size
8156+
* ecmp_size is the amount of sequential entries from adjacency_index. Valid
8157+
* ranges:
8158+
* Spectrum-1: 32-64, 512, 1024, 2048, 4096
8159+
* Spectrum-2/3: 32-128, 256, 512, 1024, 2048, 4096
8160+
* Access: Index
8161+
*/
8162+
MLXSW_ITEM32(reg, ratrad, ecmp_size, 0x00, 0, 13);
8163+
8164+
/* reg_ratrad_adjacency_index
8165+
* Index into the adjacency table.
8166+
* Access: Index
8167+
*/
8168+
MLXSW_ITEM32(reg, ratrad, adjacency_index, 0x04, 0, 24);
8169+
8170+
/* reg_ratrad_activity_vector
8171+
* Activity bit per adjacency index.
8172+
* Bits higher than ecmp_size are reserved.
8173+
* Access: RO
8174+
*/
8175+
MLXSW_ITEM_BIT_ARRAY(reg, ratrad, activity_vector, 0x10, 0x200, 1);
8176+
8177+
static inline void mlxsw_reg_ratrad_pack(char *payload, u32 adjacency_index,
8178+
u16 ecmp_size)
8179+
{
8180+
MLXSW_REG_ZERO(ratrad, payload);
8181+
mlxsw_reg_ratrad_op_set(payload,
8182+
MLXSW_REG_RATRAD_OP_READ_CLEAR_ACTIVITY);
8183+
mlxsw_reg_ratrad_ecmp_size_set(payload, ecmp_size);
8184+
mlxsw_reg_ratrad_adjacency_index_set(payload, adjacency_index);
8185+
}
8186+
81338187
/* RIGR-V2 - Router Interface Group Register Version 2
81348188
* ---------------------------------------------------
81358189
* The RIGR_V2 register is used to add, remove and query egress interface list
@@ -12114,6 +12168,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
1211412168
MLXSW_REG(rtar),
1211512169
MLXSW_REG(ratr),
1211612170
MLXSW_REG(rtdp),
12171+
MLXSW_REG(ratrad),
1211712172
MLXSW_REG(rdpm),
1211812173
MLXSW_REG(ricnt),
1211912174
MLXSW_REG(rrcr),

‎drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ mlxsw_sp_dpipe_table_adj_entries_dump(void *priv, bool counters_enabled,
11781178

11791179
static int mlxsw_sp_dpipe_table_adj_counters_update(void *priv, bool enable)
11801180
{
1181+
char ratr_pl[MLXSW_REG_RATR_LEN];
11811182
struct mlxsw_sp *mlxsw_sp = priv;
11821183
struct mlxsw_sp_nexthop *nh;
11831184
u32 adj_hash_index = 0;
@@ -1196,7 +1197,8 @@ static int mlxsw_sp_dpipe_table_adj_counters_update(void *priv, bool enable)
11961197
else
11971198
mlxsw_sp_nexthop_counter_free(mlxsw_sp, nh);
11981199
mlxsw_sp_nexthop_eth_update(mlxsw_sp,
1199-
adj_index + adj_hash_index, nh);
1200+
adj_index + adj_hash_index, nh,
1201+
true, ratr_pl);
12001202
}
12011203
return 0;
12021204
}

‎drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,16 @@ bool mlxsw_sp_l3addr_is_zero(union mlxsw_sp_l3addr addr)
127127

128128
static int
129129
mlxsw_sp_ipip_nexthop_update_gre4(struct mlxsw_sp *mlxsw_sp, u32 adj_index,
130-
struct mlxsw_sp_ipip_entry *ipip_entry)
130+
struct mlxsw_sp_ipip_entry *ipip_entry,
131+
bool force, char *ratr_pl)
131132
{
132133
u16 rif_index = mlxsw_sp_ipip_lb_rif_index(ipip_entry->ol_lb);
133134
__be32 daddr4 = mlxsw_sp_ipip_netdev_daddr4(ipip_entry->ol_dev);
134-
char ratr_pl[MLXSW_REG_RATR_LEN];
135+
enum mlxsw_reg_ratr_op op;
135136

136-
mlxsw_reg_ratr_pack(ratr_pl, MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY,
137-
true, MLXSW_REG_RATR_TYPE_IPIP,
137+
op = force ? MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY :
138+
MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY_ON_ACTIVITY;
139+
mlxsw_reg_ratr_pack(ratr_pl, op, true, MLXSW_REG_RATR_TYPE_IPIP,
138140
adj_index, rif_index);
139141
mlxsw_reg_ratr_ipip4_entry_pack(ratr_pl, be32_to_cpu(daddr4));
140142

‎drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ struct mlxsw_sp_ipip_ops {
4040
enum mlxsw_sp_l3proto ul_proto; /* Underlay. */
4141

4242
int (*nexthop_update)(struct mlxsw_sp *mlxsw_sp, u32 adj_index,
43-
struct mlxsw_sp_ipip_entry *ipip_entry);
43+
struct mlxsw_sp_ipip_entry *ipip_entry,
44+
bool force, char *ratr_pl);
4445

4546
bool (*can_offload)(const struct mlxsw_sp *mlxsw_sp,
4647
const struct net_device *ol_dev);

0 commit comments

Comments
 (0)