diff mbox

[RFC,bluetooth-next,04/19] ieee802154: 6lowpan: fix short addr hash

Message ID 1458652515-7862-5-git-send-email-aar@pengutronix.de (mailing list archive)
State Superseded
Headers show

Commit Message

Alexander Aring March 22, 2016, 1:15 p.m. UTC
The short address is unique in combination with the panid. This patch
will add the panid for generating an ieee802154 address hash.

Signed-off-by: Alexander Aring <aar@pengutronix.de>
---
 net/ieee802154/6lowpan/6lowpan_i.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Schmidt March 23, 2016, 9:58 a.m. UTC | #1
Hello.

On 22/03/16 14:15, Alexander Aring wrote:
> The short address is unique in combination with the panid. This patch
> will add the panid for generating an ieee802154 address hash.
>
> Signed-off-by: Alexander Aring <aar@pengutronix.de>
> ---
>   net/ieee802154/6lowpan/6lowpan_i.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ieee802154/6lowpan/6lowpan_i.h b/net/ieee802154/6lowpan/6lowpan_i.h
> index b4e17a7..b4092a9 100644
> --- a/net/ieee802154/6lowpan/6lowpan_i.h
> +++ b/net/ieee802154/6lowpan/6lowpan_i.h
> @@ -41,7 +41,7 @@ static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a)
>   		return (((__force u64)a->extended_addr) >> 32) ^
>   			(((__force u64)a->extended_addr) & 0xffffffff);
>   	case IEEE802154_ADDR_SHORT:
> -		return (__force u32)(a->short_addr);
> +		return (__force u32)(a->short_addr + (a->pan_id << 16));
>   	default:
>   		return 0;
>   	}

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/net/ieee802154/6lowpan/6lowpan_i.h b/net/ieee802154/6lowpan/6lowpan_i.h
index b4e17a7..b4092a9 100644
--- a/net/ieee802154/6lowpan/6lowpan_i.h
+++ b/net/ieee802154/6lowpan/6lowpan_i.h
@@ -41,7 +41,7 @@  static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a)
 		return (((__force u64)a->extended_addr) >> 32) ^
 			(((__force u64)a->extended_addr) & 0xffffffff);
 	case IEEE802154_ADDR_SHORT:
-		return (__force u32)(a->short_addr);
+		return (__force u32)(a->short_addr + (a->pan_id << 16));
 	default:
 		return 0;
 	}