2014-03-04 12:52:45

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 00/14] ath10k: Refactor rx path little bit

Refactor rx path, mainly split/reduce calculation we
did before. Now we caculate variable/flags only once
per-ppdu, while before we did some calculations for
each mpdu. Kill some not needed code and fill directly
ieee80211_rx_status structure.
TP veryfication required.

Janusz Dziedzic (14):
ath10k: add ath10k_htt_rx_amsdu_allowed function
ath10k: Fill per-ppdu info in rx_info only once
ath10k: move rx related functions to htt_rx.c
ath10k: rename process_rx_rates to ath10k_htt_rx_h_rates
ath10k: introduce ieee80211_rx_status to htt_rx_info
ath10k: kill signal field in htt_rx_info
ath10k: setup rx channel per ppdu
ath10k: kill rate substruct and tsf from htt_rx_info
ath10k: kill fcs_err from htt_rx_info
ath10k: kill mic_err/amsdu_more from htt_rx_info
ath10k: kill status from htt_rx_info
ath10k: kill encrypt_type from htt_rx_info
ath10k: return error when ath10k_htt_rx_amsdu_pop() fail
ath10k: improve way we play with attention flags

drivers/net/wireless/ath/ath10k/htt.h | 15 +-
drivers/net/wireless/ath/ath10k/htt_rx.c | 436 +++++++++++++++++++++---------
drivers/net/wireless/ath/ath10k/txrx.c | 183 -------------
drivers/net/wireless/ath/ath10k/txrx.h | 1 -
4 files changed, 308 insertions(+), 327 deletions(-)

--
1.7.9.5



2014-03-04 12:52:51

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 05/14] ath10k: introduce ieee80211_rx_status to htt_rx_info

Will be used as a template, and final storage for
rx_status.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt.h | 2 ++
drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 654867f..e80f033 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -21,6 +21,7 @@
#include <linux/bug.h>
#include <linux/interrupt.h>
#include <linux/dmapool.h>
+#include <net/mac80211.h>

#include "htc.h"
#include "rx_desc.h"
@@ -1174,6 +1175,7 @@ struct htt_peer_unmap_event {

struct htt_rx_info {
struct sk_buff *skb;
+ struct ieee80211_rx_status rx_status;
enum htt_rx_mpdu_status status;
enum htt_rx_mpdu_encrypt_type encrypt_type;
s8 signal;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 3008a1d..2fca1fa 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -756,7 +756,7 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)info->skb->data;

status = IEEE80211_SKB_RXCB(info->skb);
- memset(status, 0, sizeof(*status));
+ memcpy(status, &info->rx_status, sizeof(*status));

if (info->encrypt_type != HTT_RX_MPDU_ENCRYPT_NONE) {
status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED |
--
1.7.9.5


2014-03-04 14:06:00

by Michal Kazior

[permalink] [raw]
Subject: Re: [RFC 13/14] ath10k: return error when ath10k_htt_rx_amsdu_pop() fail

On 4 March 2014 13:52, Janusz Dziedzic <[email protected]> wrote:
> Signed-off-by: Janusz Dziedzic <[email protected]>
> ---
> drivers/net/wireless/ath/ath10k/htt_rx.c | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
> index 555aecf..e300a74 100644
> --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
> +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
> @@ -310,7 +310,7 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
>
> if (htt->rx_confused) {
> ath10k_warn("htt is confused. refusing rx\n");
> - return 0;
> + return -1;
> }

Add a comment before function definition, please:

/* return: <0 fatal error, >=0 success, >0 number of chained msdus */

(this includes return-value logic Ben's unchaining patch added..)


>
> msdu = *head_msdu = ath10k_htt_rx_netbuf_pop(htt);
> @@ -442,6 +442,9 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
> }
> *tail_msdu = msdu;
>
> + if (*head_msdu == NULL)
> + msdu_chaining = -1;
> +
> /*
> * Don't refill the ring yet.
> *
> @@ -1089,11 +1092,6 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,
> enum htt_rx_mpdu_status status,
> bool channel_set)
> {
> - if (!head) {
> - ath10k_warn("htt rx no data!\n");
> - return false;
> - }
> -
> if (head->len == 0) {
> ath10k_dbg(ATH10K_DBG_HTT,
> "htt rx dropping due to zero-len\n");
> @@ -1209,8 +1207,14 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
> &msdu_head,
> &msdu_tail);
>
> + if (msdu_chaining == -1) {

if (msdu_chaining < 0)

I think having `ret` makes more sense here now.


> + ath10k_warn("htt rx no data!\n");

"failed to pop amsdu from htt rx ring: %d", ret


> + ath10k_htt_rx_free_msdu_chain(msdu_head);
> + continue;
> + }
> +
> if (!ath10k_htt_rx_amsdu_allowed(htt, msdu_head,
> - !!msdu_chaining,
> + msdu_chaining > 0,
> status,
> channel_set)) {
> ath10k_htt_rx_free_msdu_chain(msdu_head);
> @@ -1280,12 +1284,12 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,
>
> ath10k_dbg(ATH10K_DBG_HTT_DUMP, "htt rx frag ahead\n");
>
> - if (!msdu_head) {
> + if (msdu_chaining == -1) {

ret < 0


> ath10k_warn("htt rx frag no data\n");

"failed to .. : %d", ret


> return;
> }
>
> - if (msdu_chaining || msdu_head != msdu_tail) {
> + if (msdu_chaining > 0 || msdu_head != msdu_tail) {
> ath10k_warn("aggregation with fragmentation?!\n");
> ath10k_htt_rx_free_msdu_chain(msdu_head);
> return;

Actually the 2 checks above can be squashed:

if (ret) {
ath10k_warn("failed to pop amsdu from htt rx for fragmented rx: %d", ret)



MichaƂ

2014-03-04 12:52:53

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 06/14] ath10k: kill signal field in htt_rx_info

Setup signal field directly in ieee80211_rx_status.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt.h | 1 -
drivers/net/wireless/ath/ath10k/htt_rx.c | 6 ++----
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index e80f033..9f5da2b 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1178,7 +1178,6 @@ struct htt_rx_info {
struct ieee80211_rx_status rx_status;
enum htt_rx_mpdu_status status;
enum htt_rx_mpdu_encrypt_type encrypt_type;
- s8 signal;
struct {
u8 info0;
u32 info1;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 2fca1fa..fa6540b 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -775,8 +775,6 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
if (info->amsdu_more)
status->flag |= RX_FLAG_AMSDU_MORE;

- status->signal = info->signal;
-
spin_lock_bh(&ar->data_lock);
ch = ar->scan_channel;
if (!ch)
@@ -1164,8 +1162,8 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
mpdu_ranges = htt_rx_ind_get_mpdu_ranges(rx);

/* Fill this once, while this is per-ppdu */
- info.signal = ATH10K_DEFAULT_NOISE_FLOOR;
- info.signal += rx->ppdu.combined_rssi;
+ info.rx_status.signal = ATH10K_DEFAULT_NOISE_FLOOR;
+ info.rx_status.signal += rx->ppdu.combined_rssi;

info.rate.info0 = rx->ppdu.info0;
info.rate.info1 = __le32_to_cpu(rx->ppdu.info1);
--
1.7.9.5


2014-03-04 12:53:00

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 12/14] ath10k: kill encrypt_type from htt_rx_info

Setup flags directly in ieee80211_rx_status.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt.h | 1 -
drivers/net/wireless/ath/ath10k/htt_rx.c | 48 +++++++++++++++++++-----------
2 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 7ebbd8b..870f807 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1176,7 +1176,6 @@ struct htt_peer_unmap_event {
struct htt_rx_info {
struct sk_buff *skb;
struct ieee80211_rx_status rx_status;
- enum htt_rx_mpdu_encrypt_type encrypt_type;
};

struct ath10k_htt_txbuf {
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 976499d..555aecf 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -767,22 +767,34 @@ static bool ath10k_htt_rx_h_channel(struct ath10k *ar,
return true;
}

-static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
+static void ath10k_htt_rx_h_protected(struct ath10k_htt *htt,
+ struct htt_rx_info *info,
+ enum htt_rx_mpdu_encrypt_type enctype)
{
- struct ieee80211_rx_status *status;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)info->skb->data;

- status = IEEE80211_SKB_RXCB(info->skb);
- memcpy(status, &info->rx_status, sizeof(*status));
-
- if (info->encrypt_type != HTT_RX_MPDU_ENCRYPT_NONE) {
- status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED |
- RX_FLAG_MMIC_STRIPPED;
+ if (enctype != HTT_RX_MPDU_ENCRYPT_NONE) {
+ info->rx_status.flag |= RX_FLAG_DECRYPTED |
+ RX_FLAG_IV_STRIPPED |
+ RX_FLAG_MMIC_STRIPPED;
hdr->frame_control = __cpu_to_le16(
__le16_to_cpu(hdr->frame_control) &
- ~IEEE80211_FCTL_PROTECTED);
+ ~IEEE80211_FCTL_PROTECTED);
+ return;
}

+ info->rx_status.flag &= ~(RX_FLAG_DECRYPTED |
+ RX_FLAG_IV_STRIPPED |
+ RX_FLAG_MMIC_STRIPPED);
+}
+
+static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
+{
+ struct ieee80211_rx_status *status;
+
+ status = IEEE80211_SKB_RXCB(info->skb);
+ memcpy(status, &info->rx_status, sizeof(*status));
+
ath10k_dbg(ATH10K_DBG_DATA,
"rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i\n",
info->skb,
@@ -897,7 +909,7 @@ static void ath10k_htt_rx_amsdu(struct ath10k_htt *htt,
}

info->skb = skb;
- info->encrypt_type = enctype;
+ ath10k_htt_rx_h_protected(htt, info, enctype);
skb = skb->next;
info->skb->next = NULL;

@@ -979,7 +991,7 @@ static void ath10k_htt_rx_msdu(struct ath10k_htt *htt, struct htt_rx_info *info)
}

info->skb = skb;
- info->encrypt_type = enctype;
+ ath10k_htt_rx_h_protected(htt, info, enctype);

ath10k_process_rx(htt->ar, info);
}
@@ -1243,6 +1255,7 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,
struct htt_rx_fragment_indication *frag)
{
struct sk_buff *msdu_head, *msdu_tail;
+ enum htt_rx_mpdu_encrypt_type enctype;
struct htt_rx_desc *rxd;
enum rx_msdu_decap_format fmt;
struct htt_rx_info info = {};
@@ -1296,8 +1309,9 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,
}

info.skb = msdu_head;
- info.encrypt_type = MS(__le32_to_cpu(rxd->mpdu_start.info0),
- RX_MPDU_START_INFO0_ENCRYPT_TYPE);
+ enctype = MS(__le32_to_cpu(rxd->mpdu_start.info0),
+ RX_MPDU_START_INFO0_ENCRYPT_TYPE);
+ ath10k_htt_rx_h_protected(htt, &info, enctype);
info.skb->ip_summed = ath10k_htt_rx_get_csum_state(info.skb);

if (tkip_mic_err)
@@ -1309,9 +1323,9 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,
goto end;
}

