diff options
author | Dan Williams <dcbw@redhat.com> | 2010-07-27 16:01:47 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-07-27 15:11:20 -0400 |
commit | 52148655608b31b7e18325ae7711de3a86466136 (patch) | |
tree | 687f215d2cf0aa9de97fe410bb64791441f23519 /drivers/net/wireless/libertas | |
parent | 4c7c6e00f17365633638848197c44552dd353d49 (diff) |
libertas: convert Mesh Blinding Table access to a direct command
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/host.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/mesh.c | 182 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/mesh.h | 8 |
5 files changed, 158 insertions, 46 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index b8df1fd89240..dd25b2a9dbeb 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -1208,10 +1208,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, | |||
1208 | 1208 | ||
1209 | #ifdef CONFIG_LIBERTAS_MESH | 1209 | #ifdef CONFIG_LIBERTAS_MESH |
1210 | 1210 | ||
1211 | case CMD_BT_ACCESS: | ||
1212 | ret = lbs_cmd_bt_access(cmdptr, cmd_action, pdata_buf); | ||
1213 | break; | ||
1214 | |||
1215 | case CMD_FWT_ACCESS: | 1211 | case CMD_FWT_ACCESS: |
1216 | ret = lbs_cmd_fwt_access(cmdptr, cmd_action, pdata_buf); | 1212 | ret = lbs_cmd_fwt_access(cmdptr, cmd_action, pdata_buf); |
1217 | break; | 1213 | break; |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 810d75882e79..098b6453cb09 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -68,13 +68,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, | |||
68 | case CMD_RET(CMD_802_11_BEACON_STOP): | 68 | case CMD_RET(CMD_802_11_BEACON_STOP): |
69 | break; | 69 | break; |
70 | 70 | ||
71 | case CMD_RET(CMD_BT_ACCESS): | ||
72 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
73 | if (priv->cur_cmd->callback_arg) | ||
74 | memcpy((void *)priv->cur_cmd->callback_arg, | ||
75 | &resp->params.bt.addr1, 2 * ETH_ALEN); | ||
76 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
77 | break; | ||
78 | case CMD_RET(CMD_FWT_ACCESS): | 71 | case CMD_RET(CMD_FWT_ACCESS): |
79 | spin_lock_irqsave(&priv->driver_lock, flags); | 72 | spin_lock_irqsave(&priv->driver_lock, flags); |
80 | if (priv->cur_cmd->callback_arg) | 73 | if (priv->cur_cmd->callback_arg) |
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 0a4ddc1cdd6c..e8171777846a 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h | |||
@@ -903,6 +903,8 @@ struct cmd_ds_get_tsf { | |||
903 | } __packed; | 903 | } __packed; |
904 | 904 | ||
905 | struct cmd_ds_bt_access { | 905 | struct cmd_ds_bt_access { |
906 | struct cmd_header hdr; | ||
907 | |||
906 | __le16 action; | 908 | __le16 action; |
907 | __le32 id; | 909 | __le32 id; |
908 | u8 addr1[ETH_ALEN]; | 910 | u8 addr1[ETH_ALEN]; |
@@ -959,7 +961,6 @@ struct cmd_ds_command { | |||
959 | /* command Body */ | 961 | /* command Body */ |
960 | union { | 962 | union { |
961 | struct cmd_ds_802_11_ps_mode psmode; | 963 | struct cmd_ds_802_11_ps_mode psmode; |
962 | struct cmd_ds_bt_access bt; | ||
963 | struct cmd_ds_fwt_access fwt; | 964 | struct cmd_ds_fwt_access fwt; |
964 | } params; | 965 | } params; |
965 | } __packed; | 966 | } __packed; |
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index bc5bc1384c35..35ee574f588f 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
@@ -455,44 +455,162 @@ void lbs_mesh_set_txpd(struct lbs_private *priv, | |||
455 | * Mesh command handling | 455 | * Mesh command handling |
456 | */ | 456 | */ |
457 | 457 | ||
458 | int lbs_cmd_bt_access(struct cmd_ds_command *cmd, | 458 | /** |
459 | u16 cmd_action, void *pdata_buf) | 459 | * @brief Add or delete Mesh Blinding Table entries |
460 | * | ||
461 | * @param priv A pointer to struct lbs_private structure | ||
462 | * @param add TRUE to add the entry, FALSE to delete it | ||
463 | * @param addr1 Destination address to blind or unblind | ||
464 | * | ||
465 | * @return 0 on success, error on failure | ||
466 | */ | ||
467 | int lbs_mesh_bt_add_del(struct lbs_private *priv, bool add, u8 *addr1) | ||
460 | { | 468 | { |
461 | struct cmd_ds_bt_access *bt_access = &cmd->params.bt; | 469 | struct cmd_ds_bt_access cmd; |
462 | lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); | 470 | int ret = 0; |
463 | 471 | ||
464 | cmd->command = cpu_to_le16(CMD_BT_ACCESS); | 472 | lbs_deb_enter(LBS_DEB_CMD); |
465 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + | 473 | |
466 | sizeof(struct cmd_header)); | 474 | BUG_ON(addr1 == NULL); |
467 | cmd->result = 0; | ||
468 | bt_access->action = cpu_to_le16(cmd_action); | ||
469 | 475 | ||
470 | switch (cmd_action) { | 476 | memset(&cmd, 0, sizeof(cmd)); |
471 | case CMD_ACT_BT_ACCESS_ADD: | 477 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
472 | memcpy(bt_access->addr1, pdata_buf, 2 * ETH_ALEN); | 478 | memcpy(cmd.addr1, addr1, ETH_ALEN); |
479 | if (add) { | ||
480 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_ADD); | ||
473 | lbs_deb_hex(LBS_DEB_MESH, "BT_ADD: blinded MAC addr", | 481 | lbs_deb_hex(LBS_DEB_MESH, "BT_ADD: blinded MAC addr", |
474 | bt_access->addr1, 6); | 482 | addr1, ETH_ALEN); |
475 | break; | 483 | } else { |
476 | case CMD_ACT_BT_ACCESS_DEL: | 484 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_DEL); |
477 | memcpy(bt_access->addr1, pdata_buf, 1 * ETH_ALEN); | ||
478 | lbs_deb_hex(LBS_DEB_MESH, "BT_DEL: blinded MAC addr", | 485 | lbs_deb_hex(LBS_DEB_MESH, "BT_DEL: blinded MAC addr", |
479 | bt_access->addr1, 6); | 486 | addr1, ETH_ALEN); |
480 | break; | ||
481 | case CMD_ACT_BT_ACCESS_LIST: | ||
482 | bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); | ||
483 | break; | ||
484 | case CMD_ACT_BT_ACCESS_RESET: | ||
485 | break; | ||
486 | case CMD_ACT_BT_ACCESS_SET_INVERT: | ||
487 | bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); | ||
488 | break; | ||
489 | case CMD_ACT_BT_ACCESS_GET_INVERT: | ||
490 | break; | ||
491 | default: | ||
492 | break; | ||
493 | } | 487 | } |
494 | lbs_deb_leave(LBS_DEB_CMD); | 488 | |
495 | return 0; | 489 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); |
490 | |||
491 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
492 | return ret; | ||
493 | } | ||
494 | |||
495 | /** | ||
496 | * @brief Reset/clear the mesh blinding table | ||
497 | * | ||
498 | * @param priv A pointer to struct lbs_private structure | ||
499 | * | ||
500 | * @return 0 on success, error on failure | ||
501 | */ | ||
502 | int lbs_mesh_bt_reset(struct lbs_private *priv) | ||
503 | { | ||
504 | struct cmd_ds_bt_access cmd; | ||
505 | int ret = 0; | ||
506 | |||
507 | lbs_deb_enter(LBS_DEB_CMD); | ||
508 | |||
509 | memset(&cmd, 0, sizeof(cmd)); | ||
510 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
511 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_RESET); | ||
512 | |||
513 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); | ||
514 | |||
515 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
516 | return ret; | ||
517 | } | ||
518 | |||
519 | /** | ||
520 | * @brief Gets the inverted status of the mesh blinding table | ||
521 | * | ||
522 | * Normally the firmware "blinds" or ignores traffic from mesh nodes in the | ||
523 | * table, but an inverted table allows *only* traffic from nodes listed in | ||
524 | * the table. | ||
525 | * | ||
526 | * @param priv A pointer to struct lbs_private structure | ||
527 | * @param invert On success, TRUE if the blinding table is inverted, | ||
528 | * FALSE if it is not inverted | ||
529 | * | ||
530 | * @return 0 on success, error on failure | ||
531 | */ | ||
532 | int lbs_mesh_bt_get_inverted(struct lbs_private *priv, bool *inverted) | ||
533 | { | ||
534 | struct cmd_ds_bt_access cmd; | ||
535 | int ret = 0; | ||
536 | |||
537 | lbs_deb_enter(LBS_DEB_CMD); | ||
538 | |||
539 | BUG_ON(inverted == NULL); | ||
540 | |||
541 | memset(&cmd, 0, sizeof(cmd)); | ||
542 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
543 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_GET_INVERT); | ||
544 | |||
545 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); | ||
546 | if (ret == 0) | ||
547 | *inverted = !!cmd.id; | ||
548 | |||
549 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
550 | return ret; | ||
551 | } | ||
552 | |||
553 | /** | ||
554 | * @brief Sets the inverted status of the mesh blinding table | ||
555 | * | ||
556 | * Normally the firmware "blinds" or ignores traffic from mesh nodes in the | ||
557 | * table, but an inverted table allows *only* traffic from nodes listed in | ||
558 | * the table. | ||
559 | * | ||
560 | * @param priv A pointer to struct lbs_private structure | ||
561 | * @param invert TRUE to invert the blinding table (only traffic from | ||
562 | * listed nodes allowed), FALSE to return it | ||
563 | * to normal state (listed nodes ignored) | ||
564 | * | ||
565 | * @return 0 on success, error on failure | ||
566 | */ | ||
567 | int lbs_mesh_bt_set_inverted(struct lbs_private *priv, bool inverted) | ||
568 | { | ||
569 | struct cmd_ds_bt_access cmd; | ||
570 | int ret = 0; | ||
571 | |||
572 | lbs_deb_enter(LBS_DEB_CMD); | ||
573 | |||
574 | memset(&cmd, 0, sizeof(cmd)); | ||
575 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
576 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_SET_INVERT); | ||
577 | cmd.id = !!inverted; | ||
578 | |||
579 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); | ||
580 | |||
581 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
582 | return ret; | ||
583 | } | ||
584 | |||
585 | /** | ||
586 | * @brief List an entry in the mesh blinding table | ||
587 | * | ||
588 | * @param priv A pointer to struct lbs_private structure | ||
589 | * @param id The ID of the entry to list | ||
590 | * @param addr1 MAC address associated with the table entry | ||
591 | * | ||
592 | * @return 0 on success, error on failure | ||
593 | */ | ||
594 | int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1) | ||
595 | { | ||
596 | struct cmd_ds_bt_access cmd; | ||
597 | int ret = 0; | ||
598 | |||
599 | lbs_deb_enter(LBS_DEB_CMD); | ||
600 | |||
601 | BUG_ON(addr1 == NULL); | ||
602 | |||
603 | memset(&cmd, 0, sizeof(cmd)); | ||
604 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
605 | cmd.action = cpu_to_le16(CMD_ACT_BT_ACCESS_SET_INVERT); | ||
606 | cmd.id = cpu_to_le32(id); | ||
607 | |||
608 | ret = lbs_cmd_with_response(priv, CMD_BT_ACCESS, &cmd); | ||
609 | if (ret == 0) | ||
610 | memcpy(addr1, cmd.addr1, sizeof(cmd.addr1)); | ||
611 | |||
612 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
613 | return ret; | ||
496 | } | 614 | } |
497 | 615 | ||
498 | int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, | 616 | int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, |
diff --git a/drivers/net/wireless/libertas/mesh.h b/drivers/net/wireless/libertas/mesh.h index 84ea2481ff20..855497902d9f 100644 --- a/drivers/net/wireless/libertas/mesh.h +++ b/drivers/net/wireless/libertas/mesh.h | |||
@@ -51,8 +51,12 @@ struct cmd_ds_command; | |||
51 | struct cmd_ds_mesh_access; | 51 | struct cmd_ds_mesh_access; |
52 | struct cmd_ds_mesh_config; | 52 | struct cmd_ds_mesh_config; |
53 | 53 | ||
54 | int lbs_cmd_bt_access(struct cmd_ds_command *cmd, | 54 | int lbs_mesh_bt_add_del(struct lbs_private *priv, bool add, u8 *addr1); |
55 | u16 cmd_action, void *pdata_buf); | 55 | int lbs_mesh_bt_reset(struct lbs_private *priv); |
56 | int lbs_mesh_bt_get_inverted(struct lbs_private *priv, bool *inverted); | ||
57 | int lbs_mesh_bt_set_inverted(struct lbs_private *priv, bool inverted); | ||
58 | int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1); | ||
59 | |||
56 | int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, | 60 | int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, |
57 | u16 cmd_action, void *pdata_buf); | 61 | u16 cmd_action, void *pdata_buf); |
58 | int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, | 62 | int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, |