aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/libertas/cmd.c28
-rw-r--r--drivers/net/wireless/libertas/cmd.h3
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c5
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h3
-rw-r--r--drivers/net/wireless/libertas/if_usb.c11
-rw-r--r--drivers/net/wireless/libertas/main.c40
6 files changed, 39 insertions, 51 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index eeb09e05903c..9d621fe7f08a 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -976,27 +976,25 @@ static int lbs_cmd_fwt_access(struct lbs_private *priv,
976 return 0; 976 return 0;
977} 977}
978 978
979static int lbs_cmd_mesh_access(struct lbs_private *priv, 979int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
980 struct cmd_ds_command *cmd, 980 struct cmd_ds_mesh_access *cmd)
981 u16 cmd_action, void *pdata_buf)
982{ 981{
983 struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh; 982 int ret;
983
984 lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); 984 lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
985 985
986 cmd->command = cpu_to_le16(CMD_MESH_ACCESS); 986 cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS);
987 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN); 987 cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN);
988 cmd->result = 0; 988 cmd->hdr.result = 0;
989 989
990 if (pdata_buf) 990 cmd->action = cpu_to_le16(cmd_action);
991 memcpy(mesh_access, pdata_buf, sizeof(*mesh_access));
992 else
993 memset(mesh_access, 0, sizeof(*mesh_access));
994 991
995 mesh_access->action = cpu_to_le16(cmd_action); 992 ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, (*cmd));
996 993
997 lbs_deb_leave(LBS_DEB_CMD); 994 lbs_deb_leave(LBS_DEB_CMD);
998 return 0; 995 return ret;
999} 996}
997EXPORT_SYMBOL_GPL(lbs_mesh_access);
1000 998
1001static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, 999static int lbs_cmd_bcn_ctrl(struct lbs_private * priv,
1002 struct cmd_ds_command *cmd, 1000 struct cmd_ds_command *cmd,
@@ -1486,10 +1484,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1486 ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf); 1484 ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf);
1487 break; 1485 break;
1488 1486
1489 case CMD_MESH_ACCESS:
1490 ret = lbs_cmd_mesh_access(priv, cmdptr, cmd_action, pdata_buf);
1491 break;
1492
1493 case CMD_GET_TSF: 1487 case CMD_GET_TSF:
1494 cmdptr->command = cpu_to_le16(CMD_GET_TSF); 1488 cmdptr->command = cpu_to_le16(CMD_GET_TSF);
1495 cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) + 1489 cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) +
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h
index b8e5d21329a3..716f25be5b3e 100644
--- a/drivers/net/wireless/libertas/cmd.h
+++ b/drivers/net/wireless/libertas/cmd.h
@@ -24,4 +24,7 @@ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
24 24
25int lbs_update_hw_spec(struct lbs_private *priv); 25int lbs_update_hw_spec(struct lbs_private *priv);
26 26
27int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
28 struct cmd_ds_mesh_access *cmd);
29
27#endif /* _LBS_CMD_H */ 30#endif /* _LBS_CMD_H */
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index b4cd7b79f54f..6ff705b49ddc 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -653,11 +653,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
653 sizeof(resp->params.fwt)); 653 sizeof(resp->params.fwt));
654 spin_unlock_irqrestore(&priv->driver_lock, flags); 654 spin_unlock_irqrestore(&priv->driver_lock, flags);
655 break; 655 break;
656 case CMD_RET(CMD_MESH_ACCESS):
657 if (priv->cur_cmd->pdata_buf)
658 memcpy(priv->cur_cmd->pdata_buf, &resp->params.mesh,
659 sizeof(resp->params.mesh));
660 break;
661 case CMD_RET(CMD_802_11_BEACON_CTRL): 656 case CMD_RET(CMD_802_11_BEACON_CTRL):
662 ret = lbs_ret_802_11_bcn_ctrl(priv, resp); 657 ret = lbs_ret_802_11_bcn_ctrl(priv, resp);
663 break; 658 break;
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index e5e2106cd5ac..d9b151a28801 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -623,6 +623,8 @@ struct cmd_ds_fwt_access {
623} __attribute__ ((packed)); 623} __attribute__ ((packed));
624 624
625struct cmd_ds_mesh_access { 625struct cmd_ds_mesh_access {
626 struct cmd_header hdr;
627
626 __le16 action; 628 __le16 action;
627 __le32 data[32]; /* last position reserved */ 629 __le32 data[32]; /* last position reserved */
628} __attribute__ ((packed)); 630} __attribute__ ((packed));
@@ -687,7 +689,6 @@ struct cmd_ds_command {
687 struct cmd_tx_rate_query txrate; 689 struct cmd_tx_rate_query txrate;
688 struct cmd_ds_bt_access bt; 690 struct cmd_ds_bt_access bt;
689 struct cmd_ds_fwt_access fwt; 691 struct cmd_ds_fwt_access fwt;
690 struct cmd_ds_mesh_access mesh;
691 struct cmd_ds_get_tsf gettsf; 692 struct cmd_ds_get_tsf gettsf;
692 struct cmd_ds_802_11_subscribe_event subscribe_event; 693 struct cmd_ds_802_11_subscribe_event subscribe_event;
693 struct cmd_ds_802_11_beacon_control bcn_ctrl; 694 struct cmd_ds_802_11_beacon_control bcn_ctrl;
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 5f2d944312a5..a0866efb9647 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -990,11 +990,9 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
990 */ 990 */
991 struct cmd_ds_mesh_access mesh_access; 991 struct cmd_ds_mesh_access mesh_access;
992 memset(&mesh_access, 0, sizeof(mesh_access)); 992 memset(&mesh_access, 0, sizeof(mesh_access));
993
993 mesh_access.data[0] = cpu_to_le32(1); 994 mesh_access.data[0] = cpu_to_le32(1);
994 lbs_prepare_and_send_command(priv, 995 lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access);
995 CMD_MESH_ACCESS,
996 CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
997 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
998 } 996 }
999 997
1000 netif_device_detach(cardp->eth_dev); 998 netif_device_detach(cardp->eth_dev);
@@ -1031,10 +1029,7 @@ static int if_usb_resume(struct usb_interface *intf)
1031 struct cmd_ds_mesh_access mesh_access; 1029 struct cmd_ds_mesh_access mesh_access;
1032 memset(&mesh_access, 0, sizeof(mesh_access)); 1030 memset(&mesh_access, 0, sizeof(mesh_access));
1033 mesh_access.data[0] = cpu_to_le32(0); 1031 mesh_access.data[0] = cpu_to_le32(0);
1034 lbs_prepare_and_send_command(priv, 1032 lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access);
1035 CMD_MESH_ACCESS,
1036 CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
1037 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
1038 } 1033 }
1039 1034
1040 lbs_deb_leave(LBS_DEB_USB); 1035 lbs_deb_leave(LBS_DEB_USB);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index a081b91fb9ba..7f6b3ccef0c2 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -217,13 +217,15 @@ u8 lbs_data_rate_to_fw_index(u32 rate)
217static ssize_t lbs_anycast_get(struct device *dev, 217static ssize_t lbs_anycast_get(struct device *dev,
218 struct device_attribute *attr, char * buf) 218 struct device_attribute *attr, char * buf)
219{ 219{
220 struct lbs_private *priv = to_net_dev(dev)->priv;
220 struct cmd_ds_mesh_access mesh_access; 221 struct cmd_ds_mesh_access mesh_access;
222 int ret;
221 223
222 memset(&mesh_access, 0, sizeof(mesh_access)); 224 memset(&mesh_access, 0, sizeof(mesh_access));
223 lbs_prepare_and_send_command(to_net_dev(dev)->priv, 225
224 CMD_MESH_ACCESS, 226 ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_ANYCAST, &mesh_access);
225 CMD_ACT_MESH_GET_ANYCAST, 227 if (ret)
226 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); 228 return ret;
227 229
228 return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0])); 230 return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
229} 231}
@@ -234,17 +236,19 @@ static ssize_t lbs_anycast_get(struct device *dev,
234static ssize_t lbs_anycast_set(struct device *dev, 236static ssize_t lbs_anycast_set(struct device *dev,
235 struct device_attribute *attr, const char * buf, size_t count) 237 struct device_attribute *attr, const char * buf, size_t count)
236{ 238{
239 struct lbs_private *priv = to_net_dev(dev)->priv;
237 struct cmd_ds_mesh_access mesh_access; 240 struct cmd_ds_mesh_access mesh_access;
238 uint32_t datum; 241 uint32_t datum;
242 int ret;
239 243
240 memset(&mesh_access, 0, sizeof(mesh_access)); 244 memset(&mesh_access, 0, sizeof(mesh_access));
241 sscanf(buf, "%x", &datum); 245 sscanf(buf, "%x", &datum);
242 mesh_access.data[0] = cpu_to_le32(datum); 246 mesh_access.data[0] = cpu_to_le32(datum);
243 247
244 lbs_prepare_and_send_command((to_net_dev(dev))->priv, 248 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_ANYCAST, &mesh_access);
245 CMD_MESH_ACCESS, 249 if (ret)
246 CMD_ACT_MESH_SET_ANYCAST, 250 return ret;
247 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); 251
248 return strlen(buf); 252 return strlen(buf);
249} 253}
250 254
@@ -323,14 +327,15 @@ static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set);
323static ssize_t lbs_autostart_enabled_get(struct device *dev, 327static ssize_t lbs_autostart_enabled_get(struct device *dev,
324 struct device_attribute *attr, char * buf) 328 struct device_attribute *attr, char * buf)
325{ 329{
330 struct lbs_private *priv = to_net_dev(dev)->priv;
326 struct cmd_ds_mesh_access mesh_access; 331 struct cmd_ds_mesh_access mesh_access;
332 int ret;
327 333
328 memset(&mesh_access, 0, sizeof(mesh_access)); 334 memset(&mesh_access, 0, sizeof(mesh_access));
329 lbs_prepare_and_send_command(to_net_dev(dev)->priv,
330 CMD_MESH_ACCESS,
331 CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
332 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
333 335
336 ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_AUTOSTART_ENABLED, &mesh_access);
337 if (ret)
338 return ret;
334 return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0])); 339 return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0]));
335} 340}
336 341
@@ -346,10 +351,7 @@ static ssize_t lbs_autostart_enabled_set(struct device *dev,
346 sscanf(buf, "%d", &datum); 351 sscanf(buf, "%d", &datum);
347 mesh_access.data[0] = cpu_to_le32(datum); 352 mesh_access.data[0] = cpu_to_le32(datum);
348 353
349 ret = lbs_prepare_and_send_command(priv, 354 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access);
350 CMD_MESH_ACCESS,
351 CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
352 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
353 if (ret == 0) 355 if (ret == 0)
354 priv->mesh_autostart_enabled = datum ? 1 : 0; 356 priv->mesh_autostart_enabled = datum ? 1 : 0;
355 357
@@ -866,10 +868,8 @@ static int lbs_setup_firmware(struct lbs_private *priv)
866 if (priv->mesh_dev) { 868 if (priv->mesh_dev) {
867 memset(&mesh_access, 0, sizeof(mesh_access)); 869 memset(&mesh_access, 0, sizeof(mesh_access));
868 mesh_access.data[0] = cpu_to_le32(0); 870 mesh_access.data[0] = cpu_to_le32(0);
869 ret = lbs_prepare_and_send_command(priv, 871 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
870 CMD_MESH_ACCESS, 872 &mesh_access);
871 CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
872 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
873 if (ret) { 873 if (ret) {
874 ret = -1; 874 ret = -1;
875 goto done; 875 goto done;