linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled
@ 2009-02-06 16:02 Atsushi Nemoto
  2009-02-06 21:15 ` Dan Williams
  0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Nemoto @ 2009-02-06 16:02 UTC (permalink / raw)
  To: Dan Williams; +Cc: Maciej Sosnowski, David S. Miller, linux-kernel

The commit 649274d993212e7c23c0cb734572c2311c200872 ("net_dma:
acquire/release dma channels on ifup/ifdown") added unconditional call
of dmaengine_get() to net_dma.  The API should be called only if
NET_DMA was enabled.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 net/core/dev.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 5379b0c..3d510d4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1087,10 +1087,12 @@ int dev_open(struct net_device *dev)
 		 */
 		dev->flags |= IFF_UP;
 
+#ifdef CONFIG_NET_DMA
 		/*
 		 *	Enable NET_DMA
 		 */
 		dmaengine_get();
+#endif
 
 		/*
 		 *	Initialize multicasting status
@@ -1169,10 +1171,12 @@ int dev_close(struct net_device *dev)
 	 */
 	call_netdevice_notifiers(NETDEV_DOWN, dev);
 
+#ifdef CONFIG_NET_DMA
 	/*
 	 *	Shutdown NET_DMA
 	 */
 	dmaengine_put();
+#endif
 
 	return 0;
 }
-- 
1.5.6.3


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

* Re: [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled
  2009-02-06 16:02 [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled Atsushi Nemoto
@ 2009-02-06 21:15 ` Dan Williams
  2009-02-06 22:09   ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Williams @ 2009-02-06 21:15 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: Maciej Sosnowski, David S. Miller, linux-kernel, netdev

[ please cc netdev on net_dma patches ]

On Fri, Feb 6, 2009 at 9:02 AM, Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> The commit 649274d993212e7c23c0cb734572c2311c200872 ("net_dma:
> acquire/release dma channels on ifup/ifdown") added unconditional call
> of dmaengine_get() to net_dma.  The API should be called only if
> NET_DMA was enabled.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

Acked-by: Dan Williams <dan.j.williams@intel.com>

I was looking to avoid ifdefs in this path by making
dmaengine_{get,put} a nop in the DMAENGINE=n case.  However, the
current code with DMAENGINE=y NET_DMA=n will pin channels even though
the network stack is not using them.

Thanks,
Dan

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

* Re: [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled
  2009-02-06 21:15 ` Dan Williams
@ 2009-02-06 22:09   ` David Miller
  2009-02-06 22:52     ` Dan Williams
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-02-06 22:09 UTC (permalink / raw)
  To: dan.j.williams; +Cc: anemo, maciej.sosnowski, linux-kernel, netdev

From: Dan Williams <dan.j.williams@intel.com>
Date: Fri, 6 Feb 2009 14:15:02 -0700

> [ please cc netdev on net_dma patches ]
> 
> On Fri, Feb 6, 2009 at 9:02 AM, Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> > The commit 649274d993212e7c23c0cb734572c2311c200872 ("net_dma:
> > acquire/release dma channels on ifup/ifdown") added unconditional call
> > of dmaengine_get() to net_dma.  The API should be called only if
> > NET_DMA was enabled.
> >
> > Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> 
> Acked-by: Dan Williams <dan.j.williams@intel.com>
> 
> I was looking to avoid ifdefs in this path by making
> dmaengine_{get,put} a nop in the DMAENGINE=n case.  However, the
> current code with DMAENGINE=y NET_DMA=n will pin channels even though
> the network stack is not using them.

I don't want to apply this patch at all.

What is the purpose of keeping the ugly ifdefs in dmaengine.h if we're
just going to pollute the networking code with the ifdefs anyways?

Make the NOP versions in linux/dmaengine.h actually work.

The NET_DMA stuff is the one thing which is polluting up the networking
stack with ugly ifdefs, I'm not adding new ones.

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

* Re: [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled
  2009-02-06 22:09   ` David Miller
@ 2009-02-06 22:52     ` Dan Williams
  2009-02-07  3:29       ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Williams @ 2009-02-06 22:52 UTC (permalink / raw)
  To: David Miller; +Cc: anemo, maciej.sosnowski, linux-kernel, netdev

On Fri, Feb 6, 2009 at 3:09 PM, David Miller <davem@davemloft.net> wrote:
> From: Dan Williams <dan.j.williams@intel.com>
> Date: Fri, 6 Feb 2009 14:15:02 -0700
>
>> [ please cc netdev on net_dma patches ]
>>
>> On Fri, Feb 6, 2009 at 9:02 AM, Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
>> > The commit 649274d993212e7c23c0cb734572c2311c200872 ("net_dma:
>> > acquire/release dma channels on ifup/ifdown") added unconditional call
>> > of dmaengine_get() to net_dma.  The API should be called only if
>> > NET_DMA was enabled.
>> >
>> > Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
>>
>> Acked-by: Dan Williams <dan.j.williams@intel.com>
>>
>> I was looking to avoid ifdefs in this path by making
>> dmaengine_{get,put} a nop in the DMAENGINE=n case.  However, the
>> current code with DMAENGINE=y NET_DMA=n will pin channels even though
>> the network stack is not using them.
>
> I don't want to apply this patch at all.
>
> What is the purpose of keeping the ugly ifdefs in dmaengine.h if we're
> just going to pollute the networking code with the ifdefs anyways?
>
> Make the NOP versions in linux/dmaengine.h actually work.
>
> The NET_DMA stuff is the one thing which is polluting up the networking
> stack with ugly ifdefs, I'm not adding new ones.

Yes, it has been on the todo list for a while, but I eventually want
the net case to look more like the raid case.  I.e. have one code path
that picks async versus sync at runtime, with the option to compile
out async support with header file ifdefs only.

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

* Re: [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled
  2009-02-06 22:52     ` Dan Williams
@ 2009-02-07  3:29       ` David Miller
  2009-02-07  5:55         ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-02-07  3:29 UTC (permalink / raw)
  To: dan.j.williams; +Cc: anemo, maciej.sosnowski, linux-kernel, netdev

From: Dan Williams <dan.j.williams@intel.com>
Date: Fri, 6 Feb 2009 15:52:35 -0700

> Yes, it has been on the todo list for a while, but I eventually want
> the net case to look more like the raid case.  I.e. have one code path
> that picks async versus sync at runtime, with the option to compile
> out async support with header file ifdefs only.

And how does any of that get us any closer to a fix right now
for this problem that doesn't require an ifdef?

Someone please work on this.

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

* Re: [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled
  2009-02-07  3:29       ` David Miller
@ 2009-02-07  5:55         ` David Miller
  2009-02-07  6:03           ` Dan Williams
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-02-07  5:55 UTC (permalink / raw)
  To: dan.j.williams; +Cc: anemo, maciej.sosnowski, linux-kernel, netdev

From: David Miller <davem@davemloft.net>
Date: Fri, 06 Feb 2009 19:29:10 -0800 (PST)

> From: Dan Williams <dan.j.williams@intel.com>
> Date: Fri, 6 Feb 2009 15:52:35 -0700
> 
> > Yes, it has been on the todo list for a while, but I eventually want
> > the net case to look more like the raid case.  I.e. have one code path
> > that picks async versus sync at runtime, with the option to compile
> > out async support with header file ifdefs only.
> 
> And how does any of that get us any closer to a fix right now
> for this problem that doesn't require an ifdef?
> 
> Someone please work on this.

I guess that'd end up being me....

How about something like this?

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 3e0f64c..3e68469 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -282,6 +282,18 @@ static inline void dmaengine_put(void)
 }
 #endif
 
+#ifdef CONFIG_NET_DMA
+#define net_dmaengine_get()	dmaengine_get()
+#define net_dmaengine_put()	dmaengine_put()
+#else
+static inline void net_dmaengine_get(void)
+{
+}
+static inline void net_dmaengine_put(void)
+{
+}
+#endif
+
 dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
 	void *dest, void *src, size_t len);
 dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
