BigW Consortium Gitlab

Commit c925bf40 by David Frey Committed by David Clark

Cleanup formatting of mt7697 kernel code

- Remove trailing whitespace - Wrap lines at 80 chars - Format else statements according to linux coding style
parent 7d650479
......@@ -30,46 +30,46 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo)
ret = mt7697q_get_s2m_mbx(qinfo, &s2m_mbox);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): mt7697q_get_s2m_mbx() failed(%d)\n",
dev_err(qinfo->dev,
"%s(): mt7697q_get_s2m_mbx() failed(%d)\n",
__func__, ret);
goto cleanup;
}
if (s2m_mbox) {
if (!queue_delayed_work(qinfo->irq_workq,
if (!queue_delayed_work(qinfo->irq_workq,
&qinfo->irq_delayed_work, usecs_to_jiffies(10))) {
dev_err(qinfo->dev,
"%s(): queue_delayed_work() failed\n",
dev_err(qinfo->dev,
"%s(): queue_delayed_work() failed\n",
__func__);
ret = -EINVAL;
}
}
else
} else {
enable_irq(qinfo->irq);
}
for (ch = 0; ch < MT7697_NUM_QUEUES; ch++) {
struct mt7697q_spec *qs = &qinfo->queues[ch];
u32 in_use = mt7697q_flags_get_in_use(qs->data.flags);
u32 dir = mt7697q_flags_get_dir(qs->data.flags);
if (in_use &&
(s2m_mbox & (0x01 << ch))) {
if (in_use &&
(s2m_mbox & (0x01 << ch))) {
if (dir == MT7697_QUEUE_DIR_S2M) {
ret = mt7697q_proc_data(qs);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): mt7697q_proc_data() failed(%d)\n",
dev_err(qinfo->dev,
"%s(): mt7697q_proc_data() failed(%d)\n",
__func__, ret);
goto cleanup;
}
}
else if (mt7697q_blocked_writer(qs)) {
WARN_ON(!qs->notify_tx_fcn);
ret = qs->notify_tx_fcn(qs->priv, mt7697q_get_free_words(qs));
} else if (mt7697q_blocked_writer(qs)) {
WARN_ON(!qs->notify_tx_fcn);
ret = qs->notify_tx_fcn(qs->priv,
mt7697q_get_free_words(qs));
if (ret < 0) {
dev_err(qs->qinfo->dev,
"%s(): notify_tx_fcn() failed(%d)\n",
dev_err(qs->qinfo->dev,
"%s(): notify_tx_fcn() failed(%d)\n",
__func__, ret);
}
}
......@@ -82,14 +82,14 @@ cleanup:
void mt7697q_irq_delayed_work(struct work_struct *irq_delayed_work)
{
struct mt7697q_info *qinfo = container_of(irq_delayed_work,
struct mt7697q_info *qinfo = container_of(irq_delayed_work,
struct mt7697q_info, irq_delayed_work.work);
int ret;
dev_dbg(qinfo->dev, "%s(): process work\n", __func__);
ret = mt7697q_irq_run(qinfo);
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697q_irq_run() failed(%d)\n",
dev_err(qinfo->dev, "%s(): mt7697q_irq_run() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -100,15 +100,15 @@ cleanup:
void mt7697q_irq_work(struct work_struct *irq_work)
{
struct mt7697q_info *qinfo = container_of(irq_work,
struct mt7697q_info *qinfo = container_of(irq_work,
struct mt7697q_info, irq_work);
int ret;
dev_dbg(qinfo->dev, "%s(): process work\n", __func__);
ret = mt7697q_irq_run(qinfo);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): mt7697q_irq_run() failed(%d)\n",
dev_err(qinfo->dev,
"%s(): mt7697q_irq_run() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -121,7 +121,7 @@ irqreturn_t mt7697q_isr(int irq, void *arg)
{
struct mt7697q_info *qinfo = (struct mt7697q_info*)arg;
disable_irq_nosync(qinfo->irq);
disable_irq_nosync(qinfo->irq);
if (!queue_work(qinfo->irq_workq, &qinfo->irq_work)) {
dev_err(qinfo->dev, "%s(): queue_work() failed\n", __func__);
}
......
......@@ -40,7 +40,7 @@ struct mt7697q_data {
u16 rd_offset;
u16 reserved1;
u16 wr_offset;
u16 reserved2;
u16 reserved2;
};
struct mt7697q_spec {
......@@ -57,14 +57,14 @@ struct mt7697q_info {
struct mt7697_rsp_hdr rsp;
u8 txBuffer[sizeof(u32)];
u8 rxBuffer[sizeof(u32)];
struct device *dev;
void *hw_priv;
const struct mt7697spi_hw_ops *hw_ops;
struct mutex mutex;
struct workqueue_struct *irq_workq;
struct work_struct irq_work;
struct delayed_work irq_delayed_work;
atomic_t blocked_writer;
......
......@@ -85,7 +85,7 @@ static int __init mt7697spi_init(void)
while (!master && (bus_num >= 0)) {
master = spi_busnum_to_master(bus_num);
if (!master)
if (!master)
bus_num--;
}
......@@ -97,18 +97,19 @@ static int __init mt7697spi_init(void)
ret = cp2130_update_ch_config(master, MT7697_SPI_CONFIG);
if (ret < 0) {
dev_err(&master->dev,
"%s(): cp2130_update_ch_config() failed(%d)\n",
dev_err(&master->dev,
"%s(): cp2130_update_ch_config() failed(%d)\n",
__func__, ret);
goto cleanup;
}
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), MT7697_SPI_CS);
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev),
MT7697_SPI_CS);
dev_info(&master->dev, "%s(): find SPI device('%s')\n", __func__, str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) {
dev_err(&master->dev,
"%s(): bus_find_device_by_name('%s') failed\n",
dev_err(&master->dev,
"%s(): bus_find_device_by_name('%s') failed\n",
__func__, str);
ret = -EINVAL;
......@@ -117,20 +118,20 @@ static int __init mt7697spi_init(void)
spi = container_of(dev, struct spi_device, dev);
if (!spi) {
dev_err(&master->dev, "%s(): get SPI device failed\n",
dev_err(&master->dev, "%s(): get SPI device failed\n",
__func__);
ret = -EINVAL;
goto cleanup;
}
dev_info(&master->dev, "%s(): dev('%s') mode(%d) max speed(%d) "
"CS(%d) bits/word(%d)\n",
__func__, spi->modalias, spi->mode, spi->max_speed_hz,
"CS(%d) bits/word(%d)\n",
__func__, spi->modalias, spi->mode, spi->max_speed_hz,
spi->chip_select, spi->bits_per_word);
qinfo = kzalloc(sizeof(struct mt7697q_info), GFP_KERNEL);
if (!qinfo) {
dev_err(&master->dev, "%s(): create queue info failed\n",
dev_err(&master->dev, "%s(): create queue info failed\n",
__func__);
ret = -ENOMEM;
goto cleanup;
......@@ -146,10 +147,10 @@ static int __init mt7697spi_init(void)
INIT_DELAYED_WORK(&qinfo->irq_delayed_work, mt7697q_irq_delayed_work);
INIT_WORK(&qinfo->irq_work, mt7697q_irq_work);
qinfo->irq_workq = alloc_workqueue(DRVNAME"wq",
qinfo->irq_workq = alloc_workqueue(DRVNAME"wq",
WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
if (!qinfo->irq_workq) {
dev_err(qinfo->dev, "%s(): alloc_workqueue() failed\n",
dev_err(qinfo->dev, "%s(): alloc_workqueue() failed\n",
__func__);
ret = -ENOMEM;
goto cleanup;
......@@ -159,15 +160,14 @@ static int __init mt7697spi_init(void)
ret = gpio_request(qinfo->gpio_pin, MT7697_SPI_GPIO_IRQ_NAME);
if (ret < 0) {
if (ret != -EBUSY) {
dev_err(qinfo->dev, "%s(): gpio_request() failed(%d)",
dev_err(qinfo->dev, "%s(): gpio_request() failed(%d)",
__func__, ret);
goto failed_workqueue;
}
qinfo->irq = gpio_to_irq(qinfo->gpio_pin);
qinfo->gpio_pin = MT7697_SPI_INTR_GPIO_PIN_INVALID;
}
else {
} else {
gpio_direction_input(qinfo->gpio_pin);
qinfo->irq = gpio_to_irq(qinfo->gpio_pin);
}
......@@ -175,7 +175,7 @@ static int __init mt7697spi_init(void)
dev_info(qinfo->dev, "%s(): request irq(%d)\n", __func__, qinfo->irq);
ret = request_irq(qinfo->irq, mt7697q_isr, 0, DRVNAME, qinfo);
if (ret < 0) {
dev_err(qinfo->dev, "%s(): request_irq() failed(%d)",
dev_err(qinfo->dev, "%s(): request_irq() failed(%d)",
__func__, ret);
goto failed_gpio_req;
}
......@@ -218,26 +218,27 @@ static void __exit mt7697spi_exit(void)
goto cleanup;
}
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), MT7697_SPI_CS);
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev),
MT7697_SPI_CS);
dev_info(&master->dev, "%s(): find SPI device('%s')\n", __func__, str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) {
dev_err(&master->dev,
"%s(): '%s' bus_find_device_by_name() failed\n",
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) {
dev_err(dev, "%s(): get SPI device failed\n",
dev_err(dev, "%s(): get SPI device failed\n",
__func__);
goto cleanup;
}
qinfo = spi_get_drvdata(spi);
if (!qinfo) {
dev_err(dev, "%s(): SPI device no queue info\n",
dev_err(dev, "%s(): SPI device no queue info\n",
__func__);
goto cleanup;
}
......@@ -259,6 +260,6 @@ cleanup:
module_init(mt7697spi_init);
module_exit(mt7697spi_exit);
MODULE_AUTHOR( "Sierra Wireless Corporation" );
MODULE_LICENSE( "GPL" );
MODULE_DESCRIPTION( "MediaTek7697 SPI master" );
MODULE_AUTHOR("Sierra Wireless Corporation");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MediaTek7697 SPI master");
......@@ -90,7 +90,7 @@ struct mt7697_cfg80211_info {
struct device *dev;
struct wiphy *wiphy;
struct semaphore sem;
struct platform_device *hif_priv;
const struct mt7697_if_ops *hif_ops;
......@@ -110,7 +110,7 @@ struct mt7697_cfg80211_info {
u8 rx_data[LEN32_ALIGNED(IEEE80211_MAX_FRAME_LEN)];
u8 probe_data[LEN32_ALIGNED(IEEE80211_MAX_DATA_LEN)];
enum mt7697_port_type port_type;
enum mt7697_wifi_phy_mode_t wireless_mode;
enum mt7697_wifi_phy_mode_t hw_wireless_mode;
......@@ -163,7 +163,7 @@ struct mt7697_vif {
u8 req_bssid[ETH_ALEN];
u8 pmk[MT7697_WIFI_LENGTH_PMK];
u16 ch_hint;
struct work_struct disconnect_work;
struct timer_list disconnect_timer;
......@@ -217,7 +217,7 @@ 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*, u32);
struct wireless_dev *mt7697_interface_add(struct mt7697_cfg80211_info*,
struct wireless_dev *mt7697_interface_add(struct mt7697_cfg80211_info*,
const char*, enum nl80211_iftype, u8);
int mt7697_notify_tx(void*, u32);
void mt7697_tx_stop(struct mt7697_cfg80211_info*);
......
......@@ -40,10 +40,10 @@ static void mt7697_to_lower(char** in)
while (*ptr != '\0') {
if (((*ptr <= 'Z') && (*ptr >= 'A')) ||
((*ptr <= 'z') && (*ptr >= 'a')))
*ptr = ((*ptr <= 'Z') && (*ptr >= 'A')) ?
*ptr = ((*ptr <= 'Z') && (*ptr >= 'A')) ?
*ptr + 'a' - 'A':*ptr;
ptr++;
ptr++;
}
}
......@@ -71,8 +71,9 @@ static int mt7697_open(struct net_device *ndev)
if (test_bit(CONNECTED, &vif->flags)) {
netif_carrier_on(ndev);
netif_wake_queue(ndev);
} else
} else {
netif_carrier_on(ndev);
}
cleanup:
return ret;
......@@ -89,13 +90,13 @@ static int mt7697_stop(struct net_device *ndev)
ret = mt7697_cfg80211_stop(vif);
if (ret < 0) {
dev_err(cfg->dev,
"%s(): mt7697_cfg80211_stop() failed(%d)\n",
dev_err(cfg->dev,
"%s(): mt7697_cfg80211_stop() failed(%d)\n",
__func__, ret);
goto cleanup;
}
cleanup:
cleanup:
return ret;
}
......@@ -112,7 +113,7 @@ static void mt7697_set_multicast_list(struct net_device *ndev)
bool mc_all_on = false;
int mc_count = netdev_mc_count(ndev);
dev_dbg(cfg->dev, "%s(): net device set multicast flags(0x%08x)\n",
dev_dbg(cfg->dev, "%s(): net device set multicast flags(0x%08x)\n",
__func__, ndev->flags);
/* Enable multicast-all filter. */
......@@ -139,25 +140,25 @@ static void mt7697_set_multicast_list(struct net_device *ndev)
static void mt7697_init_hw_start(struct work_struct *work)
{
struct mt7697_cfg80211_info *cfg = container_of(work,
struct mt7697_cfg80211_info *cfg = container_of(work,
struct mt7697_cfg80211_info, init_work);
int err;
if (!strcmp(hw_itf, "spi")) {
dev_dbg(cfg->dev, "%s(): init mt7697 queue(%u/%u)\n",
__func__, MT7697_MAC80211_QUEUE_TX, MT7697_MAC80211_QUEUE_RX);
err = cfg->hif_ops->init(MT7697_MAC80211_QUEUE_TX,
dev_dbg(cfg->dev, "%s(): init mt7697 queue(%u/%u)\n",
__func__, MT7697_MAC80211_QUEUE_TX,
MT7697_MAC80211_QUEUE_RX);
err = cfg->hif_ops->init(MT7697_MAC80211_QUEUE_TX,
MT7697_MAC80211_QUEUE_RX, cfg,
mt7697_notify_tx,
mt7697_proc_80211cmd,
mt7697_notify_tx,
mt7697_proc_80211cmd,
&cfg->txq_hdl, &cfg->rxq_hdl);
if (err < 0) {
dev_err(cfg->dev, "%s(): queue(%u) init() failed(%d)\n",
__func__, MT7697_MAC80211_QUEUE_TX, err);
goto failed;
}
}
else {
} else {
dev_dbg(cfg->dev, "%s(): open mt7697 uart\n", __func__);
cfg->txq_hdl = cfg->hif_ops->open(mt7697_proc_80211cmd, cfg);
if (!cfg->txq_hdl) {
......@@ -170,7 +171,7 @@ static void mt7697_init_hw_start(struct work_struct *work)
err = mt7697_wr_cfg_req(cfg);
if (err < 0) {
dev_err(cfg->dev, "%s(): mt7697_wr_cfg_req() failed(%d)\n",
dev_err(cfg->dev, "%s(): mt7697_wr_cfg_req() failed(%d)\n",
__func__, err);
goto failed;
}
......@@ -193,7 +194,7 @@ void mt7697_init_netdev(struct net_device *ndev)
ndev->wireless_handlers = &mt7697_wireless_hndlrs;
ndev->destructor = free_netdev;
ndev->watchdog_timeo = MT7697_TX_TIMEOUT;
ndev->needed_headroom = sizeof(struct ieee80211_hdr) +
ndev->needed_headroom = sizeof(struct ieee80211_hdr) +
sizeof(struct mt7697_llc_snap_hdr);
ndev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
}
......@@ -201,7 +202,7 @@ void mt7697_init_netdev(struct net_device *ndev)
static struct mt7697_if_ops if_ops;
static int mt7697_probe(struct platform_device *pdev)
{
{
struct wiphy *wiphy;
struct mt7697_cfg80211_info *cfg;
int err = 0;
......@@ -209,7 +210,7 @@ static int mt7697_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "%s(): probe\n", __func__);
cfg = mt7697_cfg80211_create();
if (!cfg) {
dev_err(&pdev->dev,
dev_err(&pdev->dev,
"%s(): mt7697_cfg80211_create() failed()\n",
__func__);
err = -ENOMEM;
......@@ -219,7 +220,7 @@ static int mt7697_probe(struct platform_device *pdev)
sema_init(&cfg->sem, 1);
cfg->tx_workq = create_workqueue(DRVNAME);
if (!cfg->tx_workq) {
dev_err(&pdev->dev,
dev_err(&pdev->dev,
"%s(): create_workqueue() failed()\n",
__func__);
err = -ENOMEM;
......@@ -245,16 +246,14 @@ static int mt7697_probe(struct platform_device *pdev)
if_ops.read = mt7697q_read;
if_ops.write = mt7697q_write;
if_ops.unblock_writer = mt7697q_unblock_writer;
}
else if (!strcmp(hw_itf, "uart")) {
} else if (!strcmp(hw_itf, "uart")) {
if_ops.open = mt7697_uart_open;
if_ops.close = mt7697_uart_close;
if_ops.read = mt7697_uart_read;
if_ops.write = mt7697_uart_write;
}
else {
dev_err(&pdev->dev,
"%s(): invalid hw itf(spi/uart) module paramter('%s')\n",
} else {
dev_err(&pdev->dev,
"%s(): invalid hw itf(spi/uart) module paramter('%s')\n",
__func__, hw_itf);
err = -EINVAL;
goto failed;
......@@ -269,15 +268,15 @@ static int mt7697_probe(struct platform_device *pdev)
err = mt7697_cfg80211_init(cfg);
if (err < 0) {
dev_err(&pdev->dev,
"%s(): mt7697_cfg80211_init() failed(%d)\n",
dev_err(&pdev->dev,
"%s(): mt7697_cfg80211_init() failed(%d)\n",
__func__, err);
goto failed;
}
platform_set_drvdata(pdev, cfg);
schedule_work(&cfg->init_work);
failed:
if (err < 0) {
if (wiphy) wiphy_free(wiphy);
......@@ -327,14 +326,14 @@ static int __init mt7697_init(void)
pr_info(DRVNAME" init\n");
ret = platform_device_register(&mt7697_platform_device);
if (ret) {
pr_err(DRVNAME" %s(): platform_device_register() failed(%d)\n",
pr_err(DRVNAME" %s(): platform_device_register() failed(%d)\n",
__func__, ret);
goto cleanup;
}
ret = platform_driver_register(&mt7697_platform_driver);
if (ret) {
pr_err(DRVNAME" %s(): platform_driver_register() failed(%d)\n",
pr_err(DRVNAME" %s(): platform_driver_register() failed(%d)\n",
__func__, ret);
platform_device_del(&mt7697_platform_device);
goto cleanup;
......@@ -374,16 +373,16 @@ int mt7697_disconnect(struct mt7697_vif *vif)
if (test_bit(CONNECTED, &vif->flags) ||
test_bit(CONNECT_PEND, &vif->flags)) {
if (vif->sme_state == SME_CONNECTING)
cfg80211_connect_result(vif->ndev, vif->bssid,
if (vif->sme_state == SME_CONNECTING) {
cfg80211_connect_result(vif->ndev, vif->bssid,
NULL, 0,
NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL);
else if (vif->sme_state == SME_CONNECTED) {
} else if (vif->sme_state == SME_CONNECTED) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,44)
cfg80211_disconnected(vif->ndev, 0,
NULL, 0, vif->locally_generated,
NULL, 0, vif->locally_generated,
GFP_KERNEL);
#else
cfg80211_disconnected(vif->ndev, 0,
......@@ -393,8 +392,8 @@ int mt7697_disconnect(struct mt7697_vif *vif)
ret = mt7697_wr_disconnect_req(vif->cfg, NULL);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_disconnect_req() failed(%d)\n",
dev_err(vif->cfg->dev,
"%s(): mt7697_wr_disconnect_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -414,4 +413,3 @@ cleanup:
MODULE_AUTHOR("Sierra Wireless Corporation");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MediaTek7697 WiFi 80211");
......@@ -7,7 +7,7 @@ export CLIENT_REF="0x10000001"
export PASSPHRASE="@iPr1m3"
export SECURITY_PROTO="3"
echo "Start wifi client..."
echo "Start wifi client..."
wifi client start $ITF_LAN
echo "Begin wifi client scan..."
......
......@@ -25,13 +25,14 @@ int mt7697_notify_tx(void* priv, u32 free)
spin_lock_bh(&cfg->tx_skb_list_lock);
if (!list_empty(&cfg->tx_skb_list)) {
struct mt7697_tx_pkt *tx_pkt = list_entry(&cfg->tx_skb_list,
struct mt7697_tx_pkt *tx_pkt = list_entry(&cfg->tx_skb_list,
struct mt7697_tx_pkt, next);
if (tx_pkt->skb->len >= free) {
cfg->hif_ops->unblock_writer(cfg->txq_hdl);
ret = queue_work(cfg->tx_workq, &cfg->tx_work);
if (ret < 0) {
dev_err(cfg->dev, "%s(): queue_work() failed(%d)\n",
dev_err(cfg->dev,
"%s(): queue_work() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -52,7 +53,7 @@ int mt7697_data_tx(struct sk_buff *skb, struct net_device *ndev)
dev_dbg(cfg->dev, "%s(): tx len(%u)\n", __func__, skb->len);
dev_dbg(cfg->dev, "%s(): headroom skb/needed(%u/%u)\n",
dev_dbg(cfg->dev, "%s(): headroom skb/needed(%u/%u)\n",
__func__, skb_headroom(skb), ndev->needed_headroom);
if (skb_headroom(skb) < ndev->needed_headroom) {
struct sk_buff *tmp_skb = skb;
......@@ -67,18 +68,18 @@ int mt7697_data_tx(struct sk_buff *skb, struct net_device *ndev)
tx_skb = &cfg->tx_skb_pool[atomic_read(&cfg->tx_skb_pool_idx)];
if (tx_skb->skb) {
dev_warn(cfg->dev, "%s(): tx pool full\n",
dev_warn(cfg->dev, "%s(): tx pool full\n",
__func__);
ret = NETDEV_TX_BUSY;
goto cleanup;
}
tx_skb->skb = skb;
dev_dbg(cfg->dev, "%s(): tx pkt(%u/%p)\n",
dev_dbg(cfg->dev, "%s(): tx pkt(%u/%p)\n",
__func__, atomic_read(&cfg->tx_skb_pool_idx), tx_skb->skb);
atomic_inc(&cfg->tx_skb_pool_idx);
if (atomic_read(&cfg->tx_skb_pool_idx) >= MT7697_TX_PKT_POOL_LEN)
if (atomic_read(&cfg->tx_skb_pool_idx) >= MT7697_TX_PKT_POOL_LEN)
atomic_set(&cfg->tx_skb_pool_idx, 0);
spin_lock_bh(&cfg->tx_skb_list_lock);
......@@ -87,7 +88,7 @@ int mt7697_data_tx(struct sk_buff *skb, struct net_device *ndev)
ret = queue_work(cfg->tx_workq, &cfg->tx_work);
if (ret < 0) {
dev_err(cfg->dev, "%s(): queue_work() failed(%d)\n",
dev_err(cfg->dev, "%s(): queue_work() failed(%d)\n",
__func__, ret);
ret = NETDEV_TX_BUSY;
goto cleanup;
......@@ -105,7 +106,7 @@ cleanup:
void mt7697_tx_work(struct work_struct *work)
{
struct mt7697_cfg80211_info *cfg = container_of(work,
struct mt7697_cfg80211_info *cfg = container_of(work,
struct mt7697_cfg80211_info, tx_work);
struct mt7697_tx_pkt *tx_pkt, *tx_pkt_next = NULL;
struct ieee80211_hdr *hdr;
......@@ -117,21 +118,22 @@ void mt7697_tx_work(struct work_struct *work)
/* validate length for ether packet */
if (tx_pkt->skb->len < sizeof(*hdr)) {
dev_err(cfg->dev, "%s(): invalid skb len(%u < %u)\n",
dev_err(cfg->dev, "%s(): invalid skb len(%u < %u)\n",
__func__, tx_pkt->skb->len, sizeof(*hdr));
vif->net_stats.tx_errors++;
}
ret = mt7697_wr_tx_raw_packet(cfg, tx_pkt->skb->data,
ret = mt7697_wr_tx_raw_packet(cfg, tx_pkt->skb->data,
tx_pkt->skb->len);
if (ret < 0) {
dev_dbg(cfg->dev,
"%s(): mt7697_wr_tx_raw_packet() failed(%d)\n",
dev_dbg(cfg->dev,
"%s(): mt7697_wr_tx_raw_packet() failed(%d)\n",
__func__, ret);
vif->net_stats.tx_errors++;
}
dev_dbg(cfg->dev, "%s(): tx complete pkt(%p)\n", __func__, tx_pkt->skb);
dev_dbg(cfg->dev, "%s(): tx complete pkt(%p)\n", __func__,
tx_pkt->skb);
vif->net_stats.tx_packets++;
vif->net_stats.tx_bytes += tx_pkt->skb->len;
......@@ -154,7 +156,8 @@ void mt7697_tx_stop(struct mt7697_cfg80211_info *cfg)
struct mt7697_vif *vif = netdev_priv(tx_pkt->skb->dev);
WARN_ON(!vif);
dev_dbg(cfg->dev, "%s(): tx drop pkt(%p)\n", __func__, tx_pkt->skb);
dev_dbg(cfg->dev, "%s(): tx drop pkt(%p)\n", __func__,
tx_pkt->skb);
vif->net_stats.tx_dropped++;
spin_lock_bh(&cfg->tx_skb_list_lock);
......@@ -186,7 +189,7 @@ int mt7697_rx_data(struct mt7697_cfg80211_info *cfg, u32 len, u32 if_idx)
}
if ((len < sizeof(*hdr)) || (len > IEEE80211_MAX_FRAME_LEN)) {
dev_warn(cfg->dev, "%s(): invalid Rx frame size(%u)\n",
dev_warn(cfg->dev, "%s(): invalid Rx frame size(%u)\n",
__func__, len);
vif->net_stats.rx_length_errors++;
ret = -EINVAL;
......@@ -209,7 +212,7 @@ int mt7697_rx_data(struct mt7697_cfg80211_info *cfg, u32 len, u32 if_idx)
skb->protocol = eth_type_trans(skb, skb->dev);
skb->ip_summed = CHECKSUM_UNNECESSARY;
dev_dbg(cfg->dev, "%s(): rx frame protocol(%u) type(%u)\n",
dev_dbg(cfg->dev, "%s(): rx frame protocol(%u) type(%u)\n",
__func__, skb->protocol, skb->pkt_type);
ret = netif_rx_ni(skb);
......@@ -221,7 +224,8 @@ int mt7697_rx_data(struct mt7697_cfg80211_info *cfg, u32 len, u32 if_idx)
goto cleanup;
}
dev_err(cfg->dev, "%s(): netif_rx_ni() failed(%d)\n", __func__, ret);
dev_err(cfg->dev, "%s(): netif_rx_ni() failed(%d)\n", __func__,
ret);
goto cleanup;
}
......
......@@ -50,7 +50,7 @@
/**
* @brief Repeater mode. There are two virtual ports in repeater mode, one is #WIFI_PORT_AP, and the other is #WIFI_PORT_APCLI.
* Both ports should be configured to operate on the same channel with the same bandwidth, while their other settings can be different.
* Both ports should be configured to operate on the same channel with the same bandwidth, while their other settings can be different.
* For example, both ports can have different MAC addresses and security modes.
*/
#define MT7697_WIFI_MODE_REPEATER (3)
......
......@@ -20,8 +20,8 @@
#include <linux/ieee80211.h>
#include <linux/if_ether.h>
#include "mt7697_i.h"
#include "wifi_api.h"
#include "mt7697_i.h"
#include "wifi_api.h"
#define MT7697_WOW_MAX_FILTERS_PER_LIST 4
#define MT7697_WOW_PATTERN_SIZE 64
......@@ -33,7 +33,7 @@
#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_wireless_mode_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
......@@ -77,7 +77,7 @@ enum mt7697_wifi_cmd_types {
MT7697_CMD_SET_SECURITY_MODE_REQ,
MT7697_CMD_SET_SECURITY_MODE_RSP,
MT7697_CMD_GET_SECURITY_MODE_REQ,
MT7697_CMD_GET_SECURITY_MODE_RSP,
MT7697_CMD_GET_SECURITY_MODE_RSP,
MT7697_CMD_SCAN_IND,
MT7697_CMD_SCAN_REQ,
MT7697_CMD_SCAN_RSP,
......@@ -111,7 +111,7 @@ struct mt7697_mac_addr_req {
} __attribute__((packed, aligned(4)));
struct mt7697_mac_addr_rsp {
struct mt7697_rsp_hdr rsp;
struct mt7697_rsp_hdr rsp;
u8 addr[LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4)));
......@@ -155,7 +155,7 @@ struct mt7697_reload_settings_req {
struct mt7697_cmd_hdr cmd;
__be32 if_idx;
} __attribute__((packed, aligned(4)));
struct mt7697_scan_req {
struct mt7697_cmd_hdr cmd;
__be32 if_idx;
......@@ -274,7 +274,7 @@ int mt7697_wr_scan_req(const struct mt7697_cfg80211_info*, u32,
const struct cfg80211_scan_request*);
int mt7697_wr_set_security_mode_req(const struct mt7697_cfg80211_info*, u8, u8);
int mt7697_wr_get_security_mode_req(const struct mt7697_cfg80211_info*, u32);
int mt7697_wr_scan_stop_req(const struct mt7697_cfg80211_info*);
int mt7697_wr_scan_stop_req(const struct mt7697_cfg80211_info*);
int mt7697_wr_disconnect_req(const struct mt7697_cfg80211_info*, const u8*);
int mt7697_wr_tx_raw_packet(struct mt7697_cfg80211_info*, const u8*, u32);
int mt7697_proc_data(void*);
......
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