aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2008-03-26 08:22:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:13:17 -0400
commitf539f2efe9fdf9e7db2022a757190858576d34fd (patch)
tree9fa3aafbffe64122a7bcb8c7e2d8ae117ab65b8a /drivers/net/wireless/libertas
parent7460f5a69055357bf97f1890db547aba0c4bf2fa (diff)
libertas: convert sleep/wake config direct commands
Confirm sleep event: they come very regularly, eventually several times per second. Therefore we want to send the config command as fast as possible. The old code pre-set the command in priv->lbs_ps_confirm_sleep. However, the byte sequence to be sent to the hardware is the same for all interfaces. So this patch make this an extern structure, initialized at module load time. Config wake event: normal conversion to a direct command. However, I don't know how to trigger a "HOST AWAKE" event from the firmware, so this part is untested. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-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.c32
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c17
-rw-r--r--drivers/net/wireless/libertas/dev.h5
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h9
-rw-r--r--drivers/net/wireless/libertas/main.c17
5 files changed, 32 insertions, 48 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 6e7bfb36b491..dbaf8b9e47d5 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1802,38 +1802,27 @@ void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str)
1802 lbs_deb_leave(LBS_DEB_WEXT); 1802 lbs_deb_leave(LBS_DEB_WEXT);
1803} 1803}
1804 1804
1805static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size) 1805static void lbs_send_confirmsleep(struct lbs_private *priv)
1806{ 1806{
1807 unsigned long flags; 1807 unsigned long flags;
1808 int ret = 0; 1808 int ret;
1809 1809
1810 lbs_deb_enter(LBS_DEB_HOST); 1810 lbs_deb_enter(LBS_DEB_HOST);
1811 lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size); 1811 lbs_deb_hex(LBS_DEB_HOST, "sleep confirm", (u8 *) &confirm_sleep,
1812 1812 sizeof(confirm_sleep));
1813 ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
1814 1813
1815 spin_lock_irqsave(&priv->driver_lock, flags); 1814 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &confirm_sleep,
1816 if (priv->intcounter || priv->currenttxskb) 1815 sizeof(confirm_sleep));
1817 lbs_deb_host("SEND_SLEEPC_CMD: intcounter %d, currenttxskb %p\n",
1818 priv->intcounter, priv->currenttxskb);
1819 spin_unlock_irqrestore(&priv->driver_lock, flags);
1820 1816
1821 if (ret) { 1817 if (ret) {
1822 lbs_pr_alert( 1818 lbs_pr_alert("confirm_sleep failed\n");
1823 "SEND_SLEEPC_CMD: Host to Card failed for Confirm Sleep\n");
1824 } else { 1819 } else {
1825 spin_lock_irqsave(&priv->driver_lock, flags); 1820 spin_lock_irqsave(&priv->driver_lock, flags);
1826 if (!priv->intcounter) { 1821 if (!priv->intcounter)
1827 priv->psstate = PS_STATE_SLEEP; 1822 priv->psstate = PS_STATE_SLEEP;
1828 } else {
1829 lbs_deb_host("SEND_SLEEPC_CMD: after sent, intcounter %d\n",
1830 priv->intcounter);
1831 }
1832 spin_unlock_irqrestore(&priv->driver_lock, flags); 1823 spin_unlock_irqrestore(&priv->driver_lock, flags);
1833 } 1824 }
1834 1825 lbs_deb_leave(LBS_DEB_HOST);
1835 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
1836 return ret;
1837} 1826}
1838 1827
1839void lbs_ps_sleep(struct lbs_private *priv, int wait_option) 1828void lbs_ps_sleep(struct lbs_private *priv, int wait_option)
@@ -1906,8 +1895,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
1906 1895
1907 if (allowed) { 1896 if (allowed) {
1908 lbs_deb_host("sending lbs_ps_confirm_sleep\n"); 1897 lbs_deb_host("sending lbs_ps_confirm_sleep\n");
1909 sendconfirmsleep(priv, (u8 *) & priv->lbs_ps_confirm_sleep, 1898 lbs_send_confirmsleep(priv);
1910 sizeof(struct PS_CMD_ConfirmSleep));
1911 } else { 1899 } else {
1912 lbs_deb_host("sleep confirm has been delayed\n"); 1900 lbs_deb_host("sleep confirm has been delayed\n");
1913 } 1901 }
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 8b5d1a55a0e9..e60d03bf8d11 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -548,21 +548,20 @@ done:
548 548
549static int lbs_send_confirmwake(struct lbs_private *priv) 549static int lbs_send_confirmwake(struct lbs_private *priv)
550{ 550{
551 struct cmd_header *cmd = &priv->lbs_ps_confirm_wake; 551 struct cmd_header cmd;
552 int ret = 0; 552 int ret = 0;
553 553
554 lbs_deb_enter(LBS_DEB_HOST); 554 lbs_deb_enter(LBS_DEB_HOST);
555 555
556 cmd->command = cpu_to_le16(CMD_802_11_WAKEUP_CONFIRM); 556 cmd.command = cpu_to_le16(CMD_802_11_WAKEUP_CONFIRM);
557 cmd->size = cpu_to_le16(sizeof(*cmd)); 557 cmd.size = cpu_to_le16(sizeof(cmd));
558 cmd->seqnum = cpu_to_le16(++priv->seqnum); 558 cmd.seqnum = cpu_to_le16(++priv->seqnum);
559 cmd->result = 0; 559 cmd.result = 0;
560 560
561 lbs_deb_host("SEND_WAKEC_CMD: before download\n"); 561 lbs_deb_hex(LBS_DEB_HOST, "wake confirm", (u8 *) &cmd,
562 sizeof(cmd));
562 563
563 lbs_deb_hex(LBS_DEB_HOST, "wake confirm command", (void *)cmd, sizeof(*cmd)); 564 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &cmd, sizeof(cmd));
564
565 ret = priv->hw_host_to_card(priv, MVMS_CMD, (void *)cmd, sizeof(*cmd));
566 if (ret) 565 if (ret)
567 lbs_pr_alert("SEND_WAKEC_CMD: Host to Card failed for Confirm Wake\n"); 566 lbs_pr_alert("SEND_WAKEC_CMD: Host to Card failed for Confirm Wake\n");
568 567
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 8e770dd6ef6b..3f3e7f6e68b3 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -267,9 +267,6 @@ struct lbs_private {
267 char ps_supported; 267 char ps_supported;
268 u8 needtowakeup; 268 u8 needtowakeup;
269 269
270 struct PS_CMD_ConfirmSleep lbs_ps_confirm_sleep;
271 struct cmd_header lbs_ps_confirm_wake;
272
273 struct assoc_request * pending_assoc_req; 270 struct assoc_request * pending_assoc_req;
274 struct assoc_request * in_progress_assoc_req; 271 struct assoc_request * in_progress_assoc_req;
275 272
@@ -326,6 +323,8 @@ struct lbs_private {
326 u8 fw_ready; 323 u8 fw_ready;
327}; 324};
328 325
326extern struct cmd_confirm_sleep confirm_sleep;
327
329/** Association request 328/** Association request
330 * 329 *
331 * Encapsulates all the options that describe a specific assocation request 330 * Encapsulates all the options that describe a specific assocation request
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 9256daba48fc..f29bc5bbda3e 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -480,14 +480,11 @@ struct cmd_ds_802_11_ps_mode {
480 __le16 locallisteninterval; 480 __le16 locallisteninterval;
481}; 481};
482 482
483struct PS_CMD_ConfirmSleep { 483struct cmd_confirm_sleep {
484 __le16 command; 484 struct cmd_header hdr;
485 __le16 size;
486 __le16 seqnum;
487 __le16 result;
488 485
489 __le16 action; 486 __le16 action;
490 __le16 reserved1; 487 __le16 nullpktinterval;
491 __le16 multipledtim; 488 __le16 multipledtim;
492 __le16 reserved; 489 __le16 reserved;
493 __le16 locallisteninterval; 490 __le16 locallisteninterval;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index d0e4c3b6deaa..efff63fb6b66 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -37,6 +37,11 @@ EXPORT_SYMBOL_GPL(lbs_debug);
37module_param_named(libertas_debug, lbs_debug, int, 0644); 37module_param_named(libertas_debug, lbs_debug, int, 0644);
38 38
39 39
40/* This global structure is used to send the confirm_sleep command as
41 * fast as possible down to the firmware. */
42struct cmd_confirm_sleep confirm_sleep;
43
44
40#define LBS_TX_PWR_DEFAULT 20 /*100mW */ 45#define LBS_TX_PWR_DEFAULT 20 /*100mW */
41#define LBS_TX_PWR_US_DEFAULT 20 /*100mW */ 46#define LBS_TX_PWR_US_DEFAULT 20 /*100mW */
42#define LBS_TX_PWR_JP_DEFAULT 16 /*50mW */ 47#define LBS_TX_PWR_JP_DEFAULT 16 /*50mW */
@@ -1013,14 +1018,6 @@ static int lbs_init_adapter(struct lbs_private *priv)
1013 &priv->network_free_list); 1018 &priv->network_free_list);
1014 } 1019 }
1015 1020
1016 priv->lbs_ps_confirm_sleep.seqnum = cpu_to_le16(++priv->seqnum);
1017 priv->lbs_ps_confirm_sleep.command =
1018 cpu_to_le16(CMD_802_11_PS_MODE);
1019 priv->lbs_ps_confirm_sleep.size =
1020 cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep));
1021 priv->lbs_ps_confirm_sleep.action =
1022 cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED);
1023
1024 memset(priv->current_addr, 0xff, ETH_ALEN); 1021 memset(priv->current_addr, 0xff, ETH_ALEN);
1025 1022
1026 priv->connect_status = LBS_DISCONNECTED; 1023 priv->connect_status = LBS_DISCONNECTED;
@@ -1462,6 +1459,10 @@ EXPORT_SYMBOL_GPL(lbs_interrupt);
1462static int __init lbs_init_module(void) 1459static int __init lbs_init_module(void)
1463{ 1460{
1464 lbs_deb_enter(LBS_DEB_MAIN); 1461 lbs_deb_enter(LBS_DEB_MAIN);
1462 memset(&confirm_sleep, 0, sizeof(confirm_sleep));
1463 confirm_sleep.hdr.command = cpu_to_le16(CMD_802_11_PS_MODE);
1464 confirm_sleep.hdr.size = cpu_to_le16(sizeof(confirm_sleep));
1465 confirm_sleep.action = cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED);
1465 lbs_debugfs_init(); 1466 lbs_debugfs_init();
1466 lbs_deb_leave(LBS_DEB_MAIN); 1467 lbs_deb_leave(LBS_DEB_MAIN);
1467 return 0; 1468 return 0;