Re: [PATCH 5/7 net-next] vxlan: add VXLAN_NL2FLAG macro
From: David Miller
Date: Thu Aug 27 2020 - 10:29:53 EST
From: Michal Kubecek <mkubecek@xxxxxxx>
Date: Thu, 27 Aug 2020 11:50:25 +0200
> 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@xxxxxxxxx>
>> ---
> [...]
>> 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.
Agreed, please don't do this.