wl12xx: declare support for WIPHY_FLAG_AP_UAPSD
authorEliad Peller <eliad@wizery.com>
Thu, 25 Aug 2011 11:26:54 +0000 (14:26 +0300)
committerLuciano Coelho <coelho@ti.com>
Wed, 14 Sep 2011 09:09:38 +0000 (12:09 +0300)
Declare support for uapsd when working as AP, and
set psd_type and sp_len whan a station is being added.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/cmd.c
drivers/net/wireless/wl12xx/cmd.h
drivers/net/wireless/wl12xx/main.c

index 9ec2f31b0ecfd78615c9619f55590242e54555bb..084262f169b2e3469b3150f21657a08ce0f8a758 100644 (file)
@@ -1413,7 +1413,7 @@ out:
 int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid)
 {
        struct wl12xx_cmd_add_peer *cmd;
-       int ret;
+       int i, ret;
        u32 sta_rates;
 
        wl1271_debug(DEBUG_CMD, "cmd add peer %d", (int)hlid);
@@ -1424,15 +1424,19 @@ int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid)
                goto out;
        }
 
-       /* currently we don't support UAPSD */
-       cmd->sp_len = 0;
-
        memcpy(cmd->addr, sta->addr, ETH_ALEN);
        cmd->bss_index = WL1271_AP_BSS_INDEX;
        cmd->aid = sta->aid;
        cmd->hlid = hlid;
+       cmd->sp_len = sta->max_sp;
        cmd->wmm = sta->wme ? 1 : 0;
 
+       for (i = 0; i < NUM_ACCESS_CATEGORIES_COPY; i++)
+               if (sta->wme && (sta->uapsd_queues & BIT(i)))
+                       cmd->psd_type[i] = WL1271_PSD_UPSD_TRIGGER;
+               else
+                       cmd->psd_type[i] = WL1271_PSD_LEGACY;
+
        sta_rates = sta->supp_rates[wl->band];
        if (sta->ht_cap.ht_supported)
                sta_rates |= sta->ht_cap.mcs.rx_mask[0] << HW_HT_RATES_OFFSET;
@@ -1440,7 +1444,8 @@ int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid)
        cmd->supported_rates =
                cpu_to_le32(wl1271_tx_enabled_rates_get(wl, sta_rates));
 
-       wl1271_debug(DEBUG_CMD, "new peer rates: 0x%x", cmd->supported_rates);
+       wl1271_debug(DEBUG_CMD, "new peer rates=0x%x queues=0x%x",
+                    cmd->supported_rates, sta->uapsd_queues);
 
        ret = wl1271_cmd_send(wl, CMD_ADD_PEER, cmd, sizeof(*cmd), 0);
        if (ret < 0) {
index 22c2f373dd04b51d9593df45f0769767c05a4277..8e4d11ec0c55fd7cda5b90a1751a48031d7abb41 100644 (file)
@@ -591,6 +591,13 @@ enum wl12xx_ssid_type {
        WL12XX_SSID_TYPE_ANY = 2,
 };
 
+enum wl1271_psd_type {
+       WL1271_PSD_LEGACY = 0,
+       WL1271_PSD_UPSD_TRIGGER = 1,
+       WL1271_PSD_LEGACY_PSPOLL = 2,
+       WL1271_PSD_SAPSD = 3
+};
+
 struct wl12xx_cmd_add_peer {
        struct wl1271_cmd_header header;
 
index e5b871c5c5211d6cfabdd96bce35c63796104d11..501a9e408d7a6642c223b3a3967b7ef45e48e23d 100644 (file)
@@ -4512,6 +4512,8 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
        wl->hw->wiphy->max_scan_ie_len = WL1271_CMD_TEMPL_DFLT_SIZE -
                        sizeof(struct ieee80211_header);
 
+       wl->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
+
        /* make sure all our channels fit in the scanned_ch bitmask */
        BUILD_BUG_ON(ARRAY_SIZE(wl1271_channels) +
                     ARRAY_SIZE(wl1271_channels_5ghz) >