Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp304985pxa; Thu, 27 Aug 2020 02:51:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaN0ZPKe9m8FNaRuWcMW06lD2f6kwyWmZ9CAfNvNwB3W2f6HO9ww7mtMcnPwhQd8H/HTij X-Received: by 2002:a17:906:4c52:: with SMTP id d18mr6663751ejw.368.1598521898430; Thu, 27 Aug 2020 02:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598521898; cv=none; d=google.com; s=arc-20160816; b=VRuMatWhRFvYwZ+wcdFi7DiULwrFeLSAPjL79uxat/DwYSAwCnUtDH63+zmVpUiIdh 7ImeeFAR2qEUjzs086FS3zT64oNIjhY0JTToFa4M2jhzJCXcjiiE0iKSHiT+2wKmo4Gc ZuDCFns6+Fs3vONXiLrjbmT4pFSNXOjELVLlbO4TQWrfFL6MKqlAy1/EBY/gZaF9fI2U DbFpgNcQr7zCzJ/PDsbeY+Qs3qJJtWPb3WKf/VxHMVwefo7TG9V7cRnVVJFDPiwVfBYw Wn/xyC8ek/DObQQhdCCVpJipOhzajsaFTfQoLp4y5TKnn1PbFV/xKiatO7Djkaf24frs Xhrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=eKkOliR8V/w1ArKvcKL3bf4mPc9459r7PR+eXgFcB2A=; b=0X4a9mRRaEUpzC0AhfJHOnScHqRozADUoOsJhGwZnifZTzAGn4qm/ZBBW2tDrNYlm/ cLeXQjLPYXEe90KhdOBqQ18bYz4sG/VfVIYk7DGucFrw2ORjhDuLy+LOkEmSyeG0f1Su /ZXtPUy61jimieUVJPH2FMwWbWVNmOnxk3yVx6yaf7ZisCKRVUvocIVBc1hn3QS1BFXN rhF9nO8qlyyU8mvxrCjVe4YAHVymSmH1AqZiCMy81eUCp6urFXker2NgnFZkEObJ+8FS EaM/GeY6xjFBt0X56RoX0sbq0Ds2QTilsTFoBpyp3ov8c4e7JVVMjX59MDeFFn7PSeOF vPoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e11si1016483ejk.250.2020.08.27.02.51.15; Thu, 27 Aug 2020 02:51:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728431AbgH0Ju2 (ORCPT + 99 others); Thu, 27 Aug 2020 05:50:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:53030 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbgH0Ju1 (ORCPT ); Thu, 27 Aug 2020 05:50:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C031CAD78; Thu, 27 Aug 2020 09:50:57 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id 5A269603FB; Thu, 27 Aug 2020 11:50:25 +0200 (CEST) Date: Thu, 27 Aug 2020 11:50:25 +0200 From: Michal Kubecek To: Fabian Frederick Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/7 net-next] vxlan: add VXLAN_NL2FLAG macro Message-ID: <20200827095025.p4mxmuh2jwmzs5kt@lion.mk-sys.cz> References: <20200827065019.5787-1-fabf@skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200827065019.5787-1-fabf@skynet.be> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- [...] > 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 >