All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path
@ 2019-09-25  4:44 Vasanthakumar Thiagarajan
  2019-09-25  4:44 ` [PATCH bringup 2/3] ath11k: Clean up parameter list in ath11k_ce_completed_send_next() Vasanthakumar Thiagarajan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Vasanthakumar Thiagarajan @ 2019-09-25  4:44 UTC (permalink / raw)
  To: ath11k

Unify the unlock/ring_access_end calls with error path in
ath11k_ce_rx_buf_enqueue_pipe(). Update to ce_pipe->rx_buf_needed
is done inside srng->lock before ath11k_hal_srng_access_end().
Also rename the goto label from err to exit.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/ce.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/ce.c b/drivers/net/wireless/ath/ath11k/ce.c
index c1b170c..205f28e 100644
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -131,13 +131,13 @@ static int ath11k_ce_rx_buf_enqueue_pipe(struct ath11k_ce_pipe *pipe,
 
 	if (unlikely(ath11k_hal_srng_src_num_free(ab, srng, false) < 1)) {
 		ret = -ENOSPC;
-		goto err;
+		goto exit;
 	}
 
 	desc = ath11k_hal_srng_src_get_next_entry(ab, srng);
 	if (!desc) {
 		ret = -ENOSPC;
-		goto err;
+		goto exit;
 	}
 
 	ath11k_hal_ce_dst_set_desc(desc, paddr);
@@ -146,15 +146,10 @@ static int ath11k_ce_rx_buf_enqueue_pipe(struct ath11k_ce_pipe *pipe,
 	write_index = CE_RING_IDX_INCR(nentries_mask, write_index);
 	ring->write_index = write_index;
 
-	ath11k_hal_srng_access_end(ab, srng);
-
-	spin_unlock_bh(&srng->lock);
-
 	pipe->rx_buf_needed--;
 
-	return 0;
-
-err:
+	ret = 0;
+exit:
 	ath11k_hal_srng_access_end(ab, srng);
 
 	spin_unlock_bh(&srng->lock);
-- 
1.9.1


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH bringup 2/3] ath11k: Clean up parameter list in ath11k_ce_completed_send_next()
  2019-09-25  4:44 [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Vasanthakumar Thiagarajan
@ 2019-09-25  4:44 ` Vasanthakumar Thiagarajan
  2019-09-25  4:44 ` [PATCH bringup 3/3] ath11k: Use struct_size() to get the structure size with trailing array Vasanthakumar Thiagarajan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Vasanthakumar Thiagarajan @ 2019-09-25  4:44 UTC (permalink / raw)
  To: ath11k

Make ath11k_ce_completed_send_next() to return skb instead of
through a double pointer argument of type sk_buff.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/ce.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/ce.c b/drivers/net/wireless/ath/ath11k/ce.c
index 205f28e..03e7cf0 100644
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -296,15 +296,14 @@ static void ath11k_ce_recv_process_cb(struct ath11k_ce_pipe *pipe)
 	}
 }
 
-static int ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe,
-					 struct sk_buff **skb)
+static struct sk_buff *ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe)
 {
 	struct ath11k_base *ab = pipe->ab;
 	struct hal_srng *srng;
 	unsigned int sw_index;
 	unsigned int nentries_mask;
+	struct sk_buff *skb;
 	u32 *desc;
-	int ret = 0;
 
 	spin_lock_bh(&ab->ce.ce_lock);
 
@@ -319,11 +318,11 @@ static int ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe,
 
 	desc = ath11k_hal_srng_src_reap_next(ab, srng);
 	if (!desc) {
-		ret = -EIO;
+		skb = ERR_PTR(-EIO);
 		goto err_unlock;
 	}
 
-	*skb = pipe->src_ring->skb[sw_index];
+	skb = pipe->src_ring->skb[sw_index];
 
 	pipe->src_ring->skb[sw_index] = NULL;
 
@@ -335,7 +334,7 @@ static int ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe,
 
 	spin_unlock_bh(&ab->ce.ce_lock);
 
-	return ret;
+	return skb;
 }
 
 static void ath11k_ce_send_done_cb(struct ath11k_ce_pipe *pipe)
@@ -343,7 +342,7 @@ static void ath11k_ce_send_done_cb(struct ath11k_ce_pipe *pipe)
 	struct ath11k_base *ab = pipe->ab;
 	struct sk_buff *skb;
 
-	while (ath11k_ce_completed_send_next(pipe, &skb) == 0) {
+	while (!IS_ERR(skb = ath11k_ce_completed_send_next(pipe))) {
 		if (!skb)
 			continue;
 
-- 
1.9.1


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH bringup 3/3] ath11k: Use struct_size() to get the structure size with trailing array
  2019-09-25  4:44 [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Vasanthakumar Thiagarajan
  2019-09-25  4:44 ` [PATCH bringup 2/3] ath11k: Clean up parameter list in ath11k_ce_completed_send_next() Vasanthakumar Thiagarajan
