Commit f04854fa authored by Prameela Rani Garnepudi's avatar Prameela Rani Garnepudi Committed by Kalle Valo

rsi: update set_channel command frame

TX command frame set_channel is modified to use common
descriptor structure. Also DFS channel indication to firmware
is added in the descriptor for dfs channels configuration.
Signed-off-by: default avatarPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: default avatarAmitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 5c7ca1bb
...@@ -965,12 +965,13 @@ int rsi_set_channel(struct rsi_common *common, ...@@ -965,12 +965,13 @@ int rsi_set_channel(struct rsi_common *common,
struct ieee80211_channel *channel) struct ieee80211_channel *channel)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct rsi_mac_frame *mgmt_frame; struct rsi_chan_config *chan_cfg;
u16 frame_len = sizeof(struct rsi_chan_config);
rsi_dbg(MGMT_TX_ZONE, rsi_dbg(MGMT_TX_ZONE,
"%s: Sending scan req frame\n", __func__); "%s: Sending scan req frame\n", __func__);
skb = dev_alloc_skb(FRAME_DESC_SZ); skb = dev_alloc_skb(frame_len);
if (!skb) { if (!skb) {
rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n",
__func__); __func__);
...@@ -981,37 +982,33 @@ int rsi_set_channel(struct rsi_common *common, ...@@ -981,37 +982,33 @@ int rsi_set_channel(struct rsi_common *common,
dev_kfree_skb(skb); dev_kfree_skb(skb);
return 0; return 0;
} }
memset(skb->data, 0, FRAME_DESC_SZ); memset(skb->data, 0, frame_len);
mgmt_frame = (struct rsi_mac_frame *)skb->data; chan_cfg = (struct rsi_chan_config *)skb->data;
mgmt_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); rsi_set_len_qno(&chan_cfg->desc_dword0.len_qno, 0, RSI_WIFI_MGMT_Q);
mgmt_frame->desc_word[1] = cpu_to_le16(SCAN_REQUEST); chan_cfg->desc_dword0.frame_type = SCAN_REQUEST;
mgmt_frame->desc_word[4] = cpu_to_le16(channel->hw_value); chan_cfg->channel_number = channel->hw_value;
chan_cfg->antenna_gain_offset_2g = channel->max_antenna_gain;
mgmt_frame->desc_word[4] |= chan_cfg->antenna_gain_offset_5g = channel->max_antenna_gain;
cpu_to_le16(((char)(channel->max_antenna_gain)) << 8); chan_cfg->region_rftype = (RSI_RF_TYPE & 0xf) << 4;
mgmt_frame->desc_word[5] =
cpu_to_le16((char)(channel->max_antenna_gain)); if ((channel->flags & IEEE80211_CHAN_NO_IR) ||
(channel->flags & IEEE80211_CHAN_RADAR)) {
mgmt_frame->desc_word[7] = cpu_to_le16(PUT_BBP_RESET | chan_cfg->antenna_gain_offset_2g |= RSI_CHAN_RADAR;
BBP_REG_WRITE | } else {
(RSI_RF_TYPE << 4));
if (!(channel->flags & IEEE80211_CHAN_NO_IR) &&
!(channel->flags & IEEE80211_CHAN_RADAR)) {
if (common->tx_power < channel->max_power) if (common->tx_power < channel->max_power)
mgmt_frame->desc_word[6] = cpu_to_le16(common->tx_power); chan_cfg->tx_power = cpu_to_le16(common->tx_power);
else else
mgmt_frame->desc_word[6] = cpu_to_le16(channel->max_power); chan_cfg->tx_power = cpu_to_le16(channel->max_power);
} }
mgmt_frame->desc_word[7] = cpu_to_le16(common->priv->dfs_region); chan_cfg->region_rftype |= (common->priv->dfs_region & 0xf);
if (common->channel_width == BW_40MHZ) if (common->channel_width == BW_40MHZ)
mgmt_frame->desc_word[5] |= cpu_to_le16(0x1 << 8); chan_cfg->channel_width = 0x1;
common->channel = channel->hw_value; common->channel = channel->hw_value;
skb_put(skb, FRAME_DESC_SZ); skb_put(skb, frame_len);
return rsi_send_internal_mgmt_frame(common, skb); return rsi_send_internal_mgmt_frame(common, skb);
} }
......
...@@ -166,6 +166,7 @@ ...@@ -166,6 +166,7 @@
#define DISALLOW_BROADCAST_DATA BIT(6) #define DISALLOW_BROADCAST_DATA BIT(6)
#define RSI_MPDU_DENSITY 0x8 #define RSI_MPDU_DENSITY 0x8
#define RSI_CHAN_RADAR BIT(7)
enum opmode { enum opmode {
STA_OPMODE = 1, STA_OPMODE = 1,
...@@ -306,6 +307,18 @@ struct rsi_bb_rf_prog { ...@@ -306,6 +307,18 @@ struct rsi_bb_rf_prog {
__le16 flags; __le16 flags;
} __packed; } __packed;
struct rsi_chan_config {
struct rsi_cmd_desc_dword0 desc_dword0;
struct rsi_cmd_desc_dword1 desc_dword1;
u8 channel_number;
u8 antenna_gain_offset_2g;
u8 antenna_gain_offset_5g;
u8 channel_width;
__le16 tx_power;
u8 region_rftype;
u8 flags;
} __packed;
struct rsi_vap_caps { struct rsi_vap_caps {
__le16 desc_word[8]; __le16 desc_word[8];
u8 mac_addr[6]; u8 mac_addr[6];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment