All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ar9170usb: fix panic triggered by undersized rxstream buffer
@ 2010-03-23 20:51 Christian Lamparter
  2010-03-24  1:59 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Lamparter @ 2010-03-23 20:51 UTC (permalink / raw)
  To: linux-wireless; +Cc: Christian Mehlis, John W Linville

While ar9170's USB transport packet size is currently set to 8KiB,
the PHY is capable of receiving AMPDUs with up to 64KiB.
Such a large frame will be split over several rx URBs and
exceed the previously allocated space for rx stream reconstruction.

This patch increases the buffer size to 64KiB which is
in fact the phy & rx stream designed size limit.

Cc: stable@kernel.org
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=15591
Reported-by: Christian Mehlis <mehlis@inf.fu-berlin.de>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
---
diff --git a/drivers/net/wireless/ath/ar9170/hw.h b/drivers/net/wireless/ath/ar9170/hw.h
index 0a1d4c2..06f1f3c 100644
--- a/drivers/net/wireless/ath/ar9170/hw.h
+++ b/drivers/net/wireless/ath/ar9170/hw.h
@@ -425,5 +425,6 @@ enum ar9170_txq {
 
 #define AR9170_TXQ_DEPTH	32
 #define AR9170_TX_MAX_PENDING	128
+#define AR9170_RX_STREAM_MAX_SIZE 65535
 
 #endif /* __AR9170_HW_H */
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index 257c734..e017119 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -2515,7 +2515,7 @@ void *ar9170_alloc(size_t priv_size)
 	 * tends to split the streams into separate rx descriptors.
 	 */
 
-	skb = __dev_alloc_skb(AR9170_MAX_RX_BUFFER_SIZE, GFP_KERNEL);
+	skb = __dev_alloc_skb(AR9170_RX_STREAM_MAX_SIZE, GFP_KERNEL);
 	if (!skb)
 		goto err_nomem;
 

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

* Re: [PATCH] ar9170usb: fix panic triggered by undersized rxstream buffer
  2010-03-23 20:51 [PATCH] ar9170usb: fix panic triggered by undersized rxstream buffer Christian Lamparter
@ 2010-03-24  1:59 ` Johannes Berg
  2010-03-24  2:20   ` Zhu Yi
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2010-03-24  1:59 UTC (permalink / raw)
  To: Christian Lamparter; +Cc: linux-wireless, Christian Mehlis, John W Linville

On Tue, 2010-03-23 at 21:51 +0100, Christian Lamparter wrote:
> While ar9170's USB transport packet size is currently set to 8KiB,
> the PHY is capable of receiving AMPDUs with up to 64KiB.
> Such a large frame will be split over several rx URBs and
> exceed the previously allocated space for rx stream reconstruction.
> 
> This patch increases the buffer size to 64KiB which is
> in fact the phy & rx stream designed size limit.

That's a pretty high order allocation, you may want to paged allocation
-- you'll end up doing a order 5 allocation here!

johannes



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

* Re: [PATCH] ar9170usb: fix panic triggered by undersized rxstream buffer
  2010-03-24  1:59 ` Johannes Berg
@ 2010-03-24  2:20   ` Zhu Yi
  2010-03-24 12:30     ` Christian Lamparter
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Yi @ 2010-03-24  2:20 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Christian Lamparter, linux-wireless, Christian Mehlis, John W Linville

On Wed, 2010-03-24 at 09:59 +0800, Johannes Berg wrote:
> On Tue, 2010-03-23 at 21:51 +0100, Christian Lamparter wrote:
> > While ar9170's USB transport packet size is currently set to 8KiB,
> > the PHY is capable of receiving AMPDUs with up to 64KiB.
> > Such a large frame will be split over several rx URBs and
> > exceed the previously allocated space for rx stream reconstruction.
> > 
> > This patch increases the buffer size to 64KiB which is
> > in fact the phy & rx stream designed size limit.
> 
> That's a pretty high order allocation, you may want to paged allocation
> -- you'll end up doing a order 5 allocation here!

Yup, order-5 given the struct skb_shared_info overhead in __alloc_skb().
If the URBs are split over, you probably don't need to allocate such a
big chunk of memory in one go. You just need to connect them into a
paged skb later before pushing to mac80211. BTW, I've moved the
skb_linearize() from iwlwifi to mac80211. Will submit the patches today.

Thanks,
-yi


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

* Re: [PATCH] ar9170usb: fix panic triggered by undersized rxstream buffer
  2010-03-24  2:20   ` Zhu Yi
@ 2010-03-24 12:30     ` Christian Lamparter
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Lamparter @ 2010-03-24 12:30 UTC (permalink / raw)
  To: Zhu Yi; +Cc: Johannes Berg, linux-wireless, Christian Mehlis, John W Linville

On Wednesday 24 March 2010 03:20:18 Zhu Yi wrote:
> On Wed, 2010-03-24 at 09:59 +0800, Johannes Berg wrote:
> > On Tue, 2010-03-23 at 21:51 +0100, Christian Lamparter wrote:
> > > While ar9170's USB transport packet size is currently set to 8KiB,
> > > the PHY is capable of receiving AMPDUs with up to 64KiB.
> > > Such a large frame will be split over several rx URBs and
> > > exceed the previously allocated space for rx stream reconstruction.
> > > 
> > > This patch increases the buffer size to 64KiB which is
> > > in fact the phy & rx stream designed size limit.
> > 
> > That's a pretty high order allocation, you may want to paged allocation
> > -- you'll end up doing a order 5 allocation here!
> Yup, order-5 given the struct skb_shared_info overhead in __alloc_skb().
> If the URBs are split over, you probably don't need to allocate such a
> big chunk of memory in one go. 

I know, I know, but unfortunately I do need a continuous address space.
The reason is that usually one URB can have up to 5 data frames
(each with ~1600 Octets). That's why the driver memcpys everything
from the rxstream skbs into newly allocated ones for each individual frame.
(The reconstruction  simply adds another memcpy to a temporary buffer,
 until we have everything...).

as far as I can tell, there's only one other options:
 * mix vmalloc with paged skbs API ;-)

   This looks kind of funny. The API abuse is highly questionable and
   probably not something for "stable".

 * early drop, if len > 8KiB

   This has the downside that we lose the data and the rx stream state.
   (E.g.: signal quality & phy data, mac error codes, the lot...)

 * something I don't know?

   please tell me about it!

> You just need to connect them into a paged skb later before pushing to mac80211.
> BTW, I've moved the skb_linearize() from iwlwifi to mac80211. Will submit the patches today.
AFAIK Atheros resolved this issue with AR9271. At least that's what I
heard from Luis about the _new_ scatter/gather IO implementation.

Regards,
	Chr

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

end of thread, other threads:[~2010-03-24 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-23 20:51 [PATCH] ar9170usb: fix panic triggered by undersized rxstream buffer Christian Lamparter
2010-03-24  1:59 ` Johannes Berg
2010-03-24  2:20   ` Zhu Yi
2010-03-24 12:30     ` Christian Lamparter

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.