BigW Consortium Gitlab

Commit 3b911ff1 by David Clark

Updates after getting WiFi connect and data transfer working

parent 6e818594
......@@ -144,7 +144,8 @@ void mt7697_irq_work(struct work_struct *irq_work)
ret = mt7697io_rd_s2m_mbx(qinfo);
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_rd_s2m_mbx() failed(%d)\n", __func__, ret);
dev_err(qinfo->dev, "%s(): mt7697io_rd_s2m_mbx() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -154,7 +155,8 @@ void mt7697_irq_work(struct work_struct *irq_work)
ret = mt7697io_clr_s2m_mbx(qinfo);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): mt7697io_clr_s2m_mbx() failed(%d)\n", __func__, ret);
"%s(): mt7697io_clr_s2m_mbx() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -167,26 +169,31 @@ void mt7697_irq_work(struct work_struct *irq_work)
if (in_use &&
(dir == MT7697_QUEUE_DIR_SLAVE_TO_MASTER)) {
WARN_ON(!qs->rx_fcn);
mutex_unlock(&qinfo->mutex);
ret = qs->rx_fcn(qs->priv);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): rx_fcn() failed(%d)\n",
__func__, ret);
}
mutex_lock(&qinfo->mutex);
}
else if (!in_use) {
dev_warn(qinfo->dev,
"%s(): unused channel(%d)\n", __func__, ch);
"%s(): unused channel(%d)\n",
__func__, ch);
}
}
}
cleanup:
ret = queue_delayed_work(qinfo->irq_workq, &qinfo->irq_work,
msecs_to_jiffies(1000));
msecs_to_jiffies(100));
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): queue_delayed_work() failed(%d)\n", __func__, ret);
"%s(): queue_delayed_work() failed(%d)\n",
__func__, ret);
}
mutex_unlock(&qinfo->mutex);
......
......@@ -8,6 +8,6 @@ sources:
cflags:
{
-DDEBUG
// -DDEBUG
}
......@@ -121,29 +121,34 @@ void* mt7697q_init(u8 ch, void *priv, rx_hndlr rx_fcn)
}
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), MT7697_SPI_CS);
pr_info(DRVNAME" find SPI device('%s')\n", str);
dev_dbg(&master->dev, "%s(): find SPI device('%s')\n", __func__, str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) {
pr_err(DRVNAME" '%s' bus_find_device_by_name() failed\n", str);
dev_err(&master->dev,
"%s(): '%s' bus_find_device_by_name() failed\n",
__func__, str);
goto cleanup;
}
spi = container_of(dev, struct spi_device, dev);
if (!spi) {
pr_err(DRVNAME" get SPI device failed\n");
dev_err(&master->dev, "%s(): get SPI device failed\n",
__func__);
goto cleanup;
}
qinfo = spi_get_drvdata(spi);
if (!qinfo) {
pr_err(DRVNAME" spi_get_drvdata() failed\n");
dev_dbg(&master->dev, "%s(): spi_get_drvdata() failed\n",
__func__);
goto cleanup;
}
pr_info(DRVNAME" init queue(%u)\n", ch);
dev_dbg(&master->dev, "%s(): init queue(%u)\n", __func__, ch);
if (ch >= MT7697_NUM_QUEUES) {
pr_err(DRVNAME" invalid queue(%u)\n", ch);
dev_err(&master->dev, "%s(): invalid queue(%u)\n",
__func__, ch);
goto cleanup;
}
......@@ -155,47 +160,38 @@ void* mt7697q_init(u8 ch, void *priv, rx_hndlr rx_fcn)
mutex_lock(&qinfo->mutex);
/* TODO: Remove when CP2130 working */
while (1) {
pr_info(DRVNAME" base(0x%08x)\n", MT7697_IO_SLAVE_BUFFER_ADDRESS + ch * sizeof(struct mt7697q_data));
ret = mt7697io_rd(qinfo,
MT7697_IO_SLAVE_BUFFER_ADDRESS + ch * sizeof(struct mt7697q_data),
(u32*)&qs->data,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697q_data)));
if (ret < 0) {
pr_err(DRVNAME" mt7697io_rd() failed(%d)\n", ret);
goto failed_rd;
}
if ((ch == 0) &&
(qs->data.flags == 0x04000001) &&
!qs->data.rd_offset &&
!qs->data.wr_offset &&
(qs->data.base_addr == 0x20005ec4)) break;
else if ((ch == 1) &&
(qs->data.flags == 0x04000002) &&
!qs->data.rd_offset &&
!qs->data.wr_offset &&
(qs->data.base_addr == 0x20006ed4)) break;
}
ret = mt7697io_rd(qinfo,
MT7697_IO_SLAVE_BUFFER_ADDRESS + ch * sizeof(struct mt7697q_data),
(u32*)&qs->data,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697q_data)));
if (ret < 0) {
dev_err(&master->dev, "%s(): mt7697io_rd() failed(%d)\n",
__func__, ret);
goto failed_rd;
}
pr_info(DRVNAME" flags(0x%08x)\n", qs->data.flags);
pr_info(DRVNAME" base_addr(0x%08x)\n", qs->data.base_addr);
pr_info(DRVNAME" rd_offset(0x%08x)\n", qs->data.rd_offset);
pr_info(DRVNAME" wr_offset(0x%08x)\n", qs->data.wr_offset);
dev_dbg(&master->dev, "%s(): flags(0x%08x)\n",
__func__, qs->data.flags);
dev_dbg(&master->dev, "%s(): base_addr(0x%08x)\n",
__func__, qs->data.base_addr);
dev_dbg(&master->dev, "%s(): rd_offset(0x%08x)\n",
__func__, qs->data.rd_offset);
dev_dbg(&master->dev, "%s(): wr_offset(0x%08x)\n",
__func__, qs->data.wr_offset);
if (!qs->data.base_addr) {
pr_err(DRVNAME" invalid base address(0x%08x)\n",
qs->data.base_addr);
dev_err(&master->dev, "%s(): invalid base address(0x%08x)\n",
__func__, qs->data.base_addr);
goto failed_rd;
}
else if (!qs->data.flags) {
pr_err(DRVNAME" invalid flags(0x%08x)\n",
qs->data.flags);
dev_err(&master->dev, "%s(): invalid flags(0x%08x)\n",
__func__, qs->data.flags);
goto failed_rd;
}
else if (qs->data.rd_offset || qs->data.wr_offset) {
pr_err(DRVNAME" invalid rd/wr offset(0x%08x/0x%08x)\n",
qs->data.rd_offset, qs->data.wr_offset);
dev_err(&master->dev,
"%s(): invalid rd/wr offset(0x%08x/0x%08x)\n",
__func__, qs->data.rd_offset, qs->data.wr_offset);
goto failed_rd;
}
......@@ -389,7 +385,8 @@ size_t mt7697q_write(void *hndl, const u32 *buff, size_t num)
ret = mt7697q_push_wr_ptr(qs);
if (ret < 0) {
dev_err(qs->qinfo->dev,
"%s(): mt7697q_push_wr_ptr() failed(%d)\n", ret);
"%s(): mt7697q_push_wr_ptr() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......
......@@ -53,11 +53,36 @@ static const struct mt7697spi_hw_ops hw_ops =
.disable_irq = mt7697spi_disable_irq,
};
static int mt7697spi_probe(struct spi_device *spi)
static int __init mt7697spi_init(void)
{
char str[32];
struct spi_master *master;
struct device *dev;
struct spi_device *spi;
struct mt7697q_info *qinfo;
int ret = 0;
master = spi_busnum_to_master(MT7697_SPI_BUS_NUM);
if (!master) {
pr_err(DRVNAME" spi_busnum_to_master(%d) failed\n",
MT7697_SPI_BUS_NUM);
goto cleanup;
}
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), MT7697_SPI_CS);
pr_info(DRVNAME" find SPI device('%s')\n", str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) {
pr_err(DRVNAME" '%s' bus_find_device_by_name() failed\n", str);
goto cleanup;
}
spi = container_of(dev, struct spi_device, dev);
if (!spi) {
pr_err(DRVNAME" get SPI device failed\n");
goto cleanup;
}
pr_info(DRVNAME" init dev('%s') mode(%d) max speed(%d) "
"CS(%d) GPIO(%d) bits/word(%d)\n",
spi->modalias, spi->mode, spi->max_speed_hz, spi->chip_select,
......@@ -85,11 +110,11 @@ static int mt7697spi_probe(struct spi_device *spi)
goto cleanup;
}
/* TODO: revove after CP2130 working */
INIT_DELAYED_WORK(&qinfo->irq_work, mt7697_irq_work);
// INIT_WORK(&qinfo->irq_work, mt7697_irq_work);
qinfo->irq = spi->irq;
dev_info(qinfo->dev, "%s(): '%s' request irq(%d)\n",
__func__, spi->modalias, spi->irq);
dev_info(qinfo->dev, "'%s' request irq(%d)\n", spi->modalias, spi->irq);
/* ret = request_irq(spi->irq, mt7697_irq,
IRQF_SHARED| IRQF_NO_SUSPEND, spi->modalias, qinfo);
if (ret < 0) {
......@@ -99,12 +124,12 @@ static int mt7697spi_probe(struct spi_device *spi)
*/
spi_set_drvdata(spi, qinfo);
/* TODO: revove after CP2130 working */
ret = queue_delayed_work(qinfo->irq_workq, &qinfo->irq_work,
msecs_to_jiffies(1000));
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): queue_delayed_work() failed(%d)\n",
__func__, ret);
"queue_delayed_work() failed(%d)\n", ret);
}
return 0;
......@@ -116,37 +141,50 @@ cleanup:
return ret;
}
static int mt7697spi_remove(struct spi_device *spi)
static void __exit mt7697spi_exit(void)
{
struct mt7697q_info *qinfo = spi_get_drvdata(spi);
if (qinfo) {
dev_info(qinfo->dev, "%s(): remove\n", __func__);
free_irq(spi->irq, qinfo);
kfree(qinfo);
}
char str[32];
struct spi_master *master;
struct device *dev;
struct spi_device *spi;
struct mt7697q_info *qinfo;
return 0;
}
master = spi_busnum_to_master(MT7697_SPI_BUS_NUM);
if (!master) {
pr_err(DRVNAME" spi_busnum_to_master(%d) failed\n",
MT7697_SPI_BUS_NUM);
goto cleanup;
}
static const struct of_device_id dt_ids[] = {
{ .compatible = "MediaTek,mt7697" },
{},
};
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), MT7697_SPI_CS);
pr_info(DRVNAME" find SPI device('%s')\n", str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) {
pr_err(DRVNAME" '%s' bus_find_device_by_name() failed\n", str);
goto cleanup;
}
MODULE_DEVICE_TABLE(of, dt_ids);
spi = container_of(dev, struct spi_device, dev);
if (!spi) {
pr_err(DRVNAME" get SPI device failed\n");
goto cleanup;
}
static struct spi_driver mt7697spi_driver = {
.driver = {
.name = DRVNAME,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(dt_ids),
},
qinfo = spi_get_drvdata(spi);
if (qinfo) {
dev_info(qinfo->dev, "remove\n");
flush_workqueue(qinfo->irq_workq);
destroy_workqueue(qinfo->irq_workq);
// free_irq(spi->irq, qinfo);
kfree(qinfo);
}
.probe = mt7697spi_probe,
.remove = mt7697spi_remove,
};
cleanup:
return;
}
module_spi_driver(mt7697spi_driver)
module_init(mt7697spi_init);
module_exit(mt7697spi_exit);
MODULE_AUTHOR( "Sierra Wireless Corporation" );
MODULE_LICENSE( "GPL" );
......
......@@ -24,7 +24,7 @@
#include <linux/spi/spi.h>
#define DRVNAME "mt7697"
#define DRVNAME "mt7697q"
#define MT7697_SPI_BUS_NUM 32766
#define MT7697_SPI_CS 0
......
......@@ -19,28 +19,28 @@
#include "core.h"
#include "cfg80211.h"
#define RATETAB_ENT(_rate, _rateid, _flags) { \
.bitrate = (_rate), \
.flags = (_flags), \
.hw_value = (_rateid), \
#define RATETAB_ENT(_rate, _rateid, _flags) { \
.bitrate = (_rate), \
.flags = (_flags), \
.hw_value = (_rateid), \
}
#define CHAN2G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_2GHZ, \
.hw_value = (_channel), \
.center_freq = (_freq), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
#define CHAN2G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_2GHZ, \
.hw_value = (_channel), \
.center_freq = (_freq), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#define CHAN5G(_channel, _flags) { \
.band = IEEE80211_BAND_5GHZ, \
.hw_value = (_channel), \
.center_freq = 5000 + (5 * (_channel)), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
#define CHAN5G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_5GHZ, \
.hw_value = (_channel), \
.center_freq = (_freq), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
static struct ieee80211_rate mt7697_rates[] = {
......@@ -68,6 +68,11 @@ static struct ieee80211_rate mt7697_rates[] = {
IEEE80211_HT_CAP_SGI_20 | \
IEEE80211_HT_CAP_SGI_40)
/*
* MT7697 supports 2400-2497MHz
* See Section 2.7.3 MT76x7 Technical Reference Manual
* https://docs.labs.mediatek.com/resource/mt7687-mt7697/en/documentation
*/
static struct ieee80211_channel mt7697_2ghz_channels[] = {
CHAN2G(1, 2412, 0),
CHAN2G(2, 2417, 0),
......@@ -85,26 +90,40 @@ static struct ieee80211_channel mt7697_2ghz_channels[] = {
CHAN2G(14, 2484, 0),
};
/*
* MT7697 supports:
* - 5150-5350MHz
* - 5470-5725MHz
* - 5725-5850MHz
* - 5850-5925MHz
* See Section 2.7.3 MT76x7 Technical Reference Manual
* https://docs.labs.mediatek.com/resource/mt7687-mt7697/en/documentation
*/
static struct ieee80211_channel mt7697_5ghz_a_channels[] = {
CHAN5G(34, 0), CHAN5G(36, 0),
CHAN5G(38, 0), CHAN5G(40, 0),
CHAN5G(42, 0), CHAN5G(44, 0),
CHAN5G(46, 0), CHAN5G(48, 0),
CHAN5G(52, 0), CHAN5G(56, 0),
CHAN5G(60, 0), CHAN5G(64, 0),
CHAN5G(100, 0), CHAN5G(104, 0),
CHAN5G(108, 0), CHAN5G(112, 0),
CHAN5G(116, 0), CHAN5G(120, 0),
CHAN5G(124, 0), CHAN5G(128, 0),
CHAN5G(132, 0), CHAN5G(136, 0),
CHAN5G(140, 0), CHAN5G(149, 0),
CHAN5G(153, 0), CHAN5G(157, 0),
CHAN5G(161, 0), CHAN5G(165, 0),
CHAN5G(184, 0), CHAN5G(188, 0),
CHAN5G(192, 0), CHAN5G(196, 0),
CHAN5G(200, 0), CHAN5G(204, 0),
CHAN5G(208, 0), CHAN5G(212, 0),
CHAN5G(216, 0),
CHAN5G(36, 5180, 0),
CHAN5G(40, 5200, 0),
CHAN5G(44, 5220, 0),
CHAN5G(48, 5240, 0),
CHAN5G(52, 5260, 0),
CHAN5G(56, 5280, 0),
CHAN5G(60, 5300, 0),
CHAN5G(64, 5320, 0),
CHAN5G(100, 5500, 0),
CHAN5G(104, 5520, 0),
CHAN5G(108, 5540, 0),
CHAN5G(112, 5560, 0),
CHAN5G(116, 5580, 0),
CHAN5G(120, 5600, 0),
CHAN5G(124, 5620, 0),
CHAN5G(128, 5640, 0),
CHAN5G(132, 5660, 0),
CHAN5G(136, 5680, 0),
CHAN5G(140, 5700, 0),
CHAN5G(149, 5745, 0),
CHAN5G(153, 5765, 0),
CHAN5G(157, 5785, 0),
CHAN5G(161, 5805, 0),
CHAN5G(165, 5825, 0),
};
static struct ieee80211_supported_band mt7697_band_2ghz = {
......@@ -380,15 +399,13 @@ static bool mt7697_is_valid_iftype(struct mt7697_cfg80211_info *cfg,
return false;
}
static struct cfg80211_bss *mt7697_add_bss_if_needed(struct mt7697_vif *vif,
static struct cfg80211_bss* mt7697_add_bss_if_needed(struct mt7697_vif *vif,
const u8* bssid,
u32 freq)
{
struct ieee80211_channel *chan;
struct mt7697_cfg80211_info *cfg = vif->cfg;
struct cfg80211_bss *bss = NULL;
u16 cap_mask = WLAN_CAPABILITY_ESS;
u16 cap_val = WLAN_CAPABILITY_ESS;
u8 *ie = NULL;
chan = ieee80211_get_channel(cfg->wiphy, freq);
......@@ -400,7 +417,7 @@ static struct cfg80211_bss *mt7697_add_bss_if_needed(struct mt7697_vif *vif,
bss = cfg80211_get_bss(cfg->wiphy, chan, vif->req_bssid,
vif->ssid, vif->ssid_len,
cap_mask, cap_val);
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
if (!bss) {
/*
* Since cfg80211 may not yet know about the BSS,
......@@ -421,8 +438,11 @@ static struct cfg80211_bss *mt7697_add_bss_if_needed(struct mt7697_vif *vif,
dev_dbg(cfg->dev, "%s: inform bss ssid(%u/'%s')\n",
__func__, vif->ssid_len, vif->ssid);
print_hex_dump(KERN_DEBUG, DRVNAME" inform bss BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, bssid, ETH_ALEN, 0);
bss = cfg80211_inform_bss(cfg->wiphy, chan,
bssid, 0, cap_val, 100,
bssid, 0, WLAN_CAPABILITY_ESS, 100,
ie, 2 + vif->ssid_len,
0, GFP_KERNEL);
if (!bss) {
......@@ -539,6 +559,23 @@ static int mt7697_cfg80211_scan(struct wiphy *wiphy,
int ret;
dev_dbg(cfg->dev, "%s: START SCAN\n", __func__);
if (test_bit(CONNECTED, &vif->flags)) {
dev_warn(cfg->dev,
"%s: connected scan not allowed\n", __func__);
ret = -EINVAL;
goto out;
}
if (test_bit(CONNECT_PEND, &vif->flags)) {
dev_dbg(cfg->dev, "%s: pending connection t/o\n", __func__);
print_hex_dump(KERN_DEBUG, DRVNAME" BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, vif->req_bssid, ETH_ALEN, 0);
cfg80211_connect_result(vif->ndev, vif->req_bssid,
NULL, 0,
NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_KERNEL);
}
vif->scan_req = request;
ret = mt7697_send_scan_req(cfg, vif->fw_vif_idx, request);
......@@ -561,7 +598,13 @@ static int mt7697_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
u32 interval;
int ret;
dev_dbg(cfg->dev, "%s: ssid(%u/'%s')\n", __func__, sme->ssid_len, sme->ssid);
dev_dbg(cfg->dev, "%s: ssid(%u/'%s')\n",
__func__, sme->ssid_len, sme->ssid);
if (test_bit(CONNECTED, &vif->flags)) {
dev_dbg(cfg->dev, "%s: already connected\n", __func__);
goto cleanup;
}
vif->sme_state = SME_CONNECTING;
......@@ -577,6 +620,15 @@ static int mt7697_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
goto cleanup;
}
if (sme->bssid && !is_broadcast_ether_addr(sme->bssid)) {
print_hex_dump(KERN_DEBUG, DRVNAME" BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, sme->bssid, ETH_ALEN, 0);
memcpy(vif->req_bssid, sme->bssid, ETH_ALEN);
}
else
memset(vif->req_bssid, 0xFF, ETH_ALEN);
ret = mt7697_set_assoc_req_ies(vif, sme->ie, sme->ie_len);
if (ret < 0) {
dev_err(cfg->dev,
......@@ -594,19 +646,10 @@ static int mt7697_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
if (sme->channel) {
vif->ch_hint = sme->channel->center_freq;
dev_dbg(cfg->dev,
"%s: channel(%u)\n", __func__, vif->ch_hint);
}
memset(vif->req_bssid, 0, sizeof(vif->req_bssid));
if (sme->bssid && !is_broadcast_ether_addr(sme->bssid)) {
dev_dbg(cfg->dev,
"%s: BSSID(%02x:%02x:%02x:%02x:%02x:%02x)\n",
__func__, sme->bssid[0], sme->bssid[1], sme->bssid[2],
sme->bssid[3], sme->bssid[4], sme->bssid[5]);
memcpy(vif->req_bssid, sme->bssid, sizeof(vif->req_bssid));
dev_dbg(cfg->dev, "%s: ch_hint(%u)\n", __func__, vif->ch_hint);
}
else
vif->ch_hint = 0;
ret = mt7697_set_wpa_version(vif, sme->crypto.wpa_versions);
if (ret < 0) {
......@@ -656,6 +699,19 @@ static int mt7697_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
}
}
if (cfg->hw_wireless_mode != cfg->wireless_mode) {
ret = mt7697_send_set_wireless_mode_req(cfg, MT7697_PORT_STA,
MT7697_WIFI_PHY_11ABGN_MIXED);
if (ret < 0) {
dev_err(cfg->dev,
"%s: mt7697_send_set_wireless_mode_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
cfg->hw_wireless_mode = cfg->wireless_mode;
}
ret = mt7697_send_set_security_mode_req(cfg, MT7697_PORT_STA,
vif->auth_mode, vif->prwise_crypto);
if (ret < 0) {
......@@ -734,7 +790,7 @@ static int mt7697_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
((vif->auth_mode == MT7697_WIFI_AUTH_MODE_WPA_PSK) ||
(vif->auth_mode == MT7697_WIFI_AUTH_MODE_WPA2_PSK))) {
mod_timer(&vif->disconnect_timer,
jiffies + msecs_to_jiffies(MT7697_DISCON_TIMER_INTVAL));
jiffies + msecs_to_jiffies(MT7697_DISCON_TIMER_INTVAL_MSEC));
}
cfg->connect_ctrl_flags &= ~MT7697_CONNECT_DO_WPA_OFFLOAD;
......@@ -785,7 +841,8 @@ cleanup:
return ret;
}
static int mt7697_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
static int mt7697_cfg80211_add_key(struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index, bool pairwise,
const u8 *mac_addr,
struct key_params *params)
......@@ -795,7 +852,8 @@ static int mt7697_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
return 0;
}
static int mt7697_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
static int mt7697_cfg80211_get_key(struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index, bool pairwise,
const u8 *mac_addr, void *cookie,
void (*callback) (void *cookie,
......@@ -866,33 +924,29 @@ static int mt7697_cfg80211_set_pmksa(struct wiphy *wiphy,
dev_dbg(cfg->dev, "%s: SET PMKSA\n", __func__);
if (pmksa->bssid == NULL) {
dev_err(cfg->dev, "%s: NULL BSSID\n", __func__);
ret = -EINVAL;
goto cleanup;
if (pmksa->bssid) {
print_hex_dump(KERN_DEBUG, DRVNAME" BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, pmksa->bssid, ETH_ALEN, 0);
}
if (pmksa->pmkid == NULL) {
dev_err(cfg->dev, "%s: NULL PMKID\n", __func__);
dev_err(cfg->dev, "%s: NULL PSK\n", __func__);
ret = -EINVAL;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: PSK('%s')\n", __func__, pmksa->pmkid);
dev_dbg(cfg->dev, "%s: BSSID(%02x:%02x:%02x:%02x:%02x:%02x)\n",
__func__,
pmksa->bssid[0], pmksa->bssid[1], pmksa->bssid[2],
pmksa->bssid[3], pmksa->bssid[4], pmksa->bssid[5]);
if (memcmp(pmksa->pmkid, cfg->pmkid, MT7697_WIFI_LENGTH_PMK)) {
ret = mt7697_send_set_pmk_req(cfg, MT7697_PORT_STA, pmksa->pmkid);
if (memcmp(pmksa->pmkid, cfg->psk, WLAN_MAX_KEY_LEN)) {
ret = mt7697_send_set_psk_req(cfg, MT7697_PORT_STA, pmksa->pmkid);
if (ret) {
dev_err(cfg->dev,
"%s: mt7697_send_set_pmk_req() failed(%d)\n",
"%s: mt7697_send_set_psk_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
memcpy(cfg->pmkid, pmksa->pmkid, MT7697_WIFI_LENGTH_PMK);
memcpy(cfg->psk, pmksa->pmkid, WLAN_MAX_KEY_LEN);
}
cleanup:
......@@ -903,27 +957,25 @@ static int mt7697_cfg80211_del_pmksa(struct wiphy *wiphy,
struct net_device *ndev,
struct cfg80211_pmksa *pmksa)
{
u8 pmkid[MT7697_WIFI_LENGTH_PMK] = {0};
u8 psk[WLAN_MAX_KEY_LEN] = {0};
struct mt7697_cfg80211_info *cfg = mt7697_priv(ndev);
int ret;
dev_dbg(cfg->dev, "%s: DEL PMKSA\n", __func__);
dev_dbg(cfg->dev, "%s: BSSID(%02x:%02x:%02x:%02x:%02x:%02x)\n",
__func__,
pmksa->bssid[0], pmksa->bssid[1], pmksa->bssid[2],
pmksa->bssid[3], pmksa->bssid[4], pmksa->bssid[5]);
print_hex_dump(KERN_DEBUG, DRVNAME" BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, pmksa->bssid, ETH_ALEN, 0);
if (memcmp(pmkid, cfg->pmkid, MT7697_WIFI_LENGTH_PMK)) {
ret = mt7697_send_set_pmk_req(cfg, MT7697_PORT_STA, pmkid);
if (memcmp(psk, cfg->psk, WLAN_MAX_KEY_LEN)) {
ret = mt7697_send_set_psk_req(cfg, MT7697_PORT_STA, psk);
if (ret) {
dev_err(cfg->dev,
"%s: mt7697_send_set_pmk_req() failed(%d)\n",
"%s: mt7697_send_set_psk_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
memset(cfg->pmkid, 0, MT7697_WIFI_LENGTH_PMK);
memset(cfg->psk, 0, WLAN_MAX_KEY_LEN);
}
cleanup:
......@@ -933,7 +985,7 @@ cleanup:
static int mt7697_cfg80211_flush_pmksa(struct wiphy *wiphy,
struct net_device *ndev)
{
u8 pmk[MT7697_WIFI_LENGTH_PMK] = {0};
u8 psk[WLAN_MAX_KEY_LEN] = {0};
struct mt7697_cfg80211_info *cfg = mt7697_priv(ndev);
struct mt7697_vif *vif = netdev_priv(ndev);
int ret = 0;
......@@ -941,15 +993,15 @@ static int mt7697_cfg80211_flush_pmksa(struct wiphy *wiphy,
dev_dbg(cfg->dev, "%s: FLUSH PMKSA\n", __func__);
if (test_bit(CONNECTED, &vif->flags)) {
ret = mt7697_send_set_pmk_req(cfg, MT7697_PORT_STA, pmk);
ret = mt7697_send_set_psk_req(cfg, MT7697_PORT_STA, psk);
if (ret) {
dev_err(cfg->dev,
"%s: mt7697_send_set_pmk_req() failed(%d)\n",
"%s: mt7697_send_set_psk_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
memset(cfg->pmkid, 0, MT7697_WIFI_LENGTH_PMK);
memset(cfg->psk, 0, WLAN_MAX_KEY_LEN);
}
cleanup:
......@@ -974,10 +1026,11 @@ static int mt7697_cfg80211_change_station(struct wiphy *wiphy,
struct mt7697_vif *vif = netdev_priv(ndev);
int err = 0;
dev_dbg(cfg->dev, "%s: CHANGE STATION\n\t"
"mac(%02x:%02x:%02x:%02x:%02x:%02x)\n\tsta flags(0x%08x)\n",
__func__, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
params->sta_flags_set);
dev_dbg(cfg->dev, "%s: CHANGE STATION flags(0x%08x)\n",
__func__, params->sta_flags_set);
print_hex_dump(KERN_DEBUG, DRVNAME" MAC ",
DUMP_PREFIX_OFFSET, 16, 1, mac, ETH_ALEN, 0);
if ((vif->wdev.iftype != NL80211_IFTYPE_STATION)) {
dev_err(cfg->dev, "%s: iftype(%u) not supported\n",
......@@ -1129,8 +1182,10 @@ void mt7697_cfg80211_stop(struct mt7697_vif *vif)
ath6kl_warn("failed to disable scan during stop\n");
*/
// ath6kl_cfg80211_scan_complete_event(vif, true);
cfg80211_scan_done(vif->scan_req, true);
vif->scan_req = NULL;
if (vif->scan_req) {
cfg80211_scan_done(vif->scan_req, true);
vif->scan_req = NULL;
}
}
static const struct ieee80211_txrx_stypes
......@@ -1178,6 +1233,29 @@ cleanup:
return;
}
struct mt7697_vif* mt7697_get_vif_by_idx(struct mt7697_cfg80211_info *cfg,
u8 if_idx)
{
struct mt7697_vif *vif, *found = NULL;
if (WARN_ON(if_idx > (cfg->vif_max - 1))) {
dev_err(cfg->dev, "%s: invalid if idx(%u > %u)\n",
__func__, if_idx, cfg->vif_max - 1);
return NULL;
}
spin_lock_bh(&cfg->vif_list_lock);
list_for_each_entry(vif, &cfg->vif_list, list) {
if (vif->fw_vif_idx == if_idx) {
found = vif;
break;
}
}
spin_unlock_bh(&cfg->vif_list_lock);
return found;
}
struct wireless_dev *mt7697_interface_add(
struct mt7697_cfg80211_info *cfg, const char *name,
enum nl80211_iftype type, u8 fw_vif_idx)
......@@ -1246,50 +1324,71 @@ int mt7697_cfg80211_connect_event(struct mt7697_vif *vif, const u8* bssid,
u32 freq;
int ret = 0;
if (channel <= MT7697_CH_MAX_2G_CHANNEL)
spin_lock_bh(&vif->if_lock);
if ((channel > 0) && (channel <= MT7697_CH_MAX_2G_CHANNEL))
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else
else if ((channel >= MT7697_CH_MIN_5G_CHANNEL) &&
(channel <= MT7697_CH_MAX_5G_CHANNEL))
band = wiphy->bands[IEEE80211_BAND_5GHZ];
else {
dev_err(cfg->dev, "%s: invalid channel(%u)\n",
__func__, channel);
ret = -EINVAL;
goto cleanup;
}
if (!band) {
dev_err(cfg->dev, "%s: channel(%u) NULL band\n",
__func__, channel);
ret = -EINVAL;
goto cleanup;
}
freq = ieee80211_channel_to_frequency(channel, band->band);
if (!freq) {
dev_err(cfg->dev,
"%s: ieee80211_channel_to_frequency() failed\n",
__func__);
ret = -EINVAL;
goto cleanup;
}
bss = mt7697_add_bss_if_needed(vif, bssid, freq);
if (!bss) {
dev_err(cfg->dev, "%s: could not add cfg80211 bss entry\n",
dev_err(cfg->dev, "%s: mt7697_add_bss_if_needed() failed\n",
__func__);
ret = -EINVAL;
goto cleanup;
}
if (vif->sme_state == SME_CONNECTING) {
WARN_ON(!vif->ndev);
dev_dbg(cfg->dev, "%s: vif sme_state(%u)\n", __func__, vif->sme_state);
if ((vif->sme_state == SME_CONNECTING) ||
(vif->sme_state == SME_DISCONNECTED)) {
vif->sme_state = SME_CONNECTED;
cfg80211_connect_result(vif->ndev, bssid,
NULL, 0,
NULL, 0,
// assoc_req_ie, assoc_req_len,
// assoc_resp_ie, assoc_resp_len,
WLAN_STATUS_SUCCESS, GFP_KERNEL);
cfg80211_put_bss(cfg->wiphy, bss);
} else if (vif->sme_state == SME_CONNECTED) {
/* inform roam event to cfg80211 */
/* inform roam event to cfg80211 */
cfg80211_roamed_bss(vif->ndev, bss,
NULL, 0,
NULL, 0,
// assoc_req_ie, assoc_req_len,
// assoc_resp_ie, assoc_resp_len,
GFP_KERNEL);
}
netif_wake_queue(vif->ndev);
/* Update connect & link status atomically */
spin_lock_bh(&vif->if_lock);
set_bit(CONNECTED, &vif->flags);
clear_bit(CONNECT_PEND, &vif->flags);
dev_dbg(cfg->dev, "%s: vif flags(0x%08lx)\n", __func__, vif->flags);
netif_wake_queue(vif->ndev);
netif_carrier_on(vif->ndev);
spin_unlock_bh(&vif->if_lock);
cleanup:
spin_unlock_bh(&vif->if_lock);
return ret;
}
......@@ -1313,6 +1412,11 @@ int mt7697_cfg80211_init(struct mt7697_cfg80211_info *cfg)
bool band_2gig = false, band_5gig = false, ht = false;
s32 err = 0;
cfg->tx_req.cmd.grp = MT7697_CMD_GRP_80211;
cfg->tx_req.cmd.type = MT7697_CMD_TX_RAW;
cfg->wireless_mode = MT7697_WIFI_PHY_11ABGN_MIXED;
wiphy->mgmt_stypes = mt7697_txrx_stypes;
wiphy->max_remain_on_channel_duration = 5000;
set_wiphy_dev(wiphy, cfg->dev);
......@@ -1368,10 +1472,8 @@ int mt7697_cfg80211_init(struct mt7697_cfg80211_info *cfg)
mt7697_band_5ghz.ht_cap.ht_supported = false;
}
if (band_2gig)
wiphy->bands[IEEE80211_BAND_2GHZ] = &mt7697_band_2ghz;
if (band_5gig)
wiphy->bands[IEEE80211_BAND_5GHZ] = &mt7697_band_5ghz;
wiphy->bands[IEEE80211_BAND_2GHZ] = band_2gig ? &mt7697_band_2ghz:NULL;
wiphy->bands[IEEE80211_BAND_5GHZ] = band_5gig ? &mt7697_band_5ghz:NULL;
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wiphy->cipher_suites = mt7697_cipher_suites;
......
......@@ -27,15 +27,17 @@
#define MT7697_MAC80211_QUEUE_TX 0
#define MT7697_MAC80211_QUEUE_RX 1
#define MT7697_CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */
#define MT7697_CH_MAX_2G_CHANNEL 14
#define MT7697_CH_MIN_5G_CHANNEL 34
#define MT7697_CH_MAX_5G_CHANNEL 216
#define MT7697_SCAN_MAX_ITEMS 16
#define MT7697_IFACE_MAX_CNT 2
#define MT7697_MAX_MC_FILTERS_PER_LIST 7
#define MT7697_MAX_COOKIE_NUM 180
#define MT7697_TX_TIMEOUT 10
#define MT7697_DISCON_TIMER_INTVAL 10000 /* in msec */
/* TODO update below */
#define MT7697_DISCON_TIMER_INTVAL_MSEC (300 * 1000)
#define MT7697_KEY_SEQ_LEN 8
#define MT7697_MAX_KEY_INDEX 3
......@@ -97,19 +99,21 @@ struct mt7697_cfg80211_info {
struct mt7697_cookie cookie_mem[MT7697_MAX_COOKIE_NUM];
struct work_struct tx_work;
u8 tx_data[IEEE80211_MAX_DATA_LEN];
u8 rx_data[IEEE80211_MAX_DATA_LEN];
u8 probe_data[IEEE80211_MAX_DATA_LEN];
struct mt7697_tx_raw_packet tx_req;
u8 rx_data[MT7697_LEN32_ALIGNED(IEEE80211_MAX_FRAME_LEN)];
u8 probe_data[MT7697_LEN32_ALIGNED(IEEE80211_MAX_DATA_LEN)];
struct mt7697_rsp_hdr rsp;
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;
struct mt7697_wifi_config_t wifi_config;
int listen_interval;
enum mt7697_wifi_rx_filter_t rx_filter;
u8 pmkid[MT7697_WIFI_LENGTH_PMK];
u8 smart_conn_filter;
u8 psk[MT7697_PASSPHRASE_LEN];
struct list_head vif_list;
spinlock_t vif_list_lock;
......@@ -191,10 +195,12 @@ static inline struct mt7697_vif *mt7697_vif_from_wdev(struct wireless_dev *wdev)
void mt7697_init_netdev(struct net_device*);
struct mt7697_vif *mt7697_get_vif_by_idx(struct mt7697_cfg80211_info*, u8);
struct wireless_dev *mt7697_interface_add(struct mt7697_cfg80211_info*,
const char*, enum nl80211_iftype, u8 fw_vif_idx);
void mt7697_tx_work(struct work_struct *);
int mt7697_data_tx(struct sk_buff*, struct net_device*);
int mt7697_rx_data(struct mt7697_cfg80211_info*, u32);
void mt7697_disconnect_timer_hndlr(unsigned long);
int mt7697_disconnect(struct mt7697_vif*);
......
......@@ -146,6 +146,14 @@ static void mt7697_init_hw_start(struct work_struct *work)
goto failed;
}
err = mt7697_send_get_smart_conn_filter_req(cfg);
if (err < 0) {
dev_err(cfg->dev,
"%s: mt7697_send_get_smart_conn_filter_req() failed(%d)\n",
__func__, err);
goto failed;
}
err = mt7697_send_get_listen_interval_req(cfg);
if (err < 0) {
dev_err(cfg->dev,
......@@ -162,9 +170,9 @@ static void mt7697_init_hw_start(struct work_struct *work)
goto failed;
}
err = mt7697_send_get_pmk_req(cfg, MT7697_PORT_STA);
err = mt7697_send_get_psk_req(cfg, MT7697_PORT_STA);
if (err < 0) {
dev_err(cfg->dev, "%s: mt7697_send_get_pmk_req() failed(%d)\n",
dev_err(cfg->dev, "%s: mt7697_send_get_psk_req() failed(%d)\n",
__func__, err);
goto failed;
}
......@@ -369,8 +377,8 @@ int mt7697_disconnect(struct mt7697_vif *vif)
NULL);
if (ret < 0) {
dev_err(vif->cfg->dev,
"mt7697_send_disconnect_req() failed(%d)\n",
ret);
"%s: mt7697_send_disconnect_req() failed(%d)\n",
__func__, ret);
goto failed;
}
......@@ -402,7 +410,6 @@ struct mt7697_cookie *mt7697_alloc_cookie(struct mt7697_cfg80211_info *cfg)
void mt7697_free_cookie(struct mt7697_cfg80211_info *cfg, struct mt7697_cookie *cookie)
{
/* Insert first */
if (!cfg || !cookie)
return;
......@@ -411,7 +418,7 @@ void mt7697_free_cookie(struct mt7697_cfg80211_info *cfg, struct mt7697_cookie *
cfg->cookie_count++;
}
MODULE_AUTHOR( "Sierra Wireless Corporation" );
MODULE_LICENSE( "GPL" );
MODULE_DESCRIPTION( "MediaTek7697 WiFi 80211" );
MODULE_AUTHOR("Sierra Wireless Corporation");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MediaTek7697 WiFi 80211");
......@@ -8,46 +8,49 @@
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp
mt_wifi_start() {
# insmod /tmp/spisvc.ko || exit 127
lsmod | grep spi-cp2130 >/dev/null
if [ $? -eq 1 ]; then
insmod /tmp/spi-cp2130.ko || exit 127
for f in `ls -d /sys/class/gpio/gpiochip*`; do echo $f `cat $f/label $f/base $f/ngpio` ; done
echo -n 0,2,6,0,0,1,2,0,0,0,0,mt7697 > /sys/devices/platform/msm_hsic_host/usb1/1-1/1-1.3/1-1.3:1.0/channel_config
echo -n 0,2,6,0,0,1,2,0,0,0,0,mt7697 > /sys/devices/platform/msm_hsic_host/usb1/1-1/1-1.1/1-1.1:1.0/channel_config
fi
lsmod | grep cfg80211 >/dev/null
if [ $? -eq 1 ]; then
# modprobe cfg80211 || exit 127
insmod /tmp/cfg80211.ko || exit 127
fi
lsmod | grep cfg80211 >/dev/null
lsmod | grep mac80211 >/dev/null
if [ $? -eq 1 ]; then
# modprobe mac80211 || exit 127
insmod /tmp/mac80211.ko || exit 127
fi
lsmod | grep mt7697q >/dev/null
if [ $? -eq 1 ]; then
insmod /tmp/mt7697q.ko || exit 127
echo "Initialized MT7697 queues"; exit 127
echo "Initialized MT7697 queues";
fi
lsmod | grep mt7697wifi_core >/dev/null
if [ $? -eq 1 ]; then
insmod /tmp/mt7697wifi_core.ko || exit 127
echo "Initialized MT7697 80211 core"; exit 127
echo "Initialized MT7697 80211 core";
sleep 2
fi
ifconfig -a | grep wlan0 >/dev/null
if [ $? -ne 0 ] ; then
echo "Failed to init MT7697 80211 core"; exit 127
echo "Failed to init MT7697 80211 core";
exit 127
fi
ifconfig wlan0 up >/dev/null
if [ $? -ne 0 ] ; then
echo "Failed to start MT7697 80211 core"; exit 127
fi
echo "Failed to start MT7697 80211 core";
exit 127
fi
/tmp/wpa_supplicant -i wlan0 -D wext -c /etc/swi-mobile -B
}
mt_wifi_stop() {
......
......@@ -14,6 +14,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <linux/etherdevice.h>
#include "core.h"
int mt7697_data_tx(struct sk_buff *skb, struct net_device *ndev)
......@@ -82,3 +83,47 @@ void mt7697_tx_work(struct work_struct *work)
cleanup:
return;
}
int mt7697_rx_data(struct mt7697_cfg80211_info *cfg, u32 if_idx)
{
struct mt7697_vif *vif;
struct sk_buff *skb;
int ret = 0;
skb = alloc_skb(cfg->rsp.result, GFP_KERNEL);
if (!skb) {
dev_err(cfg->dev, "%s: alloc_skb() failed\n", __func__);
ret = -ENOMEM;
goto cleanup;
}
skb_put(skb, cfg->rsp.result);
memcpy(skb->data, cfg->rx_data, cfg->rsp.result);
vif = mt7697_get_vif_by_idx(cfg, if_idx);
if (!vif) {
dev_err(cfg->dev, "%s: mt7697_get_vif_by_idx(%u) failed\n",
__func__, if_idx);
ret = -EINVAL;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: vif(%u)\n", __func__, vif->fw_vif_idx);
skb->dev = vif->ndev;
if (!(skb->dev->flags & IFF_UP)) {
dev_warn(cfg->dev, "%s: net device NOT up\n", __func__);
ret = -EINVAL;
goto cleanup;
}
skb->protocol = eth_type_trans(skb, skb->dev);
dev_dbg(cfg->dev, "%s: protocol(%u)\n", __func__, skb->protocol);
netif_rx_ni(skb);
cleanup:
if (ret && skb) dev_kfree_skb(skb);
return ret;
}
......@@ -22,50 +22,48 @@
#include "core.h"
#include "cfg80211.h"
struct mt7697_vif *mt7697_get_vif_by_index(struct mt7697_cfg80211_info *cfg, u8 if_idx)
{
struct mt7697_vif *vif, *found = NULL;
if (WARN_ON(if_idx > (cfg->vif_max - 1))) {
dev_err(cfg->dev, "%s: invalid if idx(%u > %u)\n",
__func__, if_idx, cfg->vif_max - 1);
return NULL;
}
spin_lock_bh(&cfg->vif_list_lock);
list_for_each_entry(vif, &cfg->vif_list, list) {
if (vif->fw_vif_idx == if_idx) {
found = vif;
break;
}
}
spin_unlock_bh(&cfg->vif_list_lock);
return found;
}
static int mt7697_proc_get_pmk(struct mt7697_cfg80211_info *cfg)
static int mt7697_proc_get_psk(struct mt7697_cfg80211_info *cfg)
{
u32 len = 0;
int ret = 0;
dev_dbg(cfg->dev, "%s: --> PMK(%u)\n", __func__, cfg->rsp.cmd.len);
if (cfg->rsp.cmd.len != sizeof(struct mt7697_get_pmk_rsp)) {
dev_err(cfg->dev, "%s: invalid PMK rsp len(%u != %u)\n",
dev_dbg(cfg->dev, "%s: --> PSK(%u)\n", __func__, cfg->rsp.cmd.len);
if (cfg->rsp.cmd.len != sizeof(struct mt7697_get_psk_rsp)) {
dev_err(cfg->dev, "%s: invalid PSK rsp len(%u != %u)\n",
__func__, cfg->rsp.cmd.len,
sizeof(struct mt7697_get_pmk_rsp));
sizeof(struct mt7697_get_psk_rsp));
ret = -EINVAL;
goto cleanup;
}
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&cfg->pmkid,
MT7697_QUEUE_LEN_TO_WORD(sizeof(cfg->pmkid)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&len,
MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(u32))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
else if (!len || len > MT7697_PASSPHRASE_LEN) {
dev_err(cfg->dev, "%s: invalid PSK length(%d)\n",
__func__, len);
ret = -EINVAL;
goto cleanup;
}
print_hex_dump(KERN_DEBUG, DRVNAME" PMK ",
DUMP_PREFIX_OFFSET, 16, 1, cfg->pmkid, sizeof(cfg->pmkid), 0);
dev_dbg(cfg->dev, "%s: PSK length(%d)\n", __func__, len);
memset(cfg->psk, 0, MT7697_PASSPHRASE_LEN);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&cfg->psk,
MT7697_QUEUE_LEN_TO_WORD(MT7697_PASSPHRASE_LEN));
if (ret != MT7697_QUEUE_LEN_TO_WORD(MT7697_PASSPHRASE_LEN)) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(MT7697_PASSPHRASE_LEN));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: PSK('%s')\n", __func__, cfg->psk);
cleanup:
return ret;
......@@ -73,47 +71,33 @@ cleanup:
static int mt7697_proc_mac_addr(struct mt7697_cfg80211_info *cfg)
{
struct mt7697_mac_addr addr;
u8 addr[MT7697_LEN32_ALIGNED(ETH_ALEN)];
struct wireless_dev *wdev;
int ret = 0;
dev_dbg(cfg->dev, "%s: --> MAC ADDRESS(%u)\n",
__func__, cfg->rsp.cmd.len);
if (cfg->rsp.cmd.len - sizeof(struct mt7697_rsp_hdr) !=
sizeof(struct mt7697_mac_addr)) {
dev_err(cfg->dev, "%s: invalid MAC address rsp len(%u != %u)\n",
__func__,
cfg->rsp.cmd.len - sizeof(struct mt7697_rsp_hdr),
sizeof(struct mt7697_mac_addr));
if (cfg->rsp.cmd.len != sizeof(struct mt7697_mac_addr_rsp)) {
dev_err(cfg->dev,
"%s: invalid MAC address rsp len(%u != %u)\n",
__func__, cfg->rsp.cmd.len,
sizeof(struct mt7697_mac_addr_rsp));
ret = -EINVAL;
goto cleanup;
}
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&addr,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_mac_addr)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
MT7697_QUEUE_LEN_TO_WORD(sizeof(addr)));
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(addr))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(addr)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: MAC address length(%d)\n", __func__, addr.len);
if (!addr.len) {
dev_err(cfg->dev, "%s: invalid mac address len(%d)\n",
__func__, addr.len);
ret = -EINVAL;
goto cleanup;
}
else if (addr.len > ETH_ALEN) {
dev_err(cfg->dev,
"%s: invalid mac address len(%d > %d)\n",
__func__, addr.len, ETH_ALEN);
ret = -EINVAL;
goto cleanup;
}
print_hex_dump(KERN_DEBUG, DRVNAME" MAC address ",
DUMP_PREFIX_OFFSET, 16, 1, addr.data, addr.len, 0);
memcpy(cfg->mac_addr.addr, addr.data, addr.len);
DUMP_PREFIX_OFFSET, 16, 1, addr, ETH_ALEN, 0);
memcpy(cfg->mac_addr.addr, addr, ETH_ALEN);
rtnl_lock();
......@@ -122,7 +106,8 @@ static int mt7697_proc_mac_addr(struct mt7697_cfg80211_info *cfg)
rtnl_unlock();
if (!wdev) {
dev_err(cfg->dev, "%s: mt7697_interface_add() failed\n", __func__);
dev_err(cfg->dev, "%s: mt7697_interface_add() failed\n",
__func__);
ret = -ENOMEM;
goto cleanup;
}
......@@ -151,13 +136,16 @@ static int mt7697_proc_get_wireless_mode(struct mt7697_cfg80211_info *cfg)
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&wireless_mode,
MT7697_QUEUE_LEN_TO_WORD(sizeof(wireless_mode)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(wireless_mode))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(wireless_mode)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
cfg->wireless_mode = wireless_mode;
dev_dbg(cfg->dev, "%s: wireless mode(0x%08x)\n", __func__, cfg->wireless_mode);
dev_dbg(cfg->dev, "%s: wireless mode(%u)\n", __func__, wireless_mode);
cfg->hw_wireless_mode = wireless_mode;
cleanup:
return ret;
......@@ -180,7 +168,7 @@ static int mt7697_proc_get_cfg(struct mt7697_cfg80211_info *cfg)
goto cleanup;
}
rd_buf = kmalloc(
rd_buf = kzalloc(
MT7697_LEN32_ALIGNED(sizeof(struct mt7697_wifi_config_t)),
GFP_KERNEL);
if (!rd_buf) {
......@@ -189,14 +177,17 @@ static int mt7697_proc_get_cfg(struct mt7697_cfg80211_info *cfg)
goto cleanup;
}
wifi_cfg = (struct mt7697_wifi_config_t*)rd_buf;
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)rd_buf,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_wifi_config_t)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_wifi_config_t))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_wifi_config_t)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
wifi_cfg = (struct mt7697_wifi_config_t*)rd_buf;
dev_dbg(cfg->dev, "%s: operation mode(%u)\n",
__func__, wifi_cfg->opmode);
if ((wifi_cfg->opmode == MT7697_WIFI_MODE_STA_ONLY) ||
......@@ -314,8 +305,11 @@ static int mt7697_proc_get_rx_filter(struct mt7697_cfg80211_info *cfg)
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&rx_filter,
MT7697_QUEUE_LEN_TO_WORD(sizeof(rx_filter)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(rx_filter))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(rx_filter)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -326,6 +320,40 @@ cleanup:
return ret;
}
static int mt7697_proc_get_smart_conn_filter(struct mt7697_cfg80211_info *cfg)
{
u32 smart_conn_filter;
int ret = 0;
dev_dbg(cfg->dev, "%s: --> GET SMART CONN FILTER(%u)\n",
__func__, cfg->rsp.cmd.len);
if (cfg->rsp.cmd.len - sizeof(struct mt7697_rsp_hdr) != sizeof(smart_conn_filter)) {
dev_err(cfg->dev, "%s: invalid rx filter rsp len(%u != %u)\n",
__func__,
cfg->rsp.cmd.len - sizeof(struct mt7697_rsp_hdr),
sizeof(smart_conn_filter));
ret = -EINVAL;
goto cleanup;
}
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&smart_conn_filter,
MT7697_QUEUE_LEN_TO_WORD(sizeof(smart_conn_filter)));
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(smart_conn_filter))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(smart_conn_filter)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
cfg->smart_conn_filter = smart_conn_filter;
dev_dbg(cfg->dev, "%s: smart connection filter(%u)\n",
__func__, cfg->smart_conn_filter);
cleanup:
return ret;
}
static int mt7697_proc_get_radio_state(struct mt7697_cfg80211_info *cfg)
{
u32 state;
......@@ -344,8 +372,11 @@ static int mt7697_proc_get_radio_state(struct mt7697_cfg80211_info *cfg)
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&state,
MT7697_QUEUE_LEN_TO_WORD(sizeof(state)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(state))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(state)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -375,8 +406,11 @@ static int mt7697_proc_get_listen_interval(struct mt7697_cfg80211_info *cfg)
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&interval,
MT7697_QUEUE_LEN_TO_WORD(sizeof(interval)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(interval))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(interval)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -410,32 +444,48 @@ static int mt7697_proc_scan_rsp(struct mt7697_cfg80211_info *cfg)
ret = cfg->hif_ops->read(cfg->rxq_hdl, (s32*)&rssi,
MT7697_QUEUE_LEN_TO_WORD(sizeof(s32)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(s32))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(s32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: rssi(%d)\n", __func__, rssi);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&ch,
MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(u32))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: channel(%u)\n", __func__, ch);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&probe_rsp_len,
MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(u32))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
if (probe_rsp_len > IEEE80211_MAX_DATA_LEN) {
dev_err(cfg->dev, "%s: invalid probe rsp len(%d > %d)\n",
__func__, probe_rsp_len, IEEE80211_MAX_DATA_LEN);
ret = -EINVAL;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: probe rsp len(%u)\n", __func__, probe_rsp_len);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)cfg->probe_data,
MT7697_QUEUE_LEN_TO_WORD(MT7697_LEN32_ALIGNED(probe_rsp_len)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(MT7697_LEN32_ALIGNED(probe_rsp_len))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(MT7697_LEN32_ALIGNED(probe_rsp_len)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -447,14 +497,34 @@ static int mt7697_proc_scan_rsp(struct mt7697_cfg80211_info *cfg)
struct ieee80211_supported_band *band;
u32 freq;
band = cfg->wiphy->bands[IEEE80211_BAND_2GHZ];
if ((ch > 0) && (ch <= MT7697_CH_MAX_2G_CHANNEL))
band = cfg->wiphy->bands[IEEE80211_BAND_2GHZ];
else if ((ch >= MT7697_CH_MIN_5G_CHANNEL) &&
(ch <= MT7697_CH_MAX_5G_CHANNEL))
band = cfg->wiphy->bands[IEEE80211_BAND_5GHZ];
else {
dev_err(cfg->dev, "%s: invalid channel(%u)\n",
__func__, ch);
ret = -EINVAL;
goto cleanup;
}
freq = ieee80211_channel_to_frequency(ch, band->band);
if (!freq) {
dev_err(cfg->dev,
"%s: ieee80211_channel_to_frequency() failed\n",
__func__);
ret = -EINVAL;
goto cleanup;
}
channel = ieee80211_get_channel(cfg->wiphy, freq);
if (!channel) {
dev_err(cfg->dev,
"%s: ieee80211_get_channel() failed\n",
__func__);
return -EINVAL;
ret = -EINVAL;
goto cleanup;
}
bss = cfg80211_inform_bss_frame(cfg->wiphy, channel,
......@@ -467,6 +537,17 @@ static int mt7697_proc_scan_rsp(struct mt7697_cfg80211_info *cfg)
ret = -ENOMEM;
goto cleanup;
}
print_hex_dump(KERN_DEBUG, DRVNAME" BSS BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, bss->bssid, ETH_ALEN, 0);
dev_dbg(cfg->dev, "%s: BSS signal(%d) scan width(%u) cap(0x%08x)\n",
__func__, bss->signal, bss->scan_width, bss->capability);
if (bss->channel) {
dev_dbg(cfg->dev,
"%s: BSS channel band(%u) center freq(%u)\n",
__func__, bss->channel->band,
bss->channel->center_freq);
}
}
else {
dev_err(cfg->dev, "%s: Rx unsupported mgmt frame\n", __func__);
......@@ -488,20 +569,23 @@ static int mt7697_proc_scan_complete(struct mt7697_cfg80211_info *cfg)
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&if_idx,
MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(u32))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: if idx(%d)\n", __func__, if_idx);
vif = mt7697_get_vif_by_index(cfg, if_idx);
vif = mt7697_get_vif_by_idx(cfg, if_idx);
if (!vif) {
dev_err(cfg->dev, "%s: mt7697_get_vif_by_index(%u) failed\n",
dev_err(cfg->dev, "%s: mt7697_get_vif_by_idx(%u) failed\n",
__func__, if_idx);
ret = -EINVAL;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: vif(%u)\n", __func__, vif->fw_vif_idx);
cfg80211_scan_done(vif->scan_req, false);
vif->scan_req = NULL;
......@@ -513,46 +597,99 @@ static int mt7697_proc_connect(struct mt7697_cfg80211_info *cfg)
{
u8 bssid[MT7697_LEN32_ALIGNED(ETH_ALEN)];
struct mt7697_vif *vif;
enum mt7697_wifi_rx_filter_t rx_filter;
u32 if_idx;
u32 channel;
int ret;
dev_dbg(cfg->dev, "%s: --> CONNECT(%u)\n", __func__, cfg->rsp.cmd.len);
dev_dbg(cfg->dev, "%s: --> CONNECT RSP(%u)\n",
__func__, cfg->rsp.cmd.len);
if (cfg->rsp.cmd.len != sizeof(struct mt7697_connect_rsp)) {
dev_err(cfg->dev, "%s: invalid connect rsp len(%d != %d)\n",
__func__, cfg->rsp.cmd.len,
sizeof(struct mt7697_connect_rsp));
ret = -EINVAL;
goto cleanup;
}
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&if_idx,
MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(u32))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: if idx(%d)\n", __func__, if_idx);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&channel,
MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(u32))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: channel(%d)\n", __func__, channel);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)bssid,
MT7697_QUEUE_LEN_TO_WORD(sizeof(bssid)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(bssid))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(bssid)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: bssid(%02x:%02x:%02x:%02x:%02x:%02x)\n",
__func__, bssid[0], bssid[1], bssid[2],
bssid[3], bssid[4], bssid[5]);
vif = mt7697_get_vif_by_index(cfg, if_idx);
print_hex_dump(KERN_DEBUG, DRVNAME" BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, bssid, ETH_ALEN, 0);
vif = mt7697_get_vif_by_idx(cfg, if_idx);
if (!vif) {
dev_err(cfg->dev, "%s: mt7697_get_vif_by_index(%u) failed\n",
__func__, if_idx);
dev_err(cfg->dev, "%s: mt7697_get_vif_by_idx(%u) failed\n",
__func__, if_idx);
ret = -EINVAL;
goto cleanup;
}
rx_filter |= BIT(MT7697_WIFI_RX_FILTER_RM_FRAME_REPORT_EN);
rx_filter &= ~BIT(MT7697_WIFI_RX_FILTER_DROP_NOT_MY_BSSID);
rx_filter &= ~BIT(MT7697_WIFI_RX_FILTER_DROP_NOT_UC2ME);
rx_filter &= ~BIT(MT7697_WIFI_RX_FILTER_DROP_MC_FRAME);
if (rx_filter != cfg->rx_filter) {
ret = mt7697_send_set_rx_filter_req(cfg, cfg->rx_filter);
if (ret < 0) {
dev_err(cfg->dev,
"%s: mt7697_send_set_rx_filter_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
cfg->rx_filter = rx_filter;
}
if (!cfg->smart_conn_filter) {
ret = mt7697_send_set_smart_conn_filter_req(cfg, true);
if (ret < 0) {
dev_err(cfg->dev,
"%s: mt7697_send_set_smart_conn_filter_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
cfg->smart_conn_filter = true;
}
ret = mt7697_send_register_rx_hndlr_req(cfg);
if (ret < 0) {
dev_err(cfg->dev,
"%s: mt7697_send_register_rx_hndlr_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
dev_dbg(cfg->dev, "%s: vif(%u)\n", __func__, vif->fw_vif_idx);
ret = mt7697_cfg80211_connect_event(vif, bssid, channel);
if (ret < 0) {
dev_err(cfg->dev,
......@@ -573,39 +710,51 @@ static int mt7697_proc_disconnect(struct mt7697_cfg80211_info *cfg)
u16 proto_reason = 0;
int ret;
dev_dbg(cfg->dev, "%s: --> DISCONNECT(%u)\n", __func__, cfg->rsp.cmd.len);
dev_dbg(cfg->dev, "%s: --> DISCONNECT RSP(%u)\n", __func__, cfg->rsp.cmd.len);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&if_idx,
MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(u32))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: if idx(%d)\n", __func__, if_idx);
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)bssid,
MT7697_QUEUE_LEN_TO_WORD(sizeof(bssid)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(bssid))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(bssid)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: BSSID(%02x:%02x:%02x:%02x:%02x:%02x)\n",
__func__, bssid[0], bssid[1], bssid[2],
bssid[3], bssid[4], bssid[5]);
vif = mt7697_get_vif_by_index(cfg, if_idx);
print_hex_dump(KERN_DEBUG, DRVNAME" BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, bssid, ETH_ALEN, 0);
vif = mt7697_get_vif_by_idx(cfg, if_idx);
if (!vif) {
dev_err(cfg->dev, "%s: mt7697_get_vif_by_index(%u) failed\n",
dev_err(cfg->dev, "%s: mt7697_get_vif_by_idx(%u) failed\n",
__func__, if_idx);
ret = -EINVAL;
goto cleanup;
}
clear_bit(CONNECT_PEND, &vif->flags);
ret = mt7697_send_unregister_rx_hndlr_req(cfg);
if (ret < 0) {
dev_err(cfg->dev,
"%s: mt7697_send_unregister_rx_hndlr_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
dev_dbg(cfg->dev, "%s: vif(%u)\n", __func__, vif->fw_vif_idx);
if (vif->sme_state == SME_CONNECTING) {
cfg80211_connect_result(vif->ndev,
bssid, NULL, 0,
cfg80211_connect_result(vif->ndev, bssid,
NULL, 0,
NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL);
......@@ -615,7 +764,12 @@ static int mt7697_proc_disconnect(struct mt7697_cfg80211_info *cfg)
}
vif->sme_state = SME_DISCONNECTED;
spin_lock_bh(&vif->if_lock);
clear_bit(CONNECT_PEND, &vif->flags);
clear_bit(CONNECTED, &vif->flags);
dev_dbg(cfg->dev, "%s: vif sme_state(%u), flags(0x%08lx)\n",
__func__, vif->sme_state, vif->flags);
spin_unlock_bh(&vif->if_lock);
cleanup:
return ret;
......@@ -623,34 +777,46 @@ cleanup:
static int mt7697_rx_raw(struct mt7697_cfg80211_info *cfg)
{
u32 len;
int ret;
int ret;
dev_dbg(cfg->dev, "%s: --> RX RAW(%u)\n", __func__, cfg->rsp.cmd.len);
if (cfg->rsp.cmd.len <= sizeof(struct mt7697_rx_raw_packet)) {
if (cfg->rsp.cmd.len <= sizeof(struct mt7697_rsp_hdr)) {
dev_err(cfg->dev, "%s: invalid rx raw len(%u <= %u)\n",
__func__, cfg->rsp.cmd.len,
sizeof(struct mt7697_rx_raw_packet));
sizeof(struct mt7697_rsp_hdr));
ret = -EINVAL;
goto cleanup;
}
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&len,
MT7697_QUEUE_LEN_TO_WORD(sizeof(u32)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
dev_dbg(cfg->dev, "%s: len(%d)\n", __func__, cfg->rsp.result);
if (cfg->rsp.result > IEEE80211_MAX_FRAME_LEN) {
dev_err(cfg->dev, "%s: invalid rx data len(%u <= %u)\n",
__func__, cfg->rsp.result, IEEE80211_MAX_FRAME_LEN);
ret = -EINVAL;
goto cleanup;
}
dev_dbg(cfg->dev, "%s: len(%d)\n", __func__, len);
}
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)cfg->rx_data,
MT7697_QUEUE_LEN_TO_WORD(len));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n", __func__, ret);
MT7697_QUEUE_LEN_TO_WORD(cfg->rsp.result));
if (ret != MT7697_QUEUE_LEN_TO_WORD(cfg->rsp.result)) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(cfg->rsp.result));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
print_hex_dump(KERN_DEBUG, DRVNAME" RX DATA ",
DUMP_PREFIX_OFFSET, 16, 1, cfg->rx_data, cfg->rsp.result, 0);
/* TODO: interface index come from MT7697 */
ret = mt7697_rx_data(cfg, 0);
if (ret) {
dev_err(cfg->dev, "%s: mt7697_rx_data() failed(%d)\n",
__func__, ret);
goto cleanup;
}
cleanup:
return ret;
}
......@@ -660,11 +826,11 @@ static int mt7697_proc_80211cmd(struct mt7697_cfg80211_info *cfg)
int ret;
switch (cfg->rsp.cmd.type) {
case MT7697_CMD_GET_PMK_RSP:
ret = mt7697_proc_get_pmk(cfg);
case MT7697_CMD_GET_PSK_RSP:
ret = mt7697_proc_get_psk(cfg);
if (ret < 0) {
dev_err(cfg->dev,
"%s: mt7697_proc_get_pmk() failed(%d)\n",
"%s: mt7697_proc_get_psk() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -704,7 +870,17 @@ static int mt7697_proc_80211cmd(struct mt7697_cfg80211_info *cfg)
ret = mt7697_proc_get_rx_filter(cfg);
if (ret < 0) {
dev_err(cfg->dev,
"%s: mt7697_get_rx_filter() failed(%d)\n",
"%s: mt7697_proc_get_rx_filter() failed(%d)\n",
__func__, ret);
goto cleanup;
}
break;
case MT7697_CMD_GET_SMART_CONN_FILTER_RSP:
ret = mt7697_proc_get_smart_conn_filter(cfg);
if (ret < 0) {
dev_err(cfg->dev,
"%s: mt7697_proc_get_smart_conn_filter() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -780,8 +956,8 @@ static int mt7697_proc_80211cmd(struct mt7697_cfg80211_info *cfg)
}
break;
case MT7697_CMD_SET_PMK_RSP:
dev_dbg(cfg->dev, "%s: --> SET PMK(%u)\n",
case MT7697_CMD_SET_PSK_RSP:
dev_dbg(cfg->dev, "%s: --> SET PSK(%u)\n",
__func__, cfg->rsp.cmd.len);
break;
......@@ -795,6 +971,11 @@ static int mt7697_proc_80211cmd(struct mt7697_cfg80211_info *cfg)
__func__, cfg->rsp.cmd.len);
break;
case MT7697_CMD_SET_WIRELESS_MODE_RSP:
dev_dbg(cfg->dev, "%s: --> SET WIRELESS MODE(%u)\n",
__func__, cfg->rsp.cmd.len);
break;
case MT7697_CMD_SET_RADIO_STATE_RSP:
dev_dbg(cfg->dev, "%s: --> SET RADIO STATE(%u)\n",
__func__, cfg->rsp.cmd.len);
......@@ -805,6 +986,11 @@ static int mt7697_proc_80211cmd(struct mt7697_cfg80211_info *cfg)
__func__, cfg->rsp.cmd.len);
break;
case MT7697_CMD_SET_SMART_CONN_FILTER_RSP:
dev_dbg(cfg->dev, "%s: --> SET SMART CONN FILTER(%u)\n",
__func__, cfg->rsp.cmd.len);
break;
case MT7697_CMD_SET_SECURITY_MODE_RSP:
dev_dbg(cfg->dev, "%s: --> SET SECURITY MODE(%u)\n",
__func__, cfg->rsp.cmd.len);
......@@ -815,6 +1001,16 @@ static int mt7697_proc_80211cmd(struct mt7697_cfg80211_info *cfg)
__func__, cfg->rsp.cmd.len);
break;
case MT7697_CMD_REGISTER_RX_HNDLR_RSP:
dev_dbg(cfg->dev, "%s: --> REGISTER RX HANDLER(%u)\n",
__func__, cfg->rsp.cmd.len);
break;
case MT7697_CMD_UNREGISTER_RX_HNDLR_RSP:
dev_dbg(cfg->dev, "%s: --> UNREGISTER RX HANDLER(%u)\n",
__func__, cfg->rsp.cmd.len);
break;
default:
dev_err(cfg->dev, "%s: unsupported cmd(%d)\n",
__func__, cfg->rsp.cmd.type);
......@@ -838,8 +1034,10 @@ int mt7697_send_init(struct mt7697_cfg80211_info *cfg)
dev_dbg(cfg->dev, "%s: <-- QUEUE INIT\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -861,8 +1059,10 @@ int mt7697_send_reset(struct mt7697_cfg80211_info *cfg)
dev_dbg(cfg->dev, "%s: <-- QUEUE RESET\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -882,11 +1082,13 @@ int mt7697_send_get_wireless_mode_req(struct mt7697_cfg80211_info *cfg, u8 port)
req.cmd.type = MT7697_CMD_GET_WIRELESS_MODE_REQ;
req.port = port;
dev_dbg(cfg->dev, "%s: <-- WIRELESS MODE PORT(%u)\n", __func__, port);
dev_dbg(cfg->dev, "%s: <-- GET WIRELESS MODE PORT(%u)\n", __func__, port);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -896,21 +1098,24 @@ cleanup:
return ret;
}
int mt7697_send_get_pmk_req(struct mt7697_cfg80211_info *cfg, u8 port)
int mt7697_send_set_wireless_mode_req(struct mt7697_cfg80211_info *cfg, u8 port, u8 mode)
{
struct mt7697_get_pmk_req req;
struct mt7697_set_wireless_mode_req req;
int ret;
req.cmd.len = sizeof(struct mt7697_get_pmk_req);
req.cmd.len = sizeof(struct mt7697_set_wireless_mode_req);
req.cmd.grp = MT7697_CMD_GRP_80211;
req.cmd.type = MT7697_CMD_GET_PMK_REQ;
req.cmd.type = MT7697_CMD_SET_WIRELESS_MODE_REQ;
req.port = port;
req.mode = mode;
dev_dbg(cfg->dev, "%s: <-- PMK PORT(%u)\n", __func__, port);
dev_dbg(cfg->dev, "%s: <-- SET WIRELESS MODE port(%u)\n", __func__, port);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -920,26 +1125,53 @@ cleanup:
return ret;
}
int mt7697_send_set_pmk_req(struct mt7697_cfg80211_info *cfg, u8 port,
const u8 pmk[])
int mt7697_send_get_psk_req(struct mt7697_cfg80211_info *cfg, u8 port)
{
struct mt7697_set_pmk_req req;
struct mt7697_get_psk_req req;
int ret;
req.cmd.len = sizeof(struct mt7697_set_pmk_req);
req.cmd.len = sizeof(struct mt7697_get_psk_req);
req.cmd.grp = MT7697_CMD_GRP_80211;
req.cmd.type = MT7697_CMD_SET_PMK_REQ;
req.cmd.type = MT7697_CMD_GET_PSK_REQ;
req.port = port;
print_hex_dump(KERN_DEBUG, DRVNAME" PMK ",
DUMP_PREFIX_OFFSET, 16, 1, pmk, MT7697_WIFI_LENGTH_PMK, 0);
memcpy(req.pmk, pmk, MT7697_WIFI_LENGTH_PMK);
dev_dbg(cfg->dev, "%s: <-- PMK PORT(%u)\n", __func__, port);
dev_dbg(cfg->dev, "%s: <-- GET PSK port(%u)\n", __func__, port);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
return ret;
}
int mt7697_send_set_psk_req(struct mt7697_cfg80211_info *cfg, u8 port,
const u8 psk[])
{
struct mt7697_set_psk_req req;
int ret;
req.cmd.len = sizeof(struct mt7697_set_psk_req);
req.cmd.grp = MT7697_CMD_GRP_80211;
req.cmd.type = MT7697_CMD_SET_PSK_REQ;
req.port = port;
req.len = strlen(psk);
memcpy(req.psk, psk, req.len);
dev_dbg(cfg->dev, "%s: <-- SET PSK port(%u)\n", __func__, port);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_set_psk_req)));
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_set_psk_req))) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_set_psk_req)));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -959,11 +1191,13 @@ int mt7697_send_mac_addr_req(struct mt7697_cfg80211_info *cfg, u8 port)
req.cmd.type = MT7697_CMD_MAC_ADDR_REQ;
req.port = port;
dev_dbg(cfg->dev, "%s: <-- MAC ADDRESS PORT(%u)\n", __func__, port);
dev_dbg(cfg->dev, "%s: <-- GET MAC ADDRESS port(%u)\n", __func__, port);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -986,8 +1220,10 @@ int mt7697_send_set_op_mode_req(struct mt7697_cfg80211_info* cfg, u8 opmode)
dev_dbg(cfg->dev, "%s: <-- SET OPMODE(%u)\n", __func__, opmode);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1006,11 +1242,63 @@ int mt7697_send_cfg_req(struct mt7697_cfg80211_info *cfg)
req.grp = MT7697_CMD_GRP_80211;
req.type = MT7697_CMD_GET_CFG_REQ;
dev_dbg(cfg->dev, "%s: <-- CONFIG\n", __func__);
dev_dbg(cfg->dev, "%s: <-- GET CONFIG\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
return ret;
}
int mt7697_send_register_rx_hndlr_req(struct mt7697_cfg80211_info* cfg)
{
struct mt7697_register_rx_hndlr_req req;
int ret;
req.len = sizeof(struct mt7697_register_rx_hndlr_req);
req.grp = MT7697_CMD_GRP_80211;
req.type = MT7697_CMD_REGISTER_RX_HNDLR_REQ;
dev_dbg(cfg->dev, "%s: <-- REGISTER RX HANDLER\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
return ret;
}
int mt7697_send_unregister_rx_hndlr_req(struct mt7697_cfg80211_info* cfg)
{
struct mt7697_unregister_rx_hndlr_req req;
int ret;
req.len = sizeof(struct mt7697_unregister_rx_hndlr_req);
req.grp = MT7697_CMD_GRP_80211;
req.type = MT7697_CMD_UNREGISTER_RX_HNDLR_REQ;
dev_dbg(cfg->dev, "%s: <-- UNREGISTER RX HANDLER\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1029,11 +1317,13 @@ int mt7697_send_get_radio_state_req(struct mt7697_cfg80211_info* cfg)
req.grp = MT7697_CMD_GRP_80211;
req.type = MT7697_CMD_GET_RADIO_STATE_REQ;
dev_dbg(cfg->dev, "%s: <-- RADIO STATE\n", __func__);
dev_dbg(cfg->dev, "%s: <-- GET RADIO STATE\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1056,8 +1346,10 @@ int mt7697_send_set_radio_state_req(struct mt7697_cfg80211_info* cfg, u8 state)
dev_dbg(cfg->dev, "%s: <-- SET RADIO STATE(%u)\n", __func__, state);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1079,8 +1371,10 @@ int mt7697_send_get_rx_filter_req(struct mt7697_cfg80211_info* cfg)
dev_dbg(cfg->dev, "%s: <-- GET RX FILTER\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1105,8 +1399,62 @@ int mt7697_send_set_rx_filter_req(struct mt7697_cfg80211_info* cfg,
__func__, rx_filter);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
return ret;
}
int mt7697_send_get_smart_conn_filter_req(struct mt7697_cfg80211_info* cfg)
{
struct mt7697_get_smart_conn_filter_req req;
int ret;
req.len = sizeof(struct mt7697_get_smart_conn_filter_req);
req.grp = MT7697_CMD_GRP_80211;
req.type = MT7697_CMD_GET_SMART_CONN_FILTER_REQ;
dev_dbg(cfg->dev, "%s: <-- GET SMART CONN FILTER\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
return ret;
}
int mt7697_send_set_smart_conn_filter_req(struct mt7697_cfg80211_info* cfg, u8 flag)
{
struct mt7697_set_smart_conn_filter_req req;
int ret;
req.cmd.len = sizeof(struct mt7697_set_smart_conn_filter_req);
req.cmd.grp = MT7697_CMD_GRP_80211;
req.cmd.type = MT7697_CMD_SET_SMART_CONN_FILTER_REQ;
req.flag = flag;
dev_dbg(cfg->dev, "%s: <-- SET SMART CONN FILTER(%u)\n",
__func__, flag);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1128,8 +1476,10 @@ int mt7697_send_get_listen_interval_req(struct mt7697_cfg80211_info* cfg)
dev_dbg(cfg->dev, "%s: <-- GET LISTEN INTERVAL\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1154,8 +1504,10 @@ int mt7697_send_set_listen_interval_req(struct mt7697_cfg80211_info* cfg,
__func__, interval);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1182,8 +1534,10 @@ int mt7697_send_set_security_mode_req(struct mt7697_cfg80211_info* cfg,
__func__, auth_mode, encrypt_type);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1208,8 +1562,10 @@ int mt7697_send_get_security_mode_req(struct mt7697_cfg80211_info* cfg,
dev_dbg(cfg->dev, "%s: <-- GET SECURITY MODE\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1225,8 +1581,8 @@ int mt7697_send_scan_req(struct mt7697_cfg80211_info *cfg, u32 if_idx,
struct mt7697_scan_req scan_req;
int ret;
dev_dbg(cfg->dev, "%s: <-- SCAN\n", __func__);
memset(&scan_req, 0, sizeof(struct mt7697_scan_req));
dev_dbg(cfg->dev, "%s: <-- START SCAN\n", __func__);
memset(&scan_req, 0, sizeof(scan_req));
scan_req.cmd.len = sizeof(struct mt7697_scan_req);
scan_req.cmd.grp = MT7697_CMD_GRP_80211;
scan_req.cmd.type = MT7697_CMD_SCAN_REQ;
......@@ -1243,14 +1599,16 @@ int mt7697_send_scan_req(struct mt7697_cfg80211_info *cfg, u32 if_idx,
print_hex_dump(KERN_DEBUG, DRVNAME" SSID ",
DUMP_PREFIX_OFFSET, 16, 1, req->ssids[0].ssid,
req->ssids[0].ssid_len, 0);
memcpy(scan_req.ssid_bssid, req->ssids[0].ssid,
memcpy(scan_req.ssid, req->ssids[0].ssid,
req->ssids[0].ssid_len);
}
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&scan_req,
MT7697_QUEUE_LEN_TO_WORD(scan_req.cmd.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(scan_req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(scan_req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1269,11 +1627,13 @@ int mt7697_send_scan_stop_req(struct mt7697_cfg80211_info* cfg)
req.grp = MT7697_CMD_GRP_80211;
req.type = MT7697_CMD_SCAN_STOP;
dev_dbg(cfg->dev, "%s: <-- SCAN STOP\n", __func__);
dev_dbg(cfg->dev, "%s: <-- STOP SCAN\n", __func__);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1285,130 +1645,94 @@ cleanup:
int mt7697_send_connect_req(struct mt7697_cfg80211_info *cfg,
u8 port, u32 if_idx, const u8* bssid,
const u8* ssid, u32 ssid_len, u32 channel)
const u8* ssid, u32 ssid_len,
u32 channel)
{
struct mt7697_connect_req* req = NULL;
u8* ptr;
u32 len = sizeof(struct mt7697_connect_req);
struct mt7697_connect_req req;
int ret;
if (bssid && !is_zero_ether_addr(bssid)) len += ETH_ALEN;
else if (ssid) len += ssid_len;
else {
dev_err(cfg->dev, "%s: invalid connect req\n", __func__);
ret = -EINVAL;
goto cleanup;
}
len = MT7697_LEN32_ALIGNED(len);
req = kzalloc(len, GFP_KERNEL);
if (!req) {
dev_err(cfg->dev, "%s: malloc() failed\n", __func__);
ret = -ENOMEM;
goto cleanup;
}
WARN_ON(!ssid || !ssid_len);
req->cmd.len = len;
req->cmd.grp = MT7697_CMD_GRP_80211;
req->cmd.type = MT7697_CMD_CONNECT_REQ;
req->if_idx = if_idx;
req->port = port;
req->channel = channel;
ptr = req->bssid_ssid;
if (ssid) {
req->ssid_len = ssid_len;
memcpy(ptr, ssid, ssid_len);
ptr += ssid_len;
}
if (bssid && !is_zero_ether_addr(bssid)) {
req->bssid_len = ETH_ALEN;
memcpy(ptr, bssid, ETH_ALEN);
}
memset(&req, 0, sizeof(req));
req.cmd.len = sizeof(struct mt7697_connect_req);
req.cmd.grp = MT7697_CMD_GRP_80211;
req.cmd.type = MT7697_CMD_CONNECT_REQ;
req.if_idx = if_idx;
req.port = port;
req.channel = channel ? ieee80211_frequency_to_channel(channel):channel;
memcpy(req.bssid, bssid, ETH_ALEN);
req.ssid_len = ssid_len;
memcpy(req.ssid, ssid, ssid_len);
dev_dbg(cfg->dev, "%s: <-- CONNECT(%u)\n", __func__, len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)req,
MT7697_QUEUE_LEN_TO_WORD(len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
dev_dbg(cfg->dev, "%s: <-- CONNECT(%u)\n", __func__, req.cmd.len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
if (req) kfree(req);
return ret;
}
int mt7697_send_disconnect_req(struct mt7697_cfg80211_info *cfg, u32 if_idx,
const u8 *addr)
{
struct mt7697_disconnect_req* req = NULL;
u32 len = sizeof(struct mt7697_disconnect_req);
struct mt7697_disconnect_req req;
int ret;
if (addr) len += ETH_ALEN;
req = kmalloc(MT7697_LEN32_ALIGNED(len), GFP_KERNEL);
if (!req) {
dev_err(cfg->dev, "%s: malloc() failed)\n", __func__);
ret = -ENOMEM;
goto cleanup;
}
req->cmd.len = len;
req->cmd.grp = MT7697_CMD_GRP_80211;
req->cmd.type = MT7697_CMD_DISCONNECT_REQ;
req->if_idx = if_idx;
memset(&req, 0, sizeof(req));
req.cmd.len = sizeof(struct mt7697_disconnect_req);
req.cmd.grp = MT7697_CMD_GRP_80211;
req.cmd.type = MT7697_CMD_DISCONNECT_REQ;
req.if_idx = if_idx;
if (addr) {
req->addr_len = ETH_ALEN;
memcpy(req->addr, addr, ETH_ALEN);
req.port = MT7697_PORT_AP;
memcpy(req.addr, addr, ETH_ALEN);
}
else
req->addr_len = 0;
req.port = MT7697_PORT_STA;
dev_dbg(cfg->dev, "%s: <-- DISCONNECT(%u)\n", __func__, len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)req,
MT7697_QUEUE_LEN_TO_WORD(len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
dev_dbg(cfg->dev, "%s: <-- DISCONNECT(%u)\n", __func__, req.cmd.len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
if (ret != MT7697_QUEUE_LEN_TO_WORD(req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret, MT7697_QUEUE_LEN_TO_WORD(req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
ret = 0;
cleanup:
if (req) kfree(req);
return ret;
}
int mt7697_send_tx_raw_packet(struct mt7697_cfg80211_info* cfg,
const u8* data, u32 len)
{
struct mt7697_tx_raw_packet req;
int ret;
req.cmd.len = sizeof(struct mt7697_tx_raw_packet) + len;
req.cmd.grp = MT7697_CMD_GRP_80211;
req.cmd.type = MT7697_CMD_TX_RAW;
req.len = len;
dev_dbg(cfg->dev, "%s: <-- TX RAW PKT(%u)\n", __func__, len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&req,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_tx_raw_packet)));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
goto cleanup;
}
memcpy(cfg->tx_data, data, len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)cfg->tx_data,
MT7697_QUEUE_LEN_TO_WORD(len));
if (ret < 0) {
dev_err(cfg->dev, "%s: write() failed(%d)\n", __func__, ret);
cfg->tx_req.cmd.len = sizeof(struct mt7697_cmd_hdr) + sizeof(len) + len;
cfg->tx_req.len = len;
WARN_ON(len > sizeof(cfg->tx_req.data));
memcpy(cfg->tx_req.data, data, len);
dev_dbg(cfg->dev, "%s: <-- TX RAW PKT(%u)\n", __func__, cfg->tx_req.len);
ret = cfg->hif_ops->write(cfg->txq_hdl, (const u32*)&cfg->tx_req,
MT7697_QUEUE_LEN_TO_WORD(cfg->tx_req.cmd.len));
if (ret != MT7697_QUEUE_LEN_TO_WORD(cfg->tx_req.cmd.len)) {
dev_err(cfg->dev, "%s: write() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(cfg->tx_req.cmd.len));
ret = (ret < 0) ? ret:-EIO;
goto cleanup;
}
......@@ -1430,8 +1754,7 @@ int mt7697_proc_data(void *priv)
}
/* TODO: Do not starve Tx here */
avail = cfg->hif_ops->num_rd(cfg->rxq_hdl);
dev_dbg(cfg->dev, "%s: avail(%u)\n", __func__, avail);
avail = cfg->hif_ops->num_rd(cfg->rxq_hdl);
while (avail > MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_rsp_hdr))) {
if (!cfg->rsp.cmd.len) {
if (avail < MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_rsp_hdr))) {
......@@ -1442,17 +1765,14 @@ int mt7697_proc_data(void *priv)
ret = cfg->hif_ops->read(cfg->rxq_hdl, (u32*)&cfg->rsp,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_rsp_hdr)));
if (ret < 0) {
dev_err(cfg->dev, "%s: read() failed(%d)\n",
__func__, ret);
if (ret != MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_rsp_hdr))) {
dev_err(cfg->dev, "%s: read() failed(%d != %d)\n",
__func__, ret,
MT7697_QUEUE_LEN_TO_WORD(sizeof(struct mt7697_rsp_hdr)));
goto cleanup;
}
dev_dbg(cfg->dev,
"%s: len(%d) grp(%d) type(%d) result(%d)\n",
__func__, cfg->rsp.cmd.len, cfg->rsp.cmd.grp,
cfg->rsp.cmd.type, cfg->rsp.result);
if (cfg->rsp.result) {
if (cfg->rsp.result && (cfg->rsp.cmd.type != MT7697_CMD_RX_RAW)) {
dev_warn(cfg->dev, "%s: result(%d)\n",
__func__, cfg->rsp.result);
}
......
......@@ -25,22 +25,31 @@
#define MT7697_LEN32_ALIGNED(x) (((x) / sizeof(u32) + \
((x) % sizeof(u32) ? 1:0)) * sizeof(u32))
#define MT7697_WOW_MAX_FILTERS_PER_LIST 4
#define MT7697_WOW_PATTERN_SIZE 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_scan_stop mt7697_cmd_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_listen_interval_rsp mt7697_rsp_hdr
#define mt7697_set_pmk_rsp mt7697_rsp_hdr
#define mt7697_set_security_mode_rsp mt7697_rsp_hdr
#define mt7697_scan_stop_rsp mt7697_rsp_hdr
#define MT7697_WOW_MAX_FILTERS_PER_LIST 4
#define MT7697_WOW_PATTERN_SIZE 64
#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_register_rx_hndlr_req mt7697_cmd_hdr
#define mt7697_unregister_rx_hndlr_req 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
#define mt7697_set_listen_interval_rsp mt7697_rsp_hdr
#define mt7697_set_psk_rsp mt7697_rsp_hdr
#define mt7697_set_security_mode_rsp mt7697_rsp_hdr
#define mt7697_scan_stop_rsp mt7697_rsp_hdr
#define mt7697_register_rx_hndlr_rsp mt7697_rsp_hdr
#define mt7697_unregister_rx_hndlr_rsp mt7697_rsp_hdr
enum mt7697_connect_ctrl_flags_bits {
MT7697_CONNECT_ASSOC_POLICY_USER = 0x0001,
......@@ -72,6 +81,8 @@ enum mt7697_wifi_cmd_types {
MT7697_CMD_GET_CFG_RSP,
MT7697_CMD_GET_WIRELESS_MODE_REQ,
MT7697_CMD_GET_WIRELESS_MODE_RSP,
MT7697_CMD_SET_WIRELESS_MODE_REQ,
MT7697_CMD_SET_WIRELESS_MODE_RSP,
MT7697_CMD_SET_OP_MODE_REQ,
MT7697_CMD_SET_OP_MODE_RSP,
MT7697_CMD_GET_RADIO_STATE_REQ,
......@@ -90,15 +101,23 @@ enum mt7697_wifi_cmd_types {
MT7697_CMD_SET_SECURITY_MODE_RSP,
MT7697_CMD_GET_SECURITY_MODE_REQ,
MT7697_CMD_GET_SECURITY_MODE_RSP,
MT7697_CMD_GET_SMART_CONN_FILTER_REQ,
MT7697_CMD_GET_SMART_CONN_FILTER_RSP,
MT7697_CMD_SET_SMART_CONN_FILTER_REQ,
MT7697_CMD_SET_SMART_CONN_FILTER_RSP,
MT7697_CMD_REGISTER_RX_HNDLR_REQ,
MT7697_CMD_REGISTER_RX_HNDLR_RSP,
MT7697_CMD_UNREGISTER_RX_HNDLR_REQ,
MT7697_CMD_UNREGISTER_RX_HNDLR_RSP,
MT7697_CMD_SCAN_REQ,
MT7697_CMD_SCAN_RSP,
MT7697_CMD_SCAN_COMPLETE,
MT7697_CMD_SCAN_STOP,
MT7697_CMD_SCAN_STOP_RSP,
MT7697_CMD_GET_PMK_REQ,
MT7697_CMD_GET_PMK_RSP,
MT7697_CMD_SET_PMK_REQ,
MT7697_CMD_SET_PMK_RSP,
MT7697_CMD_GET_PSK_REQ,
MT7697_CMD_GET_PSK_RSP,
MT7697_CMD_SET_PSK_REQ,
MT7697_CMD_SET_PSK_RSP,
MT7697_CMD_CONNECT_REQ,
MT7697_CMD_CONNECT_RSP,
MT7697_CMD_DISCONNECT_REQ,
......@@ -126,14 +145,9 @@ struct mt7697_mac_addr_req {
__be32 port;
} __attribute__((packed, aligned(4)));
struct mt7697_mac_addr {
__be16 len;
u8 data[ETH_ALEN];
} __attribute__((packed, aligned(4)));
struct mt7697_mac_addr_rsp {
struct mt7697_rsp_hdr rsp;
struct mt7697_mac_addr addr;
u8 addr[MT7697_LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_get_wireless_mode_req {
......@@ -146,6 +160,12 @@ struct mt7697_get_wireless_mode_rsp {
__be32 mode;
} __attribute__((packed, aligned(4)));
struct mt7697_set_wireless_mode_req {
struct mt7697_cmd_hdr cmd;
__be32 port;
__be32 mode;
} __attribute__((packed, aligned(4)));
struct mt7697_cfg_rsp {
struct mt7697_rsp_hdr rsp;
struct mt7697_wifi_config_t cfg;
......@@ -176,6 +196,16 @@ struct mt7697_set_rx_filter_req {
__be32 rx_filter;
} __attribute__((packed, aligned(4)));
struct mt7697_get_smart_conn_filter_rsp {
struct mt7697_rsp_hdr rsp;
__be32 flag;
} __attribute__((packed, aligned(4)));
struct mt7697_set_smart_conn_filter_req {
struct mt7697_cmd_hdr cmd;
__be32 flag;
} __attribute__((packed, aligned(4)));
struct mt7697_get_listen_interval_rsp {
struct mt7697_rsp_hdr rsp;
__be32 interval;
......@@ -189,11 +219,12 @@ struct mt7697_set_listen_interval_req {
struct mt7697_scan_req {
struct mt7697_cmd_hdr cmd;
__be32 if_idx;
u8 mode;
u8 option;
u8 ssid_len;
u8 bssid_len;
u8 ssid_bssid[ETH_ALEN + IEEE80211_MAX_SSID_LEN];
__be32 mode;
__be32 option;
__be32 bssid_len;
u8 bssid[MT7697_LEN32_ALIGNED(ETH_ALEN)];
__be32 ssid_len;
u8 ssid[MT7697_LEN32_ALIGNED(IEEE80211_MAX_SSID_LEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_scan_rsp {
......@@ -209,20 +240,22 @@ struct mt7697_scan_complete_rsp {
__be32 if_idx;
} __attribute__((packed, aligned(4)));
struct mt7697_get_pmk_req {
struct mt7697_get_psk_req {
struct mt7697_cmd_hdr cmd;
__be32 port;
} __attribute__((packed, aligned(4)));
struct mt7697_get_pmk_rsp {
struct mt7697_get_psk_rsp {
struct mt7697_rsp_hdr rsp;
u8 pmk[MT7697_WIFI_LENGTH_PMK];
__be32 len;
u8 psk[MT7697_LEN32_ALIGNED(MT7697_PASSPHRASE_LEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_set_pmk_req {
struct mt7697_set_psk_req {
struct mt7697_cmd_hdr cmd;
__be32 port;
u8 pmk[MT7697_WIFI_LENGTH_PMK];
__be32 len;
u8 psk[MT7697_LEN32_ALIGNED(MT7697_PASSPHRASE_LEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_set_security_mode_req {
......@@ -250,56 +283,60 @@ struct mt7697_connect_req {
__be32 if_idx;
__be32 port;
__be32 channel;
__be32 bssid_len;
u8 bssid[MT7697_LEN32_ALIGNED(ETH_ALEN)];
__be32 ssid_len;
u8 bssid_ssid[];
u8 ssid[MT7697_LEN32_ALIGNED(IEEE80211_MAX_SSID_LEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_connect_rsp {
struct mt7697_rsp_hdr rsp;
__be32 if_idx;
__be32 channel;
u8 bssid[ETH_ALEN];
u8 bssid[MT7697_LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_disconnect_req {
struct mt7697_cmd_hdr cmd;
__be32 if_idx;
__be32 addr_len;
u8 addr[];
__be32 port;
u8 addr[MT7697_LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_disconnect_rsp {
struct mt7697_rsp_hdr rsp;
__be32 if_idx;
u8 bssid[ETH_ALEN];
u8 bssid[MT7697_LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_tx_raw_packet {
struct mt7697_cmd_hdr cmd;
__be32 len;
u8 data[];
u8 data[MT7697_LEN32_ALIGNED(IEEE80211_MAX_FRAME_LEN)];
} __attribute__((packed, aligned(4)));
struct mt7697_rx_raw_packet {
struct mt7697_cmd_hdr cmd;
__be32 len;
struct mt7697_rsp_hdr hdr;
u8 data[];
} __attribute__((packed, aligned(4)));
int mt7697_send_init(struct mt7697_cfg80211_info*);
int mt7697_send_reset(struct mt7697_cfg80211_info*);
int mt7697_send_set_wireless_mode_req(struct mt7697_cfg80211_info*, u8, u8);
int mt7697_send_get_wireless_mode_req(struct mt7697_cfg80211_info*, u8);
int mt7697_send_get_pmk_req(struct mt7697_cfg80211_info*, u8);
int mt7697_send_set_pmk_req(struct mt7697_cfg80211_info*, u8, const u8[]);
int mt7697_send_get_psk_req(struct mt7697_cfg80211_info*, u8);
int mt7697_send_set_psk_req(struct mt7697_cfg80211_info*, u8, const u8[]);
int mt7697_send_mac_addr_req(struct mt7697_cfg80211_info*, u8);
int mt7697_send_cfg_req(struct mt7697_cfg80211_info*);
int mt7697_send_register_rx_hndlr_req(struct mt7697_cfg80211_info*);
int mt7697_send_unregister_rx_hndlr_req(struct mt7697_cfg80211_info*);
int mt7697_send_set_op_mode_req(struct mt7697_cfg80211_info*, u8);
int mt7697_send_get_radio_state_req(struct mt7697_cfg80211_info*);
int mt7697_send_set_radio_state_req(struct mt7697_cfg80211_info*, u8);
int mt7697_send_get_rx_filter_req(struct mt7697_cfg80211_info*);
int mt7697_send_set_rx_filter_req(struct mt7697_cfg80211_info*, u32);
int mt7697_send_get_smart_conn_filter_req(struct mt7697_cfg80211_info*);
int mt7697_send_set_smart_conn_filter_req(struct mt7697_cfg80211_info*, u8);
int mt7697_send_get_listen_interval_req(struct mt7697_cfg80211_info*);
int mt7697_send_set_listen_interval_req(struct mt7697_cfg80211_info*, u32);
int mt7697_send_scan_req(struct mt7697_cfg80211_info*, u32,
......
......@@ -5,10 +5,14 @@
// Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
//--------------------------------------------------------------------------------------------------
#include "$LEGATO_ROOT/legatoTargetConfig.sinc"
#include "$LEGATO_ROOT/apps/platformServices/defaultAirVantage.sinc"
apps:
{
// Platform services.
$LEGATO_ROOT/apps/platformServices/airVantage/avcService
// $LEGATO_ROOT/apps/platformServices/airVantage/avcService
$LEGATO_ROOT/apps/platformServices/audioService
$LEGATO_ROOT/apps/platformServices/cellNetService
$LEGATO_ROOT/apps/platformServices/dataConnectionService
......@@ -20,10 +24,10 @@ apps:
$LEGATO_ROOT/apps/platformServices/smsInboxService
$LEGATO_ROOT/apps/platformServices/voiceCallService
$LEGATO_ROOT/apps/platformServices/gpioService
$LEGATO_ROOT/apps/platformServices/atClient
$LEGATO_ROOT/apps/platformServices/atServer
// $LEGATO_ROOT/apps/platformServices/atClient
// $LEGATO_ROOT/apps/platformServices/atServer
$LEGATO_ROOT/apps/platformServices/spiService
$LEGATO_ROOT/apps/platformServices/devMode
$LEGATO_ROOT/apps/tools/devMode
$MANGOH_ROOT/apps/GpioExpander/gpioExpanderService/gpioExpanderServiceRed
......@@ -33,14 +37,27 @@ apps:
// $MANGOH_ROOT/apps/MuxControl/tools/muxCtrlTools
$MANGOH_ROOT/apps/MqttClient/mqttClient
$MANGOH_ROOT/apps/DataRouter/dataRouter
$MANGOH_ROOT/apps/DataRouter/drTool/drTool
// $MANGOH_ROOT/apps/DataRouter/dataRouter
// $MANGOH_ROOT/apps/DataRouter/drTool/drTool
$MANGOH_ROOT/apps/SocialService/socialService
// Command-line tools.
$LEGATO_ROOT/apps/tools/tools
}
kernelModules:
{
$MANGOH_ROOT/linux_kernel_modules/cp2130/spi-cp2130.mdef
$MANGOH_ROOT/linux_kernel_modules/spisvc/spisvc.mdef
$MANGOH_ROOT/linux_kernel_modules/mt7697wifi/mt7697wifi_core.mdef
$MANGOH_ROOT/linux_kernel_modules/mt7697q/mt7697q.mdef
}
buildVars:
{
LEGATO_KERNELROOT = /home/david/kernel
}
commands:
{
cm = tools:/bin/cm
......@@ -52,7 +69,7 @@ commands:
// mux = muxCtrlTools:/bin/mux
dr = drTool:/bin/dr
// dr = drTool:/bin/dr
twitter = socialService:/bin/twitter
}
......
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