* [PATCH net-next 0/4] vrf: cleanups part 2
@ 2015-08-19 3:27 Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 1/4] vrf: don't panic on cache create failure Nikolay Aleksandrov
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2015-08-19 3:27 UTC (permalink / raw)
To: netdev; +Cc: dsa, shm, davem, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Hi,
This is the next part of vrf cleanups, patch 1 drops the SLAB_PANIC when
creating kmem cache since it's handled, patch 02 removes a slave duplicate
check which is already done by the lower/upper code, patch 3 moves the
ndo_add_slave code around a bit so we can drop an error label and patch 4
drops the master device checks which are unnecessary because the ops are
taken from the master device itself so it can't be different.
Cheers,
Nik
Nikolay Aleksandrov (4):
vrf: don't panic on cache create failure
vrf: remove unnecessary duplicate check
vrf: move vrf_insert_slave so we can drop a goto label
vrf: ndo_add|del_slave drop unnecessary checks
drivers/net/vrf.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
--
2.4.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/4] vrf: don't panic on cache create failure
2015-08-19 3:27 [PATCH net-next 0/4] vrf: cleanups part 2 Nikolay Aleksandrov
@ 2015-08-19 3:27 ` Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 2/4] vrf: remove unnecessary duplicate check Nikolay Aleksandrov
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2015-08-19 3:27 UTC (permalink / raw)
To: netdev; +Cc: dsa, shm, davem, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
It's pointless to panic on cache create failure when that case is handled
and even more so since it's not a kernel-wide fatal problem so don't
panic.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
drivers/net/vrf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 4aa06450fafa..01dc91562a88 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -649,7 +649,7 @@ static int __init vrf_init_module(void)
vrf_dst_ops.kmem_cachep =
kmem_cache_create("vrf_ip_dst_cache",
sizeof(struct rtable), 0,
- SLAB_HWCACHE_ALIGN | SLAB_PANIC,
+ SLAB_HWCACHE_ALIGN,
NULL);
if (!vrf_dst_ops.kmem_cachep)
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/4] vrf: remove unnecessary duplicate check
2015-08-19 3:27 [PATCH net-next 0/4] vrf: cleanups part 2 Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 1/4] vrf: don't panic on cache create failure Nikolay Aleksandrov
@ 2015-08-19 3:27 ` Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 3/4] vrf: move vrf_insert_slave so we can drop a goto label Nikolay Aleksandrov
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2015-08-19 3:27 UTC (permalink / raw)
To: netdev; +Cc: dsa, shm, davem, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
The upper/lower functions already check for duplicate slaves so no need
to do it again.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
drivers/net/vrf.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 01dc91562a88..9907550ff640 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -352,7 +352,6 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
{
struct net_vrf_dev *vrf_ptr = kmalloc(sizeof(*vrf_ptr), GFP_KERNEL);
struct slave *slave = kzalloc(sizeof(*slave), GFP_KERNEL);
- struct slave *duplicate_slave;
struct net_vrf *vrf = netdev_priv(dev);
struct slave_queue *queue = &vrf->queue;
int ret = -ENOMEM;
@@ -361,16 +360,9 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
goto out_fail;
slave->dev = port_dev;
-
vrf_ptr->ifindex = dev->ifindex;
vrf_ptr->tb_id = vrf->tb_id;
- duplicate_slave = __vrf_find_slave_dev(queue, port_dev);
- if (duplicate_slave) {
- ret = -EBUSY;
- goto out_fail;
- }
-
__vrf_insert_slave(queue, slave);
/* register the packet handler for slave ports */
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 3/4] vrf: move vrf_insert_slave so we can drop a goto label
2015-08-19 3:27 [PATCH net-next 0/4] vrf: cleanups part 2 Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 1/4] vrf: don't panic on cache create failure Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 2/4] vrf: remove unnecessary duplicate check Nikolay Aleksandrov
@ 2015-08-19 3:27 ` Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 4/4] vrf: ndo_add|del_slave drop unnecessary checks Nikolay Aleksandrov
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2015-08-19 3:27 UTC (permalink / raw)
To: netdev; +Cc: dsa, shm, davem, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
We can simplify do_vrf_add_slave by moving vrf_insert_slave in the end
of the enslaving and thus eliminate an error goto label. It always
succeeds and isn't needed before that anyway.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
drivers/net/vrf.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 9907550ff640..4825c65c62fd 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -363,15 +363,13 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
vrf_ptr->ifindex = dev->ifindex;
vrf_ptr->tb_id = vrf->tb_id;
- __vrf_insert_slave(queue, slave);
-
/* register the packet handler for slave ports */
ret = netdev_rx_handler_register(port_dev, vrf_handle_frame, dev);
if (ret) {
netdev_err(port_dev,
"Device %s failed to register rx_handler\n",
port_dev->name);
- goto out_remove;
+ goto out_fail;
}
ret = netdev_master_upper_dev_link(port_dev, dev);
@@ -379,7 +377,7 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
goto out_unregister;
port_dev->flags |= IFF_SLAVE;
-
+ __vrf_insert_slave(queue, slave);
rcu_assign_pointer(port_dev->vrf_ptr, vrf_ptr);
cycle_netdev(port_dev);
@@ -387,8 +385,6 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
out_unregister:
netdev_rx_handler_unregister(port_dev);
-out_remove:
- __vrf_remove_slave(queue, slave);
out_fail:
kfree(vrf_ptr);
kfree(slave);
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 4/4] vrf: ndo_add|del_slave drop unnecessary checks
2015-08-19 3:27 [PATCH net-next 0/4] vrf: cleanups part 2 Nikolay Aleksandrov
` (2 preceding siblings ...)
2015-08-19 3:27 ` [PATCH net-next 3/4] vrf: move vrf_insert_slave so we can drop a goto label Nikolay Aleksandrov
@ 2015-08-19 3:27 ` Nikolay Aleksandrov
2015-08-19 17:47 ` [PATCH net-next 0/4] vrf: cleanups part 2 David Ahern
2015-08-20 20:02 ` David Miller
5 siblings, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2015-08-19 3:27 UTC (permalink / raw)
To: netdev; +Cc: dsa, shm, davem, Nikolay Aleksandrov
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
When ndo_add|del_slave ops are used, they're taken from the respective
master device's netdev ops, so if the master device is a VRF only then
the VRF ops will get called thus no need to check the type of the
master.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
drivers/net/vrf.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 4825c65c62fd..dbeffe789185 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -393,8 +393,7 @@ out_fail:
static int vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
{
- if (!netif_is_vrf(dev) || netif_is_vrf(port_dev) ||
- vrf_is_slave(port_dev))
+ if (netif_is_vrf(port_dev) || vrf_is_slave(port_dev))
return -EINVAL;
return do_vrf_add_slave(dev, port_dev);
@@ -431,9 +430,6 @@ static int do_vrf_del_slave(struct net_device *dev, struct net_device *port_dev)
static int vrf_del_slave(struct net_device *dev, struct net_device *port_dev)
{
- if (!netif_is_vrf(dev))
- return -EINVAL;
-
return do_vrf_del_slave(dev, port_dev);
}
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/4] vrf: cleanups part 2
2015-08-19 3:27 [PATCH net-next 0/4] vrf: cleanups part 2 Nikolay Aleksandrov
` (3 preceding siblings ...)
2015-08-19 3:27 ` [PATCH net-next 4/4] vrf: ndo_add|del_slave drop unnecessary checks Nikolay Aleksandrov
@ 2015-08-19 17:47 ` David Ahern
2015-08-20 20:02 ` David Miller
5 siblings, 0 replies; 7+ messages in thread
From: David Ahern @ 2015-08-19 17:47 UTC (permalink / raw)
To: Nikolay Aleksandrov, netdev; +Cc: shm, davem, Nikolay Aleksandrov
On 8/18/15 8:27 PM, Nikolay Aleksandrov wrote:
> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>
> Hi,
> This is the next part of vrf cleanups, patch 1 drops the SLAB_PANIC when
> creating kmem cache since it's handled, patch 02 removes a slave duplicate
> check which is already done by the lower/upper code, patch 3 moves the
> ndo_add_slave code around a bit so we can drop an error label and patch 4
> drops the master device checks which are unnecessary because the ops are
> taken from the master device itself so it can't be different.
>
> Cheers,
> Nik
>
> Nikolay Aleksandrov (4):
> vrf: don't panic on cache create failure
> vrf: remove unnecessary duplicate check
> vrf: move vrf_insert_slave so we can drop a goto label
> vrf: ndo_add|del_slave drop unnecessary checks
>
> drivers/net/vrf.c | 24 ++++--------------------
> 1 file changed, 4 insertions(+), 20 deletions(-)
>
Looks good to me. Thanks, Nikolay.
Acked-by: David Ahern <dsa@cumulusnetworks.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/4] vrf: cleanups part 2
2015-08-19 3:27 [PATCH net-next 0/4] vrf: cleanups part 2 Nikolay Aleksandrov
` (4 preceding siblings ...)
2015-08-19 17:47 ` [PATCH net-next 0/4] vrf: cleanups part 2 David Ahern
@ 2015-08-20 20:02 ` David Miller
5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-08-20 20:02 UTC (permalink / raw)
To: razor; +Cc: netdev, dsa, shm, nikolay
From: Nikolay Aleksandrov <razor@blackwall.org>
Date: Wed, 19 Aug 2015 06:27:06 +0300
> This is the next part of vrf cleanups, patch 1 drops the SLAB_PANIC when
> creating kmem cache since it's handled, patch 02 removes a slave duplicate
> check which is already done by the lower/upper code, patch 3 moves the
> ndo_add_slave code around a bit so we can drop an error label and patch 4
> drops the master device checks which are unnecessary because the ops are
> taken from the master device itself so it can't be different.
Series applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-08-20 20:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19 3:27 [PATCH net-next 0/4] vrf: cleanups part 2 Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 1/4] vrf: don't panic on cache create failure Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 2/4] vrf: remove unnecessary duplicate check Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 3/4] vrf: move vrf_insert_slave so we can drop a goto label Nikolay Aleksandrov
2015-08-19 3:27 ` [PATCH net-next 4/4] vrf: ndo_add|del_slave drop unnecessary checks Nikolay Aleksandrov
2015-08-19 17:47 ` [PATCH net-next 0/4] vrf: cleanups part 2 David Ahern
2015-08-20 20:02 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).