* [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-30 18:23 ` Kalle Valo
2013-04-28 15:31 ` [ath9k-devel] [PATCH 03/20] ath10k: Rename HIF callback post_init as init Sujith Manoharan
` (18 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/core.c | 1 -
drivers/net/wireless/ath/ath10k/core.h | 20 +++++++++++
drivers/net/wireless/ath/ath10k/htt_tx.c | 1 -
drivers/net/wireless/ath/ath10k/mac.c | 20 +++++++++--
drivers/net/wireless/ath/ath10k/mac.h | 61 --------------------------------
drivers/net/wireless/ath/ath10k/txrx.c | 1 -
drivers/net/wireless/ath/ath10k/wmi.c | 1 -
7 files changed, 38 insertions(+), 67 deletions(-)
delete mode 100644 drivers/net/wireless/ath/ath10k/mac.h
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 0ec7986..ec652b9 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -19,7 +19,6 @@
#include <linux/firmware.h>
#include "core.h"
-#include "mac.h"
#include "htc.h"
#include "hif.h"
#include "wmi.h"
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 225089d..c040418 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -374,4 +374,24 @@ void ath10k_core_unregister(struct ath10k *ar);
int ath10k_core_target_suspend(struct ath10k *ar);
int ath10k_core_target_resume(struct ath10k *ar);
+struct ath10k_generic_iter {
+ struct ath10k *ar;
+ int ret;
+};
+
+struct ath10k *ath10k_mac_create(void);
+void ath10k_mac_destroy(struct ath10k *ar);
+int ath10k_mac_register(struct ath10k *ar);
+void ath10k_mac_unregister(struct ath10k *ar);
+struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id);
+void ath10k_reset_scan(unsigned long ptr);
+void ath10k_offchan_tx_purge(struct ath10k *ar);
+void ath10k_offchan_tx_work(struct work_struct *work);
+void ath10k_tx_h_seq_no(struct sk_buff *skb);
+
+static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif)
+{
+ return (struct ath10k_vif *)vif->drv_priv;
+}
+
#endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index edbe4f4..677f527 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -17,7 +17,6 @@
#include <linux/etherdevice.h>
#include "htt.h"
-#include "mac.h"
#include "txrx.h"
#include "debug.h"
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 4a11878..8e8987e 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -15,8 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "mac.h"
-
#include <net/mac80211.h>
#include <linux/etherdevice.h>
@@ -218,6 +216,24 @@ static int ath10k_clear_vdev_key(struct ath10k_vif *arvif,
/* General utilities */
/*********************/
+void ath10k_tx_h_seq_no(struct sk_buff *skb)
+{
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+ struct ieee80211_vif *vif = info->control.vif;
+ struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+
+ if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
+ if (arvif->tx_seq_no == 0)
+ arvif->tx_seq_no = 0x1000;
+
+ if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
+ arvif->tx_seq_no += 0x10;
+ hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+ hdr->seq_ctrl |= cpu_to_le16(arvif->tx_seq_no);
+ }
+}
+
static inline enum wmi_phy_mode chan_to_phymode(struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type)
{
diff --git a/drivers/net/wireless/ath/ath10k/mac.h b/drivers/net/wireless/ath/ath10k/mac.h
deleted file mode 100644
index 58eed18..0000000
--- a/drivers/net/wireless/ath/ath10k/mac.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2005-2011 Atheros Communications Inc.
- * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _MAC_H_
-#define _MAC_H_
-
-#include <net/mac80211.h>
-#include "core.h"
-
-struct ath10k_generic_iter {
- struct ath10k *ar;
- int ret;
-};
-
-struct ath10k *ath10k_mac_create(void);
-void ath10k_mac_destroy(struct ath10k *ar);
-int ath10k_mac_register(struct ath10k *ar);
-void ath10k_mac_unregister(struct ath10k *ar);
-struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id);
-void ath10k_reset_scan(unsigned long ptr);
-void ath10k_offchan_tx_purge(struct ath10k *ar);
-void ath10k_offchan_tx_work(struct work_struct *work);
-
-static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif)
-{
- return (struct ath10k_vif *)vif->drv_priv;
-}
-
-static inline void ath10k_tx_h_seq_no(struct sk_buff *skb)
-{
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- struct ieee80211_vif *vif = info->control.vif;
- struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
-
- if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
- if (arvif->tx_seq_no == 0)
- arvif->tx_seq_no = 0x1000;
-
- if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
- arvif->tx_seq_no += 0x10;
- hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
- hdr->seq_ctrl |= cpu_to_le16(arvif->tx_seq_no);
- }
-}
-
-#endif /* _MAC_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 9d0b1e2..d333f45 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -18,7 +18,6 @@
#include "core.h"
#include "txrx.h"
#include "htt.h"
-#include "mac.h"
#include "debug.h"
static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 5272f18..8017a59 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -21,7 +21,6 @@
#include "htc.h"
#include "debug.h"
#include "wmi.h"
-#include "mac.h"
void ath10k_wmi_flush_tx(struct ath10k *ar)
{
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h
2013-04-28 15:31 ` [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h Sujith Manoharan
@ 2013-04-30 18:23 ` Kalle Valo
2013-04-30 23:51 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Kalle Valo @ 2013-04-30 18:23 UTC (permalink / raw)
To: ath9k-devel
Sujith Manoharan <sujith@msujith.org> writes:
> From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
>
> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath10k/core.c | 1 -
> drivers/net/wireless/ath/ath10k/core.h | 20 +++++++++++
> drivers/net/wireless/ath/ath10k/htt_tx.c | 1 -
> drivers/net/wireless/ath/ath10k/mac.c | 20 +++++++++--
> drivers/net/wireless/ath/ath10k/mac.h | 61 --------------------------------
> drivers/net/wireless/ath/ath10k/txrx.c | 1 -
> drivers/net/wireless/ath/ath10k/wmi.c | 1 -
> 7 files changed, 38 insertions(+), 67 deletions(-)
> delete mode 100644 drivers/net/wireless/ath/ath10k/mac.h
Why do you want to delete mac.h? My idea was to avoid bloating core.h
and that's why I wanted to have header files for each .c file.
--
Kalle Valo
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h
2013-04-30 18:23 ` Kalle Valo
@ 2013-04-30 23:51 ` Sujith Manoharan
2013-05-02 7:41 ` Kalle Valo
0 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-30 23:51 UTC (permalink / raw)
To: ath9k-devel
Kalle Valo wrote:
> Why do you want to delete mac.h? My idea was to avoid bloating core.h
> and that's why I wanted to have header files for each .c file.
mac.h contains a few prototypes and most of the data structures are in core.h.
I don't think core.h is getting bloated, it has barely 300+ lines.
Sujith
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h
2013-04-30 23:51 ` Sujith Manoharan
@ 2013-05-02 7:41 ` Kalle Valo
2013-05-02 8:38 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Kalle Valo @ 2013-05-02 7:41 UTC (permalink / raw)
To: ath9k-devel
Sujith Manoharan <sujith@msujith.org> writes:
> Kalle Valo wrote:
>> Why do you want to delete mac.h? My idea was to avoid bloating core.h
>> and that's why I wanted to have header files for each .c file.
>
> mac.h contains a few prototypes and most of the data structures are in core.h.
> I don't think core.h is getting bloated, it has barely 300+ lines.
Yes, it has 300+ lines now as I have enforced that it's not abused. But
if I I let everything go to core.h how long will it end up then?
Besides, I can't see what harm having mac.h brings?
--
Kalle Valo
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h
2013-05-02 7:41 ` Kalle Valo
@ 2013-05-02 8:38 ` Sujith Manoharan
0 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-05-02 8:38 UTC (permalink / raw)
To: ath9k-devel
Kalle Valo wrote:
> Sujith Manoharan <sujith@msujith.org> writes:
>
> > Kalle Valo wrote:
> >> Why do you want to delete mac.h? My idea was to avoid bloating core.h
> >> and that's why I wanted to have header files for each .c file.
> >
> > mac.h contains a few prototypes and most of the data structures are in core.h.
> > I don't think core.h is getting bloated, it has barely 300+ lines.
>
> Yes, it has 300+ lines now as I have enforced that it's not abused. But
> if I I let everything go to core.h how long will it end up then?
>
> Besides, I can't see what harm having mac.h brings?
Please drop this patch.
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 03/20] ath10k: Rename HIF callback post_init as init
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 04/20] ath10k: Remove "ar" inside WMI structure Sujith Manoharan
` (17 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/hif.h | 10 +++++-----
drivers/net/wireless/ath/ath10k/htc.c | 2 +-
drivers/net/wireless/ath/ath10k/pci.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/hif.h b/drivers/net/wireless/ath/ath10k/hif.h
index 23e7c99..a5e6422 100644
--- a/drivers/net/wireless/ath/ath10k/hif.h
+++ b/drivers/net/wireless/ath/ath10k/hif.h
@@ -66,8 +66,8 @@ struct ath10k_hif_ops {
*/
void (*send_complete_check)(struct ath10k *ar, u8 pipe_id, int force);
- void (*post_init)(struct ath10k *ar,
- struct ath10k_hif_cb *callbacks);
+ void (*init)(struct ath10k *ar,
+ struct ath10k_hif_cb *callbacks);
u16 (*get_free_queue_number)(struct ath10k *ar, u8 pipe_id);
};
@@ -122,10 +122,10 @@ static inline void ath10k_hif_send_complete_check(struct ath10k *ar,
ar->hif.ops->send_complete_check(ar, pipe_id, force);
}
-static inline void ath10k_hif_post_init(struct ath10k *ar,
- struct ath10k_hif_cb *callbacks)
+static inline void ath10k_hif_init(struct ath10k *ar,
+ struct ath10k_hif_cb *callbacks)
{
- ar->hif.ops->post_init(ar, callbacks);
+ ar->hif.ops->init(ar, callbacks);
}
static inline u16 ath10k_hif_get_free_queue_number(struct ath10k *ar,
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 56a06b0..647bd69 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -1001,7 +1001,7 @@ struct ath10k_htc *ath10k_htc_create(struct ath10k *ar,
/* Get HIF default pipe for HTC message exchange */
ep = &htc->endpoint[ATH10K_HTC_EP_0];
- ath10k_hif_post_init(ar, &htc_callbacks);
+ ath10k_hif_init(ar, &htc_callbacks);
ath10k_hif_get_default_pipe(ar, &ep->ul_pipe_id, &ep->dl_pipe_id);
init_completion(&htc->ctl_resp);
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 31881f9..a7d321c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1673,7 +1673,7 @@ static const struct ath10k_hif_ops ath10k_pci_hif_ops = {
.map_service_to_pipe = ath10k_pci_hif_map_service_to_pipe,
.get_default_pipe = ath10k_pci_hif_get_default_pipe,
.send_complete_check = ath10k_pci_hif_send_complete_check,
- .post_init = ath10k_pci_hif_post_init,
+ .init = ath10k_pci_hif_post_init,
.get_free_queue_number = ath10k_pci_hif_get_free_queue_number,
};
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 04/20] ath10k: Remove "ar" inside WMI structure
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 03/20] ath10k: Rename HIF callback post_init as init Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 05/20] ath10k: Remove "htc" inside HTT struct Sujith Manoharan
` (16 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/core.h | 2 --
drivers/net/wireless/ath/ath10k/wmi.c | 1 -
2 files changed, 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index c040418..18f8eca 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -115,8 +115,6 @@ struct ath10k_bmi {
};
struct ath10k_wmi {
- struct ath10k *ar;
-
enum ath10k_htc_ep_id eid;
struct completion service_ready;
struct completion unified_ready;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 8017a59..a837b3f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1079,7 +1079,6 @@ static void ath10k_wmi_process_rx(void *ptr, struct sk_buff *skb)
/* WMI Initialization functions */
int ath10k_wmi_attach(struct ath10k *ar)
{
- ar->wmi.ar = ar;
init_completion(&ar->wmi.service_ready);
init_completion(&ar->wmi.unified_ready);
init_waitqueue_head(&ar->wmi.wq);
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 05/20] ath10k: Remove "htc" inside HTT struct
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (2 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 04/20] ath10k: Remove "ar" inside WMI structure Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 06/20] ath10k: Move debug routines to debug.c Sujith Manoharan
` (15 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/core.c | 2 +-
drivers/net/wireless/ath/ath10k/htt.c | 5 ++---
drivers/net/wireless/ath/ath10k/htt.h | 4 +---
drivers/net/wireless/ath/ath10k/htt_tx.c | 8 ++++----
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index ec652b9..fa9ba4e 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -555,7 +555,7 @@ int ath10k_core_register(struct ath10k *ar)
if (status)
goto err_wmi_detach;
- ar->htt = ath10k_htt_attach(ar, ar->htc);
+ ar->htt = ath10k_htt_attach(ar);
if (!ar->htt) {
status = -ENOMEM;
goto err_wmi_detach;
diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c
index 036e2b8..c253db8 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -57,7 +57,7 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
/* connect to control service */
conn_req.service_id = ATH10K_HTC_SVC_ID_HTT_DATA_MSG;
- status = ath10k_htc_connect_service(htt->htc, &conn_req, &conn_resp);
+ status = ath10k_htc_connect_service(htt->ar->htc, &conn_req, &conn_resp);
if (status)
return status;
@@ -67,7 +67,7 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
return 0;
}
-struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar, struct ath10k_htc *htc)
+struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar)
{
struct ath10k_htt *htt;
@@ -76,7 +76,6 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar, struct ath10k_htc *htc)
return NULL;
htt->ar = ar;
- htt->htc = htc;
htt->cfg.max_throughput_mbps = 800;
/*
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 2f353d5..58f0d03 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1103,8 +1103,6 @@ struct htt_rx_info {
struct ath10k_htt {
struct ath10k *ar;
- struct ath10k_htc *htc;
-
enum ath10k_htc_ep_id eid;
struct {
@@ -1259,7 +1257,7 @@ struct htt_rx_desc {
/* FIXME: add htt_tx_desc_init() */
-struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar, struct ath10k_htc *htc);
+struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar);
int ath10k_htt_attach_target(struct ath10k_htt *htt);
void ath10k_htt_detach(struct ath10k_htt *htt);
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 677f527..62575b7 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -130,7 +130,7 @@ int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt)
ATH10K_SKB_CB(skb)->htt.is_conf = true;
- ret = ath10k_htc_send(htt->htc, htt->eid, skb);
+ ret = ath10k_htc_send(htt->ar->htc, htt->eid, skb);
if (ret) {
dev_kfree_skb_any(skb);
return ret;
@@ -217,7 +217,7 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt)
ATH10K_SKB_CB(skb)->htt.is_conf = true;
- ret = ath10k_htc_send(htt->htc, htt->eid, skb);
+ ret = ath10k_htc_send(htt->ar->htc, htt->eid, skb);
if (ret) {
dev_kfree_skb_any(skb);
return ret;
@@ -277,7 +277,7 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
skb_cb->htt.refcount = 2;
skb_cb->htt.msdu = msdu;
- res = ath10k_htc_send(htt->htc, htt->eid, txdesc);
+ res = ath10k_htc_send(htt->ar->htc, htt->eid, txdesc);
if (res)
goto err;
@@ -412,7 +412,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
skb_cb->htt.txfrag = txfrag;
skb_cb->htt.msdu = msdu;
- res = ath10k_htc_send(htt->htc, htt->eid, txdesc);
+ res = ath10k_htc_send(htt->ar->htc, htt->eid, txdesc);
if (res)
goto err;
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 06/20] ath10k: Move debug routines to debug.c
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (3 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 05/20] ath10k: Remove "htc" inside HTT struct Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-30 18:28 ` Kalle Valo
2013-04-28 15:31 ` [ath9k-devel] [PATCH 07/20] ath10k: Remove void pointers in HTC endpoints Sujith Manoharan
` (14 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/debug.c | 119 ++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath10k/debug.h | 124 ++------------------------------
2 files changed, 124 insertions(+), 119 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 3357917..946185c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -99,6 +99,13 @@ EXPORT_SYMBOL(ath10k_warn);
#ifdef CONFIG_ATH10K_DEBUGFS
+void ath10k_debug_read_service_map(struct ath10k *ar,
+ void *service_map,
+ size_t map_size)
+{
+ memcpy(ar->debug.wmi_service_bitmap, service_map, map_size);
+}
+
static ssize_t ath10k_read_wmi_services(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
@@ -147,6 +154,118 @@ static const struct file_operations fops_wmi_services = {
.llseek = default_llseek,
};
+void ath10k_debug_read_target_stats(struct ath10k *ar,
+ struct wmi_stats_event *ev)
+{
+ u8 *tmp = ev->data;
+ struct ath10k_target_stats *stats;
+ int num_pdev_stats, num_vdev_stats, num_peer_stats;
+ struct wmi_pdev_stats *ps;
+ int i;
+
+ mutex_lock(&ar->conf_mutex);
+
+ stats = &ar->debug.target_stats;
+
+ num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats); /* 0 or 1 */
+ num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats); /* 0 or max vdevs */
+ num_peer_stats = __le32_to_cpu(ev->num_peer_stats); /* 0 or max peers */
+
+ if (num_pdev_stats) {
+ ps = (struct wmi_pdev_stats *)tmp;
+
+ stats->ch_noise_floor = __le32_to_cpu(ps->chan_nf);
+ stats->tx_frame_count = __le32_to_cpu(ps->tx_frame_count);
+ stats->rx_frame_count = __le32_to_cpu(ps->rx_frame_count);
+ stats->rx_clear_count = __le32_to_cpu(ps->rx_clear_count);
+ stats->cycle_count = __le32_to_cpu(ps->cycle_count);
+ stats->phy_err_count = __le32_to_cpu(ps->phy_err_count);
+ stats->chan_tx_power = __le32_to_cpu(ps->chan_tx_pwr);
+
+ stats->comp_queued = __le32_to_cpu(ps->wal.tx.comp_queued);
+ stats->comp_delivered =
+ __le32_to_cpu(ps->wal.tx.comp_delivered);
+ stats->msdu_enqued = __le32_to_cpu(ps->wal.tx.msdu_enqued);
+ stats->mpdu_enqued = __le32_to_cpu(ps->wal.tx.mpdu_enqued);
+ stats->wmm_drop = __le32_to_cpu(ps->wal.tx.wmm_drop);
+ stats->local_enqued = __le32_to_cpu(ps->wal.tx.local_enqued);
+ stats->local_freed = __le32_to_cpu(ps->wal.tx.local_freed);
+ stats->hw_queued = __le32_to_cpu(ps->wal.tx.hw_queued);
+ stats->hw_reaped = __le32_to_cpu(ps->wal.tx.hw_reaped);
+ stats->underrun = __le32_to_cpu(ps->wal.tx.underrun);
+ stats->tx_abort = __le32_to_cpu(ps->wal.tx.tx_abort);
+ stats->mpdus_requed = __le32_to_cpu(ps->wal.tx.mpdus_requed);
+ stats->tx_ko = __le32_to_cpu(ps->wal.tx.tx_ko);
+ stats->data_rc = __le32_to_cpu(ps->wal.tx.data_rc);
+ stats->self_triggers = __le32_to_cpu(ps->wal.tx.self_triggers);
+ stats->sw_retry_failure =
+ __le32_to_cpu(ps->wal.tx.sw_retry_failure);
+ stats->illgl_rate_phy_err =
+ __le32_to_cpu(ps->wal.tx.illgl_rate_phy_err);
+ stats->pdev_cont_xretry =
+ __le32_to_cpu(ps->wal.tx.pdev_cont_xretry);
+ stats->pdev_tx_timeout =
+ __le32_to_cpu(ps->wal.tx.pdev_tx_timeout);
+ stats->pdev_resets = __le32_to_cpu(ps->wal.tx.pdev_resets);
+ stats->phy_underrun = __le32_to_cpu(ps->wal.tx.phy_underrun);
+ stats->txop_ovf = __le32_to_cpu(ps->wal.tx.txop_ovf);
+
+ stats->mid_ppdu_route_change =
+ __le32_to_cpu(ps->wal.rx.mid_ppdu_route_change);
+ stats->status_rcvd = __le32_to_cpu(ps->wal.rx.status_rcvd);
+ stats->r0_frags = __le32_to_cpu(ps->wal.rx.r0_frags);
+ stats->r1_frags = __le32_to_cpu(ps->wal.rx.r1_frags);
+ stats->r2_frags = __le32_to_cpu(ps->wal.rx.r2_frags);
+ stats->r3_frags = __le32_to_cpu(ps->wal.rx.r3_frags);
+ stats->htt_msdus = __le32_to_cpu(ps->wal.rx.htt_msdus);
+ stats->htt_mpdus = __le32_to_cpu(ps->wal.rx.htt_mpdus);
+ stats->loc_msdus = __le32_to_cpu(ps->wal.rx.loc_msdus);
+ stats->loc_mpdus = __le32_to_cpu(ps->wal.rx.loc_mpdus);
+ stats->oversize_amsdu =
+ __le32_to_cpu(ps->wal.rx.oversize_amsdu);
+ stats->phy_errs = __le32_to_cpu(ps->wal.rx.phy_errs);
+ stats->phy_err_drop = __le32_to_cpu(ps->wal.rx.phy_err_drop);
+ stats->mpdu_errs = __le32_to_cpu(ps->wal.rx.mpdu_errs);
+
+ tmp += sizeof(struct wmi_pdev_stats);
+ }
+
+ /* 0 or max vdevs */
+ /* Currently firmware does not support VDEV stats */
+ if (num_vdev_stats) {
+ struct wmi_vdev_stats *vdev_stats;
+
+ for (i = 0; i < num_vdev_stats; i++) {
+ vdev_stats = (struct wmi_vdev_stats *)tmp;
+ tmp += sizeof(struct wmi_vdev_stats);
+ }
+ }
+
+ if (num_peer_stats) {
+ struct wmi_peer_stats *peer_stats;
+ struct ath10k_peer_stat *s;
+
+ stats->peers = num_peer_stats;
+
+ for (i = 0; i < num_peer_stats; i++) {
+ peer_stats = (struct wmi_peer_stats *)tmp;
+ s = &stats->peer_stat[i];
+
+ WMI_MAC_ADDR_TO_CHAR_ARRAY(&peer_stats->peer_macaddr,
+ s->peer_macaddr);
+ s->peer_rssi = __le32_to_cpu(peer_stats->peer_rssi);
+ s->peer_tx_rate =
+ __le32_to_cpu(peer_stats->peer_tx_rate);
+
+ tmp += sizeof(struct wmi_peer_stats);
+ }
+ }
+
+ mutex_unlock(&ar->conf_mutex);
+ complete(&ar->debug.event_stats_compl);
+
+}
+
static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index aeca3af..bbaaa37 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -42,125 +42,11 @@ extern __printf(1, 2) int ath10k_warn(const char *fmt, ...);
#ifdef CONFIG_ATH10K_DEBUGFS
int ath10k_debug_create(struct ath10k *ar);
-
-static inline void ath10k_debug_read_service_map(struct ath10k *ar,
- void *service_map,
- size_t map_size)
-{
- memcpy(ar->debug.wmi_service_bitmap, service_map, map_size);
-}
-
-static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
- struct wmi_stats_event *ev)
-{
- u8 *tmp = ev->data;
- struct ath10k_target_stats *stats;
- int num_pdev_stats, num_vdev_stats, num_peer_stats;
- struct wmi_pdev_stats *ps;
- int i;
-
- mutex_lock(&ar->conf_mutex);
-
- stats = &ar->debug.target_stats;
-
- num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats); /* 0 or 1 */
- num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats); /* 0 or max vdevs */
- num_peer_stats = __le32_to_cpu(ev->num_peer_stats); /* 0 or max peers */
-
- if (num_pdev_stats) {
- ps = (struct wmi_pdev_stats *)tmp;
-
- stats->ch_noise_floor = __le32_to_cpu(ps->chan_nf);
- stats->tx_frame_count = __le32_to_cpu(ps->tx_frame_count);
- stats->rx_frame_count = __le32_to_cpu(ps->rx_frame_count);
- stats->rx_clear_count = __le32_to_cpu(ps->rx_clear_count);
- stats->cycle_count = __le32_to_cpu(ps->cycle_count);
- stats->phy_err_count = __le32_to_cpu(ps->phy_err_count);
- stats->chan_tx_power = __le32_to_cpu(ps->chan_tx_pwr);
-
- stats->comp_queued = __le32_to_cpu(ps->wal.tx.comp_queued);
- stats->comp_delivered =
- __le32_to_cpu(ps->wal.tx.comp_delivered);
- stats->msdu_enqued = __le32_to_cpu(ps->wal.tx.msdu_enqued);
- stats->mpdu_enqued = __le32_to_cpu(ps->wal.tx.mpdu_enqued);
- stats->wmm_drop = __le32_to_cpu(ps->wal.tx.wmm_drop);
- stats->local_enqued = __le32_to_cpu(ps->wal.tx.local_enqued);
- stats->local_freed = __le32_to_cpu(ps->wal.tx.local_freed);
- stats->hw_queued = __le32_to_cpu(ps->wal.tx.hw_queued);
- stats->hw_reaped = __le32_to_cpu(ps->wal.tx.hw_reaped);
- stats->underrun = __le32_to_cpu(ps->wal.tx.underrun);
- stats->tx_abort = __le32_to_cpu(ps->wal.tx.tx_abort);
- stats->mpdus_requed = __le32_to_cpu(ps->wal.tx.mpdus_requed);
- stats->tx_ko = __le32_to_cpu(ps->wal.tx.tx_ko);
- stats->data_rc = __le32_to_cpu(ps->wal.tx.data_rc);
- stats->self_triggers = __le32_to_cpu(ps->wal.tx.self_triggers);
- stats->sw_retry_failure =
- __le32_to_cpu(ps->wal.tx.sw_retry_failure);
- stats->illgl_rate_phy_err =
- __le32_to_cpu(ps->wal.tx.illgl_rate_phy_err);
- stats->pdev_cont_xretry =
- __le32_to_cpu(ps->wal.tx.pdev_cont_xretry);
- stats->pdev_tx_timeout =
- __le32_to_cpu(ps->wal.tx.pdev_tx_timeout);
- stats->pdev_resets = __le32_to_cpu(ps->wal.tx.pdev_resets);
- stats->phy_underrun = __le32_to_cpu(ps->wal.tx.phy_underrun);
- stats->txop_ovf = __le32_to_cpu(ps->wal.tx.txop_ovf);
-
- stats->mid_ppdu_route_change =
- __le32_to_cpu(ps->wal.rx.mid_ppdu_route_change);
- stats->status_rcvd = __le32_to_cpu(ps->wal.rx.status_rcvd);
- stats->r0_frags = __le32_to_cpu(ps->wal.rx.r0_frags);
- stats->r1_frags = __le32_to_cpu(ps->wal.rx.r1_frags);
- stats->r2_frags = __le32_to_cpu(ps->wal.rx.r2_frags);
- stats->r3_frags = __le32_to_cpu(ps->wal.rx.r3_frags);
- stats->htt_msdus = __le32_to_cpu(ps->wal.rx.htt_msdus);
- stats->htt_mpdus = __le32_to_cpu(ps->wal.rx.htt_mpdus);
- stats->loc_msdus = __le32_to_cpu(ps->wal.rx.loc_msdus);
- stats->loc_mpdus = __le32_to_cpu(ps->wal.rx.loc_mpdus);
- stats->oversize_amsdu =
- __le32_to_cpu(ps->wal.rx.oversize_amsdu);
- stats->phy_errs = __le32_to_cpu(ps->wal.rx.phy_errs);
- stats->phy_err_drop = __le32_to_cpu(ps->wal.rx.phy_err_drop);
- stats->mpdu_errs = __le32_to_cpu(ps->wal.rx.mpdu_errs);
-
- tmp += sizeof(struct wmi_pdev_stats);
- }
-
- /* 0 or max vdevs */
- /* Currently firmware does not support VDEV stats */
- if (num_vdev_stats) {
- struct wmi_vdev_stats *vdev_stats;
-
- for (i = 0; i < num_vdev_stats; i++) {
- vdev_stats = (struct wmi_vdev_stats *)tmp;
- tmp += sizeof(struct wmi_vdev_stats);
- }
- }
-
- if (num_peer_stats) {
- struct wmi_peer_stats *peer_stats;
- struct ath10k_peer_stat *s;
-
- stats->peers = num_peer_stats;
-
- for (i = 0; i < num_peer_stats; i++) {
- peer_stats = (struct wmi_peer_stats *)tmp;
- s = &stats->peer_stat[i];
-
- WMI_MAC_ADDR_TO_CHAR_ARRAY(&peer_stats->peer_macaddr,
- s->peer_macaddr);
- s->peer_rssi = __le32_to_cpu(peer_stats->peer_rssi);
- s->peer_tx_rate =
- __le32_to_cpu(peer_stats->peer_tx_rate);
-
- tmp += sizeof(struct wmi_peer_stats);
- }
- }
-
- mutex_unlock(&ar->conf_mutex);
- complete(&ar->debug.event_stats_compl);
-
-}
+void ath10k_debug_read_service_map(struct ath10k *ar,
+ void *service_map,
+ size_t map_size);
+void ath10k_debug_read_target_stats(struct ath10k *ar,
+ struct wmi_stats_event *ev);
#else
static inline int ath10k_debug_create(struct ath10k *ar)
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 07/20] ath10k: Remove void pointers in HTC endpoints
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (4 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 06/20] ath10k: Move debug routines to debug.c Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 08/20] ath10k: Use lockless SKB queue routines Sujith Manoharan
` (13 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htc.c | 13 ++++++-------
drivers/net/wireless/ath/ath10k/htc.h | 9 ++++-----
drivers/net/wireless/ath/ath10k/htt.c | 11 ++++-------
drivers/net/wireless/ath/ath10k/htt.h | 4 ++--
drivers/net/wireless/ath/ath10k/htt_rx.c | 4 ++--
drivers/net/wireless/ath/ath10k/htt_tx.c | 4 ++--
drivers/net/wireless/ath/ath10k/wmi.c | 8 ++------
7 files changed, 22 insertions(+), 31 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 647bd69..b303c35 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -29,7 +29,7 @@ static inline void ath10k_htc_stop_queue(struct ath10k_htc_ep *ep)
return;
if (ep->ep_ops.stop_queue)
- ep->ep_ops.stop_queue(ep->ep_ops.context);
+ ep->ep_ops.stop_queue(ep->htc->ar);
ath10k_dbg(ATH10K_DBG_HTC, "ep %d stop\n", ep->eid);
ep->tx_queue_stopped = true;
@@ -41,7 +41,7 @@ static inline void ath10k_htc_wake_queue(struct ath10k_htc_ep *ep)
return;
if (ep->ep_ops.wake_queue)
- ep->ep_ops.wake_queue(ep->ep_ops.context);
+ ep->ep_ops.wake_queue(ep->htc->ar);
ath10k_dbg(ATH10K_DBG_HTC, "ep %d wake\n", ep->eid);
ep->tx_queue_stopped = false;
@@ -74,7 +74,7 @@ static inline void ath10k_htc_send_complete_check(struct ath10k_htc_ep *ep,
ath10k_hif_send_complete_check(ep->htc->ar, ep->ul_pipe_id, force);
}
-static void ath10k_htc_control_tx_complete(void *context, struct sk_buff *skb)
+static void ath10k_htc_control_tx_complete(struct ath10k *ar, struct sk_buff *skb)
{
kfree_skb(skb);
}
@@ -121,7 +121,7 @@ static void ath10k_htc_notify_tx_completion(struct ath10k_htc_ep *ep,
return;
}
- ep->ep_ops.ep_tx_complete(ep->ep_ops.context, skb);
+ ep->ep_ops.ep_tx_complete(ep->htc->ar, skb);
}
/* assumes tx_lock is held */
@@ -606,7 +606,7 @@ static int ath10k_htc_rx_completion_handler(struct ath10k *ar,
ath10k_dbg(ATH10K_DBG_HTC, "htc rx completion ep %d skb %p\n",
eid, skb);
- ep->ep_ops.ep_rx_complete(ep->ep_ops.context, skb);
+ ep->ep_ops.ep_rx_complete(ar, skb);
/* skb is now owned by the rx completion handler */
skb = NULL;
@@ -616,7 +616,7 @@ out:
return status;
}
-static void ath10k_htc_control_rx_complete(void *context, struct sk_buff *skb)
+static void ath10k_htc_control_rx_complete(struct ath10k *ar, struct sk_buff *skb)
{
/* TODO, can't receive HTC control messages yet */
ath10k_dbg(ATH10K_DBG_HTC, "Invalid call to %s\n", __func__);
@@ -740,7 +740,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
/* setup our pseudo HTC control endpoint connection */
memset(&conn_req, 0, sizeof(conn_req));
memset(&conn_resp, 0, sizeof(conn_resp));
- conn_req.ep_ops.context = htc;
conn_req.ep_ops.ep_tx_complete = ath10k_htc_control_tx_complete;
conn_req.ep_ops.ep_rx_complete = ath10k_htc_control_rx_complete;
conn_req.max_send_queue_depth = ATH10K_NUM_CONTROL_TX_BUFFERS;
diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 3d03019..cf97bde 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -274,11 +274,10 @@ struct ath10k_htc_ops {
};
struct ath10k_htc_ep_ops {
- void *context;
- void (*ep_tx_complete)(void *context, struct sk_buff *);
- void (*ep_rx_complete)(void *context, struct sk_buff *);
- void (*stop_queue)(void *context);
- void (*wake_queue)(void *context);
+ void (*ep_tx_complete)(struct ath10k *, struct sk_buff *);
+ void (*ep_rx_complete)(struct ath10k *, struct sk_buff *);
+ void (*stop_queue)(struct ath10k *);
+ void (*wake_queue)(struct ath10k *);
};
/* service connection information */
diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c
index c253db8..5ad552d 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -21,16 +21,14 @@
#include "core.h"
#include "debug.h"
-static void ath10k_htt_stop_queue(void *context)
+static void ath10k_htt_stop_queue(struct ath10k *ar)
{
- struct ath10k_htt *htt = context;
- ieee80211_stop_queues(htt->ar->hw);
+ ieee80211_stop_queues(ar->hw);
}
-static void ath10k_htt_wake_queue(void *context)
+static void ath10k_htt_wake_queue(struct ath10k *ar)
{
- struct ath10k_htt *htt = context;
- ieee80211_wake_queues(htt->ar->hw);
+ ieee80211_wake_queues(ar->hw);
}
static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
@@ -42,7 +40,6 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
memset(&conn_req, 0, sizeof(conn_req));
memset(&conn_resp, 0, sizeof(conn_resp));
- conn_req.ep_ops.context = htt;
conn_req.ep_ops.ep_tx_complete = ath10k_htt_htc_tx_complete;
conn_req.ep_ops.ep_rx_complete = ath10k_htt_t2h_msg_handler;
conn_req.ep_ops.stop_queue = ath10k_htt_stop_queue;
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 58f0d03..2853a53 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1265,8 +1265,8 @@ void ath10k_htt_tx_attach(struct ath10k_htt *htt);
void ath10k_htt_tx_detach(struct ath10k_htt *htt);
int ath10k_htt_rx_attach(struct ath10k_htt *htt);
void ath10k_htt_rx_detach(struct ath10k_htt *htt);
-void ath10k_htt_htc_tx_complete(void *context, struct sk_buff *skb);
-void ath10k_htt_t2h_msg_handler(void *context, struct sk_buff *skb);
+void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb);
+void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt);
int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt);
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 0b20879..ac4dc4a 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -981,9 +981,9 @@ end:
}
}
-void ath10k_htt_t2h_msg_handler(void *context, struct sk_buff *skb)
+void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
{
- struct ath10k_htt *htt = (struct ath10k_htt *)context;
+ struct ath10k_htt *htt = ar->htt;
struct htt_resp *resp = (struct htt_resp *)skb->data;
/* confirm alignment */
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 62575b7..2e6e0d9 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -86,10 +86,10 @@ void ath10k_htt_tx_detach(struct ath10k_htt *htt)
return;
}
-void ath10k_htt_htc_tx_complete(void *context, struct sk_buff *skb)
+void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb)
{
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
- struct ath10k_htt *htt = (struct ath10k_htt *)context;
+ struct ath10k_htt *htt = ar->htt;
if (skb_cb->htt.is_conf) {
dev_kfree_skb_any(skb);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index a837b3f..577a63e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -73,10 +73,8 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)
return skb;
}
-static void ath10k_wmi_htc_tx_complete(void *context, struct sk_buff *skb)
+static void ath10k_wmi_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb)
{
- struct ath10k *ar = context;
-
dev_kfree_skb(skb);
if (atomic_sub_return(1, &ar->wmi.pending_tx_count) == 0)
@@ -1048,9 +1046,8 @@ static void ath10k_wmi_event_work(struct work_struct *work)
}
}
-static void ath10k_wmi_process_rx(void *ptr, struct sk_buff *skb)
+static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
{
- struct ath10k *ar = ptr;
struct wmi_cmd_hdr *cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
enum wmi_event_id event_id;
@@ -1109,7 +1106,6 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar)
memset(&conn_resp, 0, sizeof(conn_resp));
/* these fields are the same for all service endpoints */
- conn_req.ep_ops.context = ar;
conn_req.ep_ops.ep_tx_complete = ath10k_wmi_htc_tx_complete;
conn_req.ep_ops.ep_rx_complete = ath10k_wmi_process_rx;
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 08/20] ath10k: Use lockless SKB queue routines
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (5 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 07/20] ath10k: Remove void pointers in HTC endpoints Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 09/20] ath10k: Optimize HTC queue handling Sujith Manoharan
` (12 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
The HTC TX queue is protected by "tx_lock".
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index b303c35..c6966f9 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -209,7 +209,7 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
int remainder;
unsigned int transfer_len;
- skb = skb_dequeue(&ep->tx_queue);
+ skb = __skb_dequeue(&ep->tx_queue);
if (!skb)
return NULL;
@@ -240,7 +240,7 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
credits_required = 0;
else {
if (ep->tx_credits < credits_required) {
- skb_queue_head(&ep->tx_queue, skb);
+ __skb_queue_head(&ep->tx_queue, skb);
ath10k_htc_recalc_queue(ep, 1);
return NULL;
}
@@ -268,7 +268,7 @@ static struct sk_buff *ath10k_htc_get_skb(struct ath10k_htc *htc,
if (!resources)
return NULL;
- skb = skb_dequeue(&ep->tx_queue);
+ skb = __skb_dequeue(&ep->tx_queue);
if (!skb)
return NULL;
@@ -325,7 +325,7 @@ int ath10k_htc_send(struct ath10k_htc *htc,
skb_push(skb, sizeof(struct ath10k_htc_hdr));
spin_lock_bh(&htc->tx_lock);
- skb_queue_tail(&ep->tx_queue, skb);
+ __skb_queue_tail(&ep->tx_queue, skb);
ath10k_htc_recalc_queue(ep, 1);
spin_unlock_bh(&htc->tx_lock);
@@ -369,7 +369,7 @@ static void ath10k_htc_flush_endpoint_tx(struct ath10k_htc *htc,
spin_lock_bh(&htc->tx_lock);
for (;;) {
- skb = skb_dequeue(&ep->tx_queue);
+ skb = __skb_dequeue(&ep->tx_queue);
if (!skb)
break;
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 09/20] ath10k: Optimize HTC queue handling
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (6 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 08/20] ath10k: Use lockless SKB queue routines Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 10/20] ath10k: Remove "credits_used" from SKB CB Sujith Manoharan
` (11 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Credit based flow control is enabled only for WMI service
and WMI doesn't register any handlers for queue stop/wake,
so there is no point in calling recalc_queue() for it.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index c6966f9..7169a42 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -214,8 +214,6 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
return NULL;
skb_cb = ATH10K_SKB_CB(skb);
- ath10k_htc_recalc_queue(ep, -1);
-
transfer_len = skb->len;
if (transfer_len <= htc->target_credit_size)
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 10/20] ath10k: Remove "credits_used" from SKB CB
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (7 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 09/20] ath10k: Optimize HTC queue handling Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-29 5:45 ` Michal Kazior
2013-04-28 15:31 ` [ath9k-devel] [PATCH 11/20] ath10k: Disable credit flow control for EP0 Sujith Manoharan
` (10 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/core.h | 4 ----
drivers/net/wireless/ath/ath10k/htc.c | 26 ++++++++++++--------------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 18f8eca..7f27148 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -65,10 +65,6 @@ struct ath10k_skb_cb {
struct sk_buff *msdu;
} __packed htt;
- struct {
- u8 credits_used;
- } __packed htc;
-
/* 4 bytes left on 64bit arch */
} __packed;
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 7169a42..71c13f3 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -161,7 +161,8 @@ static int ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep *ep,
static int ath10k_htc_issue_skb(struct ath10k_htc *htc,
struct ath10k_htc_ep *ep,
- struct sk_buff *skb)
+ struct sk_buff *skb,
+ u8 credits)
{
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
int ret;
@@ -190,7 +191,7 @@ err:
ath10k_warn("HTC issue failed: %d\n", ret);
spin_lock_bh(&htc->tx_lock);
- ep->tx_credits += skb_cb->htc.credits_used;
+ ep->tx_credits += credits;
spin_unlock_bh(&htc->tx_lock);
skb_cb->is_aborted = true;
@@ -201,7 +202,8 @@ err:
/* assumes tx_lock is held */
static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
- struct ath10k_htc_ep *ep)
+ struct ath10k_htc_ep *ep,
+ u8 *credits)
{
struct sk_buff *skb;
struct ath10k_skb_cb *skb_cb;
@@ -234,9 +236,9 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
* EP 0 is special, it always has a credit and does not require
* credit based flow control.
*/
- if (ep->eid == ATH10K_HTC_EP_0)
+ if (ep->eid == ATH10K_HTC_EP_0) {
credits_required = 0;
- else {
+ } else {
if (ep->tx_credits < credits_required) {
__skb_queue_head(&ep->tx_queue, skb);
ath10k_htc_recalc_queue(ep, 1);
@@ -246,12 +248,7 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
ep->tx_credits -= credits_required;
}
- /* shouldn't happen, but print a warning just in case */
- if (credits_required >= 1 << (8*sizeof(skb_cb->htc.credits_used)))
- ath10k_warn("credits_required value overflow (%d)\n",
- credits_required);
-
- skb_cb->htc.credits_used = credits_required;
+ *credits = credits_required;
return skb;
}
@@ -273,7 +270,6 @@ static struct sk_buff *ath10k_htc_get_skb(struct ath10k_htc *htc,
skb_cb = ATH10K_SKB_CB(skb);
ath10k_htc_recalc_queue(ep, -1);
- skb_cb->htc.credits_used = 0;
return skb;
}
@@ -284,6 +280,7 @@ static void ath10k_htc_send_work(struct work_struct *work)
struct ath10k_htc *htc = ep->htc;
struct sk_buff *skb;
int tx_resources = 0;
+ u8 credits = 0;
while (true) {
if (!ep->tx_credit_flow_enabled)
@@ -296,7 +293,8 @@ static void ath10k_htc_send_work(struct work_struct *work)
spin_lock_bh(&htc->tx_lock);
if (ep->tx_credit_flow_enabled)
- skb = ath10k_htc_get_skb_credit_based(htc, ep);
+ skb = ath10k_htc_get_skb_credit_based(htc, ep,
+ &credits);
else
skb = ath10k_htc_get_skb(htc, ep, tx_resources);
@@ -305,7 +303,7 @@ static void ath10k_htc_send_work(struct work_struct *work)
if (!skb)
break; /* tx_queue empty or out of resources */
- ath10k_htc_issue_skb(htc, ep, skb);
+ ath10k_htc_issue_skb(htc, ep, skb, credits);
}
}
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 10/20] ath10k: Remove "credits_used" from SKB CB
2013-04-28 15:31 ` [ath9k-devel] [PATCH 10/20] ath10k: Remove "credits_used" from SKB CB Sujith Manoharan
@ 2013-04-29 5:45 ` Michal Kazior
2013-04-29 6:02 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Michal Kazior @ 2013-04-29 5:45 UTC (permalink / raw)
To: ath9k-devel
On 28/04/13 17:31, Sujith Manoharan wrote:
> From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
>
> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath10k/core.h | 4 ----
> drivers/net/wireless/ath/ath10k/htc.c | 26 ++++++++++++--------------
> 2 files changed, 12 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
> index 18f8eca..7f27148 100644
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -65,10 +65,6 @@ struct ath10k_skb_cb {
> struct sk_buff *msdu;
> } __packed htt;
>
> - struct {
> - u8 credits_used;
> - } __packed htc;
> -
> /* 4 bytes left on 64bit arch */
The comment could be updated too to reflect there's more space in the
ath10k_skb_cb now.
-- Pozdrawiam / Best regards, Michal Kazior.
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 11/20] ath10k: Disable credit flow control for EP0
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (8 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 10/20] ath10k: Remove "credits_used" from SKB CB Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 12/20] ath10k: Optimize credit allocation Sujith Manoharan
` (9 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
As the comment says, EP0 doesn't require flow control,
so disable it explicitly.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htc.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 71c13f3..3641973 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -232,22 +232,13 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
ath10k_dbg(ATH10K_DBG_HTC, "%s: creds required %d got %d\n",
__func__, credits_required, ep->tx_credits);
- /*
- * EP 0 is special, it always has a credit and does not require
- * credit based flow control.
- */
- if (ep->eid == ATH10K_HTC_EP_0) {
- credits_required = 0;
- } else {
- if (ep->tx_credits < credits_required) {
- __skb_queue_head(&ep->tx_queue, skb);
- ath10k_htc_recalc_queue(ep, 1);
- return NULL;
- }
-
- ep->tx_credits -= credits_required;
+ if (ep->tx_credits < credits_required) {
+ __skb_queue_head(&ep->tx_queue, skb);
+ ath10k_htc_recalc_queue(ep, 1);
+ return NULL;
}
+ ep->tx_credits -= credits_required;
*credits = credits_required;
return skb;
}
@@ -767,6 +758,7 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
/* special case for HTC pseudo control service */
if (conn_req->service_id == ATH10K_HTC_SVC_ID_RSVD_CTRL) {
+ disable_credit_flow_ctrl = true;
assigned_eid = ATH10K_HTC_EP_0;
max_msg_size = ATH10K_HTC_MAX_CTRL_MSG_LEN;
memset(&resp_msg_dummy, 0, sizeof(resp_msg_dummy));
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 12/20] ath10k: Optimize credit allocation
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (9 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 11/20] ath10k: Disable credit flow control for EP0 Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 13/20] ath10k: Remove unused variable in processing credit report Sujith Manoharan
` (8 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
The chances of a WMI command exceeding the target credit
size is low, so use likely() and friends.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 3641973..381e0e8 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -218,9 +218,9 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
skb_cb = ATH10K_SKB_CB(skb);
transfer_len = skb->len;
- if (transfer_len <= htc->target_credit_size)
+ if (likely(transfer_len <= htc->target_credit_size)) {
credits_required = 1;
- else {
+ } else {
/* figure out how many credits this message requires */
credits_required = transfer_len / htc->target_credit_size;
remainder = transfer_len % htc->target_credit_size;
@@ -229,8 +229,8 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
credits_required++;
}
- ath10k_dbg(ATH10K_DBG_HTC, "%s: creds required %d got %d\n",
- __func__, credits_required, ep->tx_credits);
+ ath10k_dbg(ATH10K_DBG_HTC, "Credits required %d got %d\n",
+ credits_required, ep->tx_credits);
if (ep->tx_credits < credits_required) {
__skb_queue_head(&ep->tx_queue, skb);
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 13/20] ath10k: Remove unused variable in processing credit report
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (10 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 12/20] ath10k: Optimize credit allocation Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 14/20] ath10k: Print HTC service name Sujith Manoharan
` (7 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htc.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 381e0e8..f820059 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -379,9 +379,7 @@ static void ath10k_htc_process_credit_report(struct ath10k_htc *htc,
enum ath10k_htc_ep_id eid)
{
struct ath10k_htc_ep *ep;
- int total_credits = 0;
- int n_reports;
- int i;
+ int i, n_reports;
if (len % sizeof(*report))
ath10k_warn("Uneven credit report len %d", len);
@@ -401,13 +399,8 @@ static void ath10k_htc_process_credit_report(struct ath10k_htc *htc,
if (ep->tx_credits && !skb_queue_empty(&ep->tx_queue))
queue_work(htc->ar->workqueue, &ep->send_work);
-
- total_credits += report->credits;
}
spin_unlock_bh(&htc->tx_lock);
-
- ath10k_dbg(ATH10K_DBG_HTC, "report indicated %d credits total\n",
- total_credits);
}
static int ath10k_htc_process_trailer(struct ath10k_htc *htc,
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 14/20] ath10k: Print HTC service name
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (11 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 13/20] ath10k: Remove unused variable in processing credit report Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 15/20] ath10k: Fix typo Sujith Manoharan
` (6 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htc.c | 54 ++++++++++++++++++++++++++++-------
1 file changed, 44 insertions(+), 10 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index f820059..fd07d34 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -606,6 +606,36 @@ static void ath10k_htc_control_rx_complete(struct ath10k *ar, struct sk_buff *sk
/* Init/Deinit */
/***************/
+static const char *htc_service_name(enum ath10k_htc_svc_id id)
+{
+ switch(id) {
+ case ATH10K_HTC_SVC_ID_RESERVED:
+ return "Reserved";
+ case ATH10K_HTC_SVC_ID_RSVD_CTRL:
+ return "Control";
+ case ATH10K_HTC_SVC_ID_WMI_CONTROL:
+ return "WMI";
+ case ATH10K_HTC_SVC_ID_WMI_DATA_BE:
+ return "DATA BE";
+ case ATH10K_HTC_SVC_ID_WMI_DATA_BK:
+ return "DATA BK";
+ case ATH10K_HTC_SVC_ID_WMI_DATA_VI:
+ return "DATA VI";
+ case ATH10K_HTC_SVC_ID_WMI_DATA_VO:
+ return "DATA VO";
+ case ATH10K_HTC_SVC_ID_NMI_CONTROL:
+ return "NMI Control";
+ case ATH10K_HTC_SVC_ID_NMI_DATA:
+ return "NMI Data";
+ case ATH10K_HTC_SVC_ID_HTT_DATA_MSG:
+ return "HTT Data";
+ case ATH10K_HTC_SVC_ID_TEST_RAW_STREAMS:
+ return "RAW";
+ }
+
+ return "Unknown";
+}
+
static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc)
{
struct ath10k_htc_ep *ep;
@@ -759,8 +789,8 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
tx_alloc = ath10k_htc_get_credit_allocation(htc,
conn_req->service_id);
if (!tx_alloc)
- ath10k_warn("Service 0x%x does not allocate target credits\n",
- conn_req->service_id);
+ ath10k_warn("HTC Service %s does not allocate target credits\n",
+ htc_service_name(conn_req->service_id));
skb = ath10k_htc_build_tx_ctrl_skb(htc->ar);
if (!skb) {
@@ -818,15 +848,15 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
}
ath10k_dbg(ATH10K_DBG_HTC,
- "Service 0x%x connect response from target: status: 0x%x, assigned ep: 0x%x\n",
- service_id, resp_msg->status, resp_msg->eid);
+ "HTC Service %s connect response: status: 0x%x, assigned ep: 0x%x\n",
+ htc_service_name(service_id), resp_msg->status, resp_msg->eid);
conn_resp->connect_resp_code = resp_msg->status;
/* check response status */
if (resp_msg->status != ATH10K_HTC_CONN_SVC_STATUS_SUCCESS) {
- ath10k_err("Service 0x%x connect request failed with status: 0x%x)\n",
- service_id, resp_msg->status);
+ ath10k_err("HTC Service %s connect request failed: 0x%x)\n",
+ htc_service_name(service_id), resp_msg->status);
return -EPROTO;
}
@@ -875,15 +905,19 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
return status;
ath10k_dbg(ATH10K_DBG_HTC,
- "HTC service: 0x%x UL pipe: %d DL pipe: %d eid: %d ready\n",
- ep->service_id, ep->ul_pipe_id,
+ "HTC service: %s UL pipe: %d DL pipe: %d eid: %d ready\n",
+ htc_service_name(ep->service_id), ep->ul_pipe_id,
ep->dl_pipe_id, ep->eid);
+ ath10k_dbg(ATH10K_DBG_HTC,
+ "EP %d UL polled: %d, DL polled: %d\n",
+ ep->eid, ep->ul_is_polled, ep->dl_is_polled);
+
if (disable_credit_flow_ctrl && ep->tx_credit_flow_enabled) {
ep->tx_credit_flow_enabled = false;
ath10k_dbg(ATH10K_DBG_HTC,
- "HTC service: 0x%x eid: %d TX flow control disabled\n",
- ep->service_id, assigned_eid);
+ "HTC service: %s eid: %d TX flow control disabled\n",
+ htc_service_name(ep->service_id), assigned_eid);
}
return status;
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 15/20] ath10k: Fix typo
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (12 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 14/20] ath10k: Print HTC service name Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 16/20] ath10k: Merge txrx.c with HTT Sujith Manoharan
` (5 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/ce.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 352cf43..e8d8d0c 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -244,8 +244,8 @@ static inline void ath10k_ce_copy_complete_intr_disable(struct ath10k *ar,
host_ie_addr & ~HOST_IE_COPY_COMPLETE_MASK);
}
-static inline void ath10k_ce_watermark_intr_diable(struct ath10k *ar,
- u32 ce_ctrl_addr)
+static inline void ath10k_ce_watermark_intr_disable(struct ath10k *ar,
+ u32 ce_ctrl_addr)
{
u32 host_ie_addr = ath10k_pci_read32(ar, ce_ctrl_addr + HOST_IE_ADDRESS);
@@ -845,7 +845,7 @@ static void ath10k_ce_per_engine_handler_adjust(struct ce_state *ce_state,
else
ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr);
- ath10k_ce_watermark_intr_diable(ar, ctrl_addr);
+ ath10k_ce_watermark_intr_disable(ar, ctrl_addr);
ath10k_pci_sleep(ar);
}
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 16/20] ath10k: Merge txrx.c with HTT
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (13 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 15/20] ath10k: Fix typo Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 17/20] ath10k: Use IS_ALIGNED macro to check alignment Sujith Manoharan
` (4 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/Makefile | 1 -
drivers/net/wireless/ath/ath10k/htt.c | 129 +++++++++-
drivers/net/wireless/ath/ath10k/htt.h | 16 ++
drivers/net/wireless/ath/ath10k/htt_rx.c | 174 ++++++++++++-
drivers/net/wireless/ath/ath10k/htt_tx.c | 104 +++++++-
drivers/net/wireless/ath/ath10k/mac.c | 1 -
drivers/net/wireless/ath/ath10k/txrx.c | 415 -------------------------------
drivers/net/wireless/ath/ath10k/txrx.h | 39 ---
8 files changed, 419 insertions(+), 460 deletions(-)
delete mode 100644 drivers/net/wireless/ath/ath10k/txrx.c
delete mode 100644 drivers/net/wireless/ath/ath10k/txrx.h
diff --git a/drivers/net/wireless/ath/ath10k/Makefile b/drivers/net/wireless/ath/ath10k/Makefile
index a4179f4..36444fe 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -6,7 +6,6 @@ ath10k_core-y += mac.o \
htt.o \
htt_rx.o \
htt_tx.o \
- txrx.o \
wmi.o \
bmi.o
diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c
index 5ad552d..1b92f84 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -21,6 +21,133 @@
#include "core.h"
#include "debug.h"
+/***********************/
+/* HTT Peer management */
+/***********************/
+
+struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
+ const u8 *addr)
+{
+ struct ath10k_peer *peer;
+
+ lockdep_assert_held(&ar->data_lock);
+
+ list_for_each_entry(peer, &ar->peers, list) {
+ if (peer->vdev_id != vdev_id)
+ continue;
+ if (memcmp(peer->addr, addr, ETH_ALEN))
+ continue;
+
+ return peer;
+ }
+
+ return NULL;
+}
+
+static struct ath10k_peer *ath10k_peer_find_by_id(struct ath10k *ar,
+ int peer_id)
+{
+ struct ath10k_peer *peer;
+
+ lockdep_assert_held(&ar->data_lock);
+
+ list_for_each_entry(peer, &ar->peers, list)
+ if (test_bit(peer_id, peer->peer_ids))
+ return peer;
+
+ return NULL;
+}
+
+static int ath10k_wait_for_peer_common(struct ath10k *ar, int vdev_id,
+ const u8 *addr, bool expect_mapped)
+{
+ int ret;
+
+ ret = wait_event_timeout(ar->peer_mapping_wq, ({
+ bool mapped;
+
+ spin_lock_bh(&ar->data_lock);
+ mapped = !!ath10k_peer_find(ar, vdev_id, addr);
+ spin_unlock_bh(&ar->data_lock);
+
+ mapped == expect_mapped;
+ }), 3*HZ);
+
+ if (ret <= 0)
+ return -ETIMEDOUT;
+
+ return 0;
+}
+
+int ath10k_wait_for_peer_created(struct ath10k *ar, int vdev_id, const u8 *addr)
+{
+ return ath10k_wait_for_peer_common(ar, vdev_id, addr, true);
+}
+
+int ath10k_wait_for_peer_deleted(struct ath10k *ar, int vdev_id, const u8 *addr)
+{
+ return ath10k_wait_for_peer_common(ar, vdev_id, addr, false);
+}
+
+void ath10k_peer_map_event(struct ath10k_htt *htt,
+ struct htt_peer_map_event *ev)
+{
+ struct ath10k *ar = htt->ar;
+ struct ath10k_peer *peer;
+
+ spin_lock_bh(&ar->data_lock);
+ peer = ath10k_peer_find(ar, ev->vdev_id, ev->addr);
+ if (!peer) {
+ peer = kzalloc(sizeof(*peer), GFP_ATOMIC);
+ if (!peer)
+ goto exit;
+
+ peer->vdev_id = ev->vdev_id;
+ memcpy(peer->addr, ev->addr, ETH_ALEN);
+ list_add(&peer->list, &ar->peers);
+ wake_up(&ar->peer_mapping_wq);
+ }
+
+ ath10k_dbg(ATH10K_DBG_HTT, "htt peer map vdev %d peer %pM id %d\n",
+ ev->vdev_id, ev->addr, ev->peer_id);
+
+ set_bit(ev->peer_id, peer->peer_ids);
+exit:
+ spin_unlock_bh(&ar->data_lock);
+}
+
+void ath10k_peer_unmap_event(struct ath10k_htt *htt,
+ struct htt_peer_unmap_event *ev)
+{
+ struct ath10k *ar = htt->ar;
+ struct ath10k_peer *peer;
+
+ spin_lock_bh(&ar->data_lock);
+ peer = ath10k_peer_find_by_id(ar, ev->peer_id);
+ if (!peer) {
+ ath10k_warn("unknown peer id %d\n", ev->peer_id);
+ goto exit;
+ }
+
+ ath10k_dbg(ATH10K_DBG_HTT, "htt peer unmap vdev %d peer %pM id %d\n",
+ peer->vdev_id, peer->addr, ev->peer_id);
+
+ clear_bit(ev->peer_id, peer->peer_ids);
+
+ if (bitmap_empty(peer->peer_ids, ATH10K_MAX_NUM_PEER_IDS)) {
+ list_del(&peer->list);
+ kfree(peer);
+ wake_up(&ar->peer_mapping_wq);
+ }
+
+exit:
+ spin_unlock_bh(&ar->data_lock);
+}
+
+/************/
+/* HTT Core */
+/************/
+
static void ath10k_htt_stop_queue(struct ath10k *ar)
{
ieee80211_stop_queues(ar->hw);
@@ -110,8 +237,6 @@ err_htc_attach:
return NULL;
}
-#define HTT_TARGET_VERSION_TIMEOUT_HZ (3*HZ)
-
static int ath10k_htt_verify_version(struct ath10k_htt *htt)
{
ath10k_dbg(ATH10K_DBG_HTT,
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 2853a53..d416a4f 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -26,6 +26,7 @@
#define HTT_CURRENT_VERSION_MAJOR 2
#define HTT_CURRENT_VERSION_MINOR 1
+#define HTT_TARGET_VERSION_TIMEOUT_HZ (3*HZ)
enum htt_dbg_stats_type {
HTT_DBG_STATS_WAL_PDEV_TXRX = 1 << 0,
@@ -1274,4 +1275,19 @@ int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt);
void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id);
int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *);
int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *);
+
+void ath10k_txrx_tx_unref(struct ath10k_htt *htt, struct sk_buff *txdesc);
+void ath10k_txrx_tx_completed(struct ath10k_htt *htt,
+ const struct htt_tx_done *tx_done);
+struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
+ const u8 *addr);
+int ath10k_wait_for_peer_created(struct ath10k *ar, int vdev_id,
+ const u8 *addr);
+int ath10k_wait_for_peer_deleted(struct ath10k *ar, int vdev_id,
+ const u8 *addr);
+void ath10k_peer_map_event(struct ath10k_htt *htt,
+ struct htt_peer_map_event *ev);
+void ath10k_peer_unmap_event(struct ath10k_htt *htt,
+ struct htt_peer_unmap_event *ev);
+
#endif
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index ac4dc4a..6e09581 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -17,7 +17,6 @@
#include "htc.h"
#include "htt.h"
-#include "txrx.h"
#include "debug.h"
#include <linux/log2.h>
@@ -39,6 +38,179 @@
/* when under memory pressure rx ring refill may fail and needs a retry */
#define HTT_RX_RING_REFILL_RETRY_MS 50
+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;
+ bw = info1 & 3;
+ sgi = info2 & 1;
+
+ status->rate_idx = mcs + (nss * 10);
+
+ 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->flag |= RX_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->status == HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR)
+ status->flag |= RX_FLAG_MMIC_ERROR;
+
+ if (info->fcs_err)
+ status->flag |= RX_FLAG_FAILED_FCS_CRC;
+
+ status->signal = info->signal;
+
+ rcu_read_lock();
+ ch = rcu_dereference(ar->scan_channel);
+ if (!ch)
+ ch = rcu_dereference(ar->rx_channel);
+
+ if (!ch) {
+ rcu_read_unlock();
+ 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;
+ rcu_read_unlock();
+
+ ath10k_dbg(ATH10K_DBG_HTT,
+ "rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u\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->flag & RX_FLAG_80MHZ ? "80" : "",
+ status->flag & RX_FLAG_SHORT_GI ? "sgi " : "",
+ status->rate_idx,
+ status->vht_nss,
+ status->freq,
+ status->band);
+
+ ieee80211_rx(ar->hw, info->skb);
+}
+
static int ath10k_htt_rx_ring_size(struct ath10k_htt *htt)
{
int size;
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 2e6e0d9..7a10503 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -17,7 +17,6 @@
#include <linux/etherdevice.h>
#include "htt.h"
-#include "txrx.h"
#include "debug.h"
int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt)
@@ -226,6 +225,109 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt)
return 0;
}
+static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb)
+{
+ if (!ATH10K_SKB_CB(skb)->htt.is_offchan)
+ return;
+
+ /* If the original wait_for_completion() timed out before
+ * {data,mgmt}_tx_completed() was called then we could complete
+ * offchan_tx_completed for a different skb. Prevent this by using
+ * offchan_tx_skb. */
+ spin_lock_bh(&ar->data_lock);
+ if (ar->offchan_tx_skb != skb) {
+ ath10k_warn("completed old offchannel frame\n");
+ goto out;
+ }
+
+ complete(&ar->offchan_tx_completed);
+ ar->offchan_tx_skb = NULL; /* just for sanity */
+
+ ath10k_dbg(ATH10K_DBG_HTT, "completed offchannel skb %p\n", skb);
+out:
+ spin_unlock_bh(&ar->data_lock);
+}
+
+void ath10k_txrx_tx_unref(struct ath10k_htt *htt, struct sk_buff *txdesc)
+{
+ struct device *dev = htt->ar->dev;
+ struct ieee80211_tx_info *info;
+ struct sk_buff *txfrag = ATH10K_SKB_CB(txdesc)->htt.txfrag;
+ struct sk_buff *msdu = ATH10K_SKB_CB(txdesc)->htt.msdu;
+ int ret;
+
+ if (ATH10K_SKB_CB(txdesc)->htt.refcount == 0)
+ return;
+
+ ATH10K_SKB_CB(txdesc)->htt.refcount--;
+
+ if (ATH10K_SKB_CB(txdesc)->htt.refcount > 0)
+ return;
+
+ if (txfrag) {
+ ret = ath10k_skb_unmap(dev, txfrag);
+ if (ret)
+ ath10k_warn("txfrag unmap failed (%d)\n", ret);
+
+ dev_kfree_skb_any(txfrag);
+ }
+
+ ret = ath10k_skb_unmap(dev, msdu);
+ if (ret)
+ ath10k_warn("data skb unmap failed (%d)\n", ret);
+
+ ath10k_report_offchan_tx(htt->ar, msdu);
+
+ info = IEEE80211_SKB_CB(msdu);
+ memset(&info->status, 0, sizeof(info->status));
+
+ if (ATH10K_SKB_CB(txdesc)->htt.discard) {
+ ieee80211_free_txskb(htt->ar->hw, msdu);
+ goto exit;
+ }
+
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ info->flags |= IEEE80211_TX_STAT_ACK;
+
+ if (ATH10K_SKB_CB(txdesc)->htt.no_ack)
+ info->flags &= ~IEEE80211_TX_STAT_ACK;
+
+ ieee80211_tx_status(htt->ar->hw, msdu);
+ /* we do not own the msdu anymore */
+
+exit:
+ spin_lock_bh(&htt->tx_lock);
+ htt->pending_tx[ATH10K_SKB_CB(txdesc)->htt.msdu_id] = NULL;
+ ath10k_htt_tx_free_msdu_id(htt, ATH10K_SKB_CB(txdesc)->htt.msdu_id);
+ if (bitmap_empty(htt->used_msdu_ids, HTT_MAX_NUM_PENDING_TX))
+ wake_up(&htt->empty_tx_wq);
+ spin_unlock_bh(&htt->tx_lock);
+
+ dev_kfree_skb_any(txdesc);
+}
+
+void ath10k_txrx_tx_completed(struct ath10k_htt *htt,
+ const struct htt_tx_done *tx_done)
+{
+ struct sk_buff *txdesc;
+
+ ath10k_dbg(ATH10K_DBG_HTT, "htt tx completion msdu_id %u discard %d no_ack %d\n",
+ tx_done->msdu_id, !!tx_done->discard, !!tx_done->no_ack);
+
+ if (tx_done->msdu_id >= ARRAY_SIZE(htt->pending_tx)) {
+ ath10k_warn("warning: msdu_id %d too big, ignoring\n",
+ tx_done->msdu_id);
+ return;
+ }
+
+ txdesc = htt->pending_tx[tx_done->msdu_id];
+
+ ATH10K_SKB_CB(txdesc)->htt.discard = tx_done->discard;
+ ATH10K_SKB_CB(txdesc)->htt.no_ack = tx_done->no_ack;
+
+ ath10k_txrx_tx_unref(htt, txdesc);
+}
+
int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
{
struct device *dev = htt->ar->dev;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 8e8987e..0dfeae8 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -22,7 +22,6 @@
#include "debug.h"
#include "wmi.h"
#include "htt.h"
-#include "txrx.h"
/**********/
/* Crypto */
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
deleted file mode 100644
index d333f45..0000000
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Copyright (c) 2005-2011 Atheros Communications Inc.
- * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "core.h"
-#include "txrx.h"
-#include "htt.h"
-#include "debug.h"
-
-static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb)
-{
- if (!ATH10K_SKB_CB(skb)->htt.is_offchan)
- return;
-
- /* If the original wait_for_completion() timed out before
- * {data,mgmt}_tx_completed() was called then we could complete
- * offchan_tx_completed for a different skb. Prevent this by using
- * offchan_tx_skb. */
- spin_lock_bh(&ar->data_lock);
- if (ar->offchan_tx_skb != skb) {
- ath10k_warn("completed old offchannel frame\n");
- goto out;
- }
-
- complete(&ar->offchan_tx_completed);
- ar->offchan_tx_skb = NULL; /* just for sanity */
-
- ath10k_dbg(ATH10K_DBG_HTT, "completed offchannel skb %p\n", skb);
-out:
- spin_unlock_bh(&ar->data_lock);
-}
-
-void ath10k_txrx_tx_unref(struct ath10k_htt *htt, struct sk_buff *txdesc)
-{
- struct device *dev = htt->ar->dev;
- struct ieee80211_tx_info *info;
- struct sk_buff *txfrag = ATH10K_SKB_CB(txdesc)->htt.txfrag;
- struct sk_buff *msdu = ATH10K_SKB_CB(txdesc)->htt.msdu;
- int ret;
-
- if (ATH10K_SKB_CB(txdesc)->htt.refcount == 0)
- return;
-
- ATH10K_SKB_CB(txdesc)->htt.refcount--;
-
- if (ATH10K_SKB_CB(txdesc)->htt.refcount > 0)
- return;
-
- if (txfrag) {
- ret = ath10k_skb_unmap(dev, txfrag);
- if (ret)
- ath10k_warn("txfrag unmap failed (%d)\n", ret);
-
- dev_kfree_skb_any(txfrag);
- }
-
- ret = ath10k_skb_unmap(dev, msdu);
- if (ret)
- ath10k_warn("data skb unmap failed (%d)\n", ret);
-
- ath10k_report_offchan_tx(htt->ar, msdu);
-
- info = IEEE80211_SKB_CB(msdu);
- memset(&info->status, 0, sizeof(info->status));
-
- if (ATH10K_SKB_CB(txdesc)->htt.discard) {
- ieee80211_free_txskb(htt->ar->hw, msdu);
- goto exit;
- }
-
- if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
- info->flags |= IEEE80211_TX_STAT_ACK;
-
- if (ATH10K_SKB_CB(txdesc)->htt.no_ack)
- info->flags &= ~IEEE80211_TX_STAT_ACK;
-
- ieee80211_tx_status(htt->ar->hw, msdu);
- /* we do not own the msdu anymore */
-
-exit:
- spin_lock_bh(&htt->tx_lock);
- htt->pending_tx[ATH10K_SKB_CB(txdesc)->htt.msdu_id] = NULL;
- ath10k_htt_tx_free_msdu_id(htt, ATH10K_SKB_CB(txdesc)->htt.msdu_id);
- if (bitmap_empty(htt->used_msdu_ids, HTT_MAX_NUM_PENDING_TX))
- wake_up(&htt->empty_tx_wq);
- spin_unlock_bh(&htt->tx_lock);
-
- dev_kfree_skb_any(txdesc);
-}
-
-void ath10k_txrx_tx_completed(struct ath10k_htt *htt,
- const struct htt_tx_done *tx_done)
-{
- struct sk_buff *txdesc;
-
- ath10k_dbg(ATH10K_DBG_HTT, "htt tx completion msdu_id %u discard %d no_ack %d\n",
- tx_done->msdu_id, !!tx_done->discard, !!tx_done->no_ack);
-
- if (tx_done->msdu_id >= ARRAY_SIZE(htt->pending_tx)) {
- ath10k_warn("warning: msdu_id %d too big, ignoring\n",
- tx_done->msdu_id);
- return;
- }
-
- txdesc = htt->pending_tx[tx_done->msdu_id];
-
- ATH10K_SKB_CB(txdesc)->htt.discard = tx_done->discard;
- ATH10K_SKB_CB(txdesc)->htt.no_ack = tx_done->no_ack;
-
- ath10k_txrx_tx_unref(htt, txdesc);
-}
-
-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;
- bw = info1 & 3;
- sgi = info2 & 1;
-
- status->rate_idx = mcs + (nss * 10);
-
- 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->flag |= RX_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->status == HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR)
- status->flag |= RX_FLAG_MMIC_ERROR;
-
- if (info->fcs_err)
- status->flag |= RX_FLAG_FAILED_FCS_CRC;
-
- status->signal = info->signal;
-
- rcu_read_lock();
- ch = rcu_dereference(ar->scan_channel);
- if (!ch)
- ch = rcu_dereference(ar->rx_channel);
-
- if (!ch) {
- rcu_read_unlock();
- 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;
- rcu_read_unlock();
-
- ath10k_dbg(ATH10K_DBG_HTT,
- "rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u\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->flag & RX_FLAG_80MHZ ? "80" : "",
- status->flag & RX_FLAG_SHORT_GI ? "sgi " : "",
- status->rate_idx,
- status->vht_nss,
- status->freq,
- status->band);
-
- ieee80211_rx(ar->hw, info->skb);
-}
-
-struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
- const u8 *addr)
-{
- struct ath10k_peer *peer;
-
- lockdep_assert_held(&ar->data_lock);
-
- list_for_each_entry(peer, &ar->peers, list) {
- if (peer->vdev_id != vdev_id)
- continue;
- if (memcmp(peer->addr, addr, ETH_ALEN))
- continue;
-
- return peer;
- }
-
- return NULL;
-}
-
-static struct ath10k_peer *ath10k_peer_find_by_id(struct ath10k *ar,
- int peer_id)
-{
- struct ath10k_peer *peer;
-
- lockdep_assert_held(&ar->data_lock);
-
- list_for_each_entry(peer, &ar->peers, list)
- if (test_bit(peer_id, peer->peer_ids))
- return peer;
-
- return NULL;
-}
-
-static int ath10k_wait_for_peer_common(struct ath10k *ar, int vdev_id,
- const u8 *addr, bool expect_mapped)
-{
- int ret;
-
- ret = wait_event_timeout(ar->peer_mapping_wq, ({
- bool mapped;
-
- spin_lock_bh(&ar->data_lock);
- mapped = !!ath10k_peer_find(ar, vdev_id, addr);
- spin_unlock_bh(&ar->data_lock);
-
- mapped == expect_mapped;
- }), 3*HZ);
-
- if (ret <= 0)
- return -ETIMEDOUT;
-
- return 0;
-}
-
-int ath10k_wait_for_peer_created(struct ath10k *ar, int vdev_id, const u8 *addr)
-{
- return ath10k_wait_for_peer_common(ar, vdev_id, addr, true);
-}
-
-int ath10k_wait_for_peer_deleted(struct ath10k *ar, int vdev_id, const u8 *addr)
-{
- return ath10k_wait_for_peer_common(ar, vdev_id, addr, false);
-}
-
-void ath10k_peer_map_event(struct ath10k_htt *htt,
- struct htt_peer_map_event *ev)
-{
- struct ath10k *ar = htt->ar;
- struct ath10k_peer *peer;
-
- spin_lock_bh(&ar->data_lock);
- peer = ath10k_peer_find(ar, ev->vdev_id, ev->addr);
- if (!peer) {
- peer = kzalloc(sizeof(*peer), GFP_ATOMIC);
- if (!peer)
- goto exit;
-
- peer->vdev_id = ev->vdev_id;
- memcpy(peer->addr, ev->addr, ETH_ALEN);
- list_add(&peer->list, &ar->peers);
- wake_up(&ar->peer_mapping_wq);
- }
-
- ath10k_dbg(ATH10K_DBG_HTT, "htt peer map vdev %d peer %pM id %d\n",
- ev->vdev_id, ev->addr, ev->peer_id);
-
- set_bit(ev->peer_id, peer->peer_ids);
-exit:
- spin_unlock_bh(&ar->data_lock);
-}
-
-void ath10k_peer_unmap_event(struct ath10k_htt *htt,
- struct htt_peer_unmap_event *ev)
-{
- struct ath10k *ar = htt->ar;
- struct ath10k_peer *peer;
-
- spin_lock_bh(&ar->data_lock);
- peer = ath10k_peer_find_by_id(ar, ev->peer_id);
- if (!peer) {
- ath10k_warn("unknown peer id %d\n", ev->peer_id);
- goto exit;
- }
-
- ath10k_dbg(ATH10K_DBG_HTT, "htt peer unmap vdev %d peer %pM id %d\n",
- peer->vdev_id, peer->addr, ev->peer_id);
-
- clear_bit(ev->peer_id, peer->peer_ids);
-
- if (bitmap_empty(peer->peer_ids, ATH10K_MAX_NUM_PEER_IDS)) {
- list_del(&peer->list);
- kfree(peer);
- wake_up(&ar->peer_mapping_wq);
- }
-
-exit:
- spin_unlock_bh(&ar->data_lock);
-}
diff --git a/drivers/net/wireless/ath/ath10k/txrx.h b/drivers/net/wireless/ath/ath10k/txrx.h
deleted file mode 100644
index 72afb20..0000000
--- a/drivers/net/wireless/ath/ath10k/txrx.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2005-2011 Atheros Communications Inc.
- * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#ifndef _TXRX_H
-#define _TXRX_H
-
-#include "htt.h"
-
-void ath10k_txrx_tx_unref(struct ath10k_htt *htt, struct sk_buff *txdesc);
-void ath10k_txrx_tx_completed(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);
-int ath10k_wait_for_peer_created(struct ath10k *ar, int vdev_id,
- const u8 *addr);
-int ath10k_wait_for_peer_deleted(struct ath10k *ar, int vdev_id,
- const u8 *addr);
-
-void ath10k_peer_map_event(struct ath10k_htt *htt,
- struct htt_peer_map_event *ev);
-void ath10k_peer_unmap_event(struct ath10k_htt *htt,
- struct htt_peer_unmap_event *ev);
-
-#endif
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 17/20] ath10k: Use IS_ALIGNED macro to check alignment
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (14 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 16/20] ath10k: Merge txrx.c with HTT Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c Sujith Manoharan
` (3 subsequent siblings)
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htc.c | 4 +++-
drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +-
drivers/net/wireless/ath/ath10k/htt_tx.c | 4 ++--
drivers/net/wireless/ath/ath10k/pci.c | 3 ++-
drivers/net/wireless/ath/ath10k/wmi.c | 3 ++-
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index fd07d34..1e4c075 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -936,7 +936,9 @@ struct sk_buff *ath10k_htc_alloc_skb(int size)
skb_reserve(skb, sizeof(struct ath10k_htc_hdr));
/* FW/HTC requires 4-byte aligned streams */
- WARN_ONCE((unsigned long)skb->data & 0x3, "unaligned skb");
+ if (!IS_ALIGNED((unsigned long)skb->data, 4))
+ ath10k_warn("Unaligned HTC tx skb\n");
+
return skb;
}
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 6e09581..cc385e7 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1159,7 +1159,7 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
struct htt_resp *resp = (struct htt_resp *)skb->data;
/* confirm alignment */
- if ((((unsigned long)skb->data) & 0x3) != 0)
+ if (!IS_ALIGNED((unsigned long)skb->data, 4))
ath10k_warn("unaligned htt message, expect trouble\n");
ath10k_dbg(ATH10K_DBG_HTT, "HTT RX, msg_type: 0x%0X\n",
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 7a10503..881d390 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -153,7 +153,7 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt)
* the HW expects the buffer to be an integral number of 4-byte
* "words"
*/
- BUILD_BUG_ON((HTT_RX_BUF_SIZE & 0x3) != 0);
+ BUILD_BUG_ON(!IS_ALIGNED(HTT_RX_BUF_SIZE, 4));
BUILD_BUG_ON((HTT_RX_BUF_SIZE & HTT_MAX_CACHE_LINE_SIZE_MASK) != 0);
len = sizeof(cmd->hdr) + sizeof(cmd->rx_setup.hdr)
@@ -435,7 +435,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
goto err;
}
- if ((unsigned long)txdesc->data & 0x3) {
+ if (!IS_ALIGNED((unsigned long)txdesc->data, 4)) {
ath10k_warn("htt alignment check failed. dropping packet.\n");
res = -EIO;
goto err;
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index a7d321c..209b310 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -120,7 +120,8 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
* this fn
*/
if (address < DRAM_BASE_ADDRESS) {
- if ((address & 0x3) || ((dma_addr_t)data & 0x3))
+ if (!IS_ALIGNED(address, 4) ||
+ !IS_ALIGNED((unsigned long)data, 4))
return -EIO;
while ((nbytes >= 4) && ((ret = ath10k_pci_diag_read_access(
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 577a63e..248a886 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -65,7 +65,8 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)
return NULL;
skb_reserve(skb, WMI_SKB_HEADROOM);
- WARN_ONCE((unsigned long)skb->data & 0x3, "unaligned skb");
+ if (!IS_ALIGNED((unsigned long)skb->data, 4))
+ ath10k_warn("Unaligned WMI skb\n");
skb_put(skb, round_len);
memset(skb->data, 0, round_len);
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (15 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 17/20] ath10k: Use IS_ALIGNED macro to check alignment Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-29 5:51 ` Michal Kazior
2013-04-28 15:31 ` [ath9k-devel] [PATCH 19/20] ath10k: Simplify excessively nested HTT structure layout Sujith Manoharan
` (2 subsequent siblings)
19 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htt.h | 12 ------------
drivers/net/wireless/ath/ath10k/htt_rx.c | 12 ++++++++++++
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index d416a4f..bd3b0b4 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -478,18 +478,6 @@ struct htt_rx_indication {
struct htt_rx_indication_mpdu_range mpdu_ranges[0];
} __packed;
-static inline struct htt_rx_indication_mpdu_range *
- htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
-{
- void *ptr = rx_ind;
-
- ptr += sizeof(rx_ind->hdr)
- + sizeof(rx_ind->ppdu)
- + sizeof(rx_ind->prefix)
- + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
- return ptr;
-}
-
enum htt_rx_flush_mpdu_status {
HTT_RX_FLUSH_MPDU_DISCARD = 0,
HTT_RX_FLUSH_MPDU_REORDER = 1,
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index cc385e7..a310dde 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -929,6 +929,18 @@ static bool ath10k_htt_rx_has_fcs_err(struct sk_buff *skb)
return false;
}
+static inline struct htt_rx_indication_mpdu_range *
+htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
+{
+ void *ptr = rx_ind;
+
+ ptr += sizeof(rx_ind->hdr)
+ + sizeof(rx_ind->ppdu)
+ + sizeof(rx_ind->prefix)
+ + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
+ return ptr;
+}
+
static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
struct htt_rx_indication *rx)
{
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c
2013-04-28 15:31 ` [ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c Sujith Manoharan
@ 2013-04-29 5:51 ` Michal Kazior
2013-04-29 6:03 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Michal Kazior @ 2013-04-29 5:51 UTC (permalink / raw)
To: ath9k-devel
On 28/04/13 17:31, Sujith Manoharan wrote:
> From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
>
> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath10k/htt.h | 12 ------------
> drivers/net/wireless/ath/ath10k/htt_rx.c | 12 ++++++++++++
> 2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
> index d416a4f..bd3b0b4 100644
> --- a/drivers/net/wireless/ath/ath10k/htt.h
> +++ b/drivers/net/wireless/ath/ath10k/htt.h
> @@ -478,18 +478,6 @@ struct htt_rx_indication {
> struct htt_rx_indication_mpdu_range mpdu_ranges[0];
> } __packed;
>
> -static inline struct htt_rx_indication_mpdu_range *
> - htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
> -{
> - void *ptr = rx_ind;
> -
> - ptr += sizeof(rx_ind->hdr)
> - + sizeof(rx_ind->ppdu)
> - + sizeof(rx_ind->prefix)
> - + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
> - return ptr;
> -}
> -
I'm not really convinced with this. The idea is the function defines how
to access the variadic structure member position so it should stay close
to the structure definition. This could as well be a #define but an
inline function looks cleaner IMHO.
-- Pozdrawiam / Best regards, Michal Kazior.
^ permalink raw reply [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c
2013-04-29 5:51 ` Michal Kazior
@ 2013-04-29 6:03 ` Sujith Manoharan
0 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-29 6:03 UTC (permalink / raw)
To: ath9k-devel
Michal Kazior wrote:
> I'm not really convinced with this. The idea is the function defines how
> to access the variadic structure member position so it should stay close
> to the structure definition. This could as well be a #define but an
> inline function looks cleaner IMHO.
Alright, we can keep it there. Kalle, please drop this patch.
Sujith
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 19/20] ath10k: Simplify excessively nested HTT structure layout
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (16 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach Sujith Manoharan
2013-04-30 11:43 ` [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Kalle Valo
19 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
There are various sructures inside HTT/RX_RING that contain
very few elements. Simplify these.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htt.c | 2 +-
drivers/net/wireless/ath/ath10k/htt.h | 48 +++++++++++++-------------------
drivers/net/wireless/ath/ath10k/htt_rx.c | 37 ++++++++++++------------
3 files changed, 40 insertions(+), 47 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c
index 1b92f84..09acb00 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -200,7 +200,7 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar)
return NULL;
htt->ar = ar;
- htt->cfg.max_throughput_mbps = 800;
+ htt->max_throughput_mbps = 800;
/*
* Connect to HTC service.
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index bd3b0b4..e4bac01 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1090,38 +1090,35 @@ struct htt_rx_info {
bool fcs_err;
};
+#define HTT_MAX_NUM_PENDING_TX 512 /* FIXME: find proper value? */
+
struct ath10k_htt {
struct ath10k *ar;
enum ath10k_htc_ep_id eid;
- struct {
- int max_throughput_mbps;
- } cfg;
-
+ int max_throughput_mbps;
u8 target_version_major;
u8 target_version_minor;
struct completion target_version_received;
struct {
- struct {
- /*
- * Ring of network buffer objects - This ring is
- * used exclusively by the host SW. This ring
- * mirrors the dev_addrs_ring that is shared
- * between the host SW and the MAC HW. The host SW
- * uses this netbufs ring to locate the network
- * buffer objects whose data buffers the HW has
- * filled.
- */
- struct sk_buff **netbufs_ring;
- /*
- * Ring of buffer addresses -
- * This ring holds the "physical" device address of the
- * rx buffers the host SW provides for the MAC HW to
- * fill.
- */
- __le32 *paddrs_ring;
- } buf;
+ /*
+ * Ring of network buffer objects - This ring is
+ * used exclusively by the host SW. This ring
+ * mirrors the dev_addrs_ring that is shared
+ * between the host SW and the MAC HW. The host SW
+ * uses this netbufs ring to locate the network
+ * buffer objects whose data buffers the HW has
+ * filled.
+ */
+ struct sk_buff **netbufs_ring;
+ /*
+ * Ring of buffer addresses -
+ * This ring holds the "physical" device address of the
+ * rx buffers the host SW provides for the MAC HW to
+ * fill.
+ */
+ __le32 *paddrs_ring;
/*
* Base address of ring, as a "physical" device address
@@ -1168,11 +1165,6 @@ struct ath10k_htt {
unsigned int prefetch_len;
- struct {
- int htc_err_cnt;
- } stats;
-
-#define HTT_MAX_NUM_PENDING_TX 512 /* FIXME: find proper value? */
spinlock_t tx_lock;
struct sk_buff *pending_tx[HTT_MAX_NUM_PENDING_TX];
DECLARE_BITMAP(used_msdu_ids, HTT_MAX_NUM_PENDING_TX);
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index a310dde..95ffcc2 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -237,7 +237,7 @@ static int ath10k_htt_rx_ring_size(struct ath10k_htt *htt)
/* 1e6 bps/mbps / 1e3 ms per sec = 1000 */
size =
- htt->cfg.max_throughput_mbps +
+ htt->max_throughput_mbps +
1000 /
(8 * HTT_RX_AVG_FRM_BYTES) * HTT_RX_HOST_LATENCY_MAX_MS;
@@ -258,7 +258,7 @@ static int ath10k_htt_rx_ring_fill_level(struct ath10k_htt *htt)
/* 1e6 bps/mbps / 1e3 ms per sec = 1000 */
size =
- htt->cfg.max_throughput_mbps *
+ htt->max_throughput_mbps *
1000 /
(8 * HTT_RX_AVG_FRM_BYTES) * HTT_RX_HOST_LATENCY_WORST_LIKELY_MS;
@@ -316,8 +316,8 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
}
ATH10K_SKB_CB(skb)->paddr = paddr;
- htt->rx_ring.buf.netbufs_ring[idx] = skb;
- htt->rx_ring.buf.paddrs_ring[idx] = __cpu_to_le32(paddr);
+ htt->rx_ring.netbufs_ring[idx] = skb;
+ htt->rx_ring.paddrs_ring[idx] = __cpu_to_le32(paddr);
htt->rx_ring.fill_cnt++;
num--;
@@ -360,21 +360,21 @@ void ath10k_htt_rx_detach(struct ath10k_htt *htt)
while (sw_rd_idx != __le32_to_cpu(*(htt->rx_ring.alloc_idx.vaddr))) {
struct sk_buff *skb =
- htt->rx_ring.buf.netbufs_ring[sw_rd_idx];
+ htt->rx_ring.netbufs_ring[sw_rd_idx];
struct ath10k_skb_cb *cb = ATH10K_SKB_CB(skb);
dma_unmap_single(htt->ar->dev, cb->paddr,
skb->len + skb_tailroom(skb),
DMA_FROM_DEVICE);
- dev_kfree_skb_any(htt->rx_ring.buf.netbufs_ring[sw_rd_idx]);
+ dev_kfree_skb_any(htt->rx_ring.netbufs_ring[sw_rd_idx]);
sw_rd_idx++;
sw_rd_idx &= htt->rx_ring.size_mask;
}
dma_free_coherent(htt->ar->dev,
(htt->rx_ring.size *
- sizeof(htt->rx_ring.buf.paddrs_ring)),
- htt->rx_ring.buf.paddrs_ring,
+ sizeof(htt->rx_ring.paddrs_ring)),
+ htt->rx_ring.paddrs_ring,
htt->rx_ring.base_paddr);
dma_free_coherent(htt->ar->dev,
@@ -382,7 +382,7 @@ void ath10k_htt_rx_detach(struct ath10k_htt *htt)
htt->rx_ring.alloc_idx.vaddr,
htt->rx_ring.alloc_idx.paddr);
- kfree(htt->rx_ring.buf.netbufs_ring);
+ kfree(htt->rx_ring.netbufs_ring);
}
static inline struct sk_buff *ath10k_htt_rx_netbuf_pop(struct ath10k_htt *htt)
@@ -396,7 +396,7 @@ static inline struct sk_buff *ath10k_htt_rx_netbuf_pop(struct ath10k_htt *htt)
ath10k_warn("htt rx ring is empty!\n");
idx = htt->rx_ring.sw_rd_idx.msdu_payld;
- msdu = htt->rx_ring.buf.netbufs_ring[idx];
+ msdu = htt->rx_ring.netbufs_ring[idx];
idx++;
idx &= htt->rx_ring.size_mask;
@@ -611,19 +611,19 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
*/
htt->rx_ring.fill_level = ath10k_htt_rx_ring_fill_level(htt);
- htt->rx_ring.buf.netbufs_ring =
+ htt->rx_ring.netbufs_ring =
kmalloc(htt->rx_ring.size * sizeof(struct sk_buff *),
GFP_KERNEL);
- if (!htt->rx_ring.buf.netbufs_ring)
+ if (!htt->rx_ring.netbufs_ring)
goto fail1;
vaddr = dma_alloc_coherent(htt->ar->dev,
- (htt->rx_ring.size * sizeof(htt->rx_ring.buf.paddrs_ring)),
+ (htt->rx_ring.size * sizeof(htt->rx_ring.paddrs_ring)),
&paddr, GFP_DMA);
if (!vaddr)
goto fail2;
- htt->rx_ring.buf.paddrs_ring = vaddr;
+ htt->rx_ring.paddrs_ring = vaddr;
htt->rx_ring.base_paddr = paddr;
vaddr = dma_alloc_coherent(htt->ar->dev,
@@ -646,16 +646,17 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
spin_unlock_bh(&htt->rx_ring.lock);
+ ath10k_dbg(ATH10K_DBG_HTT, "HTT RX ring size: %d, fill_level: %d\n",
+ htt->rx_ring.size, htt->rx_ring.fill_level);
return 0;
-
fail3:
dma_free_coherent(htt->ar->dev,
(htt->rx_ring.size *
- sizeof(htt->rx_ring.buf.paddrs_ring)),
- htt->rx_ring.buf.paddrs_ring,
+ sizeof(htt->rx_ring.paddrs_ring)),
+ htt->rx_ring.paddrs_ring,
htt->rx_ring.base_paddr);
fail2:
- kfree(htt->rx_ring.buf.netbufs_ring);
+ kfree(htt->rx_ring.netbufs_ring);
fail1:
return -ENOMEM;
}
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (17 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 19/20] ath10k: Simplify excessively nested HTT structure layout Sujith Manoharan
@ 2013-04-28 15:31 ` Sujith Manoharan
2013-04-29 6:07 ` Michal Kazior
2013-04-30 11:43 ` [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Kalle Valo
19 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-28 15:31 UTC (permalink / raw)
To: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
We can dispense with the lockdep assert since the refill
timer just calls the replenish routine which is held under
the ring lock.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 95ffcc2..bcb9021 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -273,6 +273,7 @@ static int ath10k_htt_rx_ring_fill_level(struct ath10k_htt *htt)
return size;
}
+/* RX ring lock must be held. */
static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
{
struct htt_rx_desc *rx_desc;
@@ -280,8 +281,6 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
dma_addr_t paddr;
int idx;
- lockdep_assert_held(&htt->rx_ring.lock);
-
idx = __le32_to_cpu(*(htt->rx_ring.alloc_idx.vaddr));
while (num > 0) {
skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN);
@@ -641,10 +640,9 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt);
spin_lock_init(&htt->rx_ring.lock);
- spin_lock_bh(&htt->rx_ring.lock);
+
htt->rx_ring.fill_cnt = 0;
ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
- spin_unlock_bh(&htt->rx_ring.lock);
ath10k_dbg(ATH10K_DBG_HTT, "HTT RX ring size: %d, fill_level: %d\n",
htt->rx_ring.size, htt->rx_ring.fill_level);
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-28 15:31 ` [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach Sujith Manoharan
@ 2013-04-29 6:07 ` Michal Kazior
2013-04-29 6:41 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Michal Kazior @ 2013-04-29 6:07 UTC (permalink / raw)
To: ath9k-devel
On 28/04/13 17:31, Sujith Manoharan wrote:
> From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
>
> We can dispense with the lockdep assert since the refill
> timer just calls the replenish routine which is held under
> the ring lock.
Doesn't sound good to me.
The lockdep is there for a reason. This explicitly states the function
must be under the htt rx lock and makes sure this is verified. This
should not be removed.
If (which can be arguably near impossible) the initial
ath10k_htt_rx_ring_fill_n() in htt rx attach fires of a timer and we get
a crazy pre-emption between mod_timer() and goto we will
corrupt the htt rx ring state without the lock here.
-- Pozdrawiam / Best regards, Michal Kazior.
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-29 6:07 ` Michal Kazior
@ 2013-04-29 6:41 ` Sujith Manoharan
2013-04-29 6:48 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-29 6:41 UTC (permalink / raw)
To: ath9k-devel
Michal Kazior wrote:
> Doesn't sound good to me.
>
> The lockdep is there for a reason. This explicitly states the function
> must be under the htt rx lock and makes sure this is verified. This
> should not be removed.
>
> If (which can be arguably near impossible) the initial
> ath10k_htt_rx_ring_fill_n() in htt rx attach fires of a timer and we get
> a crazy pre-emption between mod_timer() and goto we will
> corrupt the htt rx ring state without the lock here.
If the system is so memory-starved that basic allocation during driver bring-up
fails, we should just bail out gracefully and not jump through hoops, hoping
that things might improve.
If this is done, the locks in attach() can be removed and the lockdep_assert()
can stay. But yes, I missed this subtle race condition so this patch can't go in
as is.
When the driver is operational, the simplest thing to do when RX overrun happens,
is to drop incoming packets until the situation eases (drivers like ath9k do this,
by re-using pre-allocated buffers). ath10k uses up the RX ring instead, until
the driver effectively stalls. I am not sure which model is better.
Sujith
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-29 6:41 ` Sujith Manoharan
@ 2013-04-29 6:48 ` Sujith Manoharan
2013-04-29 7:08 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-29 6:48 UTC (permalink / raw)
To: ath9k-devel
Sujith Manoharan wrote:
> If the system is so memory-starved that basic allocation during driver bring-up
> fails, we should just bail out gracefully and not jump through hoops, hoping
> that things might improve.
...and it doesn't seem correct to proceed with init after htt_rx_attach() has
failed due to memory allocation, since subsequent allocations would probably fail
too.
Sujith
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-29 6:48 ` Sujith Manoharan
@ 2013-04-29 7:08 ` Sujith Manoharan
2013-04-29 7:27 ` Michal Kazior
0 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-29 7:08 UTC (permalink / raw)
To: ath9k-devel
Sujith Manoharan wrote:
> ...and it doesn't seem correct to proceed with init after htt_rx_attach() has
> failed due to memory allocation, since subsequent allocations would probably fail
> too.
How about something like this ?
[PATCH] ath10k: Remove unneeded locks during HTT RX attach
If buffer allocation fails during attach(), bail out properly
so the replenish timer doesn't get fired.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 54 +++++++++++++++++++-------------
1 file changed, 32 insertions(+), 22 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 7986601..2c65a21 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -273,12 +273,12 @@ static int ath10k_htt_rx_ring_fill_level(struct ath10k_htt *htt)
return size;
}
-static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
+static int ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
{
struct htt_rx_desc *rx_desc;
struct sk_buff *skb;
dma_addr_t paddr;
- int idx;
+ int ret = 0, idx;
lockdep_assert_held(&htt->rx_ring.lock);
@@ -286,14 +286,7 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
while (num > 0) {
skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN);
if (!skb) {
- /*
- * Failed to fill it to the desired level -
- * we'll start a timer and try again next time.
- * As long as enough buffers are left in the ring for
- * another A-MPDU rx, no special recovery is needed.
- */
- mod_timer(&htt->rx_ring.refill_retry_timer, jiffies +
- msecs_to_jiffies(HTT_RX_RING_REFILL_RETRY_MS));
+ ret = -ENOMEM;
goto fail;
}
@@ -312,6 +305,7 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
if (unlikely(dma_mapping_error(htt->ar->dev, paddr))) {
dev_kfree_skb_any(skb);
+ ret = -ENOMEM;
goto fail;
}
@@ -327,16 +321,26 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
fail:
*(htt->rx_ring.alloc_idx.vaddr) = __cpu_to_le32(idx);
- return;
+ return ret;
}
static void ath10k_htt_rx_msdu_buff_replenish(struct ath10k_htt *htt)
{
- int num_to_fill;
+ int ret, num_to_fill;
spin_lock_bh(&htt->rx_ring.lock);
num_to_fill = htt->rx_ring.fill_level - htt->rx_ring.fill_cnt;
- ath10k_htt_rx_ring_fill_n(htt, num_to_fill);
+ ret = ath10k_htt_rx_ring_fill_n(htt, num_to_fill);
+ if (ret == -ENOMEM) {
+ /*
+ * Failed to fill it to the desired level -
+ * we'll start a timer and try again next time.
+ * As long as enough buffers are left in the ring for
+ * another A-MPDU rx, no special recovery is needed.
+ */
+ mod_timer(&htt->rx_ring.refill_retry_timer, jiffies +
+ msecs_to_jiffies(HTT_RX_RING_REFILL_RETRY_MS));
+ }
spin_unlock_bh(&htt->rx_ring.lock);
}
@@ -615,13 +619,13 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
kmalloc(htt->rx_ring.size * sizeof(struct sk_buff *),
GFP_KERNEL);
if (!htt->rx_ring.netbufs_ring)
- goto fail1;
+ goto err_netbuf;
vaddr = dma_alloc_coherent(htt->ar->dev,
(htt->rx_ring.size * sizeof(htt->rx_ring.paddrs_ring)),
&paddr, GFP_DMA);
if (!vaddr)
- goto fail2;
+ goto err_dma_ring;
htt->rx_ring.paddrs_ring = vaddr;
htt->rx_ring.base_paddr = paddr;
@@ -630,7 +634,7 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
sizeof(*htt->rx_ring.alloc_idx.vaddr),
&paddr, GFP_DMA);
if (!vaddr)
- goto fail3;
+ goto err_dma_idx;
htt->rx_ring.alloc_idx.vaddr = vaddr;
htt->rx_ring.alloc_idx.paddr = paddr;
@@ -641,23 +645,29 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt);
spin_lock_init(&htt->rx_ring.lock);
- spin_lock_bh(&htt->rx_ring.lock);
+
htt->rx_ring.fill_cnt = 0;
- ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
- spin_unlock_bh(&htt->rx_ring.lock);
+ if (ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level))
+ goto err_fill_ring;
ath10k_dbg(ATH10K_DBG_HTT, "HTT RX ring size: %d, fill_level: %d\n",
htt->rx_ring.size, htt->rx_ring.fill_level);
return 0;
-fail3:
+
+err_fill_ring:
+ dma_free_coherent(htt->ar->dev,
+ sizeof(*htt->rx_ring.alloc_idx.vaddr),
+ htt->rx_ring.alloc_idx.vaddr,
+ htt->rx_ring.alloc_idx.paddr);
+err_dma_idx:
dma_free_coherent(htt->ar->dev,
(htt->rx_ring.size *
sizeof(htt->rx_ring.paddrs_ring)),
htt->rx_ring.paddrs_ring,
htt->rx_ring.base_paddr);
-fail2:
+err_dma_ring:
kfree(htt->rx_ring.netbufs_ring);
-fail1:
+err_netbuf:
return -ENOMEM;
}
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-29 7:08 ` Sujith Manoharan
@ 2013-04-29 7:27 ` Michal Kazior
2013-04-29 8:14 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Michal Kazior @ 2013-04-29 7:27 UTC (permalink / raw)
To: ath9k-devel
On 29/04/13 09:08, Sujith Manoharan wrote:
> Sujith Manoharan wrote:
>> ...and it doesn't seem correct to proceed with init after htt_rx_attach() has
>> failed due to memory allocation, since subsequent allocations would probably fail
>> too.
>
> How about something like this ?
>
> [PATCH] ath10k: Remove unneeded locks during HTT RX attach
>
> If buffer allocation fails during attach(), bail out properly
> so the replenish timer doesn't get fired.
>
> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> ---
> (...)
> @@ -641,23 +645,29 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
> setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt);
>
> spin_lock_init(&htt->rx_ring.lock);
> - spin_lock_bh(&htt->rx_ring.lock);
> +
> htt->rx_ring.fill_cnt = 0;
> - ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
> - spin_unlock_bh(&htt->rx_ring.lock);
> + if (ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level))
> + goto err_fill_ring;
Won't this still fail the lockdep assertion?
We're also leaking memory upon failure. We need to free up the skbuffs
we successfully allocated & mapped.
If you want to check if the ath10k_htt_rx_ring_fill_n() failed you could
simply compare fill_level and fill_cnt while (still) holding the spinlock:
spin_lock_bh(&htt->rx_ring.lock);
htt->rx_ring.fill_cnt = 0;
ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
if (htt->rx_ring.fill_cnt != htt->rx_ring.fill_level) {
// handle failure
}
spin_unlock_bh(&htt->rx_ring.lock);
I'm not even sure if we should abort right away. We replenish htt rx
buffers using GFP_ATOMIC allocation. This can fail under memory pressure
more often (then, say, GFP_KERNEL). I wouldn't really consider this as
fatal error. Although we could probably have a ath10k_warn/info if the
initial allocation doesn't fill everything up. Perhaps we could fail
only if the fill_cnt is still 0, or below a defined threshold?
We could also try and split the replenishing functions and use
GFP_KERNEL allocation during htt rx attach.
-- Pozdrawiam / Best regards, Michal Kazior.
^ permalink raw reply [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-29 7:27 ` Michal Kazior
@ 2013-04-29 8:14 ` Sujith Manoharan
2013-04-29 8:34 ` Michal Kazior
0 siblings, 1 reply; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-29 8:14 UTC (permalink / raw)
To: ath9k-devel
Michal Kazior wrote:
> Won't this still fail the lockdep assertion?
>
> We're also leaking memory upon failure. We need to free up the skbuffs
> we successfully allocated & mapped.
>
> If you want to check if the ath10k_htt_rx_ring_fill_n() failed you could
> simply compare fill_level and fill_cnt while (still) holding the spinlock:
>
> spin_lock_bh(&htt->rx_ring.lock);
> htt->rx_ring.fill_cnt = 0;
> ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
> if (htt->rx_ring.fill_cnt != htt->rx_ring.fill_level) {
> // handle failure
> }
> spin_unlock_bh(&htt->rx_ring.lock);
>
> I'm not even sure if we should abort right away. We replenish htt rx
> buffers using GFP_ATOMIC allocation. This can fail under memory pressure
> more often (then, say, GFP_KERNEL). I wouldn't really consider this as
> fatal error. Although we could probably have a ath10k_warn/info if the
> initial allocation doesn't fill everything up. Perhaps we could fail
> only if the fill_cnt is still 0, or below a defined threshold?
>
> We could also try and split the replenishing functions and use
> GFP_KERNEL allocation during htt rx attach.
We do a bunch of allocations using GFP_ATOMIC after htt_attach().
Proceeding with initialization at this point seems wrong and programming
the FW with RX ring configuration via HTT_H2T_MSG_TYPE_RX_RING_CFG even though
host setup failed is probably incorrect ?
IMHO, the simplest fix is to just die happily when the system is hosed at load-time.
An updated patch:
[PATCH] ath10k: Remove unneeded locks during HTT RX attach
Fix two issues:
* Bail out properly when RX buffer allocation fails at init time.
* Do not acquire the rx ring lock during attach() since we
don't rearm the replenish timer.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 81 ++++++++++++++++++++++----------
1 file changed, 57 insertions(+), 24 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 7986601..6b1ca2b 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -273,27 +273,36 @@ static int ath10k_htt_rx_ring_fill_level(struct ath10k_htt *htt)
return size;
}
-static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
+static void ath10k_htt_rx_ring_free(struct ath10k_htt *htt)
+{
+ struct sk_buff *skb;
+ struct ath10k_skb_cb *cb;
+ int i;
+
+ for (i = 0; i < htt->rx_ring.fill_cnt; i++) {
+ skb = htt->rx_ring.netbufs_ring[i];
+ cb = ATH10K_SKB_CB(skb);
+ dma_unmap_single(htt->ar->dev, cb->paddr,
+ skb->len + skb_tailroom(skb),
+ DMA_FROM_DEVICE);
+ dev_kfree_skb_any(skb);
+ }
+
+ htt->rx_ring.fill_cnt = 0;
+}
+
+static int __ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
{
struct htt_rx_desc *rx_desc;
struct sk_buff *skb;
dma_addr_t paddr;
- int idx;
-
- lockdep_assert_held(&htt->rx_ring.lock);
+ int ret = 0, idx;
idx = __le32_to_cpu(*(htt->rx_ring.alloc_idx.vaddr));
while (num > 0) {
skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN);
if (!skb) {
- /*
- * Failed to fill it to the desired level -
- * we'll start a timer and try again next time.
- * As long as enough buffers are left in the ring for
- * another A-MPDU rx, no special recovery is needed.
- */
- mod_timer(&htt->rx_ring.refill_retry_timer, jiffies +
- msecs_to_jiffies(HTT_RX_RING_REFILL_RETRY_MS));
+ ret = -ENOMEM;
goto fail;
}
@@ -312,6 +321,7 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
if (unlikely(dma_mapping_error(htt->ar->dev, paddr))) {
dev_kfree_skb_any(skb);
+ ret = -ENOMEM;
goto fail;
}
@@ -327,16 +337,32 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
fail:
*(htt->rx_ring.alloc_idx.vaddr) = __cpu_to_le32(idx);
- return;
+ return ret;
+}
+
+static int ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
+{
+ lockdep_assert_held(&htt->rx_ring.lock);
+ return __ath10k_htt_rx_ring_fill_n(htt, num);
}
static void ath10k_htt_rx_msdu_buff_replenish(struct ath10k_htt *htt)
{
- int num_to_fill;
+ int ret, num_to_fill;
spin_lock_bh(&htt->rx_ring.lock);
num_to_fill = htt->rx_ring.fill_level - htt->rx_ring.fill_cnt;
- ath10k_htt_rx_ring_fill_n(htt, num_to_fill);
+ ret = ath10k_htt_rx_ring_fill_n(htt, num_to_fill);
+ if (ret == -ENOMEM) {
+ /*
+ * Failed to fill it to the desired level -
+ * we'll start a timer and try again next time.
+ * As long as enough buffers are left in the ring for
+ * another A-MPDU rx, no special recovery is needed.
+ */
+ mod_timer(&htt->rx_ring.refill_retry_timer, jiffies +
+ msecs_to_jiffies(HTT_RX_RING_REFILL_RETRY_MS));
+ }
spin_unlock_bh(&htt->rx_ring.lock);
}
@@ -615,13 +641,13 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
kmalloc(htt->rx_ring.size * sizeof(struct sk_buff *),
GFP_KERNEL);
if (!htt->rx_ring.netbufs_ring)
- goto fail1;
+ goto err_netbuf;
vaddr = dma_alloc_coherent(htt->ar->dev,
(htt->rx_ring.size * sizeof(htt->rx_ring.paddrs_ring)),
&paddr, GFP_DMA);
if (!vaddr)
- goto fail2;
+ goto err_dma_ring;
htt->rx_ring.paddrs_ring = vaddr;
htt->rx_ring.base_paddr = paddr;
@@ -630,7 +656,7 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
sizeof(*htt->rx_ring.alloc_idx.vaddr),
&paddr, GFP_DMA);
if (!vaddr)
- goto fail3;
+ goto err_dma_idx;
htt->rx_ring.alloc_idx.vaddr = vaddr;
htt->rx_ring.alloc_idx.paddr = paddr;
@@ -641,23 +667,30 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt);
spin_lock_init(&htt->rx_ring.lock);
- spin_lock_bh(&htt->rx_ring.lock);
+
htt->rx_ring.fill_cnt = 0;
- ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
- spin_unlock_bh(&htt->rx_ring.lock);
+ if (__ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level))
+ goto err_fill_ring;
ath10k_dbg(ATH10K_DBG_HTT, "HTT RX ring size: %d, fill_level: %d\n",
htt->rx_ring.size, htt->rx_ring.fill_level);
return 0;
-fail3:
+
+err_fill_ring:
+ ath10k_htt_rx_ring_free(htt);
+ dma_free_coherent(htt->ar->dev,
+ sizeof(*htt->rx_ring.alloc_idx.vaddr),
+ htt->rx_ring.alloc_idx.vaddr,
+ htt->rx_ring.alloc_idx.paddr);
+err_dma_idx:
dma_free_coherent(htt->ar->dev,
(htt->rx_ring.size *
sizeof(htt->rx_ring.paddrs_ring)),
htt->rx_ring.paddrs_ring,
htt->rx_ring.base_paddr);
-fail2:
+err_dma_ring:
kfree(htt->rx_ring.netbufs_ring);
-fail1:
+err_netbuf:
return -ENOMEM;
}
--
1.8.2.2
^ permalink raw reply related [flat|nested] 43+ messages in thread* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-29 8:14 ` Sujith Manoharan
@ 2013-04-29 8:34 ` Michal Kazior
2013-04-29 8:47 ` Sujith Manoharan
0 siblings, 1 reply; 43+ messages in thread
From: Michal Kazior @ 2013-04-29 8:34 UTC (permalink / raw)
To: ath9k-devel
On 29/04/13 10:14, Sujith Manoharan wrote:
> Michal Kazior wrote:
>> I'm not even sure if we should abort right away. We replenish htt rx
>> buffers using GFP_ATOMIC allocation. This can fail under memory pressure
>> more often (then, say, GFP_KERNEL). I wouldn't really consider this as
>> fatal error. Although we could probably have a ath10k_warn/info if the
>> initial allocation doesn't fill everything up. Perhaps we could fail
>> only if the fill_cnt is still 0, or below a defined threshold?
>>
>> We could also try and split the replenishing functions and use
>> GFP_KERNEL allocation during htt rx attach.
>
> We do a bunch of allocations using GFP_ATOMIC after htt_attach().
> Proceeding with initialization at this point seems wrong and programming
> the FW with RX ring configuration via HTT_H2T_MSG_TYPE_RX_RING_CFG even though
> host setup failed is probably incorrect ?
You're right.
> An updated patch:
>
> [PATCH] ath10k: Remove unneeded locks during HTT RX attach
>
> Fix two issues:
>
> * Bail out properly when RX buffer allocation fails at init time.
> * Do not acquire the rx ring lock during attach() since we
> don't rearm the replenish timer.
>
> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> ---
Looks good to me now.
-- Pozdrawiam / Best regards, Michal Kazior.
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
2013-04-29 8:34 ` Michal Kazior
@ 2013-04-29 8:47 ` Sujith Manoharan
0 siblings, 0 replies; 43+ messages in thread
From: Sujith Manoharan @ 2013-04-29 8:47 UTC (permalink / raw)
To: ath9k-devel
Michal Kazior wrote:
> > An updated patch:
> >
> > [PATCH] ath10k: Remove unneeded locks during HTT RX attach
> >
> > Fix two issues:
> >
> > * Bail out properly when RX buffer allocation fails at init time.
> > * Do not acquire the rx ring lock during attach() since we
> > don't rearm the replenish timer.
> >
> > Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> > ---
>
> Looks good to me now.
Alright. Thanks for the review !
Sujith
^ permalink raw reply [flat|nested] 43+ messages in thread
* [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
` (18 preceding siblings ...)
2013-04-28 15:31 ` [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach Sujith Manoharan
@ 2013-04-30 11:43 ` Kalle Valo
2013-04-30 13:21 ` Sujith Manoharan
2013-04-30 13:55 ` Sujith Manoharan
19 siblings, 2 replies; 43+ messages in thread
From: Kalle Valo @ 2013-04-30 11:43 UTC (permalink / raw)
To: ath9k-devel
Sujith Manoharan <sujith@msujith.org> writes:
> From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
>
> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
I have applied these patches:
1, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 19
These are pending review:
2, 6, 16
These are dropped:
18, 20
I hope I didn't miss anything.
But in the future please don't send more than 12 patches at a time, it's
way too much pain to handle this many unrelated patches.
--
Kalle Valo
^ permalink raw reply [flat|nested] 43+ messages in thread