diff options
author | Holger Schurig <holgerschurig@gmail.com> | 2009-11-25 07:11:16 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-28 15:04:59 -0500 |
commit | ece1e3c61e59ba184150e5aff57bbc6355613e3e (patch) | |
tree | fb6b71185eea092333d10e5c3729ea7bc8f37a2f /drivers/net/wireless/libertas/cmd.c | |
parent | c7fe64cf4a08561a9e8f57e6018a504881236e34 (diff) |
libertas: move mesh command handling into mesh.c
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 168 |
1 files changed, 0 insertions, 168 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 1065ce29cd08..b9b371bfa30f 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -3,7 +3,6 @@ | |||
3 | * It prepares command and sends it to firmware when it is ready. | 3 | * It prepares command and sends it to firmware when it is ready. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <net/lib80211.h> | ||
7 | #include <linux/kfifo.h> | 6 | #include <linux/kfifo.h> |
8 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
9 | 8 | ||
@@ -697,173 +696,6 @@ static int lbs_cmd_reg_access(struct cmd_ds_command *cmdptr, | |||
697 | return 0; | 696 | return 0; |
698 | } | 697 | } |
699 | 698 | ||
700 | static int lbs_cmd_bt_access(struct cmd_ds_command *cmd, | ||
701 | u16 cmd_action, void *pdata_buf) | ||
702 | { | ||
703 | struct cmd_ds_bt_access *bt_access = &cmd->params.bt; | ||
704 | lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); | ||
705 | |||
706 | cmd->command = cpu_to_le16(CMD_BT_ACCESS); | ||
707 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + | ||
708 | sizeof(struct cmd_header)); | ||
709 | cmd->result = 0; | ||
710 | bt_access->action = cpu_to_le16(cmd_action); | ||
711 | |||
712 | switch (cmd_action) { | ||
713 | case CMD_ACT_BT_ACCESS_ADD: | ||
714 | memcpy(bt_access->addr1, pdata_buf, 2 * ETH_ALEN); | ||
715 | lbs_deb_hex(LBS_DEB_MESH, "BT_ADD: blinded MAC addr", bt_access->addr1, 6); | ||
716 | break; | ||
717 | case CMD_ACT_BT_ACCESS_DEL: | ||
718 | memcpy(bt_access->addr1, pdata_buf, 1 * ETH_ALEN); | ||
719 | lbs_deb_hex(LBS_DEB_MESH, "BT_DEL: blinded MAC addr", bt_access->addr1, 6); | ||
720 | break; | ||
721 | case CMD_ACT_BT_ACCESS_LIST: | ||
722 | bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); | ||
723 | break; | ||
724 | case CMD_ACT_BT_ACCESS_RESET: | ||
725 | break; | ||
726 | case CMD_ACT_BT_ACCESS_SET_INVERT: | ||
727 | bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); | ||
728 | break; | ||
729 | case CMD_ACT_BT_ACCESS_GET_INVERT: | ||
730 | break; | ||
731 | default: | ||
732 | break; | ||
733 | } | ||
734 | lbs_deb_leave(LBS_DEB_CMD); | ||
735 | return 0; | ||
736 | } | ||
737 | |||
738 | static int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, | ||
739 | u16 cmd_action, void *pdata_buf) | ||
740 | { | ||
741 | struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; | ||
742 | lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); | ||
743 | |||
744 | cmd->command = cpu_to_le16(CMD_FWT_ACCESS); | ||
745 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + | ||
746 | sizeof(struct cmd_header)); | ||
747 | cmd->result = 0; | ||
748 | |||
749 | if (pdata_buf) | ||
750 | memcpy(fwt_access, pdata_buf, sizeof(*fwt_access)); | ||
751 | else | ||
752 | memset(fwt_access, 0, sizeof(*fwt_access)); | ||
753 | |||
754 | fwt_access->action = cpu_to_le16(cmd_action); | ||
755 | |||
756 | lbs_deb_leave(LBS_DEB_CMD); | ||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, | ||
761 | struct cmd_ds_mesh_access *cmd) | ||
762 | { | ||
763 | int ret; | ||
764 | |||
765 | lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); | ||
766 | |||
767 | cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS); | ||
768 | cmd->hdr.size = cpu_to_le16(sizeof(*cmd)); | ||
769 | cmd->hdr.result = 0; | ||
770 | |||
771 | cmd->action = cpu_to_le16(cmd_action); | ||
772 | |||
773 | ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, cmd); | ||
774 | |||
775 | lbs_deb_leave(LBS_DEB_CMD); | ||
776 | return ret; | ||
777 | } | ||
778 | |||
779 | static int __lbs_mesh_config_send(struct lbs_private *priv, | ||
780 | struct cmd_ds_mesh_config *cmd, | ||
781 | uint16_t action, uint16_t type) | ||
782 | { | ||
783 | int ret; | ||
784 | u16 command = CMD_MESH_CONFIG_OLD; | ||
785 | |||
786 | lbs_deb_enter(LBS_DEB_CMD); | ||
787 | |||
788 | /* | ||
789 | * Command id is 0xac for v10 FW along with mesh interface | ||
790 | * id in bits 14-13-12. | ||
791 | */ | ||
792 | if (priv->mesh_fw_ver == MESH_FW_NEW) | ||
793 | command = CMD_MESH_CONFIG | | ||
794 | (MESH_IFACE_ID << MESH_IFACE_BIT_OFFSET); | ||
795 | |||
796 | cmd->hdr.command = cpu_to_le16(command); | ||
797 | cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_mesh_config)); | ||
798 | cmd->hdr.result = 0; | ||
799 | |||
800 | cmd->type = cpu_to_le16(type); | ||
801 | cmd->action = cpu_to_le16(action); | ||
802 | |||
803 | ret = lbs_cmd_with_response(priv, command, cmd); | ||
804 | |||
805 | lbs_deb_leave(LBS_DEB_CMD); | ||
806 | return ret; | ||
807 | } | ||
808 | |||
809 | int lbs_mesh_config_send(struct lbs_private *priv, | ||
810 | struct cmd_ds_mesh_config *cmd, | ||
811 | uint16_t action, uint16_t type) | ||
812 | { | ||
813 | int ret; | ||
814 | |||
815 | if (!(priv->fwcapinfo & FW_CAPINFO_PERSISTENT_CONFIG)) | ||
816 | return -EOPNOTSUPP; | ||
817 | |||
818 | ret = __lbs_mesh_config_send(priv, cmd, action, type); | ||
819 | return ret; | ||
820 | } | ||
821 | |||
822 | /* This function is the CMD_MESH_CONFIG legacy function. It only handles the | ||
823 | * START and STOP actions. The extended actions supported by CMD_MESH_CONFIG | ||
824 | * are all handled by preparing a struct cmd_ds_mesh_config and passing it to | ||
825 | * lbs_mesh_config_send. | ||
826 | */ | ||
827 | int lbs_mesh_config(struct lbs_private *priv, uint16_t action, uint16_t chan) | ||
828 | { | ||
829 | struct cmd_ds_mesh_config cmd; | ||
830 | struct mrvl_meshie *ie; | ||
831 | DECLARE_SSID_BUF(ssid); | ||
832 | |||
833 | memset(&cmd, 0, sizeof(cmd)); | ||
834 | cmd.channel = cpu_to_le16(chan); | ||
835 | ie = (struct mrvl_meshie *)cmd.data; | ||
836 | |||
837 | switch (action) { | ||
838 | case CMD_ACT_MESH_CONFIG_START: | ||
839 | ie->id = WLAN_EID_GENERIC; | ||
840 | ie->val.oui[0] = 0x00; | ||
841 | ie->val.oui[1] = 0x50; | ||
842 | ie->val.oui[2] = 0x43; | ||
843 | ie->val.type = MARVELL_MESH_IE_TYPE; | ||
844 | ie->val.subtype = MARVELL_MESH_IE_SUBTYPE; | ||
845 | ie->val.version = MARVELL_MESH_IE_VERSION; | ||
846 | ie->val.active_protocol_id = MARVELL_MESH_PROTO_ID_HWMP; | ||
847 | ie->val.active_metric_id = MARVELL_MESH_METRIC_ID; | ||
848 | ie->val.mesh_capability = MARVELL_MESH_CAPABILITY; | ||
849 | ie->val.mesh_id_len = priv->mesh_ssid_len; | ||
850 | memcpy(ie->val.mesh_id, priv->mesh_ssid, priv->mesh_ssid_len); | ||
851 | ie->len = sizeof(struct mrvl_meshie_val) - | ||
852 | IEEE80211_MAX_SSID_LEN + priv->mesh_ssid_len; | ||
853 | cmd.length = cpu_to_le16(sizeof(struct mrvl_meshie_val)); | ||
854 | break; | ||
855 | case CMD_ACT_MESH_CONFIG_STOP: | ||
856 | break; | ||
857 | default: | ||
858 | return -1; | ||
859 | } | ||
860 | lbs_deb_cmd("mesh config action %d type %x channel %d SSID %s\n", | ||
861 | action, priv->mesh_tlv, chan, | ||
862 | print_ssid(ssid, priv->mesh_ssid, priv->mesh_ssid_len)); | ||
863 | |||
864 | return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv); | ||
865 | } | ||
866 | |||
867 | static void lbs_queue_cmd(struct lbs_private *priv, | 699 | static void lbs_queue_cmd(struct lbs_private *priv, |
868 | struct cmd_ctrl_node *cmdnode) | 700 | struct cmd_ctrl_node *cmdnode) |
869 | { | 701 | { |