diff --git a/net/core/dev.c b/net/core/dev.c
index 5379b0c..a17e006 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1090,7 +1090,7 @@ int dev_open(struct net_device *dev)
 		/*
 		 *	Enable NET_DMA
 		 */
-		dmaengine_get();
+		net_dmaengine_get();
 
 		/*
 		 *	Initialize multicasting status
@@ -1172,7 +1172,7 @@ int dev_close(struct net_device *dev)
 	/*
 	 *	Shutdown NET_DMA
 	 */
-	dmaengine_put();
+	net_dmaengine_put();
 
 	return 0;
 }

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

* Re: [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled
  2009-02-07  5:55         ` David Miller
@ 2009-02-07  6:03           ` Dan Williams
  2009-02-07  6:05             ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Williams @ 2009-02-07  6:03 UTC (permalink / raw)
  To: David Miller; +Cc: anemo, Sosnowski, Maciej, linux-kernel, netdev

David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Fri, 06 Feb 2009 19:29:10 -0800 (PST)
> 
>> From: Dan Williams <dan.j.williams@intel.com>
>> Date: Fri, 6 Feb 2009 15:52:35 -0700
>>
>>> Yes, it has been on the todo list for a while, but I eventually want
>>> the net case to look more like the raid case.  I.e. have one code path
>>> that picks async versus sync at runtime, with the option to compile
>>> out async support with header file ifdefs only.
>> And how does any of that get us any closer to a fix right now
>> for this problem that doesn't require an ifdef?
>>
>> Someone please work on this.
> 
> I guess that'd end up being me....

Not necessarily, you did snap me back into reality with that comment.

> 
> How about something like this?

Looks good.

Thanks,
Dan


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

* Re: [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled
  2009-02-07  6:03           ` Dan Williams
@ 2009-02-07  6:05             ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2009-02-07  6:05 UTC (permalink / raw)
  To: dan.j.williams; +Cc: anemo, maciej.sosnowski, linux-kernel, netdev

From: Dan Williams <dan.j.williams@intel.com>
Date: Fri, 06 Feb 2009 23:03:11 -0700

> David Miller wrote:
> > From: David Miller <davem@davemloft.net>
> > Date: Fri, 06 Feb 2009 19:29:10 -0800 (PST)
> > 
> >> From: Dan Williams <dan.j.williams@intel.com>
> >> Date: Fri, 6 Feb 2009 15:52:35 -0700
> >>
> >>> Yes, it has been on the todo list for a while, but I eventually want
> >>> the net case to look more like the raid case.  I.e. have one code path
> >>> that picks async versus sync at runtime, with the option to compile
> >>> out async support with header file ifdefs only.
> >> And how does any of that get us any closer to a fix right now
> >> for this problem that doesn't require an ifdef?
> >>
> >> Someone please work on this.
> > I guess that'd end up being me....
> 
> Not necessarily, you did snap me back into reality with that comment.
> 
> > How about something like this?
> 
> Looks good.

Ok, I'll add this to net-2.6 then, thanks.

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

end of thread, other threads:[~2009-02-07  6:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-06 16:02 [PATCH] net_dma: call dmaengine_get only if NET_DMA enabled Atsushi Nemoto
2009-02-06 21:15 ` Dan Williams
2009-02-06 22:09   ` David Miller
2009-02-06 22:52     ` Dan Williams
2009-02-07  3:29       ` David Miller
2009-02-07  5:55         ` David Miller
2009-02-07  6:03           ` Dan Williams
2009-02-07  6:05             ` David Miller

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).