Skip to contentSkip to conversation

ath11k: Clean up void *per_transfer_context[] in ce

PATCH In review Vasanthakumar Thiagarajan 2 participants 7 messages Jun 20, 2019 – Jun 21, 2019 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 ath11k: Clean up void *per_transfer_context[] in ce

Since per_transfer_context is used as an array of skb pointer always no need that to be an array of void *.

---

V2:

- Dropped "[PATCH 4/5] ath11k: Clean up link_desc_addr buffer typecast" from the series. This will be addressed later.

 drivers/net/wireless/ath/ath11k/ce.c | 9 ++++-----
 drivers/net/wireless/ath/ath11k/ce.h | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath11k/ce.c +4 -5
index b9a57ec..048adc1 100644
@@ -212,7 +212,7 @@ static int ath11k_ce_rx_post_pipe(struct ath11k_ce_pipe *pipe)
 }
 
 static int ath11k_ce_completed_recv_next(struct ath11k_ce_pipe *pipe,
-					 void **context, int *nbytes)
+					 struct sk_buff **context, int *nbytes)
 {
 	struct ath11k_base *ab = pipe->sc;
 	struct hal_srng *srng;
@@ -270,8 +270,7 @@ static void ath11k_ce_recv_process_cb(struct ath11k_ce_pipe *pipe)
 	int ret;
 
 	__skb_queue_head_init(&list);
-	while (ath11k_ce_completed_recv_next(pipe, (void **)&skb,
-					     &nbytes) == 0) {
+	while (ath11k_ce_completed_recv_next(pipe, &skb, &nbytes) == 0) {
 		max_nbytes = skb->len + skb_tailroom(skb);
 		dma_unmap_single(ab->dev, ATH11K_SKB_RXCB(skb)->paddr,
 				 max_nbytes, DMA_FROM_DEVICE);
@@ -303,7 +302,7 @@ static void ath11k_ce_recv_process_cb(struct ath11k_ce_pipe *pipe)
 }
 
 static int ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe,
-					 void **transfer_contextp)
+					 struct sk_buff **transfer_contextp)
 {
 	struct ath11k_base *ab = pipe->sc;
 	struct hal_srng *srng;
@@ -349,7 +348,7 @@ static void ath11k_ce_send_done_cb(struct ath11k_ce_pipe *pipe)
 	struct ath11k_base *ab = pipe->sc;
 	struct sk_buff *skb;
 
-	while (ath11k_ce_completed_send_next(pipe, (void **)&skb) == 0) {
+	while (ath11k_ce_completed_send_next(pipe, &skb) == 0) {
 		if (!skb)
 			continue;
 
drivers/net/wireless/ath/ath11k/ce.h +1 -1
index f9b5a0e..9f25bad 100644
@@ -139,7 +139,7 @@ struct ath11k_ce_ring {
 	u32 hal_ring_id;
 
 	/* keep last */
-	void *per_transfer_context[0];
+	struct sk_buff *per_transfer_context[0];
 };
 
 struct ath11k_ce_pipe {
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw

PATCH v2 2/4 ath11k: Add peer.[ch] files for peer related util functions

Move peer util functions from mac.c and core.c to peer.c

---
 drivers/net/wireless/ath/ath11k/Makefile      |   3 +-
 drivers/net/wireless/ath/ath11k/core.c        | 101 -----------
 drivers/net/wireless/ath/ath11k/core.h        |  22 ---
 drivers/net/wireless/ath/ath11k/debug.c       |   1 +
 drivers/net/wireless/ath/ath11k/debugfs_sta.c |   1 +
 drivers/net/wireless/ath/ath11k/dp.c          |   1 +
 drivers/net/wireless/ath/ath11k/dp_rx.c       |   1 +
 drivers/net/wireless/ath/ath11k/mac.c         | 131 +-------------
 drivers/net/wireless/ath/ath11k/peer.c        | 236 ++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/peer.h        |  35 ++++
 drivers/net/wireless/ath/ath11k/wmi.c         |   1 +
 11 files changed, 279 insertions(+), 254 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/peer.c
 create mode 100644 drivers/net/wireless/ath/ath11k/peer.h
drivers/net/wireless/ath/ath11k/Makefile +2 -1
index 4f86b18..6b4a5b5 100644
@@ -14,7 +14,8 @@ ath11k-y += core.o \
 	    dp_tx.o \
 	    dp_rx.o \
 	    debug.o \
-	    ce.o
+	    ce.o \
+	    peer.o
 
 ath11k-$(CONFIG_ATH11K_DEBUGFS) += debug_htt_stats.o
 ath11k-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o
drivers/net/wireless/ath/ath11k/core.c +0 -101

107 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/core.h +0 -22
index 4d42ab40..6b3ee2a 100644
@@ -240,19 +240,6 @@ struct ath11k_rx_peer_stats {
 	u64 reception_type[HAL_RX_RECEPTION_TYPE_MAX];
 };
 
-struct ath11k_peer {
-	struct list_head list;
-	struct ieee80211_sta *sta;
-	int vdev_id;
-	u8 addr[ETH_ALEN];
-	int peer_id;
-	u16 ast_hash;
-
-	/* protected by ab->data_lock */
-	struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
-	struct dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1];
-};
-
 #define ATH11K_HE_MCS_NUM       12
 #define ATH11K_VHT_MCS_NUM      10
 #define ATH11K_BW_NUM           4
@@ -790,15 +777,6 @@ struct ath11k_fw_stats_peer_extd {
 	u32 rx_mc_bc_cnt;
 };
 
-void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id);
-void ath11k_peer_map_event(struct ath11k_base *ab, u8 vdev_id, u16 peer_id,
-			   u8 *mac_addr, u16 ast_hash);
-struct ath11k_peer *ath11k_peer_find(struct ath11k_base *ab, int vdev_id,
-				     const u8 *addr);
-struct ath11k_peer *ath11k_peer_find_by_addr(struct ath11k_base *ab,
-					     const u8 *addr);
-struct ath11k_peer *ath11k_peer_find_by_id(struct ath11k_base *ab,
-						  int peer_id);
 int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab);
 int ath11k_core_init(struct ath11k_base *ath11k);
 void ath11k_core_deinit(struct ath11k_base *ath11k);
drivers/net/wireless/ath/ath11k/debug.c +1 -0
index c004fe8..7e86c20 100644
@@ -10,6 +10,7 @@
 #include "hal_rx.h"
 #include "dp_tx.h"
 #include "debug_htt_stats.h"
+#include "peer.h"
 
 void ath11k_info(struct ath11k_base *sc, const char *fmt, ...)
 {
drivers/net/wireless/ath/ath11k/debugfs_sta.c +1 -0
index cff6a3f..6bebe6d 100644
@@ -4,6 +4,7 @@
  */
 
 #include "core.h"
+#include "peer.h"
 #include "debug.h"
 
 void ath11k_sta_update_rx_duration(struct ath11k *ar,
drivers/net/wireless/ath/ath11k/dp.c +1 -0
index be10e98..c4770bb 100644
@@ -9,6 +9,7 @@
 #include "hal_tx.h"
 #include "debug.h"
 #include "dp_rx.h"
+#include "peer.h"
 
 static void ath11k_dp_htt_htc_tx_complete(struct ath11k_base *sc,
 					  struct sk_buff *skb)
drivers/net/wireless/ath/ath11k/dp_rx.c +1 -0
index 54cb7a4..9f47bf4 100644
@@ -11,6 +11,7 @@
 #include "dp_rx.h"
 #include "hal_rx.h"
 #include "dp_tx.h"
+#include "peer.h"
 
 static u8 *ath11k_dp_rx_h_80211_hdr(u8 *desc)
 {
drivers/net/wireless/ath/ath11k/mac.c +1 -130

149 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/peer.c new file +236 -0

236 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/peer.h new file +35 -0
new file mode 100644
index 0000000..99e54f1
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: ISC */
+/*
+ * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ */
+
+#ifndef ATH11K_PEER_H
+#define ATH11K_PEER_H
+
+struct ath11k_peer {
+	struct list_head list;
+	struct ieee80211_sta *sta;
+	int vdev_id;
+	u8 addr[ETH_ALEN];
+	int peer_id;
+	u16 ast_hash;
+
+	/* protected by ab->data_lock */
+	struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
+	struct dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1];
+};
+
+void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id);
+void ath11k_peer_map_event(struct ath11k_base *ab, u8 vdev_id, u16 peer_id,
+			   u8 *mac_addr, u16 ast_hash);
+struct ath11k_peer *ath11k_peer_find(struct ath11k_base *ab, int vdev_id,
+				     const u8 *addr);
+struct ath11k_peer *ath11k_peer_find_by_addr(struct ath11k_base *ab,
+					     const u8 *addr);
+struct ath11k_peer *ath11k_peer_find_by_id(struct ath11k_base *ab, int peer_id);
+void ath11k_peer_cleanup(struct ath11k *ar, u32 vdev_id);
+int ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, u8 *addr);
+int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif,
+		       struct ieee80211_sta *sta, struct peer_create_params *param);
+
+#endif /* _PEER_H_ */
drivers/net/wireless/ath/ath11k/wmi.c +1 -0
index 1477247..9778a02 100644
@@ -17,6 +17,7 @@
 #include "debug.h"
 #include "mac.h"
 #include "hw.h"
