Skip to content

Commit 173f14c

Browse files
Jiri Pirkokuba-moo
Jiri Pirko
authored andcommitted
mlxsw: spectrum_router: Introduce FIB entry update op
Follow-up patchset introducing XMDR implementation is going to need to distinguish write and update ops. Therefore introduce "update op" and call "write op" only when new FIB entry is inserted. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a005a7f commit 173f14c

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4350,6 +4350,7 @@ mlxsw_sp_fib_entry_hw_flags_refresh(struct mlxsw_sp *mlxsw_sp,
43504350
{
43514351
switch (op) {
43524352
case MLXSW_SP_FIB_ENTRY_OP_WRITE:
4353+
case MLXSW_SP_FIB_ENTRY_OP_UPDATE:
43534354
mlxsw_sp_fib_entry_hw_flags_set(mlxsw_sp, fib_entry);
43544355
break;
43554356
case MLXSW_SP_FIB_ENTRY_OP_DELETE:
@@ -4381,6 +4382,7 @@ mlxsw_sp_router_ll_basic_fib_entry_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx
43814382

43824383
switch (op) {
43834384
case MLXSW_SP_FIB_ENTRY_OP_WRITE:
4385+
case MLXSW_SP_FIB_ENTRY_OP_UPDATE:
43844386
ralue_op = MLXSW_REG_RALUE_OP_WRITE_WRITE;
43854387
break;
43864388
case MLXSW_SP_FIB_ENTRY_OP_DELETE:
@@ -4699,10 +4701,12 @@ static int mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp,
46994701

47004702
static int __mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp,
47014703
struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
4702-
struct mlxsw_sp_fib_entry *fib_entry)
4704+
struct mlxsw_sp_fib_entry *fib_entry,
4705+
bool is_new)
47034706
{
47044707
return mlxsw_sp_fib_entry_op(mlxsw_sp, op_ctx, fib_entry,
4705-
MLXSW_SP_FIB_ENTRY_OP_WRITE);
4708+
is_new ? MLXSW_SP_FIB_ENTRY_OP_WRITE :
4709+
MLXSW_SP_FIB_ENTRY_OP_UPDATE);
47064710
}
47074711

47084712
static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp,
@@ -4711,7 +4715,7 @@ static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp,
47114715
struct mlxsw_sp_fib_entry_op_ctx *op_ctx = mlxsw_sp->router->ll_op_ctx;
47124716

47134717
mlxsw_sp_fib_entry_op_ctx_clear(op_ctx);
4714-
return __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry);
4718+
return __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry, false);
47154719
}
47164720

47174721
static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp,
@@ -5091,11 +5095,12 @@ static int mlxsw_sp_fib_node_entry_link(struct mlxsw_sp *mlxsw_sp,
50915095
struct mlxsw_sp_fib_entry *fib_entry)
50925096
{
50935097
struct mlxsw_sp_fib_node *fib_node = fib_entry->fib_node;
5098+
bool is_new = !fib_node->fib_entry;
50945099
int err;
50955100

50965101
fib_node->fib_entry = fib_entry;
50975102

5098-
err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry);
5103+
err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry, is_new);
50995104
if (err)
51005105
goto err_fib_entry_update;
51015106

@@ -5509,7 +5514,8 @@ static int mlxsw_sp_nexthop6_group_update(struct mlxsw_sp *mlxsw_sp,
55095514
* currently associated with it in the device's table is that
55105515
* of the old group. Start using the new one instead.
55115516
*/
5512-
err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, &fib6_entry->common);
5517+
err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx,
5518+
&fib6_entry->common, false);
55135519
if (err)
55145520
goto err_fib_entry_update;
55155521

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct mlxsw_sp_fib_entry_priv {
8484

8585
enum mlxsw_sp_fib_entry_op {
8686
MLXSW_SP_FIB_ENTRY_OP_WRITE,
87+
MLXSW_SP_FIB_ENTRY_OP_UPDATE,
8788
MLXSW_SP_FIB_ENTRY_OP_DELETE,
8889
};
8990

0 commit comments

Comments
 (0)