From: Andrew Lunn <andrew@lunn.ch>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-bluetooth@vger.kernel.org
Subject: Re: [RFC PATCH] net: skb: on zero-copy formatted output to skb
Date: Thu, 23 Apr 2026 14:24:52 +0200 [thread overview]
Message-ID: <d56a7c77-cfc3-48e7-bbcb-5891b0e6c4d8@lunn.ch> (raw)
In-Reply-To: <20260423073638.778334-1-dmantipov@yandex.ru>
On Thu, Apr 23, 2026 at 10:36:38AM +0300, Dmitry Antipov wrote:
> Some code, most notably the Bluetooth drivers, uses something like
> the following:
>
> char buf[80];
> snprintf(buf, sizeof(buf), "Driver: %s\n", driver_name);
> skb_put_data(skb, buf, strlen(buf));
>
> This looks suboptimal at least because:
>
> 1) It yields in BUG() just in case the developer underestimates
> the size of an skb being used;
> 2) It requires extra data copy from an external buffer;
> 3) It uses 'strlen()' redundantly because actual data length
> is calculated by 'snprintf()' itself.
>
> So introduce 'skb_printf()' which aims to address all of these
> issues. As usual, thoughts and comments are highly appreciated.
Please always include at least one user of a new helper.
Do you plan to modify all the bluetooth drivers to use this?
Andrew
next prev parent reply other threads:[~2026-04-23 12:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 7:36 [RFC PATCH] net: skb: on zero-copy formatted output to skb Dmitry Antipov
2026-04-23 9:47 ` [RFC] " bluez.test.bot
2026-04-23 12:24 ` Andrew Lunn [this message]
2026-04-23 12:40 ` [RFC PATCH] " Andrew Lunn
2026-04-23 16:03 ` Dmitry Antipov
2026-04-23 16:46 ` Andrew Lunn
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=d56a7c77-cfc3-48e7-bbcb-5891b0e6c4d8@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dmantipov@yandex.ru \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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