[ath9k-devel] [PATCH v2 1/3] ath10k: WMI add AP PS

2013-05-09 Thread Janusz Dziedzic
Add AP power save (UAPSD) structures, enums.

Signed-off-by: Janusz Dziedzic 
---
 drivers/net/wireless/ath/ath10k/wmi.c |   26 +
 drivers/net/wireless/ath/ath10k/wmi.h |   68 +
 2 files changed, 94 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index d2d712d..bd1f076 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1903,6 +1903,32 @@ int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 
vdev_id,
return ath10k_wmi_cmd_send(ar, skb, WMI_STA_POWERSAVE_PARAM_CMDID);
 }
 
+int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac,
+  enum wmi_ap_ps_peer_param param_id, u32 value)
+{
+   struct wmi_ap_ps_peer_cmd *cmd;
+   struct sk_buff *skb;
+
+   if (!mac)
+   return -EINVAL;
+
+   skb = ath10k_wmi_alloc_skb(sizeof(*cmd));
+   if (!skb)
+   return -ENOMEM;
+
+   cmd = (struct wmi_ap_ps_peer_cmd *)skb->data;
+   cmd->vdev_id = __cpu_to_le32(vdev_id);
+   cmd->param_id = __cpu_to_le32(param_id);
+   cmd->param_value = __cpu_to_le32(value);
+   memcpy(&cmd->peer_macaddr, mac, ETH_ALEN);
+
+   ath10k_dbg(ATH10K_DBG_WMI,
+  "wmi ap ps param vdev_id 0x%X param %d value %d mac_addr 
%pM\n",
+  vdev_id, param_id, value, mac);
+
+   return ath10k_wmi_cmd_send(ar, skb, WMI_AP_PS_PEER_PARAM_CMDID);
+}
+
 int ath10k_wmi_scan_chan_list(struct ath10k *ar,
  const struct wmi_scan_chan_list_arg *arg)
 {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 2ad0431..8d482ab 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2461,6 +2461,72 @@ struct wmi_sta_mimo_ps_mode_cmd {
__le32 mimo_pwrsave_mode;
 } __packed;
 
+/* U-APSD configuration of peer station from (re)assoc request and TSPECs */
+enum wmi_ap_ps_param_uapsd {
+   WMI_AP_PS_UAPSD_AC0_DELIVERY_EN = (1 << 0),
+   WMI_AP_PS_UAPSD_AC0_TRIGGER_EN  = (1 << 1),
+   WMI_AP_PS_UAPSD_AC1_DELIVERY_EN = (1 << 2),
+   WMI_AP_PS_UAPSD_AC1_TRIGGER_EN  = (1 << 3),
+   WMI_AP_PS_UAPSD_AC2_DELIVERY_EN = (1 << 4),
+   WMI_AP_PS_UAPSD_AC2_TRIGGER_EN  = (1 << 5),
+   WMI_AP_PS_UAPSD_AC3_DELIVERY_EN = (1 << 6),
+   WMI_AP_PS_UAPSD_AC3_TRIGGER_EN  = (1 << 7),
+};
+
+/* U-APSD maximum service period of peer station */
+enum wmi_ap_ps_peer_param_max_sp {
+   WMI_AP_PS_PEER_PARAM_MAX_SP_UNLIMITED = 0,
+   WMI_AP_PS_PEER_PARAM_MAX_SP_2 = 1,
+   WMI_AP_PS_PEER_PARAM_MAX_SP_4 = 2,
+   WMI_AP_PS_PEER_PARAM_MAX_SP_6 = 3,
+   MAX_WMI_AP_PS_PEER_PARAM_MAX_SP,
+};
+
+/*
+ * AP power save parameter
+ * Set a power save specific parameter for a peer station
+ */
+enum wmi_ap_ps_peer_param {
+   /* Set uapsd configuration for a given peer.
+*
+* Include the delivery and trigger enabled state for every AC.
+* The host  MLME needs to set this based on AP capability and stations
+* request Set in the association request  received from the station.
+*
+* Lower 8 bits of the value specify the UAPSD configuration.
+*
+* (see enum wmi_ap_ps_param_uapsd)
+* The default value is 0.
+*/
+   WMI_AP_PS_PEER_PARAM_UAPSD = 0,
+
+   /*
+* Set the service period for a UAPSD capable station
+*
+* The service period from wme ie in the (re)assoc request frame.
+*
+* (see enum wmi_ap_ps_peer_param_max_sp)
+*/
+   WMI_AP_PS_PEER_PARAM_MAX_SP = 1,
+
+   /* Time in seconds for aging out buffered frames for STA in PS */
+   WMI_AP_PS_PEER_PARAM_AGEOUT_TIME = 2,
+};
+
+struct wmi_ap_ps_peer_cmd {
+   /* unique id identifying the VDEV, generated by the caller */
+   __le32 vdev_id;
+
+   /* peer MAC address */
+   struct wmi_mac_addr peer_macaddr;
+
+   /* AP powersave param (see enum wmi_ap_ps_peer_param) */
+   __le32 param_id;
+
+   /* AP powersave param value */
+   __le32 param_value;
+} __packed;
+
 /* 128 clients = 4 words */
 #define WMI_TIM_BITMAP_ARRAY_SIZE 4
 
@@ -2876,6 +2942,8 @@ int ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id,
 int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id,
enum wmi_sta_powersave_param param_id,
u32 value);
+int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac,
+  enum wmi_ap_ps_peer_param param_id, u32 value);
 int ath10k_wmi_scan_chan_list(struct ath10k *ar,
  const struct wmi_scan_chan_list_arg *arg);
 int ath10k_wmi_beacon_send(struct ath10k *ar, const struct wmi_bcn_tx_arg 
*arg);
-- 
1.7.9.5

___
ath9k-devel mail

Re: [ath9k-devel] [PATCH v2 1/3] ath10k: WMI add AP PS

2013-05-13 Thread Kalle Valo
Janusz Dziedzic  writes:

> Add AP power save (UAPSD) structures, enums.
>
> Signed-off-by: Janusz Dziedzic 

Thanks, all three applied.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel