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

rsi: Add support to filter rx frames

Filtering rx frames after connection in station mode avoids the
overhead of processing un-necessary frames. Hence rx filter frame
is added which can be configured to device at suitable times.
Signed-off-by: default avatarPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 159a55a6
...@@ -275,6 +275,8 @@ static int rsi_mac80211_start(struct ieee80211_hw *hw) ...@@ -275,6 +275,8 @@ static int rsi_mac80211_start(struct ieee80211_hw *hw)
common->iface_down = false; common->iface_down = false;
mutex_unlock(&common->mutex); mutex_unlock(&common->mutex);
rsi_send_rx_filter_frame(common, 0);
return 0; return 0;
} }
...@@ -471,11 +473,19 @@ static void rsi_mac80211_bss_info_changed(struct ieee80211_hw *hw, ...@@ -471,11 +473,19 @@ static void rsi_mac80211_bss_info_changed(struct ieee80211_hw *hw,
{ {
struct rsi_hw *adapter = hw->priv; struct rsi_hw *adapter = hw->priv;
struct rsi_common *common = adapter->priv; struct rsi_common *common = adapter->priv;
u16 rx_filter_word = 0;
mutex_lock(&common->mutex); mutex_lock(&common->mutex);
if (changed & BSS_CHANGED_ASSOC) { if (changed & BSS_CHANGED_ASSOC) {
rsi_dbg(INFO_ZONE, "%s: Changed Association status: %d\n", rsi_dbg(INFO_ZONE, "%s: Changed Association status: %d\n",
__func__, bss_conf->assoc); __func__, bss_conf->assoc);
if (bss_conf->assoc) {
/* Send the RX filter frame */
rx_filter_word = (ALLOW_DATA_ASSOC_PEER |
ALLOW_CTRL_ASSOC_PEER |
ALLOW_MGMT_ASSOC_PEER);
rsi_send_rx_filter_frame(common, rx_filter_word);
}
rsi_inform_bss_status(common, rsi_inform_bss_status(common,
bss_conf->assoc, bss_conf->assoc,
bss_conf->bssid, bss_conf->bssid,
...@@ -1013,6 +1023,7 @@ static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw, ...@@ -1013,6 +1023,7 @@ static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw,
struct rsi_common *common = adapter->priv; struct rsi_common *common = adapter->priv;
mutex_lock(&common->mutex); mutex_lock(&common->mutex);
/* Resetting all the fields to default values */ /* Resetting all the fields to default values */
common->bitrate_mask[NL80211_BAND_2GHZ] = 0; common->bitrate_mask[NL80211_BAND_2GHZ] = 0;
common->bitrate_mask[NL80211_BAND_5GHZ] = 0; common->bitrate_mask[NL80211_BAND_5GHZ] = 0;
...@@ -1022,8 +1033,11 @@ static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw, ...@@ -1022,8 +1033,11 @@ static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw,
common->vif_info[0].seq_start = 0; common->vif_info[0].seq_start = 0;
common->secinfo.ptk_cipher = 0; common->secinfo.ptk_cipher = 0;
common->secinfo.gtk_cipher = 0; common->secinfo.gtk_cipher = 0;
mutex_unlock(&common->mutex);
rsi_send_rx_filter_frame(common, 0);
mutex_unlock(&common->mutex);
return 0; return 0;
} }
......
...@@ -1243,6 +1243,39 @@ int rsi_send_block_unblock_frame(struct rsi_common *common, bool block_event) ...@@ -1243,6 +1243,39 @@ int rsi_send_block_unblock_frame(struct rsi_common *common, bool block_event)
} }
/**
* rsi_send_rx_filter_frame() - Sends a frame to filter the RX packets
*
* @common: Pointer to the driver private structure.
* @rx_filter_word: Flags of filter packets
*
* @Return: 0 on success, -1 on failure.
*/
int rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word)
{
struct rsi_mac_frame *cmd_frame;
struct sk_buff *skb;
rsi_dbg(MGMT_TX_ZONE, "Sending RX filter frame\n");
skb = dev_alloc_skb(FRAME_DESC_SZ);
if (!skb) {
rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n",
__func__);
return -ENOMEM;
}
memset(skb->data, 0, FRAME_DESC_SZ);
cmd_frame = (struct rsi_mac_frame *)skb->data;
cmd_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12);
cmd_frame->desc_word[1] = cpu_to_le16(SET_RX_FILTER);
cmd_frame->desc_word[4] = cpu_to_le16(rx_filter_word);
skb_put(skb, FRAME_DESC_SZ);
return rsi_send_internal_mgmt_frame(common, skb);
}
/** /**
* rsi_handle_ta_confirm_type() - This function handles the confirm frames. * rsi_handle_ta_confirm_type() - This function handles the confirm frames.
......
...@@ -140,6 +140,16 @@ ...@@ -140,6 +140,16 @@
#define RSI_SUPP_FILTERS (FIF_ALLMULTI | FIF_PROBE_REQ |\ #define RSI_SUPP_FILTERS (FIF_ALLMULTI | FIF_PROBE_REQ |\
FIF_BCN_PRBRESP_PROMISC) FIF_BCN_PRBRESP_PROMISC)
/* Rx filter word definitions */
#define PROMISCOUS_MODE BIT(0)
#define ALLOW_DATA_ASSOC_PEER BIT(1)
#define ALLOW_MGMT_ASSOC_PEER BIT(2)
#define ALLOW_CTRL_ASSOC_PEER BIT(3)
#define DISALLOW_BEACONS BIT(4)
#define ALLOW_CONN_PEER_MGMT_WHILE_BUF_FULL BIT(5)
#define DISALLOW_BROADCAST_DATA BIT(6)
enum opmode { enum opmode {
STA_OPMODE = 1, STA_OPMODE = 1,
AP_OPMODE = 2 AP_OPMODE = 2
...@@ -313,4 +323,5 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb); ...@@ -313,4 +323,5 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb);
int rsi_send_mgmt_pkt(struct rsi_common *common, struct sk_buff *skb); int rsi_send_mgmt_pkt(struct rsi_common *common, struct sk_buff *skb);
int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb); int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb);
int rsi_band_check(struct rsi_common *common); int rsi_band_check(struct rsi_common *common);
int rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word);
#endif #endif
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