Skip to content

Commit ce12f7d

Browse files
committed
Merge branch 'mlxsw-extack'
David Ahern says: ==================== mlxsw: spectrum_router: Add extack messages for RIF and VRF overflow Currently, exceeding the number of VRF instances or the number of router interfaces either fails with a non-intuitive EBUSY: $ ip li set swp1s1.6 vrf vrf-1s1-6 up RTNETLINK answers: Device or resource busy or fails silently (IPv6) since the checks are done in a work queue. This set adds support for the address validator notifier to spectrum which allows ext-ack based messages to be returned on failure. To make that happen the IPv6 version needs to be converted from atomic to blocking (patch 2), and then support for extack needs to be added to the notifier (patch 3). Patch 1 reworks the locking in ipv6_add_addr to work better in the atomic and non-atomic code paths. Patches 4 and 5 add the validator notifier to spectrum and then plumb the extack argument through spectrum_router. With this set, VRF overflows fail with: $ ip li set swp1s1.6 vrf vrf-1s1-6 up Error: spectrum: Exceeded number of supported VRF. and RIF overflows fail with: $ ip addr add dev swp1s2.191 10.12.191.1/24 Error: spectrum: Exceeded number of supported router interfaces. v2 -> v3 - fix surround context of patch 4 which was altered by c30f5d0 v1 -> v2 - fix error path in ipv6_add_addr: reset rt to NULL (Ido comment) and add in6_dev_put on ifa once the hold has been done RFC -> v1 - addressed various comments from Ido - refactored ipv6_add_addr to allow ifa's to be allocated with GFP_KERNEL as requested by DaveM ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 6b1f8ed + f8fa9b4 commit ce12f7d

File tree

9 files changed

+234
-109
lines changed

9 files changed

+234
-109
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4521,9 +4521,16 @@ static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
45214521
return notifier_from_errno(err);
45224522
}
45234523

4524+
static struct notifier_block mlxsw_sp_inetaddr_valid_nb __read_mostly = {
4525+
.notifier_call = mlxsw_sp_inetaddr_valid_event,
4526+
};
4527+
45244528
static struct notifier_block mlxsw_sp_inetaddr_nb __read_mostly = {
45254529
.notifier_call = mlxsw_sp_inetaddr_event,
4526-
.priority = 10, /* Must be called before FIB notifier block */
4530+
};
4531+
4532+
static struct notifier_block mlxsw_sp_inet6addr_valid_nb __read_mostly = {
4533+
.notifier_call = mlxsw_sp_inet6addr_valid_event,
45274534
};
45284535

45294536
static struct notifier_block mlxsw_sp_inet6addr_nb __read_mostly = {
@@ -4548,7 +4555,9 @@ static int __init mlxsw_sp_module_init(void)
45484555
{
45494556
int err;
45504557

4558+
register_inetaddr_validator_notifier(&mlxsw_sp_inetaddr_valid_nb);
45514559
register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb);
4560+
register_inet6addr_validator_notifier(&mlxsw_sp_inet6addr_valid_nb);
45524561
register_inet6addr_notifier(&mlxsw_sp_inet6addr_nb);
45534562
register_netevent_notifier(&mlxsw_sp_router_netevent_nb);
45544563

@@ -4567,7 +4576,9 @@ static int __init mlxsw_sp_module_init(void)
45674576
err_core_driver_register:
45684577
unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb);
45694578
unregister_inet6addr_notifier(&mlxsw_sp_inet6addr_nb);
4579+
unregister_inet6addr_validator_notifier(&mlxsw_sp_inet6addr_valid_nb);
45704580
unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb);
4581+
unregister_inetaddr_validator_notifier(&mlxsw_sp_inetaddr_valid_nb);
45714582
return err;
45724583
}
45734584

@@ -4577,7 +4588,9 @@ static void __exit mlxsw_sp_module_exit(void)
45774588
mlxsw_core_driver_unregister(&mlxsw_sp_driver);
45784589
unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb);
45794590
unregister_inet6addr_notifier(&mlxsw_sp_inet6addr_nb);
4591+
unregister_inet6addr_validator_notifier(&mlxsw_sp_inet6addr_valid_nb);
45804592
unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb);
4593+
unregister_inetaddr_validator_notifier(&mlxsw_sp_inetaddr_valid_nb);
45814594
}
45824595

45834596
module_init(mlxsw_sp_module_init);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,12 @@ int mlxsw_sp_router_netevent_event(struct notifier_block *unused,
391391
int mlxsw_sp_netdevice_router_port_event(struct net_device *dev);
392392
int mlxsw_sp_inetaddr_event(struct notifier_block *unused,
393393
unsigned long event, void *ptr);
394+
int mlxsw_sp_inetaddr_valid_event(struct notifier_block *unused,
395+
unsigned long event, void *ptr);
394396
int mlxsw_sp_inet6addr_event(struct notifier_block *unused,
395397
unsigned long event, void *ptr);
398+
int mlxsw_sp_inet6addr_valid_event(struct notifier_block *unused,
399+
unsigned long event, void *ptr);
396400
int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
397401
struct netdev_notifier_changeupper_info *info);
398402
bool mlxsw_sp_netdev_is_ipip(const struct mlxsw_sp *mlxsw_sp,

0 commit comments

Comments
 (0)