b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [RFC] batman-adv: switch routing algorithm at runtime
Date: Mon, 28 Nov 2011 19:47:22 +0100	[thread overview]
Message-ID: <20111128184722.GC13600@lunn.ch> (raw)
In-Reply-To: <201111290028.01655.lindner_marek@yahoo.de>

Hi Marek

>  * How do we design the algorithm registration. At the moment batman_init() 
> calls bat_iv_init() and possibly other algorithms in the future but this is 
> less than ideal. I had hoped to find a mechanism which allows an init function 
> to be declared and called inside of the respective routing algorithm files. 
> These files can be compiled into the module or not.

I would suggest looking at some other modular system. Generally the
core offers a _register() and a _unregister() function. The module
implementing an algorithm would call the _register function in its
module_init function and the _unregister in module_exit function. It
also makes sense to have a naming scheme for these modules. It then
becomes possible to use hotplug to load algorithms dynamically, when
userspace requests an algorithm which is not already loaded. I guess
you first need an algorithm when the soft interface is taken up. If
you don't have an algorithm loaded at that point, it makes sense to
have a hard coded (or maybe menuconfig) default algorithm, which you
try to load via hotplug.

> * The API and its implementation. It is highly likely that this API won't 
> survive for very long as it has been designed to satisfy one routing algorithm 
> only. However, changing it in the future should be easy.

It would be good to comment in the header file which functions can be
NULL and which must be implemented. It would be best to assume that
new methods added from now on will be NULL in older algorithms. There
are a few options for handling this. Check the method is not NULL
before calling it. Or the _register function can replace each NULL
with a nop function and throw an BUG_ON() when a must have function is
NULL.

	Andrew

  parent reply	other threads:[~2011-11-28 18:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28 16:27 [B.A.T.M.A.N.] [RFC] batman-adv: switch routing algorithm at runtime Marek Lindner
2011-11-28 16:28 ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: add infrastructure to change " Marek Lindner
2011-11-28 16:28   ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: convert batman iv algorithm to use dynamic infrastructure Marek Lindner
2011-11-28 19:02     ` Andrew Lunn
2011-11-28 19:45       ` Marek Lindner
2011-11-29  6:09         ` Andrew Lunn
2011-11-29  6:35           ` Marek Lindner
2011-11-29  8:45             ` Andrew Lunn
2011-11-29 15:23     ` Simon Wunderlich
2011-12-04 20:00       ` Marek Lindner
2011-12-06 19:20         ` Simon Wunderlich
2011-11-28 16:28   ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: allowing changing the routing algorithm via sysfs Marek Lindner
2011-11-28 19:00   ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: add infrastructure to change routing algorithm at runtime Andrew Lunn
2011-11-28 18:47 ` Andrew Lunn [this message]
2011-11-28 19:42   ` [B.A.T.M.A.N.] [RFC] batman-adv: switch " Marek Lindner
2011-11-29  6:18     ` Andrew Lunn
2011-11-29  6:34       ` Marek Lindner
2011-11-29  8:02         ` Andrew Lunn

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=20111128184722.GC13600@lunn.ch \
    --to=andrew@lunn.ch \
    --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;
as well as URLs for NNTP newsgroup(s).