diff options
Diffstat (limited to 'net/wimax')
-rw-r--r-- | net/wimax/op-msg.c | 27 | ||||
-rw-r--r-- | net/wimax/op-reset.c | 17 | ||||
-rw-r--r-- | net/wimax/op-rfkill.c | 21 | ||||
-rw-r--r-- | net/wimax/op-state-get.c | 17 | ||||
-rw-r--r-- | net/wimax/stack.c | 95 | ||||
-rw-r--r-- | net/wimax/wimax-internal.h | 8 |
6 files changed, 55 insertions, 130 deletions
diff --git a/net/wimax/op-msg.c b/net/wimax/op-msg.c index 0694d62e4dbc..c278b3356f75 100644 --- a/net/wimax/op-msg.c +++ b/net/wimax/op-msg.c | |||
@@ -279,7 +279,7 @@ int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb) | |||
279 | 279 | ||
280 | d_printf(1, dev, "CTX: wimax msg, %zu bytes\n", size); | 280 | d_printf(1, dev, "CTX: wimax msg, %zu bytes\n", size); |
281 | d_dump(2, dev, msg, size); | 281 | d_dump(2, dev, msg, size); |
282 | genlmsg_multicast(skb, 0, wimax_gnl_mcg.id, GFP_KERNEL); | 282 | genlmsg_multicast(&wimax_gnl_family, skb, 0, 0, GFP_KERNEL); |
283 | d_printf(1, dev, "CTX: genl multicast done\n"); | 283 | d_printf(1, dev, "CTX: genl multicast done\n"); |
284 | return 0; | 284 | return 0; |
285 | } | 285 | } |
@@ -321,17 +321,6 @@ int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name, | |||
321 | } | 321 | } |
322 | EXPORT_SYMBOL_GPL(wimax_msg); | 322 | EXPORT_SYMBOL_GPL(wimax_msg); |
323 | 323 | ||
324 | |||
325 | static const struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = { | ||
326 | [WIMAX_GNL_MSG_IFIDX] = { | ||
327 | .type = NLA_U32, | ||
328 | }, | ||
329 | [WIMAX_GNL_MSG_DATA] = { | ||
330 | .type = NLA_UNSPEC, /* libnl doesn't grok BINARY yet */ | ||
331 | }, | ||
332 | }; | ||
333 | |||
334 | |||
335 | /* | 324 | /* |
336 | * Relays a message from user space to the driver | 325 | * Relays a message from user space to the driver |
337 | * | 326 | * |
@@ -340,7 +329,6 @@ static const struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = { | |||
340 | * | 329 | * |
341 | * This call will block while handling/relaying the message. | 330 | * This call will block while handling/relaying the message. |
342 | */ | 331 | */ |
343 | static | ||
344 | int wimax_gnl_doit_msg_from_user(struct sk_buff *skb, struct genl_info *info) | 332 | int wimax_gnl_doit_msg_from_user(struct sk_buff *skb, struct genl_info *info) |
345 | { | 333 | { |
346 | int result, ifindex; | 334 | int result, ifindex; |
@@ -418,16 +406,3 @@ error_no_wimax_dev: | |||
418 | return result; | 406 | return result; |
419 | } | 407 | } |
420 | 408 | ||
421 | |||
422 | /* | ||
423 | * Generic Netlink glue | ||
424 | */ | ||
425 | |||
426 | struct genl_ops wimax_gnl_msg_from_user = { | ||
427 | .cmd = WIMAX_GNL_OP_MSG_FROM_USER, | ||
428 | .flags = GENL_ADMIN_PERM, | ||
429 | .policy = wimax_gnl_msg_policy, | ||
430 | .doit = wimax_gnl_doit_msg_from_user, | ||
431 | .dumpit = NULL, | ||
432 | }; | ||
433 | |||
diff --git a/net/wimax/op-reset.c b/net/wimax/op-reset.c index 7ceffe39d70e..eb4580784d9d 100644 --- a/net/wimax/op-reset.c +++ b/net/wimax/op-reset.c | |||
@@ -92,13 +92,6 @@ int wimax_reset(struct wimax_dev *wimax_dev) | |||
92 | EXPORT_SYMBOL(wimax_reset); | 92 | EXPORT_SYMBOL(wimax_reset); |
93 | 93 | ||
94 | 94 | ||
95 | static const struct nla_policy wimax_gnl_reset_policy[WIMAX_GNL_ATTR_MAX + 1] = { | ||
96 | [WIMAX_GNL_RESET_IFIDX] = { | ||
97 | .type = NLA_U32, | ||
98 | }, | ||
99 | }; | ||
100 | |||
101 | |||
102 | /* | 95 | /* |
103 | * Exporting to user space over generic netlink | 96 | * Exporting to user space over generic netlink |
104 | * | 97 | * |
@@ -106,7 +99,6 @@ static const struct nla_policy wimax_gnl_reset_policy[WIMAX_GNL_ATTR_MAX + 1] = | |||
106 | * | 99 | * |
107 | * No attributes. | 100 | * No attributes. |
108 | */ | 101 | */ |
109 | static | ||
110 | int wimax_gnl_doit_reset(struct sk_buff *skb, struct genl_info *info) | 102 | int wimax_gnl_doit_reset(struct sk_buff *skb, struct genl_info *info) |
111 | { | 103 | { |
112 | int result, ifindex; | 104 | int result, ifindex; |
@@ -130,12 +122,3 @@ error_no_wimax_dev: | |||
130 | d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result); | 122 | d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result); |
131 | return result; | 123 | return result; |
132 | } | 124 | } |
133 | |||
134 | |||
135 | struct genl_ops wimax_gnl_reset = { | ||
136 | .cmd = WIMAX_GNL_OP_RESET, | ||
137 | .flags = GENL_ADMIN_PERM, | ||
138 | .policy = wimax_gnl_reset_policy, | ||
139 | .doit = wimax_gnl_doit_reset, | ||
140 | .dumpit = NULL, | ||
141 | }; | ||
diff --git a/net/wimax/op-rfkill.c b/net/wimax/op-rfkill.c index 7ab60babdd22..403078d670a9 100644 --- a/net/wimax/op-rfkill.c +++ b/net/wimax/op-rfkill.c | |||
@@ -411,17 +411,6 @@ void wimax_rfkill_rm(struct wimax_dev *wimax_dev) | |||
411 | * just query). | 411 | * just query). |
412 | */ | 412 | */ |
413 | 413 | ||
414 | static const struct nla_policy wimax_gnl_rfkill_policy[WIMAX_GNL_ATTR_MAX + 1] = { | ||
415 | [WIMAX_GNL_RFKILL_IFIDX] = { | ||
416 | .type = NLA_U32, | ||
417 | }, | ||
418 | [WIMAX_GNL_RFKILL_STATE] = { | ||
419 | .type = NLA_U32 /* enum wimax_rf_state */ | ||
420 | }, | ||
421 | }; | ||
422 | |||
423 | |||
424 | static | ||
425 | int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info) | 414 | int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info) |
426 | { | 415 | { |
427 | int result, ifindex; | 416 | int result, ifindex; |
@@ -457,13 +446,3 @@ error_no_wimax_dev: | |||
457 | d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result); | 446 | d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result); |
458 | return result; | 447 | return result; |
459 | } | 448 | } |
460 | |||
461 | |||
462 | struct genl_ops wimax_gnl_rfkill = { | ||
463 | .cmd = WIMAX_GNL_OP_RFKILL, | ||
464 | .flags = GENL_ADMIN_PERM, | ||
465 | .policy = wimax_gnl_rfkill_policy, | ||
466 | .doit = wimax_gnl_doit_rfkill, | ||
467 | .dumpit = NULL, | ||
468 | }; | ||
469 | |||
diff --git a/net/wimax/op-state-get.c b/net/wimax/op-state-get.c index aff8776e2d41..995c08c827b5 100644 --- a/net/wimax/op-state-get.c +++ b/net/wimax/op-state-get.c | |||
@@ -33,13 +33,6 @@ | |||
33 | #include "debug-levels.h" | 33 | #include "debug-levels.h" |
34 | 34 | ||
35 | 35 | ||
36 | static const struct nla_policy wimax_gnl_state_get_policy[WIMAX_GNL_ATTR_MAX + 1] = { | ||
37 | [WIMAX_GNL_STGET_IFIDX] = { | ||
38 | .type = NLA_U32, | ||
39 | }, | ||
40 | }; | ||
41 | |||
42 | |||
43 | /* | 36 | /* |
44 | * Exporting to user space over generic netlink | 37 | * Exporting to user space over generic netlink |
45 | * | 38 | * |
@@ -48,7 +41,6 @@ static const struct nla_policy wimax_gnl_state_get_policy[WIMAX_GNL_ATTR_MAX + 1 | |||
48 | * | 41 | * |
49 | * No attributes. | 42 | * No attributes. |
50 | */ | 43 | */ |
51 | static | ||
52 | int wimax_gnl_doit_state_get(struct sk_buff *skb, struct genl_info *info) | 44 | int wimax_gnl_doit_state_get(struct sk_buff *skb, struct genl_info *info) |
53 | { | 45 | { |
54 | int result, ifindex; | 46 | int result, ifindex; |
@@ -72,12 +64,3 @@ error_no_wimax_dev: | |||
72 | d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result); | 64 | d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result); |
73 | return result; | 65 | return result; |
74 | } | 66 | } |
75 | |||
76 | |||
77 | struct genl_ops wimax_gnl_state_get = { | ||
78 | .cmd = WIMAX_GNL_OP_STATE_GET, | ||
79 | .flags = GENL_ADMIN_PERM, | ||
80 | .policy = wimax_gnl_state_get_policy, | ||
81 | .doit = wimax_gnl_doit_state_get, | ||
82 | .dumpit = NULL, | ||
83 | }; | ||
diff --git a/net/wimax/stack.c b/net/wimax/stack.c index a6470ac39498..ef2191b969a7 100644 --- a/net/wimax/stack.c +++ b/net/wimax/stack.c | |||
@@ -116,8 +116,9 @@ struct sk_buff *wimax_gnl_re_state_change_alloc( | |||
116 | dev_err(dev, "RE_STCH: can't create message\n"); | 116 | dev_err(dev, "RE_STCH: can't create message\n"); |
117 | goto error_new; | 117 | goto error_new; |
118 | } | 118 | } |
119 | data = genlmsg_put(report_skb, 0, wimax_gnl_mcg.id, &wimax_gnl_family, | 119 | /* FIXME: sending a group ID as the seq is wrong */ |
120 | 0, WIMAX_GNL_RE_STATE_CHANGE); | 120 | data = genlmsg_put(report_skb, 0, wimax_gnl_family.mcgrp_offset, |
121 | &wimax_gnl_family, 0, WIMAX_GNL_RE_STATE_CHANGE); | ||
121 | if (data == NULL) { | 122 | if (data == NULL) { |
122 | dev_err(dev, "RE_STCH: can't put data into message\n"); | 123 | dev_err(dev, "RE_STCH: can't put data into message\n"); |
123 | goto error_put; | 124 | goto error_put; |
@@ -177,7 +178,7 @@ int wimax_gnl_re_state_change_send( | |||
177 | goto out; | 178 | goto out; |
178 | } | 179 | } |
179 | genlmsg_end(report_skb, header); | 180 | genlmsg_end(report_skb, header); |
180 | genlmsg_multicast(report_skb, 0, wimax_gnl_mcg.id, GFP_KERNEL); | 181 | genlmsg_multicast(&wimax_gnl_family, report_skb, 0, 0, GFP_KERNEL); |
181 | out: | 182 | out: |
182 | d_fnend(3, dev, "(wimax_dev %p report_skb %p) = %d\n", | 183 | d_fnend(3, dev, "(wimax_dev %p report_skb %p) = %d\n", |
183 | wimax_dev, report_skb, result); | 184 | wimax_dev, report_skb, result); |
@@ -402,22 +403,44 @@ void wimax_dev_init(struct wimax_dev *wimax_dev) | |||
402 | } | 403 | } |
403 | EXPORT_SYMBOL_GPL(wimax_dev_init); | 404 | EXPORT_SYMBOL_GPL(wimax_dev_init); |
404 | 405 | ||
405 | /* | 406 | static const struct nla_policy wimax_gnl_policy[WIMAX_GNL_ATTR_MAX + 1] = { |
406 | * This extern is declared here because it's easier to keep track -- | 407 | [WIMAX_GNL_RESET_IFIDX] = { .type = NLA_U32, }, |
407 | * both declarations are a list of the same | 408 | [WIMAX_GNL_RFKILL_IFIDX] = { .type = NLA_U32, }, |
408 | */ | 409 | [WIMAX_GNL_RFKILL_STATE] = { |
409 | extern struct genl_ops | 410 | .type = NLA_U32 /* enum wimax_rf_state */ |
410 | wimax_gnl_msg_from_user, | 411 | }, |
411 | wimax_gnl_reset, | 412 | [WIMAX_GNL_STGET_IFIDX] = { .type = NLA_U32, }, |
412 | wimax_gnl_rfkill, | 413 | [WIMAX_GNL_MSG_IFIDX] = { .type = NLA_U32, }, |
413 | wimax_gnl_state_get; | 414 | [WIMAX_GNL_MSG_DATA] = { |
415 | .type = NLA_UNSPEC, /* libnl doesn't grok BINARY yet */ | ||
416 | }, | ||
417 | }; | ||
414 | 418 | ||
415 | static | 419 | static const struct genl_ops wimax_gnl_ops[] = { |
416 | struct genl_ops *wimax_gnl_ops[] = { | 420 | { |
417 | &wimax_gnl_msg_from_user, | 421 | .cmd = WIMAX_GNL_OP_MSG_FROM_USER, |
418 | &wimax_gnl_reset, | 422 | .flags = GENL_ADMIN_PERM, |
419 | &wimax_gnl_rfkill, | 423 | .policy = wimax_gnl_policy, |
420 | &wimax_gnl_state_get, | 424 | .doit = wimax_gnl_doit_msg_from_user, |
425 | }, | ||
426 | { | ||
427 | .cmd = WIMAX_GNL_OP_RESET, | ||
428 | .flags = GENL_ADMIN_PERM, | ||
429 | .policy = wimax_gnl_policy, | ||
430 | .doit = wimax_gnl_doit_reset, | ||
431 | }, | ||
432 | { | ||
433 | .cmd = WIMAX_GNL_OP_RFKILL, | ||
434 | .flags = GENL_ADMIN_PERM, | ||
435 | .policy = wimax_gnl_policy, | ||
436 | .doit = wimax_gnl_doit_rfkill, | ||
437 | }, | ||
438 | { | ||
439 | .cmd = WIMAX_GNL_OP_STATE_GET, | ||
440 | .flags = GENL_ADMIN_PERM, | ||
441 | .policy = wimax_gnl_policy, | ||
442 | .doit = wimax_gnl_doit_state_get, | ||
443 | }, | ||
421 | }; | 444 | }; |
422 | 445 | ||
423 | 446 | ||
@@ -557,8 +580,8 @@ struct genl_family wimax_gnl_family = { | |||
557 | .maxattr = WIMAX_GNL_ATTR_MAX, | 580 | .maxattr = WIMAX_GNL_ATTR_MAX, |
558 | }; | 581 | }; |
559 | 582 | ||
560 | struct genl_multicast_group wimax_gnl_mcg = { | 583 | static const struct genl_multicast_group wimax_gnl_mcgrps[] = { |
561 | .name = "msg", | 584 | { .name = "msg", }, |
562 | }; | 585 | }; |
563 | 586 | ||
564 | 587 | ||
@@ -567,7 +590,7 @@ struct genl_multicast_group wimax_gnl_mcg = { | |||
567 | static | 590 | static |
568 | int __init wimax_subsys_init(void) | 591 | int __init wimax_subsys_init(void) |
569 | { | 592 | { |
570 | int result, cnt; | 593 | int result; |
571 | 594 | ||
572 | d_fnstart(4, NULL, "()\n"); | 595 | d_fnstart(4, NULL, "()\n"); |
573 | d_parse_params(D_LEVEL, D_LEVEL_SIZE, wimax_debug_params, | 596 | d_parse_params(D_LEVEL, D_LEVEL_SIZE, wimax_debug_params, |
@@ -575,37 +598,18 @@ int __init wimax_subsys_init(void) | |||
575 | 598 | ||
576 | snprintf(wimax_gnl_family.name, sizeof(wimax_gnl_family.name), | 599 | snprintf(wimax_gnl_family.name, sizeof(wimax_gnl_family.name), |
577 | "WiMAX"); | 600 | "WiMAX"); |
578 | result = genl_register_family(&wimax_gnl_family); | 601 | result = genl_register_family_with_ops_groups(&wimax_gnl_family, |
602 | wimax_gnl_ops, | ||
603 | wimax_gnl_mcgrps); | ||
579 | if (unlikely(result < 0)) { | 604 | if (unlikely(result < 0)) { |
580 | printk(KERN_ERR "cannot register generic netlink family: %d\n", | 605 | printk(KERN_ERR "cannot register generic netlink family: %d\n", |
581 | result); | 606 | result); |
582 | goto error_register_family; | 607 | goto error_register_family; |
583 | } | 608 | } |
584 | 609 | ||
585 | for (cnt = 0; cnt < ARRAY_SIZE(wimax_gnl_ops); cnt++) { | ||
586 | result = genl_register_ops(&wimax_gnl_family, | ||
587 | wimax_gnl_ops[cnt]); | ||
588 | d_printf(4, NULL, "registering generic netlink op code " | ||
589 | "%u: %d\n", wimax_gnl_ops[cnt]->cmd, result); | ||
590 | if (unlikely(result < 0)) { | ||
591 | printk(KERN_ERR "cannot register generic netlink op " | ||
592 | "code %u: %d\n", | ||
593 | wimax_gnl_ops[cnt]->cmd, result); | ||
594 | goto error_register_ops; | ||
595 | } | ||
596 | } | ||
597 | |||
598 | result = genl_register_mc_group(&wimax_gnl_family, &wimax_gnl_mcg); | ||
599 | if (result < 0) | ||
600 | goto error_mc_group; | ||
601 | d_fnend(4, NULL, "() = 0\n"); | 610 | d_fnend(4, NULL, "() = 0\n"); |
602 | return 0; | 611 | return 0; |
603 | 612 | ||
604 | error_mc_group: | ||
605 | error_register_ops: | ||
606 | for (cnt--; cnt >= 0; cnt--) | ||
607 | genl_unregister_ops(&wimax_gnl_family, | ||
608 | wimax_gnl_ops[cnt]); | ||
609 | genl_unregister_family(&wimax_gnl_family); | 613 | genl_unregister_family(&wimax_gnl_family); |
610 | error_register_family: | 614 | error_register_family: |
611 | d_fnend(4, NULL, "() = %d\n", result); | 615 | d_fnend(4, NULL, "() = %d\n", result); |
@@ -619,12 +623,7 @@ module_init(wimax_subsys_init); | |||
619 | static | 623 | static |
620 | void __exit wimax_subsys_exit(void) | 624 | void __exit wimax_subsys_exit(void) |
621 | { | 625 | { |
622 | int cnt; | ||
623 | wimax_id_table_release(); | 626 | wimax_id_table_release(); |
624 | genl_unregister_mc_group(&wimax_gnl_family, &wimax_gnl_mcg); | ||
625 | for (cnt = ARRAY_SIZE(wimax_gnl_ops) - 1; cnt >= 0; cnt--) | ||
626 | genl_unregister_ops(&wimax_gnl_family, | ||
627 | wimax_gnl_ops[cnt]); | ||
628 | genl_unregister_family(&wimax_gnl_family); | 627 | genl_unregister_family(&wimax_gnl_family); |
629 | } | 628 | } |
630 | module_exit(wimax_subsys_exit); | 629 | module_exit(wimax_subsys_exit); |
diff --git a/net/wimax/wimax-internal.h b/net/wimax/wimax-internal.h index 5dcd9c067bf0..b445b82020a8 100644 --- a/net/wimax/wimax-internal.h +++ b/net/wimax/wimax-internal.h | |||
@@ -84,8 +84,14 @@ void wimax_id_table_release(void); | |||
84 | int wimax_rfkill_add(struct wimax_dev *); | 84 | int wimax_rfkill_add(struct wimax_dev *); |
85 | void wimax_rfkill_rm(struct wimax_dev *); | 85 | void wimax_rfkill_rm(struct wimax_dev *); |
86 | 86 | ||
87 | /* generic netlink */ | ||
87 | extern struct genl_family wimax_gnl_family; | 88 | extern struct genl_family wimax_gnl_family; |
88 | extern struct genl_multicast_group wimax_gnl_mcg; | 89 | |
90 | /* ops */ | ||
91 | int wimax_gnl_doit_msg_from_user(struct sk_buff *skb, struct genl_info *info); | ||
92 | int wimax_gnl_doit_reset(struct sk_buff *skb, struct genl_info *info); | ||
93 | int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info); | ||
94 | int wimax_gnl_doit_state_get(struct sk_buff *skb, struct genl_info *info); | ||
89 | 95 | ||
90 | #endif /* #ifdef __KERNEL__ */ | 96 | #endif /* #ifdef __KERNEL__ */ |
91 | #endif /* #ifndef __WIMAX_INTERNAL_H__ */ | 97 | #endif /* #ifndef __WIMAX_INTERNAL_H__ */ |