Mapping memory between kernel and user space
Hi all, How do I map some space between kernel and user space. Can anyone point me in to right direction. I was trying to map the packets from my netfilter function to kernel user space, to avoid over head of copying. Thanks in advance. -- Regards, Sri.
On Thu, Feb 10, 2011 at 06:45, Sri Ram Vemulpali <sri.ram.gmu06@gmail.com> wrote:
Hi all,
How do I map some space between kernel and user space. Can anyone point me in to right direction. I was trying to map the packets from my netfilter function to kernel user space, to avoid over head of copying. Thanks in advance.
Not trying to discourage you, but I assume your "filtering" function will be engaged many many times in the case of rapid traffic...thus, the buffer might grow rapidly too, right? In that case, are you sure direct mapping could cope with it? Well unless you're ready to loose some data ..... Anyway, I think you can do that by reserve the buffer in user space and the get_user_page() them. As the bridge, a unique device with ioctl() might do the job. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Hi Santosa, Can you please be more explicit. I do manage buffers internally in my module. Some cases if it full I will lose data. Can you please provide more detailed explanation on how to approach this. Thanks. --Sri On Wed, Feb 9, 2011 at 10:21 PM, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
On Thu, Feb 10, 2011 at 06:45, Sri Ram Vemulpali <sri.ram.gmu06@gmail.com> wrote:
Hi all,
How do I map some space between kernel and user space. Can anyone point me in to right direction. I was trying to map the packets from my netfilter function to kernel user space, to avoid over head of copying. Thanks in advance.
Not trying to discourage you, but I assume your "filtering" function will be engaged many many times in the case of rapid traffic...thus, the buffer might grow rapidly too, right? In that case, are you sure direct mapping could cope with it? Well unless you're ready to loose some data .....
Anyway, I think you can do that by reserve the buffer in user space and the get_user_page() them. As the bridge, a unique device with ioctl() might do the job.
-- regards,
Mulyadi Santosa Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
-- Regards, Sri.
Hi Sri, On Feb 10, 2011, at 11:56 AM, Sri Ram Vemulpali wrote:
Hi Santosa,
Can you please be more explicit. I do manage buffers internally in my module. Some cases if it full I will lose data. Can you please provide more detailed explanation on how to approach this. Thanks.
--Sri
On Wed, Feb 9, 2011 at 10:21 PM, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
On Thu, Feb 10, 2011 at 06:45, Sri Ram Vemulpali <sri.ram.gmu06@gmail.com> wrote:
Hi all,
How do I map some space between kernel and user space. Can anyone point me in to right direction. I was trying to map the packets from my netfilter function to kernel user space, to avoid over head of copying. Thanks in advance.
Isn't it possible if your driver supports mmap? Have you checked it out in Linux Kernel Drive chapter 15?
Not trying to discourage you, but I assume your "filtering" function will be engaged many many times in the case of rapid traffic...thus, the buffer might grow rapidly too, right? In that case, are you sure direct mapping could cope with it? Well unless you're ready to loose some data .....
Anyway, I think you can do that by reserve the buffer in user space and the get_user_page() them. As the bridge, a unique device with ioctl() might do the job.
-- regards,
Mulyadi Santosa Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
-- Regards, Sri.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Daniel.
Hi Sri, LKD chapter 15 is right resource for you. specifically you can look for remap_pfn_range function to map I/O memory to user space. Thanks, Rajat On Fri, Feb 11, 2011 at 6:12 PM, YOUNGWHAN SONG <breadncup@gmail.com> wrote:
Hi Sri,
On Feb 10, 2011, at 11:56 AM, Sri Ram Vemulpali wrote:
Hi Santosa,
Can you please be more explicit. I do manage buffers internally in my module. Some cases if it full I will lose data. Can you please provide more detailed explanation on how to approach this. Thanks.
--Sri
On Wed, Feb 9, 2011 at 10:21 PM, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
On Thu, Feb 10, 2011 at 06:45, Sri Ram Vemulpali <sri.ram.gmu06@gmail.com> wrote:
Hi all,
How do I map some space between kernel and user space. Can anyone point me in to right direction. I was trying to map the packets from my netfilter function to kernel user space, to avoid over head of copying. Thanks in advance.
Isn't it possible if your driver supports mmap? Have you checked it out in Linux Kernel Drive chapter 15?
Not trying to discourage you, but I assume your "filtering" function will be engaged many many times in the case of rapid traffic...thus, the buffer might grow rapidly too, right? In that case, are you sure direct mapping could cope with it? Well unless you're ready to loose some data .....
Anyway, I think you can do that by reserve the buffer in user space and the get_user_page() them. As the bridge, a unique device with ioctl() might do the job.
-- regards,
Mulyadi Santosa Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
-- Regards, Sri.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Daniel.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
participants (4)
-
Mulyadi Santosa -
Rajat Sharma -
Sri Ram Vemulpali -
YOUNGWHAN SONG