netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: rtl818x: request DMA-able memory
@ 2010-10-24 20:32 Serafeim Zanikolas
  0 siblings, 0 replies; 9+ messages in thread
From: Serafeim Zanikolas @ 2010-10-24 20:32 UTC (permalink / raw)
  To: herton, htl10, Larry.Finger, linville, joe, davem, linux-wireless,
	netdev
  Cc: Serafeim Zanikolas

Despite the indicated intention in comment, the kmalloc() call was not
explicitly requesting memory from ZONE_DMA.

Signed-off-by: Serafeim Zanikolas <sez@debian.org>
---
 drivers/net/wireless/rtl818x/rtl8187_dev.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 38fa824..771794d 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -1343,7 +1343,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
 	priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
 
 	/* allocate "DMA aware" buffer for register accesses */
-	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
+	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf),
+				  GFP_DMA | GFP_KERNEL);
 	if (!priv->io_dmabuf) {
 		err = -ENOMEM;
 		goto err_free_dev;
-- 
1.7.1


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

* Re: [PATCH] drivers: rtl818x: request DMA-able memory
       [not found] <1287952327-9924-1-git-send-email-sez@debian.org>
@ 2010-10-25 13:24 ` Larry Finger
  2010-10-25 14:11   ` Hin-Tak Leung
  2010-10-25 13:35 ` John W. Linville
  1 sibling, 1 reply; 9+ messages in thread
From: Larry Finger @ 2010-10-25 13:24 UTC (permalink / raw)
  To: Serafeim Zanikolas
  Cc: herton, htl10, linville, joe, davem, linux-wireless, netdev,
	linux-kernel

On 10/24/2010 03:32 PM, Serafeim Zanikolas wrote:
> Despite the indicated intention in comment, the kmalloc() call was not
> explicitly requesting memory from ZONE_DMA.
> 
> Signed-off-by: Serafeim Zanikolas <sez@debian.org>
> ---
>  drivers/net/wireless/rtl818x/rtl8187_dev.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
> index 38fa824..771794d 100644
> --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
> +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
> @@ -1343,7 +1343,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
>  	priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
>  
>  	/* allocate "DMA aware" buffer for register accesses */
> -	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
> +	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf),
> +				  GFP_DMA | GFP_KERNEL);
>  	if (!priv->io_dmabuf) {
>  		err = -ENOMEM;
>  		goto err_free_dev;

ACK.

Larry


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

* Re: [PATCH] drivers: rtl818x: request DMA-able memory
       [not found] <1287952327-9924-1-git-send-email-sez@debian.org>
  2010-10-25 13:24 ` [PATCH] drivers: rtl818x: request DMA-able memory Larry Finger
@ 2010-10-25 13:35 ` John W. Linville
  1 sibling, 0 replies; 9+ messages in thread
From: John W. Linville @ 2010-10-25 13:35 UTC (permalink / raw)
  To: Serafeim Zanikolas
  Cc: herton, htl10, Larry.Finger, joe, davem, linux-wireless, netdev,
	linux-kernel

On Sun, Oct 24, 2010 at 10:32:07PM +0200, Serafeim Zanikolas wrote:
> Despite the indicated intention in comment, the kmalloc() call was not
> explicitly requesting memory from ZONE_DMA.
> 
> Signed-off-by: Serafeim Zanikolas <sez@debian.org>
> ---
>  drivers/net/wireless/rtl818x/rtl8187_dev.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
> index 38fa824..771794d 100644
> --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
> +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
> @@ -1343,7 +1343,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
>  	priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
>  
>  	/* allocate "DMA aware" buffer for register accesses */
> -	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
> +	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf),
> +				  GFP_DMA | GFP_KERNEL);
>  	if (!priv->io_dmabuf) {
>  		err = -ENOMEM;
>  		goto err_free_dev;

Are you sure about this?  Are there USB controllers out there with
the ISA 16MB limitation for DMA?

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

* Re: [PATCH] drivers: rtl818x: request DMA-able memory
  2010-10-25 13:24 ` [PATCH] drivers: rtl818x: request DMA-able memory Larry Finger
@ 2010-10-25 14:11   ` Hin-Tak Leung
  2010-10-25 14:22     ` John W. Linville
  2010-10-25 14:23     ` Johannes Berg
  0 siblings, 2 replies; 9+ messages in thread
From: Hin-Tak Leung @ 2010-10-25 14:11 UTC (permalink / raw)
  To: Larry Finger
  Cc: Serafeim Zanikolas, herton, linville, joe, davem, linux-wireless,
	netdev, linux-kernel



Larry Finger wrote:
> On 10/24/2010 03:32 PM, Serafeim Zanikolas wrote:
>> Despite the indicated intention in comment, the kmalloc() call was not
>> explicitly requesting memory from ZONE_DMA.
>>
>> Signed-off-by: Serafeim Zanikolas <sez@debian.org>
>> ---
>>  drivers/net/wireless/rtl818x/rtl8187_dev.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
>> index 38fa824..771794d 100644
>> --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
>> +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
>> @@ -1343,7 +1343,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
>>  	priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
>>  
>>  	/* allocate "DMA aware" buffer for register accesses */
>> -	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
>> +	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf),
>> +				  GFP_DMA | GFP_KERNEL);
>>  	if (!priv->io_dmabuf) {
>>  		err = -ENOMEM;
>>  		goto err_free_dev;
> 
> ACK.
> 
> Larry

Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>

I had a quick look for similiar constructs and AFAIK only the b43/b43legacy 
drivers uses DMA buffers. Seems to be a rare practice. Is that something we 
should or should not do?

Hin-Tak

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

* Re: [PATCH] drivers: rtl818x: request DMA-able memory
  2010-10-25 14:11   ` Hin-Tak Leung
@ 2010-10-25 14:22     ` John W. Linville
  2010-10-25 15:39       ` Hin-Tak Leung
  2010-10-25 17:44       ` Serafeim Zanikolas
  2010-10-25 14:23     ` Johannes Berg
  1 sibling, 2 replies; 9+ messages in thread
From: John W. Linville @ 2010-10-25 14:22 UTC (permalink / raw)
  To: Hin-Tak Leung
  Cc: Larry Finger, Serafeim Zanikolas, herton, joe, davem,
	linux-wireless, netdev, linux-kernel

On Mon, Oct 25, 2010 at 03:11:22PM +0100, Hin-Tak Leung wrote:
> 
> 
> Larry Finger wrote:
> >On 10/24/2010 03:32 PM, Serafeim Zanikolas wrote:
> >>Despite the indicated intention in comment, the kmalloc() call was not
> >>explicitly requesting memory from ZONE_DMA.
> >>
> >>Signed-off-by: Serafeim Zanikolas <sez@debian.org>
> >>---
> >> drivers/net/wireless/rtl818x/rtl8187_dev.c |    3 ++-
> >> 1 files changed, 2 insertions(+), 1 deletions(-)
> >>
> >>diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
> >>index 38fa824..771794d 100644
> >>--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
> >>+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
> >>@@ -1343,7 +1343,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
> >> 	priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
> >> 	/* allocate "DMA aware" buffer for register accesses */
> >>-	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
> >>+	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf),
> >>+				  GFP_DMA | GFP_KERNEL);
> >> 	if (!priv->io_dmabuf) {
> >> 		err = -ENOMEM;
> >> 		goto err_free_dev;
> >
> >ACK.
> >
> >Larry
> 
> Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
> 
> I had a quick look for similiar constructs and AFAIK only the
> b43/b43legacy drivers uses DMA buffers. Seems to be a rare practice.
> Is that something we should or should not do?

It doesn't mean what you think it means.  It is a relic of the past,
used to indicate memory below 16MB so that ISA devices could do DMA.

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

* Re: [PATCH] drivers: rtl818x: request DMA-able memory
  2010-10-25 14:11   ` Hin-Tak Leung
  2010-10-25 14:22     ` John W. Linville
@ 2010-10-25 14:23     ` Johannes Berg
  1 sibling, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2010-10-25 14:23 UTC (permalink / raw)
  To: Hin-Tak Leung
  Cc: Larry Finger, Serafeim Zanikolas, herton, linville, joe, davem,
	linux-wireless, netdev, linux-kernel

On Mon, 2010-10-25 at 15:11 +0100, Hin-Tak Leung wrote:

> >> Despite the indicated intention in comment, the kmalloc() call was not
> >> explicitly requesting memory from ZONE_DMA.

> I had a quick look for similiar constructs and AFAIK only the b43/b43legacy 
> drivers uses DMA buffers. Seems to be a rare practice. Is that something we 
> should or should not do?

I think there's some confusion here about ZONE_DMA vs. DMA-able memory.
All memory you get with kmalloc can be used for DMA, GFP_DMA means using
ZONE_DMA which is a hack for ISA (and in b43 maybe PCMCIA/Cardbus)
devices to put memory into something they can address. I don't think the
latter is necessary for USB devices.

johannes

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

* Re: [PATCH] drivers: rtl818x: request DMA-able memory
  2010-10-25 14:22     ` John W. Linville
@ 2010-10-25 15:39       ` Hin-Tak Leung
       [not found]         ` <902045.66378.qm-gyycVyw5OoDyX4RqAA4FmIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
  2010-10-25 17:44       ` Serafeim Zanikolas
  1 sibling, 1 reply; 9+ messages in thread
From: Hin-Tak Leung @ 2010-10-25 15:39 UTC (permalink / raw)
  To: John W. Linville
  Cc: Larry Finger, Serafeim Zanikolas, herton, joe, davem,
	linux-wireless, netdev, linux-kernel


--- On Mon, 25/10/10, John W. Linville <linville@tuxdriver.com> wrote:

> > I had a quick look for similiar constructs and AFAIK
> only the
> > b43/b43legacy drivers uses DMA buffers. Seems to be a
> rare practice.
> > Is that something we should or should not do?
> 
> It doesn't mean what you think it means.  It is a
> relic of the past,
> used to indicate memory below 16MB so that ISA devices
> could do DMA.

okay - sorry about the confusion - I was grep'ing for GFP_DMA and only b43/b43lagacy have it and it is relatively rare. AFAIK none of the rtl8187 devices are non-USB... probably a NACK then, but I should ask Serafeim if there is a reason for him to submit this patch? (other than "it says dma"...) 

Hin-tak


      

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

* Re: [PATCH] drivers: rtl818x: request DMA-able memory
  2010-10-25 14:22     ` John W. Linville
  2010-10-25 15:39       ` Hin-Tak Leung
@ 2010-10-25 17:44       ` Serafeim Zanikolas
  1 sibling, 0 replies; 9+ messages in thread
From: Serafeim Zanikolas @ 2010-10-25 17:44 UTC (permalink / raw)
  To: John W. Linville
  Cc: Hin-Tak Leung, Larry Finger, herton, joe, davem, linux-wireless,
	netdev, linux-kernel

On Mon, Oct 25, 2010 at 10:22:32AM -0400, John W. Linville wrote:
> On Mon, Oct 25, 2010 at 03:11:22PM +0100, Hin-Tak Leung wrote:
> > 
> > 
> > Larry Finger wrote:
> > >On 10/24/2010 03:32 PM, Serafeim Zanikolas wrote:
> > >>Despite the indicated intention in comment, the kmalloc() call was not
> > >>explicitly requesting memory from ZONE_DMA.
> > >>
> > >>Signed-off-by: Serafeim Zanikolas <sez@debian.org>
> > >>---
> > >> drivers/net/wireless/rtl818x/rtl8187_dev.c |    3 ++-
> > >> 1 files changed, 2 insertions(+), 1 deletions(-)
> > >>
> > >>diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
> > >>index 38fa824..771794d 100644
> > >>--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
> > >>+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
> > >>@@ -1343,7 +1343,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
> > >> 	priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
> > >> 	/* allocate "DMA aware" buffer for register accesses */
> > >>-	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
> > >>+	priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf),
> > >>+				  GFP_DMA | GFP_KERNEL);
> > >> 	if (!priv->io_dmabuf) {
> > >> 		err = -ENOMEM;
> > >> 		goto err_free_dev;
> > >
> > >ACK.
> > >
> > >Larry
> > 
> > Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
> > 
> > I had a quick look for similiar constructs and AFAIK only the
> > b43/b43legacy drivers uses DMA buffers. Seems to be a rare practice.
> > Is that something we should or should not do?
> 
> It doesn't mean what you think it means.  It is a relic of the past,
> used to indicate memory below 16MB so that ISA devices could do DMA.

Right. Sorry for the noise.

-S

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

* Re: [PATCH] drivers: rtl818x: request DMA-able memory
       [not found]         ` <902045.66378.qm-gyycVyw5OoDyX4RqAA4FmIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
@ 2010-10-25 18:01           ` Larry Finger
  0 siblings, 0 replies; 9+ messages in thread
From: Larry Finger @ 2010-10-25 18:01 UTC (permalink / raw)
  To: htl10-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
  Cc: John W. Linville, Serafeim Zanikolas,
	herton-4qZELD6Fgxg39yzSjRtAkw, joe-6d6DIl74uiNBDgjK7y7TUQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 10/25/2010 10:39 AM, Hin-Tak Leung wrote:
> 
> okay - sorry about the confusion - I was grep'ing for GFP_DMA and only b43/b43lagacy have it and it is relatively rare. AFAIK none of the rtl8187 devices are non-USB... probably a NACK then, but I should ask Serafeim if there is a reason for him to submit this patch? (other than "it says dma"...) 

There are some devices driven by b43/b43legacy that implement only 24-bit DMA.
For that reason, they need to allocate DMA buffers in the low 16 MB of RAM. For
rtl8187, that consideration does not apply.

Larry
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2010-10-25 18:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1287952327-9924-1-git-send-email-sez@debian.org>
2010-10-25 13:24 ` [PATCH] drivers: rtl818x: request DMA-able memory Larry Finger
2010-10-25 14:11   ` Hin-Tak Leung
2010-10-25 14:22     ` John W. Linville
2010-10-25 15:39       ` Hin-Tak Leung
     [not found]         ` <902045.66378.qm-gyycVyw5OoDyX4RqAA4FmIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
2010-10-25 18:01           ` Larry Finger
2010-10-25 17:44       ` Serafeim Zanikolas
2010-10-25 14:23     ` Johannes Berg
2010-10-25 13:35 ` John W. Linville
2010-10-24 20:32 Serafeim Zanikolas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).