All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ath6kl: Update netstats for some of the tx failrues in ath6kl_data_tx()
@ 2012-04-26 14:56 Vasanthakumar Thiagarajan
  2012-04-26 14:56 ` [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue() Vasanthakumar Thiagarajan
  2012-04-30  7:57 ` [PATCH 1/2] ath6kl: Update netstats for some of the tx failrues in ath6kl_data_tx() Kalle Valo
  0 siblings, 2 replies; 10+ messages in thread
From: Vasanthakumar Thiagarajan @ 2012-04-26 14:56 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, ath6kl-devel

There are few cases where the tx skb is dropped but netstats is
not updated, fix this.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/txrx.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
index 82f2f5c..67206ae 100644
--- a/drivers/net/wireless/ath/ath6kl/txrx.c
+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
@@ -362,15 +362,11 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
 		   skb, skb->data, skb->len);
 
 	/* If target is not associated */
-	if (!test_bit(CONNECTED, &vif->flags)) {
-		dev_kfree_skb(skb);
-		return 0;
-	}
+	if (!test_bit(CONNECTED, &vif->flags))
+		goto fail_tx;
 
-	if (WARN_ON_ONCE(ar->state != ATH6KL_STATE_ON)) {
-		dev_kfree_skb(skb);
-		return 0;
-	}
+	if (WARN_ON_ONCE(ar->state != ATH6KL_STATE_ON))
+		goto fail_tx;
 
 	if (!test_bit(WMI_READY, &ar->flag))
 		goto fail_tx;
-- 
1.7.0.4


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

