Netdev List
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	b.a.t.m.a.n@lists.open-mesh.org,
	Sven Eckelmann <sven@narfation.org>,
	Simon Wunderlich <sw@simonwunderlich.de>
Subject: [PATCH net-next 14/15] batman-adv: use bool for boolean flags
Date: Wed, 11 Nov 2026 11:27:28 +0100	[thread overview]
Message-ID: <20261111102729.2096241-15-sw@simonwunderlich.de> (raw)
In-Reply-To: <20261111102729.2096241-1-sw@simonwunderlich.de>

From: Sven Eckelmann <sven@narfation.org>

A few flags are stored in int or u8 although they only ever hold true or
false:

* the own_packet parameter of the B.A.T.M.A.N. IV OGM queueing functions
* batadv_forw_packet::own, whose kerneldoc already calls it a bool
* is_old_ttvn in batadv_check_unicast_ttvn(), which stores the result of
  batadv_seq_before()

Use bool for them, and pass true/false instead of 1/0.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/bat_iv_ogm.c | 10 +++++-----
 net/batman-adv/routing.c    |  2 +-
 net/batman-adv/types.h      |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 9e529215a7908..0b2134a8f963a 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -623,7 +623,7 @@ static bool batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
 					bool direct_link,
 					struct batadv_hard_iface *if_incoming,
 					struct batadv_hard_iface *if_outgoing,
-					int own_packet)
+					bool own_packet)
 {
 	struct batadv_priv *bat_priv = netdev_priv(if_incoming->mesh_iface);
 	struct batadv_forw_packet *forw_packet_aggr;
@@ -716,7 +716,7 @@ static bool batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv,
 				    int packet_len,
 				    struct batadv_hard_iface *if_incoming,
 				    struct batadv_hard_iface *if_outgoing,
-				    int own_packet, unsigned long send_time)
+				    bool own_packet, unsigned long send_time)
 {
 	/* _aggr -> pointer to the packet we want to aggregate with
 	 * _pos -> pointer to the position in the queue
@@ -843,7 +843,7 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node,
 
 	batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batadv_ogm_packet,
 				BATADV_OGM_HLEN + tvlv_len,
-				if_incoming, if_outgoing, 0,
+				if_incoming, if_outgoing, false,
 				batadv_iv_ogm_fwd_send_time());
 }
 
@@ -955,7 +955,7 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)
 		 * respective interfaces.
 		 */
 		scheduled = batadv_iv_ogm_queue_add(bat_priv, ogm_buff->buf, ogm_buff->len,
-						    hard_iface, hard_iface, 1, send_time);
+						    hard_iface, hard_iface, true, send_time);
 		if (!scheduled)
 			reschedule = true;
 
@@ -972,7 +972,7 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)
 
 		scheduled = batadv_iv_ogm_queue_add(bat_priv, ogm_buff->buf,
 						    ogm_buff->len, hard_iface,
-						    tmp_hard_iface, 1, send_time);
+						    tmp_hard_iface, true, send_time);
 		batadv_hardif_put(tmp_hard_iface);
 
 		if (!scheduled && tmp_hard_iface == hard_iface)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 79fad88cd039c..e2951bf047024 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -891,7 +891,7 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
 	struct batadv_orig_node *orig_node;
 	struct ethhdr *ethhdr;
 	unsigned short vid;
-	int is_old_ttvn;
+	bool is_old_ttvn;
 	u8 curr_ttvn;
 	u8 old_ttvn;
 
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 0fece14c7e7f8..b3edfc71af4a7 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -2047,7 +2047,7 @@ struct batadv_forw_packet {
 	 * @own: bool for locally generated packets (local OGMs are re-scheduled
 	 * after sending)
 	 */
-	u8 own;
+	bool own:1;
 
 	/** @skb: bcast packet's skb buffer */
 	struct sk_buff *skb;
-- 
2.47.3


  parent reply	other threads:[~2026-11-11 10:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 10:27 [PATCH net-next 00/15] pull request for net-next: batman-adv 2026-11-11 Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 01/15] batman-adv: mcast: explicitly initialize mcast.num_want_all_rtr{4,6) Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 02/15] batman-adv: mcast: explicitly initialize mcast.want_all_rtr{4,6}_list Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 03/15] batman-adv: uapi: add note/clarification on access of reserved bytes/bits Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 04/15] batman-adv: avoid torn u64 counter reads on 32-bit systems Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 05/15] batman-adv: bat_v: initialize last_unicast_tx on neighbor creation Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 06/15] batman-adv: dat: annotate last_update with READ/WRITE_ONCE Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 07/15] batman-adv: bla: avoid negative reported BATADV_ATTR_LAST_SEEN_MSECS Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 08/15] batman-adv: tt: annotate last_seen with READ/WRITE_ONCE Simon Wunderlich
     [not found]   ` <sashiko-outbox-210958@kernel.org>
2026-11-12 10:57     ` Sven Eckelmann
2026-11-11 10:27 ` [PATCH net-next 09/15] batman-adv: annotate originator " Simon Wunderlich
     [not found]   ` <sashiko-outbox-210959@kernel.org>
2026-11-12 10:57     ` Sven Eckelmann
2026-11-11 10:27 ` [PATCH net-next 10/15] batman-adv: annotate neigh_node " Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 11/15] batman-adv: annotate hardif_neigh_node " Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 12/15] batman-adv: use matching return types for bool and void functions Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 13/15] batman-adv: mark read-only MAC address parameters as const Simon Wunderlich
2026-11-11 10:27 ` Simon Wunderlich [this message]
2026-11-11 10:27 ` [PATCH net-next 15/15] batman-adv: mcast: document the value stored in is_routable 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=20261111102729.2096241-15-sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sven@narfation.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