aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2008-12-30 07:48:41 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:59:44 -0500
commit2b8d4e2eea711b6dfe1878ff3c94ebe757656f6d (patch)
treef4cbc2ded9070edfdda55ff30d83cab9e3ca898d /drivers/net/wireless
parent51eed9923d98477e7f7473edd60d876d1cecc8c5 (diff)
p54: power save management
This patch implements dynamic power save feature for p54. Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/p54/p54common.c42
-rw-r--r--drivers/net/wireless/p54/p54common.h1
2 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index d85a6bafd79f..6c175df48b0d 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -1765,6 +1765,43 @@ static int p54_set_edcf(struct ieee80211_hw *dev)
1765 return 0; 1765 return 0;
1766} 1766}
1767 1767
1768static int p54_set_ps(struct ieee80211_hw *dev)
1769{
1770 struct p54_common *priv = dev->priv;
1771 struct sk_buff *skb;
1772 struct p54_psm *psm;
1773 u16 mode;
1774 int i;
1775
1776 if (dev->conf.flags & IEEE80211_CONF_PS)
1777 mode = cpu_to_le16(P54_PSM | P54_PSM_DTIM | P54_PSM_MCBC);
1778 else
1779 mode = P54_PSM_CAM;
1780
1781 skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*psm) +
1782 sizeof(struct p54_hdr), P54_CONTROL_TYPE_PSM,
1783 GFP_ATOMIC);
1784 if (!skb)
1785 return -ENOMEM;
1786
1787 psm = (struct p54_psm *)skb_put(skb, sizeof(*psm));
1788 psm->mode = cpu_to_le16(mode);
1789 psm->aid = cpu_to_le16(priv->aid);
1790 for (i = 0; i < ARRAY_SIZE(psm->intervals); i++) {
1791 psm->intervals[i].interval =
1792 cpu_to_le16(dev->conf.listen_interval);
1793 psm->intervals[i].periods = 1;
1794 }
1795
1796 psm->beacon_rssi_skip_max = 60;
1797 psm->rssi_delta_threshold = 0;
1798 psm->nr = 0;
1799
1800 priv->tx(dev, skb);
1801
1802 return 0;
1803}
1804
1768static int p54_beacon_tim(struct sk_buff *skb) 1805static int p54_beacon_tim(struct sk_buff *skb)
1769{ 1806{
1770 /* 1807 /*
@@ -1957,6 +1994,11 @@ static int p54_config(struct ieee80211_hw *dev, u32 changed)
1957 if (ret) 1994 if (ret)
1958 goto out; 1995 goto out;
1959 } 1996 }
1997 if (changed & IEEE80211_CONF_CHANGE_PS) {
1998 ret = p54_set_ps(dev);
1999 if (ret)
2000 goto out;
2001 }
1960 2002
1961out: 2003out:
1962 mutex_unlock(&priv->conf_mutex); 2004 mutex_unlock(&priv->conf_mutex);
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h
index 035e77312484..6207323848bd 100644
--- a/drivers/net/wireless/p54/p54common.h
+++ b/drivers/net/wireless/p54/p54common.h
@@ -534,6 +534,7 @@ struct p54_psm_interval {
534 __le16 periods; 534 __le16 periods;
535} __attribute__ ((packed)); 535} __attribute__ ((packed));
536 536
537#define P54_PSM_CAM 0
537#define P54_PSM BIT(0) 538#define P54_PSM BIT(0)
538#define P54_PSM_DTIM BIT(1) 539#define P54_PSM_DTIM BIT(1)
539#define P54_PSM_MCBC BIT(2) 540#define P54_PSM_MCBC BIT(2)