public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox•net>
To: Jakub Kicinski <jakub.kicinski@netronome•com>, netdev@vger•kernel.org
Cc: davem@davemloft•net, johannes@sipsolutions•net,
	dsa@cumulusnetworks•com, alexei.starovoitov@gmail•com,
	bblanco@gmail•com, john.fastabend@gmail•com, kubakici@wp•pl,
	oss-drivers@netronome•com
Subject: Re: [RFC 1/4] netlink: make extended ACK setting NULL-friendly
Date: Tue, 25 Apr 2017 11:12:11 +0200	[thread overview]
Message-ID: <58FF12EB.7090700@iogearbox.net> (raw)
In-Reply-To: <20170425080644.122536-2-jakub.kicinski@netronome.com>

On 04/25/2017 10:06 AM, Jakub Kicinski wrote:
> As we propagate extended ack reporting throughout various paths in
> the kernel it may happen that the same function is called with the
> extended ack parameter passed as NULL.  Make the NL_SET_ERR_MSG()
> macro simply print the message to the logs if that happens.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome•com>
> ---
>   include/linux/netlink.h | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/netlink.h b/include/linux/netlink.h
> index 8d2a8924705c..b59cfbf2e2c7 100644
> --- a/include/linux/netlink.h
> +++ b/include/linux/netlink.h
> @@ -86,10 +86,14 @@ struct netlink_ext_ack {
>    * Currently string formatting is not supported (due
>    * to the lack of an output buffer.)
>    */
> -#define NL_SET_ERR_MSG(extack, msg) do {	\
> -	static const char _msg[] = (msg);	\
> -						\
> -	(extack)->_msg = _msg;			\
> +#define NL_SET_ERR_MSG(extack, msg) do {		\
> +	struct netlink_ext_ack *_extack = (extack);	\
> +	static const char _msg[] = (msg);		\
> +							\
> +	if (_extack)					\
> +		_extack->_msg = _msg;			\
> +	else						\
> +		pr_info("%s\n", _msg);			\
>   } while (0)
>
>   extern void netlink_kernel_release(struct sock *sk);

Probably makes sense to have a NL_MOD_SET_ERR_MSG(), which
then also prepends a KBUILD_MODNAME ": " string to the
message (similar to pr_*()), so that it's easier to identify
whether the error came from a specific driver or rather
common core code?

  parent reply	other threads:[~2017-04-25  9:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  8:06 [RFC 0/4] xdp: use netlink extended ACK reporting Jakub Kicinski
2017-04-25  8:06 ` [RFC 1/4] netlink: make extended ACK setting NULL-friendly Jakub Kicinski
2017-04-25  8:13   ` Johannes Berg
2017-04-25 20:53     ` Jakub Kicinski
2017-04-26  7:17       ` Johannes Berg
2017-04-25  9:12   ` Daniel Borkmann [this message]
2017-04-25  8:06 ` [RFC 2/4] xdp: propagate extended ack to XDP setup Jakub Kicinski
2017-04-25  8:06 ` [RFC 3/4] nfp: make use of extended ack message reporting Jakub Kicinski
2017-04-25 12:42   ` Jamal Hadi Salim
2017-04-25 14:20     ` David Miller
2017-04-26 11:13       ` [oss-drivers] " Simon Horman
2017-04-26 13:03         ` Jamal Hadi Salim
2017-04-26 13:31           ` Daniel Borkmann
2017-04-26 14:44         ` David Miller
2017-04-26 18:44           ` Simon Horman
2017-04-25  8:06 ` [RFC 4/4] virtio_net: " Jakub Kicinski
2017-04-25  9:05 ` [RFC 0/4] xdp: use netlink extended ACK reporting Daniel Borkmann
2017-04-25 16:54   ` Jesper Dangaard Brouer
2017-04-25 21:00   ` Jakub Kicinski
2017-04-25 14:53 ` David Ahern
2017-04-25 21:05   ` Jakub Kicinski

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=58FF12EB.7090700@iogearbox.net \
    --to=daniel@iogearbox$(echo .)net \
    --cc=alexei.starovoitov@gmail$(echo .)com \
    --cc=bblanco@gmail$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=dsa@cumulusnetworks$(echo .)com \
    --cc=jakub.kicinski@netronome$(echo .)com \
    --cc=johannes@sipsolutions$(echo .)net \
    --cc=john.fastabend@gmail$(echo .)com \
    --cc=kubakici@wp$(echo .)pl \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=oss-drivers@netronome$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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