linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes
@ 2015-09-24  7:37 Alexander Aring
  2015-09-24  7:37 ` [PATCH bluetooth-next 2/2] mac802154: iface: assume big endian for af_packet Alexander Aring
  2015-09-24 18:43 ` [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Aring @ 2015-09-24  7:37 UTC (permalink / raw)
  To: linux-wpan; +Cc: kernel, Alexander Aring

This patch removes some unnecessary includes from ieee802154 header,
which was introduced by commit b609fb54adfa ("ieee802154: add helpers for
frame control checks").

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 include/linux/ieee802154.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
index aca228b..d3e4156 100644
--- a/include/linux/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -25,9 +25,6 @@
 
 #include <linux/types.h>
 #include <linux/random.h>
-#include <linux/skbuff.h>
-#include <linux/unaligned/memmove.h>
-#include <asm/byteorder.h>
 
 #define IEEE802154_MTU			127
 #define IEEE802154_ACK_PSDU_LEN		5
-- 
2.5.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH bluetooth-next 2/2] mac802154: iface: assume big endian for af_packet
  2015-09-24  7:37 [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes Alexander Aring
@ 2015-09-24  7:37 ` Alexander Aring
  2015-09-24 18:44   ` Marcel Holtmann
  2015-09-24 18:43 ` [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Aring @ 2015-09-24  7:37 UTC (permalink / raw)
  To: linux-wpan; +Cc: kernel, Alexander Aring

The callback "create" and "parse" from header_ops are called from
netdev core upper-layer functionality, like af_packet. These callbacks
assumes big endian for addresses and we should not introduce a special
byteordering handling for ieee802154 over af_packet in userspace.

We have an identical issue with setting the mac address which also
assumes big endian byteordering.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/iface.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index b5a0936..3954bcf 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -461,7 +461,7 @@ static int mac802154_header_create(struct sk_buff *skb,
 
 	hdr.dest.pan_id = wpan_dev->pan_id;
 	hdr.dest.mode = IEEE802154_ADDR_LONG;
-	memcpy(&hdr.dest.extended_addr, daddr, IEEE802154_EXTENDED_ADDR_LEN);
+	ieee802154_be64_to_le64(&hdr.dest.extended_addr, daddr);
 
 	hdr.source.pan_id = hdr.dest.pan_id;
 	hdr.source.mode = IEEE802154_ADDR_LONG;
@@ -469,8 +469,7 @@ static int mac802154_header_create(struct sk_buff *skb,
 	if (!saddr)
 		hdr.source.extended_addr = wpan_dev->extended_addr;
 	else
-		memcpy(&hdr.source.extended_addr, saddr,
-		       IEEE802154_EXTENDED_ADDR_LEN);
+		ieee802154_be64_to_le64(&hdr.source.extended_addr, saddr);
 
 	hlen = ieee802154_hdr_push(skb, &hdr);
 	if (hlen < 0)
@@ -496,8 +495,7 @@ mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
 	}
 
 	if (hdr.source.mode == IEEE802154_ADDR_LONG) {
-		memcpy(haddr, &hdr.source.extended_addr,
-		       IEEE802154_EXTENDED_ADDR_LEN);
+		ieee802154_le64_to_be64(haddr, &hdr.source.extended_addr);
 		return IEEE802154_EXTENDED_ADDR_LEN;
 	}
 
-- 
2.5.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes
  2015-09-24  7:37 [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes Alexander Aring
  2015-09-24  7:37 ` [PATCH bluetooth-next 2/2] mac802154: iface: assume big endian for af_packet Alexander Aring
@ 2015-09-24 18:43 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2015-09-24 18:43 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan, kernel

Hi Alex,

> This patch removes some unnecessary includes from ieee802154 header,
> which was introduced by commit b609fb54adfa ("ieee802154: add helpers for
> frame control checks").
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> include/linux/ieee802154.h | 3 ---
> 1 file changed, 3 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bluetooth-next 2/2] mac802154: iface: assume big endian for af_packet
  2015-09-24  7:37 ` [PATCH bluetooth-next 2/2] mac802154: iface: assume big endian for af_packet Alexander Aring
@ 2015-09-24 18:44   ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2015-09-24 18:44 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan, kernel

Hi Alex,

> The callback "create" and "parse" from header_ops are called from
> netdev core upper-layer functionality, like af_packet. These callbacks
> assumes big endian for addresses and we should not introduce a special
> byteordering handling for ieee802154 over af_packet in userspace.
> 
> We have an identical issue with setting the mac address which also
> assumes big endian byteordering.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> net/mac802154/iface.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-24 18:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24  7:37 [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes Alexander Aring
2015-09-24  7:37 ` [PATCH bluetooth-next 2/2] mac802154: iface: assume big endian for af_packet Alexander Aring
2015-09-24 18:44   ` Marcel Holtmann
2015-09-24 18:43 ` [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).