+#include "peer.h"
 
 struct wmi_tlv_policy {
 	size_t min_len;
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#2 lore raw

PATCH v2 3/4 ath11k{dp, hal}: Endian macro related clean ups

In reply to Vasanthakumar Thiagarajan

Replace ifdef __BIG_ENDIAN with IS_ENABLED(CONFIG_CPU_BIG_ENDIAN). Replace swapXX() with swabXX(). Also does a renaming of dp_peer_map_get_mac_addr.

---
 drivers/net/wireless/ath/ath11k/dp.h    | 11 +++++------
 drivers/net/wireless/ath/ath11k/dp_rx.c |  4 ++--
 drivers/net/wireless/ath/ath11k/hal.c   |  8 +++-----
 3 files changed, 10 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath11k/dp.h +5 -6
index 037fcbd..f7acd65 100644
@@ -1483,13 +1483,12 @@ struct htt_mac_addr {
 	u32 mac_addr_h16;
 };
 
-static inline void dp_peer_map_get_mac_addr(u32 addr_l32, u16 addr_h16,
-					    u8 *addr)
+static inline void ath11k_dp_get_mac_addr(u32 addr_l32, u16 addr_h16, u8 *addr)
 {
-#ifdef __BIG_ENDIAN
-	addr_l32 = swap32(addr_l32);
-	addr_h16 = swap16(addr_h16);
-#endif
+	if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) {
+		addr_l32 = swab32(addr_l32);
+		addr_h16 = swab16(addr_h16);
+	}
 	memcpy(addr, &addr_l32, 4);
 	memcpy(addr + 4, &addr_h16, ETH_ALEN - 4);
 }
