Commit 381d3295 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: reformat code on 100 columns

Until now, this driver was written in 80 columns style. However, since
all the functions are prefixed with "wfx_", this constraint is no more
respected in the last patches.

From the perspective of kernel Coding Style, it is not a problem since
it is now allowed to write code on 100 columns.

This patch just unify the code to use 100 columns.
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220113085524.1110708-21-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 07874db4
...@@ -37,8 +37,7 @@ static void device_wakeup(struct wfx_dev *wdev) ...@@ -37,8 +37,7 @@ static void device_wakeup(struct wfx_dev *wdev)
* wait_for_completion_done_timeout()). So we have to emulate * wait_for_completion_done_timeout()). So we have to emulate
* it. * it.
*/ */
if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, msecs_to_jiffies(2))) {
msecs_to_jiffies(2))) {
complete(&wdev->hif.ctrl_ready); complete(&wdev->hif.ctrl_ready);
return; return;
} else if (max_retry-- > 0) { } else if (max_retry-- > 0) {
...@@ -105,7 +104,8 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) ...@@ -105,7 +104,8 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf)
if (!(hif->id & HIF_ID_IS_INDICATION)) { if (!(hif->id & HIF_ID_IS_INDICATION)) {
(*is_cnf)++; (*is_cnf)++;
if (hif->id == HIF_CNF_ID_MULTI_TRANSMIT) if (hif->id == HIF_CNF_ID_MULTI_TRANSMIT)
release_count = ((struct wfx_hif_cnf_multi_transmit *)hif->body)->num_tx_confs; release_count =
((struct wfx_hif_cnf_multi_transmit *)hif->body)->num_tx_confs;
else else
release_count = 1; release_count = 1;
WARN(wdev->hif.tx_buffers_used < release_count, "corrupted buffer counter"); WARN(wdev->hif.tx_buffers_used < release_count, "corrupted buffer counter");
...@@ -229,8 +229,7 @@ static void ack_sdio_data(struct wfx_dev *wdev) ...@@ -229,8 +229,7 @@ static void ack_sdio_data(struct wfx_dev *wdev)
wfx_config_reg_read(wdev, &cfg_reg); wfx_config_reg_read(wdev, &cfg_reg);
if (cfg_reg & 0xFF) { if (cfg_reg & 0xFF) {
dev_warn(wdev->dev, "chip reports errors: %02x\n", dev_warn(wdev->dev, "chip reports errors: %02x\n", cfg_reg & 0xFF);
cfg_reg & 0xFF);
wfx_config_reg_write_bits(wdev, 0xFF, 0x00); wfx_config_reg_write_bits(wdev, 0xFF, 0x00);
} }
} }
...@@ -261,8 +260,7 @@ static void bh_work(struct work_struct *work) ...@@ -261,8 +260,7 @@ static void bh_work(struct work_struct *work)
device_release(wdev); device_release(wdev);
release_chip = true; release_chip = true;
} }
_trace_bh_stats(stats_ind, stats_req, stats_cnf, _trace_bh_stats(stats_ind, stats_req, stats_cnf, wdev->hif.tx_buffers_used, release_chip);
wdev->hif.tx_buffers_used, release_chip);
} }
/* An IRQ from chip did occur */ /* An IRQ from chip did occur */
......
...@@ -21,10 +21,8 @@ ...@@ -21,10 +21,8 @@
#define WFX_REG_FRAME_OUT 0x7 #define WFX_REG_FRAME_OUT 0x7
struct wfx_hwbus_ops { struct wfx_hwbus_ops {
int (*copy_from_io)(void *bus_priv, unsigned int addr, int (*copy_from_io)(void *bus_priv, unsigned int addr, void *dst, size_t count);
void *dst, size_t count); int (*copy_to_io)(void *bus_priv, unsigned int addr, const void *src, size_t count);
int (*copy_to_io)(void *bus_priv, unsigned int addr,
const void *src, size_t count);
int (*irq_subscribe)(void *bus_priv); int (*irq_subscribe)(void *bus_priv);
int (*irq_unsubscribe)(void *bus_priv); int (*irq_unsubscribe)(void *bus_priv);
void (*lock)(void *bus_priv); void (*lock)(void *bus_priv);
......
...@@ -33,8 +33,7 @@ struct wfx_sdio_priv { ...@@ -33,8 +33,7 @@ struct wfx_sdio_priv {
int of_irq; int of_irq;
}; };
static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, void *dst, size_t count)
void *dst, size_t count)
{ {
struct wfx_sdio_priv *bus = priv; struct wfx_sdio_priv *bus = priv;
unsigned int sdio_addr = reg_id << 2; unsigned int sdio_addr = reg_id << 2;
...@@ -54,8 +53,7 @@ static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, ...@@ -54,8 +53,7 @@ static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id,
return ret; return ret;
} }
static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id, static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id, const void *src, size_t count)
const void *src, size_t count)
{ {
struct wfx_sdio_priv *bus = priv; struct wfx_sdio_priv *bus = priv;
unsigned int sdio_addr = reg_id << 2; unsigned int sdio_addr = reg_id << 2;
...@@ -126,8 +124,7 @@ static int wfx_sdio_irq_subscribe(void *priv) ...@@ -126,8 +124,7 @@ static int wfx_sdio_irq_subscribe(void *priv)
flags = IRQF_TRIGGER_HIGH; flags = IRQF_TRIGGER_HIGH;
flags |= IRQF_ONESHOT; flags |= IRQF_ONESHOT;
ret = devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL, ret = devm_request_threaded_irq(&bus->func->dev, bus->of_irq, NULL,
wfx_sdio_irq_handler_ext, flags, wfx_sdio_irq_handler_ext, flags, "wfx", bus);
"wfx", bus);
if (ret) if (ret)
return ret; return ret;
sdio_claim_host(bus->func); sdio_claim_host(bus->func);
...@@ -176,8 +173,7 @@ static const struct of_device_id wfx_sdio_of_match[] = { ...@@ -176,8 +173,7 @@ static const struct of_device_id wfx_sdio_of_match[] = {
}; };
MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); MODULE_DEVICE_TABLE(of, wfx_sdio_of_match);
static int wfx_sdio_probe(struct sdio_func *func, static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
const struct sdio_device_id *id)
{ {
struct device_node *np = func->dev.of_node; struct device_node *np = func->dev.of_node;
struct wfx_sdio_priv *bus; struct wfx_sdio_priv *bus;
......
...@@ -46,8 +46,7 @@ struct wfx_spi_priv { ...@@ -46,8 +46,7 @@ struct wfx_spi_priv {
* natively. The code below to support big endian host and commonly used SPI * natively. The code below to support big endian host and commonly used SPI
* 8bits. * 8bits.
*/ */
static int wfx_spi_copy_from_io(void *priv, unsigned int addr, static int wfx_spi_copy_from_io(void *priv, unsigned int addr, void *dst, size_t count)
void *dst, size_t count)
{ {
struct wfx_spi_priv *bus = priv; struct wfx_spi_priv *bus = priv;
u16 regaddr = (addr << 12) | (count / 2) | SET_READ; u16 regaddr = (addr << 12) | (count / 2) | SET_READ;
...@@ -80,8 +79,7 @@ static int wfx_spi_copy_from_io(void *priv, unsigned int addr, ...@@ -80,8 +79,7 @@ static int wfx_spi_copy_from_io(void *priv, unsigned int addr,
return ret; return ret;
} }
static int wfx_spi_copy_to_io(void *priv, unsigned int addr, static int wfx_spi_copy_to_io(void *priv, unsigned int addr, const void *src, size_t count)
const void *src, size_t count)
{ {
struct wfx_spi_priv *bus = priv; struct wfx_spi_priv *bus = priv;
u16 regaddr = (addr << 12) | (count / 2); u16 regaddr = (addr << 12) | (count / 2);
...@@ -149,8 +147,7 @@ static int wfx_spi_irq_subscribe(void *priv) ...@@ -149,8 +147,7 @@ static int wfx_spi_irq_subscribe(void *priv)
flags = IRQF_TRIGGER_HIGH; flags = IRQF_TRIGGER_HIGH;
flags |= IRQF_ONESHOT; flags |= IRQF_ONESHOT;
return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL, return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL,
wfx_spi_irq_handler, IRQF_ONESHOT, wfx_spi_irq_handler, IRQF_ONESHOT, "wfx", bus);
"wfx", bus);
} }
static int wfx_spi_irq_unsubscribe(void *priv) static int wfx_spi_irq_unsubscribe(void *priv)
...@@ -190,14 +187,11 @@ static int wfx_spi_probe(struct spi_device *func) ...@@ -190,14 +187,11 @@ static int wfx_spi_probe(struct spi_device *func)
return ret; return ret;
/* Trace below is also displayed by spi_setup() if compiled with DEBUG */ /* Trace below is also displayed by spi_setup() if compiled with DEBUG */
dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n", dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n",
func->chip_select, func->mode, func->bits_per_word, func->chip_select, func->mode, func->bits_per_word, func->max_speed_hz);
func->max_speed_hz);
if (func->bits_per_word != 16 && func->bits_per_word != 8) if (func->bits_per_word != 16 && func->bits_per_word != 8)
dev_warn(&func->dev, "unusual bits/word value: %d\n", dev_warn(&func->dev, "unusual bits/word value: %d\n", func->bits_per_word);
func->bits_per_word);
if (func->max_speed_hz > 50000000) if (func->max_speed_hz > 50000000)
dev_warn(&func->dev, "%dHz is a very high speed\n", dev_warn(&func->dev, "%dHz is a very high speed\n", func->max_speed_hz);
func->max_speed_hz);
bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL);
if (!bus) if (!bus)
...@@ -207,13 +201,11 @@ static int wfx_spi_probe(struct spi_device *func) ...@@ -207,13 +201,11 @@ static int wfx_spi_probe(struct spi_device *func)
bus->need_swab = true; bus->need_swab = true;
spi_set_drvdata(func, bus); spi_set_drvdata(func, bus);
bus->gpio_reset = devm_gpiod_get_optional(&func->dev, "reset", bus->gpio_reset = devm_gpiod_get_optional(&func->dev, "reset", GPIOD_OUT_LOW);
GPIOD_OUT_LOW);
if (IS_ERR(bus->gpio_reset)) if (IS_ERR(bus->gpio_reset))
return PTR_ERR(bus->gpio_reset); return PTR_ERR(bus->gpio_reset);
if (!bus->gpio_reset) { if (!bus->gpio_reset) {
dev_warn(&func->dev, dev_warn(&func->dev, "gpio reset is not defined, trying to load firmware anyway\n");
"gpio reset is not defined, trying to load firmware anyway\n");
} else { } else {
gpiod_set_consumer_name(bus->gpio_reset, "wfx reset"); gpiod_set_consumer_name(bus->gpio_reset, "wfx reset");
if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED) if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED)
......
...@@ -34,8 +34,7 @@ static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt) ...@@ -34,8 +34,7 @@ static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt)
} }
} }
void wfx_rx_cb(struct wfx_vif *wvif, void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk_buff *skb)
const struct wfx_hif_ind_rx *arg, struct sk_buff *skb)
{ {
struct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb); struct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb);
struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data;
...@@ -54,8 +53,7 @@ void wfx_rx_cb(struct wfx_vif *wvif, ...@@ -54,8 +53,7 @@ void wfx_rx_cb(struct wfx_vif *wvif,
} }
hdr->band = NL80211_BAND_2GHZ; hdr->band = NL80211_BAND_2GHZ;
hdr->freq = ieee80211_channel_to_frequency(arg->channel_number, hdr->freq = ieee80211_channel_to_frequency(arg->channel_number, hdr->band);
hdr->band);
if (arg->rxed_rate >= 14) { if (arg->rxed_rate >= 14) {
hdr->encoding = RX_ENC_HT; hdr->encoding = RX_ENC_HT;
......
...@@ -12,7 +12,6 @@ struct wfx_vif; ...@@ -12,7 +12,6 @@ struct wfx_vif;
struct sk_buff; struct sk_buff;
struct wfx_hif_ind_rx; struct wfx_hif_ind_rx;
void wfx_rx_cb(struct wfx_vif *wvif, void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk_buff *skb);
const struct wfx_hif_ind_rx *arg, struct sk_buff *skb);
#endif #endif
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
#include "traces.h" #include "traces.h"
#include "hif_tx_mib.h" #include "hif_tx_mib.h"
static int wfx_get_hw_rate(struct wfx_dev *wdev, static int wfx_get_hw_rate(struct wfx_dev *wdev, const struct ieee80211_tx_rate *rate)
const struct ieee80211_tx_rate *rate)
{ {
struct ieee80211_supported_band *band; struct ieee80211_supported_band *band;
...@@ -66,14 +65,12 @@ static void wfx_tx_policy_build(struct wfx_vif *wvif, struct wfx_tx_policy *poli ...@@ -66,14 +65,12 @@ static void wfx_tx_policy_build(struct wfx_vif *wvif, struct wfx_tx_policy *poli
} }
} }
static bool wfx_tx_policy_is_equal(const struct wfx_tx_policy *a, static bool wfx_tx_policy_is_equal(const struct wfx_tx_policy *a, const struct wfx_tx_policy *b)
const struct wfx_tx_policy *b)
{ {
return !memcmp(a->rates, b->rates, sizeof(a->rates)); return !memcmp(a->rates, b->rates, sizeof(a->rates));
} }
static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache, static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *wanted)
struct wfx_tx_policy *wanted)
{ {
struct wfx_tx_policy *it; struct wfx_tx_policy *it;
...@@ -86,15 +83,13 @@ static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache, ...@@ -86,15 +83,13 @@ static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache,
return -1; return -1;
} }
static void wfx_tx_policy_use(struct wfx_tx_policy_cache *cache, static void wfx_tx_policy_use(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *entry)
struct wfx_tx_policy *entry)
{ {
++entry->usage_count; ++entry->usage_count;
list_move(&entry->link, &cache->used); list_move(&entry->link, &cache->used);
} }
static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache, static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *entry)
struct wfx_tx_policy *entry)
{ {
int ret = --entry->usage_count; int ret = --entry->usage_count;
...@@ -103,8 +98,7 @@ static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache, ...@@ -103,8 +98,7 @@ static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache,
return ret; return ret;
} }
static int wfx_tx_policy_get(struct wfx_vif *wvif, static int wfx_tx_policy_get(struct wfx_vif *wvif, struct ieee80211_tx_rate *rates, bool *renew)
struct ieee80211_tx_rate *rates, bool *renew)
{ {
int idx; int idx;
struct wfx_tx_policy_cache *cache = &wvif->tx_policy_cache; struct wfx_tx_policy_cache *cache = &wvif->tx_policy_cache;
...@@ -164,8 +158,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif) ...@@ -164,8 +158,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif)
do { do {
spin_lock_bh(&wvif->tx_policy_cache.lock); spin_lock_bh(&wvif->tx_policy_cache.lock);
for (i = 0; i < ARRAY_SIZE(wvif->tx_policy_cache.cache); ++i) { for (i = 0; i < ARRAY_SIZE(wvif->tx_policy_cache.cache); ++i) {
is_used = memzcmp(policies[i].rates, is_used = memzcmp(policies[i].rates, sizeof(policies[i].rates));
sizeof(policies[i].rates));
if (!policies[i].uploaded && is_used) if (!policies[i].uploaded && is_used)
break; break;
} }
...@@ -183,8 +176,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif) ...@@ -183,8 +176,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif)
void wfx_tx_policy_upload_work(struct work_struct *work) void wfx_tx_policy_upload_work(struct work_struct *work)
{ {
struct wfx_vif *wvif = struct wfx_vif *wvif = container_of(work, struct wfx_vif, tx_policy_upload_work);
container_of(work, struct wfx_vif, tx_policy_upload_work);
wfx_tx_policy_upload(wvif); wfx_tx_policy_upload(wvif);
wfx_tx_unlock(wvif->wdev); wfx_tx_unlock(wvif->wdev);
...@@ -221,8 +213,7 @@ static bool wfx_is_action_back(struct ieee80211_hdr *hdr) ...@@ -221,8 +213,7 @@ static bool wfx_is_action_back(struct ieee80211_hdr *hdr)
static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, struct ieee80211_sta *sta, static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, struct ieee80211_sta *sta,
struct ieee80211_hdr *hdr) struct ieee80211_hdr *hdr)
{ {
struct wfx_sta_priv *sta_priv = struct wfx_sta_priv *sta_priv = sta ? (struct wfx_sta_priv *)&sta->drv_priv : NULL;
sta ? (struct wfx_sta_priv *)&sta->drv_priv : NULL;
const u8 *da = ieee80211_get_DA(hdr); const u8 *da = ieee80211_get_DA(hdr);
if (sta_priv && sta_priv->link_id) if (sta_priv && sta_priv->link_id)
...@@ -276,8 +267,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates) ...@@ -276,8 +267,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates)
if (rates[i].idx == -1) { if (rates[i].idx == -1) {
rates[i].idx = 0; rates[i].idx = 0;
rates[i].count = 8; /* == hw->max_rate_tries */ rates[i].count = 8; /* == hw->max_rate_tries */
rates[i].flags = rates[i - 1].flags & rates[i].flags = rates[i - 1].flags & IEEE80211_TX_RC_MCS;
IEEE80211_TX_RC_MCS;
break; break;
} }
} }
...@@ -286,8 +276,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates) ...@@ -286,8 +276,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates)
rates[i].flags &= ~IEEE80211_TX_RC_SHORT_GI; rates[i].flags &= ~IEEE80211_TX_RC_SHORT_GI;
} }
static u8 wfx_tx_get_retry_policy_id(struct wfx_vif *wvif, static u8 wfx_tx_get_retry_policy_id(struct wfx_vif *wvif, struct ieee80211_tx_info *tx_info)
struct ieee80211_tx_info *tx_info)
{ {
bool tx_policy_renew = false; bool tx_policy_renew = false;
u8 ret; u8 ret;
...@@ -326,8 +315,7 @@ static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key) ...@@ -326,8 +315,7 @@ static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key)
return hw_key->icv_len + mic_space; return hw_key->icv_len + mic_space;
} }
static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct sk_buff *skb)
struct sk_buff *skb)
{ {
struct wfx_hif_msg *hif_msg; struct wfx_hif_msg *hif_msg;
struct wfx_hif_req_tx *req; struct wfx_hif_req_tx *req;
...@@ -337,8 +325,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, ...@@ -337,8 +325,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
int queue_id = skb_get_queue_mapping(skb); int queue_id = skb_get_queue_mapping(skb);
size_t offset = (size_t)skb->data & 3; size_t offset = (size_t)skb->data & 3;
int wmsg_len = sizeof(struct wfx_hif_msg) + int wmsg_len = sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_req_tx) + offset;
sizeof(struct wfx_hif_req_tx) + offset;
WARN(queue_id >= IEEE80211_NUM_ACS, "unsupported queue_id"); WARN(queue_id >= IEEE80211_NUM_ACS, "unsupported queue_id");
wfx_tx_fixup_rates(tx_info->driver_rates); wfx_tx_fixup_rates(tx_info->driver_rates);
...@@ -396,16 +383,14 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, ...@@ -396,16 +383,14 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
return 0; return 0;
} }
void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb)
struct sk_buff *skb)
{ {
struct wfx_dev *wdev = hw->priv; struct wfx_dev *wdev = hw->priv;
struct wfx_vif *wvif; struct wfx_vif *wvif;
struct ieee80211_sta *sta = control ? control->sta : NULL; struct ieee80211_sta *sta = control ? control->sta : NULL;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
size_t driver_data_room = sizeof_field(struct ieee80211_tx_info, size_t driver_data_room = sizeof_field(struct ieee80211_tx_info, rate_driver_data);
rate_driver_data);
compiletime_assert(sizeof(struct wfx_tx_priv) <= driver_data_room, compiletime_assert(sizeof(struct wfx_tx_priv) <= driver_data_room,
"struct tx_priv is too large"); "struct tx_priv is too large");
...@@ -437,8 +422,7 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) ...@@ -437,8 +422,7 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb)
{ {
struct wfx_hif_msg *hif = (struct wfx_hif_msg *)skb->data; struct wfx_hif_msg *hif = (struct wfx_hif_msg *)skb->data;
struct wfx_hif_req_tx *req = (struct wfx_hif_req_tx *)hif->body; struct wfx_hif_req_tx *req = (struct wfx_hif_req_tx *)hif->body;
unsigned int offset = sizeof(struct wfx_hif_msg) + unsigned int offset = sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_req_tx) +
sizeof(struct wfx_hif_req_tx) +
req->fc_offset; req->fc_offset;
if (!wvif) { if (!wvif) {
...@@ -450,8 +434,7 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) ...@@ -450,8 +434,7 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb)
ieee80211_tx_status_irqsafe(wvif->wdev->hw, skb); ieee80211_tx_status_irqsafe(wvif->wdev->hw, skb);
} }
static void wfx_tx_fill_rates(struct wfx_dev *wdev, static void wfx_tx_fill_rates(struct wfx_dev *wdev, struct ieee80211_tx_info *tx_info,
struct ieee80211_tx_info *tx_info,
const struct wfx_hif_cnf_tx *arg) const struct wfx_hif_cnf_tx *arg)
{ {
struct ieee80211_tx_rate *rate; struct ieee80211_tx_rate *rate;
...@@ -465,8 +448,7 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev, ...@@ -465,8 +448,7 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev,
rate = &tx_info->status.rates[i]; rate = &tx_info->status.rates[i];
if (rate->idx < 0) if (rate->idx < 0)
break; break;
if (tx_count < rate->count && if (tx_count < rate->count && arg->status == HIF_STATUS_TX_FAIL_RETRIES &&
arg->status == HIF_STATUS_TX_FAIL_RETRIES &&
arg->ack_failures) arg->ack_failures)
dev_dbg(wdev->dev, "all retries were not consumed: %d != %d\n", dev_dbg(wdev->dev, "all retries were not consumed: %d != %d\n",
rate->count, tx_count); rate->count, tx_count);
...@@ -521,8 +503,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg) ...@@ -521,8 +503,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg)
memset(tx_info->pad, 0, sizeof(tx_info->pad)); memset(tx_info->pad, 0, sizeof(tx_info->pad));
if (!arg->status) { if (!arg->status) {
tx_info->status.tx_time = tx_info->status.tx_time = le32_to_cpu(arg->media_delay) -
le32_to_cpu(arg->media_delay) -
le32_to_cpu(arg->tx_queue_delay); le32_to_cpu(arg->tx_queue_delay);
if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
tx_info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; tx_info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
...@@ -539,8 +520,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg) ...@@ -539,8 +520,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg)
wfx_skb_dtor(wvif, skb); wfx_skb_dtor(wvif, skb);
} }
static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, struct sk_buff_head *dropped)
struct sk_buff_head *dropped)
{ {
struct wfx_queue *queue; struct wfx_queue *queue;
int i; int i;
...@@ -558,16 +538,13 @@ static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, ...@@ -558,16 +538,13 @@ static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues,
if (!(BIT(i) & queues)) if (!(BIT(i) & queues))
continue; continue;
queue = &wvif->tx_queue[i]; queue = &wvif->tx_queue[i];
if (wait_event_timeout(wvif->wdev->tx_dequeue, if (wait_event_timeout(wvif->wdev->tx_dequeue, wfx_tx_queue_empty(wvif, queue),
wfx_tx_queue_empty(wvif, queue),
msecs_to_jiffies(1000)) <= 0) msecs_to_jiffies(1000)) <= 0)
dev_warn(wvif->wdev->dev, dev_warn(wvif->wdev->dev, "frames queued while flushing tx queues?");
"frames queued while flushing tx queues?");
} }
} }
void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop)
u32 queues, bool drop)
{ {
struct wfx_dev *wdev = hw->priv; struct wfx_dev *wdev = hw->priv;
struct sk_buff_head dropped; struct sk_buff_head dropped;
......
...@@ -41,11 +41,9 @@ struct wfx_tx_priv { ...@@ -41,11 +41,9 @@ struct wfx_tx_priv {
void wfx_tx_policy_init(struct wfx_vif *wvif); void wfx_tx_policy_init(struct wfx_vif *wvif);
void wfx_tx_policy_upload_work(struct work_struct *work); void wfx_tx_policy_upload_work(struct work_struct *work);
void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb);
struct sk_buff *skb);
void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg); void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct wfx_hif_cnf_tx *arg);
void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop);
u32 queues, bool drop);
static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb) static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb)
{ {
......
...@@ -31,8 +31,7 @@ static const struct trace_print_flags wfx_reg_print_map[] = { ...@@ -31,8 +31,7 @@ static const struct trace_print_flags wfx_reg_print_map[] = {
wfx_reg_list, wfx_reg_list,
}; };
static const char *get_symbol(unsigned long val, static const char *get_symbol(unsigned long val, const struct trace_print_flags *symbol_array)
const struct trace_print_flags *symbol_array)
{ {
int i; int i;
...@@ -73,8 +72,7 @@ static int wfx_counters_show(struct seq_file *seq, void *v) ...@@ -73,8 +72,7 @@ static int wfx_counters_show(struct seq_file *seq, void *v)
return -EIO; return -EIO;
} }
seq_printf(seq, "%-24s %12s %12s %12s\n", seq_printf(seq, "%-24s %12s %12s %12s\n", "", "global", "iface 0", "iface 1");
"", "global", "iface 0", "iface 1");
#define PUT_COUNTER(name) \ #define PUT_COUNTER(name) \
seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \ seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \
...@@ -159,10 +157,8 @@ static int wfx_rx_stats_show(struct seq_file *seq, void *v) ...@@ -159,10 +157,8 @@ static int wfx_rx_stats_show(struct seq_file *seq, void *v)
mutex_lock(&wdev->rx_stats_lock); mutex_lock(&wdev->rx_stats_lock);
seq_printf(seq, "Timestamp: %dus\n", st->date); seq_printf(seq, "Timestamp: %dus\n", st->date);
seq_printf(seq, "Low power clock: frequency %uHz, external %s\n", seq_printf(seq, "Low power clock: frequency %uHz, external %s\n",
le32_to_cpu(st->pwr_clk_freq), le32_to_cpu(st->pwr_clk_freq), st->is_ext_pwr_clk ? "yes" : "no");
st->is_ext_pwr_clk ? "yes" : "no"); seq_printf(seq, "Num. of frames: %d, PER (x10e4): %d, Throughput: %dKbps/s\n",
seq_printf(seq,
"Num. of frames: %d, PER (x10e4): %d, Throughput: %dKbps/s\n",
st->nb_rx_frame, st->per_total, st->throughput); st->nb_rx_frame, st->per_total, st->throughput);
seq_puts(seq, " Num. of PER RSSI SNR CFO\n"); seq_puts(seq, " Num. of PER RSSI SNR CFO\n");
seq_puts(seq, " frames (x10e4) (dBm) (dB) (kHz)\n"); seq_puts(seq, " frames (x10e4) (dBm) (dB) (kHz)\n");
...@@ -206,8 +202,7 @@ static int wfx_tx_power_loop_show(struct seq_file *seq, void *v) ...@@ -206,8 +202,7 @@ static int wfx_tx_power_loop_show(struct seq_file *seq, void *v)
} }
DEFINE_SHOW_ATTRIBUTE(wfx_tx_power_loop); DEFINE_SHOW_ATTRIBUTE(wfx_tx_power_loop);
static ssize_t wfx_send_pds_write(struct file *file, static ssize_t wfx_send_pds_write(struct file *file, const char __user *user_buf,
const char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct wfx_dev *wdev = file->private_data; struct wfx_dev *wdev = file->private_data;
...@@ -241,8 +236,7 @@ struct dbgfs_hif_msg { ...@@ -241,8 +236,7 @@ struct dbgfs_hif_msg {
int ret; int ret;
}; };
static ssize_t wfx_send_hif_msg_write(struct file *file, static ssize_t wfx_send_hif_msg_write(struct file *file, const char __user *user_buf,
const char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct dbgfs_hif_msg *context = file->private_data; struct dbgfs_hif_msg *context = file->private_data;
...@@ -268,8 +262,7 @@ static ssize_t wfx_send_hif_msg_write(struct file *file, ...@@ -268,8 +262,7 @@ static ssize_t wfx_send_hif_msg_write(struct file *file,
kfree(request); kfree(request);
return -EINVAL; return -EINVAL;
} }
context->ret = wfx_cmd_send(wdev, request, context->reply, context->ret = wfx_cmd_send(wdev, request, context->reply, sizeof(context->reply), false);
sizeof(context->reply), false);
kfree(request); kfree(request);
complete(&context->complete); complete(&context->complete);
...@@ -354,11 +347,9 @@ int wfx_debug_init(struct wfx_dev *wdev) ...@@ -354,11 +347,9 @@ int wfx_debug_init(struct wfx_dev *wdev)
d = debugfs_create_dir("wfx", wdev->hw->wiphy->debugfsdir); d = debugfs_create_dir("wfx", wdev->hw->wiphy->debugfsdir);
debugfs_create_file("counters", 0444, d, wdev, &wfx_counters_fops); debugfs_create_file("counters", 0444, d, wdev, &wfx_counters_fops);
debugfs_create_file("rx_stats", 0444, d, wdev, &wfx_rx_stats_fops); debugfs_create_file("rx_stats", 0444, d, wdev, &wfx_rx_stats_fops);
debugfs_create_file("tx_power_loop", 0444, d, wdev, debugfs_create_file("tx_power_loop", 0444, d, wdev, &wfx_tx_power_loop_fops);
&wfx_tx_power_loop_fops);
debugfs_create_file("send_pds", 0200, d, wdev, &wfx_send_pds_fops); debugfs_create_file("send_pds", 0200, d, wdev, &wfx_send_pds_fops);
debugfs_create_file("send_hif_msg", 0600, d, wdev, debugfs_create_file("send_hif_msg", 0600, d, wdev, &wfx_send_hif_msg_fops);
&wfx_send_hif_msg_fops);
debugfs_create_file("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops); debugfs_create_file("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops);
return 0; return 0;
......
...@@ -79,8 +79,7 @@ static const char * const fwio_errors[] = { ...@@ -79,8 +79,7 @@ static const char * const fwio_errors[] = {
* NOTE: it may also be possible to use 'pages' from struct firmware and avoid * NOTE: it may also be possible to use 'pages' from struct firmware and avoid
* bounce buffer * bounce buffer
*/ */
static int wfx_sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, static int wfx_sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len)
const u8 *buf, size_t len)
{ {
int ret; int ret;
const u8 *tmp; const u8 *tmp;
...@@ -112,8 +111,7 @@ static int get_firmware(struct wfx_dev *wdev, u32 keyset_chip, ...@@ -112,8 +111,7 @@ static int get_firmware(struct wfx_dev *wdev, u32 keyset_chip,
if (ret) { if (ret) {
dev_info(wdev->dev, "can't load %s, falling back to %s.sec\n", dev_info(wdev->dev, "can't load %s, falling back to %s.sec\n",
filename, wdev->pdata.file_fw); filename, wdev->pdata.file_fw);
snprintf(filename, sizeof(filename), "%s.sec", snprintf(filename, sizeof(filename), "%s.sec", wdev->pdata.file_fw);
wdev->pdata.file_fw);
ret = request_firmware(fw, filename, wdev->dev); ret = request_firmware(fw, filename, wdev->dev);
if (ret) { if (ret) {
dev_err(wdev->dev, "can't load %s\n", filename); dev_err(wdev->dev, "can't load %s\n", filename);
...@@ -166,8 +164,7 @@ static int wait_ncp_status(struct wfx_dev *wdev, u32 status) ...@@ -166,8 +164,7 @@ static int wait_ncp_status(struct wfx_dev *wdev, u32 status)
return -ETIMEDOUT; return -ETIMEDOUT;
} }
if (ktime_compare(now, start)) if (ktime_compare(now, start))
dev_dbg(wdev->dev, "chip answer after %lldus\n", dev_dbg(wdev->dev, "chip answer after %lldus\n", ktime_us_delta(now, start));
ktime_us_delta(now, start));
else else
dev_dbg(wdev->dev, "chip answer immediately\n"); dev_dbg(wdev->dev, "chip answer immediately\n");
return 0; return 0;
...@@ -200,8 +197,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) ...@@ -200,8 +197,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
dev_dbg(wdev->dev, "answer after %lldus\n", dev_dbg(wdev->dev, "answer after %lldus\n",
ktime_us_delta(now, start)); ktime_us_delta(now, start));
ret = wfx_sram_write_dma_safe(wdev, ret = wfx_sram_write_dma_safe(wdev, WFX_DNLD_FIFO + (offs % DNLD_FIFO_SIZE),
WFX_DNLD_FIFO + (offs % DNLD_FIFO_SIZE),
data + offs, DNLD_BLOCK_SIZE); data + offs, DNLD_BLOCK_SIZE);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -266,12 +262,10 @@ static int load_firmware_secure(struct wfx_dev *wdev) ...@@ -266,12 +262,10 @@ static int load_firmware_secure(struct wfx_dev *wdev)
goto error; goto error;
wfx_sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); /* Fifo init */ wfx_sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); /* Fifo init */
wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", FW_VERSION_SIZE);
FW_VERSION_SIZE);
wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset, wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset,
FW_SIGNATURE_SIZE); FW_SIGNATURE_SIZE);
wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, wfx_sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, fw->data + fw_offset + FW_SIGNATURE_SIZE,
fw->data + fw_offset + FW_SIGNATURE_SIZE,
FW_HASH_SIZE); FW_HASH_SIZE);
wfx_sram_reg_write(wdev, WFX_DCA_IMAGE_SIZE, fw->size - header_size); wfx_sram_reg_write(wdev, WFX_DCA_IMAGE_SIZE, fw->size - header_size);
wfx_sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_PENDING); wfx_sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_PENDING);
...@@ -280,8 +274,7 @@ static int load_firmware_secure(struct wfx_dev *wdev) ...@@ -280,8 +274,7 @@ static int load_firmware_secure(struct wfx_dev *wdev)
goto error; goto error;
start = ktime_get(); start = ktime_get();
ret = upload_firmware(wdev, fw->data + header_size, ret = upload_firmware(wdev, fw->data + header_size, fw->size - header_size);
fw->size - header_size);
if (ret) if (ret)
goto error; goto error;
dev_dbg(wdev->dev, "firmware load after %lldus\n", dev_dbg(wdev->dev, "firmware load after %lldus\n",
...@@ -320,12 +313,10 @@ static int init_gpr(struct wfx_dev *wdev) ...@@ -320,12 +313,10 @@ static int init_gpr(struct wfx_dev *wdev)
}; };
for (i = 0; i < ARRAY_SIZE(gpr_init); i++) { for (i = 0; i < ARRAY_SIZE(gpr_init); i++) {
ret = wfx_igpr_reg_write(wdev, gpr_init[i].index, ret = wfx_igpr_reg_write(wdev, gpr_init[i].index, gpr_init[i].value);
gpr_init[i].value);
if (ret < 0) if (ret < 0)
return ret; return ret;
dev_dbg(wdev->dev, " index %02x: %08x\n", dev_dbg(wdev->dev, " index %02x: %08x\n", gpr_init[i].index, gpr_init[i].value);
gpr_init[i].index, gpr_init[i].value);
} }
return 0; return 0;
} }
...@@ -360,8 +351,7 @@ int wfx_init_device(struct wfx_dev *wdev) ...@@ -360,8 +351,7 @@ int wfx_init_device(struct wfx_dev *wdev)
hw_revision = FIELD_GET(CFG_DEVICE_ID_MAJOR, reg); hw_revision = FIELD_GET(CFG_DEVICE_ID_MAJOR, reg);
if (hw_revision == 0) { if (hw_revision == 0) {
dev_err(wdev->dev, "bad hardware revision number: %d\n", dev_err(wdev->dev, "bad hardware revision number: %d\n", hw_revision);
hw_revision);
return -ENODEV; return -ENODEV;
} }
hw_type = FIELD_GET(CFG_DEVICE_ID_TYPE, reg); hw_type = FIELD_GET(CFG_DEVICE_ID_TYPE, reg);
...@@ -388,8 +378,7 @@ int wfx_init_device(struct wfx_dev *wdev) ...@@ -388,8 +378,7 @@ int wfx_init_device(struct wfx_dev *wdev)
return -ETIMEDOUT; return -ETIMEDOUT;
} }
} }
dev_dbg(wdev->dev, "chip wake up after %lldus\n", dev_dbg(wdev->dev, "chip wake up after %lldus\n", ktime_us_delta(now, start));
ktime_us_delta(now, start));
ret = wfx_config_reg_write_bits(wdev, CFG_CPU_RESET, 0); ret = wfx_config_reg_write_bits(wdev, CFG_CPU_RESET, 0);
if (ret < 0) if (ret < 0)
......
...@@ -32,8 +32,7 @@ static int wfx_hif_generic_confirm(struct wfx_dev *wdev, ...@@ -32,8 +32,7 @@ static int wfx_hif_generic_confirm(struct wfx_dev *wdev,
} }
if (cmd != wdev->hif_cmd.buf_send->id) { if (cmd != wdev->hif_cmd.buf_send->id) {
dev_warn(wdev->dev, dev_warn(wdev->dev, "chip response mismatch request: 0x%.2x vs 0x%.2x\n",
"chip response mismatch request: 0x%.2x vs 0x%.2x\n",
cmd, wdev->hif_cmd.buf_send->id); cmd, wdev->hif_cmd.buf_send->id);
return -EINVAL; return -EINVAL;
} }
...@@ -72,8 +71,7 @@ static int wfx_hif_multi_tx_confirm(struct wfx_dev *wdev, ...@@ -72,8 +71,7 @@ static int wfx_hif_multi_tx_confirm(struct wfx_dev *wdev,
} }
static int wfx_hif_startup_indication(struct wfx_dev *wdev, static int wfx_hif_startup_indication(struct wfx_dev *wdev,
const struct wfx_hif_msg *hif, const struct wfx_hif_msg *hif, const void *buf)
const void *buf)
{ {
const struct wfx_hif_ind_startup *body = buf; const struct wfx_hif_ind_startup *body = buf;
...@@ -87,19 +85,16 @@ static int wfx_hif_startup_indication(struct wfx_dev *wdev, ...@@ -87,19 +85,16 @@ static int wfx_hif_startup_indication(struct wfx_dev *wdev,
} }
static int wfx_hif_wakeup_indication(struct wfx_dev *wdev, static int wfx_hif_wakeup_indication(struct wfx_dev *wdev,
const struct wfx_hif_msg *hif, const struct wfx_hif_msg *hif, const void *buf)
const void *buf)
{ {
if (!wdev->pdata.gpio_wakeup || if (!wdev->pdata.gpio_wakeup || gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) {
gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) {
dev_warn(wdev->dev, "unexpected wake-up indication\n"); dev_warn(wdev->dev, "unexpected wake-up indication\n");
return -EIO; return -EIO;
} }
return 0; return 0;
} }
static int wfx_hif_receive_indication(struct wfx_dev *wdev, static int wfx_hif_receive_indication(struct wfx_dev *wdev, const struct wfx_hif_msg *hif,
const struct wfx_hif_msg *hif,
const void *buf, struct sk_buff *skb) const void *buf, struct sk_buff *skb)
{ {
struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface);
...@@ -144,16 +139,14 @@ static int wfx_hif_event_indication(struct wfx_dev *wdev, ...@@ -144,16 +139,14 @@ static int wfx_hif_event_indication(struct wfx_dev *wdev,
le32_to_cpu(body->event_data.ps_mode_error)); le32_to_cpu(body->event_data.ps_mode_error));
break; break;
default: default:
dev_warn(wdev->dev, "unhandled event indication: %.2x\n", dev_warn(wdev->dev, "unhandled event indication: %.2x\n", type);
type);
break; break;
} }
return 0; return 0;
} }
static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev, static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev,
const struct wfx_hif_msg *hif, const struct wfx_hif_msg *hif, const void *buf)
const void *buf)
{ {
struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface);
...@@ -167,8 +160,7 @@ static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev, ...@@ -167,8 +160,7 @@ static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev,
} }
static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev, static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev,
const struct wfx_hif_msg *hif, const struct wfx_hif_msg *hif, const void *buf)
const void *buf)
{ {
struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface);
const struct wfx_hif_ind_scan_cmpl *body = buf; const struct wfx_hif_ind_scan_cmpl *body = buf;
...@@ -184,8 +176,7 @@ static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev, ...@@ -184,8 +176,7 @@ static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev,
} }
static int wfx_hif_join_complete_indication(struct wfx_dev *wdev, static int wfx_hif_join_complete_indication(struct wfx_dev *wdev,
const struct wfx_hif_msg *hif, const struct wfx_hif_msg *hif, const void *buf)
const void *buf)
{ {
struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface);
...@@ -199,8 +190,7 @@ static int wfx_hif_join_complete_indication(struct wfx_dev *wdev, ...@@ -199,8 +190,7 @@ static int wfx_hif_join_complete_indication(struct wfx_dev *wdev,
} }
static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev, static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev,
const struct wfx_hif_msg *hif, const struct wfx_hif_msg *hif, const void *buf)
const void *buf)
{ {
const struct wfx_hif_ind_suspend_resume_tx *body = buf; const struct wfx_hif_ind_suspend_resume_tx *body = buf;
struct wfx_vif *wvif; struct wfx_vif *wvif;
...@@ -228,8 +218,7 @@ static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev, ...@@ -228,8 +218,7 @@ static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev,
} }
static int wfx_hif_generic_indication(struct wfx_dev *wdev, static int wfx_hif_generic_indication(struct wfx_dev *wdev,
const struct wfx_hif_msg *hif, const struct wfx_hif_msg *hif, const void *buf)
const void *buf)
{ {
const struct wfx_hif_ind_generic *body = buf; const struct wfx_hif_ind_generic *body = buf;
int type = le32_to_cpu(body->type); int type = le32_to_cpu(body->type);
...@@ -246,14 +235,12 @@ static int wfx_hif_generic_indication(struct wfx_dev *wdev, ...@@ -246,14 +235,12 @@ static int wfx_hif_generic_indication(struct wfx_dev *wdev,
if (!wfx_api_older_than(wdev, 1, 4)) if (!wfx_api_older_than(wdev, 1, 4))
dev_info(wdev->dev, "Rx test ongoing. Temperature: %d degrees C\n", dev_info(wdev->dev, "Rx test ongoing. Temperature: %d degrees C\n",
body->data.rx_stats.current_temp); body->data.rx_stats.current_temp);
memcpy(&wdev->rx_stats, &body->data.rx_stats, memcpy(&wdev->rx_stats, &body->data.rx_stats, sizeof(wdev->rx_stats));
sizeof(wdev->rx_stats));
mutex_unlock(&wdev->rx_stats_lock); mutex_unlock(&wdev->rx_stats_lock);
return 0; return 0;
case HIF_GENERIC_INDICATION_TYPE_TX_POWER_LOOP_INFO: case HIF_GENERIC_INDICATION_TYPE_TX_POWER_LOOP_INFO:
mutex_lock(&wdev->tx_power_loop_info_lock); mutex_lock(&wdev->tx_power_loop_info_lock);
memcpy(&wdev->tx_power_loop_info, memcpy(&wdev->tx_power_loop_info, &body->data.tx_power_loop_info,
&body->data.tx_power_loop_info,
sizeof(wdev->tx_power_loop_info)); sizeof(wdev->tx_power_loop_info));
mutex_unlock(&wdev->tx_power_loop_info_lock); mutex_unlock(&wdev->tx_power_loop_info_lock);
return 0; return 0;
...@@ -324,8 +311,7 @@ static int wfx_hif_error_indication(struct wfx_dev *wdev, ...@@ -324,8 +311,7 @@ static int wfx_hif_error_indication(struct wfx_dev *wdev,
dev_err(wdev->dev, "asynchronous error: %s: %d\n", dev_err(wdev->dev, "asynchronous error: %s: %d\n",
hif_errors[i].str, param); hif_errors[i].str, param);
else else
dev_err(wdev->dev, "asynchronous error: %s\n", dev_err(wdev->dev, "asynchronous error: %s\n", hif_errors[i].str);
hif_errors[i].str);
else else
dev_err(wdev->dev, "asynchronous error: unknown: %08x\n", type); dev_err(wdev->dev, "asynchronous error: unknown: %08x\n", type);
print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET,
...@@ -336,15 +322,13 @@ static int wfx_hif_error_indication(struct wfx_dev *wdev, ...@@ -336,15 +322,13 @@ static int wfx_hif_error_indication(struct wfx_dev *wdev,
}; };
static int wfx_hif_exception_indication(struct wfx_dev *wdev, static int wfx_hif_exception_indication(struct wfx_dev *wdev,
const struct wfx_hif_msg *hif, const struct wfx_hif_msg *hif, const void *buf)
const void *buf)
{ {
const struct wfx_hif_ind_exception *body = buf; const struct wfx_hif_ind_exception *body = buf;
int type = le32_to_cpu(body->type); int type = le32_to_cpu(body->type);
if (type == 4) if (type == 4)
dev_err(wdev->dev, "firmware assert %d\n", dev_err(wdev->dev, "firmware assert %d\n", le32_to_cpup((__le32 *)body->data));
le32_to_cpup((__le32 *)body->data));
else else
dev_err(wdev->dev, "firmware exception\n"); dev_err(wdev->dev, "firmware exception\n");
print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET,
...@@ -356,8 +340,7 @@ static int wfx_hif_exception_indication(struct wfx_dev *wdev, ...@@ -356,8 +340,7 @@ static int wfx_hif_exception_indication(struct wfx_dev *wdev,
static const struct { static const struct {
int msg_id; int msg_id;
int (*handler)(struct wfx_dev *wdev, int (*handler)(struct wfx_dev *wdev, const struct wfx_hif_msg *hif, const void *buf);
const struct wfx_hif_msg *hif, const void *buf);
} hif_handlers[] = { } hif_handlers[] = {
/* Confirmations */ /* Confirmations */
{ HIF_CNF_ID_TX, wfx_hif_tx_confirm }, { HIF_CNF_ID_TX, wfx_hif_tx_confirm },
...@@ -392,8 +375,7 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) ...@@ -392,8 +375,7 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb)
* buf_send * buf_send
*/ */
if (mutex_is_locked(&wdev->hif_cmd.lock) && if (mutex_is_locked(&wdev->hif_cmd.lock) &&
wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send->id == hif_id) {
wdev->hif_cmd.buf_send->id == hif_id) {
wfx_hif_generic_confirm(wdev, hif, hif->body); wfx_hif_generic_confirm(wdev, hif, hif->body);
goto free; goto free;
} }
...@@ -405,11 +387,9 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) ...@@ -405,11 +387,9 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb)
} }
} }
if (hif_id & HIF_ID_IS_INDICATION) if (hif_id & HIF_ID_IS_INDICATION)
dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n", dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n", hif_id);
hif_id);
else else
dev_err(wdev->dev, "unexpected HIF confirmation: ID %02x\n", dev_err(wdev->dev, "unexpected HIF confirmation: ID %02x\n", hif_id);
hif_id);
free: free:
dev_kfree_skb(skb); dev_kfree_skb(skb);
} }
...@@ -22,8 +22,7 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *hif_cmd) ...@@ -22,8 +22,7 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *hif_cmd)
mutex_init(&hif_cmd->lock); mutex_init(&hif_cmd->lock);
} }
static void wfx_fill_header(struct wfx_hif_msg *hif, int if_id, static void wfx_fill_header(struct wfx_hif_msg *hif, int if_id, unsigned int cmd, size_t size)
unsigned int cmd, size_t size)
{ {
if (if_id == -1) if (if_id == -1)
if_id = 2; if_id = 2;
...@@ -190,14 +189,12 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, ...@@ -190,14 +189,12 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
ret = wfx_cmd_send(wdev, hif, reply, buf_len, false); ret = wfx_cmd_send(wdev, hif, reply, buf_len, false);
if (!ret && mib_id != le16_to_cpu(reply->mib_id)) { if (!ret && mib_id != le16_to_cpu(reply->mib_id)) {
dev_warn(wdev->dev, "%s: confirmation mismatch request\n", dev_warn(wdev->dev, "%s: confirmation mismatch request\n", __func__);
__func__);
ret = -EIO; ret = -EIO;
} }
if (ret == -ENOMEM) if (ret == -ENOMEM)
dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n", dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n",
wfx_get_mib_name(mib_id), val_len, wfx_get_mib_name(mib_id), val_len, le16_to_cpu(reply->length));
le16_to_cpu(reply->length));
if (!ret) if (!ret)
memcpy(val, &reply->mib_data, le16_to_cpu(reply->length)); memcpy(val, &reply->mib_data, le16_to_cpu(reply->length));
else else
...@@ -208,8 +205,7 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, ...@@ -208,8 +205,7 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
return ret; return ret;
} }
int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t val_len)
void *val, size_t val_len)
{ {
int ret; int ret;
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
...@@ -232,8 +228,7 @@ int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, ...@@ -232,8 +228,7 @@ int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req,
{ {
int ret, i; int ret, i;
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
size_t buf_len = sizeof(struct wfx_hif_req_start_scan_alt) + size_t buf_len = sizeof(struct wfx_hif_req_start_scan_alt) + chan_num * sizeof(u8);
chan_num * sizeof(u8);
struct wfx_hif_req_start_scan_alt *body = wfx_alloc_hif(buf_len, &hif); struct wfx_hif_req_start_scan_alt *body = wfx_alloc_hif(buf_len, &hif);
WARN(chan_num > HIF_API_MAX_NB_CHANNELS, "invalid params"); WARN(chan_num > HIF_API_MAX_NB_CHANNELS, "invalid params");
...@@ -242,20 +237,16 @@ int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, ...@@ -242,20 +237,16 @@ int wfx_hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req,
if (!hif) if (!hif)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < req->n_ssids; i++) { for (i = 0; i < req->n_ssids; i++) {
memcpy(body->ssid_def[i].ssid, req->ssids[i].ssid, memcpy(body->ssid_def[i].ssid, req->ssids[i].ssid, IEEE80211_MAX_SSID_LEN);
IEEE80211_MAX_SSID_LEN); body->ssid_def[i].ssid_length = cpu_to_le32(req->ssids[i].ssid_len);
body->ssid_def[i].ssid_length =
cpu_to_le32(req->ssids[i].ssid_len);
} }
body->num_of_ssids = HIF_API_MAX_NB_SSIDS; body->num_of_ssids = HIF_API_MAX_NB_SSIDS;
body->maintain_current_bss = 1; body->maintain_current_bss = 1;
body->disallow_ps = 1; body->disallow_ps = 1;
body->tx_power_level = body->tx_power_level = cpu_to_le32(req->channels[chan_start_idx]->max_power);
cpu_to_le32(req->channels[chan_start_idx]->max_power);
body->num_of_channels = chan_num; body->num_of_channels = chan_num;
for (i = 0; i < chan_num; i++) for (i = 0; i < chan_num; i++)
body->channel_list[i] = body->channel_list[i] = req->channels[i + chan_start_idx]->hw_value;
req->channels[i + chan_start_idx]->hw_value;
if (req->no_cck) if (req->no_cck)
body->max_transmit_rate = API_RATE_INDEX_G_6MBPS; body->max_transmit_rate = API_RATE_INDEX_G_6MBPS;
else else
...@@ -309,8 +300,7 @@ int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, ...@@ -309,8 +300,7 @@ int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
body->probe_for_join = !(channel->flags & IEEE80211_CHAN_NO_IR); body->probe_for_join = !(channel->flags & IEEE80211_CHAN_NO_IR);
body->channel_number = channel->hw_value; body->channel_number = channel->hw_value;
body->beacon_interval = cpu_to_le32(conf->beacon_int); body->beacon_interval = cpu_to_le32(conf->beacon_int);
body->basic_rate_set = body->basic_rate_set = cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
memcpy(body->bssid, conf->bssid, sizeof(body->bssid)); memcpy(body->bssid, conf->bssid, sizeof(body->bssid));
if (ssid) { if (ssid) {
body->ssid_length = cpu_to_le32(ssidlen); body->ssid_length = cpu_to_le32(ssidlen);
...@@ -326,15 +316,13 @@ int wfx_hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) ...@@ -326,15 +316,13 @@ int wfx_hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count)
{ {
int ret; int ret;
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
struct wfx_hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), struct wfx_hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), &hif);
&hif);
if (!hif) if (!hif)
return -ENOMEM; return -ENOMEM;
body->aid = cpu_to_le16(aid); body->aid = cpu_to_le16(aid);
body->beacon_lost_count = beacon_lost_count; body->beacon_lost_count = beacon_lost_count;
wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, sizeof(*body));
sizeof(*body));
ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
kfree(hif); kfree(hif);
return ret; return ret;
...@@ -355,8 +343,7 @@ int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg) ...@@ -355,8 +343,7 @@ int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg)
/* Legacy firmwares expect that add_key to be sent on right /* Legacy firmwares expect that add_key to be sent on right
* interface. * interface.
*/ */
wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, sizeof(*body));
sizeof(*body));
else else
wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body)); wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body));
ret = wfx_cmd_send(wdev, hif, NULL, 0, false); ret = wfx_cmd_send(wdev, hif, NULL, 0, false);
...@@ -384,8 +371,7 @@ int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, ...@@ -384,8 +371,7 @@ int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue,
{ {
int ret; int ret;
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
struct wfx_hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), struct wfx_hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), &hif);
&hif);
if (!body) if (!body)
return -ENOMEM; return -ENOMEM;
...@@ -403,8 +389,7 @@ int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, ...@@ -403,8 +389,7 @@ int wfx_hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue,
body->queue_id = HIF_QUEUE_ID_BACKGROUND; body->queue_id = HIF_QUEUE_ID_BACKGROUND;
if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BK) if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BK)
body->queue_id = HIF_QUEUE_ID_BESTEFFORT; body->queue_id = HIF_QUEUE_ID_BESTEFFORT;
wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS, wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS, sizeof(*body));
sizeof(*body));
ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
kfree(hif); kfree(hif);
return ret; return ret;
...@@ -414,8 +399,7 @@ int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout) ...@@ -414,8 +399,7 @@ int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout)
{ {
int ret; int ret;
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
struct wfx_hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), struct wfx_hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), &hif);
&hif);
if (!body) if (!body)
return -ENOMEM; return -ENOMEM;
...@@ -449,8 +433,7 @@ int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, ...@@ -449,8 +433,7 @@ int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
body->short_preamble = conf->use_short_preamble; body->short_preamble = conf->use_short_preamble;
body->channel_number = channel->hw_value; body->channel_number = channel->hw_value;
body->beacon_interval = cpu_to_le32(conf->beacon_int); body->beacon_interval = cpu_to_le32(conf->beacon_int);
body->basic_rate_set = body->basic_rate_set = cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
body->ssid_length = conf->ssid_len; body->ssid_length = conf->ssid_len;
memcpy(body->ssid, conf->ssid, conf->ssid_len); memcpy(body->ssid, conf->ssid, conf->ssid_len);
wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START, sizeof(*body)); wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START, sizeof(*body));
...@@ -463,21 +446,18 @@ int wfx_hif_beacon_transmit(struct wfx_vif *wvif, bool enable) ...@@ -463,21 +446,18 @@ int wfx_hif_beacon_transmit(struct wfx_vif *wvif, bool enable)
{ {
int ret; int ret;
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
struct wfx_hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), struct wfx_hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), &hif);
&hif);
if (!hif) if (!hif)
return -ENOMEM; return -ENOMEM;
body->enable_beaconing = enable ? 1 : 0; body->enable_beaconing = enable ? 1 : 0;
wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, sizeof(*body));
sizeof(*body));
ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
kfree(hif); kfree(hif);
return ret; return ret;
} }
int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp)
bool mfp)
{ {
int ret; int ret;
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
...@@ -496,8 +476,7 @@ int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, ...@@ -496,8 +476,7 @@ int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id,
return ret; return ret;
} }
int wfx_hif_update_ie_beacon(struct wfx_vif *wvif, int wfx_hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len)
const u8 *ies, size_t ies_len)
{ {
int ret; int ret;
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
......
...@@ -36,17 +36,14 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *wfx_hif_cmd); ...@@ -36,17 +36,14 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *wfx_hif_cmd);
int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request, int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request,
void *reply, size_t reply_len, bool async); void *reply, size_t reply_len, bool async);
int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *buf, size_t buf_size);
void *buf, size_t buf_size); int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *buf, size_t buf_size);
int wfx_hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
void *buf, size_t buf_size);
int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, int wfx_hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
const struct ieee80211_channel *channel); const struct ieee80211_channel *channel);
int wfx_hif_reset(struct wfx_vif *wvif, bool reset_stat); int wfx_hif_reset(struct wfx_vif *wvif, bool reset_stat);
int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, int wfx_hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); struct ieee80211_channel *channel, const u8 *ssid, int ssidlen);
int wfx_hif_map_link(struct wfx_vif *wvif, int wfx_hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp);
bool unmap, u8 *mac_addr, int sta_id, bool mfp);
int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg); int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg);
int wfx_hif_remove_key(struct wfx_dev *wdev, int idx); int wfx_hif_remove_key(struct wfx_dev *wdev, int idx);
int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout); int wfx_hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout);
......
...@@ -20,14 +20,12 @@ int wfx_hif_set_output_power(struct wfx_vif *wvif, int val) ...@@ -20,14 +20,12 @@ int wfx_hif_set_output_power(struct wfx_vif *wvif, int val)
.power_level = cpu_to_le32(val * 10), .power_level = cpu_to_le32(val * 10),
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_CURRENT_TX_POWER_LEVEL,
HIF_MIB_ID_CURRENT_TX_POWER_LEVEL,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif,
unsigned int dtim_interval, unsigned int dtim_interval, unsigned int listen_interval)
unsigned int listen_interval)
{ {
struct wfx_hif_mib_beacon_wake_up_period arg = { struct wfx_hif_mib_beacon_wake_up_period arg = {
.wakeup_period_min = dtim_interval, .wakeup_period_min = dtim_interval,
...@@ -37,13 +35,11 @@ int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, ...@@ -37,13 +35,11 @@ int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif,
if (dtim_interval > 0xFF || listen_interval > 0xFFFF) if (dtim_interval > 0xFF || listen_interval > 0xFFFF)
return -EINVAL; return -EINVAL;
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BEACON_WAKEUP_PERIOD,
HIF_MIB_ID_BEACON_WAKEUP_PERIOD,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int rssi_thold, int rssi_hyst)
int rssi_thold, int rssi_hyst)
{ {
struct wfx_hif_mib_rcpi_rssi_threshold arg = { struct wfx_hif_mib_rcpi_rssi_threshold arg = {
.rolling_average_count = 8, .rolling_average_count = 8,
...@@ -60,8 +56,7 @@ int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, ...@@ -60,8 +56,7 @@ int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif,
arg.lower_threshold = (arg.lower_threshold + 110) * 2; arg.lower_threshold = (arg.lower_threshold + 110) * 2;
} }
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RCPI_RSSI_THRESHOLD,
HIF_MIB_ID_RCPI_RSSI_THRESHOLD,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
...@@ -74,9 +69,8 @@ int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id, ...@@ -74,9 +69,8 @@ int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id,
return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE, return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE,
arg, sizeof(struct wfx_hif_mib_count_table)); arg, sizeof(struct wfx_hif_mib_count_table));
} else { } else {
return wfx_hif_read_mib(wdev, vif_id, return wfx_hif_read_mib(wdev, vif_id, HIF_MIB_ID_EXTENDED_COUNTERS_TABLE,
HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, arg, sizeof(struct wfx_hif_mib_extended_count_table));
sizeof(struct wfx_hif_mib_extended_count_table));
} }
} }
...@@ -86,8 +80,7 @@ int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac) ...@@ -86,8 +80,7 @@ int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac)
if (mac) if (mac)
ether_addr_copy(arg.mac_addr, mac); ether_addr_copy(arg.mac_addr, mac);
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_MAC_ADDRESS,
HIF_MIB_ID_DOT11_MAC_ADDRESS,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
...@@ -100,8 +93,7 @@ int wfx_hif_set_rx_filter(struct wfx_vif *wvif, ...@@ -100,8 +93,7 @@ int wfx_hif_set_rx_filter(struct wfx_vif *wvif,
arg.bssid_filter = 1; arg.bssid_filter = 1;
if (!filter_prbreq) if (!filter_prbreq)
arg.fwd_probe_req = 1; arg.fwd_probe_req = 1;
return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RX_FILTER, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_RX_FILTER, &arg, sizeof(arg));
&arg, sizeof(arg));
} }
int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len,
...@@ -116,26 +108,23 @@ int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, ...@@ -116,26 +108,23 @@ int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len,
return -ENOMEM; return -ENOMEM;
arg->num_of_info_elmts = cpu_to_le32(tbl_len); arg->num_of_info_elmts = cpu_to_le32(tbl_len);
memcpy(arg->ie_table, tbl, flex_array_size(arg, ie_table, tbl_len)); memcpy(arg->ie_table, tbl, flex_array_size(arg, ie_table, tbl_len));
ret = wfx_hif_write_mib(wvif->wdev, wvif->id, ret = wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BEACON_FILTER_TABLE,
HIF_MIB_ID_BEACON_FILTER_TABLE, arg, buf_len); arg, buf_len);
kfree(arg); kfree(arg);
return ret; return ret;
} }
int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, int enable, int beacon_count)
int enable, int beacon_count)
{ {
struct wfx_hif_mib_bcn_filter_enable arg = { struct wfx_hif_mib_bcn_filter_enable arg = {
.enable = cpu_to_le32(enable), .enable = cpu_to_le32(enable),
.bcn_count = cpu_to_le32(beacon_count), .bcn_count = cpu_to_le32(beacon_count),
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BEACON_FILTER_ENABLE,
HIF_MIB_ID_BEACON_FILTER_ENABLE,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
int wfx_hif_set_operational_mode(struct wfx_dev *wdev, int wfx_hif_set_operational_mode(struct wfx_dev *wdev, enum wfx_hif_op_power_mode mode)
enum wfx_hif_op_power_mode mode)
{ {
struct wfx_hif_mib_gl_operational_power_mode arg = { struct wfx_hif_mib_gl_operational_power_mode arg = {
.power_mode = mode, .power_mode = mode,
...@@ -173,21 +162,18 @@ int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required) ...@@ -173,21 +162,18 @@ int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required)
} }
if (!required) if (!required)
arg.unpmf_allowed = 1; arg.unpmf_allowed = 1;
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_PROTECTED_MGMT_POLICY,
HIF_MIB_ID_PROTECTED_MGMT_POLICY,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, u8 tx_tid_policy, u8 rx_tid_policy)
u8 tx_tid_policy, u8 rx_tid_policy)
{ {
struct wfx_hif_mib_block_ack_policy arg = { struct wfx_hif_mib_block_ack_policy arg = {
.block_ack_tx_tid_policy = tx_tid_policy, .block_ack_tx_tid_policy = tx_tid_policy,
.block_ack_rx_tid_policy = rx_tid_policy, .block_ack_rx_tid_policy = rx_tid_policy,
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_BLOCK_ACK_POLICY,
HIF_MIB_ID_BLOCK_ACK_POLICY,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
...@@ -203,13 +189,11 @@ int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, ...@@ -203,13 +189,11 @@ int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density,
.mpdu_start_spacing = ampdu_density, .mpdu_start_spacing = ampdu_density,
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_ASSOCIATION_MODE,
HIF_MIB_ID_SET_ASSOCIATION_MODE,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates)
int policy_index, u8 *rates)
{ {
struct wfx_hif_mib_set_tx_rate_retry_policy *arg; struct wfx_hif_mib_set_tx_rate_retry_policy *arg;
size_t size = struct_size(arg, tx_rate_retry_policy, 1); size_t size = struct_size(arg, tx_rate_retry_policy, 1);
...@@ -227,8 +211,7 @@ int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, ...@@ -227,8 +211,7 @@ int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif,
arg->tx_rate_retry_policy[0].count_init = 1; arg->tx_rate_retry_policy[0].count_init = 1;
memcpy(&arg->tx_rate_retry_policy[0].rates, rates, memcpy(&arg->tx_rate_retry_policy[0].rates, rates,
sizeof(arg->tx_rate_retry_policy[0].rates)); sizeof(arg->tx_rate_retry_policy[0].rates));
ret = wfx_hif_write_mib(wvif->wdev, wvif->id, ret = wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY,
HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY,
arg, size); arg, size);
kfree(arg); kfree(arg);
return ret; return ret;
...@@ -240,8 +223,7 @@ int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period) ...@@ -240,8 +223,7 @@ int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period)
.keep_alive_period = cpu_to_le16(period), .keep_alive_period = cpu_to_le16(period),
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_KEEP_ALIVE_PERIOD,
HIF_MIB_ID_KEEP_ALIVE_PERIOD,
&arg, sizeof(arg)); &arg, sizeof(arg));
}; };
...@@ -257,8 +239,7 @@ int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr) ...@@ -257,8 +239,7 @@ int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr)
memcpy(arg.ipv4_address, addr, sizeof(arg.ipv4_address)); memcpy(arg.ipv4_address, addr, sizeof(arg.ipv4_address));
arg.arp_enable = HIF_ARP_NS_FILTERING_ENABLE; arg.arp_enable = HIF_ARP_NS_FILTERING_ENABLE;
} }
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE,
HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
...@@ -268,8 +249,7 @@ int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) ...@@ -268,8 +249,7 @@ int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable)
.enable_multi_tx_conf = enable, .enable_multi_tx_conf = enable,
}; };
return wfx_hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, return wfx_hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, &arg, sizeof(arg));
&arg, sizeof(arg));
} }
int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val)
...@@ -284,8 +264,7 @@ int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) ...@@ -284,8 +264,7 @@ int wfx_hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val)
arg.trig_be = 1; arg.trig_be = 1;
if (val & BIT(IEEE80211_AC_BK)) if (val & BIT(IEEE80211_AC_BK))
arg.trig_bckgrnd = 1; arg.trig_bckgrnd = 1;
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_UAPSD_INFORMATION,
HIF_MIB_ID_SET_UAPSD_INFORMATION,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
...@@ -295,8 +274,7 @@ int wfx_hif_erp_use_protection(struct wfx_vif *wvif, bool enable) ...@@ -295,8 +274,7 @@ int wfx_hif_erp_use_protection(struct wfx_vif *wvif, bool enable)
.use_cts_to_self = enable, .use_cts_to_self = enable,
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_NON_ERP_PROTECTION,
HIF_MIB_ID_NON_ERP_PROTECTION,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
...@@ -306,8 +284,7 @@ int wfx_hif_slot_time(struct wfx_vif *wvif, int val) ...@@ -306,8 +284,7 @@ int wfx_hif_slot_time(struct wfx_vif *wvif, int val)
.slot_time = cpu_to_le32(val), .slot_time = cpu_to_le32(val),
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, &arg, sizeof(arg));
&arg, sizeof(arg));
} }
int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val) int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val)
...@@ -316,8 +293,7 @@ int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val) ...@@ -316,8 +293,7 @@ int wfx_hif_wep_default_key_id(struct wfx_vif *wvif, int val)
.wep_default_key_id = val, .wep_default_key_id = val,
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID,
HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
...@@ -327,7 +303,6 @@ int wfx_hif_rts_threshold(struct wfx_vif *wvif, int val) ...@@ -327,7 +303,6 @@ int wfx_hif_rts_threshold(struct wfx_vif *wvif, int val)
.threshold = cpu_to_le32(val >= 0 ? val : 0xFFFF), .threshold = cpu_to_le32(val >= 0 ? val : 0xFFFF),
}; };
return wfx_hif_write_mib(wvif->wdev, wvif->id, return wfx_hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_RTS_THRESHOLD,
HIF_MIB_ID_DOT11_RTS_THRESHOLD,
&arg, sizeof(arg)); &arg, sizeof(arg));
} }
...@@ -19,30 +19,23 @@ struct wfx_hif_mib_extended_count_table; ...@@ -19,30 +19,23 @@ struct wfx_hif_mib_extended_count_table;
int wfx_hif_set_output_power(struct wfx_vif *wvif, int val); int wfx_hif_set_output_power(struct wfx_vif *wvif, int val);
int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif, int wfx_hif_set_beacon_wakeup_period(struct wfx_vif *wvif,
unsigned int dtim_interval, unsigned int dtim_interval, unsigned int listen_interval);
unsigned int listen_interval); int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int rssi_thold, int rssi_hyst);
int wfx_hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif,
int rssi_thold, int rssi_hyst);
int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id, int wfx_hif_get_counters_table(struct wfx_dev *wdev, int vif_id,
struct wfx_hif_mib_extended_count_table *arg); struct wfx_hif_mib_extended_count_table *arg);
int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); int wfx_hif_set_macaddr(struct wfx_vif *wvif, u8 *mac);
int wfx_hif_set_rx_filter(struct wfx_vif *wvif, int wfx_hif_set_rx_filter(struct wfx_vif *wvif, bool filter_bssid, bool fwd_probe_req);
bool filter_bssid, bool fwd_probe_req);
int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len, int wfx_hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len,
const struct wfx_hif_ie_table_entry *tbl); const struct wfx_hif_ie_table_entry *tbl);
int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, int wfx_hif_beacon_filter_control(struct wfx_vif *wvif, int enable, int beacon_count);
int enable, int beacon_count); int wfx_hif_set_operational_mode(struct wfx_dev *wdev, enum wfx_hif_op_power_mode mode);
int wfx_hif_set_operational_mode(struct wfx_dev *wdev,
enum wfx_hif_op_power_mode mode);
int wfx_hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, int wfx_hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb,
u8 frame_type, int init_rate); u8 frame_type, int init_rate);
int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); int wfx_hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required);
int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, int wfx_hif_set_block_ack_policy(struct wfx_vif *wvif, u8 tx_tid_policy, u8 rx_tid_policy);
u8 tx_tid_policy, u8 rx_tid_policy);
int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, int wfx_hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density,
bool greenfield, bool short_preamble); bool greenfield, bool short_preamble);
int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int wfx_hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates);
int policy_index, u8 *rates);
int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period); int wfx_hif_keep_alive_period(struct wfx_vif *wvif, int period);
int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr); int wfx_hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr);
int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable); int wfx_hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable);
......
...@@ -25,14 +25,12 @@ static int wfx_read32(struct wfx_dev *wdev, int reg, u32 *val) ...@@ -25,14 +25,12 @@ static int wfx_read32(struct wfx_dev *wdev, int reg, u32 *val)
*val = ~0; /* Never return undefined value */ *val = ~0; /* Never return undefined value */
if (!tmp) if (!tmp)
return -ENOMEM; return -ENOMEM;
ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp, ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp, sizeof(u32));
sizeof(u32));
if (ret >= 0) if (ret >= 0)
*val = le32_to_cpu(*tmp); *val = le32_to_cpu(*tmp);
kfree(tmp); kfree(tmp);
if (ret) if (ret)
dev_err(wdev->dev, "%s: bus communication error: %d\n", dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret);
__func__, ret);
return ret; return ret;
} }
...@@ -44,12 +42,10 @@ static int wfx_write32(struct wfx_dev *wdev, int reg, u32 val) ...@@ -44,12 +42,10 @@ static int wfx_write32(struct wfx_dev *wdev, int reg, u32 val)
if (!tmp) if (!tmp)
return -ENOMEM; return -ENOMEM;
*tmp = cpu_to_le32(val); *tmp = cpu_to_le32(val);
ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, tmp, ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, tmp, sizeof(u32));
sizeof(u32));
kfree(tmp); kfree(tmp);
if (ret) if (ret)
dev_err(wdev->dev, "%s: bus communication error: %d\n", dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret);
__func__, ret);
return ret; return ret;
} }
...@@ -187,8 +183,7 @@ static int wfx_indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, ...@@ -187,8 +183,7 @@ static int wfx_indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr,
return ret; return ret;
} }
static int wfx_indirect_read32_locked(struct wfx_dev *wdev, int reg, static int wfx_indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr, u32 *val)
u32 addr, u32 *val)
{ {
int ret; int ret;
__le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL);
...@@ -227,13 +222,11 @@ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len) ...@@ -227,13 +222,11 @@ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len)
WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer"); WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer");
wdev->hwbus_ops->lock(wdev->hwbus_priv); wdev->hwbus_ops->lock(wdev->hwbus_priv);
ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len);
WFX_REG_IN_OUT_QUEUE, buf, len);
_trace_io_read(WFX_REG_IN_OUT_QUEUE, buf, len); _trace_io_read(WFX_REG_IN_OUT_QUEUE, buf, len);
wdev->hwbus_ops->unlock(wdev->hwbus_priv); wdev->hwbus_ops->unlock(wdev->hwbus_priv);
if (ret) if (ret)
dev_err(wdev->dev, "%s: bus communication error: %d\n", dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret);
__func__, ret);
return ret; return ret;
} }
...@@ -243,52 +236,42 @@ int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len) ...@@ -243,52 +236,42 @@ int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len)
WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer"); WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer");
wdev->hwbus_ops->lock(wdev->hwbus_priv); wdev->hwbus_ops->lock(wdev->hwbus_priv);
ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len);
WFX_REG_IN_OUT_QUEUE, buf, len);
_trace_io_write(WFX_REG_IN_OUT_QUEUE, buf, len); _trace_io_write(WFX_REG_IN_OUT_QUEUE, buf, len);
wdev->hwbus_ops->unlock(wdev->hwbus_priv); wdev->hwbus_ops->unlock(wdev->hwbus_priv);
if (ret) if (ret)
dev_err(wdev->dev, "%s: bus communication error: %d\n", dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret);
__func__, ret);
return ret; return ret;
} }
int wfx_sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) int wfx_sram_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len)
{ {
return wfx_indirect_read_locked(wdev, WFX_REG_SRAM_DPORT, return wfx_indirect_read_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len);
addr, buf, len);
} }
int wfx_ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len) int wfx_ahb_buf_read(struct wfx_dev *wdev, u32 addr, void *buf, size_t len)
{ {
return wfx_indirect_read_locked(wdev, WFX_REG_AHB_DPORT, return wfx_indirect_read_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len);
addr, buf, len);
} }
int wfx_sram_buf_write(struct wfx_dev *wdev, u32 addr, int wfx_sram_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len)
const void *buf, size_t len)
{ {
return wfx_indirect_write_locked(wdev, WFX_REG_SRAM_DPORT, return wfx_indirect_write_locked(wdev, WFX_REG_SRAM_DPORT, addr, buf, len);
addr, buf, len);
} }
int wfx_ahb_buf_write(struct wfx_dev *wdev, u32 addr, int wfx_ahb_buf_write(struct wfx_dev *wdev, u32 addr, const void *buf, size_t len)
const void *buf, size_t len)
{ {
return wfx_indirect_write_locked(wdev, WFX_REG_AHB_DPORT, return wfx_indirect_write_locked(wdev, WFX_REG_AHB_DPORT, addr, buf, len);
addr, buf, len);
} }
int wfx_sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) int wfx_sram_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val)
{ {
return wfx_indirect_read32_locked(wdev, WFX_REG_SRAM_DPORT, return wfx_indirect_read32_locked(wdev, WFX_REG_SRAM_DPORT, addr, val);
addr, val);
} }
int wfx_ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val) int wfx_ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val)
{ {
return wfx_indirect_read32_locked(wdev, WFX_REG_AHB_DPORT, return wfx_indirect_read32_locked(wdev, WFX_REG_AHB_DPORT, addr, val);
addr, val);
} }
int wfx_sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val) int wfx_sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val)
......
...@@ -55,9 +55,8 @@ static u8 fill_tkip_pair(struct wfx_hif_tkip_pairwise_key *msg, ...@@ -55,9 +55,8 @@ static u8 fill_tkip_pair(struct wfx_hif_tkip_pairwise_key *msg,
{ {
u8 *keybuf = key->key; u8 *keybuf = key->key;
WARN(key->keylen != sizeof(msg->tkip_key_data) WARN(key->keylen != sizeof(msg->tkip_key_data) + sizeof(msg->tx_mic_key) +
+ sizeof(msg->tx_mic_key) sizeof(msg->rx_mic_key), "inconsistent data");
+ sizeof(msg->rx_mic_key), "inconsistent data");
memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data)); memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data));
keybuf += sizeof(msg->tkip_key_data); keybuf += sizeof(msg->tkip_key_data);
memcpy(msg->tx_mic_key, keybuf, sizeof(msg->tx_mic_key)); memcpy(msg->tx_mic_key, keybuf, sizeof(msg->tx_mic_key));
...@@ -67,20 +66,16 @@ static u8 fill_tkip_pair(struct wfx_hif_tkip_pairwise_key *msg, ...@@ -67,20 +66,16 @@ static u8 fill_tkip_pair(struct wfx_hif_tkip_pairwise_key *msg,
return HIF_KEY_TYPE_TKIP_PAIRWISE; return HIF_KEY_TYPE_TKIP_PAIRWISE;
} }
static u8 fill_tkip_group(struct wfx_hif_tkip_group_key *msg, static u8 fill_tkip_group(struct wfx_hif_tkip_group_key *msg, struct ieee80211_key_conf *key,
struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq, enum nl80211_iftype iftype)
struct ieee80211_key_seq *seq,
enum nl80211_iftype iftype)
{ {
u8 *keybuf = key->key; u8 *keybuf = key->key;
WARN(key->keylen != sizeof(msg->tkip_key_data) WARN(key->keylen != sizeof(msg->tkip_key_data) + 2 * sizeof(msg->rx_mic_key),
+ 2 * sizeof(msg->rx_mic_key), "inconsistent data"); "inconsistent data");
msg->key_id = key->keyidx; msg->key_id = key->keyidx;
memcpy(msg->rx_sequence_counter, memcpy(msg->rx_sequence_counter, &seq->tkip.iv16, sizeof(seq->tkip.iv16));
&seq->tkip.iv16, sizeof(seq->tkip.iv16)); memcpy(msg->rx_sequence_counter + sizeof(u16), &seq->tkip.iv32, sizeof(seq->tkip.iv32));
memcpy(msg->rx_sequence_counter + sizeof(u16),
&seq->tkip.iv32, sizeof(seq->tkip.iv32));
memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data)); memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data));
keybuf += sizeof(msg->tkip_key_data); keybuf += sizeof(msg->tkip_key_data);
if (iftype == NL80211_IFTYPE_AP) if (iftype == NL80211_IFTYPE_AP)
...@@ -102,8 +97,7 @@ static u8 fill_ccmp_pair(struct wfx_hif_aes_pairwise_key *msg, ...@@ -102,8 +97,7 @@ static u8 fill_ccmp_pair(struct wfx_hif_aes_pairwise_key *msg,
} }
static u8 fill_ccmp_group(struct wfx_hif_aes_group_key *msg, static u8 fill_ccmp_group(struct wfx_hif_aes_group_key *msg,
struct ieee80211_key_conf *key, struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq)
struct ieee80211_key_seq *seq)
{ {
WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data"); WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data");
memcpy(msg->aes_key_data, key->key, key->keylen); memcpy(msg->aes_key_data, key->key, key->keylen);
...@@ -118,8 +112,8 @@ static u8 fill_sms4_pair(struct wfx_hif_wapi_pairwise_key *msg, ...@@ -118,8 +112,8 @@ static u8 fill_sms4_pair(struct wfx_hif_wapi_pairwise_key *msg,
{ {
u8 *keybuf = key->key; u8 *keybuf = key->key;
WARN(key->keylen != sizeof(msg->wapi_key_data) WARN(key->keylen != sizeof(msg->wapi_key_data) + sizeof(msg->mic_key_data),
+ sizeof(msg->mic_key_data), "inconsistent data"); "inconsistent data");
ether_addr_copy(msg->peer_address, peer_addr); ether_addr_copy(msg->peer_address, peer_addr);
memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data)); memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data));
keybuf += sizeof(msg->wapi_key_data); keybuf += sizeof(msg->wapi_key_data);
...@@ -133,8 +127,8 @@ static u8 fill_sms4_group(struct wfx_hif_wapi_group_key *msg, ...@@ -133,8 +127,8 @@ static u8 fill_sms4_group(struct wfx_hif_wapi_group_key *msg,
{ {
u8 *keybuf = key->key; u8 *keybuf = key->key;
WARN(key->keylen != sizeof(msg->wapi_key_data) WARN(key->keylen != sizeof(msg->wapi_key_data) + sizeof(msg->mic_key_data),
+ sizeof(msg->mic_key_data), "inconsistent data"); "inconsistent data");
memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data)); memcpy(msg->wapi_key_data, keybuf, sizeof(msg->wapi_key_data));
keybuf += sizeof(msg->wapi_key_data); keybuf += sizeof(msg->wapi_key_data);
memcpy(msg->mic_key_data, keybuf, sizeof(msg->mic_key_data)); memcpy(msg->mic_key_data, keybuf, sizeof(msg->mic_key_data));
...@@ -143,8 +137,7 @@ static u8 fill_sms4_group(struct wfx_hif_wapi_group_key *msg, ...@@ -143,8 +137,7 @@ static u8 fill_sms4_group(struct wfx_hif_wapi_group_key *msg,
} }
static u8 fill_aes_cmac_group(struct wfx_hif_igtk_group_key *msg, static u8 fill_aes_cmac_group(struct wfx_hif_igtk_group_key *msg,
struct ieee80211_key_conf *key, struct ieee80211_key_conf *key, struct ieee80211_key_seq *seq)
struct ieee80211_key_seq *seq)
{ {
WARN(key->keylen != sizeof(msg->igtk_key_data), "inconsistent data"); WARN(key->keylen != sizeof(msg->igtk_key_data), "inconsistent data");
memcpy(msg->igtk_key_data, key->key, key->keylen); memcpy(msg->igtk_key_data, key->key, key->keylen);
...@@ -173,28 +166,23 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, ...@@ -173,28 +166,23 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta,
if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || if (key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
key->cipher == WLAN_CIPHER_SUITE_WEP104) { key->cipher == WLAN_CIPHER_SUITE_WEP104) {
if (pairwise) if (pairwise)
k.type = fill_wep_pair(&k.key.wep_pairwise_key, key, k.type = fill_wep_pair(&k.key.wep_pairwise_key, key, sta->addr);
sta->addr);
else else
k.type = fill_wep_group(&k.key.wep_group_key, key); k.type = fill_wep_group(&k.key.wep_group_key, key);
} else if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { } else if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
if (pairwise) if (pairwise)
k.type = fill_tkip_pair(&k.key.tkip_pairwise_key, key, k.type = fill_tkip_pair(&k.key.tkip_pairwise_key, key, sta->addr);
sta->addr);
else else
k.type = fill_tkip_group(&k.key.tkip_group_key, key, k.type = fill_tkip_group(&k.key.tkip_group_key, key, &seq,
&seq, wvif->vif->type); wvif->vif->type);
} else if (key->cipher == WLAN_CIPHER_SUITE_CCMP) { } else if (key->cipher == WLAN_CIPHER_SUITE_CCMP) {
if (pairwise) if (pairwise)
k.type = fill_ccmp_pair(&k.key.aes_pairwise_key, key, k.type = fill_ccmp_pair(&k.key.aes_pairwise_key, key, sta->addr);
sta->addr);
else else
k.type = fill_ccmp_group(&k.key.aes_group_key, key, k.type = fill_ccmp_group(&k.key.aes_group_key, key, &seq);
&seq);
} else if (key->cipher == WLAN_CIPHER_SUITE_SMS4) { } else if (key->cipher == WLAN_CIPHER_SUITE_SMS4) {
if (pairwise) if (pairwise)
k.type = fill_sms4_pair(&k.key.wapi_pairwise_key, key, k.type = fill_sms4_pair(&k.key.wapi_pairwise_key, key, sta->addr);
sta->addr);
else else
k.type = fill_sms4_group(&k.key.wapi_group_key, key); k.type = fill_sms4_group(&k.key.wapi_group_key, key);
} else if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) { } else if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) {
...@@ -210,8 +198,7 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta, ...@@ -210,8 +198,7 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta,
wfx_free_key(wdev, idx); wfx_free_key(wdev, idx);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE | key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE | IEEE80211_KEY_FLAG_RESERVE_TAILROOM;
IEEE80211_KEY_FLAG_RESERVE_TAILROOM;
key->hw_key_idx = idx; key->hw_key_idx = idx;
return 0; return 0;
} }
...@@ -223,9 +210,8 @@ static int wfx_remove_key(struct wfx_vif *wvif, struct ieee80211_key_conf *key) ...@@ -223,9 +210,8 @@ static int wfx_remove_key(struct wfx_vif *wvif, struct ieee80211_key_conf *key)
return wfx_hif_remove_key(wvif->wdev, key->hw_key_idx); return wfx_hif_remove_key(wvif->wdev, key->hw_key_idx);
} }
int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif,
struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_sta *sta, struct ieee80211_key_conf *key)
struct ieee80211_key_conf *key)
{ {
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
struct wfx_dev; struct wfx_dev;
struct wfx_vif; struct wfx_vif;
int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif,
struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_sta *sta, struct ieee80211_key_conf *key);
struct ieee80211_key_conf *key);
#endif #endif
...@@ -94,8 +94,7 @@ static const struct ieee80211_supported_band wfx_band_2ghz = { ...@@ -94,8 +94,7 @@ static const struct ieee80211_supported_band wfx_band_2ghz = {
.ht_cap = { .ht_cap = {
/* Receive caps */ /* Receive caps */
.cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 |
IEEE80211_HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_MAX_AMSDU | (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT),
(1 << IEEE80211_HT_CAP_RX_STBC_SHIFT),
.ht_supported = 1, .ht_supported = 1,
.ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K,
.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE, .ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE,
...@@ -260,10 +259,8 @@ static void wfx_free_common(void *data) ...@@ -260,10 +259,8 @@ static void wfx_free_common(void *data)
ieee80211_free_hw(wdev->hw); ieee80211_free_hw(wdev->hw);
} }
struct wfx_dev *wfx_init_common(struct device *dev, struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_data *pdata,
const struct wfx_platform_data *pdata, const struct wfx_hwbus_ops *hwbus_ops, void *hwbus_priv)
const struct wfx_hwbus_ops *hwbus_ops,
void *hwbus_priv)
{ {
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct wfx_dev *wdev; struct wfx_dev *wdev;
...@@ -288,9 +285,8 @@ struct wfx_dev *wfx_init_common(struct device *dev, ...@@ -288,9 +285,8 @@ struct wfx_dev *wfx_init_common(struct device *dev,
hw->queues = 4; hw->queues = 4;
hw->max_rates = 8; hw->max_rates = 8;
hw->max_rate_tries = 8; hw->max_rate_tries = 8;
hw->extra_tx_headroom = sizeof(struct wfx_hif_msg) hw->extra_tx_headroom = sizeof(struct wfx_hif_msg) + sizeof(struct wfx_hif_req_tx) +
+ sizeof(struct wfx_hif_req_tx) 4 /* alignment */ + 8 /* TKIP IV */;
+ 4 /* alignment */ + 8 /* TKIP IV */;
hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_AP); BIT(NL80211_IFTYPE_AP);
...@@ -308,8 +304,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, ...@@ -308,8 +304,7 @@ struct wfx_dev *wfx_init_common(struct device *dev,
hw->wiphy->iface_combinations = wfx_iface_combinations; hw->wiphy->iface_combinations = wfx_iface_combinations;
hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL); hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL);
/* FIXME: also copy wfx_rates and wfx_2ghz_chantable */ /* FIXME: also copy wfx_rates and wfx_2ghz_chantable */
memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, sizeof(wfx_band_2ghz));
sizeof(wfx_band_2ghz));
wdev = hw->priv; wdev = hw->priv;
wdev->hw = hw; wdev->hw = hw;
...@@ -317,10 +312,8 @@ struct wfx_dev *wfx_init_common(struct device *dev, ...@@ -317,10 +312,8 @@ struct wfx_dev *wfx_init_common(struct device *dev,
wdev->hwbus_ops = hwbus_ops; wdev->hwbus_ops = hwbus_ops;
wdev->hwbus_priv = hwbus_priv; wdev->hwbus_priv = hwbus_priv;
memcpy(&wdev->pdata, pdata, sizeof(*pdata)); memcpy(&wdev->pdata, pdata, sizeof(*pdata));
of_property_read_string(dev->of_node, "config-file", of_property_read_string(dev->of_node, "config-file", &wdev->pdata.file_pds);
&wdev->pdata.file_pds); wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup", GPIOD_OUT_LOW);
wdev->pdata.gpio_wakeup = devm_gpiod_get_optional(dev, "wakeup",
GPIOD_OUT_LOW);
if (IS_ERR(wdev->pdata.gpio_wakeup)) if (IS_ERR(wdev->pdata.gpio_wakeup))
return NULL; return NULL;
if (wdev->pdata.gpio_wakeup) if (wdev->pdata.gpio_wakeup)
...@@ -330,8 +323,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, ...@@ -330,8 +323,7 @@ struct wfx_dev *wfx_init_common(struct device *dev,
mutex_init(&wdev->rx_stats_lock); mutex_init(&wdev->rx_stats_lock);
mutex_init(&wdev->tx_power_loop_info_lock); mutex_init(&wdev->tx_power_loop_info_lock);
init_completion(&wdev->firmware_ready); init_completion(&wdev->firmware_ready);
INIT_DELAYED_WORK(&wdev->cooling_timeout_work, INIT_DELAYED_WORK(&wdev->cooling_timeout_work, wfx_cooling_timeout_work);
wfx_cooling_timeout_work);
skb_queue_head_init(&wdev->tx_pending); skb_queue_head_init(&wdev->tx_pending);
init_waitqueue_head(&wdev->tx_dequeue); init_waitqueue_head(&wdev->tx_dequeue);
wfx_init_hif_cmd(&wdev->hif_cmd); wfx_init_hif_cmd(&wdev->hif_cmd);
...@@ -388,27 +380,27 @@ int wfx_probe(struct wfx_dev *wdev) ...@@ -388,27 +380,27 @@ int wfx_probe(struct wfx_dev *wdev)
wdev->hw_caps.firmware_build); wdev->hw_caps.firmware_build);
if (wfx_api_older_than(wdev, 1, 0)) { if (wfx_api_older_than(wdev, 1, 0)) {
dev_err(wdev->dev, dev_err(wdev->dev, "unsupported firmware API version (expect 1 while firmware returns %d)\n",
"unsupported firmware API version (expect 1 while firmware returns %d)\n",
wdev->hw_caps.api_version_major); wdev->hw_caps.api_version_major);
err = -ENOTSUPP; err = -ENOTSUPP;
goto err0; goto err0;
} }
if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) { if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) {
dev_err(wdev->dev, dev_err(wdev->dev, "chip require secure_link, but can't negotiate it\n");
"chip require secure_link, but can't negotiate it\n");
goto err0; goto err0;
} }
if (wdev->hw_caps.region_sel_mode) { if (wdev->hw_caps.region_sel_mode) {
wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[11].flags |= IEEE80211_CHAN_NO_IR; wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[11].flags |=
wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[12].flags |= IEEE80211_CHAN_NO_IR; IEEE80211_CHAN_NO_IR;
wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[13].flags |= IEEE80211_CHAN_DISABLED; wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[12].flags |=
IEEE80211_CHAN_NO_IR;
wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[13].flags |=
IEEE80211_CHAN_DISABLED;
} }
dev_dbg(wdev->dev, "sending configuration file %s\n", dev_dbg(wdev->dev, "sending configuration file %s\n", wdev->pdata.file_pds);
wdev->pdata.file_pds);
err = wfx_send_pdata_pds(wdev); err = wfx_send_pdata_pds(wdev);
if (err < 0 && err != -ENOENT) if (err < 0 && err != -ENOENT)
goto err0; goto err0;
...@@ -424,8 +416,7 @@ int wfx_probe(struct wfx_dev *wdev) ...@@ -424,8 +416,7 @@ int wfx_probe(struct wfx_dev *wdev)
wdev->pdata.gpio_wakeup = gpio_saved; wdev->pdata.gpio_wakeup = gpio_saved;
if (wdev->pdata.gpio_wakeup) { if (wdev->pdata.gpio_wakeup) {
dev_dbg(wdev->dev, dev_dbg(wdev->dev, "enable 'quiescent' power mode with wakeup GPIO and PDS file %s\n",
"enable 'quiescent' power mode with wakeup GPIO and PDS file %s\n",
wdev->pdata.file_pds); wdev->pdata.file_pds);
gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1); gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1);
wfx_control_reg_write(wdev, 0); wfx_control_reg_write(wdev, 0);
...@@ -436,19 +427,16 @@ int wfx_probe(struct wfx_dev *wdev) ...@@ -436,19 +427,16 @@ int wfx_probe(struct wfx_dev *wdev)
for (i = 0; i < ARRAY_SIZE(wdev->addresses); i++) { for (i = 0; i < ARRAY_SIZE(wdev->addresses); i++) {
eth_zero_addr(wdev->addresses[i].addr); eth_zero_addr(wdev->addresses[i].addr);
err = of_get_mac_address(wdev->dev->of_node, err = of_get_mac_address(wdev->dev->of_node, wdev->addresses[i].addr);
wdev->addresses[i].addr);
if (!err) if (!err)
wdev->addresses[i].addr[ETH_ALEN - 1] += i; wdev->addresses[i].addr[ETH_ALEN - 1] += i;
else else
ether_addr_copy(wdev->addresses[i].addr, ether_addr_copy(wdev->addresses[i].addr, wdev->hw_caps.mac_addr[i]);
wdev->hw_caps.mac_addr[i]);
if (!is_valid_ether_addr(wdev->addresses[i].addr)) { if (!is_valid_ether_addr(wdev->addresses[i].addr)) {
dev_warn(wdev->dev, "using random MAC address\n"); dev_warn(wdev->dev, "using random MAC address\n");
eth_random_addr(wdev->addresses[i].addr); eth_random_addr(wdev->addresses[i].addr);
} }
dev_info(wdev->dev, "MAC address %d: %pM\n", i, dev_info(wdev->dev, "MAC address %d: %pM\n", i, wdev->addresses[i].addr);
wdev->addresses[i].addr);
} }
wdev->hw->wiphy->n_addresses = ARRAY_SIZE(wdev->addresses); wdev->hw->wiphy->n_addresses = ARRAY_SIZE(wdev->addresses);
wdev->hw->wiphy->addresses = wdev->addresses; wdev->hw->wiphy->addresses = wdev->addresses;
......
...@@ -29,10 +29,8 @@ struct wfx_platform_data { ...@@ -29,10 +29,8 @@ struct wfx_platform_data {
bool use_rising_clk; bool use_rising_clk;
}; };
struct wfx_dev *wfx_init_common(struct device *dev, struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_data *pdata,
const struct wfx_platform_data *pdata, const struct wfx_hwbus_ops *hwbus_ops, void *hwbus_priv);
const struct wfx_hwbus_ops *hwbus_ops,
void *hwbus_priv);
int wfx_probe(struct wfx_dev *wdev); int wfx_probe(struct wfx_dev *wdev);
void wfx_release(struct wfx_dev *wdev); void wfx_release(struct wfx_dev *wdev);
......
...@@ -38,8 +38,7 @@ void wfx_tx_flush(struct wfx_dev *wdev) ...@@ -38,8 +38,7 @@ void wfx_tx_flush(struct wfx_dev *wdev)
wfx_tx_lock(wdev); wfx_tx_lock(wdev);
mutex_lock(&wdev->hif_cmd.lock); mutex_lock(&wdev->hif_cmd.lock);
ret = wait_event_timeout(wdev->hif.tx_buffers_empty, ret = wait_event_timeout(wdev->hif.tx_buffers_empty, !wdev->hif.tx_buffers_used,
!wdev->hif.tx_buffers_used,
msecs_to_jiffies(3000)); msecs_to_jiffies(3000));
if (!ret) { if (!ret) {
dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n", dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n",
...@@ -76,8 +75,7 @@ void wfx_tx_queues_init(struct wfx_vif *wvif) ...@@ -76,8 +75,7 @@ void wfx_tx_queues_init(struct wfx_vif *wvif)
bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue) bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue)
{ {
return skb_queue_empty_lockless(&queue->normal) && return skb_queue_empty_lockless(&queue->normal) && skb_queue_empty_lockless(&queue->cab);
skb_queue_empty_lockless(&queue->cab);
} }
void wfx_tx_queues_check_empty(struct wfx_vif *wvif) void wfx_tx_queues_check_empty(struct wfx_vif *wvif)
...@@ -91,8 +89,7 @@ void wfx_tx_queues_check_empty(struct wfx_vif *wvif) ...@@ -91,8 +89,7 @@ void wfx_tx_queues_check_empty(struct wfx_vif *wvif)
} }
static void __wfx_tx_queue_drop(struct wfx_vif *wvif, static void __wfx_tx_queue_drop(struct wfx_vif *wvif,
struct sk_buff_head *skb_queue, struct sk_buff_head *skb_queue, struct sk_buff_head *dropped)
struct sk_buff_head *dropped)
{ {
struct sk_buff *skb, *tmp; struct sk_buff *skb, *tmp;
...@@ -130,8 +127,7 @@ void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) ...@@ -130,8 +127,7 @@ void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped)
struct wfx_hif_msg *hif; struct wfx_hif_msg *hif;
struct sk_buff *skb; struct sk_buff *skb;
WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", __func__);
__func__);
while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) { while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) {
hif = (struct wfx_hif_msg *)skb->data; hif = (struct wfx_hif_msg *)skb->data;
wvif = wdev_to_wvif(wdev, hif->interface); wvif = wdev_to_wvif(wdev, hif->interface);
...@@ -187,23 +183,20 @@ void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms) ...@@ -187,23 +183,20 @@ void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms)
skb_queue_walk(&wdev->tx_pending, skb) { skb_queue_walk(&wdev->tx_pending, skb) {
tx_priv = wfx_skb_tx_priv(skb); tx_priv = wfx_skb_tx_priv(skb);
req = wfx_skb_txreq(skb); req = wfx_skb_txreq(skb);
if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, limit_ms))) {
limit_ms))) {
if (first) { if (first) {
dev_info(wdev->dev, "frames stuck in firmware since %dms or more:\n", dev_info(wdev->dev, "frames stuck in firmware since %dms or more:\n",
limit_ms); limit_ms);
first = false; first = false;
} }
dev_info(wdev->dev, " id %08x sent %lldms ago\n", dev_info(wdev->dev, " id %08x sent %lldms ago\n",
req->packet_id, req->packet_id, ktime_ms_delta(now, tx_priv->xmit_timestamp));
ktime_ms_delta(now, tx_priv->xmit_timestamp));
} }
} }
spin_unlock_bh(&wdev->tx_pending.lock); spin_unlock_bh(&wdev->tx_pending.lock);
} }
unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb)
struct sk_buff *skb)
{ {
ktime_t now = ktime_get(); ktime_t now = ktime_get();
struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb); struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb);
...@@ -267,8 +260,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) ...@@ -267,8 +260,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
*/ */
hif = (struct wfx_hif_msg *)skb->data; hif = (struct wfx_hif_msg *)skb->data;
WARN_ON(hif->interface != wvif->id); WARN_ON(hif->interface != wvif->id);
WARN_ON(queues[i] != WARN_ON(queues[i] != &wvif->tx_queue[skb_get_queue_mapping(skb)]);
&wvif->tx_queue[skb_get_queue_mapping(skb)]);
atomic_inc(&queues[i]->pending_frames); atomic_inc(&queues[i]->pending_frames);
trace_queues_stats(wdev, queues[i]); trace_queues_stats(wdev, queues[i]);
return skb; return skb;
......
...@@ -38,8 +38,7 @@ void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, ...@@ -38,8 +38,7 @@ void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue,
struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id); struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id);
void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped); void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped);
unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb);
struct sk_buff *skb);
void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms); void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms);
#endif #endif
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
#include "sta.h" #include "sta.h"
#include "hif_tx_mib.h" #include "hif_tx_mib.h"
static void wfx_ieee80211_scan_completed_compat(struct ieee80211_hw *hw, static void wfx_ieee80211_scan_completed_compat(struct ieee80211_hw *hw, bool aborted)
bool aborted)
{ {
struct cfg80211_scan_info info = { struct cfg80211_scan_info info = {
.aborted = aborted, .aborted = aborted,
...@@ -22,13 +21,11 @@ static void wfx_ieee80211_scan_completed_compat(struct ieee80211_hw *hw, ...@@ -22,13 +21,11 @@ static void wfx_ieee80211_scan_completed_compat(struct ieee80211_hw *hw,
ieee80211_scan_completed(hw, &info); ieee80211_scan_completed(hw, &info);
} }
static int update_probe_tmpl(struct wfx_vif *wvif, static int update_probe_tmpl(struct wfx_vif *wvif, struct cfg80211_scan_request *req)
struct cfg80211_scan_request *req)
{ {
struct sk_buff *skb; struct sk_buff *skb;
skb = ieee80211_probereq_get(wvif->wdev->hw, wvif->vif->addr, skb = ieee80211_probereq_get(wvif->wdev->hw, wvif->vif->addr, NULL, 0, req->ie_len);
NULL, 0, req->ie_len);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
...@@ -38,8 +35,7 @@ static int update_probe_tmpl(struct wfx_vif *wvif, ...@@ -38,8 +35,7 @@ static int update_probe_tmpl(struct wfx_vif *wvif,
return 0; return 0;
} }
static int send_scan_req(struct wfx_vif *wvif, static int send_scan_req(struct wfx_vif *wvif, struct cfg80211_scan_request *req, int start_idx)
struct cfg80211_scan_request *req, int start_idx)
{ {
int i, ret; int i, ret;
struct ieee80211_channel *ch_start, *ch_cur; struct ieee80211_channel *ch_start, *ch_cur;
......
...@@ -40,8 +40,7 @@ u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates) ...@@ -40,8 +40,7 @@ u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates)
void wfx_cooling_timeout_work(struct work_struct *work) void wfx_cooling_timeout_work(struct work_struct *work)
{ {
struct wfx_dev *wdev = container_of(to_delayed_work(work), struct wfx_dev *wdev = container_of(to_delayed_work(work), struct wfx_dev,
struct wfx_dev,
cooling_timeout_work); cooling_timeout_work);
wdev->chip_frozen = true; wdev->chip_frozen = true;
...@@ -91,10 +90,8 @@ static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon) ...@@ -91,10 +90,8 @@ static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon)
if (!filter_beacon) { if (!filter_beacon) {
wfx_hif_beacon_filter_control(wvif, 0, 1); wfx_hif_beacon_filter_control(wvif, 0, 1);
} else { } else {
wfx_hif_set_beacon_filter_table(wvif, ARRAY_SIZE(filter_ies), wfx_hif_set_beacon_filter_table(wvif, ARRAY_SIZE(filter_ies), filter_ies);
filter_ies); wfx_hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE, 0);
wfx_hif_beacon_filter_control(wvif,
HIF_BEACON_FILTER_ENABLE, 0);
} }
} }
...@@ -135,8 +132,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, ...@@ -135,8 +132,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
filter_bssid = true; filter_bssid = true;
/* In AP mode, chip can reply to probe request itself */ /* In AP mode, chip can reply to probe request itself */
if (*total_flags & FIF_PROBE_REQ && if (*total_flags & FIF_PROBE_REQ && wvif->vif->type == NL80211_IFTYPE_AP) {
wvif->vif->type == NL80211_IFTYPE_AP) {
dev_dbg(wdev->dev, "do not forward probe request in AP mode\n"); dev_dbg(wdev->dev, "do not forward probe request in AP mode\n");
*total_flags &= ~FIF_PROBE_REQ; *total_flags &= ~FIF_PROBE_REQ;
} }
...@@ -208,10 +204,8 @@ int wfx_update_pm(struct wfx_vif *wvif) ...@@ -208,10 +204,8 @@ int wfx_update_pm(struct wfx_vif *wvif)
if (wvif->uapsd_mask) if (wvif->uapsd_mask)
ps_timeout = 0; ps_timeout = 0;
if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete, if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete, TU_TO_JIFFIES(512)))
TU_TO_JIFFIES(512))) dev_warn(wvif->wdev->dev, "timeout while waiting of set_pm_mode_complete\n");
dev_warn(wvif->wdev->dev,
"timeout while waiting of set_pm_mode_complete\n");
return wfx_hif_set_pm(wvif, ps, ps_timeout); return wfx_hif_set_pm(wvif, ps, ps_timeout);
} }
...@@ -227,8 +221,7 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -227,8 +221,7 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&wdev->conf_mutex); mutex_lock(&wdev->conf_mutex);
assign_bit(queue, &wvif->uapsd_mask, params->uapsd); assign_bit(queue, &wvif->uapsd_mask, params->uapsd);
wfx_hif_set_edca_queue_params(wvif, queue, params); wfx_hif_set_edca_queue_params(wvif, queue, params);
if (wvif->vif->type == NL80211_IFTYPE_STATION && if (wvif->vif->type == NL80211_IFTYPE_STATION && old_uapsd != wvif->uapsd_mask) {
old_uapsd != wvif->uapsd_mask) {
wfx_hif_set_uapsd_info(wvif, wvif->uapsd_mask); wfx_hif_set_uapsd_info(wvif, wvif->uapsd_mask);
wfx_update_pm(wvif); wfx_update_pm(wvif);
} }
...@@ -264,17 +257,15 @@ void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi) ...@@ -264,17 +257,15 @@ void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi)
static void wfx_beacon_loss_work(struct work_struct *work) static void wfx_beacon_loss_work(struct work_struct *work)
{ {
struct wfx_vif *wvif = container_of(to_delayed_work(work), struct wfx_vif *wvif = container_of(to_delayed_work(work), struct wfx_vif,
struct wfx_vif, beacon_loss_work); beacon_loss_work);
struct ieee80211_bss_conf *bss_conf = &wvif->vif->bss_conf; struct ieee80211_bss_conf *bss_conf = &wvif->vif->bss_conf;
ieee80211_beacon_loss(wvif->vif); ieee80211_beacon_loss(wvif->vif);
schedule_delayed_work(to_delayed_work(work), schedule_delayed_work(to_delayed_work(work), msecs_to_jiffies(bss_conf->beacon_int));
msecs_to_jiffies(bss_conf->beacon_int));
} }
void wfx_set_default_unicast_key(struct ieee80211_hw *hw, void wfx_set_default_unicast_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int idx)
struct ieee80211_vif *vif, int idx)
{ {
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
...@@ -298,8 +289,7 @@ void wfx_reset(struct wfx_vif *wvif) ...@@ -298,8 +289,7 @@ void wfx_reset(struct wfx_vif *wvif)
wfx_update_pm(wvif); wfx_update_pm(wvif);
} }
int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta)
struct ieee80211_sta *sta)
{ {
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv;
...@@ -321,8 +311,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -321,8 +311,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return 0; return 0;
} }
int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta)
struct ieee80211_sta *sta)
{ {
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv;
...@@ -343,15 +332,13 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) ...@@ -343,15 +332,13 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif)
skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, API_RATE_INDEX_B_1MBPS);
API_RATE_INDEX_B_1MBPS);
dev_kfree_skb(skb); dev_kfree_skb(skb);
skb = ieee80211_proberesp_get(wvif->wdev->hw, wvif->vif); skb = ieee80211_proberesp_get(wvif->wdev->hw, wvif->vif);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, API_RATE_INDEX_B_1MBPS);
API_RATE_INDEX_B_1MBPS);
dev_kfree_skb(skb); dev_kfree_skb(skb);
return 0; return 0;
} }
...@@ -360,8 +347,7 @@ static void wfx_set_mfp_ap(struct wfx_vif *wvif) ...@@ -360,8 +347,7 @@ static void wfx_set_mfp_ap(struct wfx_vif *wvif)
{ {
struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif);
const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable); const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable);
const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, skb->data + ieoffset,
skb->data + ieoffset,
skb->len - ieoffset); skb->len - ieoffset);
const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16);
const int pairwise_cipher_suite_size = 4 / sizeof(u16); const int pairwise_cipher_suite_size = 4 / sizeof(u16);
...@@ -417,8 +403,7 @@ static void wfx_join(struct wfx_vif *wvif) ...@@ -417,8 +403,7 @@ static void wfx_join(struct wfx_vif *wvif)
wfx_tx_lock_flush(wvif->wdev); wfx_tx_lock_flush(wvif->wdev);
bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, conf->bssid, NULL, 0,
conf->bssid, NULL, 0,
IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY);
if (!bss && !conf->ibss_joined) { if (!bss && !conf->ibss_joined) {
wfx_tx_unlock(wvif->wdev); wfx_tx_unlock(wvif->wdev);
...@@ -472,8 +457,7 @@ static void wfx_join_finalize(struct wfx_vif *wvif, ...@@ -472,8 +457,7 @@ static void wfx_join_finalize(struct wfx_vif *wvif,
rcu_read_unlock(); rcu_read_unlock();
wvif->join_in_progress = false; wvif->join_in_progress = false;
wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, info->use_short_preamble);
info->use_short_preamble);
wfx_hif_keep_alive_period(wvif, 0); wfx_hif_keep_alive_period(wvif, 0);
/* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use
* the same value. * the same value.
...@@ -541,10 +525,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -541,10 +525,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (changed & BSS_CHANGED_BEACON_INFO) { if (changed & BSS_CHANGED_BEACON_INFO) {
if (vif->type != NL80211_IFTYPE_STATION) if (vif->type != NL80211_IFTYPE_STATION)
dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", __func__);
__func__); wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, info->dtim_period);
wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period,
info->dtim_period);
/* We temporary forwarded beacon for join process. It is now no /* We temporary forwarded beacon for join process. It is now no
* more necessary. * more necessary.
*/ */
...@@ -563,8 +545,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -563,8 +545,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
} }
} }
if (changed & BSS_CHANGED_AP_PROBE_RESP || if (changed & BSS_CHANGED_AP_PROBE_RESP || changed & BSS_CHANGED_BEACON)
changed & BSS_CHANGED_BEACON)
wfx_upload_ap_templates(wvif); wfx_upload_ap_templates(wvif);
if (changed & BSS_CHANGED_BEACON_ENABLED) if (changed & BSS_CHANGED_BEACON_ENABLED)
...@@ -581,8 +562,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -581,8 +562,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
wfx_hif_slot_time(wvif, info->use_short_slot ? 9 : 20); wfx_hif_slot_time(wvif, info->use_short_slot ? 9 : 20);
if (changed & BSS_CHANGED_CQM) if (changed & BSS_CHANGED_CQM)
wfx_hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, wfx_hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, info->cqm_rssi_hyst);
info->cqm_rssi_hyst);
if (changed & BSS_CHANGED_TXPOWER) if (changed & BSS_CHANGED_TXPOWER)
wfx_hif_set_output_power(wvif, info->txpower); wfx_hif_set_output_power(wvif, info->txpower);
...@@ -599,8 +579,7 @@ static int wfx_update_tim(struct wfx_vif *wvif) ...@@ -599,8 +579,7 @@ static int wfx_update_tim(struct wfx_vif *wvif)
u16 tim_offset, tim_length; u16 tim_offset, tim_length;
u8 *tim_ptr; u8 *tim_ptr;
skb = ieee80211_beacon_get_tim(wvif->wdev->hw, wvif->vif, skb = ieee80211_beacon_get_tim(wvif->wdev->hw, wvif->vif, &tim_offset, &tim_length);
&tim_offset, &tim_length);
if (!skb) if (!skb)
return -ENOENT; return -ENOENT;
tim_ptr = skb->data + tim_offset; tim_ptr = skb->data + tim_offset;
...@@ -665,8 +644,7 @@ void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd) ...@@ -665,8 +644,7 @@ void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd)
wfx_bh_request_tx(wvif->wdev); wfx_bh_request_tx(wvif->wdev);
} }
int wfx_ampdu_action(struct ieee80211_hw *hw, int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_vif *vif,
struct ieee80211_ampdu_params *params) struct ieee80211_ampdu_params *params)
{ {
/* Aggregation is implemented fully in firmware */ /* Aggregation is implemented fully in firmware */
...@@ -681,20 +659,16 @@ int wfx_ampdu_action(struct ieee80211_hw *hw, ...@@ -681,20 +659,16 @@ int wfx_ampdu_action(struct ieee80211_hw *hw,
} }
} }
int wfx_add_chanctx(struct ieee80211_hw *hw, int wfx_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
struct ieee80211_chanctx_conf *conf)
{ {
return 0; return 0;
} }
void wfx_remove_chanctx(struct ieee80211_hw *hw, void wfx_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf)
struct ieee80211_chanctx_conf *conf)
{ {
} }
void wfx_change_chanctx(struct ieee80211_hw *hw, void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf, u32 changed)
struct ieee80211_chanctx_conf *conf,
u32 changed)
{ {
} }
...@@ -710,8 +684,7 @@ int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -710,8 +684,7 @@ int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return 0; return 0;
} }
void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *conf) struct ieee80211_chanctx_conf *conf)
{ {
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
......
...@@ -23,8 +23,7 @@ int wfx_start(struct ieee80211_hw *hw); ...@@ -23,8 +23,7 @@ int wfx_start(struct ieee80211_hw *hw);
void wfx_stop(struct ieee80211_hw *hw); void wfx_stop(struct ieee80211_hw *hw);
int wfx_config(struct ieee80211_hw *hw, u32 changed); int wfx_config(struct ieee80211_hw *hw, u32 changed);
int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value); int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
void wfx_set_default_unicast_key(struct ieee80211_hw *hw, void wfx_set_default_unicast_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int idx);
struct ieee80211_vif *vif, int idx);
void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
unsigned int *total_flags, u64 unused); unsigned int *total_flags, u64 unused);
...@@ -38,25 +37,20 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -38,25 +37,20 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u16 queue, const struct ieee80211_tx_queue_params *params); u16 queue, const struct ieee80211_tx_queue_params *params);
void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *info, u32 changed); struct ieee80211_bss_conf *info, u32 changed);
int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta);
struct ieee80211_sta *sta); int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta);
int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta);
void wfx_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void wfx_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
enum sta_notify_cmd cmd, struct ieee80211_sta *sta); enum sta_notify_cmd cmd, struct ieee80211_sta *sta);
int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set); int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set);
int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_ampdu_params *params); struct ieee80211_ampdu_params *params);
int wfx_add_chanctx(struct ieee80211_hw *hw, int wfx_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf);
struct ieee80211_chanctx_conf *conf); void wfx_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf);
void wfx_remove_chanctx(struct ieee80211_hw *hw, void wfx_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *conf,
struct ieee80211_chanctx_conf *conf); u32 changed);
void wfx_change_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *conf, u32 changed);
int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *conf); struct ieee80211_chanctx_conf *conf);
void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *conf); struct ieee80211_chanctx_conf *conf);
/* Hardware API Callbacks */ /* Hardware API Callbacks */
......
...@@ -190,8 +190,7 @@ DECLARE_EVENT_CLASS(hif_data, ...@@ -190,8 +190,7 @@ DECLARE_EVENT_CLASS(hif_data,
__entry->mib = -1; __entry->mib = -1;
header_len = 0; header_len = 0;
} }
__entry->buf_len = min_t(int, __entry->msg_len, __entry->buf_len = min_t(int, __entry->msg_len, sizeof(__entry->buf))
sizeof(__entry->buf))
- sizeof(struct wfx_hif_msg) - header_len; - sizeof(struct wfx_hif_msg) - header_len;
memcpy(__entry->buf, hif->body + header_len, __entry->buf_len); memcpy(__entry->buf, hif->body + header_len, __entry->buf_len);
), ),
...@@ -250,8 +249,7 @@ DECLARE_EVENT_CLASS(io_data, ...@@ -250,8 +249,7 @@ DECLARE_EVENT_CLASS(io_data,
__entry->reg = reg; __entry->reg = reg;
__entry->addr = addr; __entry->addr = addr;
__entry->msg_len = len; __entry->msg_len = len;
__entry->buf_len = min_t(int, sizeof(__entry->buf), __entry->buf_len = min_t(int, sizeof(__entry->buf), __entry->msg_len);
__entry->msg_len);
memcpy(__entry->buf, io_buf, __entry->buf_len); memcpy(__entry->buf, io_buf, __entry->buf_len);
if (addr >= 0) if (addr >= 0)
snprintf(__entry->addr_str, 10, "/%08x", addr); snprintf(__entry->addr_str, 10, "/%08x", addr);
...@@ -379,8 +377,7 @@ TRACE_EVENT(tx_stats, ...@@ -379,8 +377,7 @@ TRACE_EVENT(tx_stats,
), ),
TP_fast_assign( TP_fast_assign(
/* Keep sync with wfx_rates definition in main.c */ /* Keep sync with wfx_rates definition in main.c */
static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9, static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13 };
10, 11, 12, 13 };
const struct ieee80211_tx_info *tx_info = const struct ieee80211_tx_info *tx_info =
(const struct ieee80211_tx_info *)skb->cb; (const struct ieee80211_tx_info *)skb->cb;
const struct ieee80211_tx_rate *rates = tx_info->driver_rates; const struct ieee80211_tx_rate *rates = tx_info->driver_rates;
...@@ -420,9 +417,8 @@ TRACE_EVENT(tx_stats, ...@@ -420,9 +417,8 @@ TRACE_EVENT(tx_stats,
TP_printk("packet ID: %08x, rate policy: %s %d|%d %d|%d %d|%d %d|%d -> %d attempt, Delays media/queue/total: %4dus/%4dus/%4dus", TP_printk("packet ID: %08x, rate policy: %s %d|%d %d|%d %d|%d %d|%d -> %d attempt, Delays media/queue/total: %4dus/%4dus/%4dus",
__entry->pkt_id, __entry->pkt_id,
__print_flags(__entry->flags, NULL, __print_flags(__entry->flags, NULL,
{ 0x01, "M" }, { 0x02, "S" }, { 0x04, "G" }, { 0x01, "M" }, { 0x02, "S" }, { 0x04, "G" }, { 0x08, "R" },
{ 0x08, "R" }, { 0x10, "D" }, { 0x20, "F" }, { 0x10, "D" }, { 0x20, "F" }, { 0x40, "Q" }),
{ 0x40, "Q" }),
__entry->rate[0], __entry->rate[0],
__entry->tx_count[0], __entry->tx_count[0],
__entry->rate[1], __entry->rate[1],
......
...@@ -104,8 +104,7 @@ static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id) ...@@ -104,8 +104,7 @@ static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id)
return (struct wfx_vif *)wdev->vif[vif_id]->drv_priv; return (struct wfx_vif *)wdev->vif[vif_id]->drv_priv;
} }
static inline struct wfx_vif *wvif_iterate(struct wfx_dev *wdev, static inline struct wfx_vif *wvif_iterate(struct wfx_dev *wdev, struct wfx_vif *cur)
struct wfx_vif *cur)
{ {
int i; int i;
int mark = 0; int mark = 0;
......
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