On 7/26/07, David Miller <[EMAIL PROTECTED]> wrote:
> From: Shannon Nelson <[EMAIL PROTECTED]>
> Date: Tue, 24 Jul 2007 17:36:06 -0700
>
> > (repost - original eaten by vger?)
> >
> > Al Viro pointed out that dma_memcpy_to_kernel_iovec() really was
> > unreachable and thus unused.  The code originally was there to support
> > in-kernel dma needs, but since it remains unused, we'll pull it out.
> >
> > Signed-off-by: Shannon Nelson <[EMAIL PROTECTED]>
>
> Applied, thanks Shannon.

NET_DMA on kernel buffer is pretty useful in ndb, iSCSI target and
initiators which uses kernel buffer to receive data. Are there any
other issues with dma-memcpy on kernel buffers, if not then following
patch makes dma_memcpy_to_kernel_iovec() reachable from tcp_recvmsg.
I tested this patch and it work fine with unh iSCSI target.


comments?

--pravin.

Index: linux-2.6.23-rc1/net/ipv4/tcp.c
===================================================================
--- linux-2.6.23-rc1.orig/net/ipv4/tcp.c        2007-07-23 02:11:00.000000000 
+0530
+++ linux-2.6.23-rc1/net/ipv4/tcp.c     2007-07-30 17:43:51.000000000 +0530
@@ -1115,7 +1115,7 @@
        int target;             /* Read at least this many bytes */
        long timeo;
        struct task_struct *user_recv = NULL;
-       int copied_early = 0;
+       int copied_early = 0, kernel_dma = 0;
        struct sk_buff *skb;

        lock_sock(sk);
@@ -1154,6 +1154,9 @@
                    !sysctl_tcp_low_latency &&
                    __get_cpu_var(softnet_data).net_dma) {
                        preempt_enable_no_resched();
+                       if (segment_eq(get_fs(), KERNEL_DS))
+                               kernel_dma = 1;
+                       else
                        tp->ucopy.pinned_list =
                                        dma_pin_iovec_pages(msg->msg_iov, len);
                } else {
@@ -1362,7 +1365,7 @@

                if (!(flags & MSG_TRUNC)) {
  #ifdef CONFIG_NET_DMA
-                       if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
+                       if (!tp->ucopy.dma_chan  && (kernel_dma || 
tp->ucopy.pinned_list))
                                tp->ucopy.dma_chan = get_softnet_dma();

                        if (tp->ucopy.dma_chan) {



> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to