* [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue()
  2012-04-26 14:56 [PATCH 1/2] ath6kl: Update netstats for some of the tx failrues in ath6kl_data_tx() Vasanthakumar Thiagarajan
@ 2012-04-26 14:56 ` Vasanthakumar Thiagarajan
  2012-04-26 18:21   ` Kalle Valo
  2012-04-30  7:57 ` [PATCH 1/2] ath6kl: Update netstats for some of the tx failrues in ath6kl_data_tx() Kalle Valo
  1 sibling, 1 reply; 10+ messages in thread
From: Vasanthakumar Thiagarajan @ 2012-04-26 14:56 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, ath6kl-devel

Return status of ath6kl_htc_tx_issue() is ignored in
ath6kl_htc_tx_from_queue(), but failed tx packet is
is not cleaned up. To fix memory leak in this case, call
completion with error. Also, throw an error debug message
when tx fails in ath6kl_sdio_write_async() due to shortage
in bus request buffer.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/htc_mbox.c |    8 +++++++-
 drivers/net/wireless/ath/ath6kl/sdio.c     |    4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
index 65310d5..8729803 100644
--- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c
+++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
@@ -850,6 +850,7 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,
 	int bundle_sent;
 	int n_pkts_bundle;
 	u8 ac = WMM_NUM_AC;
+	int status;
 
 	spin_lock_bh(&target->tx_lock);
 
@@ -911,7 +912,12 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,
 
 			ath6kl_htc_tx_prep_pkt(packet, packet->info.tx.flags,
 					       0, packet->info.tx.seqno);
-			ath6kl_htc_tx_issue(target, packet);
+			status = ath6kl_htc_tx_issue(target, packet);
+
+			if (status) {
+				packet->status = status;
+				packet->completion(packet->context, packet);
+			}
 		}
 
 		spin_lock_bh(&target->tx_lock);
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 0384a0f..efe083f 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -552,8 +552,10 @@ static int ath6kl_sdio_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
 
 	bus_req = ath6kl_sdio_alloc_busreq(ar_sdio);
 
-	if (!bus_req)
+	if (!bus_req) {
+		ath6kl_err("Ran out of bus request buffer for tx\n");
 		return -ENOMEM;
+	}
 
 	bus_req->address = address;
 	bus_req->buffer = buffer;
-- 
1.7.0.4


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

* Re: [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue()
  2012-04-26 14:56 ` [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue() Vasanthakumar Thiagarajan
@ 2012-04-26 18:21   ` Kalle Valo
  2012-04-27  4:09     ` Vasanthakumar Thiagarajan
  0 siblings, 1 reply; 10+ messages in thread
From: Kalle Valo @ 2012-04-26 18:21 UTC (permalink / raw)
  To: Vasanthakumar Thiagarajan; +Cc: linux-wireless, ath6kl-devel

On 04/26/2012 05:56 PM, Vasanthakumar Thiagarajan wrote:
> Return status of ath6kl_htc_tx_issue() is ignored in
> ath6kl_htc_tx_from_queue(), but failed tx packet is
> is not cleaned up. To fix memory leak in this case, call
> completion with error. Also, throw an error debug message
> when tx fails in ath6kl_sdio_write_async() due to shortage
> in bus request buffer.
> 
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

[...]

>  	bus_req = ath6kl_sdio_alloc_busreq(ar_sdio);
>  
> -	if (!bus_req)
> +	if (!bus_req) {
> +		ath6kl_err("Ran out of bus request buffer for tx\n");
>  		return -ENOMEM;
> +	}

I'm not sure about this one. There's a risk that this will spam the log.
Should it be a debug message instead? Or should we have instead
ath6kl_err_ratelimit()?

Kalle

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

* Re: [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue()
  2012-04-26 18:21   ` Kalle Valo
@ 2012-04-27  4:09     ` Vasanthakumar Thiagarajan
  2012-04-27  6:34       ` Kalle Valo
  0 siblings, 1 reply; 10+ messages in thread
From: Vasanthakumar Thiagarajan @ 2012-04-27  4:09 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath6kl-devel



On Thursday 26 April 2012 11:51 PM, Kalle Valo wrote:
> On 04/26/2012 05:56 PM, Vasanthakumar Thiagarajan wrote:
>> Return status of ath6kl_htc_tx_issue() is ignored in
>> ath6kl_htc_tx_from_queue(), but failed tx packet is
>> is not cleaned up. To fix memory leak in this case, call
>> completion with error. Also, throw an error debug message
>> when tx fails in ath6kl_sdio_write_async() due to shortage
>> in bus request buffer.
>>
>> Signed-off-by: Vasanthakumar Thiagarajan<vthiagar@qca.qualcomm.com>
>
> [...]
>
>>   	bus_req = ath6kl_sdio_alloc_busreq(ar_sdio);
>>
>> -	if (!bus_req)
>> +	if (!bus_req) {
>> +		ath6kl_err("Ran out of bus request buffer for tx\n");
>>   		return -ENOMEM;
>> +	}
>
> I'm not sure about this one. There's a risk that this will spam the log.
> Should it be a debug message instead? Or should we have instead
> ath6kl_err_ratelimit()?

This condition is very rare, I found it only through code review. I'm 
pretty sure we don't hit this very often.

Vasanth

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

* Re: [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue()
  2012-04-27  4:09     ` Vasanthakumar Thiagarajan
@ 2012-04-27  6:34       ` Kalle Valo
  2012-04-27  6:52         ` Vasanthakumar Thiagarajan
  0 siblings, 1 reply; 10+ messages in thread
From: Kalle Valo @ 2012-04-27  6:34 UTC (permalink / raw)
  To: Vasanthakumar Thiagarajan; +Cc: linux-wireless, ath6kl-devel

On 04/27/2012 07:09 AM, Vasanthakumar Thiagarajan wrote:

>>>   	bus_req = ath6kl_sdio_alloc_busreq(ar_sdio);
>>>
>>> -	if (!bus_req)
>>> +	if (!bus_req) {
>>> +		ath6kl_err("Ran out of bus request buffer for tx\n");
>>>   		return -ENOMEM;
>>> +	}
>>
>> I'm not sure about this one. There's a risk that this will spam the log.
>> Should it be a debug message instead? Or should we have instead
>> ath6kl_err_ratelimit()?
> 
> This condition is very rare, I found it only through code review. I'm 
> pretty sure we don't hit this very often.

I'm not worried how often it happens, I'm just worried that _when_ it
happens the warning might make things worse. For example, I personally
saw a case where flood of warnings prevented watchdog heartbeat from
happening which caused the whole system to reboot. Without the warnings
system would have worked just fine, just a bit more slowly.

Is it ok for you if I change the ath6kl_err() to WARN_ON_ONCE() (or
WARN_ONCE() if you prefer to keep the warning message)? This should be a
rare event anyway.

Kalle

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

* Re: [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue()
  2012-04-27  6:34       ` Kalle Valo
@ 2012-04-27  6:52         ` Vasanthakumar Thiagarajan
  0 siblings, 0 replies; 10+ messages in thread
From: Vasanthakumar Thiagarajan @ 2012-04-27  6:52 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath6kl-devel



On Friday 27 April 2012 12:04 PM, Kalle Valo wrote:
> On 04/27/2012 07:09 AM, Vasanthakumar Thiagarajan wrote:
>
>>>>    	bus_req = ath6kl_sdio_alloc_busreq(ar_sdio);
>>>>
>>>> -	if (!bus_req)
>>>> +	if (!bus_req) {
>>>> +		ath6kl_err("Ran out of bus request buffer for tx\n");
>>>>    		return -ENOMEM;
>>>> +	}
>>>
>>> I'm not sure about this one. There's a risk that this will spam the log.
>>> Should it be a debug message instead? Or should we have instead
>>> ath6kl_err_ratelimit()?
>>
>> This condition is very rare, I found it only through code review. I'm
>> pretty sure we don't hit this very often.
>
> I'm not worried how often it happens, I'm just worried that _when_ it
> happens the warning might make things worse. For example, I personally
> saw a case where flood of warnings prevented watchdog heartbeat from
> happening which caused the whole system to reboot. Without the warnings
> system would have worked just fine, just a bit more slowly.

Fair enough.

>
> Is it ok for you if I change the ath6kl_err() to WARN_ON_ONCE() (or
> WARN_ONCE() if you prefer to keep the warning message)? This should be a
> rare event anyway.

I'm fine with that, thanks.

Vasanth

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

* Re: [PATCH 1/2] ath6kl: Update netstats for some of the tx failrues in ath6kl_data_tx()
  2012-04-26 14:56 [PATCH 1/2] ath6kl: Update netstats for some of the tx failrues in ath6kl_data_tx() Vasanthakumar Thiagarajan
  2012-04-26 14:56 ` [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue() Vasanthakumar Thiagarajan
@ 2012-04-30  7:57 ` Kalle Valo
  1 sibling, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2012-04-30  7:57 UTC (permalink / raw)
  To: Vasanthakumar Thiagarajan; +Cc: linux-wireless, ath6kl-devel

On 04/26/2012 05:56 PM, Vasanthakumar Thiagarajan wrote:
> There are few cases where the tx skb is dropped but netstats is
> not updated, fix this.
> 
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

Thanks, both patches applied.

Kalle

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

* Re: [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue()
  2012-05-22  7:25   ` Vasanthakumar Thiagarajan
@ 2012-05-22 12:28     ` Kalle Valo
  0 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2012-05-22 12:28 UTC (permalink / raw)
  To: Vasanthakumar Thiagarajan; +Cc: linux-wireless, ath6kl-devel

On 05/22/2012 10:25 AM, Vasanthakumar Thiagarajan wrote:
> 
> Oops, please forget this crap, mistakenly sent the older patches.
> I'm really sorry.

No worries :)

I will ignore the patches.

Kalle

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

* Re: [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue()
  2012-05-22  7:22 ` [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue() Vasanthakumar Thiagarajan
@ 2012-05-22  7:25   ` Vasanthakumar Thiagarajan
  2012-05-22 12:28     ` Kalle Valo
  0 siblings, 1 reply; 10+ messages in thread
From: Vasanthakumar Thiagarajan @ 2012-05-22  7:25 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, ath6kl-devel


Oops, please forget this crap, mistakenly sent the older patches.
I'm really sorry.

Vasanth

On Tuesday 22 May 2012 12:52 PM, Vasanthakumar Thiagarajan wrote:
> Return status of ath6kl_htc_tx_issue() is ignored in
> ath6kl_htc_tx_from_queue(), but failed tx packet is
> is not cleaned up. To fix memory leak in this case, call
> completion with error. Also, throw an error debug message
> when tx fails in ath6kl_sdio_write_async() due to shortage
> in bus request buffer.
>
> Signed-off-by: Vasanthakumar Thiagarajan<vthiagar@qca.qualcomm.com>
> ---
>   drivers/net/wireless/ath/ath6kl/htc_mbox.c |    8 +++++++-
>   drivers/net/wireless/ath/ath6kl/sdio.c     |    4 +++-
>   2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
> index 65310d5..8729803 100644
> --- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c
> +++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
> @@ -850,6 +850,7 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,
>   	int bundle_sent;
>   	int n_pkts_bundle;
>   	u8 ac = WMM_NUM_AC;
> +	int status;
>
>   	spin_lock_bh(&target->tx_lock);
>
> @@ -911,7 +912,12 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,
>
>   			ath6kl_htc_tx_prep_pkt(packet, packet->info.tx.flags,
>   					       0, packet->info.tx.seqno);
> -			ath6kl_htc_tx_issue(target, packet);
> +			status = ath6kl_htc_tx_issue(target, packet);
> +
> +			if (status) {
> +				packet->status = status;
> +				packet->completion(packet->context, packet);
> +			}
>   		}
>
>   		spin_lock_bh(&target->tx_lock);
> diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
> index 0384a0f..efe083f 100644
> --- a/drivers/net/wireless/ath/ath6kl/sdio.c
> +++ b/drivers/net/wireless/ath/ath6kl/sdio.c
> @@ -552,8 +552,10 @@ static int ath6kl_sdio_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
>
>   	bus_req = ath6kl_sdio_alloc_busreq(ar_sdio);
>
> -	if (!bus_req)
> +	if (!bus_req) {
> +		ath6kl_err("Ran out of bus request buffer for tx\n");
>   		return -ENOMEM;
> +	}
>
>   	bus_req->address = address;
>   	bus_req->buffer = buffer;

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

* [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue()
  2012-05-22  7:22 [PATCH] ath6kl: Fix missing gpio pin 9 configuration Vasanthakumar Thiagarajan
@ 2012-05-22  7:22 ` Vasanthakumar Thiagarajan
  2012-05-22  7:25   ` Vasanthakumar Thiagarajan
  0 siblings, 1 reply; 10+ messages in thread
From: Vasanthakumar Thiagarajan @ 2012-05-22  7:22 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, ath6kl-devel

Return status of ath6kl_htc_tx_issue() is ignored in
ath6kl_htc_tx_from_queue(), but failed tx packet is
is not cleaned up. To fix memory leak in this case, call
completion with error. Also, throw an error debug message
when tx fails in ath6kl_sdio_write_async() due to shortage
in bus request buffer.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/htc_mbox.c |    8 +++++++-
 drivers/net/wireless/ath/ath6kl/sdio.c     |    4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
index 65310d5..8729803 100644
--- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c
+++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
@@ -850,6 +850,7 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,
 	int bundle_sent;
 	int n_pkts_bundle;
 	u8 ac = WMM_NUM_AC;
+	int status;
 
 	spin_lock_bh(&target->tx_lock);
 
@@ -911,7 +912,12 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,
 
 			ath6kl_htc_tx_prep_pkt(packet, packet->info.tx.flags,
 					       0, packet->info.tx.seqno);
-			ath6kl_htc_tx_issue(target, packet);
+			status = ath6kl_htc_tx_issue(target, packet);
+
+			if (status) {
+				packet->status = status;
+				packet->completion(packet->context, packet);
+			}
 		}
 
 		spin_lock_bh(&target->tx_lock);
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 0384a0f..efe083f 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -552,8 +552,10 @@ static int ath6kl_sdio_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
 
 	bus_req = ath6kl_sdio_alloc_busreq(ar_sdio);
 
-	if (!bus_req)
+	if (!bus_req) {
+		ath6kl_err("Ran out of bus request buffer for tx\n");
 		return -ENOMEM;
+	}
 
 	bus_req->address = address;
 	bus_req->buffer = buffer;
-- 
1.7.0.4


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

end of thread, other threads:[~2012-05-22 12:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-26 14:56 [PATCH 1/2] ath6kl: Update netstats for some of the tx failrues in ath6kl_data_tx() Vasanthakumar Thiagarajan
2012-04-26 14:56 ` [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue() Vasanthakumar Thiagarajan
2012-04-26 18:21   ` Kalle Valo
2012-04-27  4:09     ` Vasanthakumar Thiagarajan
2012-04-27  6:34       ` Kalle Valo
2012-04-27  6:52         ` Vasanthakumar Thiagarajan
2012-04-30  7:57 ` [PATCH 1/2] ath6kl: Update netstats for some of the tx failrues in ath6kl_data_tx() Kalle Valo
2012-05-22  7:22 [PATCH] ath6kl: Fix missing gpio pin 9 configuration Vasanthakumar Thiagarajan
2012-05-22  7:22 ` [PATCH 2/2] ath6kl: Complete failed tx packet in ath6kl_htc_tx_from_queue() Vasanthakumar Thiagarajan
2012-05-22  7:25   ` Vasanthakumar Thiagarajan
2012-05-22 12:28     ` 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.