[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200827095025.p4mxmuh2jwmzs5kt@lion.mk-sys.cz>
Date: Thu, 27 Aug 2020 11:50:25 +0200
From: Michal Kubecek <mkubecek@...e.cz>
To: Fabian Frederick <fabf@...net.be>
Cc: davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/7 net-next] vxlan: add VXLAN_NL2FLAG macro
On Thu, Aug 27, 2020 at 08:50:19AM +0200, Fabian Frederick wrote:
> Replace common flag assignment with a macro.
> This could yet be simplified with changelink/supported but it would
> remove clarity
>
> Signed-off-by: Fabian Frederick <fabf@...net.be>
> ---
[...]
> diff --git a/include/net/vxlan.h b/include/net/vxlan.h
> index 3a41627cbdfe5..8a56b7a0f75f9 100644
> --- a/include/net/vxlan.h
> +++ b/include/net/vxlan.h
> @@ -290,6 +290,16 @@ struct vxlan_dev {
> VXLAN_F_UDP_ZERO_CSUM6_RX | \
> VXLAN_F_COLLECT_METADATA)
>
> +
> +#define VXLAN_NL2FLAG(iflag, flag, changelink, changelink_supported) { \
> + if (data[iflag]) { \
> + err = vxlan_nl2flag(conf, data, iflag, flag, changelink, \
> + changelink_supported, extack); \
> + if (err) \
> + return err; \
> + } \
> +}
> +
Hiding a goto or return in a macro is generally discouraged as it may
confuse people reading or updating the code. See e.g. commit
94f826b8076e ("net: fix a potential rcu_read_lock() imbalance in
rt6_fill_node()") for an example of such problem - which was likely the
trigger for removal of NLA_PUT() and related macros shortly after.
Michal
> struct net_device *vxlan_dev_create(struct net *net, const char *name,
> u8 name_assign_type, struct vxlan_config *conf);
>
> --
> 2.27.0
>
Powered by blists - more mailing lists