- if (info.encrypt_type != HTT_RX_MPDU_ENCRYPT_NONE) {
+ if (enctype != HTT_RX_MPDU_ENCRYPT_NONE) {
hdrlen = ieee80211_hdrlen(hdr->frame_control);
- paramlen = ath10k_htt_rx_crypto_param_len(info.encrypt_type);
+ paramlen = ath10k_htt_rx_crypto_param_len(enctype);

/* It is more efficient to move the header than the payload */
memmove((void *)info.skb->data + paramlen,
@@ -1325,11 +1339,11 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,
trim = 4;

/* remove crypto trailer */
- trim += ath10k_htt_rx_crypto_tail_len(info.encrypt_type);
+ trim += ath10k_htt_rx_crypto_tail_len(enctype);

/* last fragment of TKIP frags has MIC */
if (!ieee80211_has_morefrags(hdr->frame_control) &&
- info.encrypt_type == HTT_RX_MPDU_ENCRYPT_TKIP_WPA)
+ enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA)
trim += 8;

if (trim > info.skb->len) {
--
1.7.9.5


2014-03-04 12:52:58

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 10/14] ath10k: kill mic_err/amsdu_more from htt_rx_info

Setup this directly in ieee80211_rx_status.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt.h | 2 --
drivers/net/wireless/ath/ath10k/htt_rx.c | 20 ++++++++++----------
2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 1713c70..d3d2f01 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1178,8 +1178,6 @@ struct htt_rx_info {
struct ieee80211_rx_status rx_status;
enum htt_rx_mpdu_status status;
enum htt_rx_mpdu_encrypt_type encrypt_type;
- bool amsdu_more;
- bool mic_err;
};

struct ath10k_htt_txbuf {
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 35a7ae15..3aa5a61 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -783,12 +783,6 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
~IEEE80211_FCTL_PROTECTED);
}

- if (info->mic_err)
- status->flag |= RX_FLAG_MMIC_ERROR;
-
- if (info->amsdu_more)
- status->flag |= RX_FLAG_AMSDU_MORE;
-
ath10k_dbg(ATH10K_DBG_DATA,
"rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i\n",
info->skb,
@@ -908,7 +902,9 @@ static void ath10k_htt_rx_amsdu(struct ath10k_htt *htt,
info->skb->next = NULL;

if (skb)
- info->amsdu_more = true;
+ info->rx_status.flag |= RX_FLAG_AMSDU_MORE;
+ else
+ info->rx_status.flag &= ~RX_FLAG_AMSDU_MORE;

ath10k_process_rx(htt->ar, info);
}
@@ -1147,7 +1143,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
int num_mpdu_ranges;
int fw_desc_len;
u8 *fw_desc;
- bool channel_set, fcs_err;
+ bool channel_set, fcs_err, mic_err;
int i, j;

lockdep_assert_held(&htt->rx_ring.lock);
@@ -1218,13 +1214,17 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
else
info.rx_status.flag &= ~RX_FLAG_FAILED_FCS_CRC;

- info.mic_err = ath10k_htt_rx_has_mic_err(msdu_head);
+ mic_err = ath10k_htt_rx_has_mic_err(msdu_head);
+ if (mic_err)
+ info.rx_status.flag |= RX_FLAG_MMIC_ERROR;
+ else
+ info.rx_status.flag &= ~RX_FLAG_MMIC_ERROR;

if (fcs_err)
ath10k_dbg(ATH10K_DBG_HTT,
"htt rx has FCS err\n");

- if (info.mic_err)
+ if (mic_err)
ath10k_dbg(ATH10K_DBG_HTT,
"htt rx has MIC err\n");

--
1.7.9.5


2014-03-11 10:04:59

by Kalle Valo

[permalink] [raw]
Subject: Re: [RFC 00/14] ath10k: Refactor rx path little bit

Janusz Dziedzic <[email protected]> writes:

> Refactor rx path, mainly split/reduce calculation we
> did before. Now we caculate variable/flags only once
> per-ppdu, while before we did some calculations for
> each mpdu. Kill some not needed code and fill directly
> ieee80211_rx_status structure.
> TP veryfication required.
>
> Janusz Dziedzic (14):
> ath10k: add ath10k_htt_rx_amsdu_allowed function
> ath10k: Fill per-ppdu info in rx_info only once
> ath10k: move rx related functions to htt_rx.c
> ath10k: rename process_rx_rates to ath10k_htt_rx_h_rates
> ath10k: introduce ieee80211_rx_status to htt_rx_info
> ath10k: kill signal field in htt_rx_info
> ath10k: setup rx channel per ppdu
> ath10k: kill rate substruct and tsf from htt_rx_info
> ath10k: kill fcs_err from htt_rx_info
> ath10k: kill mic_err/amsdu_more from htt_rx_info
> ath10k: kill status from htt_rx_info
> ath10k: kill encrypt_type from htt_rx_info
> ath10k: return error when ath10k_htt_rx_amsdu_pop() fail
> ath10k: improve way we play with attention flags

I did now a quick review:

I didn't fully understand your idea with rx status template.

I think the patchset is too long, it will be easier if you split these
into two. First set with all the easy and obvious stuff and a second one
for the rx status template.

Some of the patches are missing commit logs. Even if the patch is
obvious, please write a small commit log. Just oneliner would be enough.

I would prefer the commit logs to answer more why the change is needed.

--
Kalle Valo

2014-03-11 10:00:36

by Kalle Valo

[permalink] [raw]
Subject: Re: [RFC 05/14] ath10k: introduce ieee80211_rx_status to htt_rx_info

Janusz Dziedzic <[email protected]> writes:

> Will be used as a template, and final storage for
> rx_status.
>
> Signed-off-by: Janusz Dziedzic <[email protected]>

I think this patch is too small. It's good to have small atomic commits
but I think goes overboard.

> @@ -1174,6 +1175,7 @@ struct htt_peer_unmap_event {
>
> struct htt_rx_info {
> struct sk_buff *skb;
> + struct ieee80211_rx_status rx_status;
> enum htt_rx_mpdu_status status;
> enum htt_rx_mpdu_encrypt_type encrypt_type;
> s8 signal;
> diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
> index 3008a1d..2fca1fa 100644
> --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
> +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
> @@ -756,7 +756,7 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
> struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)info->skb->data;
>
> status = IEEE80211_SKB_RXCB(info->skb);
> - memset(status, 0, sizeof(*status));
> + memcpy(status, &info->rx_status, sizeof(*status));

So you are idea with the status template is that instead clearing
status, you copy it from the previous frame and reuse it? Why do you
want to do it? Performance reasons?

I didn't fully understand your idea here, but I assume patch 9 is
related as I see that you change the CRC flag handling from this:

- if (info->fcs_err)
- status->flag |= RX_FLAG_FAILED_FCS_CRC;

to this:

+ fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head);
+ if (fcs_err)
+ info.rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
+ else
+ info.rx_status.flag &= ~RX_FLAG_FAILED_FCS_CRC;

I don't really like that clearing the flag part. Can you describe what
is your plan behind this template?

--
Kalle Valo

2014-03-04 12:53:01

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 13/14] ath10k: return error when ath10k_htt_rx_amsdu_pop() fail

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 555aecf..e300a74 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -310,7 +310,7 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,

if (htt->rx_confused) {
ath10k_warn("htt is confused. refusing rx\n");
- return 0;
+ return -1;
}

msdu = *head_msdu = ath10k_htt_rx_netbuf_pop(htt);
@@ -442,6 +442,9 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
}
*tail_msdu = msdu;