drivers/net/wireless/ath/ath11k/dp_rx.c +2 -2
index 9f47bf4..57a1c27 100644
@@ -1385,8 +1385,8 @@ void ath11k_dp_htt_htc_t2h_msg_handler(struct ath11k_base *ab,
 				    resp->peer_map_ev.info);
 		peer_mac_h16 = FIELD_GET(HTT_T2H_PEER_MAP_INFO1_MAC_ADDR_H16,
 					 resp->peer_map_ev.info1);
-		dp_peer_map_get_mac_addr(resp->peer_map_ev.mac_addr_l32,
-					 peer_mac_h16, mac_addr);
+		ath11k_dp_get_mac_addr(resp->peer_map_ev.mac_addr_l32,
+				       peer_mac_h16, mac_addr);
 		ast_hash = FIELD_GET(HTT_T2H_PEER_MAP_INFO2_AST_HASH_VAL,
 				     resp->peer_map_ev.info1);
 		ath11k_peer_map_event(ab, vdev_id, peer_id, mac_addr, ast_hash);
drivers/net/wireless/ath/ath11k/hal.c +3 -5
index 3fe8f81..b7b9b9c 100644
@@ -1032,11 +1032,9 @@ int ath11k_hal_srng_setup(struct ath11k_base *sc, enum hal_ring_type type,
 	       (srng->entry_size * srng->num_entries) << 2);
 
 	/* TODO: Add comments on these swap configurations */
