From owner-cvs-src@FreeBSD.ORG Mon Dec 22 20:08:24 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 56A0516A4CE; Mon, 22 Dec 2003 20:08:24 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 44FD743D45; Mon, 22 Dec 2003 20:08:23 -0800 (PST) (envelope-from wpaul@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id hBN48N0B061507; Mon, 22 Dec 2003 20:08:23 -0800 (PST) (envelope-from wpaul@repoman.freebsd.org) Received: (from wpaul@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id hBN48NAS061506; Mon, 22 Dec 2003 20:08:23 -0800 (PST) (envelope-from wpaul) Message-Id: <200312230408.hBN48NAS061506@repoman.freebsd.org> From: Bill Paul Date: Mon, 22 Dec 2003 20:08:23 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/compat/ndis kern_ndis.c ntoskrnl_var.h subr_ndis.c src/sys/dev/if_ndis if_ndis.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2003 04:08:24 -0000 wpaul 2003/12/22 20:08:23 PST FreeBSD src repository Modified files: sys/compat/ndis kern_ndis.c ntoskrnl_var.h subr_ndis.c sys/dev/if_ndis if_ndis.c Log: Re-do the handling of ndis_buffers. The NDIS_BUFFER structure is supposed to be opaque to the driver, however it is exposed through several macros which expect certain behavior. In my original implementation, I used the mappedsystemva member of the structure to hold a pointer to the buffer and bytecount to hold the length. It turns out you must use the startva pointer to point to the page containing the start of the buffer and set byteoffset to the offset within the page where the buffer starts. So, for a buffer with address 'baseva,' startva is baseva & ~(PAGE_SIZE -1) and byteoffset is baseva & (PAGE_SIZE -1). We have to maintain this convention everywhere that ndis_buffers are used. Fortunately, Microsoft defines some macros for initializing and manipulating NDIS_BUFFER structures in ntddk.h. I adapted some of them for use here and used them where appropriate. This fixes the discrepancy I observed between how RX'ed packet sizes were being reported in the Broadcom wireless driver and the sample ethernet drivers that I've tested. This should also help the Intel Centrino wireless driver work. Also try to properly initialize the 802.11 BSS and IBSS channels. (Sadly, the channel value is meaningless since there's no way in the existing NDIS API to get/set the channel, but this should take care of any 'invalid channel (NULL)' messages printed on the console. Revision Changes Path 1.8 +5 -9 src/sys/compat/ndis/kern_ndis.c 1.4 +14 -0 src/sys/compat/ndis/ntoskrnl_var.h 1.11 +15 -9 src/sys/compat/ndis/subr_ndis.c 1.7 +11 -4 src/sys/dev/if_ndis/if_ndis.c