@ 2019-09-25  4:44 ` Vasanthakumar Thiagarajan
  2019-09-27 14:52 ` [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Kalle Valo
  2019-09-27 15:07 ` Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Vasanthakumar Thiagarajan @ 2019-09-25  4:44 UTC (permalink / raw)
  To: ath11k

The size calculation of struct ath11k_ce_ring with trailing skb array
got simplified with struct_size() kernel macro.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/ce.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/ce.c b/drivers/net/wireless/ath/ath11k/ce.c
index 03e7cf0..daeab0f 100644
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -406,8 +406,7 @@ static int ath11k_ce_init_ring(struct ath11k_base *ab,
 	struct ath11k_ce_ring *ce_ring;
 	dma_addr_t base_addr;
 
-	ce_ring = kzalloc(sizeof(*ce_ring) + (nentries * sizeof(*ce_ring->skb)),
-			  GFP_KERNEL);
+	ce_ring = kzalloc(struct_size(ce_ring, skb, nentries), GFP_KERNEL);
 	if (ce_ring == NULL)
 		return ERR_PTR(-ENOMEM);
 
-- 
1.9.1


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path
  2019-09-25  4:44 [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Vasanthakumar Thiagarajan
  2019-09-25  4:44 ` [PATCH bringup 2/3] ath11k: Clean up parameter list in ath11k_ce_completed_send_next() Vasanthakumar Thiagarajan
  2019-09-25  4:44 ` [PATCH bringup 3/3] ath11k: Use struct_size() to get the structure size with trailing array Vasanthakumar Thiagarajan
@ 2019-09-27 14:52 ` Kalle Valo
  2019-09-27 14:55   ` Kalle Valo
  2019-09-27 15:07 ` Kalle Valo
  3 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2019-09-27 14:52 UTC (permalink / raw)
  To: Vasanthakumar Thiagarajan; +Cc: ath11k

Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> wrote:

> Unify the unlock/ring_access_end calls with error path in
> ath11k_ce_rx_buf_enqueue_pipe(). Update to ce_pipe->rx_buf_needed
> is done inside srng->lock before ath11k_hal_srng_access_end().
> Also rename the goto label from err to exit.
> 
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

d28909b5a9ac ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path
759b5305b0bc ath11k: Clean up parameter list in ath11k_ce_completed_send_next()
51725f95094a ath11k: Use struct_size() to get the structure size with trailing array

-- 
https://patchwork.kernel.org/patch/11160007/

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


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path
  2019-09-27 14:52 ` [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Kalle Valo
@ 2019-09-27 14:55   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-09-27 14:55 UTC (permalink / raw)
  To: Vasanthakumar Thiagarajan; +Cc: ath11k

Kalle Valo <kvalo@codeaurora.org> writes:

> Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> wrote:
>
>> Unify the unlock/ring_access_end calls with error path in
>> ath11k_ce_rx_buf_enqueue_pipe(). Update to ce_pipe->rx_buf_needed
>> is done inside srng->lock before ath11k_hal_srng_access_end().
>> Also rename the goto label from err to exit.
>> 
>> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
>> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
>
> 3 patches applied to ath11k-post-bringup branch of ath.git, thanks.
>
> d28909b5a9ac ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path
> 759b5305b0bc ath11k: Clean up parameter list in ath11k_ce_completed_send_next()
> 51725f95094a ath11k: Use struct_size() to get the structure size with trailing array

Please disregard, I applied to a wrong branch.

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

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path
  2019-09-25  4:44 [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Vasanthakumar Thiagarajan
                   ` (2 preceding siblings ...)
  2019-09-27 14:52 ` [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Kalle Valo
@ 2019-09-27 15:07 ` Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-09-27 15:07 UTC (permalink / raw)
  To: Vasanthakumar Thiagarajan; +Cc: ath11k

Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> wrote:

> Unify the unlock/ring_access_end calls with error path in
> ath11k_ce_rx_buf_enqueue_pipe(). Update to ce_pipe->rx_buf_needed
> is done inside srng->lock before ath11k_hal_srng_access_end().
> Also rename the goto label from err to exit.
> 
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

8cc72b480777 ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path
9f55e5658237 ath11k: Clean up parameter list in ath11k_ce_completed_send_next()
3dcb3e76a260 ath11k: Use struct_size() to get the structure size with trailing array

-- 
https://patchwork.kernel.org/patch/11160007/

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


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-27 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-25  4:44 [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Vasanthakumar Thiagarajan
2019-09-25  4:44 ` [PATCH bringup 2/3] ath11k: Clean up parameter list in ath11k_ce_completed_send_next() Vasanthakumar Thiagarajan
2019-09-25  4:44 ` [PATCH bringup 3/3] ath11k: Use struct_size() to get the structure size with trailing array Vasanthakumar Thiagarajan
2019-09-27 14:52 ` [PATCH bringup 1/3] ath11k: Clean ups in ath11k_ce_rx_buf_enqueue_pipe() error path Kalle Valo
2019-09-27 14:55   ` Kalle Valo
2019-09-27 15:07 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.