diff options
author | Dan Williams <dcbw@redhat.com> | 2010-07-27 15:54:34 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-07-27 15:03:29 -0400 |
commit | a45b6f4f9ef7fde2321da5aaa7db0e1e793a5b1e (patch) | |
tree | d38142f7db7ad6b63f37ca902ff40f70bc439969 /drivers/net/wireless | |
parent | 98ec62185cd940765a096c88a3f14147dd1d3bd4 (diff) |
libertas: clean up MONITOR_MODE command
Convert to a full direct command; previous code rolled a direct
command by handle but left the original indirect command code
lying around.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/libertas/cfg.c | 57 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 42 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/host.h | 4 |
4 files changed, 33 insertions, 72 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 7e0741608856..5110a771464b 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -7,7 +7,6 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/if_arp.h> | ||
11 | #include <linux/ieee80211.h> | 10 | #include <linux/ieee80211.h> |
12 | #include <net/cfg80211.h> | 11 | #include <net/cfg80211.h> |
13 | #include <asm/unaligned.h> | 12 | #include <asm/unaligned.h> |
@@ -1383,56 +1382,6 @@ static int lbs_cfg_del_key(struct wiphy *wiphy, struct net_device *netdev, | |||
1383 | } | 1382 | } |
1384 | 1383 | ||
1385 | 1384 | ||
1386 | |||
1387 | /*************************************************************************** | ||
1388 | * Monitor mode | ||
1389 | */ | ||
1390 | |||
1391 | /* like "struct cmd_ds_802_11_monitor_mode", but with cmd_header. Once we | ||
1392 | * get rid of WEXT, this should go into host.h */ | ||
1393 | struct cmd_monitor_mode { | ||
1394 | struct cmd_header hdr; | ||
1395 | |||
1396 | __le16 action; | ||
1397 | __le16 mode; | ||
1398 | } __packed; | ||
1399 | |||
1400 | static int lbs_enable_monitor_mode(struct lbs_private *priv, int mode) | ||
1401 | { | ||
1402 | struct cmd_monitor_mode cmd; | ||
1403 | int ret; | ||
1404 | |||
1405 | lbs_deb_enter(LBS_DEB_CFG80211); | ||
1406 | |||
1407 | /* | ||
1408 | * cmd 98 00 | ||
1409 | * size 0c 00 | ||
1410 | * sequence xx xx | ||
1411 | * result 00 00 | ||
1412 | * action 01 00 ACT_SET | ||
1413 | * enable 01 00 | ||
1414 | */ | ||
1415 | memset(&cmd, 0, sizeof(cmd)); | ||
1416 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
1417 | cmd.action = cpu_to_le16(CMD_ACT_SET); | ||
1418 | cmd.mode = cpu_to_le16(mode); | ||
1419 | |||
1420 | ret = lbs_cmd_with_response(priv, CMD_802_11_MONITOR_MODE, &cmd); | ||
1421 | |||
1422 | if (ret == 0) | ||
1423 | priv->dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
1424 | else | ||
1425 | priv->dev->type = ARPHRD_ETHER; | ||
1426 | |||
1427 | lbs_deb_leave(LBS_DEB_CFG80211); | ||
1428 | return ret; | ||
1429 | } | ||
1430 | |||
1431 | |||
1432 | |||
1433 | |||
1434 | |||
1435 | |||
1436 | /*************************************************************************** | 1385 | /*************************************************************************** |
1437 | * Get station | 1386 | * Get station |
1438 | */ | 1387 | */ |
@@ -1558,17 +1507,17 @@ static int lbs_change_intf(struct wiphy *wiphy, struct net_device *dev, | |||
1558 | 1507 | ||
1559 | switch (type) { | 1508 | switch (type) { |
1560 | case NL80211_IFTYPE_MONITOR: | 1509 | case NL80211_IFTYPE_MONITOR: |
1561 | ret = lbs_enable_monitor_mode(priv, 1); | 1510 | ret = lbs_set_monitor_mode(priv, 1); |
1562 | break; | 1511 | break; |
1563 | case NL80211_IFTYPE_STATION: | 1512 | case NL80211_IFTYPE_STATION: |
1564 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) | 1513 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) |
1565 | ret = lbs_enable_monitor_mode(priv, 0); | 1514 | ret = lbs_set_monitor_mode(priv, 0); |
1566 | if (!ret) | 1515 | if (!ret) |
1567 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1); | 1516 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1); |
1568 | break; | 1517 | break; |
1569 | case NL80211_IFTYPE_ADHOC: | 1518 | case NL80211_IFTYPE_ADHOC: |
1570 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) | 1519 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) |
1571 | ret = lbs_enable_monitor_mode(priv, 0); | 1520 | ret = lbs_set_monitor_mode(priv, 0); |
1572 | if (!ret) | 1521 | if (!ret) |
1573 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2); | 1522 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2); |
1574 | break; | 1523 | break; |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 749fbde4fd54..4454988fc00b 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/kfifo.h> | 6 | #include <linux/kfifo.h> |
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/if_arp.h> | ||
9 | 10 | ||
10 | #include "decl.h" | 11 | #include "decl.h" |
11 | #include "cfg.h" | 12 | #include "cfg.h" |
@@ -576,23 +577,35 @@ int lbs_set_tx_power(struct lbs_private *priv, s16 dbm) | |||
576 | return ret; | 577 | return ret; |
577 | } | 578 | } |
578 | 579 | ||
579 | static int lbs_cmd_802_11_monitor_mode(struct cmd_ds_command *cmd, | 580 | /** |
580 | u16 cmd_action, void *pdata_buf) | 581 | * @brief Enable or disable monitor mode (only implemented on OLPC usb8388 FW) |
582 | * | ||
583 | * @param priv A pointer to struct lbs_private structure | ||
584 | * @param enable 1 to enable monitor mode, 0 to disable | ||
585 | * | ||
586 | * @return 0 on success, error on failure | ||
587 | */ | ||
588 | int lbs_set_monitor_mode(struct lbs_private *priv, int enable) | ||
581 | { | 589 | { |
582 | struct cmd_ds_802_11_monitor_mode *monitor = &cmd->params.monitor; | 590 | struct cmd_ds_802_11_monitor_mode cmd; |
591 | int ret; | ||
583 | 592 | ||
584 | cmd->command = cpu_to_le16(CMD_802_11_MONITOR_MODE); | 593 | memset(&cmd, 0, sizeof(cmd)); |
585 | cmd->size = | 594 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
586 | cpu_to_le16(sizeof(struct cmd_ds_802_11_monitor_mode) + | 595 | cmd.action = cpu_to_le16(CMD_ACT_SET); |
587 | sizeof(struct cmd_header)); | 596 | if (enable) |
597 | cmd.mode = cpu_to_le16(0x1); | ||
588 | 598 | ||
589 | monitor->action = cpu_to_le16(cmd_action); | 599 | lbs_deb_cmd("SET_MONITOR_MODE: %d\n", enable); |
590 | if (cmd_action == CMD_ACT_SET) { | 600 | |
591 | monitor->mode = | 601 | ret = lbs_cmd_with_response(priv, CMD_802_11_MONITOR_MODE, &cmd); |
592 | cpu_to_le16((u16) (*(u32 *) pdata_buf)); | 602 | if (ret == 0) { |
603 | priv->dev->type = enable ? ARPHRD_IEEE80211_RADIOTAP : | ||
604 | ARPHRD_ETHER; | ||
593 | } | 605 | } |
594 | 606 | ||
595 | return 0; | 607 | lbs_deb_leave(LBS_DEB_CMD); |
608 | return ret; | ||
596 | } | 609 | } |
597 | 610 | ||
598 | /** | 611 | /** |
@@ -1093,11 +1106,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, | |||
1093 | ret = lbs_cmd_reg_access(cmdptr, cmd_action, pdata_buf); | 1106 | ret = lbs_cmd_reg_access(cmdptr, cmd_action, pdata_buf); |
1094 | break; | 1107 | break; |
1095 | 1108 | ||
1096 | case CMD_802_11_MONITOR_MODE: | ||
1097 | ret = lbs_cmd_802_11_monitor_mode(cmdptr, | ||
1098 | cmd_action, pdata_buf); | ||
1099 | break; | ||
1100 | |||
1101 | case CMD_802_11_RSSI: | 1109 | case CMD_802_11_RSSI: |
1102 | ret = lbs_cmd_802_11_rssi(priv, cmdptr); | 1110 | ret = lbs_cmd_802_11_rssi(priv, cmdptr); |
1103 | break; | 1111 | break; |
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 386e565d99ad..1b9092f95676 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h | |||
@@ -129,4 +129,6 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep); | |||
129 | 129 | ||
130 | int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep); | 130 | int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep); |
131 | 131 | ||
132 | int lbs_set_monitor_mode(struct lbs_private *priv, int enable); | ||
133 | |||
132 | #endif /* _LBS_CMD_H */ | 134 | #endif /* _LBS_CMD_H */ |
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index 43d020cd7403..dd67334765ef 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h | |||
@@ -675,7 +675,10 @@ struct cmd_ds_802_11_rf_tx_power { | |||
675 | s8 minlevel; | 675 | s8 minlevel; |
676 | } __packed; | 676 | } __packed; |
677 | 677 | ||
678 | /* MONITOR_MODE only exists in OLPC v5 firmware */ | ||
678 | struct cmd_ds_802_11_monitor_mode { | 679 | struct cmd_ds_802_11_monitor_mode { |
680 | struct cmd_header hdr; | ||
681 | |||
679 | __le16 action; | 682 | __le16 action; |
680 | __le16 mode; | 683 | __le16 mode; |
681 | } __packed; | 684 | } __packed; |
@@ -966,7 +969,6 @@ struct cmd_ds_command { | |||
966 | /* command Body */ | 969 | /* command Body */ |
967 | union { | 970 | union { |
968 | struct cmd_ds_802_11_ps_mode psmode; | 971 | struct cmd_ds_802_11_ps_mode psmode; |
969 | struct cmd_ds_802_11_monitor_mode monitor; | ||
970 | struct cmd_ds_802_11_rssi rssi; | 972 | struct cmd_ds_802_11_rssi rssi; |
971 | struct cmd_ds_802_11_rssi_rsp rssirsp; | 973 | struct cmd_ds_802_11_rssi_rsp rssirsp; |
972 | struct cmd_ds_mac_reg_access macreg; | 974 | struct cmd_ds_mac_reg_access macreg; |