staging: wfx: avoid c99 comments
The wfx driver is a network driver. C99 comments are prohibited in this part of the kernel. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20210913130203.1903622-28-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9885474d45
commit
63aac5db1a
@ -32,18 +32,20 @@ static void device_wakeup(struct wfx_dev *wdev)
|
||||
}
|
||||
for (;;) {
|
||||
gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1);
|
||||
// completion.h does not provide any function to wait
|
||||
// completion without consume it (a kind of
|
||||
// wait_for_completion_done_timeout()). So we have to emulate
|
||||
// it.
|
||||
/* completion.h does not provide any function to wait
|
||||
* completion without consume it (a kind of
|
||||
* wait_for_completion_done_timeout()). So we have to emulate
|
||||
* it.
|
||||
*/
|
||||
if (wait_for_completion_timeout(&wdev->hif.ctrl_ready,
|
||||
msecs_to_jiffies(2))) {
|
||||
complete(&wdev->hif.ctrl_ready);
|
||||
return;
|
||||
} else if (max_retry-- > 0) {
|
||||
// Older firmwares have a race in sleep/wake-up process.
|
||||
// Redo the process is sufficient to unfreeze the
|
||||
// chip.
|
||||
/* Older firmwares have a race in sleep/wake-up process.
|
||||
* Redo the process is sufficient to unfreeze the
|
||||
* chip.
|
||||
*/
|
||||
dev_err(wdev->dev, "timeout while wake up chip\n");
|
||||
gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0);
|
||||
usleep_range(2000, 2500);
|
||||
@ -74,7 +76,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf)
|
||||
WARN(read_len > round_down(0xFFF, 2) * sizeof(u16),
|
||||
"%s: request exceed the chip capability", __func__);
|
||||
|
||||
// Add 2 to take into account piggyback size
|
||||
/* Add 2 to take into account piggyback size */
|
||||
alloc_len = wdev->hwbus_ops->align_size(wdev->hwbus_priv, read_len + 2);
|
||||
skb = dev_alloc_skb(alloc_len);
|
||||
if (!skb)
|
||||
@ -119,7 +121,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf)
|
||||
}
|
||||
|
||||
skb_put(skb, le16_to_cpu(hif->len));
|
||||
// wfx_handle_rx takes care on SKB livetime
|
||||
/* wfx_handle_rx takes care on SKB livetime */
|
||||
wfx_handle_rx(wdev, skb);
|
||||
if (!wdev->hif.tx_buffers_used)
|
||||
wake_up(&wdev->hif.tx_buffers_empty);
|
||||
@ -148,7 +150,7 @@ static int bh_work_rx(struct wfx_dev *wdev, int max_msg, int *num_cnf)
|
||||
ctrl_reg = 0;
|
||||
if (!(ctrl_reg & CTRL_NEXT_LEN_MASK))
|
||||
return i;
|
||||
// ctrl_reg units are 16bits words
|
||||
/* ctrl_reg units are 16bits words */
|
||||
len = (ctrl_reg & CTRL_NEXT_LEN_MASK) * 2;
|
||||
piggyback = rx_helper(wdev, len, num_cnf);
|
||||
if (piggyback < 0)
|
||||
|
@ -67,7 +67,7 @@ static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id,
|
||||
/* Use queue mode buffers */
|
||||
if (reg_id == WFX_REG_IN_OUT_QUEUE)
|
||||
sdio_addr |= bus->buf_id_tx << 7;
|
||||
// FIXME: discards 'const' qualifier for src
|
||||
/* FIXME: discards 'const' qualifier for src */
|
||||
ret = sdio_memcpy_toio(bus->func, sdio_addr, (void *)src, count);
|
||||
if (!ret && reg_id == WFX_REG_IN_OUT_QUEUE)
|
||||
bus->buf_id_tx = (bus->buf_id_tx + 1) % 32;
|
||||
@ -198,7 +198,7 @@ static int wfx_sdio_probe(struct sdio_func *func,
|
||||
} else {
|
||||
dev_warn(&func->dev,
|
||||
"device is not declared in DT, features will be limited\n");
|
||||
// FIXME: ignore VID/PID and only rely on device tree
|
||||
/* FIXME: ignore VID/PID and only rely on device tree */
|
||||
// return -ENODEV;
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ static int wfx_sdio_probe(struct sdio_func *func,
|
||||
|
||||
sdio_claim_host(func);
|
||||
ret = sdio_enable_func(func);
|
||||
// Block of 64 bytes is more efficient than 512B for frame sizes < 4k
|
||||
/* Block of 64 bytes is more efficient than 512B for frame sizes < 4k */
|
||||
sdio_set_block_size(func, 64);
|
||||
sdio_release_host(func);
|
||||
if (ret)
|
||||
@ -251,7 +251,7 @@ static void wfx_sdio_remove(struct sdio_func *func)
|
||||
#define SDIO_DEVICE_ID_SILABS_WF200 0x1000
|
||||
static const struct sdio_device_id wfx_sdio_ids[] = {
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) },
|
||||
// FIXME: ignore VID/PID and only rely on device tree
|
||||
/* FIXME: ignore VID/PID and only rely on device tree */
|
||||
// { SDIO_DEVICE(SDIO_ANY_ID, SDIO_ANY_ID) },
|
||||
{ },
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ static int wfx_spi_copy_to_io(void *priv, unsigned int addr,
|
||||
{
|
||||
struct wfx_spi_priv *bus = priv;
|
||||
u16 regaddr = (addr << 12) | (count / 2);
|
||||
// FIXME: use a bounce buffer
|
||||
/* FIXME: use a bounce buffer */
|
||||
u16 *src16 = (void *)src;
|
||||
int ret, i;
|
||||
struct spi_message m;
|
||||
@ -104,8 +104,9 @@ static int wfx_spi_copy_to_io(void *priv, unsigned int addr,
|
||||
|
||||
cpu_to_le16s(®addr);
|
||||
|
||||
// Register address and CONFIG content always use 16bit big endian
|
||||
// ("BADC" order)
|
||||
/* Register address and CONFIG content always use 16bit big endian
|
||||
* ("BADC" order)
|
||||
*/
|
||||
if (bus->need_swab)
|
||||
swab16s(®addr);
|
||||
if (bus->need_swab && addr == WFX_REG_CONFIG)
|
||||
@ -163,7 +164,8 @@ static int wfx_spi_irq_unsubscribe(void *priv)
|
||||
|
||||
static size_t wfx_spi_align_size(void *priv, size_t size)
|
||||
{
|
||||
// Most of SPI controllers avoid DMA if buffer size is not 32bit aligned
|
||||
/* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned
|
||||
*/
|
||||
return ALIGN(size, 4);
|
||||
}
|
||||
|
||||
@ -187,7 +189,7 @@ static int wfx_spi_probe(struct spi_device *func)
|
||||
ret = spi_setup(func);
|
||||
if (ret)
|
||||
return ret;
|
||||
// Trace below is also displayed by spi_setup() if compiled with DEBUG
|
||||
/* Trace below is also displayed by spi_setup() if compiled with DEBUG */
|
||||
dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n",
|
||||
func->chip_select, func->mode, func->bits_per_word,
|
||||
func->max_speed_hz);
|
||||
|
@ -76,8 +76,9 @@ void wfx_rx_cb(struct wfx_vif *wvif,
|
||||
if (arg->encryp)
|
||||
hdr->flag |= RX_FLAG_DECRYPTED;
|
||||
|
||||
// Block ack negotiation is offloaded by the firmware. However,
|
||||
// re-ordering must be done by the mac80211.
|
||||
/* Block ack negotiation is offloaded by the firmware. However,
|
||||
* re-ordering must be done by the mac80211.
|
||||
*/
|
||||
if (ieee80211_is_action(frame->frame_control) &&
|
||||
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
|
||||
skb->len > IEEE80211_MIN_ACTION_SIZE) {
|
||||
|
@ -31,8 +31,9 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev,
|
||||
}
|
||||
return rate->idx + 14;
|
||||
}
|
||||
// The device only support 2GHz, else band information should be
|
||||
// retrieved from ieee80211_tx_info
|
||||
/* The device only support 2GHz, else band information should be
|
||||
* retrieved from ieee80211_tx_info
|
||||
*/
|
||||
band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
|
||||
if (rate->idx >= band->n_bitrates) {
|
||||
WARN(1, "wrong rate->idx value: %d", rate->idx);
|
||||
@ -57,7 +58,7 @@ static void wfx_tx_policy_build(struct wfx_vif *wvif, struct tx_policy *policy,
|
||||
break;
|
||||
WARN_ON(rates[i].count > 15);
|
||||
rateid = wfx_get_hw_rate(wdev, &rates[i]);
|
||||
// Pack two values in each byte of policy->rates
|
||||
/* Pack two values in each byte of policy->rates */
|
||||
count = rates[i].count;
|
||||
if (rateid % 2)
|
||||
count <<= 4;
|
||||
@ -238,7 +239,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates)
|
||||
int i;
|
||||
bool finished;
|
||||
|
||||
// Firmware is not able to mix rates with different flags
|
||||
/* Firmware is not able to mix rates with different flags */
|
||||
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
|
||||
if (rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
|
||||
rates[i].flags |= IEEE80211_TX_RC_SHORT_GI;
|
||||
@ -248,7 +249,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates)
|
||||
rates[i].flags &= ~IEEE80211_TX_RC_USE_RTS_CTS;
|
||||
}
|
||||
|
||||
// Sort rates and remove duplicates
|
||||
/* Sort rates and remove duplicates */
|
||||
do {
|
||||
finished = true;
|
||||
for (i = 0; i < IEEE80211_TX_MAX_RATES - 1; i++) {
|
||||
@ -268,19 +269,19 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates)
|
||||
}
|
||||
}
|
||||
} while (!finished);
|
||||
// Ensure that MCS0 or 1Mbps is present at the end of the retry list
|
||||
/* Ensure that MCS0 or 1Mbps is present at the end of the retry list */
|
||||
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
|
||||
if (rates[i].idx == 0)
|
||||
break;
|
||||
if (rates[i].idx == -1) {
|
||||
rates[i].idx = 0;
|
||||
rates[i].count = 8; // == hw->max_rate_tries
|
||||
rates[i].count = 8; /* == hw->max_rate_tries */
|
||||
rates[i].flags = rates[i - 1].flags &
|
||||
IEEE80211_TX_RC_MCS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// All retries use long GI
|
||||
/* All retries use long GI */
|
||||
for (i = 1; i < IEEE80211_TX_MAX_RATES; i++)
|
||||
rates[i].flags &= ~IEEE80211_TX_RC_SHORT_GI;
|
||||
}
|
||||
@ -342,13 +343,13 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
|
||||
WARN(queue_id >= IEEE80211_NUM_ACS, "unsupported queue_id");
|
||||
wfx_tx_fixup_rates(tx_info->driver_rates);
|
||||
|
||||
// From now tx_info->control is unusable
|
||||
/* From now tx_info->control is unusable */
|
||||
memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv));
|
||||
// Fill tx_priv
|
||||
/* Fill tx_priv */
|
||||
tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data;
|
||||
tx_priv->icv_size = wfx_tx_get_icv_len(hw_key);
|
||||
|
||||
// Fill hif_msg
|
||||
/* Fill hif_msg */
|
||||
WARN(skb_headroom(skb) < wmsg_len, "not enough space in skb");
|
||||
WARN(offset & 1, "attempt to transmit an unaligned frame");
|
||||
skb_put(skb, tx_priv->icv_size);
|
||||
@ -366,17 +367,18 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
// Fill tx request
|
||||
/* Fill tx request */
|
||||
req = (struct hif_req_tx *)hif_msg->body;
|
||||
// packet_id just need to be unique on device. 32bits are more than
|
||||
// necessary for that task, so we tae advantage of it to add some extra
|
||||
// data for debug.
|
||||
/* packet_id just need to be unique on device. 32bits are more than
|
||||
* necessary for that task, so we tae advantage of it to add some extra
|
||||
* data for debug.
|
||||
*/
|
||||
req->packet_id = atomic_add_return(1, &wvif->wdev->packet_id) & 0xFFFF;
|
||||
req->packet_id |= IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)) << 16;
|
||||
req->packet_id |= queue_id << 28;
|
||||
|
||||
req->fc_offset = offset;
|
||||
// Queue index are inverted between firmware and Linux
|
||||
/* Queue index are inverted between firmware and Linux */
|
||||
req->queue_id = 3 - queue_id;
|
||||
req->peer_sta_id = wfx_tx_get_link_id(wvif, sta, hdr);
|
||||
req->retry_policy_index = wfx_tx_get_retry_policy_id(wvif, tx_info);
|
||||
@ -386,7 +388,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
|
||||
if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM)
|
||||
req->after_dtim = 1;
|
||||
|
||||
// Auxiliary operations
|
||||
/* Auxiliary operations */
|
||||
wfx_tx_queues_put(wvif, skb);
|
||||
if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM)
|
||||
schedule_work(&wvif->update_tim_work);
|
||||
@ -408,15 +410,16 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
|
||||
compiletime_assert(sizeof(struct wfx_tx_priv) <= driver_data_room,
|
||||
"struct tx_priv is too large");
|
||||
WARN(skb->next || skb->prev, "skb is already member of a list");
|
||||
// control.vif can be NULL for injected frames
|
||||
/* control.vif can be NULL for injected frames */
|
||||
if (tx_info->control.vif)
|
||||
wvif = (struct wfx_vif *)tx_info->control.vif->drv_priv;
|
||||
else
|
||||
wvif = wvif_iterate(wdev, NULL);
|
||||
if (WARN_ON(!wvif))
|
||||
goto drop;
|
||||
// Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any
|
||||
// BlockAck session management frame. The check below exist just in case.
|
||||
/* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any
|
||||
* BlockAck session management frame. The check below exist just in case.
|
||||
*/
|
||||
if (ieee80211_is_action_back(hdr)) {
|
||||
dev_info(wdev->dev, "drop BA action\n");
|
||||
goto drop;
|
||||
@ -457,7 +460,7 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev,
|
||||
|
||||
tx_count = arg->ack_failures;
|
||||
if (!arg->status || arg->ack_failures)
|
||||
tx_count += 1; // Also report success
|
||||
tx_count += 1; /* Also report success */
|
||||
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
|
||||
rate = &tx_info->status.rates[i];
|
||||
if (rate->idx < 0)
|
||||
@ -505,14 +508,15 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg)
|
||||
if (!wvif)
|
||||
return;
|
||||
|
||||
// Note that wfx_pending_get_pkt_us_delay() get data from tx_info
|
||||
/* Note that wfx_pending_get_pkt_us_delay() get data from tx_info */
|
||||
_trace_tx_stats(arg, skb, wfx_pending_get_pkt_us_delay(wdev, skb));
|
||||
wfx_tx_fill_rates(wdev, tx_info, arg);
|
||||
skb_trim(skb, skb->len - tx_priv->icv_size);
|
||||
|
||||
// From now, you can touch to tx_info->status, but do not touch to
|
||||
// tx_priv anymore
|
||||
// FIXME: use ieee80211_tx_info_clear_status()
|
||||
/* From now, you can touch to tx_info->status, but do not touch to
|
||||
* tx_priv anymore
|
||||
*/
|
||||
/* FIXME: use ieee80211_tx_info_clear_status() */
|
||||
memset(tx_info->rate_driver_data, 0, sizeof(tx_info->rate_driver_data));
|
||||
memset(tx_info->pad, 0, sizeof(tx_info->pad));
|
||||
|
||||
@ -527,7 +531,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg)
|
||||
} else if (arg->status == HIF_STATUS_TX_FAIL_REQUEUE) {
|
||||
WARN(!arg->requeue, "incoherent status and result_flags");
|
||||
if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
|
||||
wvif->after_dtim_tx_allowed = false; // DTIM period elapsed
|
||||
wvif->after_dtim_tx_allowed = false; /* DTIM period elapsed */
|
||||
schedule_work(&wvif->update_tim_work);
|
||||
}
|
||||
tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
|
||||
|
@ -27,7 +27,7 @@ struct tx_policy {
|
||||
|
||||
struct tx_policy_cache {
|
||||
struct tx_policy cache[HIF_TX_RETRY_POLICY_MAX];
|
||||
// FIXME: use a trees and drop hash from tx_policy
|
||||
/* FIXME: use a trees and drop hash from tx_policy */
|
||||
struct list_head used;
|
||||
struct list_head free;
|
||||
spinlock_t lock;
|
||||
|
@ -256,9 +256,10 @@ static ssize_t wfx_send_hif_msg_write(struct file *file,
|
||||
if (count < sizeof(struct hif_msg))
|
||||
return -EINVAL;
|
||||
|
||||
// wfx_cmd_send() checks that reply buffer is wide enough, but does not
|
||||
// return precise length read. User have to know how many bytes should
|
||||
// be read. Filling reply buffer with a memory pattern may help user.
|
||||
/* wfx_cmd_send() checks that reply buffer is wide enough, but does not
|
||||
* return precise length read. User have to know how many bytes should
|
||||
* be read. Filling reply buffer with a memory pattern may help user.
|
||||
*/
|
||||
memset(context->reply, 0xFF, sizeof(context->reply));
|
||||
request = memdup_user(user_buf, count);
|
||||
if (IS_ERR(request))
|
||||
@ -288,8 +289,9 @@ static ssize_t wfx_send_hif_msg_read(struct file *file, char __user *user_buf,
|
||||
return ret;
|
||||
if (context->ret < 0)
|
||||
return context->ret;
|
||||
// Be careful, write() is waiting for a full message while read()
|
||||
// only returns a payload
|
||||
/* Be careful, write() is waiting for a full message while read()
|
||||
* only returns a payload
|
||||
*/
|
||||
if (copy_to_user(user_buf, context->reply, count))
|
||||
return -EFAULT;
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
#include "wfx.h"
|
||||
#include "hwio.h"
|
||||
|
||||
// Addresses below are in SRAM area
|
||||
/* Addresses below are in SRAM area */
|
||||
#define WFX_DNLD_FIFO 0x09004000
|
||||
#define DNLD_BLOCK_SIZE 0x0400
|
||||
#define DNLD_FIFO_SIZE 0x8000 // (32 * DNLD_BLOCK_SIZE)
|
||||
// Download Control Area (DCA)
|
||||
#define DNLD_FIFO_SIZE 0x8000 /* (32 * DNLD_BLOCK_SIZE) */
|
||||
/* Download Control Area (DCA) */
|
||||
#define WFX_DCA_IMAGE_SIZE 0x0900C000
|
||||
#define WFX_DCA_PUT 0x0900C004
|
||||
#define WFX_DCA_GET 0x0900C008
|
||||
@ -58,8 +58,8 @@
|
||||
#define ERR_ECC_PUB_KEY 0x11
|
||||
#define ERR_MAC_KEY 0x18
|
||||
|
||||
#define DCA_TIMEOUT 50 // milliseconds
|
||||
#define WAKEUP_TIMEOUT 200 // milliseconds
|
||||
#define DCA_TIMEOUT 50 /* milliseconds */
|
||||
#define WAKEUP_TIMEOUT 200 /* milliseconds */
|
||||
|
||||
static const char * const fwio_errors[] = {
|
||||
[ERR_INVALID_SEC_TYPE] = "Invalid section type or wrong encryption",
|
||||
@ -125,7 +125,7 @@ static int get_firmware(struct wfx_dev *wdev, u32 keyset_chip,
|
||||
|
||||
data = (*fw)->data;
|
||||
if (memcmp(data, "KEYSET", 6) != 0) {
|
||||
// Legacy firmware format
|
||||
/* Legacy firmware format */
|
||||
*file_offset = 0;
|
||||
keyset_file = 0x90;
|
||||
} else {
|
||||
@ -207,8 +207,9 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
// The device seems to not support writing 0 in this register
|
||||
// during first loop
|
||||
/* The device seems to not support writing 0 in this register
|
||||
* during first loop
|
||||
*/
|
||||
offs += DNLD_BLOCK_SIZE;
|
||||
ret = sram_reg_write(wdev, WFX_DCA_PUT, offs);
|
||||
if (ret < 0)
|
||||
@ -265,7 +266,7 @@ static int load_firmware_secure(struct wfx_dev *wdev)
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); // Fifo init
|
||||
sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); /* Fifo init */
|
||||
sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00",
|
||||
FW_VERSION_SIZE);
|
||||
sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset,
|
||||
@ -289,7 +290,7 @@ static int load_firmware_secure(struct wfx_dev *wdev)
|
||||
|
||||
sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_COMPLETE);
|
||||
ret = wait_ncp_status(wdev, NCP_AUTH_OK);
|
||||
// Legacy ROM support
|
||||
/* Legacy ROM support */
|
||||
if (ret < 0)
|
||||
ret = wait_ncp_status(wdev, NCP_PUB_KEY_RDY);
|
||||
if (ret < 0)
|
||||
@ -334,7 +335,7 @@ int wfx_init_device(struct wfx_dev *wdev)
|
||||
{
|
||||
int ret;
|
||||
int hw_revision, hw_type;
|
||||
int wakeup_timeout = 50; // ms
|
||||
int wakeup_timeout = 50; /* ms */
|
||||
ktime_t now, start;
|
||||
u32 reg;
|
||||
|
||||
|
@ -134,7 +134,7 @@ struct hif_req_start_scan_alt {
|
||||
u8 num_of_channels;
|
||||
__le32 min_channel_time;
|
||||
__le32 max_channel_time;
|
||||
__le32 tx_power_level; // signed value
|
||||
__le32 tx_power_level; /* signed value */
|
||||
struct hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS];
|
||||
u8 channel_list[];
|
||||
} __packed;
|
||||
@ -174,8 +174,9 @@ enum hif_frame_format {
|
||||
};
|
||||
|
||||
struct hif_req_tx {
|
||||
// packet_id is not interpreted by the device, so it is not necessary to
|
||||
// declare it little endian
|
||||
/* packet_id is not interpreted by the device, so it is not necessary to
|
||||
* declare it little endian
|
||||
*/
|
||||
u32 packet_id;
|
||||
u8 max_tx_rate;
|
||||
u8 queue_id:2;
|
||||
@ -211,8 +212,9 @@ enum hif_qos_ackplcy {
|
||||
|
||||
struct hif_cnf_tx {
|
||||
__le32 status;
|
||||
// packet_id is copied from struct hif_req_tx without been interpreted
|
||||
// by the device, so it is not necessary to declare it little endian
|
||||
/* packet_id is copied from struct hif_req_tx without been interpreted
|
||||
* by the device, so it is not necessary to declare it little endian
|
||||
*/
|
||||
u32 packet_id;
|
||||
u8 txed_rate;
|
||||
u8 ack_failures;
|
||||
|
@ -114,9 +114,10 @@ enum hif_api_rate_index {
|
||||
};
|
||||
|
||||
struct hif_ind_startup {
|
||||
// As the others, this struct is interpreted as little endian by the
|
||||
// device. However, this struct is also used by the driver. We prefer to
|
||||
// declare it in native order and doing byte swap on reception.
|
||||
/* As the others, this struct is interpreted as little endian by the
|
||||
* device. However, this struct is also used by the driver. We prefer to
|
||||
* declare it in native order and doing byte swap on reception.
|
||||
*/
|
||||
__le32 status;
|
||||
u16 hardware_id;
|
||||
u8 opn[14];
|
||||
@ -193,9 +194,9 @@ struct hif_rx_stats {
|
||||
__le32 throughput;
|
||||
__le32 nb_rx_by_rate[API_RATE_NUM_ENTRIES];
|
||||
__le16 per[API_RATE_NUM_ENTRIES];
|
||||
__le16 snr[API_RATE_NUM_ENTRIES]; // signed value
|
||||
__le16 rssi[API_RATE_NUM_ENTRIES]; // signed value
|
||||
__le16 cfo[API_RATE_NUM_ENTRIES]; // signed value
|
||||
__le16 snr[API_RATE_NUM_ENTRIES]; /* signed value */
|
||||
__le16 rssi[API_RATE_NUM_ENTRIES]; /* signed value */
|
||||
__le16 cfo[API_RATE_NUM_ENTRIES]; /* signed value */
|
||||
__le32 date;
|
||||
__le32 pwr_clk_freq;
|
||||
u8 is_ext_pwr_clk;
|
||||
@ -205,8 +206,8 @@ struct hif_rx_stats {
|
||||
struct hif_tx_power_loop_info {
|
||||
__le16 tx_gain_dig;
|
||||
__le16 tx_gain_pa;
|
||||
__le16 target_pout; // signed value
|
||||
__le16 p_estimation; // signed value
|
||||
__le16 target_pout; /* signed value */
|
||||
__le16 p_estimation; /* signed value */
|
||||
__le16 vpdet;
|
||||
u8 measurement_index;
|
||||
u8 reserved;
|
||||
|
@ -209,7 +209,7 @@ struct hif_mib_slot_time {
|
||||
} __packed;
|
||||
|
||||
struct hif_mib_current_tx_power_level {
|
||||
__le32 power_level; // signed value
|
||||
__le32 power_level; /* signed value */
|
||||
} __packed;
|
||||
|
||||
struct hif_mib_non_erp_protection {
|
||||
|
@ -19,10 +19,10 @@
|
||||
static int hif_generic_confirm(struct wfx_dev *wdev,
|
||||
const struct hif_msg *hif, const void *buf)
|
||||
{
|
||||
// All confirm messages start with status
|
||||
/* All confirm messages start with status */
|
||||
int status = le32_to_cpup((__le32 *)buf);
|
||||
int cmd = hif->id;
|
||||
int len = le16_to_cpu(hif->len) - 4; // drop header
|
||||
int len = le16_to_cpu(hif->len) - 4; /* drop header */
|
||||
|
||||
WARN(!mutex_is_locked(&wdev->hif_cmd.lock), "data locking error");
|
||||
|
||||
@ -244,7 +244,7 @@ static int hif_generic_indication(struct wfx_dev *wdev,
|
||||
return 0;
|
||||
case HIF_GENERIC_INDICATION_TYPE_RX_STATS:
|
||||
mutex_lock(&wdev->rx_stats_lock);
|
||||
// Older firmware send a generic indication beside RxStats
|
||||
/* Older firmware send a generic indication beside RxStats */
|
||||
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);
|
||||
@ -297,7 +297,7 @@ static const struct {
|
||||
"bus clock is too slow (<1kHz)" },
|
||||
{ HIF_ERROR_HIF_RX_DATA_TOO_LARGE,
|
||||
"HIF message too large" },
|
||||
// Following errors only exists in old firmware versions:
|
||||
/* Following errors only exists in old firmware versions: */
|
||||
{ HIF_ERROR_HIF_TX_QUEUE_FULL,
|
||||
"HIF messages queue is full" },
|
||||
{ HIF_ERROR_HIF_BUS,
|
||||
@ -374,7 +374,7 @@ static const struct {
|
||||
{ HIF_IND_ID_GENERIC, hif_generic_indication },
|
||||
{ HIF_IND_ID_ERROR, hif_error_indication },
|
||||
{ HIF_IND_ID_EXCEPTION, hif_exception_indication },
|
||||
// FIXME: allocate skb_p from hif_receive_indication and make it generic
|
||||
/* FIXME: allocate skb_p from hif_receive_indication and make it generic */
|
||||
//{ HIF_IND_ID_RX, hif_receive_indication },
|
||||
};
|
||||
|
||||
@ -385,12 +385,13 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb)
|
||||
int hif_id = hif->id;
|
||||
|
||||
if (hif_id == HIF_IND_ID_RX) {
|
||||
// hif_receive_indication take care of skb lifetime
|
||||
/* hif_receive_indication take care of skb lifetime */
|
||||
hif_receive_indication(wdev, hif, hif->body, skb);
|
||||
return;
|
||||
}
|
||||
// Note: mutex_is_lock cause an implicit memory barrier that protect
|
||||
// buf_send
|
||||
/* Note: mutex_is_lock cause an implicit memory barrier that protect
|
||||
* buf_send
|
||||
*/
|
||||
if (mutex_is_locked(&wdev->hif_cmd.lock) &&
|
||||
wdev->hif_cmd.buf_send &&
|
||||
wdev->hif_cmd.buf_send->id == hif_id) {
|
||||
|
@ -55,15 +55,16 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request,
|
||||
int vif = request->interface;
|
||||
int ret;
|
||||
|
||||
// Do not wait for any reply if chip is frozen
|
||||
/* Do not wait for any reply if chip is frozen */
|
||||
if (wdev->chip_frozen)
|
||||
return -ETIMEDOUT;
|
||||
|
||||
mutex_lock(&wdev->hif_cmd.lock);
|
||||
WARN(wdev->hif_cmd.buf_send, "data locking error");
|
||||
|
||||
// Note: call to complete() below has an implicit memory barrier that
|
||||
// hopefully protect buf_send
|
||||
/* Note: call to complete() below has an implicit memory barrier that
|
||||
* hopefully protect buf_send
|
||||
*/
|
||||
wdev->hif_cmd.buf_send = request;
|
||||
wdev->hif_cmd.buf_recv = reply;
|
||||
wdev->hif_cmd.len_recv = reply_len;
|
||||
@ -72,8 +73,9 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request,
|
||||
wfx_bh_request_tx(wdev);
|
||||
|
||||
if (no_reply) {
|
||||
// Chip won't reply. Give enough time to the wq to send the
|
||||
// buffer.
|
||||
/* Chip won't reply. Give enough time to the wq to send the
|
||||
* buffer.
|
||||
*/
|
||||
msleep(100);
|
||||
wdev->hif_cmd.buf_send = NULL;
|
||||
mutex_unlock(&wdev->hif_cmd.lock);
|
||||
@ -117,8 +119,9 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request,
|
||||
return ret;
|
||||
}
|
||||
|
||||
// This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any
|
||||
// request anymore. Obviously, only call this function during device unregister.
|
||||
/* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any
|
||||
* request anymore. Obviously, only call this function during device unregister.
|
||||
*/
|
||||
int hif_shutdown(struct wfx_dev *wdev)
|
||||
{
|
||||
int ret;
|
||||
@ -277,7 +280,7 @@ int hif_stop_scan(struct wfx_vif *wvif)
|
||||
{
|
||||
int ret;
|
||||
struct hif_msg *hif;
|
||||
// body associated to HIF_REQ_ID_STOP_SCAN is empty
|
||||
/* body associated to HIF_REQ_ID_STOP_SCAN is empty */
|
||||
wfx_alloc_hif(0, &hif);
|
||||
|
||||
if (!hif)
|
||||
@ -341,16 +344,17 @@ int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg)
|
||||
{
|
||||
int ret;
|
||||
struct hif_msg *hif;
|
||||
// FIXME: only send necessary bits
|
||||
/* FIXME: only send necessary bits */
|
||||
struct hif_req_add_key *body = wfx_alloc_hif(sizeof(*body), &hif);
|
||||
|
||||
if (!hif)
|
||||
return -ENOMEM;
|
||||
// FIXME: swap bytes as necessary in body
|
||||
/* FIXME: swap bytes as necessary in body */
|
||||
memcpy(body, arg, sizeof(*body));
|
||||
if (wfx_api_older_than(wdev, 1, 5))
|
||||
// Legacy firmwares expect that add_key to be sent on right
|
||||
// interface.
|
||||
/* 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));
|
||||
else
|
||||
@ -394,7 +398,7 @@ int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue,
|
||||
body->cw_max = cpu_to_le16(arg->cw_max);
|
||||
body->tx_op_limit = cpu_to_le16(arg->txop * USEC_PER_TXOP);
|
||||
body->queue_id = 3 - queue;
|
||||
// API 2.0 has changed queue IDs values
|
||||
/* API 2.0 has changed queue IDs values */
|
||||
if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BE)
|
||||
body->queue_id = HIF_QUEUE_ID_BACKGROUND;
|
||||
if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BK)
|
||||
@ -419,7 +423,7 @@ int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout)
|
||||
return -ENOMEM;
|
||||
if (ps) {
|
||||
body->enter_psm = 1;
|
||||
// Firmware does not support more than 128ms
|
||||
/* Firmware does not support more than 128ms */
|
||||
body->fast_psm_idle_period = min(dynamic_ps_timeout * 2, 255);
|
||||
if (body->fast_psm_idle_period)
|
||||
body->fast_psm = 1;
|
||||
|
@ -68,7 +68,7 @@ int hif_get_counters_table(struct wfx_dev *wdev, int vif_id,
|
||||
struct hif_mib_extended_count_table *arg)
|
||||
{
|
||||
if (wfx_api_older_than(wdev, 1, 3)) {
|
||||
// extended_count_table is wider than count_table
|
||||
/* extended_count_table is wider than count_table */
|
||||
memset(arg, 0xFF, sizeof(*arg));
|
||||
return hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE,
|
||||
arg, sizeof(struct hif_mib_count_table));
|
||||
@ -246,7 +246,7 @@ int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr)
|
||||
};
|
||||
|
||||
if (addr) {
|
||||
// Caution: type of addr is __be32
|
||||
/* Caution: type of addr is __be32 */
|
||||
memcpy(arg.ipv4_address, addr, sizeof(arg.ipv4_address));
|
||||
arg.arp_enable = HIF_ARP_NS_FILTERING_ENABLE;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ static int read32(struct wfx_dev *wdev, int reg, u32 *val)
|
||||
int ret;
|
||||
__le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL);
|
||||
|
||||
*val = ~0; // Never return undefined value
|
||||
*val = ~0; /* Never return undefined value */
|
||||
if (!tmp)
|
||||
return -ENOMEM;
|
||||
ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp,
|
||||
@ -153,7 +153,7 @@ static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr,
|
||||
|
||||
err:
|
||||
if (ret < 0)
|
||||
memset(buf, 0xFF, len); // Never return undefined value
|
||||
memset(buf, 0xFF, len); /* Never return undefined value */
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -335,7 +335,7 @@ int igpr_reg_read(struct wfx_dev *wdev, int index, u32 *val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
*val = ~0; // Never return undefined value
|
||||
*val = ~0; /* Never return undefined value */
|
||||
ret = write32_locked(wdev, WFX_REG_SET_GEN_R_W, IGPR_RW | index << 24);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -27,30 +27,30 @@ int sram_reg_write(struct wfx_dev *wdev, u32 addr, u32 val);
|
||||
int ahb_reg_read(struct wfx_dev *wdev, u32 addr, u32 *val);
|
||||
int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val);
|
||||
|
||||
#define CFG_ERR_SPI_FRAME 0x00000001 // only with SPI
|
||||
#define CFG_ERR_SDIO_BUF_MISMATCH 0x00000001 // only with SDIO
|
||||
#define CFG_ERR_SPI_FRAME 0x00000001 /* only with SPI */
|
||||
#define CFG_ERR_SDIO_BUF_MISMATCH 0x00000001 /* only with SDIO */
|
||||
#define CFG_ERR_BUF_UNDERRUN 0x00000002
|
||||
#define CFG_ERR_DATA_IN_TOO_LARGE 0x00000004
|
||||
#define CFG_ERR_HOST_NO_OUT_QUEUE 0x00000008
|
||||
#define CFG_ERR_BUF_OVERRUN 0x00000010
|
||||
#define CFG_ERR_DATA_OUT_TOO_LARGE 0x00000020
|
||||
#define CFG_ERR_HOST_NO_IN_QUEUE 0x00000040
|
||||
#define CFG_ERR_HOST_CRC_MISS 0x00000080 // only with SDIO
|
||||
#define CFG_SPI_IGNORE_CS 0x00000080 // only with SPI
|
||||
#define CFG_BYTE_ORDER_MASK 0x00000300 // only writable with SPI
|
||||
#define CFG_ERR_HOST_CRC_MISS 0x00000080 /* only with SDIO */
|
||||
#define CFG_SPI_IGNORE_CS 0x00000080 /* only with SPI */
|
||||
#define CFG_BYTE_ORDER_MASK 0x00000300 /* only writable with SPI */
|
||||
#define CFG_BYTE_ORDER_BADC 0x00000000
|
||||
#define CFG_BYTE_ORDER_DCBA 0x00000100
|
||||
#define CFG_BYTE_ORDER_ABCD 0x00000200 // SDIO always use this value
|
||||
#define CFG_BYTE_ORDER_ABCD 0x00000200 /* SDIO always use this value */
|
||||
#define CFG_DIRECT_ACCESS_MODE 0x00000400
|
||||
#define CFG_PREFETCH_AHB 0x00000800
|
||||
#define CFG_DISABLE_CPU_CLK 0x00001000
|
||||
#define CFG_PREFETCH_SRAM 0x00002000
|
||||
#define CFG_CPU_RESET 0x00004000
|
||||
#define CFG_SDIO_DISABLE_IRQ 0x00008000 // only with SDIO
|
||||
#define CFG_SDIO_DISABLE_IRQ 0x00008000 /* only with SDIO */
|
||||
#define CFG_IRQ_ENABLE_DATA 0x00010000
|
||||
#define CFG_IRQ_ENABLE_WRDY 0x00020000
|
||||
#define CFG_CLK_RISE_EDGE 0x00040000
|
||||
#define CFG_SDIO_DISABLE_CRC_CHK 0x00080000 // only with SDIO
|
||||
#define CFG_SDIO_DISABLE_CRC_CHK 0x00080000 /* only with SDIO */
|
||||
#define CFG_RESERVED 0x00F00000
|
||||
#define CFG_DEVICE_ID_MAJOR 0x07000000
|
||||
#define CFG_DEVICE_ID_RESERVED 0x78000000
|
||||
|
@ -84,10 +84,10 @@ static u8 fill_tkip_group(struct hif_tkip_group_key *msg,
|
||||
memcpy(msg->tkip_key_data, keybuf, sizeof(msg->tkip_key_data));
|
||||
keybuf += sizeof(msg->tkip_key_data);
|
||||
if (iftype == NL80211_IFTYPE_AP)
|
||||
// Use Tx MIC Key
|
||||
/* Use Tx MIC Key */
|
||||
memcpy(msg->rx_mic_key, keybuf + 0, sizeof(msg->rx_mic_key));
|
||||
else
|
||||
// Use Rx MIC Key
|
||||
/* Use Rx MIC Key */
|
||||
memcpy(msg->rx_mic_key, keybuf + 8, sizeof(msg->rx_mic_key));
|
||||
return HIF_KEY_TYPE_TKIP_GROUP;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ static const struct ieee80211_supported_band wfx_band_2ghz = {
|
||||
.bitrates = wfx_rates,
|
||||
.n_bitrates = ARRAY_SIZE(wfx_rates),
|
||||
.ht_cap = {
|
||||
// Receive caps
|
||||
/* 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),
|
||||
@ -100,7 +100,7 @@ static const struct ieee80211_supported_band wfx_band_2ghz = {
|
||||
.ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K,
|
||||
.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE,
|
||||
.mcs = {
|
||||
.rx_mask = { 0xFF }, // MCS0 to MCS7
|
||||
.rx_mask = { 0xFF }, /* MCS0 to MCS7 */
|
||||
.rx_highest = cpu_to_le16(72),
|
||||
.tx_params = IEEE80211_HT_MCS_TX_DEFINED,
|
||||
},
|
||||
@ -294,7 +294,7 @@ struct wfx_dev *wfx_init_common(struct device *dev,
|
||||
hw->wiphy->n_iface_combinations = ARRAY_SIZE(wfx_iface_combinations);
|
||||
hw->wiphy->iface_combinations = wfx_iface_combinations;
|
||||
hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL);
|
||||
// FIXME: also copy wfx_rates and wfx_2ghz_chantable
|
||||
/* FIXME: also copy wfx_rates and wfx_2ghz_chantable */
|
||||
memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz,
|
||||
sizeof(wfx_band_2ghz));
|
||||
|
||||
@ -336,8 +336,9 @@ int wfx_probe(struct wfx_dev *wdev)
|
||||
int err;
|
||||
struct gpio_desc *gpio_saved;
|
||||
|
||||
// During first part of boot, gpio_wakeup cannot yet been used. So
|
||||
// prevent bh() to touch it.
|
||||
/* During first part of boot, gpio_wakeup cannot yet been used. So
|
||||
* prevent bh() to touch it.
|
||||
*/
|
||||
gpio_saved = wdev->pdata.gpio_wakeup;
|
||||
wdev->pdata.gpio_wakeup = NULL;
|
||||
wdev->poll_irq = true;
|
||||
@ -360,7 +361,7 @@ int wfx_probe(struct wfx_dev *wdev)
|
||||
goto err0;
|
||||
}
|
||||
|
||||
// FIXME: fill wiphy::hw_version
|
||||
/* FIXME: fill wiphy::hw_version */
|
||||
dev_info(wdev->dev, "started firmware %d.%d.%d \"%s\" (API: %d.%d, keyset: %02X, caps: 0x%.8X)\n",
|
||||
wdev->hw_caps.firmware_major, wdev->hw_caps.firmware_minor,
|
||||
wdev->hw_caps.firmware_build, wdev->hw_caps.firmware_label,
|
||||
|
@ -32,7 +32,7 @@ void wfx_tx_flush(struct wfx_dev *wdev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
// Do not wait for any reply if chip is frozen
|
||||
/* Do not wait for any reply if chip is frozen */
|
||||
if (wdev->chip_frozen)
|
||||
return;
|
||||
|
||||
@ -45,7 +45,7 @@ void wfx_tx_flush(struct wfx_dev *wdev)
|
||||
dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n",
|
||||
wdev->hif.tx_buffers_used);
|
||||
wfx_pending_dump_old_frames(wdev, 3000);
|
||||
// FIXME: drop pending frames here
|
||||
/* FIXME: drop pending frames here */
|
||||
wdev->chip_frozen = true;
|
||||
}
|
||||
mutex_unlock(&wdev->hif_cmd.lock);
|
||||
@ -60,9 +60,10 @@ void wfx_tx_lock_flush(struct wfx_dev *wdev)
|
||||
|
||||
void wfx_tx_queues_init(struct wfx_vif *wvif)
|
||||
{
|
||||
// The device is in charge to respect the details of the QoS parameters.
|
||||
// The driver just ensure that it roughtly respect the priorities to
|
||||
// avoid any shortage.
|
||||
/* The device is in charge to respect the details of the QoS parameters.
|
||||
* The driver just ensure that it roughtly respect the priorities to
|
||||
* avoid any shortage.
|
||||
*/
|
||||
const int priorities[IEEE80211_NUM_ACS] = { 1, 2, 64, 128 };
|
||||
int i;
|
||||
|
||||
@ -217,8 +218,9 @@ bool wfx_tx_queues_has_cab(struct wfx_vif *wvif)
|
||||
if (wvif->vif->type != NL80211_IFTYPE_AP)
|
||||
return false;
|
||||
for (i = 0; i < IEEE80211_NUM_ACS; ++i)
|
||||
// Note: since only AP can have mcast frames in queue and only
|
||||
// one vif can be AP, all queued frames has same interface id
|
||||
/* Note: since only AP can have mcast frames in queue and only
|
||||
* one vif can be AP, all queued frames has same interface id
|
||||
*/
|
||||
if (!skb_queue_empty_lockless(&wvif->tx_queue[i].cab))
|
||||
return true;
|
||||
return false;
|
||||
@ -237,7 +239,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
|
||||
struct hif_msg *hif;
|
||||
struct sk_buff *skb;
|
||||
|
||||
// sort the queues
|
||||
/* sort the queues */
|
||||
wvif = NULL;
|
||||
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
|
||||
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
|
||||
@ -259,9 +261,10 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
|
||||
skb = skb_dequeue(&queues[i]->cab);
|
||||
if (!skb)
|
||||
continue;
|
||||
// Note: since only AP can have mcast frames in queue
|
||||
// and only one vif can be AP, all queued frames has
|
||||
// same interface id
|
||||
/* Note: since only AP can have mcast frames in queue
|
||||
* and only one vif can be AP, all queued frames has
|
||||
* same interface id
|
||||
*/
|
||||
hif = (struct hif_msg *)skb->data;
|
||||
WARN_ON(hif->interface != wvif->id);
|
||||
WARN_ON(queues[i] !=
|
||||
@ -270,7 +273,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
|
||||
trace_queues_stats(wdev, queues[i]);
|
||||
return skb;
|
||||
}
|
||||
// No more multicast to sent
|
||||
/* No more multicast to sent */
|
||||
wvif->after_dtim_tx_allowed = false;
|
||||
schedule_work(&wvif->update_tim_work);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ struct wfx_vif;
|
||||
|
||||
struct wfx_queue {
|
||||
struct sk_buff_head normal;
|
||||
struct sk_buff_head cab; // Content After (DTIM) Beacon
|
||||
struct sk_buff_head cab; /* Content After (DTIM) Beacon */
|
||||
atomic_t pending_frames;
|
||||
int priority;
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates)
|
||||
{
|
||||
int i;
|
||||
u32 ret = 0;
|
||||
// The device only supports 2GHz
|
||||
/* The device only supports 2GHz */
|
||||
struct ieee80211_supported_band *sband = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
|
||||
|
||||
for (i = 0; i < sband->n_bitrates; i++) {
|
||||
@ -51,11 +51,11 @@ void wfx_cooling_timeout_work(struct work_struct *work)
|
||||
void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd)
|
||||
{
|
||||
if (cmd == STA_NOTIFY_AWAKE) {
|
||||
// Device recover normal temperature
|
||||
/* Device recover normal temperature */
|
||||
if (cancel_delayed_work(&wdev->cooling_timeout_work))
|
||||
wfx_tx_unlock(wdev);
|
||||
} else {
|
||||
// Device is too hot
|
||||
/* Device is too hot */
|
||||
schedule_delayed_work(&wdev->cooling_timeout_work, 10 * HZ);
|
||||
wfx_tx_lock(wdev);
|
||||
}
|
||||
@ -103,13 +103,14 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
|
||||
struct wfx_dev *wdev = hw->priv;
|
||||
bool filter_bssid, filter_prbreq, filter_beacon;
|
||||
|
||||
// Notes:
|
||||
// - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered
|
||||
// - PS-Poll (FIF_PSPOLL) are never filtered
|
||||
// - RTS, CTS and Ack (FIF_CONTROL) are always filtered
|
||||
// - Broken frames (FIF_FCSFAIL and FIF_PLCPFAIL) are always filtered
|
||||
// - Firmware does (yet) allow to forward unicast traffic sent to
|
||||
// other stations (aka. promiscuous mode)
|
||||
/* Notes:
|
||||
* - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered
|
||||
* - PS-Poll (FIF_PSPOLL) are never filtered
|
||||
* - RTS, CTS and Ack (FIF_CONTROL) are always filtered
|
||||
* - Broken frames (FIF_FCSFAIL and FIF_PLCPFAIL) are always filtered
|
||||
* - Firmware does (yet) allow to forward unicast traffic sent to
|
||||
* other stations (aka. promiscuous mode)
|
||||
*/
|
||||
*total_flags &= FIF_BCN_PRBRESP_PROMISC | FIF_ALLMULTI | FIF_OTHER_BSS |
|
||||
FIF_PROBE_REQ | FIF_PSPOLL;
|
||||
|
||||
@ -117,8 +118,9 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
|
||||
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
|
||||
mutex_lock(&wvif->scan_lock);
|
||||
|
||||
// Note: FIF_BCN_PRBRESP_PROMISC covers probe response and
|
||||
// beacons from other BSS
|
||||
/* Note: FIF_BCN_PRBRESP_PROMISC covers probe response and
|
||||
* beacons from other BSS
|
||||
*/
|
||||
if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
|
||||
filter_beacon = false;
|
||||
else
|
||||
@ -130,7 +132,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
|
||||
else
|
||||
filter_bssid = true;
|
||||
|
||||
// In AP mode, chip can reply to probe request itself
|
||||
/* In AP mode, chip can reply to probe request itself */
|
||||
if (*total_flags & FIF_PROBE_REQ &&
|
||||
wvif->vif->type == NL80211_IFTYPE_AP) {
|
||||
dev_dbg(wdev->dev, "do not forward probe request in AP mode\n");
|
||||
@ -161,15 +163,16 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
|
||||
chan1 = wdev_to_wvif(wvif->wdev, 1)->vif->bss_conf.chandef.chan;
|
||||
if (chan0 && chan1 && wvif->vif->type != NL80211_IFTYPE_AP) {
|
||||
if (chan0->hw_value == chan1->hw_value) {
|
||||
// It is useless to enable PS if channels are the same.
|
||||
/* It is useless to enable PS if channels are the same. */
|
||||
if (enable_ps)
|
||||
*enable_ps = false;
|
||||
if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps)
|
||||
dev_info(wvif->wdev->dev, "ignoring requested PS mode");
|
||||
return -1;
|
||||
} else {
|
||||
// It is necessary to enable PS if channels
|
||||
// are different.
|
||||
/* It is necessary to enable PS if channels
|
||||
* are different.
|
||||
*/
|
||||
if (enable_ps)
|
||||
*enable_ps = true;
|
||||
if (wvif->wdev->force_ps_timeout > -1)
|
||||
@ -305,7 +308,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
if (vif->type == NL80211_IFTYPE_STATION)
|
||||
hif_set_mfp(wvif, sta->mfp, sta->mfp);
|
||||
|
||||
// In station mode, the firmware interprets new link-id as a TDLS peer.
|
||||
/* In station mode, the firmware interprets new link-id as a TDLS peer */
|
||||
if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
|
||||
return 0;
|
||||
sta_priv->link_id = ffz(wvif->link_id_map);
|
||||
@ -323,10 +326,10 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
|
||||
struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv;
|
||||
|
||||
// See note in wfx_sta_add()
|
||||
/* See note in wfx_sta_add() */
|
||||
if (!sta_priv->link_id)
|
||||
return 0;
|
||||
// FIXME add a mutex?
|
||||
/* FIXME add a mutex? */
|
||||
hif_map_link(wvif, true, sta->addr, sta_priv->link_id, false);
|
||||
wvif->link_id_map &= ~BIT(sta_priv->link_id);
|
||||
return 0;
|
||||
@ -421,7 +424,7 @@ static void wfx_join(struct wfx_vif *wvif)
|
||||
return;
|
||||
}
|
||||
|
||||
rcu_read_lock(); // protect ssidie
|
||||
rcu_read_lock(); /* protect ssidie */
|
||||
if (bss)
|
||||
ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
|
||||
if (ssidie) {
|
||||
@ -457,7 +460,7 @@ static void wfx_join_finalize(struct wfx_vif *wvif,
|
||||
int ampdu_density = 0;
|
||||
bool greenfield = false;
|
||||
|
||||
rcu_read_lock(); // protect sta
|
||||
rcu_read_lock(); /* protect sta */
|
||||
if (info->bssid && !info->ibss_joined)
|
||||
sta = ieee80211_find_sta(wvif->vif, info->bssid);
|
||||
if (sta && sta->ht_cap.ht_supported)
|
||||
@ -471,8 +474,9 @@ static void wfx_join_finalize(struct wfx_vif *wvif,
|
||||
hif_set_association_mode(wvif, ampdu_density, greenfield,
|
||||
info->use_short_preamble);
|
||||
hif_keep_alive_period(wvif, 0);
|
||||
// beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use
|
||||
// the same value.
|
||||
/* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use
|
||||
* the same value.
|
||||
*/
|
||||
hif_set_bss_params(wvif, info->aid, 7);
|
||||
hif_set_beacon_wakeup_period(wvif, 1, 1);
|
||||
wfx_update_pm(wvif);
|
||||
@ -496,10 +500,11 @@ void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
|
||||
static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable)
|
||||
{
|
||||
// Driver has Content After DTIM Beacon in queue. Driver is waiting for
|
||||
// a signal from the firmware. Since we are going to stop to send
|
||||
// beacons, this signal will never happens. See also
|
||||
// wfx_suspend_resume_mc()
|
||||
/* Driver has Content After DTIM Beacon in queue. Driver is waiting for
|
||||
* a signal from the firmware. Since we are going to stop to send
|
||||
* beacons, this signal will never happens. See also
|
||||
* wfx_suspend_resume_mc()
|
||||
*/
|
||||
if (!enable && wfx_tx_queues_has_cab(wvif)) {
|
||||
wvif->after_dtim_tx_allowed = true;
|
||||
wfx_bh_request_tx(wvif->wdev);
|
||||
@ -539,8 +544,9 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
__func__);
|
||||
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.
|
||||
/* We temporary forwarded beacon for join process. It is now no
|
||||
* more necessary.
|
||||
*/
|
||||
wfx_filter_beacon(wvif, true);
|
||||
}
|
||||
|
||||
@ -662,14 +668,14 @@ int wfx_ampdu_action(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_ampdu_params *params)
|
||||
{
|
||||
// Aggregation is implemented fully in firmware
|
||||
/* Aggregation is implemented fully in firmware */
|
||||
switch (params->action) {
|
||||
case IEEE80211_AMPDU_RX_START:
|
||||
case IEEE80211_AMPDU_RX_STOP:
|
||||
// Just acknowledge it to enable frame re-ordering
|
||||
/* Just acknowledge it to enable frame re-ordering */
|
||||
return 0;
|
||||
default:
|
||||
// Leave the firmware doing its business for tx aggregation
|
||||
/* Leave the firmware doing its business for tx aggregation */
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
@ -741,11 +747,11 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
// FIXME: prefer use of container_of() to get vif
|
||||
/* FIXME: prefer use of container_of() to get vif */
|
||||
wvif->vif = vif;
|
||||
wvif->wdev = wdev;
|
||||
|
||||
wvif->link_id_map = 1; // link-id 0 is reserved for multicast
|
||||
wvif->link_id_map = 1; /* link-id 0 is reserved for multicast */
|
||||
INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work);
|
||||
INIT_DELAYED_WORK(&wvif->beacon_loss_work, wfx_beacon_loss_work);
|
||||
|
||||
@ -775,7 +781,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
|
||||
wvif = NULL;
|
||||
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
|
||||
// Combo mode does not support Block Acks. We can re-enable them
|
||||
/* Combo mode does not support Block Acks. We can re-enable them */
|
||||
if (wvif_count(wdev) == 1)
|
||||
hif_set_block_ack_policy(wvif, 0xFF, 0xFF);
|
||||
else
|
||||
@ -807,7 +813,7 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
|
||||
wvif = NULL;
|
||||
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
|
||||
// Combo mode does not support Block Acks. We can re-enable them
|
||||
/* Combo mode does not support Block Acks. We can re-enable them */
|
||||
if (wvif_count(wdev) == 1)
|
||||
hif_set_block_ack_policy(wvif, 0xFF, 0xFF);
|
||||
else
|
||||
|
@ -18,7 +18,7 @@ struct wfx_sta_priv {
|
||||
int vif_id;
|
||||
};
|
||||
|
||||
// mac80211 interface
|
||||
/* mac80211 interface */
|
||||
int wfx_start(struct ieee80211_hw *hw);
|
||||
void wfx_stop(struct ieee80211_hw *hw);
|
||||
int wfx_config(struct ieee80211_hw *hw, u32 changed);
|
||||
@ -59,14 +59,14 @@ void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_chanctx_conf *conf);
|
||||
|
||||
// Hardware API Callbacks
|
||||
/* Hardware API Callbacks */
|
||||
void wfx_cooling_timeout_work(struct work_struct *work);
|
||||
void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd);
|
||||
void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd cmd);
|
||||
void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi);
|
||||
int wfx_update_pm(struct wfx_vif *wvif);
|
||||
|
||||
// Other Helpers
|
||||
/* Other Helpers */
|
||||
void wfx_reset(struct wfx_vif *wvif);
|
||||
u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates);
|
||||
|
||||
|
@ -378,7 +378,7 @@ TRACE_EVENT(tx_stats,
|
||||
__array(int, tx_count, 4)
|
||||
),
|
||||
TP_fast_assign(
|
||||
// Keep sync with wfx_rates definition in main.c
|
||||
/* Keep sync with wfx_rates definition in main.c */
|
||||
static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9,
|
||||
10, 11, 12, 13 };
|
||||
const struct ieee80211_tx_info *tx_info =
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "queue.h"
|
||||
#include "hif_tx.h"
|
||||
|
||||
#define USEC_PER_TXOP 32 // see struct ieee80211_tx_queue_params
|
||||
#define USEC_PER_TXOP 32 /* see struct ieee80211_tx_queue_params */
|
||||
#define USEC_PER_TU 1024
|
||||
|
||||
struct hwbus_ops;
|
||||
|
Loading…
Reference in New Issue
Block a user