Skip to content

Commit

Permalink
Merge ath-next from ath.git
Browse files Browse the repository at this point in the history
Major changes:

ath9k

* add random number generator support (CONFIG_ATH9K_HWRNG)
  • Loading branch information
Kalle Valo committed Dec 16, 2015
2 parents 9b2761c + 7c97b72 commit d0ca990
Show file tree
Hide file tree
Showing 25 changed files with 422 additions and 225 deletions.
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath10k/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ static ssize_t ath10k_read_htt_max_amsdu_ampdu(struct file *file,
{
struct ath10k *ar = file->private_data;
char buf[64];
u8 amsdu = 3, ampdu = 64;
u8 amsdu, ampdu;
unsigned int len;

mutex_lock(&ar->conf_mutex);
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ath10k/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ static int ath10k_install_peer_wep_keys(struct ath10k_vif *arvif,
lockdep_assert_held(&ar->conf_mutex);

if (WARN_ON(arvif->vif->type != NL80211_IFTYPE_AP &&
arvif->vif->type != NL80211_IFTYPE_ADHOC))
arvif->vif->type != NL80211_IFTYPE_ADHOC &&
arvif->vif->type != NL80211_IFTYPE_MESH_POINT))
return -EINVAL;

spin_lock_bh(&ar->data_lock);
Expand Down
61 changes: 43 additions & 18 deletions drivers/net/wireless/ath/ath10k/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -4312,34 +4312,58 @@ void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar, struct sk_buff *skb)
ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_RESUME_REQ_EVENTID\n");
}

static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id,
u32 num_units, u32 unit_len)
static int ath10k_wmi_alloc_chunk(struct ath10k *ar, u32 req_id,
u32 num_units, u32 unit_len)
{
dma_addr_t paddr;
u32 pool_size;
u32 pool_size = 0;
int idx = ar->wmi.num_mem_chunks;
void *vaddr = NULL;

pool_size = num_units * round_up(unit_len, 4);
if (ar->wmi.num_mem_chunks == ARRAY_SIZE(ar->wmi.mem_chunks))
return -ENOMEM;

if (!pool_size)
return -EINVAL;
while (!vaddr && num_units) {
pool_size = num_units * round_up(unit_len, 4);
if (!pool_size)
return -EINVAL;

ar->wmi.mem_chunks[idx].vaddr = dma_alloc_coherent(ar->dev,
pool_size,
&paddr,
GFP_KERNEL);
if (!ar->wmi.mem_chunks[idx].vaddr) {
ath10k_warn(ar, "failed to allocate memory chunk\n");
return -ENOMEM;
vaddr = kzalloc(pool_size, GFP_KERNEL | __GFP_NOWARN);
if (!vaddr)
num_units /= 2;
}

memset(ar->wmi.mem_chunks[idx].vaddr, 0, pool_size);
if (!num_units)
return -ENOMEM;

paddr = dma_map_single(ar->dev, vaddr, pool_size, DMA_TO_DEVICE);
if (dma_mapping_error(ar->dev, paddr)) {
kfree(vaddr);
return -ENOMEM;
}

ar->wmi.mem_chunks[idx].vaddr = vaddr;
ar->wmi.mem_chunks[idx].paddr = paddr;
ar->wmi.mem_chunks[idx].len = pool_size;
ar->wmi.mem_chunks[idx].req_id = req_id;
ar->wmi.num_mem_chunks++;

return num_units;
}

static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id,
u32 num_units, u32 unit_len)
{
int ret;

while (num_units) {
ret = ath10k_wmi_alloc_chunk(ar, req_id, num_units, unit_len);
if (ret < 0)
return ret;

num_units -= ret;
}

return 0;
}

Expand Down Expand Up @@ -7717,10 +7741,11 @@ void ath10k_wmi_free_host_mem(struct ath10k *ar)

/* free the host memory chunks requested by firmware */
for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
dma_free_coherent(ar->dev,
ar->wmi.mem_chunks[i].len,
ar->wmi.mem_chunks[i].vaddr,
ar->wmi.mem_chunks[i].paddr);
dma_unmap_single(ar->dev,
ar->wmi.mem_chunks[i].paddr,
ar->wmi.mem_chunks[i].len,
DMA_TO_DEVICE);
kfree(ar->wmi.mem_chunks[i].vaddr);
}

ar->wmi.num_mem_chunks = 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath5k/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ ath5k_txbuf_setup(struct ath5k_hw *ah, struct ath5k_buf *bf,
if (info->flags & IEEE80211_TX_CTL_NO_ACK)
flags |= AR5K_TXDESC_NOACK;

rc_flags = info->control.rates[0].flags;
rc_flags = bf->rates[0].flags;

hw_rate = ath5k_get_rate_hw_value(ah->hw, info, bf, 0);

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath/ath6kl/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -3930,8 +3930,8 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
ath6kl_band_2ghz.ht_cap.mcs.rx_mask[1] = 0xff;
ath6kl_band_5ghz.ht_cap.mcs.rx_mask[1] = 0xff;
ar->hw.tx_ant = 2;
ar->hw.rx_ant = 2;
ar->hw.tx_ant = 0x3; /* mask, 2 antenna */
ar->hw.rx_ant = 0x3;
} else {
ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
Expand Down
5 changes: 3 additions & 2 deletions drivers/net/wireless/ath/ath6kl/htc_mbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -2222,8 +2222,9 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
}

