Thread (3 messages) flat view 3 messages, 3 authors, 2020-08-27

Re: [PATCH 5/7 net-next] vxlan: add VXLAN_NL2FLAG macro

From: David Miller <davem@davemloft.net>
Date: 2020-08-27 14:29:53
Also in: lkml

From: Michal Kubecek <redacted>
Date: Thu, 27 Aug 2020 11:50:25 +0200
On Thu, Aug 27, 2020 at 08:50:19AM +0200, Fabian Frederick wrote:
quoted
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 <redacted>
---
[...]
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help