[Devel] [PATCH RHEL7 COMMIT] venet: veip_shutdown() helper introduced

Konstantin Khorenko khorenko at virtuozzo.com
Sat Apr 22 04:47:05 PDT 2017


The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.30.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.16.1.vz7.30.4
------>
commit c888a20fa28deb73c6b24d05e37077fcdeb8e79b
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Sat Apr 22 15:47:05 2017 +0400

    venet: veip_shutdown() helper introduced
    
    It takes spinlock only once for both __veip_stop and __venet_ext_clean
    (which is converted to unprotected, because now called only from this helper).
    New helper is now used in venet_dellink.
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 drivers/net/venetdev.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c
index 5a09575..b7d7596 100644
--- a/drivers/net/venetdev.c
+++ b/drivers/net/venetdev.c
@@ -190,17 +190,12 @@ out:
 	return err;
 }
 
-static void venet_ext_clean(struct ve_struct *ve)
+static void __venet_ext_clean(struct ve_struct *ve)
 {
 	struct ext_entry_struct *entry, *tmp;
 
-	if (ve->veip == NULL)
-		return;
-
-	spin_lock(&veip_lock);
 	list_for_each_entry_safe (entry, tmp, &ve->veip->ext_lh, list)
 		venet_ext_release(entry);
-	spin_unlock(&veip_lock);
 }
 
 static struct veip_struct *veip_find(envid_t veid)
@@ -750,12 +745,23 @@ static void venet_setup(struct net_device *dev)
 	SET_ETHTOOL_OPS(dev, &venet_ethtool_ops);
 }
 
+static void veip_shutdown(void *data)
+{
+	struct ve_struct *ve = data;
+
+	spin_lock(&veip_lock);
+	if (ve->veip) {
+		__venet_ext_clean(ve);
+		__veip_stop(ve);
+	}
+	spin_unlock(&veip_lock);
+}
+
 static void venet_dellink(struct net_device *dev, struct list_head *head)
 {
 	struct ve_struct *env = dev->nd_net->owner_ve;
 
-	venet_ext_clean(env);
-	veip_stop(env);
+	veip_shutdown(env);
 
 	env->_venet_dev = NULL;
 	unregister_netdevice_queue(dev, head);


More information about the Devel mailing list