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

rsi: add interface changes for ap mode

AP mode is handled in add_interface callback of mac80211.
Also for AP mode, sending rx filter frame to disallow beacons
to host is added. Station structures are initialized to NULL.
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 6da1e00a
......@@ -342,25 +342,51 @@ static int rsi_mac80211_add_interface(struct ieee80211_hw *hw,
{
struct rsi_hw *adapter = hw->priv;
struct rsi_common *common = adapter->priv;
enum opmode intf_mode;
int ret = -EOPNOTSUPP;
vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
mutex_lock(&common->mutex);
if (adapter->sc_nvifs > 1) {
mutex_unlock(&common->mutex);
return -EOPNOTSUPP;
}
switch (vif->type) {
case NL80211_IFTYPE_STATION:
if (!adapter->sc_nvifs) {
++adapter->sc_nvifs;
adapter->vifs[0] = vif;
ret = rsi_set_vap_capabilities(common,
STA_OPMODE,
VAP_ADD);
}
rsi_dbg(INFO_ZONE, "Station Mode");
intf_mode = STA_OPMODE;
break;
case NL80211_IFTYPE_AP:
rsi_dbg(INFO_ZONE, "AP Mode");
intf_mode = AP_OPMODE;
break;
default:
rsi_dbg(ERR_ZONE,
"%s: Interface type %d not supported\n", __func__,
vif->type);
goto out;
}
adapter->vifs[adapter->sc_nvifs++] = vif;
ret = rsi_set_vap_capabilities(common, intf_mode, common->mac_addr,
0, VAP_ADD);
if (ret) {
rsi_dbg(ERR_ZONE, "Failed to set VAP capabilities\n");
goto out;
}
if (vif->type == NL80211_IFTYPE_AP) {
int i;
rsi_send_rx_filter_frame(common, DISALLOW_BEACONS);
common->min_rate = RSI_RATE_AUTO;
for (i = 0; i < common->max_stations; i++)
common->stations[i].sta = NULL;
}
out:
mutex_unlock(&common->mutex);
return ret;
......@@ -383,7 +409,8 @@ static void rsi_mac80211_remove_interface(struct ieee80211_hw *hw,
mutex_lock(&common->mutex);
if (vif->type == NL80211_IFTYPE_STATION) {
adapter->sc_nvifs--;
rsi_set_vap_capabilities(common, STA_OPMODE, VAP_DELETE);
rsi_set_vap_capabilities(common, STA_OPMODE, vif->addr,
0, VAP_DELETE);
}
if (!memcmp(adapter->vifs[0], vif, sizeof(struct ieee80211_vif)))
......
......@@ -624,6 +624,8 @@ static int rsi_program_bb_rf(struct rsi_common *common)
*/
int rsi_set_vap_capabilities(struct rsi_common *common,
enum opmode mode,
u8 *mac_addr,
u8 vap_id,
u8 vap_status)
{
struct sk_buff *skb = NULL;
......@@ -632,7 +634,6 @@ int rsi_set_vap_capabilities(struct rsi_common *common,
struct ieee80211_hw *hw = adapter->hw;
struct ieee80211_conf *conf = &hw->conf;
u16 frame_len = sizeof(struct rsi_vap_caps);
u16 vap_id = 0;
rsi_dbg(MGMT_TX_ZONE, "%s: Sending VAP capabilities frame\n", __func__);
......@@ -656,7 +657,7 @@ int rsi_set_vap_capabilities(struct rsi_common *common,
vap_caps->radioid_macid = ((common->mac_id & 0xf) << 4) |
(common->radio_id & 0xf);
memcpy(vap_caps->mac_addr, common->mac_addr, IEEE80211_ADDR_LEN);
memcpy(vap_caps->mac_addr, mac_addr, IEEE80211_ADDR_LEN);
vap_caps->keep_alive_period = cpu_to_le16(90);
vap_caps->frag_threshold = cpu_to_le16(IEEE80211_MAX_FRAG_THRESHOLD);
......
......@@ -90,6 +90,7 @@ extern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, ...);
#define IEEE80211_MGMT_FRAME 0x00
#define IEEE80211_CTL_FRAME 0x04
#define RSI_MAX_ASSOC_STAS 32
#define IEEE80211_QOS_TID 0x0f
#define IEEE80211_NONQOS_TID 16
......@@ -262,6 +263,8 @@ struct rsi_common {
u8 dtim_cnt;
/* AP mode parameters */
struct rsi_sta stations[RSI_MAX_ASSOC_STAS + 1];
int num_stations;
int max_stations;
};
......
......@@ -188,8 +188,8 @@
IEEE80211_WMM_IE_STA_QOSINFO_AC_BK)
enum opmode {
STA_OPMODE = 1,
AP_OPMODE = 2
AP_OPMODE = 0,
STA_OPMODE,
};
enum vap_status {
......@@ -591,7 +591,7 @@ static inline void rsi_set_len_qno(__le16 *addr, u16 len, u8 qno)
int rsi_mgmt_pkt_recv(struct rsi_common *common, u8 *msg);
int rsi_set_vap_capabilities(struct rsi_common *common, enum opmode mode,
u8 vap_status);
u8 *mac_addr, u8 vap_id, u8 vap_status);
int rsi_send_aggregation_params_frame(struct rsi_common *common, u16 tid,
u16 ssn, u8 buf_size, u8 event);
int rsi_hal_load_key(struct rsi_common *common, u8 *data, u16 key_len,
......
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