BigW Consortium Gitlab

Commit 4271ac69 by David Clark

Updates after configuring MT7697 to not auto connect

parent fe6b233f
......@@ -1014,29 +1014,26 @@ int mt7697_cfg80211_stop(struct mt7697_vif *vif)
mt7697_tx_stop(vif->cfg);
if ((vif->cfg->wifi_cfg.opmode == MT7697_WIFI_MODE_STA_ONLY) &&
(vif->cfg->radio_state == MT7697_RADIO_STATE_ON)) {
ret = mt7697_wr_set_radio_state_req(vif->cfg, MT7697_RADIO_STATE_OFF);
if (vif->wdev.iftype == NL80211_IFTYPE_STATION) {
ret = mt7697_wr_disconnect_req(vif->cfg, NULL);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_set_radio_state_req() failed(%d)\n",
"%s(): mt7697_wr_disconnect_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
vif->cfg->radio_state = MT7697_RADIO_STATE_OFF;
}
if (vif->wdev.iftype == NL80211_IFTYPE_STATION) {
switch (vif->sme_state) {
case SME_DISCONNECTED:
break;
case SME_CONNECTING:
cfg80211_connect_result(vif->ndev, vif->bssid, NULL, 0,
NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL);
break;
case SME_CONNECTED:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,44)
cfg80211_disconnected(vif->ndev, 0, NULL, 0,
......@@ -1087,50 +1084,8 @@ int mt7697_cfg80211_stop(struct mt7697_vif *vif)
}
memset(vif->ssid, 0, IEEE80211_MAX_SSID_LEN);
ret = mt7697_wr_set_ssid_req(vif->cfg, IEEE80211_MAX_SSID_LEN, vif->ssid);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_set_ssid_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
memset(vif->req_bssid, 0, ETH_ALEN);
ret = mt7697_wr_set_bssid_req(vif->cfg, vif->req_bssid);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_set_channel_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
memset(vif->pmk, 0, MT7697_WIFI_LENGTH_PMK);
ret = mt7697_wr_set_pmk_req(vif->cfg, vif->pmk);
if (ret < 0) {
dev_err(vif->cfg->dev, "%s(): mt7697_wr_set_pmk_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
ret = mt7697_wr_reload_settings_req(vif->cfg, vif->fw_vif_idx);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_reload_settings_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
if (vif->cfg->radio_state == MT7697_RADIO_STATE_ON) {
ret = mt7697_wr_set_radio_state_req(vif->cfg, MT7697_RADIO_STATE_OFF);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_set_radio_state_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
vif->cfg->radio_state = MT7697_RADIO_STATE_OFF;
}
/* Stop netdev queues, needed during recovery */
netif_stop_queue(vif->ndev);
......@@ -1428,7 +1383,12 @@ int mt7697_cfg80211_connect_event(struct mt7697_vif *vif, const u8* bssid,
set_bit(CONNECTED, &vif->flags);
clear_bit(CONNECT_PEND, &vif->flags);
dev_dbg(cfg->dev, "%s(): vif flags(0x%08lx)\n", __func__, vif->flags);
if (bssid) {
print_hex_dump(KERN_DEBUG, DRVNAME" BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, bssid, ETH_ALEN, 0);
}
if ((channel > 0) && (channel <= MT7697_CH_MAX_2G_CHANNEL))
band = wiphy->bands[IEEE80211_BAND_2GHZ];
......@@ -1519,14 +1479,6 @@ int mt7697_cfg80211_get_params(struct mt7697_cfg80211_info *cfg)
goto failed;
}
err = mt7697_wr_get_radio_state_req(cfg);
if (err < 0) {
dev_err(cfg->dev,
"%s(): mt7697_wr_get_radio_state_req() failed(%d)\n",
__func__, err);
goto failed;
}
err = mt7697_wr_get_wireless_mode_req(cfg);
if (err < 0) {
dev_err(cfg->dev,
......
......@@ -112,7 +112,6 @@ struct mt7697_cfg80211_info {
u8 probe_data[LEN32_ALIGNED(IEEE80211_MAX_DATA_LEN)];
enum mt7697_port_type port_type;
enum mt7697_radio_state radio_state;
enum mt7697_wifi_phy_mode_t wireless_mode;
enum mt7697_wifi_phy_mode_t hw_wireless_mode;
struct mac_address mac_addr;
......
......@@ -341,6 +341,7 @@ static int mt7697_wext_siwessid(struct net_device *ndev,
goto cleanup;
}
if (vif->ssid_len > 0) {
if (cfg->wifi_cfg.opmode == MT7697_WIFI_MODE_STA_ONLY) {
ret = mt7697_wr_set_bssid_req(cfg, vif->req_bssid);
if (ret < 0) {
......@@ -370,7 +371,7 @@ static int mt7697_wext_siwessid(struct net_device *ndev,
goto cleanup;
}
}
else if (vif->ssid_len > 0) {
else {
ret = mt7697_wr_set_security_mode_req(cfg,
MT7697_WIFI_AUTH_MODE_OPEN,
MT7697_WIFI_ENCRYPT_TYPE_ENCRYPT_DISABLED);
......@@ -382,13 +383,13 @@ static int mt7697_wext_siwessid(struct net_device *ndev,
}
}
if (len > 0) {
if (test_bit(CONNECTED, &vif->flags)) {
dev_dbg(cfg->dev, "%s(): already connected\n",
__func__);
goto cleanup;
}
set_bit(CONNECT_PEND, &vif->flags);
vif->sme_state = SME_CONNECTING;
if (test_bit(DESTROY_IN_PROGRESS, &cfg->flag)) {
......@@ -406,6 +407,16 @@ static int mt7697_wext_siwessid(struct net_device *ndev,
goto cleanup;
}
}
else if ((cfg->wifi_cfg.opmode == MT7697_WIFI_MODE_STA_ONLY) &&
test_bit(CONNECTED, &vif->flags)) {
ret = mt7697_wr_disconnect_req(vif->cfg, NULL);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_disconnect_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
}
cleanup:
return ret;
......@@ -541,7 +552,6 @@ static int mt7697_wext_siwencodeext(struct net_device *ndev,
if (ext->alg == IW_ENCODE_ALG_PMK) {
print_hex_dump(KERN_DEBUG, DRVNAME" PMK ",
DUMP_PREFIX_OFFSET, 16, 1, ext->key, ext->key_len, 0);
memcpy(vif->pmk, ext->key, ext->key_len);
}
......
......@@ -66,19 +66,6 @@ static int mt7697_open(struct net_device *ndev)
cfg->rxq_hdl = cfg->txq_hdl;
}
if ((cfg->wifi_cfg.opmode == MT7697_WIFI_MODE_STA_ONLY) &&
(cfg->radio_state == MT7697_RADIO_STATE_OFF)) {
ret = mt7697_wr_set_radio_state_req(cfg, MT7697_RADIO_STATE_ON);
if (ret < 0) {
dev_err(cfg->dev,
"%s(): mt7697_wr_set_radio_state_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
cfg->radio_state = MT7697_RADIO_STATE_ON;
}
set_bit(WLAN_ENABLED, &vif->flags);
if (test_bit(CONNECTED, &vif->flags)) {
......@@ -181,15 +168,6 @@ static void mt7697_init_hw_start(struct work_struct *work)
cfg->rxq_hdl = cfg->txq_hdl;
}
cfg->radio_state = MT7697_RADIO_STATE_OFF;
err = mt7697_wr_set_radio_state_req(cfg, MT7697_RADIO_STATE_OFF);
if (err < 0) {
dev_err(cfg->dev,
"%s(): mt7697_wr_set_radio_state_req() failed(%d)\n",
__func__, err);
goto failed;
}
err = mt7697_wr_cfg_req(cfg);
if (err < 0) {
dev_err(cfg->dev, "%s(): mt7697_wr_cfg_req() failed(%d)\n",
......
......@@ -70,11 +70,6 @@ enum mt7697_port_type {
MT7697_PORT_AP,
};
enum mt7697_radio_state {
MT7697_RADIO_STATE_OFF = 0,
MT7697_RADIO_STATE_ON,
};
enum mt7697_scan_mode {
MT7697_WIFI_SCAN_MODE_FULL = 0,
MT7697_WIFI_SCAN_MODE_PARTIAL,
......
......@@ -268,41 +268,6 @@ cleanup:
return ret;
}
static int mt7697_proc_get_radio_state(const struct mt7697_rsp_hdr* rsp,
struct mt7697_cfg80211_info *cfg)
{
u32 state;
int ret;
dev_dbg(cfg->dev, "%s(): --> GET RADIO STATE RSP\n", __func__);
if (rsp->cmd.len - sizeof(struct mt7697_rsp_hdr) != sizeof(u32)) {
dev_err(cfg->dev,
"%s(): invalid get radio state rsp len(%u != %u)\n",
__func__,
rsp->cmd.len - sizeof(struct mt7697_rsp_hdr),
sizeof(u32));
ret = -EINVAL;
goto cleanup;
}
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&state,
LEN_TO_WORD(sizeof(u32)));
if (ret != LEN_TO_WORD(sizeof(u32))) {
dev_err(cfg->dev, "%s(): read() failed(%d != %d)\n",
__func__, ret, LEN_TO_WORD(sizeof(u32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
cfg->radio_state = state;
dev_dbg(cfg->dev, "%s(): radio state(%u)\n",
__func__, cfg->radio_state);
ret = 0;
cleanup:
return ret;
}
static int mt7697_proc_get_listen_interval(const struct mt7697_rsp_hdr* rsp,
struct mt7697_cfg80211_info *cfg)
{
......@@ -623,6 +588,7 @@ static int mt7697_proc_connect_ind(const struct mt7697_rsp_hdr* rsp,
}
dev_dbg(cfg->dev, "%s(): vif(%u)\n", __func__, vif->fw_vif_idx);
if (test_bit(CONNECT_PEND, &vif->flags)) {
ret = mt7697_cfg80211_connect_event(vif, bssid, channel);
if (ret < 0) {
dev_err(cfg->dev,
......@@ -631,6 +597,7 @@ static int mt7697_proc_connect_ind(const struct mt7697_rsp_hdr* rsp,
goto cleanup;
}
}
}
else {
struct station_info sinfo = {0};
......@@ -669,7 +636,6 @@ cleanup:
static int mt7697_proc_disconnect_ind(struct mt7697_cfg80211_info *cfg)
{
u8 bssid[LEN32_ALIGNED(ETH_ALEN)];
u8 ssid[LEN32_ALIGNED(IEEE80211_MAX_SSID_LEN)] = {0};
struct mt7697_vif *vif;
u32 if_idx;
u16 proto_reason = 0;
......@@ -714,8 +680,8 @@ static int mt7697_proc_disconnect_ind(struct mt7697_cfg80211_info *cfg)
}
dev_dbg(cfg->dev, "%s(): vif(%u)\n", __func__, vif->fw_vif_idx);
if (vif->sme_state == SME_CONNECTING) {
ret = mt7697_wr_disconnect_req(vif->cfg, vif->bssid);
ret = mt7697_wr_disconnect_req(vif->cfg, NULL);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_disconnect_req() failed(%d)\n",
......@@ -723,6 +689,7 @@ static int mt7697_proc_disconnect_ind(struct mt7697_cfg80211_info *cfg)
goto cleanup;
}
if (vif->sme_state == SME_CONNECTING) {
cfg80211_connect_result(vif->ndev, vif->bssid,
NULL, 0,
NULL, 0,
......@@ -730,22 +697,6 @@ static int mt7697_proc_disconnect_ind(struct mt7697_cfg80211_info *cfg)
GFP_KERNEL);
}
else if (vif->sme_state == SME_CONNECTED) {
ret = mt7697_wr_set_ssid_req(cfg, IEEE80211_MAX_SSID_LEN, ssid);
if (ret < 0) {
dev_err(cfg->dev,
"%s(): mt7697_wr_set_ssid_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
ret = mt7697_wr_reload_settings_req(cfg, vif->fw_vif_idx);
if (ret < 0) {
dev_err(cfg->dev,
"%s(): mt7697_wr_reload_settings_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,44)
cfg80211_disconnected(vif->ndev, proto_reason,
NULL, 0, vif->locally_generated, GFP_KERNEL);
......@@ -881,16 +832,6 @@ int mt7697_proc_80211cmd(const struct mt7697_rsp_hdr* rsp, void* priv)
}
break;
case MT7697_CMD_GET_RADIO_STATE_RSP:
ret = mt7697_proc_get_radio_state(rsp, cfg);
if (ret < 0) {
dev_err(cfg->dev,
"mt7697_proc_get_radio_state() failed(%d)\n",
ret);
goto cleanup;
}
break;
case MT7697_CMD_GET_LISTEN_INTERVAL_RSP:
ret = mt7697_proc_get_listen_interval(rsp, cfg);
if (ret < 0) {
......@@ -991,10 +932,6 @@ int mt7697_proc_80211cmd(const struct mt7697_rsp_hdr* rsp, void* priv)
dev_dbg(cfg->dev, "%s(): --> SET WIRELESS MODE RSP\n", __func__);
break;
case MT7697_CMD_SET_RADIO_STATE_RSP:
dev_dbg(cfg->dev, "%s(): --> SET RADIO STATE\n", __func__);
break;
case MT7697_CMD_SET_SECURITY_MODE_RSP:
dev_dbg(cfg->dev, "%s(): --> SET SECURITY MODE RSP\n", __func__);
break;
......@@ -1309,60 +1246,6 @@ cleanup:
return ret;
}
int mt7697_wr_get_radio_state_req(const struct mt7697_cfg80211_info* cfg)
{
struct mt7697_get_radio_state_req req;
int ret;
req.len = sizeof(struct mt7697_get_radio_state_req);
req.grp = MT7697_CMD_GRP_80211;
req.type = MT7697_CMD_GET_RADIO_STATE_REQ;
dev_dbg(cfg->dev, "%s(): <-- GET RADIO STATE len(%u)\n",
__func__, req.len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
LEN_TO_WORD(req.len));
if (ret != LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s(): write() failed(%d != %d)\n",
__func__, ret, LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
return ret;
}
int mt7697_wr_set_radio_state_req(const struct mt7697_cfg80211_info* cfg,
u8 state)
{
struct mt7697_set_radio_state_req req;
int ret;
req.cmd.len = sizeof(struct mt7697_set_radio_state_req);
req.cmd.grp = MT7697_CMD_GRP_80211;
req.cmd.type = MT7697_CMD_SET_RADIO_STATE_REQ;
req.state = state;
dev_dbg(cfg->dev, "%s(): <-- SET RADIO STATE(%u) len(%u)\n",
__func__, state, req.cmd.len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
LEN_TO_WORD(req.cmd.len));
if (ret != LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s(): write() failed(%d != %d)\n",
__func__, ret, LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
return ret;
}
int mt7697_wr_get_listen_interval_req(const struct mt7697_cfg80211_info* cfg)
{
struct mt7697_get_listen_interval_req req;
......
......@@ -28,14 +28,12 @@
#define MT7697_PASSPHRASE_LEN 64
#define mt7697_cfg_req mt7697_cmd_hdr
#define mt7697_get_radio_state_req mt7697_cmd_hdr
#define mt7697_get_rx_filter_req mt7697_cmd_hdr
#define mt7697_get_listen_interval_req mt7697_cmd_hdr
#define mt7697_get_smart_conn_filter_req mt7697_cmd_hdr
#define mt7697_scan_stop mt7697_cmd_hdr
#define mt7697_set_wireless_mode_rsp mt7697_rsp_hdr
#define mt7697_set_radio_state_rsp mt7697_rsp_hdr
#define mt7697_set_op_mode_rsp mt7697_rsp_hdr
#define mt7697_set_rx_filter_rsp mt7697_rsp_hdr
#define mt7697_set_smart_conn_filter_rsp mt7697_rsp_hdr
......@@ -72,10 +70,6 @@ enum mt7697_wifi_cmd_types {
MT7697_CMD_SET_WIRELESS_MODE_RSP,
MT7697_CMD_SET_OP_MODE_REQ,
MT7697_CMD_SET_OP_MODE_RSP,
MT7697_CMD_GET_RADIO_STATE_REQ,
MT7697_CMD_GET_RADIO_STATE_RSP,
MT7697_CMD_SET_RADIO_STATE_REQ,
MT7697_CMD_SET_RADIO_STATE_RSP,
MT7697_CMD_GET_LISTEN_INTERVAL_REQ,
MT7697_CMD_GET_LISTEN_INTERVAL_RSP,
MT7697_CMD_SET_LISTEN_INTERVAL_REQ,
......@@ -147,16 +141,6 @@ struct mt7697_set_op_mode_req {
__be32 opmode;
} __attribute__((packed, aligned(4)));
struct mt7697_get_radio_state_rsp {
struct mt7697_rsp_hdr rsp;
__be32 state;
} __attribute__((packed, aligned(4)));
struct mt7697_set_radio_state_req {
struct mt7697_cmd_hdr cmd;
__be32 state;
} __attribute__((packed, aligned(4)));
struct mt7697_get_listen_interval_rsp {
struct mt7697_rsp_hdr rsp;
__be32 interval;
......@@ -284,8 +268,6 @@ int mt7697_wr_reload_settings_req(const struct mt7697_cfg80211_info*, u8);
int mt7697_wr_mac_addr_req(const struct mt7697_cfg80211_info*);
int mt7697_wr_cfg_req(const struct mt7697_cfg80211_info*);
int mt7697_wr_set_op_mode_req(const struct mt7697_cfg80211_info*);
int mt7697_wr_get_radio_state_req(const struct mt7697_cfg80211_info*);
int mt7697_wr_set_radio_state_req(const struct mt7697_cfg80211_info*, u8);
int mt7697_wr_get_listen_interval_req(const struct mt7697_cfg80211_info*);
int mt7697_wr_set_listen_interval_req(const struct mt7697_cfg80211_info*, u32);
int mt7697_wr_scan_req(const struct mt7697_cfg80211_info*, u32,
......
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