Skip to contentSkip to conversation

ath11k: Clean up void *per_transfer_context[] in ce

PATCH Superseded Vasanthakumar Thiagarajan 1 participant 5 messages Jun 18, 2019 Qualcomm Atheros ATH11K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 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 *.

---
 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 2/5 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 038f905..d15ae78 100644
@@ -239,19 +239,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
@@ -799,15 +786,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 69a2340..4a878eb 100644
@@ -9,6 +9,7 @@
 #include "wmi.h"
 #include "hal_rx.h"
 #include "dp_tx.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 0aec840..815a343 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 1d9892e..9e5bd81 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 f5e5d3d..12f3024 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 3/5 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 9e5bd81..5c47cfc 100644
@@ -1386,8 +1386,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 4/5 ath11k: Clean up link_desc_addr buffer typecast

In reply to Vasanthakumar Thiagarajan

It is not necessary to typecast scatter_buf while calling ath11k_hal_set_link_desc_addr(). Few more trivial clean ups related to scatter_buf typecast.

---
 drivers/net/wireless/ath/ath11k/dp.c  | 11 +++--------
 drivers/net/wireless/ath/ath11k/hal.c |  2 +-
 drivers/net/wireless/ath/ath11k/hal.h |  2 +-
 3 files changed, 5 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath11k/dp.c +3 -8
index 815a343..e565638 100644
@@ -372,9 +372,7 @@ static int ath11k_dp_scatter_idle_link_desc_setup(struct ath11k_base *ab,
 			     HAL_LINK_DESC_SIZE;
 		paddr = link_desc_banks[i].paddr;
 		while (n_entries) {
-			ath11k_hal_set_link_desc_addr(
-					(struct buffer_addr *)scatter_buf, i,
-					paddr);
+			ath11k_hal_set_link_desc_addr(scatter_buf, i, paddr);
 			n_entries--;
 			paddr += HAL_LINK_DESC_SIZE;
 			if (rem_entries) {
@@ -391,8 +389,7 @@ static int ath11k_dp_scatter_idle_link_desc_setup(struct ath11k_base *ab,
 	}
 
 	ath11k_hal_setup_link_idle_list(ab, slist, num_scatter_buf,
-					n_link_desc,
-					(u8 *)scatter_buf -
+					n_link_desc, (u8 *)scatter_buf -
 					(u8 *)slist[scatter_idx].vaddr);
 
 	return 0;
@@ -576,9 +573,7 @@ int ath11k_dp_link_desc_setup(struct ath11k_base *ab,
 		paddr = link_desc_banks[i].paddr;
 		while (n_entries &&
 		       (desc = ath11k_hal_srng_src_get_next_entry(ab, srng))) {
-			ath11k_hal_set_link_desc_addr(
-					(struct buffer_addr *)desc, i,
-					paddr);
+			ath11k_hal_set_link_desc_addr(desc, i, paddr);
 			n_entries--;
 			paddr += HAL_LINK_DESC_SIZE;
 		}
drivers/net/wireless/ath/ath11k/hal.c +1 -1
index b7b9b9c..6c8e37f 100644
@@ -689,7 +689,7 @@ u32 ath11k_hal_ce_dst_status_get_length(void *buf)
 	return len;
 }
 
-void ath11k_hal_set_link_desc_addr(void *buf, u32 cookie, dma_addr_t paddr)
+void ath11k_hal_set_link_desc_addr(u32 *buf, u32 cookie, dma_addr_t paddr)
 {
 	struct buffer_addr *desc = (struct buffer_addr *)buf;
 
drivers/net/wireless/ath/ath11k/hal.h +1 -1
index 6649dd2..f1b4157 100644
@@ -875,7 +875,7 @@ dma_addr_t ath11k_hal_srng_get_tp_addr(struct ath11k_base *ab,
 				       struct hal_srng *srng);
 dma_addr_t ath11k_hal_srng_get_hp_addr(struct ath11k_base *ab,
 				       struct hal_srng *srng);
-void ath11k_hal_set_link_desc_addr(void *buf, u32 cookie, dma_addr_t paddr);
+void ath11k_hal_set_link_desc_addr(u32 *buf, u32 cookie, dma_addr_t paddr);
 u32 ath11k_hal_ce_get_desc_size(enum hal_ce_desc type);
 void ath11k_hal_ce_src_set_desc(void *buf, dma_addr_t paddr, u32 len, u32 id,
 				u8 byte_swap_data);
Signature · 7 lines
1.9.1


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

PATCH 5/5 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 d15ae78..7591ffb 100644
@@ -65,7 +65,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