if (status) {
ath6kl_err("failed to get pending recv messages: %d\n",
status);
if (status != -ECANCELED)
ath6kl_err("failed to get pending recv messages: %d\n",
status);

/* cleanup any packets in sync completion queue */
list_for_each_entry_safe(packets, tmp_pkt, &comp_pktq, list) {
Expand Down
16 changes: 15 additions & 1 deletion drivers/net/wireless/ath/ath6kl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,8 +954,10 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
snprintf(filename, sizeof(filename), "%s/%s", ar->hw.fw.dir, name);

ret = request_firmware(&fw, filename, ar->dev);
if (ret)
if (ret) {
ath6kl_err("Failed request firmware, rv: %d\n", ret);
return ret;
}

data = fw->data;
len = fw->size;
Expand All @@ -964,11 +966,15 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
magic_len = strlen(ATH6KL_FIRMWARE_MAGIC) + 1;

if (len < magic_len) {
ath6kl_err("Magic length is invalid, len: %zd magic_len: %zd\n",
len, magic_len);
ret = -EINVAL;
goto out;
}

if (memcmp(data, ATH6KL_FIRMWARE_MAGIC, magic_len) != 0) {
ath6kl_err("Magic is invalid, magic_len: %zd\n",
magic_len);
ret = -EINVAL;
goto out;
}
Expand All @@ -987,7 +993,12 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
len -= sizeof(*hdr);
data += sizeof(*hdr);

ath6kl_dbg(ATH6KL_DBG_BOOT, "ie-id: %d len: %zd (0x%zx)\n",
ie_id, ie_len, ie_len);

if (len < ie_len) {
ath6kl_err("IE len is invalid, len: %zd ie_len: %zd ie-id: %d\n",
len, ie_len, ie_id);
ret = -EINVAL;
goto out;
}
Expand All @@ -1008,6 +1019,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
ar->fw_otp = kmemdup(data, ie_len, GFP_KERNEL);

if (ar->fw_otp == NULL) {
ath6kl_err("fw_otp cannot be allocated\n");
ret = -ENOMEM;
goto out;
}
Expand All @@ -1025,6 +1037,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
ar->fw = vmalloc(ie_len);

if (ar->fw == NULL) {
ath6kl_err("fw storage cannot be allocated, len: %zd\n", ie_len);
ret = -ENOMEM;
goto out;
}
Expand All @@ -1039,6 +1052,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
ar->fw_patch = kmemdup(data, ie_len, GFP_KERNEL);

if (ar->fw_patch == NULL) {
ath6kl_err("fw_patch storage cannot be allocated, len: %zd\n", ie_len);
ret = -ENOMEM;
goto out;
}
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/wireless/ath/ath9k/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,14 @@ config ATH9K_HTC_DEBUGFS
depends on ATH9K_HTC && DEBUG_FS
---help---
Say Y, if you need access to ath9k_htc's statistics.

config ATH9K_HWRNG
bool "Random number generator support"
depends on ATH9K && (HW_RANDOM = y || HW_RANDOM = ATH9K)
default y
---help---
This option incorporates the ADC register output as a source of
randomness into Linux entropy pool (/dev/urandom and /dev/random)

Say Y, feeds the entropy directly from the WiFi driver to the input
pool.
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath9k/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ath9k-$(CONFIG_ATH9K_DFS_DEBUGFS) += dfs_debug.o
ath9k-$(CONFIG_ATH9K_DFS_CERTIFIED) += dfs.o
ath9k-$(CONFIG_ATH9K_TX99) += tx99.o
ath9k-$(CONFIG_ATH9K_WOW) += wow.o
ath9k-$(CONFIG_ATH9K_HWRNG) += rng.o

ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o

Expand Down
23 changes: 23 additions & 0 deletions drivers/net/wireless/ath/ath9k/ath9k.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/leds.h>
#include <linux/completion.h>
#include <linux/time.h>
#include <linux/hw_random.h>

#include "common.h"
#include "debug.h"
Expand Down Expand Up @@ -981,6 +982,7 @@ struct ath_softc {
struct ath_offchannel offchannel;
struct ath_chanctx *next_chan;
struct completion go_beacon;
struct timespec last_event_time;
#endif

unsigned long driver_data;
Expand Down Expand Up @@ -1040,6 +1042,11 @@ struct ath_softc {
u32 wow_intr_before_sleep;
bool force_wow;
#endif

#ifdef CONFIG_ATH9K_HWRNG
u32 rng_last;
struct task_struct *rng_task;
#endif
};

/********/
Expand All @@ -1062,6 +1069,22 @@ static inline int ath9k_tx99_send(struct ath_softc *sc,
}
#endif /* CONFIG_ATH9K_TX99 */

/***************************/
/* Random Number Generator */
/***************************/
#ifdef CONFIG_ATH9K_HWRNG
void ath9k_rng_start(struct ath_softc *sc);
void ath9k_rng_stop(struct ath_softc *sc);
#else
static inline void ath9k_rng_start(struct ath_softc *sc)
{
}

static inline void ath9k_rng_stop(struct ath_softc *sc)
{
}
#endif

static inline void ath_read_cachesize(struct ath_common *common, int *csz)
{
common->bus_ops->read_cachesize(common, csz);
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ath9k/beacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw,

ath_assign_seq(common, skb);

if (vif->p2p)
/* Always assign NOA attr when MCC enabled */
if (ath9k_is_chanctx_enabled())
ath9k_beacon_add_noa(sc, avp, skb);

bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
Expand Down
Loading

0 comments on commit d0ca990

Please sign in to comment.