Accessing device memory from user-land application process
praharshah123 at gmail.com
Thu Aug 30 22:28:57 PDT 2007
I am writing a device driver in user-land process. I do a contigmalloc() to
allocate the descriptor memory, do a vtophys() on it and mmap that memory in
the user-land application process. I allocate buffers again using
contigmalloc(), and mmap it within the same process. I pass on a buffer each
to the device descriptor. And my packet reception works fine.
While processing packets, once i reset the device (all device registers and
related memory), and repopulate buffers into the descriptors, I
occasionally find that while receiving a packet after reset, the buffer
address that I read from the first descriptor is not the one that I gave to
the descriptor after the reset. Instead, it turns out to be an older buffer
address which as allocated to a descriptor which was supposed to be read
next, prior to the reset.
My doubt is, could this be a cache-coherency issue? Or could there be a
chance that the device might be caching the buffer address available with
the descriptors, and re-writing back to the descriptor after receiving the
packet, and somehow these cached address are not flushed during a device
If i've missed any details, kindly let me know.
Any help would be greatly appriciated
More information about the freebsd-net