Re: [PATCH v3] net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)
From: Joe Perches <joe@perches.com>
Date: 2013-08-21 19:01:21
On Wed, 2013-08-21 at 20:20 +0200, Arvid Brodin wrote:
High-availability Seamless Redundancy ("HSR") provides instant failover
redundancy for Ethernet networks. It requires a special network topology where
all nodes are connected in a ring (each node having two physical network
interfaces). It is suited for applications that demand high availability and
very short reaction time.Hi Arvid. just trivia:
quoted hunk ↗ jump to hunk
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
[]
+static int hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev)
[]
+ if (likely(res1 == NET_XMIT_SUCCESS || res1 == NET_XMIT_CN ||
+ res2 == NET_XMIT_SUCCESS || res2 == NET_XMIT_CN)) {This might be faster using | instead of || []
quoted hunk ↗ jump to hunk
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
[]
+
+/* above(a, b) - return 1 if a > b, 0 otherwise.
+ */
+static bool above(u16 a, u16 b)
+{
+ /* Remove inconsistency where above(a, b) == below(a, b) */
+ if ((int) b - a == 32768)
+ return 0;
+
+ return (((s16) (b - a)) < 0);
+}
+#define below(a, b) above((b), (a))
+#define above_or_eq(a, b) (!below((a), (b)))
+#define below_or_eq(a, b) (!above((a), (b)))These may be overly generic macro names given these only take u16.