Skip to content

Commit 376b7bd

Browse files
Phoebe Buckheisterdavem330
authored andcommitted
ieee802154: rename struct ieee802154_addr to *_sa
The struct as currently defined uses host byte order for some fields, and most big endian/EUI display byte order for other fields. Inside the stack, endianness should ideally match network byte order where possible to minimize the number of byteswaps done in critical paths, but this patch does not address this; it is only preparatory. Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1779432 commit 376b7bd

13 files changed

Lines changed: 49 additions & 48 deletions

File tree

‎drivers/net/ieee802154/fakehard.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static u8 fake_get_dsn(const struct net_device *dev)
119119
* 802.15.4-2006 document.
120120
*/
121121
static int fake_assoc_req(struct net_device *dev,
122-
struct ieee802154_addr *addr, u8 channel, u8 page, u8 cap)
122+
struct ieee802154_addr_sa *addr, u8 channel, u8 page, u8 cap)
123123
{
124124
struct wpan_phy *phy = fake_to_phy(dev);
125125

@@ -149,7 +149,7 @@ static int fake_assoc_req(struct net_device *dev,
149149
* 802.15.4-2006 document.
150150
*/
151151
static int fake_assoc_resp(struct net_device *dev,
152-
struct ieee802154_addr *addr, u16 short_addr, u8 status)
152+
struct ieee802154_addr_sa *addr, u16 short_addr, u8 status)
153153
{
154154
return 0;
155155
}
@@ -167,7 +167,7 @@ static int fake_assoc_resp(struct net_device *dev,
167167
* document, with the reason described in 7.3.3.2.
168168
*/
169169
static int fake_disassoc_req(struct net_device *dev,
170-
struct ieee802154_addr *addr, u8 reason)
170+
struct ieee802154_addr_sa *addr, u8 reason)
171171
{
172172
return ieee802154_nl_disassoc_confirm(dev, IEEE802154_SUCCESS);
173173
}
@@ -191,10 +191,10 @@ static int fake_disassoc_req(struct net_device *dev,
191191
* Note: This is in section 7.5.2.3 of the IEEE 802.15.4-2006
192192
* document, with 7.3.8 describing coordinator realignment.
193193
*/
194-
static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr,
195-
u8 channel, u8 page,
196-
u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx,
197-
u8 coord_realign)
194+
static int fake_start_req(struct net_device *dev,
195+
struct ieee802154_addr_sa *addr, u8 channel, u8 page,
196+
u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx,
197+
u8 coord_realign)
198198
{
199199
struct wpan_phy *phy = fake_to_phy(dev);
200200

‎include/net/af_ieee802154.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ enum {
3636
/* address length, octets */
3737
#define IEEE802154_ADDR_LEN 8
3838

39-
struct ieee802154_addr {
39+
struct ieee802154_addr_sa {
4040
int addr_type;
4141
u16 pan_id;
4242
union {
@@ -51,7 +51,7 @@ struct ieee802154_addr {
5151

5252
struct sockaddr_ieee802154 {
5353
sa_family_t family; /* AF_IEEE802154 */
54-
struct ieee802154_addr addr;
54+
struct ieee802154_addr_sa addr;
5555
};
5656

5757
/* get/setsockopt */

‎include/net/ieee802154_netdev.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ struct ieee802154_frag_info {
4141
*/
4242
struct ieee802154_mac_cb {
4343
u8 lqi;
44-
struct ieee802154_addr sa;
45-
struct ieee802154_addr da;
44+
struct ieee802154_addr_sa sa;
45+
struct ieee802154_addr_sa da;
4646
u8 flags;
4747
u8 seq;
4848
struct ieee802154_frag_info frag_info;
@@ -95,16 +95,16 @@ struct ieee802154_mlme_ops {
9595
/* The following fields are optional (can be NULL). */
9696

9797
int (*assoc_req)(struct net_device *dev,
98-
struct ieee802154_addr *addr,
98+
struct ieee802154_addr_sa *addr,
9999
u8 channel, u8 page, u8 cap);
100100
int (*assoc_resp)(struct net_device *dev,
101-
struct ieee802154_addr *addr,
101+
struct ieee802154_addr_sa *addr,
102102
u16 short_addr, u8 status);
103103
int (*disassoc_req)(struct net_device *dev,
104-
struct ieee802154_addr *addr,
104+
struct ieee802154_addr_sa *addr,
105105
u8 reason);
106106
int (*start_req)(struct net_device *dev,
107-
struct ieee802154_addr *addr,
107+
struct ieee802154_addr_sa *addr,
108108
u8 channel, u8 page, u8 bcn_ord, u8 sf_ord,
109109
u8 pan_coord, u8 blx, u8 coord_realign);
110110
int (*scan_req)(struct net_device *dev,

‎include/net/nl802154.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#define IEEE802154_NL_H
2323

2424
struct net_device;
25-
struct ieee802154_addr;
25+
struct ieee802154_addr_sa;
2626

2727
/**
2828
* ieee802154_nl_assoc_indic - Notify userland of an association request.
@@ -37,7 +37,7 @@ struct ieee802154_addr;
3737
* Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document.
3838
*/
3939
int ieee802154_nl_assoc_indic(struct net_device *dev,
40-
struct ieee802154_addr *addr, u8 cap);
40+
struct ieee802154_addr_sa *addr, u8 cap);
4141

4242
/**
4343
* ieee802154_nl_assoc_confirm - Notify userland of association.
@@ -65,7 +65,7 @@ int ieee802154_nl_assoc_confirm(struct net_device *dev,
6565
* Note: This is in section 7.3.3 of the IEEE 802.15.4 document.
6666
*/
6767
int ieee802154_nl_disassoc_indic(struct net_device *dev,
68-
struct ieee802154_addr *addr, u8 reason);
68+
struct ieee802154_addr_sa *addr, u8 reason);
6969

7070
/**
7171
* ieee802154_nl_disassoc_confirm - Notify userland of disassociation

‎net/ieee802154/6lowpan_rtnl.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static int lowpan_header_create(struct sk_buff *skb,
9191
{
9292
const u8 *saddr = _saddr;
9393
const u8 *daddr = _daddr;
94-
struct ieee802154_addr sa, da;
94+
struct ieee802154_addr_sa sa, da;
9595

9696
/* TODO:
9797
* if this package isn't ipv6 one, where should it be routed?
@@ -171,7 +171,7 @@ static int lowpan_give_skb_to_devices(struct sk_buff *skb,
171171
static int process_data(struct sk_buff *skb)
172172
{
173173
u8 iphc0, iphc1;
174-
const struct ieee802154_addr *_saddr, *_daddr;
174+
const struct ieee802154_addr_sa *_saddr, *_daddr;
175175

176176
raw_dump_table(__func__, "raw skb data dump", skb->data, skb->len);
177177
/* at least two bytes will be used for the encoding */

‎net/ieee802154/af802154.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ extern struct proto ieee802154_dgram_prot;
3131
void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb);
3232
int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb);
3333
struct net_device *ieee802154_get_dev(struct net *net,
34-
struct ieee802154_addr *addr);
34+
struct ieee802154_addr_sa *addr);
3535

3636
#endif

‎net/ieee802154/af_ieee802154.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* Utility function for families
4545
*/
4646
struct net_device *ieee802154_get_dev(struct net *net,
47-
struct ieee802154_addr *addr)
47+
struct ieee802154_addr_sa *addr)
4848
{
4949
struct net_device *dev = NULL;
5050
struct net_device *tmp;

‎net/ieee802154/dgram.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ static DEFINE_RWLOCK(dgram_lock);
4141
struct dgram_sock {
4242
struct sock sk;
4343

44-
struct ieee802154_addr src_addr;
45-
struct ieee802154_addr dst_addr;
44+
struct ieee802154_addr_sa src_addr;
45+
struct ieee802154_addr_sa dst_addr;
4646

4747
unsigned int bound:1;
4848
unsigned int want_ack:1;
@@ -113,7 +113,7 @@ static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len)
113113
goto out_put;
114114
}
115115

116-
memcpy(&ro->src_addr, &addr->addr, sizeof(struct ieee802154_addr));
116+
memcpy(&ro->src_addr, &addr->addr, sizeof(struct ieee802154_addr_sa));
117117

118118
ro->bound = 1;
119119
err = 0;
@@ -181,7 +181,7 @@ static int dgram_connect(struct sock *sk, struct sockaddr *uaddr,
181181
goto out;
182182
}
183183

184-
memcpy(&ro->dst_addr, &addr->addr, sizeof(struct ieee802154_addr));
184+
memcpy(&ro->dst_addr, &addr->addr, sizeof(struct ieee802154_addr_sa));
185185

186186
out:
187187
release_sock(sk);

‎net/ieee802154/nl-mac.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "ieee802154.h"
4141

4242
int ieee802154_nl_assoc_indic(struct net_device *dev,
43-
struct ieee802154_addr *addr, u8 cap)
43+
struct ieee802154_addr_sa *addr, u8 cap)
4444
{
4545
struct sk_buff *msg;
4646

@@ -99,7 +99,7 @@ int ieee802154_nl_assoc_confirm(struct net_device *dev, u16 short_addr,
9999
EXPORT_SYMBOL(ieee802154_nl_assoc_confirm);
100100

101101
int ieee802154_nl_disassoc_indic(struct net_device *dev,
102-
struct ieee802154_addr *addr, u8 reason)
102+
struct ieee802154_addr_sa *addr, u8 reason)
103103
{
104104
struct sk_buff *msg;
105105

@@ -304,7 +304,7 @@ static struct net_device *ieee802154_nl_get_dev(struct genl_info *info)
304304
int ieee802154_associate_req(struct sk_buff *skb, struct genl_info *info)
305305
{
306306
struct net_device *dev;
307-
struct ieee802154_addr addr;
307+
struct ieee802154_addr_sa addr;
308308
u8 page;
309309
int ret = -EOPNOTSUPP;
310310

@@ -351,7 +351,7 @@ int ieee802154_associate_req(struct sk_buff *skb, struct genl_info *info)
351351
int ieee802154_associate_resp(struct sk_buff *skb, struct genl_info *info)
352352
{
353353
struct net_device *dev;
354-
struct ieee802154_addr addr;
354+
struct ieee802154_addr_sa addr;
355355
int ret = -EOPNOTSUPP;
356356

357357
if (!info->attrs[IEEE802154_ATTR_STATUS] ||
@@ -383,7 +383,7 @@ int ieee802154_associate_resp(struct sk_buff *skb, struct genl_info *info)
383383
int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info)
384384
{
385385
struct net_device *dev;
386-
struct ieee802154_addr addr;
386+
struct ieee802154_addr_sa addr;
387387
int ret = -EOPNOTSUPP;
388388

389389
if ((!info->attrs[IEEE802154_ATTR_DEST_HW_ADDR] &&
@@ -425,7 +425,7 @@ int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info)
425425
int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info)
426426
{
427427
struct net_device *dev;
428-
struct ieee802154_addr addr;
428+
struct ieee802154_addr_sa addr;
429429

430430
u8 channel, bcn_ord, sf_ord;
431431
u8 page;

‎net/ieee802154/reassembly.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ static int lowpan_frag_reasm(struct lowpan_frag_queue *fq,
3636
struct sk_buff *prev, struct net_device *dev);
3737

3838
static unsigned int lowpan_hash_frag(__be16 tag, u16 d_size,
39-
const struct ieee802154_addr *saddr,
40-
const struct ieee802154_addr *daddr)
39+
const struct ieee802154_addr_sa *saddr,
40+
const struct ieee802154_addr_sa *daddr)
4141
{
4242
u32 c;
4343

@@ -103,7 +103,7 @@ static void lowpan_frag_expire(unsigned long data)
103103

104104
static inline struct lowpan_frag_queue *
105105
fq_find(struct net *net, const struct ieee802154_frag_info *frag_info,
106-
const struct ieee802154_addr *src, const struct ieee802154_addr *dst)
106+
const struct ieee802154_addr_sa *src, const struct ieee802154_addr_sa *dst)
107107
{
108108
struct inet_frag_queue *q;
109109
struct lowpan_create_arg arg;

0 commit comments

Comments
 (0)