Commit 173f14cd authored by Jiri Pirko's avatar Jiri Pirko Committed by Jakub Kicinski

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: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a005a7fe
...@@ -4350,6 +4350,7 @@ mlxsw_sp_fib_entry_hw_flags_refresh(struct mlxsw_sp *mlxsw_sp, ...@@ -4350,6 +4350,7 @@ mlxsw_sp_fib_entry_hw_flags_refresh(struct mlxsw_sp *mlxsw_sp,
{ {
switch (op) { switch (op) {
case MLXSW_SP_FIB_ENTRY_OP_WRITE: case MLXSW_SP_FIB_ENTRY_OP_WRITE:
case MLXSW_SP_FIB_ENTRY_OP_UPDATE:
mlxsw_sp_fib_entry_hw_flags_set(mlxsw_sp, fib_entry); mlxsw_sp_fib_entry_hw_flags_set(mlxsw_sp, fib_entry);
break; break;
case MLXSW_SP_FIB_ENTRY_OP_DELETE: 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 ...@@ -4381,6 +4382,7 @@ mlxsw_sp_router_ll_basic_fib_entry_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx
switch (op) { switch (op) {
case MLXSW_SP_FIB_ENTRY_OP_WRITE: case MLXSW_SP_FIB_ENTRY_OP_WRITE:
case MLXSW_SP_FIB_ENTRY_OP_UPDATE:
ralue_op = MLXSW_REG_RALUE_OP_WRITE_WRITE; ralue_op = MLXSW_REG_RALUE_OP_WRITE_WRITE;
break; break;
case MLXSW_SP_FIB_ENTRY_OP_DELETE: case MLXSW_SP_FIB_ENTRY_OP_DELETE:
...@@ -4699,10 +4701,12 @@ static int mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp, ...@@ -4699,10 +4701,12 @@ static int mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp,
static int __mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, static int __mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_fib_entry_op_ctx *op_ctx, struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
struct mlxsw_sp_fib_entry *fib_entry) struct mlxsw_sp_fib_entry *fib_entry,
bool is_new)
{ {
return mlxsw_sp_fib_entry_op(mlxsw_sp, op_ctx, fib_entry, return mlxsw_sp_fib_entry_op(mlxsw_sp, op_ctx, fib_entry,
MLXSW_SP_FIB_ENTRY_OP_WRITE); is_new ? MLXSW_SP_FIB_ENTRY_OP_WRITE :
MLXSW_SP_FIB_ENTRY_OP_UPDATE);
} }
static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, 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, ...@@ -4711,7 +4715,7 @@ static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_fib_entry_op_ctx *op_ctx = mlxsw_sp->router->ll_op_ctx; struct mlxsw_sp_fib_entry_op_ctx *op_ctx = mlxsw_sp->router->ll_op_ctx;
mlxsw_sp_fib_entry_op_ctx_clear(op_ctx); mlxsw_sp_fib_entry_op_ctx_clear(op_ctx);
return __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry); return __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry, false);
} }
static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp, 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, ...@@ -5091,11 +5095,12 @@ static int mlxsw_sp_fib_node_entry_link(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_fib_entry *fib_entry) struct mlxsw_sp_fib_entry *fib_entry)
{ {
struct mlxsw_sp_fib_node *fib_node = fib_entry->fib_node; struct mlxsw_sp_fib_node *fib_node = fib_entry->fib_node;
bool is_new = !fib_node->fib_entry;
int err; int err;
fib_node->fib_entry = fib_entry; fib_node->fib_entry = fib_entry;
err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry); err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry, is_new);
if (err) if (err)
goto err_fib_entry_update; goto err_fib_entry_update;
...@@ -5509,7 +5514,8 @@ static int mlxsw_sp_nexthop6_group_update(struct mlxsw_sp *mlxsw_sp, ...@@ -5509,7 +5514,8 @@ static int mlxsw_sp_nexthop6_group_update(struct mlxsw_sp *mlxsw_sp,
* currently associated with it in the device's table is that * currently associated with it in the device's table is that
* of the old group. Start using the new one instead. * of the old group. Start using the new one instead.
*/ */
err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, &fib6_entry->common); err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx,
&fib6_entry->common, false);
if (err) if (err)
goto err_fib_entry_update; goto err_fib_entry_update;
......
...@@ -84,6 +84,7 @@ struct mlxsw_sp_fib_entry_priv { ...@@ -84,6 +84,7 @@ struct mlxsw_sp_fib_entry_priv {
enum mlxsw_sp_fib_entry_op { enum mlxsw_sp_fib_entry_op {
MLXSW_SP_FIB_ENTRY_OP_WRITE, MLXSW_SP_FIB_ENTRY_OP_WRITE,
MLXSW_SP_FIB_ENTRY_OP_UPDATE,
MLXSW_SP_FIB_ENTRY_OP_DELETE, MLXSW_SP_FIB_ENTRY_OP_DELETE,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment