From: Antonio Quartulli <a@unstable.cc>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>,
Marek Lindner <mareklindner@neomailbox.ch>
Subject: Re: [B.A.T.M.A.N.] [PATCH maint] batman-adv: Fix TT sync flags for intermediate TT responses
Date: Wed, 9 May 2018 03:55:17 +0800 [thread overview]
Message-ID: <8b0bb0a1-5c5b-ebeb-a9f7-23f2ad2ef6f4@unstable.cc> (raw)
In-Reply-To: <2938343.Lhb7MQrGW1@lafayette>
[-- Attachment #1.1: Type: text/plain, Size: 2238 bytes --]
On 09/05/18 03:20, Marek Lindner wrote:
> On Sunday, May 6, 2018 4:23:37 AM HKT Sven Eckelmann wrote:
>>> * batadv_tt_tvlv_generate() - fill the tvlv buff with the tt entries from
>>> the * specified tt hash
>>> * @bat_priv: the bat priv with all the soft interface information
>>> @@ -2934,6 +2969,7 @@ static void batadv_tt_tvlv_generate(struct
>>> batadv_priv *bat_priv, struct batadv_tvlv_tt_change *tt_change;
>>> struct hlist_head *head;
>>> u16 tt_tot, tt_num_entries = 0;
>>> + int flags;
>>> u32 i;
>>>
>>> tt_tot = batadv_tt_entries(tt_len);
>>> @@ -2951,8 +2987,12 @@ static void batadv_tt_tvlv_generate(struct
>>> batadv_priv *bat_priv, if ((valid_cb) && (!valid_cb(tt_common_entry,
>>> cb_data)))
>>> continue;
>>>
>>> + flags = batadv_tt_get_flags(tt_common_entry,
>>> cb_data); + if (flags < 0)
>>> + continue;
>>
>> The second argument of batadv_tt_get_flags is a little bit tricky here. The
>> kernel-doc says that cb_data is "data passed to the filter function as
>> argument" and is of type "void *". But you are now using it here as if would
>> always be of type "struct batadv_orig_node *". This doesn't make problem
>> for now because only two functions are using this argument - luckily they
>> are either set it to NULL or to "batadv_orig_node *".
>>
>> I would propose to make it clear that this argument must be
>> "struct batadv_orig_node *" and not an arbitrary argument which is only used
>> by the valid_cb callback.
>
> I second that concern. An alternative suggestion: Modify
> batadv_tt_local_valid() / batadv_tt_global_valid() to return the flags as
> those functions already distinguish between the local and global case.
> Moreover, you save the extra batadv_tt_global_orig_entry_find() call which
> already happens in batadv_tt_global_valid().
I like Marek's idea, but I'd suggest to change the name of the
tt_*_valid() functions to something a bit more generic.
Apart from that I agree that that the flags retrieval could directly be
done within the callback which already knows if we are in the local or
global case.
Cheers,
--
Antonio Quartulli
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-05-08 19:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-05 15:30 [B.A.T.M.A.N.] [PATCH maint] batman-adv: Fix TT sync flags for intermediate TT responses Linus Lüssing
2018-05-05 15:46 ` Linus Lüssing
2018-05-05 20:23 ` Sven Eckelmann
2018-05-08 19:20 ` Marek Lindner
2018-05-08 19:55 ` Antonio Quartulli [this message]
2018-05-09 15:08 ` me
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=8b0bb0a1-5c5b-ebeb-a9f7-23f2ad2ef6f4@unstable.cc \
--to=a@unstable.cc \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=mareklindner@neomailbox.ch \
/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).