From: Melkor Ainur <melkorainur@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: csum_and_copy_from_user, tcp_sendmsg and zero-copy question
Date: Wed, 10 Apr 2002 19:17:05 -0700 (PDT) [thread overview]
Message-ID: <20020411021705.62404.qmail@web21204.mail.yahoo.com> (raw)
Hello all,
I have been writing a driver for a SAN device. This
device supports packetization (including header gen,
checksums, etc) of data buffers. Ideally, in order to
minimize host cpu utilization, the driver could just
convert the caller's scatter-gather list into a bus
address scatter-gather list and pass that to the hw.
I believe that from this perspective, the ideal code
for the driver's tcp_sendmsg looks like:
tcp_sendmsg(sk,...)
{
housekeeping();
if (isUserSpace(iov)) {
bussglist = convert_useg_iov_to_bus_sglist(iov);
supply_sglist_to_hw(sk,bussglist);
} else {
convert_kseg_iov_to_bus_sglist(iov);
supply_sglist_to_hw(sk,bussglist);
}
if (blocking) wait_for_tcp_send_dma_done(sk);
housekeeping();
}
The convert_useg_iov_to_bus_sglist would be something
that would make sure the application's user space
buffers are paged into physical memory (handling
physical memory pressure by sleeping), convert each
entry in the application's scatter gather list into
bus address/lengths.
I don't have enough experience or knowledge to know
whether a convert_useg_iov_to_bus_sglist type scheme
is a good thing. I understand that there are security
issues that doing DMA to/from user space buffers
introduces. And system stablity issues as well due to
allowing applications to increase physical memory
pressure directly. I see that zero-copy for TCP (of
the nature I described) has already been discussed
on lkml. However, I couldn't see a clear consensus
on a conclusion. I apologize if this is an inaccurate
interpretation on my behalf.
I think that a subset of zero-copy TCP has been
implemented in the linux kernel as of the 2.4.4
kernel (David Miller's patch). I say subset because
examining the tcp_sendmsg code, I see tcp_copy_to_page
which calls csum_and_copy_from_user which does a copy
from user. Is my interpretation correct that the
tcp_sendmsg codepath does zerocopy (for eth drivers
that support the appropriate dev->feature) but does
a single copy from user of the data buffer?
If this is so, I would greatly appreciate advice/
opinions /etc on what steps I could take to achieve
the full zero-copy goal (if it's the right goal to
have).
Thanks,
Melkor
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
next reply other threads:[~2002-04-11 2:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-11 2:17 Melkor Ainur [this message]
2002-04-11 4:33 Nivedita Singhvi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020411021705.62404.qmail@web21204.mail.yahoo.com \
--to=melkorainur@yahoo.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®