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 10/15] batman-adv: document skb ownership of always-consuming functions
Date: Sat, 14 Nov 2026 10:15:51 +0100 [thread overview]
Message-ID: <20261114091556.3336038-11-sw@simonwunderlich.de> (raw)
In-Reply-To: <20261114091556.3336038-1-sw@simonwunderlich.de>
From: Sven Eckelmann <sven@narfation.org>
Several functions always consume the skb they are given, but their
kernel-doc did not say so. Add an explicit "The skb is always consumed by
this function" to these functions.
Some even suggested the opposite and need corrections:
* batadv_v_elp_packet_recv() said the skb is consumed on NET_RX_SUCCESS,
but it is freed on NET_RX_DROP as well
* batadv_send_skb_to_orig() still documented an -EINPROGRESS return
value, which it no longer returns since the removal of the network coding
support
* batadv_frag_insert_packet() did not say that the skb is freed on error
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/bat_v_elp.c | 6 ++++--
net/batman-adv/fragmentation.c | 2 ++
net/batman-adv/send.c | 17 ++++++++++++++---
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 0eb07b789cffc..5c251feecabc5 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -551,8 +551,10 @@ static void batadv_v_elp_neigh_update(struct batadv_priv *bat_priv,
* @skb: the received packet
* @if_incoming: the interface this packet was received through
*
- * Return: NET_RX_SUCCESS and consumes the skb if the packet was properly
- * processed or NET_RX_DROP in case of failure.
+ * The skb is always consumed by this function.
+ *
+ * Return: NET_RX_SUCCESS if the packet was properly processed or NET_RX_DROP
+ * in case of failure.
*/
int batadv_v_elp_packet_recv(struct sk_buff *skb,
struct batadv_hard_iface *if_incoming)
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 9025d5f651464..936056a78effe 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -131,6 +131,8 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
* Insert a new fragment into the reverse ordered chain in the right table
* entry. The hash table entry is cleared if "old" fragments exist in it.
*
+ * The skb is always consumed by this function.
+ *
* Return: true if skb is buffered, false on error. If the chain has all the
* fragments needed to merge the packet, the chain is moved to the passed head
* to avoid locking the chain in the table.
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 6672f81798e91..24eb222299d33 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -109,6 +109,8 @@ int batadv_send_skb_packet(struct sk_buff *skb,
* @skb: packet to be transmitted (with batadv header and no outer eth header)
* @hard_iface: outgoing interface
*
+ * The skb is always consumed by this function.
+ *
* Return: A negative errno code is returned on a failure. A success does not
* guarantee the frame will be transmitted as it may be dropped due
* to congestion or traffic shaping.
@@ -126,6 +128,8 @@ int batadv_send_broadcast_skb(struct sk_buff *skb,
* @skb: packet to be transmitted (with batadv header and no outer eth header)
* @neigh: neighbor which is used as next hop to destination
*
+ * The skb is always consumed by this function.
+ *
* Return: A negative errno code is returned on a failure. A success does not
* guarantee the frame will be transmitted as it may be dropped due
* to congestion or traffic shaping.
@@ -163,9 +167,10 @@ int batadv_send_unicast_skb(struct sk_buff *skb,
* host, NULL can be passed as recv_if and no interface alternating is
* attempted.
*
- * Return: negative errno code on a failure, -EINPROGRESS if the skb is
- * buffered for later transmit or the NET_XMIT status returned by the
- * lower routine if the packet has been passed down.
+ * The skb is always consumed by this function.
+ *
+ * Return: negative errno code on a failure or the NET_XMIT status returned by
+ * the lower routine if the packet has been passed down.
*/
int batadv_send_skb_to_orig(struct sk_buff *skb,
struct batadv_orig_node *orig_node,
@@ -313,6 +318,8 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
* depending on whether BATADV_UNICAST or BATADV_UNICAST_4ADDR was supplied
* as packet_type. Then send this frame to the given orig_node.
*
+ * The skb is always consumed by this function.
+ *
* Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
*/
int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
@@ -389,6 +396,8 @@ int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
* BATADV_UNICAST_4ADDR was supplied as packet_type. Then send this frame
* to the according destination node.
*
+ * The skb is always consumed by this function.
+ *
* Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
*/
int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
@@ -429,6 +438,8 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
* Look up the currently selected gateway. Wrap the given skb into a batman-adv
* unicast header and send this frame to this gateway node.
*
+ * The skb is always consumed by this function.
+ *
* Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
*/
int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
--
2.47.3
next prev parent reply other threads:[~2026-11-14 9:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 9:15 [PATCH net-next 00/15] pull request for net-next: batman-adv 2026-11-14 Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 01/15] batman-adv: bla: use dedicated key type for claim hash Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 02/15] batman-adv: bla: use dedicated key type for backbone gateway hash Simon Wunderlich
[not found] ` <sashiko-outbox-215348@kernel.org>
2026-11-15 9:37 ` Sven Eckelmann
2026-11-14 9:15 ` [PATCH net-next 03/15] batman-adv: dat: use dedicated key type for DAT hash Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 04/15] batman-adv: tt: use dedicated key type for hashes Simon Wunderlich
[not found] ` <sashiko-outbox-215350@kernel.org>
2026-11-15 9:42 ` Sven Eckelmann
2026-11-14 9:15 ` [PATCH net-next 05/15] batman-adv: originator: pass explicit key to orig_hash Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 06/15] batman-adv: hash: document key argument of hash operations Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 07/15] batman-adv: never consume skb in BLA rx and DAT incoming snooping Simon Wunderlich
[not found] ` <sashiko-outbox-215353@kernel.org>
2026-11-15 9:44 ` Sven Eckelmann
2026-11-14 9:15 ` [PATCH net-next 08/15] batman-adv: always consume skb in batadv_forw_packet_alloc() Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 09/15] batman-adv: split fragment forwarding into lookup and forward Simon Wunderlich
2026-11-14 9:15 ` Simon Wunderlich [this message]
2026-11-14 9:15 ` [PATCH net-next 11/15] batman-adv: tt: increase hash generation when purging clients Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 12/15] batman-adv: dat: increase hash generation when purging entries Simon Wunderlich
[not found] ` <sashiko-outbox-215358@kernel.org>
2026-11-15 9:50 ` Sven Eckelmann
2026-11-14 9:15 ` [PATCH net-next 13/15] batman-adv: bla: " Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 14/15] batman-adv: increase orig hash generation when purging originators Simon Wunderlich
2026-11-14 9:15 ` [PATCH net-next 15/15] batman-adv: annotate functions returning objects with __must_check 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=20261114091556.3336038-11-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