B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Remi Pommarel <repk@triplefau.lt>
To: Sven Eckelmann <sven@narfation.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Simon Wunderlich <sw@simonwunderlich.de>,
	Antonio Quartulli <a@unstable.cc>
Subject: Re: [PATCH v3 5/5] batman-adv: Don't keep redundant TT change events
Date: Thu, 21 Nov 2024 10:13:15 +0100	[thread overview]
Message-ID: <Zz75q77puwRSl5hN@pilgrim> (raw)
In-Reply-To: <2485257.jE0xQCEvom@ripper>

On Thu, Nov 21, 2024 at 09:43:01AM +0100, Sven Eckelmann wrote:
> On Wednesday, 20 November 2024 18:47:18 CET Remi Pommarel wrote:
> > -               /* this is a second add in the same originator interval. It
> > -                * means that flags have been changed: update them!
> > +               /* this is a second add or del in the same originator interval.
> > +                * It could mean that flags have been changed (e.g. double
> > +                * add): update them
> >                  */
> > -               if (!del_op_requested && !del_op_entry)
> > +               if (del_op_requested == del_op_entry) {
> >                         entry->change.flags = flags;
> > +                       goto discard;
> > +               }
> >  
> >                 continue;
> 
> >From logic perspective, the check would be irrelevant - and the continue never happens.
> 
> 
>     if (!del_op_requested && del_op_entry)
>     	goto del;
>     if (del_op_requested && !del_op_entry)
>     	goto del;
> 
> 
> Implies that del_op_requested == del_op_entry. So the check wouldn't make too 
> much sense. Maybe we should clean up this logic further:
> 
> 
> diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
> index 437c4edd..b349851b 100644
> --- a/net/batman-adv/translation-table.c
> +++ b/net/batman-adv/translation-table.c
> @@ -484,18 +484,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
>  		if (!batadv_compare_eth(entry->change.addr, common->addr))
>  			continue;
>  
> -		/* DEL+ADD in the same orig interval have no effect and can be
> -		 * removed to avoid silly behaviour on the receiver side. The
> -		 * other way around (ADD+DEL) can happen in case of roaming of
> -		 * a client still in the NEW state. Roaming of NEW clients is
> -		 * now possible due to automatically recognition of "temporary"
> -		 * clients
> -		 */
>  		del_op_entry = entry->change.flags & BATADV_TT_CLIENT_DEL;
> -		if (!del_op_requested && del_op_entry)
> -			goto del;
> -		if (del_op_requested && !del_op_entry)
> -			goto del;
>  
>  		/* this is a second add or del in the same originator interval.
>  		 * It could mean that flags have been changed (e.g. double
> @@ -506,8 +495,13 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
>  			goto discard;
>  		}
>  
> -		continue;
> -del:
> +		/* DEL+ADD in the same orig interval have no effect and can be
> +		 * removed to avoid silly behaviour on the receiver side. The
> +		 * other way around (ADD+DEL) can happen in case of roaming of
> +		 * a client still in the NEW state. Roaming of NEW clients is
> +		 * now possible due to automatically recognition of "temporary"
> +		 * clients
> +		 */
>  		list_del(&entry->list);
>  		kmem_cache_free(batadv_tt_change_cache, entry);
>  		bat_priv->tt.local_changes--;
> 

Looks right to me, I would even simplify that more for readability with:


 		 * now possible due to automatically recognition of "temporary"
 		 * clients
 		 */
-		del_op_entry = entry->change.flags & BATADV_TT_CLIENT_DEL;
-		if (!del_op_requested && del_op_entry)
-			goto del;
-		if (del_op_requested && !del_op_entry)
-			goto del;
-
-		/* this is a second add or del in the same originator interval.
-		 * It could mean that flags have been changed (e.g. double
-		 * add): update them
-		 */
-		if (del_op_requested == del_op_entry) {
-			entry->change.flags = flags;
-			goto discard;
+		if (del_op_requested != del_op_entry) {
+			list_del(&entry->list);
+			kmem_cache_free(batadv_tt_change_cache, entry);
+			bat_priv->tt.local_changes--;
 		}
-
-		continue;
-del:
-		list_del(&entry->list);
-		kmem_cache_free(batadv_tt_change_cache, entry);
-		bat_priv->tt.local_changes--;
 discard:
 		kmem_cache_free(batadv_tt_change_cache, tt_change_node);
 		goto unlock;

-- 
Remi

  reply	other threads:[~2024-11-21  9:14 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 17:47 [PATCH v3 0/5] batman-adv: TT change events fixes and improvements Remi Pommarel
2024-11-20 17:47 ` [PATCH v3 1/5] batman-adv: Do not send uninitialized TT changes Remi Pommarel
2024-11-21 13:05   ` Antonio Quartulli
2024-11-21 13:56     ` Remi Pommarel
2024-11-21 15:07       ` Remi Pommarel
2024-11-21 18:02         ` Sven Eckelmann
2024-11-21 20:24           ` Remi Pommarel
2024-11-21 21:07             ` Antonio Quartulli
2024-11-22  8:16             ` Sven Eckelmann
2024-11-20 17:47 ` [PATCH v3 2/5] batman-adv: Remove uninitialized data in full table TT response Remi Pommarel
2024-11-21 13:14   ` Antonio Quartulli
2024-11-21 18:20     ` Sven Eckelmann
2024-11-21 20:55       ` Antonio Quartulli
2024-11-20 17:47 ` [PATCH v3 3/5] batman-adv: Do not let TT changes list grows indefinitely Remi Pommarel
2024-11-21 13:50   ` Antonio Quartulli
2024-11-21 14:18     ` Remi Pommarel
2024-11-20 17:47 ` [PATCH v3 4/5] batman-adv: Remove atomic usage for tt.local_changes Remi Pommarel
2024-11-21  9:04   ` Sven Eckelmann
2024-11-21  9:28     ` Remi Pommarel
2024-11-21  9:34       ` Sven Eckelmann
2024-11-20 17:47 ` [PATCH v3 5/5] batman-adv: Don't keep redundant TT change events Remi Pommarel
2024-11-21  8:43   ` Sven Eckelmann
2024-11-21  9:13     ` Remi Pommarel [this message]
2024-11-21  9:23       ` Sven Eckelmann
2024-11-21  9:30         ` Sven Eckelmann
2024-11-21  9:35           ` Remi Pommarel
2024-11-20 19:46 ` [PATCH v3 0/5] batman-adv: TT change events fixes and improvements Sven Eckelmann
2024-11-20 19:54   ` Remi Pommarel
2024-11-20 20:29     ` Antonio Quartulli
2024-11-20 21:04     ` Sven Eckelmann

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=Zz75q77puwRSl5hN@pilgrim \
    --to=repk@triplefau.lt \
    --cc=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=sven@narfation.org \
    --cc=sw@simonwunderlich.de \
    /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