diff options
Diffstat (limited to 'net/ieee802154')
-rw-r--r-- | net/ieee802154/6lowpan.c | 4 | ||||
-rw-r--r-- | net/ieee802154/dgram.c | 3 | ||||
-rw-r--r-- | net/ieee802154/ieee802154.h | 21 | ||||
-rw-r--r-- | net/ieee802154/netlink.c | 45 | ||||
-rw-r--r-- | net/ieee802154/nl-mac.c | 79 | ||||
-rw-r--r-- | net/ieee802154/nl-phy.c | 37 |
6 files changed, 65 insertions, 124 deletions
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 426b5df1c98f..459e200c08a4 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
@@ -956,7 +956,7 @@ lowpan_process_data(struct sk_buff *skb) | |||
956 | * Traffic class carried in-line | 956 | * Traffic class carried in-line |
957 | * ECN + DSCP (1 byte), Flow Label is elided | 957 | * ECN + DSCP (1 byte), Flow Label is elided |
958 | */ | 958 | */ |
959 | case 1: /* 10b */ | 959 | case 2: /* 10b */ |
960 | if (lowpan_fetch_skb_u8(skb, &tmp)) | 960 | if (lowpan_fetch_skb_u8(skb, &tmp)) |
961 | goto drop; | 961 | goto drop; |
962 | 962 | ||
@@ -967,7 +967,7 @@ lowpan_process_data(struct sk_buff *skb) | |||
967 | * Flow Label carried in-line | 967 | * Flow Label carried in-line |
968 | * ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided | 968 | * ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided |
969 | */ | 969 | */ |
970 | case 2: /* 01b */ | 970 | case 1: /* 01b */ |
971 | if (lowpan_fetch_skb_u8(skb, &tmp)) | 971 | if (lowpan_fetch_skb_u8(skb, &tmp)) |
972 | goto drop; | 972 | goto drop; |
973 | 973 | ||
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 581a59504bd5..1865fdf5a5a5 100644 --- a/net/ieee802154/dgram.c +++ b/net/ieee802154/dgram.c | |||
@@ -315,9 +315,8 @@ static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
315 | if (saddr) { | 315 | if (saddr) { |
316 | saddr->family = AF_IEEE802154; | 316 | saddr->family = AF_IEEE802154; |
317 | saddr->addr = mac_cb(skb)->sa; | 317 | saddr->addr = mac_cb(skb)->sa; |
318 | } | ||
319 | if (addr_len) | ||
320 | *addr_len = sizeof(*saddr); | 318 | *addr_len = sizeof(*saddr); |
319 | } | ||
321 | 320 | ||
322 | if (flags & MSG_TRUNC) | 321 | if (flags & MSG_TRUNC) |
323 | copied = skb->len; | 322 | copied = skb->len; |
diff --git a/net/ieee802154/ieee802154.h b/net/ieee802154/ieee802154.h index aadec428e6ec..cee4425b9956 100644 --- a/net/ieee802154/ieee802154.h +++ b/net/ieee802154/ieee802154.h | |||
@@ -47,7 +47,24 @@ struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info, | |||
47 | int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info); | 47 | int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info); |
48 | 48 | ||
49 | extern struct genl_family nl802154_family; | 49 | extern struct genl_family nl802154_family; |
50 | int nl802154_mac_register(void); | 50 | |
51 | int nl802154_phy_register(void); | 51 | /* genetlink ops/groups */ |
52 | int ieee802154_list_phy(struct sk_buff *skb, struct genl_info *info); | ||
53 | int ieee802154_dump_phy(struct sk_buff *skb, struct netlink_callback *cb); | ||
54 | int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info); | ||
55 | int ieee802154_del_iface(struct sk_buff *skb, struct genl_info *info); | ||
56 | |||
57 | enum ieee802154_mcgrp_ids { | ||
58 | IEEE802154_COORD_MCGRP, | ||
59 | IEEE802154_BEACON_MCGRP, | ||
60 | }; | ||
61 | |||
62 | int ieee802154_associate_req(struct sk_buff *skb, struct genl_info *info); | ||
63 | int ieee802154_associate_resp(struct sk_buff *skb, struct genl_info *info); | ||
64 | int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info); | ||
65 | int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info); | ||
66 | int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info); | ||
67 | int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info); | ||
68 | int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb); | ||
52 | 69 | ||
53 | #endif | 70 | #endif |
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c index 7e49bbcc6967..43f1b2bf469f 100644 --- a/net/ieee802154/netlink.c +++ b/net/ieee802154/netlink.c | |||
@@ -70,7 +70,7 @@ int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group) | |||
70 | if (genlmsg_end(msg, hdr) < 0) | 70 | if (genlmsg_end(msg, hdr) < 0) |
71 | goto out; | 71 | goto out; |
72 | 72 | ||
73 | return genlmsg_multicast(msg, 0, group, GFP_ATOMIC); | 73 | return genlmsg_multicast(&nl802154_family, msg, 0, group, GFP_ATOMIC); |
74 | out: | 74 | out: |
75 | nlmsg_free(msg); | 75 | nlmsg_free(msg); |
76 | return -ENOBUFS; | 76 | return -ENOBUFS; |
@@ -109,31 +109,36 @@ out: | |||
109 | return -ENOBUFS; | 109 | return -ENOBUFS; |
110 | } | 110 | } |
111 | 111 | ||
112 | int __init ieee802154_nl_init(void) | 112 | static const struct genl_ops ieee8021154_ops[] = { |
113 | { | 113 | /* see nl-phy.c */ |
114 | int rc; | 114 | IEEE802154_DUMP(IEEE802154_LIST_PHY, ieee802154_list_phy, |
115 | 115 | ieee802154_dump_phy), | |
116 | rc = genl_register_family(&nl802154_family); | 116 | IEEE802154_OP(IEEE802154_ADD_IFACE, ieee802154_add_iface), |
117 | if (rc) | 117 | IEEE802154_OP(IEEE802154_DEL_IFACE, ieee802154_del_iface), |
118 | goto fail; | 118 | /* see nl-mac.c */ |
119 | 119 | IEEE802154_OP(IEEE802154_ASSOCIATE_REQ, ieee802154_associate_req), | |
120 | rc = nl802154_mac_register(); | 120 | IEEE802154_OP(IEEE802154_ASSOCIATE_RESP, ieee802154_associate_resp), |
121 | if (rc) | 121 | IEEE802154_OP(IEEE802154_DISASSOCIATE_REQ, ieee802154_disassociate_req), |
122 | goto fail; | 122 | IEEE802154_OP(IEEE802154_SCAN_REQ, ieee802154_scan_req), |
123 | IEEE802154_OP(IEEE802154_START_REQ, ieee802154_start_req), | ||
124 | IEEE802154_DUMP(IEEE802154_LIST_IFACE, ieee802154_list_iface, | ||
125 | ieee802154_dump_iface), | ||
126 | }; | ||
123 | 127 | ||
124 | rc = nl802154_phy_register(); | 128 | static const struct genl_multicast_group ieee802154_mcgrps[] = { |
125 | if (rc) | 129 | [IEEE802154_COORD_MCGRP] = { .name = IEEE802154_MCAST_COORD_NAME, }, |
126 | goto fail; | 130 | [IEEE802154_BEACON_MCGRP] = { .name = IEEE802154_MCAST_BEACON_NAME, }, |
131 | }; | ||
127 | 132 | ||
128 | return 0; | ||
129 | 133 | ||
130 | fail: | 134 | int __init ieee802154_nl_init(void) |
131 | genl_unregister_family(&nl802154_family); | 135 | { |
132 | return rc; | 136 | return genl_register_family_with_ops_groups(&nl802154_family, |
137 | ieee8021154_ops, | ||
138 | ieee802154_mcgrps); | ||
133 | } | 139 | } |
134 | 140 | ||
135 | void __exit ieee802154_nl_exit(void) | 141 | void __exit ieee802154_nl_exit(void) |
136 | { | 142 | { |
137 | genl_unregister_family(&nl802154_family); | 143 | genl_unregister_family(&nl802154_family); |
138 | } | 144 | } |
139 | |||
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c index b0bdd8c51e9c..ba5c1e002f37 100644 --- a/net/ieee802154/nl-mac.c +++ b/net/ieee802154/nl-mac.c | |||
@@ -39,14 +39,6 @@ | |||
39 | 39 | ||
40 | #include "ieee802154.h" | 40 | #include "ieee802154.h" |
41 | 41 | ||
42 | static struct genl_multicast_group ieee802154_coord_mcgrp = { | ||
43 | .name = IEEE802154_MCAST_COORD_NAME, | ||
44 | }; | ||
45 | |||
46 | static struct genl_multicast_group ieee802154_beacon_mcgrp = { | ||
47 | .name = IEEE802154_MCAST_BEACON_NAME, | ||
48 | }; | ||
49 | |||
50 | int ieee802154_nl_assoc_indic(struct net_device *dev, | 42 | int ieee802154_nl_assoc_indic(struct net_device *dev, |
51 | struct ieee802154_addr *addr, u8 cap) | 43 | struct ieee802154_addr *addr, u8 cap) |
52 | { | 44 | { |
@@ -72,7 +64,7 @@ int ieee802154_nl_assoc_indic(struct net_device *dev, | |||
72 | nla_put_u8(msg, IEEE802154_ATTR_CAPABILITY, cap)) | 64 | nla_put_u8(msg, IEEE802154_ATTR_CAPABILITY, cap)) |
73 | goto nla_put_failure; | 65 | goto nla_put_failure; |
74 | 66 | ||
75 | return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); | 67 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
76 | 68 | ||
77 | nla_put_failure: | 69 | nla_put_failure: |
78 | nlmsg_free(msg); | 70 | nlmsg_free(msg); |
@@ -98,7 +90,7 @@ int ieee802154_nl_assoc_confirm(struct net_device *dev, u16 short_addr, | |||
98 | nla_put_u16(msg, IEEE802154_ATTR_SHORT_ADDR, short_addr) || | 90 | nla_put_u16(msg, IEEE802154_ATTR_SHORT_ADDR, short_addr) || |
99 | nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) | 91 | nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) |
100 | goto nla_put_failure; | 92 | goto nla_put_failure; |
101 | return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); | 93 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
102 | 94 | ||
103 | nla_put_failure: | 95 | nla_put_failure: |
104 | nlmsg_free(msg); | 96 | nlmsg_free(msg); |
@@ -133,7 +125,7 @@ int ieee802154_nl_disassoc_indic(struct net_device *dev, | |||
133 | } | 125 | } |
134 | if (nla_put_u8(msg, IEEE802154_ATTR_REASON, reason)) | 126 | if (nla_put_u8(msg, IEEE802154_ATTR_REASON, reason)) |
135 | goto nla_put_failure; | 127 | goto nla_put_failure; |
136 | return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); | 128 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
137 | 129 | ||
138 | nla_put_failure: | 130 | nla_put_failure: |
139 | nlmsg_free(msg); | 131 | nlmsg_free(msg); |
@@ -157,7 +149,7 @@ int ieee802154_nl_disassoc_confirm(struct net_device *dev, u8 status) | |||
157 | dev->dev_addr) || | 149 | dev->dev_addr) || |
158 | nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) | 150 | nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) |
159 | goto nla_put_failure; | 151 | goto nla_put_failure; |
160 | return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); | 152 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
161 | 153 | ||
162 | nla_put_failure: | 154 | nla_put_failure: |
163 | nlmsg_free(msg); | 155 | nlmsg_free(msg); |
@@ -183,7 +175,7 @@ int ieee802154_nl_beacon_indic(struct net_device *dev, | |||
183 | nla_put_u16(msg, IEEE802154_ATTR_COORD_SHORT_ADDR, coord_addr) || | 175 | nla_put_u16(msg, IEEE802154_ATTR_COORD_SHORT_ADDR, coord_addr) || |
184 | nla_put_u16(msg, IEEE802154_ATTR_COORD_PAN_ID, panid)) | 176 | nla_put_u16(msg, IEEE802154_ATTR_COORD_PAN_ID, panid)) |
185 | goto nla_put_failure; | 177 | goto nla_put_failure; |
186 | return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); | 178 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
187 | 179 | ||
188 | nla_put_failure: | 180 | nla_put_failure: |
189 | nlmsg_free(msg); | 181 | nlmsg_free(msg); |
@@ -214,7 +206,7 @@ int ieee802154_nl_scan_confirm(struct net_device *dev, | |||
214 | (edl && | 206 | (edl && |
215 | nla_put(msg, IEEE802154_ATTR_ED_LIST, 27, edl))) | 207 | nla_put(msg, IEEE802154_ATTR_ED_LIST, 27, edl))) |
216 | goto nla_put_failure; | 208 | goto nla_put_failure; |
217 | return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); | 209 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
218 | 210 | ||
219 | nla_put_failure: | 211 | nla_put_failure: |
220 | nlmsg_free(msg); | 212 | nlmsg_free(msg); |
@@ -238,7 +230,7 @@ int ieee802154_nl_start_confirm(struct net_device *dev, u8 status) | |||
238 | dev->dev_addr) || | 230 | dev->dev_addr) || |
239 | nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) | 231 | nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) |
240 | goto nla_put_failure; | 232 | goto nla_put_failure; |
241 | return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); | 233 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
242 | 234 | ||
243 | nla_put_failure: | 235 | nla_put_failure: |
244 | nlmsg_free(msg); | 236 | nlmsg_free(msg); |
@@ -309,8 +301,7 @@ static struct net_device *ieee802154_nl_get_dev(struct genl_info *info) | |||
309 | return dev; | 301 | return dev; |
310 | } | 302 | } |
311 | 303 | ||
312 | static int ieee802154_associate_req(struct sk_buff *skb, | 304 | int ieee802154_associate_req(struct sk_buff *skb, struct genl_info *info) |
313 | struct genl_info *info) | ||
314 | { | 305 | { |
315 | struct net_device *dev; | 306 | struct net_device *dev; |
316 | struct ieee802154_addr addr; | 307 | struct ieee802154_addr addr; |
@@ -357,8 +348,7 @@ out: | |||
357 | return ret; | 348 | return ret; |
358 | } | 349 | } |
359 | 350 | ||
360 | static int ieee802154_associate_resp(struct sk_buff *skb, | 351 | int ieee802154_associate_resp(struct sk_buff *skb, struct genl_info *info) |
361 | struct genl_info *info) | ||
362 | { | 352 | { |
363 | struct net_device *dev; | 353 | struct net_device *dev; |
364 | struct ieee802154_addr addr; | 354 | struct ieee802154_addr addr; |
@@ -390,8 +380,7 @@ out: | |||
390 | return ret; | 380 | return ret; |
391 | } | 381 | } |
392 | 382 | ||
393 | static int ieee802154_disassociate_req(struct sk_buff *skb, | 383 | int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info) |
394 | struct genl_info *info) | ||
395 | { | 384 | { |
396 | struct net_device *dev; | 385 | struct net_device *dev; |
397 | struct ieee802154_addr addr; | 386 | struct ieee802154_addr addr; |
@@ -433,7 +422,7 @@ out: | |||
433 | * PAN_coordinator, battery_life_extension = 0, | 422 | * PAN_coordinator, battery_life_extension = 0, |
434 | * coord_realignment = 0, security_enable = 0 | 423 | * coord_realignment = 0, security_enable = 0 |
435 | */ | 424 | */ |
436 | static int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info) | 425 | int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info) |
437 | { | 426 | { |
438 | struct net_device *dev; | 427 | struct net_device *dev; |
439 | struct ieee802154_addr addr; | 428 | struct ieee802154_addr addr; |
@@ -492,7 +481,7 @@ out: | |||
492 | return ret; | 481 | return ret; |
493 | } | 482 | } |
494 | 483 | ||
495 | static int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info) | 484 | int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info) |
496 | { | 485 | { |
497 | struct net_device *dev; | 486 | struct net_device *dev; |
498 | int ret = -EOPNOTSUPP; | 487 | int ret = -EOPNOTSUPP; |
@@ -530,8 +519,7 @@ out: | |||
530 | return ret; | 519 | return ret; |
531 | } | 520 | } |
532 | 521 | ||
533 | static int ieee802154_list_iface(struct sk_buff *skb, | 522 | int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info) |
534 | struct genl_info *info) | ||
535 | { | 523 | { |
536 | /* Request for interface name, index, type, IEEE address, | 524 | /* Request for interface name, index, type, IEEE address, |
537 | PAN Id, short address */ | 525 | PAN Id, short address */ |
@@ -565,8 +553,7 @@ out_dev: | |||
565 | 553 | ||
566 | } | 554 | } |
567 | 555 | ||
568 | static int ieee802154_dump_iface(struct sk_buff *skb, | 556 | int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb) |
569 | struct netlink_callback *cb) | ||
570 | { | 557 | { |
571 | struct net *net = sock_net(skb->sk); | 558 | struct net *net = sock_net(skb->sk); |
572 | struct net_device *dev; | 559 | struct net_device *dev; |
@@ -590,41 +577,3 @@ cont: | |||
590 | 577 | ||
591 | return skb->len; | 578 | return skb->len; |
592 | } | 579 | } |
593 | |||
594 | static struct genl_ops ieee802154_coordinator_ops[] = { | ||
595 | IEEE802154_OP(IEEE802154_ASSOCIATE_REQ, ieee802154_associate_req), | ||
596 | IEEE802154_OP(IEEE802154_ASSOCIATE_RESP, ieee802154_associate_resp), | ||
597 | IEEE802154_OP(IEEE802154_DISASSOCIATE_REQ, ieee802154_disassociate_req), | ||
598 | IEEE802154_OP(IEEE802154_SCAN_REQ, ieee802154_scan_req), | ||
599 | IEEE802154_OP(IEEE802154_START_REQ, ieee802154_start_req), | ||
600 | IEEE802154_DUMP(IEEE802154_LIST_IFACE, ieee802154_list_iface, | ||
601 | ieee802154_dump_iface), | ||
602 | }; | ||
603 | |||
604 | /* | ||
605 | * No need to unregister as family unregistration will do it. | ||
606 | */ | ||
607 | int nl802154_mac_register(void) | ||
608 | { | ||
609 | int i; | ||
610 | int rc; | ||
611 | |||
612 | rc = genl_register_mc_group(&nl802154_family, | ||
613 | &ieee802154_coord_mcgrp); | ||
614 | if (rc) | ||
615 | return rc; | ||
616 | |||
617 | rc = genl_register_mc_group(&nl802154_family, | ||
618 | &ieee802154_beacon_mcgrp); | ||
619 | if (rc) | ||
620 | return rc; | ||
621 | |||
622 | for (i = 0; i < ARRAY_SIZE(ieee802154_coordinator_ops); i++) { | ||
623 | rc = genl_register_ops(&nl802154_family, | ||
624 | &ieee802154_coordinator_ops[i]); | ||
625 | if (rc) | ||
626 | return rc; | ||
627 | } | ||
628 | |||
629 | return 0; | ||
630 | } | ||
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c index 22b1a7058fd3..d08c7a43dcd1 100644 --- a/net/ieee802154/nl-phy.c +++ b/net/ieee802154/nl-phy.c | |||
@@ -77,8 +77,7 @@ out: | |||
77 | return -EMSGSIZE; | 77 | return -EMSGSIZE; |
78 | } | 78 | } |
79 | 79 | ||
80 | static int ieee802154_list_phy(struct sk_buff *skb, | 80 | int ieee802154_list_phy(struct sk_buff *skb, struct genl_info *info) |
81 | struct genl_info *info) | ||
82 | { | 81 | { |
83 | /* Request for interface name, index, type, IEEE address, | 82 | /* Request for interface name, index, type, IEEE address, |
84 | PAN Id, short address */ | 83 | PAN Id, short address */ |
@@ -151,8 +150,7 @@ static int ieee802154_dump_phy_iter(struct wpan_phy *phy, void *_data) | |||
151 | return 0; | 150 | return 0; |
152 | } | 151 | } |
153 | 152 | ||
154 | static int ieee802154_dump_phy(struct sk_buff *skb, | 153 | int ieee802154_dump_phy(struct sk_buff *skb, struct netlink_callback *cb) |
155 | struct netlink_callback *cb) | ||
156 | { | 154 | { |
157 | struct dump_phy_data data = { | 155 | struct dump_phy_data data = { |
158 | .cb = cb, | 156 | .cb = cb, |
@@ -170,8 +168,7 @@ static int ieee802154_dump_phy(struct sk_buff *skb, | |||
170 | return skb->len; | 168 | return skb->len; |
171 | } | 169 | } |
172 | 170 | ||
173 | static int ieee802154_add_iface(struct sk_buff *skb, | 171 | int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info) |
174 | struct genl_info *info) | ||
175 | { | 172 | { |
176 | struct sk_buff *msg; | 173 | struct sk_buff *msg; |
177 | struct wpan_phy *phy; | 174 | struct wpan_phy *phy; |
@@ -273,8 +270,7 @@ out_dev: | |||
273 | return rc; | 270 | return rc; |
274 | } | 271 | } |
275 | 272 | ||
276 | static int ieee802154_del_iface(struct sk_buff *skb, | 273 | int ieee802154_del_iface(struct sk_buff *skb, struct genl_info *info) |
277 | struct genl_info *info) | ||
278 | { | 274 | { |
279 | struct sk_buff *msg; | 275 | struct sk_buff *msg; |
280 | struct wpan_phy *phy; | 276 | struct wpan_phy *phy; |
@@ -356,28 +352,3 @@ out_dev: | |||
356 | 352 | ||
357 | return rc; | 353 | return rc; |
358 | } | 354 | } |
359 | |||
360 | static struct genl_ops ieee802154_phy_ops[] = { | ||
361 | IEEE802154_DUMP(IEEE802154_LIST_PHY, ieee802154_list_phy, | ||
362 | ieee802154_dump_phy), | ||
363 | IEEE802154_OP(IEEE802154_ADD_IFACE, ieee802154_add_iface), | ||
364 | IEEE802154_OP(IEEE802154_DEL_IFACE, ieee802154_del_iface), | ||
365 | }; | ||
366 | |||
367 | /* | ||
368 | * No need to unregister as family unregistration will do it. | ||
369 | */ | ||
370 | int nl802154_phy_register(void) | ||
371 | { | ||
372 | int i; | ||
373 | int rc; | ||
374 | |||
375 | for (i = 0; i < ARRAY_SIZE(ieee802154_phy_ops); i++) { | ||
376 | rc = genl_register_ops(&nl802154_family, | ||
377 | &ieee802154_phy_ops[i]); | ||
378 | if (rc) | ||
379 | return rc; | ||
380 | } | ||
381 | |||
382 | return 0; | ||
383 | } | ||