public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@web.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: prepare and schedule initial OGM without rtnl_lock()
Date: Mon, 15 Jul 2013 03:46:14 +0200	[thread overview]
Message-ID: <1373852774-3802-1-git-send-email-linus.luessing@web.de> (raw)

There is no need to hold the rtnl-lock during the preparation of the
initial OGM of a hard interface.

Besides, it is a little uggly to have batadv_schedule_bat_ogm() executed
with an rtnl-lock on its first run but without an rtnl-lock in its
rearmed versions as it makes additions to batadv_schedule_bat_ogm() that
require an rtnl-lock difficult.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---

the compat code for the multicast-basic patchset needs an rtnl-lock
somewhere within batadv_schedule_bat_ogm()


 hard-interface.c |   21 ++++++++++++++++++++-
 types.h          |    2 ++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/hard-interface.c b/hard-interface.c
index c5f871f..c7ad8ae 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -470,7 +470,7 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 			   hard_iface->net_dev->name);
 
 	/* begin scheduling originator messages on that interface */
-	batadv_schedule_bat_ogm(hard_iface);
+	queue_work(batadv_event_workqueue, &hard_iface->init_ogm_work);
 
 out:
 	return 0;
@@ -554,6 +554,23 @@ static void batadv_hardif_remove_interface_finish(struct work_struct *work)
 	batadv_hardif_free_ref(hard_iface);
 }
 
+/**
+ * batadv_hardif_init_ogm - initialize the ogm scheduler
+ * @work: work queue item
+ *
+ * Prepare and queue the initial OGM on this hard interface to get its ogm
+ * scheduler into gear.
+ */
+static void batadv_hardif_init_ogm(struct work_struct *work)
+{
+	struct batadv_hard_iface *hard_iface;
+
+	hard_iface = container_of(work, struct batadv_hard_iface,
+				  init_ogm_work);
+
+	batadv_schedule_bat_ogm(hard_iface);
+}
+
 static struct batadv_hard_iface *
 batadv_hardif_add_interface(struct net_device *net_dev)
 {
@@ -583,6 +600,8 @@ batadv_hardif_add_interface(struct net_device *net_dev)
 	INIT_LIST_HEAD(&hard_iface->list);
 	INIT_WORK(&hard_iface->cleanup_work,
 		  batadv_hardif_remove_interface_finish);
+	INIT_WORK(&hard_iface->init_ogm_work,
+		  batadv_hardif_init_ogm);
 
 	hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT;
 	if (batadv_is_wifi_netdev(net_dev))
diff --git a/types.h b/types.h
index 0d5b24b..a8b5725 100644
--- a/types.h
+++ b/types.h
@@ -62,6 +62,7 @@ struct batadv_hard_iface_bat_iv {
  * @rcu: struct used for freeing in an RCU-safe manner
  * @bat_iv: BATMAN IV specific per hard interface data
  * @cleanup_work: work queue callback item for hard interface deinit
+ * @init_ogm_work: work queue callback item for ogm scheduler initialization
  */
 struct batadv_hard_iface {
 	struct list_head list;
@@ -76,6 +77,7 @@ struct batadv_hard_iface {
 	struct rcu_head rcu;
 	struct batadv_hard_iface_bat_iv bat_iv;
 	struct work_struct cleanup_work;
+	struct work_struct init_ogm_work;
 };
 
 /**
-- 
1.7.10.4


             reply	other threads:[~2013-07-15  1:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15  1:46 Linus Lüssing [this message]
2013-07-17 20:53 ` [B.A.T.M.A.N.] [PATCH] batman-adv: prepare and schedule initial OGM without rtnl_lock() Linus Lüssing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373852774-3802-1-git-send-email-linus.luessing@web.de \
    --to=linus.luessing@web.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox