search for: nl_set_err_msg_weak

Displaying 5 results from an estimated 5 matches for "nl_set_err_msg_weak".

2023 Jan 26
2
[Bridge] [PATCH net-next] netlink: provide an ability to set default extack message
...hich appears after call to the driver, let's > add this check to common code. > > [1] https://lore.kernel.org/all/Y9Irgrgf3uxOjwUm at unreal > Signed-off-by: Leon Romanovsky <leonro at nvidia.com> > --- I would somewhat prefer not doing this, and instead introducing a new NL_SET_ERR_MSG_WEAK() of sorts. The reason has to do with the fact that an extack is sometimes also used to convey warnings rather than hard errors, for example right here in net/dsa/slave.c: if (err == -EOPNOTSUPP) { if (extack && !extack->_msg) NL_SET_ERR_MSG_MOD(extack, "Offloading n...
2023 Jan 27
1
[Bridge] [PATCH net-next] netlink: provide an ability to set default extack message
...et's > > add this check to common code. > > > > [1] https://lore.kernel.org/all/Y9Irgrgf3uxOjwUm at unreal > > Signed-off-by: Leon Romanovsky <leonro at nvidia.com> > > --- > > I would somewhat prefer not doing this, and instead introducing a new > NL_SET_ERR_MSG_WEAK() of sorts. It means changing ALL error unwind places where extack was forwarded before to subfunctions. Places like this: ret = func(..., extack) if (ret) { NL_SET_ERR_MSG_MOD... return ret; } will need to be changed to something like this: ret = func(..., extack) if (ret) { NL_SE...
2023 Jan 26
2
[Bridge] [PATCH net-next] netlink: provide an ability to set default extack message
...'s > > add this check to common code. > > > > [1] https://lore.kernel.org/all/Y9Irgrgf3uxOjwUm at unreal > > Signed-off-by: Leon Romanovsky <leonro at nvidia.com> > > --- > > I would somewhat prefer not doing this, and instead introducing a new > NL_SET_ERR_MSG_WEAK() of sorts. That'd be my preference too, FWIW. It's only the offload cases which need this sort of fallback. BTW Vladimir, I remember us discussing this. I was searching the archive as you sent this, but can't find the thread. Mostly curious whether I flip flipped on this or I'm n...
2023 Jan 29
3
[Bridge] [PATCH net-next v2] netlink: provide an ability to set default extack message
...ux/netlink.h index fa4d86da0ec7..c43ac7690eca 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -130,6 +130,16 @@ struct netlink_ext_ack { #define NL_SET_ERR_MSG_FMT_MOD(extack, fmt, args...) \ NL_SET_ERR_MSG_FMT((extack), KBUILD_MODNAME ": " fmt, ##args) +#define NL_SET_ERR_MSG_WEAK(extack, msg) do { \ + if ((extack) && !(extack)->_msg) \ + NL_SET_ERR_MSG((extack), msg); \ +} while (0) + +#define NL_SET_ERR_MSG_WEAK_MOD(extack, msg) do { \ + if ((extack) && !(extack)->_msg) \ + NL_SET_ERR_MSG_MOD((extack), msg); \ +} while (0) + #define NL_SET_BAD_...
2023 Jan 26
1
[Bridge] [PATCH net-next] netlink: provide an ability to set default extack message
From: Leon Romanovsky <leonro at nvidia.com> In netdev common pattern, xxtack pointer is forwarded to the drivers to be filled with error message. However, the caller can easily overwrite the filled message. Instead of adding multiple "if (!extack->_msg)" checks before any NL_SET_ERR_MSG() call, which appears after call to the driver, let's add this check to common code.