diff options
Diffstat (limited to 'net/wimax/stack.c')
-rw-r--r-- | net/wimax/stack.c | 95 |
1 files changed, 47 insertions, 48 deletions
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); |