-#ifdef __BIG_ENDIAN
-	srng->flags |= HAL_SRNG_FLAGS_MSI_SWAP |
-		       HAL_SRNG_FLAGS_DATA_TLV_SWAP |
-		       HAL_SRNG_FLAGS_RING_PTR_SWAP;
-#endif
+	if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
+		srng->flags |= HAL_SRNG_FLAGS_MSI_SWAP | HAL_SRNG_FLAGS_DATA_TLV_SWAP |
+			       HAL_SRNG_FLAGS_RING_PTR_SWAP;
 
 	reg_base = srng->hwreg_base[HAL_SRNG_REG_GRP_R2];
 
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#3 lore raw

PATCH v2 4/4 ath11k/dp_rx: Clean up void *rx_desc in struct ath11k_skb_rxcb

In reply to Vasanthakumar Thiagarajan

Use the actual struct hal_rx_desc * instead of void *.

---
 drivers/net/wireless/ath/ath11k/core.h  |   2 +-
 drivers/net/wireless/ath/ath11k/dp_rx.c | 205 +++++++++++++-------------------
 2 files changed, 84 insertions(+), 123 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +1 -1
index 6b3ee2a..0cfe30a 100644
@@ -66,7 +66,7 @@ struct ath11k_skb_rxcb {
 	bool is_first_msdu;
 	bool is_last_msdu;
 	bool is_continuation;
-	void *rx_desc;
+	struct hal_rx_desc *rx_desc;
 	u8 err_rel_src;
 	u8 err_code;
 	u8 mac_id;
drivers/net/wireless/ath/ath11k/dp_rx.c +83 -122

486 lines not on this page · raw message

Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#4 lore raw
In reply to Vasanthakumar Thiagarajan
Quoted 5 lines · Vasanthakumar Thiagarajan

Since per_transfer_context is used as an array of skb pointer always no need that to be an array of void *.

4 patches applied to ath11k-bringup branch of ath.git, thanks.

ac429efcdf8d ath11k: Clean up void *per_transfer_context[] in ce 4fd9eee9c2ef ath11k: Add peer.[ch] files for peer related util functions 9dff37f3c969 ath11k{dp, hal}: Endian macro related clean ups 74971a410d44 ath11k/dp_rx: Clean up void *rx_desc in struct ath11k_skb_rxcb

Signature · 9 lines
https://patchwork.kernel.org/patch/11006239/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#5 lore raw
Quoted 8 lines · Kalle Valo
Quoted 5 lines · Vasanthakumar Thiagarajan

Since per_transfer_context is used as an array of skb pointer always no need that to be an array of void *.

Quoted 6 lines

4 patches applied to ath11k-bringup branch of ath.git, thanks.

ac429efcdf8d ath11k: Clean up void *per_transfer_context[] in ce 4fd9eee9c2ef ath11k: Add peer.[ch] files for peer related util functions 9dff37f3c969 ath11k{dp, hal}: Endian macro related clean ups 74971a410d44 ath11k/dp_rx: Clean up void *rx_desc in struct ath11k_skb_rxcb

There were few conflicts. Very easy to resolve with 3-way merge but please check anyway.

Signature · 6 lines
Kalle Valo

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#6 lore raw
Quoted 12 lines · Kalle Valo
Quoted 10 lines · Kalle Valo
Quoted 5 lines · Vasanthakumar Thiagarajan

Since per_transfer_context is used as an array of skb pointer always no need that to be an array of void *.

4 patches applied to ath11k-bringup branch of ath.git, thanks.

Quoted 7 lines
Quoted 4 lines

ac429efcdf8d ath11k: Clean up void *per_transfer_context[] in ce 4fd9eee9c2ef ath11k: Add peer.[ch] files for peer related util functions 9dff37f3c969 ath11k{dp, hal}: Endian macro related clean ups 74971a410d44 ath11k/dp_rx: Clean up void *rx_desc in struct ath11k_skb_rxcb

There were few conflicts. Very easy to resolve with 3-way merge but please check anyway.

Looks good, thanks.

Vasanth

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k