+ if (*head_msdu == NULL)
+ msdu_chaining = -1;
+
/*
* Don't refill the ring yet.
*
@@ -1089,11 +1092,6 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,
enum htt_rx_mpdu_status status,
bool channel_set)
{
- if (!head) {
- ath10k_warn("htt rx no data!\n");
- return false;
- }
-
if (head->len == 0) {
ath10k_dbg(ATH10K_DBG_HTT,
"htt rx dropping due to zero-len\n");
@@ -1209,8 +1207,14 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
&msdu_head,
&msdu_tail);

+ if (msdu_chaining == -1) {
+ ath10k_warn("htt rx no data!\n");
+ ath10k_htt_rx_free_msdu_chain(msdu_head);
+ continue;
+ }
+
if (!ath10k_htt_rx_amsdu_allowed(htt, msdu_head,
- !!msdu_chaining,
+ msdu_chaining > 0,
status,
channel_set)) {
ath10k_htt_rx_free_msdu_chain(msdu_head);
@@ -1280,12 +1284,12 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,

ath10k_dbg(ATH10K_DBG_HTT_DUMP, "htt rx frag ahead\n");

- if (!msdu_head) {
+ if (msdu_chaining == -1) {
ath10k_warn("htt rx frag no data\n");
return;
}

- if (msdu_chaining || msdu_head != msdu_tail) {
+ if (msdu_chaining > 0 || msdu_head != msdu_tail) {
ath10k_warn("aggregation with fragmentation?!\n");
ath10k_htt_rx_free_msdu_chain(msdu_head);
return;
--
1.7.9.5


2014-03-04 12:52:55

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 08/14] ath10k: kill rate substruct and tsf from htt_rx_info

Setup rates only once per-ppdu.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt.h | 7 -------
drivers/net/wireless/ath/ath10k/htt_rx.c | 32 +++++++++++++++---------------
2 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 9f5da2b..ea39b87 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1178,13 +1178,6 @@ struct htt_rx_info {
struct ieee80211_rx_status rx_status;
enum htt_rx_mpdu_status status;
enum htt_rx_mpdu_encrypt_type encrypt_type;
- struct {
- u8 info0;
- u32 info1;
- u32 info2;
- } rate;
-
- u32 tsf;
bool fcs_err;
bool amsdu_more;
bool mic_err;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 0c34096..4eca6e6 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -655,14 +655,12 @@ static const u8 rx_legacy_rate_idx[] = {
5, /* 0x0F - 9Mbps */
};

-static void ath10k_htt_rx_h_rates(struct ath10k *ar, struct htt_rx_info *info,
+static void ath10k_htt_rx_h_rates(struct ath10k *ar,
enum ieee80211_band band,
+ u8 info0, u32 info1, u32 info2,
struct ieee80211_rx_status *status)
{
u8 cck, rate, rate_idx, bw, sgi, mcs, nss;
- u8 info0 = info->rate.info0;
- u32 info1 = info->rate.info1;
- u32 info2 = info->rate.info2;
u8 preamble = 0;

/* Check if valid fields */
@@ -794,14 +792,6 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
if (info->amsdu_more)
status->flag |= RX_FLAG_AMSDU_MORE;

- ath10k_htt_rx_h_rates(ar, info, status->band, status);
-
- if (info->rate.info0 & HTT_RX_INDICATION_INFO0_END_VALID) {
- /* TSF available only in 32-bit */
- status->mactime = info->tsf & 0xffffffff;
- status->flag |= RX_FLAG_MACTIME_END;
- }
-
ath10k_dbg(ATH10K_DBG_DATA,
"rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i\n",
info->skb,
@@ -1177,12 +1167,22 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
info.rx_status.signal = ATH10K_DEFAULT_NOISE_FLOOR;
info.rx_status.signal += rx->ppdu.combined_rssi;

+ if (rx->ppdu.info0 & HTT_RX_INDICATION_INFO0_END_VALID) {
+ /* TSF available only in 32-bit */
+ info.rx_status.mactime =
+ __le32_to_cpu(rx->ppdu.tsf) & 0xffffffff;
+ info.rx_status.flag |= RX_FLAG_MACTIME_END;
+ }
+
channel_set = ath10k_htt_rx_h_channel(htt->ar, &info.rx_status);

- info.rate.info0 = rx->ppdu.info0;
- info.rate.info1 = __le32_to_cpu(rx->ppdu.info1);
- info.rate.info2 = __le32_to_cpu(rx->ppdu.info2);
- info.tsf = __le32_to_cpu(rx->ppdu.tsf);
+ if (channel_set) {
+ ath10k_htt_rx_h_rates(htt->ar, info.rx_status.band,
+ rx->ppdu.info0,
+ __le32_to_cpu(rx->ppdu.info1),
+ __le32_to_cpu(rx->ppdu.info2),
+ &info.rx_status);
+ }

ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx ind: ",
rx, sizeof(*rx) +
--
1.7.9.5


2014-03-04 12:52:47

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 01/14] ath10k: add ath10k_htt_rx_amsdu_allowed function

Introduce ath10k_htt_rx_amsdu_allowed() function, that
group code for checking if skip amsdu packets.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 112 ++++++++++++++++--------------
1 file changed, 60 insertions(+), 52 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 36a3871..68a058d 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -901,6 +901,63 @@ static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb)
return CHECKSUM_UNNECESSARY;
}

