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