diff options
author | Javier Cardona <javier@cozybit.com> | 2008-05-17 03:55:10 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-21 21:47:39 -0400 |
commit | edaea5ce05ca804cc55438c586ca2f947d49f56f (patch) | |
tree | be82d922cb908221d247e21d04ddf5517e7a4953 /drivers/net/wireless/libertas/cmd.c | |
parent | 75bf45a7b4ab81cfa5c5eab68b57bbfee8b8ede2 (diff) |
libertas: Extend MESH_CONFIG command to access non-volatile configuration
This patch is based on a patch from Shailendra Govardhan and Brian Cavagnolo.
It extends the MESH_CONFIG command to configure non-volatile parameters on
libertas devices that support them (e.g. OLPC Active Antenna).
This patch only implements the driver/firmware interface.
See http://dev.laptop.org/ticket/6823 for minimal testing results and known
issues.
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
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 | 68 |
1 files changed, 57 insertions, 11 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index b494aba869c5..7ccec987faaa 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -4,6 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <net/iw_handler.h> | 6 | #include <net/iw_handler.h> |
7 | #include <net/ieee80211.h> | ||
7 | #include <linux/kfifo.h> | 8 | #include <linux/kfifo.h> |
8 | #include "host.h" | 9 | #include "host.h" |
9 | #include "hostcmd.h" | 10 | #include "hostcmd.h" |
@@ -998,24 +999,69 @@ int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, | |||
998 | return ret; | 999 | return ret; |
999 | } | 1000 | } |
1000 | 1001 | ||
1001 | int lbs_mesh_config(struct lbs_private *priv, uint16_t enable, uint16_t chan) | 1002 | int lbs_mesh_config_send(struct lbs_private *priv, |
1003 | struct cmd_ds_mesh_config *cmd, | ||
1004 | uint16_t action, uint16_t type) | ||
1005 | { | ||
1006 | int ret; | ||
1007 | |||
1008 | lbs_deb_enter(LBS_DEB_CMD); | ||
1009 | |||
1010 | cmd->hdr.command = cpu_to_le16(CMD_MESH_CONFIG); | ||
1011 | cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_mesh_config)); | ||
1012 | cmd->hdr.result = 0; | ||
1013 | |||
1014 | cmd->type = cpu_to_le16(type); | ||
1015 | cmd->action = cpu_to_le16(action); | ||
1016 | |||
1017 | ret = lbs_cmd_with_response(priv, CMD_MESH_CONFIG, cmd); | ||
1018 | |||
1019 | lbs_deb_leave(LBS_DEB_CMD); | ||
1020 | return ret; | ||
1021 | } | ||
1022 | |||
1023 | /* This function is the CMD_MESH_CONFIG legacy function. It only handles the | ||
1024 | * START and STOP actions. The extended actions supported by CMD_MESH_CONFIG | ||
1025 | * are all handled by preparing a struct cmd_ds_mesh_config and passing it to | ||
1026 | * lbs_mesh_config_send. | ||
1027 | */ | ||
1028 | int lbs_mesh_config(struct lbs_private *priv, uint16_t action, uint16_t chan) | ||
1002 | { | 1029 | { |
1003 | struct cmd_ds_mesh_config cmd; | 1030 | struct cmd_ds_mesh_config cmd; |
1031 | struct mrvl_meshie *ie; | ||
1004 | 1032 | ||
1005 | memset(&cmd, 0, sizeof(cmd)); | 1033 | memset(&cmd, 0, sizeof(cmd)); |
1006 | cmd.action = cpu_to_le16(enable); | ||
1007 | cmd.channel = cpu_to_le16(chan); | 1034 | cmd.channel = cpu_to_le16(chan); |
1008 | cmd.type = cpu_to_le16(priv->mesh_tlv); | 1035 | ie = (struct mrvl_meshie *)cmd.data; |
1009 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 1036 | |
1010 | 1037 | switch (action) { | |
1011 | if (enable) { | 1038 | case CMD_ACT_MESH_CONFIG_START: |
1012 | cmd.length = cpu_to_le16(priv->mesh_ssid_len); | 1039 | ie->hdr.id = MFIE_TYPE_GENERIC; |
1013 | memcpy(cmd.data, priv->mesh_ssid, priv->mesh_ssid_len); | 1040 | ie->val.oui[0] = 0x00; |
1041 | ie->val.oui[1] = 0x50; | ||
1042 | ie->val.oui[2] = 0x43; | ||
1043 | ie->val.type = MARVELL_MESH_IE_TYPE; | ||
1044 | ie->val.subtype = MARVELL_MESH_IE_SUBTYPE; | ||
1045 | ie->val.version = MARVELL_MESH_IE_VERSION; | ||
1046 | ie->val.active_protocol_id = MARVELL_MESH_PROTO_ID_HWMP; | ||
1047 | ie->val.active_metric_id = MARVELL_MESH_METRIC_ID; | ||
1048 | ie->val.mesh_capability = MARVELL_MESH_CAPABILITY; | ||
1049 | ie->val.mesh_id_len = priv->mesh_ssid_len; | ||
1050 | memcpy(ie->val.mesh_id, priv->mesh_ssid, priv->mesh_ssid_len); | ||
1051 | ie->hdr.len = sizeof(struct mrvl_meshie_val) - | ||
1052 | IW_ESSID_MAX_SIZE + priv->mesh_ssid_len; | ||
1053 | cmd.length = cpu_to_le16(sizeof(struct mrvl_meshie_val)); | ||
1054 | break; | ||
1055 | case CMD_ACT_MESH_CONFIG_STOP: | ||
1056 | break; | ||
1057 | default: | ||
1058 | return -1; | ||
1014 | } | 1059 | } |
1015 | lbs_deb_cmd("mesh config enable %d TLV %x channel %d SSID %s\n", | 1060 | lbs_deb_cmd("mesh config action %d type %x channel %d SSID %s\n", |
1016 | enable, priv->mesh_tlv, chan, | 1061 | action, priv->mesh_tlv, chan, |
1017 | escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); | 1062 | escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); |
1018 | return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, &cmd); | 1063 | |
1064 | return lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv); | ||
1019 | } | 1065 | } |
1020 | 1066 | ||
1021 | static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, | 1067 | static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, |