rsi: RTS threshold configuration
authorKarun Eagalapati <karun256@gmail.com>
Thu, 3 Aug 2017 14:29:04 +0000 (19:59 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 8 Aug 2017 11:46:04 +0000 (14:46 +0300)
Provision is added for configuring RTS threshold by sending
vap dynamic update frame to firmware.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_mac80211.c
drivers/net/wireless/rsi/rsi_91x_mgmt.c
drivers/net/wireless/rsi/rsi_main.h
drivers/net/wireless/rsi/rsi_mgmt.h

index 6b833c424b182731e01102b30f7b5a10f99a7007..210ad79038ed8de83ddd830bed399dca96ced9b2 100644 (file)
@@ -497,6 +497,15 @@ static int rsi_mac80211_config(struct ieee80211_hw *hw,
                spin_unlock_irqrestore(&adapter->ps_lock, flags);
        }
 
+       /* RTS threshold */
+       if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
+               rsi_dbg(INFO_ZONE, "RTS threshold\n");
+               if ((common->rts_threshold) <= IEEE80211_MAX_RTS_THRESHOLD) {
+                       rsi_dbg(INFO_ZONE,
+                               "%s: Sending vap updates....\n", __func__);
+                       status = rsi_send_vap_dynamic_update(common);
+               }
+       }
        mutex_unlock(&common->mutex);
 
        return status;
index e5fe443ddfb686a692c599993b5b912d268d07a5..f93499d0b8fa8be86ed509a7bd99d52ef1856cfb 100644 (file)
@@ -1058,6 +1058,37 @@ int rsi_send_radio_params_update(struct rsi_common *common)
        return rsi_send_internal_mgmt_frame(common, skb);
 }
 
+/* This function programs the threshold. */
+int rsi_send_vap_dynamic_update(struct rsi_common *common)
+{
+       struct sk_buff *skb;
+       struct rsi_dynamic_s *dynamic_frame;
+
+       rsi_dbg(MGMT_TX_ZONE,
+               "%s: Sending vap update indication frame\n", __func__);
+
+       skb = dev_alloc_skb(sizeof(struct rsi_dynamic_s));
+       if (!skb)
+               return -ENOMEM;
+
+       memset(skb->data, 0, sizeof(struct rsi_dynamic_s));
+       dynamic_frame = (struct rsi_dynamic_s *)skb->data;
+       rsi_set_len_qno(&dynamic_frame->desc_dword0.len_qno,
+                       sizeof(dynamic_frame->frame_body), RSI_WIFI_MGMT_Q);
+
+       dynamic_frame->desc_dword0.frame_type = VAP_DYNAMIC_UPDATE;
+       dynamic_frame->desc_dword2.pkt_info =
+                                       cpu_to_le32(common->rts_threshold);
+       /* Beacon miss threshold */
+       dynamic_frame->frame_body.keep_alive_period =
+                                       cpu_to_le16(RSI_DEF_KEEPALIVE);
+       dynamic_frame->desc_dword3.sta_id = 0; /* vap id */
+
+       skb_put(skb, sizeof(struct rsi_dynamic_s));
+
+       return rsi_send_internal_mgmt_frame(common, skb);
+}
+
 /**
  * rsi_compare() - This function is used to compare two integers
  * @a: pointer to the first integer
index d2cc47e98639fc685cda93043c0da36d288a883f..d05b5e0847bc16300006363e4ab13141d749aa3a 100644 (file)
@@ -58,6 +58,7 @@ extern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, ...);
 #define IEEE80211_ADDR_LEN              6
 #define FRAME_DESC_SZ                   16
 #define MIN_802_11_HDR_LEN              24
+#define RSI_DEF_KEEPALIVE               90
 
 #define DATA_QUEUE_WATER_MARK           400
 #define MIN_DATA_QUEUE_WATER_MARK       300
index b22103fd6c810baf4e77082bc4cc9f2ed9435ba3..201a46572c6914695c77f00186473b65732314f8 100644 (file)
@@ -239,6 +239,7 @@ enum cmd_frame_type {
        CW_MODE_REQ,
        PER_CMD_PKT,
        ANT_SEL_FRAME = 0x20,
+       VAP_DYNAMIC_UPDATE = 0x27,
        COMMON_DEV_CONFIG = 0x28,
        RADIO_PARAMS_UPDATE = 0x29
 };
@@ -374,6 +375,18 @@ struct rsi_ant_sel_frame {
        __le32 reserved2;
 } __packed;
 
+struct rsi_dynamic_s {
+       struct rsi_cmd_desc_dword0 desc_dword0;
+       struct rsi_cmd_desc_dword1 desc_dword1;
+       struct rsi_cmd_desc_dword2 desc_dword2;
+       struct rsi_cmd_desc_dword3 desc_dword3;
+       struct framebody {
+               __le16 data_rate;
+               __le16 mgmt_rate;
+               __le16 keep_alive_period;
+       } frame_body;
+} __packed;
+
 /* Key descriptor flags */
 #define RSI_KEY_TYPE_BROADCAST BIT(1)
 #define RSI_WEP_KEY            BIT(2)
@@ -585,6 +598,7 @@ int rsi_hal_load_key(struct rsi_common *common, u8 *data, u16 key_len,
                     u8 key_type, u8 key_id, u32 cipher);
 int rsi_set_channel(struct rsi_common *common,
                    struct ieee80211_channel *channel);
+int rsi_send_vap_dynamic_update(struct rsi_common *common);
 int rsi_send_block_unblock_frame(struct rsi_common *common, bool event);
 void rsi_inform_bss_status(struct rsi_common *common, u8 status,
                           const u8 *bssid, u8 qos_enable, u16 aid);