Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Aug 2007 10:30:28 +0530
From:      "Prahar Shah" <praharshah123@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   Accessing device memory from user-land application process
Message-ID:  <ebd4dd8d0708302200i77e71fbaxc773da1a0642535b@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi.
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
reset?

If i've missed any details, kindly let me know.
Any help would be greatly appriciated

-- 
Prahar Shah



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ebd4dd8d0708302200i77e71fbaxc773da1a0642535b>