aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ipvlan/ipvlan_main.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-10-20 08:15:08 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-20 08:15:08 -0400
commitce12f7ddff2df63b8f9abf33d6fe020e35de4059 (patch)
tree7c80b14c401727fd76a0cd1b4739c1ddb6d30756 /drivers/net/ipvlan/ipvlan_main.c
parent6b1f8edabad562dc0b2a6d59fa49061eddd91290 (diff)
parentf8fa9b4e6da77311791c7150a6ecc9368396df3b (diff)
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 c30f5d012edf 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>
Diffstat (limited to 'drivers/net/ipvlan/ipvlan_main.c')
-rw-r--r--drivers/net/ipvlan/ipvlan_main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 3cf67db513e2..f0ab55df57f1 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -808,10 +808,6 @@ static int ipvlan_addr6_event(struct notifier_block *unused,
808 struct net_device *dev = (struct net_device *)if6->idev->dev; 808 struct net_device *dev = (struct net_device *)if6->idev->dev;
809 struct ipvl_dev *ipvlan = netdev_priv(dev); 809 struct ipvl_dev *ipvlan = netdev_priv(dev);
810 810
811 /* FIXME IPv6 autoconf calls us from bh without RTNL */
812 if (in_softirq())
813 return NOTIFY_DONE;
814
815 if (!netif_is_ipvlan(dev)) 811 if (!netif_is_ipvlan(dev))
816 return NOTIFY_DONE; 812 return NOTIFY_DONE;
817 813
@@ -851,8 +847,11 @@ static int ipvlan_addr6_validator_event(struct notifier_block *unused,
851 847
852 switch (event) { 848 switch (event) {
853 case NETDEV_UP: 849 case NETDEV_UP:
854 if (ipvlan_addr_busy(ipvlan->port, &i6vi->i6vi_addr, true)) 850 if (ipvlan_addr_busy(ipvlan->port, &i6vi->i6vi_addr, true)) {
851 NL_SET_ERR_MSG(i6vi->extack,
852 "Address already assigned to an ipvlan device");
855 return notifier_from_errno(-EADDRINUSE); 853 return notifier_from_errno(-EADDRINUSE);
854 }
856 break; 855 break;
857 } 856 }
858 857
@@ -921,8 +920,11 @@ static int ipvlan_addr4_validator_event(struct notifier_block *unused,
921 920
922 switch (event) { 921 switch (event) {
923 case NETDEV_UP: 922 case NETDEV_UP:
924 if (ipvlan_addr_busy(ipvlan->port, &ivi->ivi_addr, false)) 923 if (ipvlan_addr_busy(ipvlan->port, &ivi->ivi_addr, false)) {
924 NL_SET_ERR_MSG(ivi->extack,
925 "Address already assigned to an ipvlan device");
925 return notifier_from_errno(-EADDRINUSE); 926 return notifier_from_errno(-EADDRINUSE);
927 }
926 break; 928 break;
927 } 929 }
928 930