[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to send data directly out network interface from driver?
On Fri, Jan 30, 2009 at 10:23 PM, Greg KH <greg@xxxxxxxxx> wrote:
> On Fri, Jan 30, 2009 at 02:55:01PM -0500, Bob Beers wrote:
>> I have a voip device where I currently send my data up/down between driver
>> and user space using an interrupt driven read/write scheme. I send/recv
>> the data using standard UDP packets in userspace. I'd like to try to decrease
>> my end-to-end latency by letting the driver send/recv most of this
>> data directly
>> to the network.
>>
>> Are there drivers which already do this kind of thing that I might learn from?
>
> You can access the socket interface directly within the kernel, look for
> that, and any callers of this code, there should be a few users for you
> to get an idea of how to use it.
I've been following the example
<http://kernelnewbies.org/Simple_UDP_Server>,
and I am having some success -- only tried receiving so far --
but I am getting an error when I try to insert the following
between the sock_create and bind calls.
-----------8<------------------
{
int arg = 1;
err = kthread->sock->ops->setsockopt(kthread->sock, SOL_SOCKET,
SO_REUSEADDR,
(void *)&arg, sizeof(arg));
if (err) {
printk(KERN_INFO, "kthread[%d] setsockopt REUSEADDR error: %d\n",
kthread->voipch, err);
}
}
-----------8<------------------
Here is the error message:
ksocket_start: kthread[0] setsockopt REUSEADDR error: -92
The packets are recv'd, but why can't I use SO_REUSEADDR ???
Thanks,
-Bob
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