public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Marek Lindner <lindner_marek@yahoo.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.] [PATCHv6 1/3] batman-adv: Multicast Listener Announcements via Translation Table
Date: Tue, 25 Jun 2013 05:47:20 +0800	[thread overview]
Message-ID: <201306250547.20341.lindner_marek@yahoo.de> (raw)
In-Reply-To: <1371232209-7808-2-git-send-email-linus.luessing@web.de>

On Saturday, June 15, 2013 01:50:07 Linus Lüssing wrote:
> With this patch a node which has no bridge interface on top of its soft
> interface announces its local multicast listeners via the translation
> table.
> 
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> ---
>  Makefile               |    2 +
>  Makefile.kbuild        |    1 +
>  compat.h               |   20 ++++-
>  gen-compat-autoconf.sh |    1 +
>  main.c                 |    6 ++
>  main.h                 |    1 +
>  multicast.c            |  210
> ++++++++++++++++++++++++++++++++++++++++++++++++ multicast.h            | 
>  43 ++++++++++
>  soft-interface.c       |    3 +
>  sysfs.c                |    6 ++
>  translation-table.c    |   22 ++++-
>  types.h                |   12 +++
>  12 files changed, 322 insertions(+), 5 deletions(-)
>  create mode 100644 multicast.c
>  create mode 100644 multicast.h
> 
> diff --git a/Makefile b/Makefile
> index 407cdc4..d7c6fa6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -27,6 +27,8 @@ export CONFIG_BATMAN_ADV_BLA=y
>  export CONFIG_BATMAN_ADV_DAT=y
>  # B.A.T.M.A.N network coding (catwoman):
>  export CONFIG_BATMAN_ADV_NC=n
> +# B.A.T.M.A.N. multicast optimizations:
> +export CONFIG_BATMAN_ADV_MCAST_OPTIMIZATIONS=y

Can we please find a shorter define ? How about "CONFIG_BATMAN_ADV_MCAST" ? 
That would be in line with the rest.


> +struct batadv_hw_addr {
> +	struct list_head	list;
> +	unsigned char addr[ETH_ALEN];
> +};

All struct defines should go into types.h or packet.h if they are sent over 
the wire.


> +/**
> + * batadv_mcast_mla_tt_update - update the own MLAs
> + * @bat_priv: the bat priv with all the soft interface information
> + *
> + * Update the own multicast listener announcements in the translation
> + * table. Also take care of registering or unregistering the multicast
> + * tvlv depending on whether the user activated or deactivated
> + * multicast optimizations.
> + */
> +void batadv_mcast_mla_tt_update(struct batadv_priv *bat_priv)
> +{
> +	struct net_device *soft_iface = bat_priv->soft_iface;
> +	struct list_head mcast_list;
> +	int ret;
> +	static bool enabled;
> +
> +	INIT_LIST_HEAD(&mcast_list);
> +
> +	/* Avoid attaching MLAs, if multicast optimization is disabled
> +	 * or there is a bridge on top of our soft interface (TODO)
> +	 */
> +	if (!atomic_read(&bat_priv->mcast_group_awareness) ||
> +	    bat_priv->soft_iface->priv_flags & IFF_BRIDGE_PORT) {
> +		if (enabled)
> +			enabled = false;
> +
> +		goto update;
> +	}
> +
> +	if (!enabled)
> +		enabled = true;
> +
> +	ret = batadv_mcast_mla_local_collect(soft_iface, &mcast_list);
> +	if (ret < 0)
> +		goto out;
> +
> +update:
> +	batadv_mcast_mla_tt_clean(bat_priv, &mcast_list);
> +	batadv_mcast_mla_tt_add(bat_priv, &mcast_list);
> +
> +out:
> +	batadv_mcast_mla_collect_free(&mcast_list);
> +}

You can use the LIST_HEAD static initializer.
The "enabled" variable does not make any sense.

How about we change some function names for the sake of clarity ? Here my 
suggestions:

 * batadv_mcast_mla_local_collect() => batadv_mcast_mla_softif_retrieve() or 
batadv_mcast_mla_softif_get()
 * batadv_mcast_mla_tt_clean() => batadv_mcast_mla_tt_retract()
 * batadv_mcast_mla_collect_free() => batadv_mcast_mla_list_free()


> +#ifdef CONFIG_BATMAN_ADV_MCAST_OPTIMIZATIONS
> +struct batadv_priv_mcast {
> +	struct list_head mla_list;
> +};
> +#endif

I don't see a good reason to use a double linked list or is there one ?

Cheers,
Marek

  reply	other threads:[~2013-06-24 21:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14 17:50 [B.A.T.M.A.N.] Basic Multicast Optimizations Linus Lüssing
2013-06-14 17:50 ` [B.A.T.M.A.N.] [PATCHv6 1/3] batman-adv: Multicast Listener Announcements via Translation Table Linus Lüssing
2013-06-24 21:47   ` Marek Lindner [this message]
2013-06-25 12:55     ` Linus Lüssing
2013-06-25 13:03       ` Antonio Quartulli
2013-06-26  9:38         ` Linus Lüssing
2013-06-14 17:50 ` [B.A.T.M.A.N.] [PATCHv6 2/3] batman-adv: Announce new capability via multicast TVLV Linus Lüssing
2013-06-14 17:50 ` [B.A.T.M.A.N.] [PATCHv6 3/3] batman-adv: Modified forwarding behaviour for multicast packets Linus Lüssing
2013-06-26 14:46   ` Antonio Quartulli
2013-06-16 14:08 ` [B.A.T.M.A.N.] Basic Multicast Optimizations Simon Wunderlich

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=201306250547.20341.lindner_marek@yahoo.de \
    --to=lindner_marek@yahoo.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