Commit e90c1a10 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-Reject-unsupported-FIB-configurations'

Ido Schimmel says:

====================
mlxsw: Reject unsupported FIB configurations

Recently it became possible for listeners of the FIB notification chain
to veto operations such as addition of routes and rules.

Adjust the mlxsw driver to take advantage of it and return an error for
unsupported FIB rules and for routes configured after the abort
mechanism was triggered (due to exceeded resources for example).

v2:
* Change error code in first patch to -EOPNOTSUPP (David Ahern).
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 794451c1 50d10711
......@@ -5882,24 +5882,24 @@ static int mlxsw_sp_router_fib_rule_event(unsigned long event,
switch (info->family) {
case AF_INET:
if (!fib4_rule_default(rule) && !rule->l3mdev)
err = -1;
err = -EOPNOTSUPP;
break;
case AF_INET6:
if (!fib6_rule_default(rule) && !rule->l3mdev)
err = -1;
err = -EOPNOTSUPP;
break;
case RTNL_FAMILY_IPMR:
if (!ipmr_rule_default(rule) && !rule->l3mdev)
err = -1;
err = -EOPNOTSUPP;
break;
case RTNL_FAMILY_IP6MR:
if (!ip6mr_rule_default(rule) && !rule->l3mdev)
err = -1;
err = -EOPNOTSUPP;
break;
}
if (err < 0)
NL_SET_ERR_MSG_MOD(extack, "FIB rules not supported. Aborting offload");
NL_SET_ERR_MSG_MOD(extack, "FIB rules not supported");
return err;
}
......@@ -5926,8 +5926,15 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
case FIB_EVENT_RULE_DEL:
err = mlxsw_sp_router_fib_rule_event(event, info,
router->mlxsw_sp);
if (!err)
return NOTIFY_DONE;
if (!err || info->extack)
return notifier_from_errno(err);
break;
case FIB_EVENT_ENTRY_ADD:
if (router->aborted) {
NL_SET_ERR_MSG_MOD(info->extack, "FIB offload was aborted. Not configuring route");
return notifier_from_errno(-EINVAL);
}
break;
}
fib_work = kzalloc(sizeof(*fib_work), GFP_ATOMIC);
......
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