+static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,
+ struct sk_buff *head,
+ bool msdu_chaining,
+ struct htt_rx_info *info)
+{
+ enum htt_rx_mpdu_status status = info->status;
+
+ if (!head) {
+ ath10k_warn("htt rx no data!\n");
+ return false;
+ }
+
+ if (head->len == 0) {
+ ath10k_dbg(ATH10K_DBG_HTT,
+ "htt rx dropping due to zero-len\n");
+ return false;
+ }
+
+ if (ath10k_htt_rx_has_decrypt_err(head)) {
+ ath10k_dbg(ATH10K_DBG_HTT,
+ "htt rx dropping due to decrypt-err\n");
+ return false;
+ }
+
+ /* Skip mgmt frames while we handle this in WMI */
+ if (status == HTT_RX_IND_MPDU_STATUS_MGMT_CTRL ||
+ ath10k_htt_rx_is_mgmt(head)) {
+ ath10k_dbg(ATH10K_DBG_HTT, "htt rx mgmt ctrl\n");
+ return false;
+ }
+
+ if (status != HTT_RX_IND_MPDU_STATUS_OK &&
+ status != HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR &&
+ status != HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER &&
+ !htt->ar->monitor_enabled) {
+ ath10k_dbg(ATH10K_DBG_HTT,
+ "htt rx ignoring frame w/ status %d\n",
+ status);
+ return false;
+ }
+
+ if (test_bit(ATH10K_CAC_RUNNING, &htt->ar->dev_flags)) {
+ ath10k_dbg(ATH10K_DBG_HTT,
+ "htt rx CAC running\n");
+ return false;
+ }
+
+ /* FIXME: we do not support chaining yet.
+ * this needs investigation */
+ if (msdu_chaining) {
+ ath10k_warn("htt rx msdu_chaining is true\n");
+ return false;
+ }
+
+ return true;
+}
+
static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
struct htt_rx_indication *rx)
{
@@ -933,7 +990,6 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,

for (j = 0; j < mpdu_ranges[i].mpdu_count; j++) {
struct sk_buff *msdu_head, *msdu_tail;
- enum htt_rx_mpdu_status status;
int msdu_chaining;

msdu_head = NULL;
@@ -944,57 +1000,9 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
&msdu_head,
&msdu_tail);

- if (!msdu_head) {
- ath10k_warn("htt rx no data!\n");
- continue;
- }
-
- if (msdu_head->len == 0) {
- ath10k_dbg(ATH10K_DBG_HTT,
- "htt rx dropping due to zero-len\n");
- ath10k_htt_rx_free_msdu_chain(msdu_head);
- continue;
- }
-
- if (ath10k_htt_rx_has_decrypt_err(msdu_head)) {
- ath10k_dbg(ATH10K_DBG_HTT,
- "htt rx dropping due to decrypt-err\n");
- ath10k_htt_rx_free_msdu_chain(msdu_head);
- continue;
- }
-
- status = info.status;
-
- /* Skip mgmt frames while we handle this in WMI */
- if (status == HTT_RX_IND_MPDU_STATUS_MGMT_CTRL ||
- ath10k_htt_rx_is_mgmt(msdu_head)) {
- ath10k_dbg(ATH10K_DBG_HTT, "htt rx mgmt ctrl\n");
- ath10k_htt_rx_free_msdu_chain(msdu_head);
- continue;
- }
-
- if (status != HTT_RX_IND_MPDU_STATUS_OK &&
- status != HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR &&
- status != HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER &&
- !htt->ar->monitor_enabled) {
- ath10k_dbg(ATH10K_DBG_HTT,
- "htt rx ignoring frame w/ status %d\n",
- status);
- ath10k_htt_rx_free_msdu_chain(msdu_head);
- continue;
- }
-
- if (test_bit(ATH10K_CAC_RUNNING, &htt->ar->dev_flags)) {
- ath10k_dbg(ATH10K_DBG_HTT,
- "htt rx CAC running\n");
- ath10k_htt_rx_free_msdu_chain(msdu_head);
- continue;
- }
-
- /* FIXME: we do not support chaining yet.
- * this needs investigation */
- if (msdu_chaining) {
- ath10k_warn("htt rx msdu_chaining is true\n");
+ if (!ath10k_htt_rx_amsdu_allowed(htt, msdu_head,
+ !!msdu_chaining,
+ &info)) {
ath10k_htt_rx_free_msdu_chain(msdu_head);
continue;
}
--
1.7.9.5


2014-03-04 12:52:57

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 09/14] ath10k: kill fcs_err from htt_rx_info

Setup this directly in ieee80211_rx_status.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt.h | 1 -
drivers/net/wireless/ath/ath10k/htt_rx.c | 18 +++++++++++-------
2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index ea39b87..1713c70 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1178,7 +1178,6 @@ struct htt_rx_info {
struct ieee80211_rx_status rx_status;
enum htt_rx_mpdu_status status;
enum htt_rx_mpdu_encrypt_type encrypt_type;
- bool fcs_err;
bool amsdu_more;
bool mic_err;
};
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 4eca6e6..35a7ae15 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -786,9 +786,6 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
if (info->mic_err)
status->flag |= RX_FLAG_MMIC_ERROR;

- if (info->fcs_err)
- status->flag |= RX_FLAG_FAILED_FCS_CRC;
-
if (info->amsdu_more)
status->flag |= RX_FLAG_AMSDU_MORE;

@@ -805,7 +802,8 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
status->rate_idx,
status->vht_nss,
status->freq,
- status->band, status->flag, info->fcs_err);
+ status->band, status->flag,
+ !!(status->flag & RX_FLAG_FAILED_FCS_CRC));
ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "rx skb: ",
info->skb->data, info->skb->len);

@@ -1149,7 +1147,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
int num_mpdu_ranges;
int fw_desc_len;
u8 *fw_desc;
- bool channel_set;
+ bool channel_set, fcs_err;
int i, j;

lockdep_assert_held(&htt->rx_ring.lock);
@@ -1213,10 +1211,16 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
}

info.skb = msdu_head;
- info.fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head);
+
+ fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head);
+ if (fcs_err)
+ info.rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
+ else
+ info.rx_status.flag &= ~RX_FLAG_FAILED_FCS_CRC;
+
info.mic_err = ath10k_htt_rx_has_mic_err(msdu_head);

- if (info.fcs_err)
+ if (fcs_err)
ath10k_dbg(ATH10K_DBG_HTT,
"htt rx has FCS err\n");

