[PATCH v2 net-next 07/10] net: dsa: sja1105: Move sja1105_is_link_local to include/linux

From: Vladimir Oltean
Date: Sun Jun 02 2019 - 17:44:42 EST


This function will be reused from the .port_rxtstamp callback to see if
the received SKB can be timestamped by the switch.

Signed-off-by: Vladimir Oltean <olteanv@xxxxxxxxx>
---
Changes in v2:

Patch is new.

include/linux/dsa/sja1105.h | 15 +++++++++++++++
net/dsa/tag_sja1105.c | 15 ---------------
2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/linux/dsa/sja1105.h b/include/linux/dsa/sja1105.h
index e46e18c47d41..f3237afed35a 100644
--- a/include/linux/dsa/sja1105.h
+++ b/include/linux/dsa/sja1105.h
@@ -25,4 +25,19 @@ struct sja1105_port {
int mgmt_slot;
};

+/* Similar to is_link_local_ether_addr(hdr->h_dest) but also covers PTP */
+static inline bool sja1105_is_link_local(const struct sk_buff *skb)
+{
+ const struct ethhdr *hdr = eth_hdr(skb);
+ u64 dmac = ether_addr_to_u64(hdr->h_dest);
+
+ if ((dmac & SJA1105_LINKLOCAL_FILTER_A_MASK) ==
+ SJA1105_LINKLOCAL_FILTER_A)
+ return true;
+ if ((dmac & SJA1105_LINKLOCAL_FILTER_B_MASK) ==
+ SJA1105_LINKLOCAL_FILTER_B)
+ return true;
+ return false;
+}
+
#endif /* _NET_DSA_SJA1105_H */
diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
index d840a3749549..e0903028d1cd 100644
--- a/net/dsa/tag_sja1105.c
+++ b/net/dsa/tag_sja1105.c
@@ -7,21 +7,6 @@
#include <linux/packing.h>
#include "dsa_priv.h"

-/* Similar to is_link_local_ether_addr(hdr->h_dest) but also covers PTP */
-static inline bool sja1105_is_link_local(const struct sk_buff *skb)
-{
- const struct ethhdr *hdr = eth_hdr(skb);
- u64 dmac = ether_addr_to_u64(hdr->h_dest);
-
- if ((dmac & SJA1105_LINKLOCAL_FILTER_A_MASK) ==
- SJA1105_LINKLOCAL_FILTER_A)
- return true;
- if ((dmac & SJA1105_LINKLOCAL_FILTER_B_MASK) ==
- SJA1105_LINKLOCAL_FILTER_B)
- return true;
- return false;
-}
-
/* This is the first time the tagger sees the frame on RX.
* Figure out if we can decode it, and if we can, annotate skb->cb with how we
* plan to do that, so we don't need to check again in the rcv function.
--
2.17.1