Skip to contentSkip to conversation

ath11k: remove superflous memset

PATCH New John Crispin 1 participant 3 messages Nov 18, 2019 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ath11k: remove superflous memset

We set all values inside the struct making the memset pointless.

---
 drivers/net/wireless/ath/ath11k/dp_tx.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/ath11k/dp_tx.c +0 -1
index 670e253476a3..2d6255888cfb 100644
@@ -463,7 +463,6 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id)
 
 	spin_lock_bh(&tx_ring->tx_status_lock);
 	while (kfifo_get(&tx_ring->tx_status_fifo, &tx_status)) {
-		memset(&ts, 0, sizeof(ts));
 		ath11k_hal_tx_status_parse(ab, &tx_status, &ts);
 
 		mac_id = FIELD_GET(DP_TX_DESC_ID_MAC_ID, ts.desc_id);
Signature · 7 lines
2.20.1


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

PATCH 2/3 ath11k: remove superflous locking

The access to the fifo happens inside a napi context, which is an atomic operation. Locking is therefore not required.

---
 drivers/net/wireless/ath/ath11k/dp.c    | 4 ----
 drivers/net/wireless/ath/ath11k/dp.h    | 4 ----
 drivers/net/wireless/ath/ath11k/dp_tx.c | 8 --------
 3 files changed, 16 deletions(-)
drivers/net/wireless/ath/ath11k/dp.c +0 -4
index 72c21cf6a352..d62115e9b41b 100644
@@ -822,10 +822,7 @@ void ath11k_dp_free(struct ath11k_base *ab)
 			     ath11k_dp_tx_pending_cleanup, ab);
 		idr_destroy(&dp->tx_ring[i].txbuf_idr);
 		spin_unlock_bh(&dp->tx_ring[i].tx_idr_lock);
-
-		spin_lock_bh(&dp->tx_ring[i].tx_status_lock);
 		kfifo_free(&dp->tx_ring[i].tx_status_fifo);
-		spin_unlock_bh(&dp->tx_ring[i].tx_status_lock);
 	}
 
 	/* Deinit any SOC level resource */
@@ -872,7 +869,6 @@ int ath11k_dp_alloc(struct ath11k_base *ab)
 		spin_lock_init(&dp->tx_ring[i].tx_idr_lock);
 		dp->tx_ring[i].tcl_data_ring_id = i;
 
-		spin_lock_init(&dp->tx_ring[i].tx_status_lock);
 		ret = kfifo_alloc(&dp->tx_ring[i].tx_status_fifo, size,
 				  GFP_KERNEL);
 		if (ret)
drivers/net/wireless/ath/ath11k/dp.h +0 -4
index db216f055c42..5f98c5a49791 100644
@@ -66,10 +66,6 @@ struct dp_tx_ring {
 	/* Protects txbuf_idr and num_pending */
 	spinlock_t tx_idr_lock;
 	DECLARE_KFIFO_PTR(tx_status_fifo, struct hal_wbm_release_ring);
-	/* lock to protect tx_status_fifo because tx_status_fifo can be
-	 * accessed concurrently.
-	 */
-	spinlock_t tx_status_lock;
 };
 
 struct ath11k_pdev_mon_stats {
drivers/net/wireless/ath/ath11k/dp_tx.c +0 -8
index 2d6255888cfb..8005ad60fda1 100644
@@ -445,7 +445,6 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id)
 
 	ath11k_hal_srng_access_begin(ab, status_ring);
 
-	spin_lock_bh(&tx_ring->tx_status_lock);
 	while (!kfifo_is_full(&tx_ring->tx_status_fifo) &&
 	       (desc = ath11k_hal_srng_dst_get_next_entry(ab, status_ring)))
 		kfifo_in(&tx_ring->tx_status_fifo, (void *)desc, sizeof(struct hal_wbm_release_ring));
@@ -456,12 +455,9 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id)
 		ath11k_warn(ab, "Unable to process some of the tx_status ring desc because status_fifo is full\n");
 	}
 
-	spin_unlock_bh(&tx_ring->tx_status_lock);
-
 	ath11k_hal_srng_access_end(ab, status_ring);
 	spin_unlock_bh(&status_ring->lock);
 
-	spin_lock_bh(&tx_ring->tx_status_lock);
 	while (kfifo_get(&tx_ring->tx_status_fifo, &tx_status)) {
 		ath11k_hal_tx_status_parse(ab, &tx_status, &ts);
 
@@ -492,12 +488,8 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id)
 		if (atomic_dec_and_test(&ar->dp.num_tx_pending))
 			wake_up(&ar->dp.tx_empty_waitq);
 
-		/* TODO: Locking optimization so that tx_completion for an msdu
-		 * is not called with tx_status_lock acquired
-		 */
 		ath11k_dp_tx_complete_msdu(ar, msdu, &ts);
 	}
-	spin_unlock_bh(&tx_ring->tx_status_lock);
 }
 
 int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx_tid,
Signature · 7 lines
2.20.1


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

PATCH 3/3 ath11k: drop memset when setting up a tx cmd desc

In reply to John Crispin

There is no point in zero'ing out the structure if we set all values in the following line.

---
 drivers/net/wireless/ath/ath11k/dp_tx.c  | 2 --
 drivers/net/wireless/ath/ath11k/hal_tx.c | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/dp_tx.c +0 -2
index 8005ad60fda1..18ede21f3cbc 100644
@@ -167,8 +167,6 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
 	skb_cb->vif = arvif->vif;
 	skb_cb->ar = ar;
 
-	memset(cached_desc, 0, HAL_TCL_DESC_LEN);
-
 	ath11k_hal_tx_cmd_desc_setup(ab, cached_desc, &ti);
 
 	hal_ring_id = tx_ring->tcl_data_ring.ring_id;
drivers/net/wireless/ath/ath11k/hal_tx.c +1 -0
index b1aa716610b9..3813edaadd40 100644
@@ -71,6 +71,7 @@ void ath11k_hal_tx_cmd_desc_setup(struct ath11k_base *ab, void *cmd,
 				    ti->dscp_tid_tbl_idx) |
 			 FIELD_PREP(HAL_TCL_DATA_CMD_INFO3_SEARCH_INDEX,
 				    ti->bss_ast_hash);
+	tcl_cmd->info4 = 0;
 }
 
 /* Commit the descriptor to hardware */
Signature · 7 lines
2.20.1


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