diff mbox

[bluetooth-next,09/11] 6lowpan: move eui64 uncompress function

Message ID 1460365464-12435-10-git-send-email-aar@pengutronix.de (mailing list archive)
State Accepted
Headers show

Commit Message

Alexander Aring April 11, 2016, 9:04 a.m. UTC
This function will be use in later functionality in other branches than
generic 6lowpan, so we move it to the global 6lowpan header.

Signed-off-by: Alexander Aring <aar@pengutronix.de>
---
 include/net/6lowpan.h | 16 ++++++++++++++++
 net/6lowpan/iphc.c    | 16 ----------------
 2 files changed, 16 insertions(+), 16 deletions(-)

Comments

Stefan Schmidt April 11, 2016, 4:54 p.m. UTC | #1
Hello.

On 11/04/16 11:04, Alexander Aring wrote:
> This function will be use in later functionality in other branches than
> generic 6lowpan, so we move it to the global 6lowpan header.
>
> Signed-off-by: Alexander Aring<aar@pengutronix.de>
> ---
>   include/net/6lowpan.h | 16 ++++++++++++++++
>   net/6lowpan/iphc.c    | 16 ----------------
>   2 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
> index a0c01f5..04b877c 100644
> --- a/include/net/6lowpan.h
> +++ b/include/net/6lowpan.h
> @@ -169,6 +169,22 @@ struct lowpan_802154_cb *lowpan_802154_cb(const struct sk_buff *skb)
>   	return (struct lowpan_802154_cb *)skb->cb;
>   }
>   
> +static inline void lowpan_iphc_uncompress_eui64_lladdr(struct in6_addr *ipaddr,
> +						       const void *lladdr)
> +{
> +	/* fe:80::XXXX:XXXX:XXXX:XXXX
> +	 *        \_________________/
> +	 *              hwaddr
> +	 */
> +	ipaddr->s6_addr[0] = 0xFE;
> +	ipaddr->s6_addr[1] = 0x80;
> +	memcpy(&ipaddr->s6_addr[8], lladdr, EUI64_ADDR_LEN);
> +	/* second bit-flip (Universe/Local)
> +	 * is done according RFC2464
> +	 */
> +	ipaddr->s6_addr[8] ^= 0x02;
> +}
> +
>   #ifdef DEBUG
>   /* print data in line */
>   static inline void raw_dump_inline(const char *caller, char *msg,
> diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
> index 2999240..dff1591 100644
> --- a/net/6lowpan/iphc.c
> +++ b/net/6lowpan/iphc.c
> @@ -156,22 +156,6 @@
>   #define LOWPAN_IPHC_CID_DCI(cid)	(cid & 0x0f)
>   #define LOWPAN_IPHC_CID_SCI(cid)	((cid & 0xf0) >> 4)
>   
> -static inline void lowpan_iphc_uncompress_eui64_lladdr(struct in6_addr *ipaddr,
> -						       const void *lladdr)
> -{
> -	/* fe:80::XXXX:XXXX:XXXX:XXXX
> -	 *        \_________________/
> -	 *              hwaddr
> -	 */
> -	ipaddr->s6_addr[0] = 0xFE;
> -	ipaddr->s6_addr[1] = 0x80;
> -	memcpy(&ipaddr->s6_addr[8], lladdr, EUI64_ADDR_LEN);
> -	/* second bit-flip (Universe/Local)
> -	 * is done according RFC2464
> -	 */
> -	ipaddr->s6_addr[8] ^= 0x02;
> -}
> -
>   static inline void
>   lowpan_iphc_uncompress_802154_lladdr(struct in6_addr *ipaddr,
>   				     const void *lladdr)

Reviewed-by: Stefan Schmidt<stefan@osg.samsung.com>

regards
Stefan Schmidt


--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index a0c01f5..04b877c 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -169,6 +169,22 @@  struct lowpan_802154_cb *lowpan_802154_cb(const struct sk_buff *skb)
 	return (struct lowpan_802154_cb *)skb->cb;
 }
 
+static inline void lowpan_iphc_uncompress_eui64_lladdr(struct in6_addr *ipaddr,
+						       const void *lladdr)
+{
+	/* fe:80::XXXX:XXXX:XXXX:XXXX
+	 *        \_________________/
+	 *              hwaddr
+	 */
+	ipaddr->s6_addr[0] = 0xFE;
+	ipaddr->s6_addr[1] = 0x80;
+	memcpy(&ipaddr->s6_addr[8], lladdr, EUI64_ADDR_LEN);
+	/* second bit-flip (Universe/Local)
+	 * is done according RFC2464
+	 */
+	ipaddr->s6_addr[8] ^= 0x02;
+}
+
 #ifdef DEBUG
 /* print data in line */
 static inline void raw_dump_inline(const char *caller, char *msg,
diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
index 2999240..dff1591 100644
--- a/net/6lowpan/iphc.c
+++ b/net/6lowpan/iphc.c
@@ -156,22 +156,6 @@ 
 #define LOWPAN_IPHC_CID_DCI(cid)	(cid & 0x0f)
 #define LOWPAN_IPHC_CID_SCI(cid)	((cid & 0xf0) >> 4)
 
-static inline void lowpan_iphc_uncompress_eui64_lladdr(struct in6_addr *ipaddr,
-						       const void *lladdr)
-{
-	/* fe:80::XXXX:XXXX:XXXX:XXXX
-	 *        \_________________/
-	 *              hwaddr
-	 */
-	ipaddr->s6_addr[0] = 0xFE;
-	ipaddr->s6_addr[1] = 0x80;
-	memcpy(&ipaddr->s6_addr[8], lladdr, EUI64_ADDR_LEN);
-	/* second bit-flip (Universe/Local)
-	 * is done according RFC2464
-	 */
-	ipaddr->s6_addr[8] ^= 0x02;
-}
-
 static inline void
 lowpan_iphc_uncompress_802154_lladdr(struct in6_addr *ipaddr,
 				     const void *lladdr)