--
1.7.9.5


2014-03-04 12:52:59

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 11/14] ath10k: kill status from htt_rx_info

Not needed/used in htt_rx_info.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt.h | 1 -
drivers/net/wireless/ath/ath10k/htt_rx.c | 14 +++++---------
2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index d3d2f01..7ebbd8b 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1176,7 +1176,6 @@ struct htt_peer_unmap_event {
struct htt_rx_info {
struct sk_buff *skb;
struct ieee80211_rx_status rx_status;
- enum htt_rx_mpdu_status status;
enum htt_rx_mpdu_encrypt_type encrypt_type;
};

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 3aa5a61..976499d 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1074,11 +1074,9 @@ static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb)
static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,
struct sk_buff *head,
bool msdu_chaining,
- struct htt_rx_info *info,
+ enum htt_rx_mpdu_status status,
bool channel_set)
{
- enum htt_rx_mpdu_status status = info->status;
-
if (!head) {
ath10k_warn("htt rx no data!\n");
return false;
@@ -1139,6 +1137,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
{
struct htt_rx_info info;
struct htt_rx_indication_mpdu_range *mpdu_ranges;
+ enum htt_rx_mpdu_status status;
struct ieee80211_hdr *hdr;
int num_mpdu_ranges;
int fw_desc_len;
@@ -1184,7 +1183,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
num_mpdu_ranges));

for (i = 0; i < num_mpdu_ranges; i++) {
- info.status = mpdu_ranges[i].mpdu_range_status;
+ status = mpdu_ranges[i].mpdu_range_status;

for (j = 0; j < mpdu_ranges[i].mpdu_count; j++) {
struct sk_buff *msdu_head, *msdu_tail;
@@ -1200,7 +1199,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,

if (!ath10k_htt_rx_amsdu_allowed(htt, msdu_head,
!!msdu_chaining,
- &info,
+ status,
channel_set)) {
ath10k_htt_rx_free_msdu_chain(msdu_head);
continue;
@@ -1297,15 +1296,12 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,
}

info.skb = msdu_head;
- info.status = HTT_RX_IND_MPDU_STATUS_OK;
info.encrypt_type = MS(__le32_to_cpu(rxd->mpdu_start.info0),
RX_MPDU_START_INFO0_ENCRYPT_TYPE);
info.skb->ip_summed = ath10k_htt_rx_get_csum_state(info.skb);

- if (tkip_mic_err) {
+ if (tkip_mic_err)
ath10k_warn("tkip mic error\n");
- info.status = HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR;
- }

if (decrypt_err) {
ath10k_warn("decryption err in fragmented rx\n");
--
1.7.9.5


2014-03-19 08:39:16

by Janusz Dziedzic

[permalink] [raw]
Subject: Re: [RFC 00/14] ath10k: Refactor rx path little bit

On 11 March 2014 11:04, Kalle Valo <[email protected]> wrote:
> Janusz Dziedzic <[email protected]> writes:
>
>> Refactor rx path, mainly split/reduce calculation we
>> did before. Now we caculate variable/flags only once
>> per-ppdu, while before we did some calculations for
>> each mpdu. Kill some not needed code and fill directly
>> ieee80211_rx_status structure.
>> TP veryfication required.
>>
>> Janusz Dziedzic (14):
>> ath10k: add ath10k_htt_rx_amsdu_allowed function
>> ath10k: Fill per-ppdu info in rx_info only once
>> ath10k: move rx related functions to htt_rx.c
>> ath10k: rename process_rx_rates to ath10k_htt_rx_h_rates
>> ath10k: introduce ieee80211_rx_status to htt_rx_info
>> ath10k: kill signal field in htt_rx_info
>> ath10k: setup rx channel per ppdu
>> ath10k: kill rate substruct and tsf from htt_rx_info
>> ath10k: kill fcs_err from htt_rx_info
>> ath10k: kill mic_err/amsdu_more from htt_rx_info
>> ath10k: kill status from htt_rx_info
>> ath10k: kill encrypt_type from htt_rx_info
>> ath10k: return error when ath10k_htt_rx_amsdu_pop() fail
>> ath10k: improve way we play with attention flags
>
> I did now a quick review:
>
> I didn't fully understand your idea with rx status template.
>
Mainly I split calculations we have to do per-ppdu and per-mpdu.
Before, we did calculation for each mpdu even that wasn't required. In
case of heavy
traffic we will have eg. 15 mpdus in one ppdu. In case of attention flags
we did 4 times __cpu_to_le32() for each rx`ed packet - while one calculation
will be enough. For me this seems like resources (CPU) usage improvement.

After some refactoring tries I decided to introduce this
ieee80211_rx_status template. Seems this is easiest option here.
This will be also similar code as we have already for fragmented RX packets.

Some patches are just some code cleanup (moving code, grouping in
function etc...)

> I think the patchset is too long, it will be easier if you split these
> into two. First set with all the easy and obvious stuff and a second one
> for the rx status template.
>
Will send V2

> Some of the patches are missing commit logs. Even if the patch is
> obvious, please write a small commit log. Just oneliner would be enough.
>
> I would prefer the commit logs to answer more why the change is needed.
>
> --
> Kalle Valo

2014-03-04 12:52:48

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 02/14] ath10k: Fill per-ppdu info in rx_info only once

Don't fill this for each msdu, while this is the
same.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 68a058d..0d0862d 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -980,6 +980,15 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES);
mpdu_ranges = htt_rx_ind_get_mpdu_ranges(rx);

+ /* Fill this once, while this is per-ppdu */
+ info.signal = ATH10K_DEFAULT_NOISE_FLOOR;
+ info.signal += rx->ppdu.combined_rssi;
+
+ info.rate.info0 = rx->ppdu.info0;
+ info.rate.info1 = __le32_to_cpu(rx->ppdu.info1);
+ info.rate.info2 = __le32_to_cpu(rx->ppdu.info2);
+ info.tsf = __le32_to_cpu(rx->ppdu.tsf);
+
ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx ind: ",
rx, sizeof(*rx) +
(sizeof(struct htt_rx_indication_mpdu_range) *
@@ -1019,14 +1028,6 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
ath10k_dbg(ATH10K_DBG_HTT,
"htt rx has MIC err\n");

- info.signal = ATH10K_DEFAULT_NOISE_FLOOR;
- info.signal += rx->ppdu.combined_rssi;
-
- info.rate.info0 = rx->ppdu.info0;
- info.rate.info1 = __le32_to_cpu(rx->ppdu.info1);
- info.rate.info2 = __le32_to_cpu(rx->ppdu.info2);
- info.tsf = __le32_to_cpu(rx->ppdu.tsf);
-
hdr = ath10k_htt_rx_skb_get_hdr(msdu_head);

if (ath10k_htt_rx_hdr_is_amsdu(hdr))
--
1.7.9.5


2014-03-04 12:52:54

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 07/14] ath10k: setup rx channel per ppdu

Setup band and frequency in ieee80211_rx_status
only once - for ppdu.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 51 +++++++++++++++++++-----------
1 file changed, 33 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index fa6540b..0c34096 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -749,10 +749,29 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar, struct htt_rx_info *info,
}
}

+static bool ath10k_htt_rx_h_channel(struct ath10k *ar,
+ struct ieee80211_rx_status *status)
+{
+ struct ieee80211_channel *ch;
+
+ spin_lock_bh(&ar->data_lock);
+ ch = ar->scan_channel;
+ if (!ch)
+ ch = ar->rx_channel;
+ spin_unlock_bh(&ar->data_lock);
+
+ if (!ch)
+ return false;
+
+ status->band = ch->band;
+ status->freq = ch->center_freq;
+
+ return true;
+}
+
static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
{
struct ieee80211_rx_status *status;
- struct ieee80211_channel *ch;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)info->skb->data;

status = IEEE80211_SKB_RXCB(info->skb);
@@ -775,21 +794,7 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
if (info->amsdu_more)
status->flag |= RX_FLAG_AMSDU_MORE;

- spin_lock_bh(&ar->data_lock);
- ch = ar->scan_channel;
- if (!ch)
- ch = ar->rx_channel;
- spin_unlock_bh(&ar->data_lock);
-
- if (!ch) {
- ath10k_warn("no channel configured; ignoring frame!\n");
- dev_kfree_skb_any(info->skb);
- return;
- }
-
- ath10k_htt_rx_h_rates(ar, info, ch->band, status);
- status->band = ch->band;
- status->freq = ch->center_freq;
+ ath10k_htt_rx_h_rates(ar, info, status->band, status);

if (info->rate.info0 & HTT_RX_INDICATION_INFO0_END_VALID) {
/* TSF available only in 32-bit */
@@ -1085,7 +1090,8 @@ static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb)
static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,
struct sk_buff *head,
bool msdu_chaining,
- struct htt_rx_info *info)
+ struct htt_rx_info *info,
+ bool channel_set)
{
enum htt_rx_mpdu_status status = info->status;

@@ -1106,6 +1112,11 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,
return false;
}

+ if (!channel_set) {
+ ath10k_warn("no channel configured; ignoring frame!\n");
+ return false;
+ }
+
/* Skip mgmt frames while we handle this in WMI */
if (status == HTT_RX_IND_MPDU_STATUS_MGMT_CTRL ||
ath10k_htt_rx_is_mgmt(head)) {
@@ -1148,6 +1159,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
int num_mpdu_ranges;
int fw_desc_len;
u8 *fw_desc;
+ bool channel_set;
int i, j;

lockdep_assert_held(&htt->rx_ring.lock);
@@ -1165,6 +1177,8 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
info.rx_status.signal = ATH10K_DEFAULT_NOISE_FLOOR;
info.rx_status.signal += rx->ppdu.combined_rssi;

+ channel_set = ath10k_htt_rx_h_channel(htt->ar, &info.rx_status);
+
info.rate.info0 = rx->ppdu.info0;
info.rate.info1 = __le32_to_cpu(rx->ppdu.info1);
info.rate.info2 = __le32_to_cpu(rx->ppdu.info2);
@@ -1192,7 +1206,8 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,

if (!ath10k_htt_rx_amsdu_allowed(htt, msdu_head,
!!msdu_chaining,
- &info)) {
+ &info,
+ channel_set)) {
ath10k_htt_rx_free_msdu_chain(msdu_head);
continue;
}
--
1.7.9.5


2014-03-04 12:52:50

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 04/14] ath10k: rename process_rx_rates to ath10k_htt_rx_h_rates

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index ad3918c..3008a1d 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -655,9 +655,9 @@ static const u8 rx_legacy_rate_idx[] = {
5, /* 0x0F - 9Mbps */
};

-static void process_rx_rates(struct ath10k *ar, struct htt_rx_info *info,
- enum ieee80211_band band,
- struct ieee80211_rx_status *status)
+static void ath10k_htt_rx_h_rates(struct ath10k *ar, struct htt_rx_info *info,
+ enum ieee80211_band band,
+ struct ieee80211_rx_status *status)
{
u8 cck, rate, rate_idx, bw, sgi, mcs, nss;
u8 info0 = info->rate.info0;
@@ -789,7 +789,7 @@ static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
return;
}

- process_rx_rates(ar, info, ch->band, status);
+ ath10k_htt_rx_h_rates(ar, info, ch->band, status);
status->band = ch->band;
status->freq = ch->center_freq;

--
1.7.9.5


2014-03-04 12:53:04

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 14/14] ath10k: improve way we play with attention flags

Remove almost the same code, and do only once
__le32_to_cpu() conversion.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 77 ++++++------------------------
1 file changed, 15 insertions(+), 62 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index e300a74..a70e38e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -999,62 +999,6 @@ static void ath10k_htt_rx_msdu(struct ath10k_htt *htt, struct htt_rx_info *info)
ath10k_process_rx(htt->ar, info);
}

-static bool ath10k_htt_rx_has_decrypt_err(struct sk_buff *skb)
-{
- struct htt_rx_desc *rxd;
- u32 flags;
-
- rxd = (void *)skb->data - sizeof(*rxd);
- flags = __le32_to_cpu(rxd->attention.flags);
-
- if (flags & RX_ATTENTION_FLAGS_DECRYPT_ERR)
- return true;
-
- return false;
-}
-
-static bool ath10k_htt_rx_has_fcs_err(struct sk_buff *skb)
-{
- struct htt_rx_desc *rxd;
- u32 flags;
-
- rxd = (void *)skb->data - sizeof(*rxd);
- flags = __le32_to_cpu(rxd->attention.flags);
-
- if (flags & RX_ATTENTION_FLAGS_FCS_ERR)
- return true;
-
- return false;
-}
-
-static bool ath10k_htt_rx_has_mic_err(struct sk_buff *skb)
-{
- struct htt_rx_desc *rxd;
- u32 flags;
-
- rxd = (void *)skb->data - sizeof(*rxd);
- flags = __le32_to_cpu(rxd->attention.flags);
-
- if (flags & RX_ATTENTION_FLAGS_TKIP_MIC_ERR)
- return true;
-
- return false;
-}
-
-static bool ath10k_htt_rx_is_mgmt(struct sk_buff *skb)
-{
- struct htt_rx_desc *rxd;
- u32 flags;
-
- rxd = (void *)skb->data - sizeof(*rxd);
- flags = __le32_to_cpu(rxd->attention.flags);
-
- if (flags & RX_ATTENTION_FLAGS_MGMT_TYPE)
- return true;
-
- return false;
-}
-
static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb)
{
struct htt_rx_desc *rxd;
@@ -1090,7 +1034,8 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,
struct sk_buff *head,
bool msdu_chaining,
enum htt_rx_mpdu_status status,
- bool channel_set)
+ bool channel_set,
+ u32 attention)
{
if (head->len == 0) {
ath10k_dbg(ATH10K_DBG_HTT,
@@ -1098,7 +1043,7 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,
return false;
}

- if (ath10k_htt_rx_has_decrypt_err(head)) {
+ if (attention & RX_ATTENTION_FLAGS_DECRYPT_ERR) {
ath10k_dbg(ATH10K_DBG_HTT,
"htt rx dropping due to decrypt-err\n");
return false;
@@ -1111,7 +1056,7 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k_htt *htt,

/* Skip mgmt frames while we handle this in WMI */
if (status == HTT_RX_IND_MPDU_STATUS_MGMT_CTRL ||
- ath10k_htt_rx_is_mgmt(head)) {
+ attention & RX_ATTENTION_FLAGS_MGMT_TYPE) {
ath10k_dbg(ATH10K_DBG_HTT, "htt rx mgmt ctrl\n");
return false;
}
@@ -1147,9 +1092,11 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
{
struct htt_rx_info info;
struct htt_rx_indication_mpdu_range *mpdu_ranges;
+ struct htt_rx_desc *rxd;
enum htt_rx_mpdu_status status;
struct ieee80211_hdr *hdr;
int num_mpdu_ranges;
+ u32 attention;
int fw_desc_len;
u8 *fw_desc;
bool channel_set, fcs_err, mic_err;
@@ -1213,23 +1160,29 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
continue;
}

+ rxd = container_of((void *) msdu_head->data,
+ struct htt_rx_desc,
+ msdu_payload);
+ attention = __le32_to_cpu(rxd->attention.flags);
+
if (!ath10k_htt_rx_amsdu_allowed(htt, msdu_head,
msdu_chaining > 0,
status,
- channel_set)) {
+ channel_set,
+ attention)) {
ath10k_htt_rx_free_msdu_chain(msdu_head);
continue;
}

info.skb = msdu_head;

- fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head);
+ fcs_err = !!(attention & RX_ATTENTION_FLAGS_FCS_ERR);
if (fcs_err)
info.rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
else
info.rx_status.flag &= ~RX_FLAG_FAILED_FCS_CRC;

- mic_err = ath10k_htt_rx_has_mic_err(msdu_head);
+ mic_err = !!(attention & RX_ATTENTION_FLAGS_TKIP_MIC_ERR);
if (mic_err)
info.rx_status.flag |= RX_FLAG_MMIC_ERROR;
else
--
1.7.9.5


2014-03-04 12:52:49

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC 03/14] ath10k: move rx related functions to htt_rx.c

No functional changes.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 183 ++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath10k/txrx.c | 183 ------------------------------
drivers/net/wireless/ath/ath10k/txrx.h | 1 -
3 files changed, 183 insertions(+), 184 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 0d0862d..ad3918c 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -636,6 +636,189 @@ struct amsdu_subframe_hdr {
__be16 len;
} __packed;

+static const u8 rx_legacy_rate_idx[] = {
+ 3, /* 0x00 - 11Mbps */
+ 2, /* 0x01 - 5.5Mbps */
+ 1, /* 0x02 - 2Mbps */
+ 0, /* 0x03 - 1Mbps */
+ 3, /* 0x04 - 11Mbps */
+ 2, /* 0x05 - 5.5Mbps */
+ 1, /* 0x06 - 2Mbps */
+ 0, /* 0x07 - 1Mbps */
+ 10, /* 0x08 - 48Mbps */
+ 8, /* 0x09 - 24Mbps */
+ 6, /* 0x0A - 12Mbps */
+ 4, /* 0x0B - 6Mbps */
+ 11, /* 0x0C - 54Mbps */
+ 9, /* 0x0D - 36Mbps */
+ 7, /* 0x0E - 18Mbps */
+ 5, /* 0x0F - 9Mbps */
+};
+
+static void process_rx_rates(struct ath10k *ar, struct htt_rx_info *info,
+ enum ieee80211_band band,
+ struct ieee80211_rx_status *status)
+{
+ u8 cck, rate, rate_idx, bw, sgi, mcs, nss;
+ u8 info0 = info->rate.info0;
+ u32 info1 = info->rate.info1;
+ u32 info2 = info->rate.info2;
+ u8 preamble = 0;
+
+ /* Check if valid fields */
+ if (!(info0 & HTT_RX_INDICATION_INFO0_START_VALID))
+ return;
+
+ preamble = MS(info1, HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE);
+
+ switch (preamble) {
+ case HTT_RX_LEGACY:
+ cck = info0 & HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK;
+ rate = MS(info0, HTT_RX_INDICATION_INFO0_LEGACY_RATE);
+ rate_idx = 0;
+
+ if (rate < 0x08 || rate > 0x0F)
+ break;
+
+ switch (band) {
+ case IEEE80211_BAND_2GHZ:
+ if (cck)
+ rate &= ~BIT(3);
+ rate_idx = rx_legacy_rate_idx[rate];
+ break;
+ case IEEE80211_BAND_5GHZ:
+ rate_idx = rx_legacy_rate_idx[rate];
+ /* We are using same rate table registering
+ HW - ath10k_rates[]. In case of 5GHz skip
+ CCK rates, so -4 here */
+ rate_idx -= 4;
+ break;
+ default:
+ break;
+ }
+
+ status->rate_idx = rate_idx;
+ break;
+ case HTT_RX_HT:
+ case HTT_RX_HT_WITH_TXBF:
+ /* HT-SIG - Table 20-11 in info1 and info2 */
+ mcs = info1 & 0x1F;
+ nss = mcs >> 3;
+ bw = (info1 >> 7) & 1;
+ sgi = (info2 >> 7) & 1;
+
+ status->rate_idx = mcs;
+ status->flag |= RX_FLAG_HT;
+ if (sgi)
+ status->flag |= RX_FLAG_SHORT_GI;
+ if (bw)
+ status->flag |= RX_FLAG_40MHZ;
+ break;
+ case HTT_RX_VHT:
+ case HTT_RX_VHT_WITH_TXBF:
+ /* VHT-SIG-A1 in info 1, VHT-SIG-A2 in info2
+ TODO check this */
+ mcs = (info2 >> 4) & 0x0F;
+ nss = ((info1 >> 10) & 0x07) + 1;
+ bw = info1 & 3;
+ sgi = info2 & 1;
+
+ status->rate_idx = mcs;
+ status->vht_nss = nss;
+
+ if (sgi)
+ status->flag |= RX_FLAG_SHORT_GI;
+
+ switch (bw) {
+ /* 20MHZ */
+ case 0:
+ break;
+ /* 40MHZ */
+ case 1:
+ status->flag |= RX_FLAG_40MHZ;
+ break;
+ /* 80MHZ */
+ case 2:
+ status->vht_flag |= RX_VHT_FLAG_80MHZ;
+ }
+
+ status->flag |= RX_FLAG_VHT;
+ break;
+ default:
+ break;
+ }
+}
+
+static void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
+{
+ struct ieee80211_rx_status *status;
+ struct ieee80211_channel *ch;
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)info->skb->data;
+
+ status = IEEE80211_SKB_RXCB(info->skb);
+ memset(status, 0, sizeof(*status));
+
+ if (info->encrypt_type != HTT_RX_MPDU_ENCRYPT_NONE) {
+ status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED |
+ RX_FLAG_MMIC_STRIPPED;
+ hdr->frame_control = __cpu_to_le16(
+ __le16_to_cpu(hdr->frame_control) &
+ ~IEEE80211_FCTL_PROTECTED);
+ }
+
+ if (info->mic_err)
+ status->flag |= RX_FLAG_MMIC_ERROR;
+
+ if (info->fcs_err)
+ status->flag |= RX_FLAG_FAILED_FCS_CRC;
+
+ if (info->amsdu_more)
+ status->flag |= RX_FLAG_AMSDU_MORE;
+
+ status->signal = info->signal;
+
+ spin_lock_bh(&ar->data_lock);
+ ch = ar->scan_channel;
+ if (!ch)
+ ch = ar->rx_channel;
+ spin_unlock_bh(&ar->data_lock);
+
+ if (!ch) {
+ ath10k_warn("no channel configured; ignoring frame!\n");
+ dev_kfree_skb_any(info->skb);
+ return;
+ }
+
+ process_rx_rates(ar, info, ch->band, status);
+ status->band = ch->band;
+ status->freq = ch->center_freq;
+
+ if (info->rate.info0 & HTT_RX_INDICATION_INFO0_END_VALID) {
+ /* TSF available only in 32-bit */
+ status->mactime = info->tsf & 0xffffffff;
+ status->flag |= RX_FLAG_MACTIME_END;
+ }
+
+ ath10k_dbg(ATH10K_DBG_DATA,
+ "rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i\n",
+ info->skb,
+ info->skb->len,
+ status->flag == 0 ? "legacy" : "",
+ status->flag & RX_FLAG_HT ? "ht" : "",
+ status->flag & RX_FLAG_VHT ? "vht" : "",
+ status->flag & RX_FLAG_40MHZ ? "40" : "",
+ status->vht_flag & RX_VHT_FLAG_80MHZ ? "80" : "",
+ status->flag & RX_FLAG_SHORT_GI ? "sgi " : "",
+ status->rate_idx,
+ status->vht_nss,
+ status->freq,
+ status->band, status->flag, info->fcs_err);
+ ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "rx skb: ",
+ info->skb->data, info->skb->len);
+
+ ieee80211_rx(ar->hw, info->skb);
+}
+
static int ath10k_htt_rx_nwifi_hdrlen(struct ieee80211_hdr *hdr)
{
/* nwifi header is padded to 4 bytes. this fixes 4addr rx */
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 0541dd9..82669a7 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -100,189 +100,6 @@ exit:
wake_up(&htt->empty_tx_wq);
}

-static const u8 rx_legacy_rate_idx[] = {
- 3, /* 0x00 - 11Mbps */
- 2, /* 0x01 - 5.5Mbps */
- 1, /* 0x02 - 2Mbps */
- 0, /* 0x03 - 1Mbps */
- 3, /* 0x04 - 11Mbps */
- 2, /* 0x05 - 5.5Mbps */
- 1, /* 0x06 - 2Mbps */
- 0, /* 0x07 - 1Mbps */
- 10, /* 0x08 - 48Mbps */
- 8, /* 0x09 - 24Mbps */
- 6, /* 0x0A - 12Mbps */
- 4, /* 0x0B - 6Mbps */
- 11, /* 0x0C - 54Mbps */
- 9, /* 0x0D - 36Mbps */
- 7, /* 0x0E - 18Mbps */
- 5, /* 0x0F - 9Mbps */
-};
-
-static void process_rx_rates(struct ath10k *ar, struct htt_rx_info *info,
- enum ieee80211_band band,
- struct ieee80211_rx_status *status)
-{
- u8 cck, rate, rate_idx, bw, sgi, mcs, nss;
- u8 info0 = info->rate.info0;
- u32 info1 = info->rate.info1;
- u32 info2 = info->rate.info2;
- u8 preamble = 0;
-
- /* Check if valid fields */
- if (!(info0 & HTT_RX_INDICATION_INFO0_START_VALID))
- return;
-
- preamble = MS(info1, HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE);
-
- switch (preamble) {
- case HTT_RX_LEGACY:
- cck = info0 & HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK;
- rate = MS(info0, HTT_RX_INDICATION_INFO0_LEGACY_RATE);
- rate_idx = 0;
-
- if (rate < 0x08 || rate > 0x0F)
- break;
-
- switch (band) {
- case IEEE80211_BAND_2GHZ:
- if (cck)
- rate &= ~BIT(3);
- rate_idx = rx_legacy_rate_idx[rate];
- break;
- case IEEE80211_BAND_5GHZ:
- rate_idx = rx_legacy_rate_idx[rate];
- /* We are using same rate table registering
- HW - ath10k_rates[]. In case of 5GHz skip
- CCK rates, so -4 here */
- rate_idx -= 4;
- break;
- default:
- break;
- }
-
- status->rate_idx = rate_idx;
- break;
- case HTT_RX_HT:
- case HTT_RX_HT_WITH_TXBF:
- /* HT-SIG - Table 20-11 in info1 and info2 */
- mcs = info1 & 0x1F;
- nss = mcs >> 3;
- bw = (info1 >> 7) & 1;
- sgi = (info2 >> 7) & 1;
-
- status->rate_idx = mcs;
- status->flag |= RX_FLAG_HT;
- if (sgi)
- status->flag |= RX_FLAG_SHORT_GI;
- if (bw)
- status->flag |= RX_FLAG_40MHZ;
- break;
- case HTT_RX_VHT:
- case HTT_RX_VHT_WITH_TXBF:
- /* VHT-SIG-A1 in info 1, VHT-SIG-A2 in info2
- TODO check this */
- mcs = (info2 >> 4) & 0x0F;
- nss = ((info1 >> 10) & 0x07) + 1;
- bw = info1 & 3;
- sgi = info2 & 1;
-
- status->rate_idx = mcs;
- status->vht_nss = nss;
-
- if (sgi)
- status->flag |= RX_FLAG_SHORT_GI;
-
- switch (bw) {
- /* 20MHZ */
- case 0:
- break;
- /* 40MHZ */
- case 1:
- status->flag |= RX_FLAG_40MHZ;
- break;
- /* 80MHZ */
- case 2:
- status->vht_flag |= RX_VHT_FLAG_80MHZ;
- }
-
- status->flag |= RX_FLAG_VHT;
- break;
- default:
- break;
- }
-}
-
-void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
-{
- struct ieee80211_rx_status *status;
- struct ieee80211_channel *ch;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)info->skb->data;
-
- status = IEEE80211_SKB_RXCB(info->skb);
- memset(status, 0, sizeof(*status));
-
- if (info->encrypt_type != HTT_RX_MPDU_ENCRYPT_NONE) {
- status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED |
- RX_FLAG_MMIC_STRIPPED;
- hdr->frame_control = __cpu_to_le16(
- __le16_to_cpu(hdr->frame_control) &
- ~IEEE80211_FCTL_PROTECTED);
- }
-
- if (info->mic_err)
- status->flag |= RX_FLAG_MMIC_ERROR;
-
- if (info->fcs_err)
- status->flag |= RX_FLAG_FAILED_FCS_CRC;
-
- if (info->amsdu_more)
- status->flag |= RX_FLAG_AMSDU_MORE;
-
- status->signal = info->signal;
-
- spin_lock_bh(&ar->data_lock);
- ch = ar->scan_channel;
- if (!ch)
- ch = ar->rx_channel;
- spin_unlock_bh(&ar->data_lock);
-
- if (!ch) {
- ath10k_warn("no channel configured; ignoring frame!\n");
- dev_kfree_skb_any(info->skb);
- return;
- }
-
- process_rx_rates(ar, info, ch->band, status);
- status->band = ch->band;
- status->freq = ch->center_freq;
-
- if (info->rate.info0 & HTT_RX_INDICATION_INFO0_END_VALID) {
- /* TSF available only in 32-bit */
- status->mactime = info->tsf & 0xffffffff;
- status->flag |= RX_FLAG_MACTIME_END;
- }
-
- ath10k_dbg(ATH10K_DBG_DATA,
- "rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i\n",
- info->skb,
- info->skb->len,
- status->flag == 0 ? "legacy" : "",
- status->flag & RX_FLAG_HT ? "ht" : "",
- status->flag & RX_FLAG_VHT ? "vht" : "",
- status->flag & RX_FLAG_40MHZ ? "40" : "",
- status->vht_flag & RX_VHT_FLAG_80MHZ ? "80" : "",
- status->flag & RX_FLAG_SHORT_GI ? "sgi " : "",
- status->rate_idx,
- status->vht_nss,
- status->freq,
- status->band, status->flag, info->fcs_err);
- ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "rx skb: ",
- info->skb->data, info->skb->len);
-
- ieee80211_rx(ar->hw, info->skb);
-}
-
struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
const u8 *addr)
{
diff --git a/drivers/net/wireless/ath/ath10k/txrx.h b/drivers/net/wireless/ath/ath10k/txrx.h
index 356dc9c..aee3e20 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.h
+++ b/drivers/net/wireless/ath/ath10k/txrx.h
@@ -21,7 +21,6 @@

void ath10k_txrx_tx_unref(struct ath10k_htt *htt,
const struct htt_tx_done *tx_done);
-void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info);

struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
const u8 *addr);
--
1.7.9.5