提交 45d9b378 编写于 作者: J Jakub Kicinski 提交者: David S. Miller

netlink: add NULL-friendly helper for setting extended ACK message

As we propagate extended ack reporting throughout various paths in
the kernel it may be that the same function is called with the
extended ack parameter passed as NULL.  One place where that happens
is in drivers which have a centralized reconfiguration function
called both from ndos and from ethtool_ops.  Add a new helper for
setting the error message in such conditions.

Existing helper is left as is to encourage propagating the ext act
fully wherever possible.  It also makes it clear in the code which
messages may be lost due to ext ack being NULL.
Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 73333626
......@@ -92,6 +92,14 @@ struct netlink_ext_ack {
(extack)->_msg = _msg; \
} while (0)
#define NL_MOD_TRY_SET_ERR_MSG(extack, msg) do { \
static const char _msg[] = KBUILD_MODNAME ": " msg; \
struct netlink_ext_ack *_extack = (extack); \
\
if (_extack) \
_extack->_msg = _msg; \
} while (0)
extern void netlink_kernel_release(struct sock *sk);
extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册