b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
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.] [PATCH 2/3] batman-adv: convert batman iv algorithm to use dynamic infrastructure
Date: Tue, 29 Nov 2011 16:23:18 +0100	[thread overview]
Message-ID: <20111129152318.GA8417@pandem0nium> (raw)
In-Reply-To: <1322497717-21268-2-git-send-email-lindner_marek@yahoo.de>

[-- Attachment #1: Type: text/plain, Size: 1764 bytes --]

Hi Marek,

interesting approach, thanks for the patches! I don't really think that
we need modules at this point, but we can easily extend it later - for
example, net/mac80211/rate.c has a very similar API and works with modules.

A few comments to the API:

Generally, we should have a few lines per function in types.h to
describe what each function is doing - we don't need that for a RFC patch,
but that would be useful for the final version.

On Tue, Nov 29, 2011 at 12:28:36AM +0800, Marek Lindner wrote:
>  struct bat_algo {
>  	struct hlist_node list;
>  	char name[20];

you can also use a simple pointer here: 
  char *name;

(the name will most probably static in the module anyways)

> +	void (*bat_ogm_init)(struct hard_iface *hard_iface);
> +	void (*bat_ogm_init_primary)(struct hard_iface *hard_iface);
> +	void (*bat_ogm_update_mac)(struct hard_iface *hard_iface);
> +	void (*bat_ogm_schedule)(struct hard_iface *hard_iface,
> +				 int tt_num_changes);

can't we put tt_num_changes somewhere bat_priv?

> +	void (*bat_ogm_emit)(struct forw_packet *forw_packet);
> +	void (*bat_ogm_receive)(const struct ethhdr *ethhdr,
> +				unsigned char *packet_buff, int packet_len,
> +				struct hard_iface *if_incoming);

you can just pass the SKB instead of ethhdr, packet_buff, and packet_len
-> they are derived from the skb anyway.

Then, you have can do the API with always a hard_iface as the first
parameter. ;)

I also agree with Andrew on defining (a subset of) mandatory functions
which every algo has to provide. The register function could then check
and decline algos which don't define mandatory functions, and we don't have
to check availability in the real code later ...

best regards,
	Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2011-11-29 15:23 UTC|newest]

Thread overview: 19+ 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 [this message]
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 ` [B.A.T.M.A.N.] [RFC] batman-adv: switch " Andrew Lunn
2011-11-28 19:42   ` Marek Lindner
2011-11-29  6:18     ` Andrew Lunn
2011-11-29  6:34       ` Marek Lindner
2011-11-29  8:02         ` Andrew Lunn
2011-12-05  9:56 [B.A.T.M.A.N.] " Marek Lindner
2011-12-05  9:56 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: convert batman iv algorithm to use dynamic infrastructure Marek Lindner

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=20111129152318.GA8417@pandem0nium \
    --to=simon.wunderlich@s2003.tu-chemnitz.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;
as well as URLs for NNTP newsgroup(s).