From owner-freebsd-net@FreeBSD.ORG Fri Aug 31 05:28:57 2007 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5025A16A418 for ; Fri, 31 Aug 2007 05:28:57 +0000 (UTC) (envelope-from praharshah123@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.178]) by mx1.freebsd.org (Postfix) with ESMTP id D8EE513C458 for ; Fri, 31 Aug 2007 05:28:56 +0000 (UTC) (envelope-from praharshah123@gmail.com) Received: by wa-out-1112.google.com with SMTP id k17so855868waf for ; Thu, 30 Aug 2007 22:28:12 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=lWcZRkxn7fhqFZIvliy6TXVdKfk5B9boq8LafxJcTosNCFeLgxL+ceSYsHaEE0vvoWHVyFpiSzaaolkAXj4v1oX+9MvQ8m6ON1Pj6df2XeYZR7bik+1Kq/3vGx8qhRtb7OHJYDoSoDpEhIqewdwe6ty1stHyHbf/rdRfcvv60cM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=fCU1iSJgF6OTXbtUhZu0babj5rijcTqQXasDFywPEPSgPFgOipNO+M30n4jmHCyodwPbw81SmfmSmBhvcH+YkP1SR0+XDC3qhPjoxRC7BmAhRUfss3gNIXvs1VMgwvKaVtLAwC0o85VJISJpQArc1cFEaDdG3m9DBJUBsvZnIQI= Received: by 10.114.179.1 with SMTP id b1mr76043waf.1188536428352; Thu, 30 Aug 2007 22:00:28 -0700 (PDT) Received: by 10.114.36.9 with HTTP; Thu, 30 Aug 2007 22:00:28 -0700 (PDT) Message-ID: Date: Fri, 31 Aug 2007 10:30:28 +0530 From: "Prahar Shah" To: freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Accessing device memory from user-land application process X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2007 05:28:57 -0000 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