From: devnetfs <devnetfs@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: [RESEND-2: Pl. Help] questions regarding sending/receiving udp packets in kernel
Date: Sun, 6 Oct 2002 03:30:49 -0700 (PDT) [thread overview]
Message-ID: <20021006103049.7897.qmail@web13108.mail.yahoo.com> (raw)
Resending it again to the Gurus. Can somebody *please* help me with
these networking+kernel issues?
thanks once again,
Abhi.
Hello,
I am trying to write a kernel module, to send and receive udp packets.
I have the following questions/problems:
[1]
I wish to receive packets asynchronously (thru a callback), rather
than polling [i.e calling udp_recvmsg() periodically to check for
packtets].
To get this done, presently after creating a socket (sock_create), I
replace sk->data_ready with my own function, which when called (by the
kernel) wakes up a kernel thread that does skb_recv_datagram() to get a
udp sk_buff.
Is this the correct approach? or is there a better way to register a
callback with the core-networking subsystem, which will get called and
deliver the pkt, when a udp pkt arrives on an ip/port?
[2]
The memory allocted for the sk_buff (which i get thru
skb_recv_datagram() is charged to the socket (i created). But I wish to
use this sk_buff in my module (for processing etc.) so i dont call
kfree_skb for a long time (hence the rmem_alloc does not get
decremented). I tried to unlink the sk_buff from the socket list by
calling skb_unlink() but that does NOT decrease 'rmem_alloc'.
How do I cleanly (and truly) unlink a sk_buff from a socket list and
decrease equivalent memory charged to this socket? I would be calling
kfree_skb() later though which will eventually decrease rmem_alloc, but
I wish to do it as part of skb_unlink(). Please advice.
[3]
My kernel module sends/recvs UDP pkts process and store these packets
internally sk_buffs only. But udp_sendmsg() requires an iovec.
I can construct an iovec from an sk_buff and give it to udp_sendmsg()
but that will involve an additional COPYING from one kernel memory
space (sk_buff data buffer) to another new buffer (for iovec). I want
to avoid this xtra copying.
Am I missing something?
And if above approach does involve extra copying is there a way to
transmit a udp packet if one has the data in form of sk_buff (assuming
there is head space for ether+ip+udp header)?
Thanks in advance,
Regards,
Abhi.
I am not subscribed to this list. Please Cc: me the replies. -- thanks.
__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com
reply other threads:[~2002-10-06 10:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20021006103049.7897.qmail@web13108.mail.yahoo.com \
--to=devnetfs@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®