From owner-svn-src-projects@FreeBSD.ORG Sun Feb 15 06:37:35 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44A6A106566B; Sun, 15 Feb 2009 06:37:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 335318FC0A; Sun, 15 Feb 2009 06:37:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1F6bZNG043004; Sun, 15 Feb 2009 06:37:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1F6bZDT043003; Sun, 15 Feb 2009 06:37:35 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200902150637.n1F6bZDT043003@svn.freebsd.org> From: Kip Macy Date: Sun, 15 Feb 2009 06:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188638 - projects/releng_7_xen/sys/i386/xen X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Feb 2009 06:37:35 -0000 Author: kmacy Date: Sun Feb 15 06:37:34 2009 New Revision: 188638 URL: http://svn.freebsd.org/changeset/base/188638 Log: IFC 188637 - timer fixes Modified: projects/releng_7_xen/sys/i386/xen/clock.c Modified: projects/releng_7_xen/sys/i386/xen/clock.c ============================================================================== --- projects/releng_7_xen/sys/i386/xen/clock.c Sun Feb 15 06:36:02 2009 (r188637) +++ projects/releng_7_xen/sys/i386/xen/clock.c Sun Feb 15 06:37:34 2009 (r188638) @@ -125,7 +125,6 @@ int wall_cmos_clock; u_int timer_freq = TIMER_FREQ; static int independent_wallclock; static int xen_disable_rtc_set; -static u_long cached_gtm; /* cached quotient for TSC -> microseconds */ static u_long cyc2ns_scale; static struct timespec shadow_tv; static uint32_t shadow_tv_version; /* XXX: lazy locking */ @@ -205,8 +204,8 @@ scale_delta(uint64_t delta, uint32_t mul "mov %4,%%eax ; " "mov %%edx,%4 ; " "mul %5 ; " - "add %4,%%eax ; " "xor %5,%5 ; " + "add %4,%%eax ; " "adc %5,%%edx ; " : "=A" (product), "=r" (tmp1), "=r" (tmp2) : "a" ((uint32_t)delta), "1" ((uint32_t)(delta >> 32)), "2" (mul_frac) ); @@ -214,7 +213,8 @@ scale_delta(uint64_t delta, uint32_t mul return product; } -static uint64_t get_nsec_offset(struct shadow_time_info *shadow) +static uint64_t +get_nsec_offset(struct shadow_time_info *shadow) { uint64_t now, delta; rdtscll(now); @@ -507,13 +507,6 @@ startrtclock() /* (10^6 * 2^32) / cpu_hz = (10^3 * 2^32) / cpu_khz = (2^32 * 1 / (clocks/us)) */ - { - unsigned long eax=0, edx=1000; - __asm__("divl %2" - :"=a" (cached_gtm), "=d" (edx) - :"r" (cpu_khz), - "0" (eax), "1" (edx)); - } set_cyc2ns_scale(cpu_khz/1000); tsc_freq = cpu_khz * 1000; @@ -761,9 +754,9 @@ cpu_initclocks(void) { unsigned int time_irq; int error; - - xen_set_periodic_tick.period_ns = NS_PER_TICK; + xen_set_periodic_tick.period_ns = NS_PER_TICK; + HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, 0, &xen_set_periodic_tick); @@ -772,8 +765,6 @@ cpu_initclocks(void) INTR_TYPE_CLK | INTR_FAST, &time_irq); if (error) panic("failed to register clock interrupt\n"); - - /* should fast clock be enabled ? */ } @@ -840,63 +831,29 @@ get_system_time(int ticks) * Track behavior of cur_timer->get_offset() functionality in timer_tsc.c */ -#if 0 -static uint32_t -xen_get_offset(void) -{ - register unsigned long eax, edx; - - /* Read the Time Stamp Counter */ - - rdtsc(eax,edx); - - /* .. relative to previous jiffy (32 bits is enough) */ - eax -= shadow_tsc_stamp; - - /* - * Time offset = (tsc_low delta) * cached_gtm - * = (tsc_low delta) * (usecs_per_clock) - * = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy) - * - * Using a mull instead of a divl saves up to 31 clock cycles - * in the critical path. - */ - - __asm__("mull %2" - :"=a" (eax), "=d" (edx) - :"rm" (cached_gtm), - "0" (eax)); - - /* our adjusted time offset in microseconds */ - return edx; -} -#endif /* Convert jiffies to system time. */ static uint64_t -ticks_to_system_time(unsigned long newticks) +ticks_to_system_time(int newticks) { -#if 0 - unsigned long seq; -#endif - long delta; - uint64_t st; - + int delta; + uint64_t st; - delta = newticks - ticks; - if (delta < 1) { - /* Triggers in some wrap-around cases, but that's okay: - * we just end up with a shorter timeout. */ - st = processed_system_time + NS_PER_TICK; - } else if (((unsigned long)delta >> (BITS_PER_LONG-3)) != 0) { - /* Very long timeout means there is no pending timer. - * We indicate this to Xen by passing zero timeout. */ - st = 0; - } else { - st = processed_system_time + delta * (uint64_t)NS_PER_TICK; - } + delta = newticks - ticks; + if (delta < 1) { + /* Triggers in some wrap-around cases, + * but that's okay: + * we just end up with a shorter timeout. */ + st = processed_system_time + NS_PER_TICK; + } else if (((unsigned int)delta >> (BITS_PER_LONG-3)) != 0) { + /* Very long timeout means there is no pending timer. + * We indicate this to Xen by passing zero timeout. */ + st = 0; + } else { + st = processed_system_time + delta * (uint64_t)NS_PER_TICK; + } - return (st); + return (st); } void @@ -904,7 +861,7 @@ idle_block(void) { uint64_t timeout; - timeout = ticks_to_system_time(ticks + 1) + NS_PER_TICK/2; + timeout = ticks_to_system_time(ticks + 1) + NS_PER_TICK/2; __get_time_values_from_xen(); PANIC_IF(HYPERVISOR_set_timer_op(timeout) != 0); From owner-svn-src-projects@FreeBSD.ORG Sun Feb 15 21:51:32 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A8CD1065672; Sun, 15 Feb 2009 21:51:32 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 709F58FC1D; Sun, 15 Feb 2009 21:51:32 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1FLpWbG000459; Sun, 15 Feb 2009 21:51:32 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1FLpW2T000457; Sun, 15 Feb 2009 21:51:32 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200902152151.n1FLpW2T000457@svn.freebsd.org> From: Ulf Lilleengen Date: Sun, 15 Feb 2009 21:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188657 - projects/csup_wip/contrib/csup X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Feb 2009 21:51:33 -0000 Author: lulf Date: Sun Feb 15 21:51:32 2009 New Revision: 188657 URL: http://svn.freebsd.org/changeset/base/188657 Log: MFH r188644: - Do not free the pattern lists immediately after use, as they might be needed again in case the connection is interrupted and csup have to reconnect. The lists will be freed after the collection has been completely processed. MFH r188405: - Fix an issue where file attributes were not installed correctly during a Touch and SetAttrs operation. - SetAttrs and Touch were incorrectly switched. Modified: projects/csup_wip/contrib/csup/ (props changed) projects/csup_wip/contrib/csup/proto.c projects/csup_wip/contrib/csup/updater.c Modified: projects/csup_wip/contrib/csup/proto.c ============================================================================== --- projects/csup_wip/contrib/csup/proto.c Sun Feb 15 21:17:21 2009 (r188656) +++ projects/csup_wip/contrib/csup/proto.c Sun Feb 15 21:51:32 2009 (r188657) @@ -521,12 +521,6 @@ proto_xchgcoll(struct config *config) coll->co_filefilter = globtree_and(fileaccept, globtree_not(filerefuse)); - /* At this point we don't need the pattern lists anymore. */ - pattlist_free(coll->co_accepts); - pattlist_free(coll->co_refusals); - coll->co_accepts = NULL; - coll->co_refusals = NULL; - /* Set up a mask of file attributes that we don't want to sync with the server. */ if (!(coll->co_options & CO_SETOWNER)) Modified: projects/csup_wip/contrib/csup/updater.c ============================================================================== --- projects/csup_wip/contrib/csup/updater.c Sun Feb 15 21:17:21 2009 (r188656) +++ projects/csup_wip/contrib/csup/updater.c Sun Feb 15 21:51:32 2009 (r188657) @@ -1656,10 +1656,12 @@ updater_rcsedit(struct updater *up, stru if (rf == NULL) { fattr_maskout(oldfattr, ~FA_MODTIME); - if (fattr_equal(oldfattr, sr->sr_serverattr) == 0) + if (fattr_equal(oldfattr, sr->sr_serverattr)) lprintf(1, " SetAttrs %s", fup->coname); else lprintf(1, " Touch %s", fup->coname); + /* Install new attributes. */ + fattr_install(sr->sr_serverattr, fup->destpath, NULL); if (fup->attic) lprintf(1, " -> Attic"); lprintf(1, "\n"); From owner-svn-src-projects@FreeBSD.ORG Wed Feb 18 19:02:52 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11F3A1065676; Wed, 18 Feb 2009 19:02:52 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F307A8FC1E; Wed, 18 Feb 2009 19:02:51 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1IJ2pPB072177; Wed, 18 Feb 2009 19:02:51 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1IJ2ppm072175; Wed, 18 Feb 2009 19:02:51 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <200902181902.n1IJ2ppm072175@svn.freebsd.org> From: Peter Holm Date: Wed, 18 Feb 2009 19:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188758 - projects/stress2/misc X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2009 19:02:52 -0000 Author: pho Date: Wed Feb 18 19:02:51 2009 New Revision: 188758 URL: http://svn.freebsd.org/changeset/base/188758 Log: Test scenarios for the mmap and other process address space manipulation functions. Approved by: kib Added: projects/stress2/misc/mmap2.sh (contents, props changed) projects/stress2/misc/mmap3.sh (contents, props changed) Added: projects/stress2/misc/mmap2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/stress2/misc/mmap2.sh Wed Feb 18 19:02:51 2009 (r188758) @@ -0,0 +1,176 @@ +#!/bin/sh + +# +# Copyright (c) 2009 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# Stress mmap by having at most 100 threads mapping random areas within +# a 100 Mb range. + +# Test scenario by kib@ + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > mmap2.c +cc -o mmap2 -Wall mmap2.c -lpthread +rm -f mmap2.c + +for i in `jot 10`; do + ./mmap2 +done +rm -f ./mmap2 +exit + +EOF +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define THREADS 100 +#define STARTADDR 0x50000000U +#define ADRSPACE 0x06400000U /* 100 Mb */ + +static void +work(int nr) +{ + int fd, m; + void *p; + size_t left, len; + char path[128]; + + p = (void *)STARTADDR + trunc_page(arc4random() % ADRSPACE); + left = ADRSPACE - (size_t)p + STARTADDR; + len = trunc_page(arc4random() % left) + PAGE_SIZE; + fd = -1; + + if (arc4random() % 100 < 90) + sprintf(path, "/tmp/mmap.%06d.%04d", getpid(), nr); + else + sprintf(path, "/dev/zero"); + if (arc4random() % 2 == 0) { + if ((fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0622)) == -1) + err(1,"open()"); + if (ftruncate(fd, len) == -1) + err(1, "ftruncate"); + if (arc4random() % 2 == 0) { + if ((p = mmap(p, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == + MAP_FAILED) { + if (errno == ENOMEM) + return; + err(1, "mmap()"); + } + } else { + if ((p = mmap(p, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)) == + MAP_FAILED) { + if (errno == ENOMEM) + return; + err(1, "mmap()"); + } + } + if (fd > 0 && strcmp(path, "/dev/zero")) + if (unlink(path) == -1) + err(1, "unlink(%s)", path); + } else { + if ((p = mmap(p, len, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0)) == MAP_FAILED) { + if (errno == ENOMEM) + return; + err(1, "mmap()"); + } + strcpy(path, "anon"); + } +#if 0 + printf("nr = %d, %-14s, start = %p, end = %p, len = 0x%08x, (%5d pages)\n", + nr, path, p, p + len, len, len>>PAGE_SHIFT); +#endif + + *(int *)p = 1; + + if (arc4random() % 2 == 0) { + m = arc4random() % 10; + if (madvise(p, len, m) == -1) + warn("madvise(%p, %d, %d)", p, len, m); + } + if (arc4random() %2 == 0) + if (mprotect(p, trunc_page(arc4random() % len), PROT_READ) == -1 ) + err(1, "mprotect failed with error:"); + if (arc4random() % 2 == 0) { + if (arc4random() %2 == 0) { + if (msync(p, 0, MS_SYNC) == -1) + err(1, "msync(%p)", p); + } else { + if (msync(p, 0, MS_INVALIDATE) == -1) + err(1, "msync(%p)", p); + } + } + if (munmap(p, len) == -1) + err(1, "munmap(%p)", p); + close(fd); +} + +void * +thr(void *arg) +{ + int i; + + for (i = 0; i < 512; i++) { + work(*(int *)arg); + } + return (0); +} + +int +main(int argc, char **argv) +{ + pthread_t threads[THREADS]; + int nr[THREADS]; + int i, n, r; + +// printf("Address start 0x%x, address end 0x%x, pages %d\n", +// STARTADDR, STARTADDR + ADRSPACE, ADRSPACE>>PAGE_SHIFT); + n = arc4random() % THREADS + 1; + for (i = 0; i < n; i++) { + nr[i] = i; + if ((r = pthread_create(&threads[i], NULL, thr, (void *)&nr[i])) != 0) + err(1, "pthread_create(): %s\n", strerror(r)); + } + + for (i = 0; i < n; i++) { + if (pthread_join(threads[i], NULL) != 0) + err(1, "pthread_join(%d)", i); + } + + return (0); +} Added: projects/stress2/misc/mmap3.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/stress2/misc/mmap3.sh Wed Feb 18 19:02:51 2009 (r188758) @@ -0,0 +1,159 @@ +#!/bin/sh + +# +# Copyright (c) 2009 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# Variation of mmap2.sh with focus on random arguments for mprotect() + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > mmap3.c +cc -o mmap3 -Wall mmap3.c -lpthread +rm -f mmap3.c + +for i in `jot 20`; do + ./mmap3 +done +for i in `jot 100`; do + ./mmap3 random +done +rm -f mmap3 mmap3.core /tmp/mmap.0* +exit + +EOF +/* + Stress mmap by having max 18 threads mapping random areas within + a 100 Mb range. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define THREADS 100 +#define STARTADDR 0x50000000U +#define ADRSPACE 0x06400000U /* 100 Mb */ + +static int +ra; + +void +trash(void *p) +{ + mprotect(p, 0x570e3d38, 0x2c8fd54f); + + if (ra) { + madvise((void *)arc4random(), arc4random(), arc4random()); + mprotect((void *)arc4random(), arc4random(), arc4random()); + msync((void *)arc4random(), arc4random(), arc4random()); + } + +} + +void +work(int nr) +{ + int fd, m; + void *p; + size_t len; + char path[128]; + + p = (void *)STARTADDR; + len = ADRSPACE; + + sprintf(path, "/tmp/mmap.%06d.%04d", getpid(), nr); + if ((fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0622)) == -1) + err(1,"open()"); + if (ftruncate(fd, len) == -1) + err(1, "ftruncate"); + if ((p = mmap(p, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == + MAP_FAILED) { + if (errno == ENOMEM) + return; + err(1, "mmap()"); + } + if (unlink(path) == -1) + err(1, "unlink(%s)", path); + + trash(p); + + m = arc4random() % 10; + if (madvise(p, len, m) == -1) + warn("madvise(%p, %d, %d)", p, len, m); + if (mprotect(p, trunc_page(arc4random() % len), PROT_READ) == -1 ) + err(1, "mprotect failed with error:"); + if (msync(p, 0, MS_SYNC) == -1) + err(1, "msync(%p)", p); + if (munmap(p, len) == -1) + err(1, "munmap(%p)", p); + close(fd); +} + +void * +thr(void *arg) +{ + int i; + + for (i = 0; i < 512; i++) { + work(*(int *)arg); + } + return (0); +} + +int +main(int argc, char **argv) +{ + pthread_t threads[THREADS]; + int nr[THREADS]; + int i, n, r; + + n = arc4random() % 14 + 5; + ra = argc != 1; +// printf("Address start 0x%x, address end 0x%x, pages %d, n %d\n", +// STARTADDR, STARTADDR + ADRSPACE, ADRSPACE>>PAGE_SHIFT, n); + for (i = 0; i < n; i++) { + nr[i] = i; + if ((r = pthread_create(&threads[i], NULL, thr, (void *)&nr[i])) != 0) + err(1, "pthread_create(): %s\n", strerror(r)); + } + + for (i = 0; i < n; i++) { + if (pthread_join(threads[i], NULL) != 0) + err(1, "pthread_join(%d)", i); + } + + return (0); +} From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:40:10 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93615106566B; Thu, 19 Feb 2009 05:40:10 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 826A38FC20; Thu, 19 Feb 2009 05:40:10 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5eAqk085813; Thu, 19 Feb 2009 05:40:10 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5eAs1085812; Thu, 19 Feb 2009 05:40:10 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190540.n1J5eAs1085812@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188786 - projects/vap7/etc/defaults X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:40:11 -0000 Author: sam Date: Thu Feb 19 05:40:10 2009 New Revision: 188786 URL: http://svn.freebsd.org/changeset/base/188786 Log: fix comment Modified: projects/vap7/etc/defaults/rc.conf Modified: projects/vap7/etc/defaults/rc.conf ============================================================================== --- projects/vap7/etc/defaults/rc.conf Thu Feb 19 05:36:07 2009 (r188785) +++ projects/vap7/etc/defaults/rc.conf Thu Feb 19 05:40:10 2009 (r188786) @@ -192,7 +192,7 @@ ifconfig_lo0="inet 127.0.0.1" # default #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry. #ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry. #ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0. -#vaps_ath0="wlan0" # VAP interfaces for ath0 device +#wlans_ath0="wlan0" # VAP interfaces for ath0 device #ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. # #autobridge_interfaces="bridge0" # List of bridges to check From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:44:25 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77B7F106566B; Thu, 19 Feb 2009 05:44:25 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6468E8FC15; Thu, 19 Feb 2009 05:44:25 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5iP9M085946; Thu, 19 Feb 2009 05:44:25 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5iPCD085945; Thu, 19 Feb 2009 05:44:25 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190544.n1J5iPCD085945@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188787 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:44:25 -0000 Author: sam Date: Thu Feb 19 05:44:25 2009 New Revision: 188787 URL: http://svn.freebsd.org/changeset/base/188787 Log: merge r188770: whitespace Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ah.h projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ah.h ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ah.h Thu Feb 19 05:40:10 2009 (r188786) +++ projects/vap7/sys/dev/ath/ath_hal/ah.h Thu Feb 19 05:44:25 2009 (r188787) @@ -409,8 +409,8 @@ typedef struct { int rateCount; /* NB: for proper padding */ uint8_t rateCodeToIndex[144]; /* back mapping */ struct { - uint8_t valid; /* valid for rate control use */ - uint8_t phy; /* CCK/OFDM/XR */ + uint8_t valid; /* valid for rate control use */ + uint8_t phy; /* CCK/OFDM/XR */ uint32_t rateKbps; /* transfer rate in kbs */ uint8_t rateCode; /* rate for h/w descriptors */ uint8_t shortPreamble; /* mask for enabling short From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:45:06 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BFB41065674; Thu, 19 Feb 2009 05:45:06 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC95B8FC20; Thu, 19 Feb 2009 05:45:05 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5j5hb086014; Thu, 19 Feb 2009 05:45:05 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5j5UI086012; Thu, 19 Feb 2009 05:45:05 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190545.n1J5j5UI086012@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188788 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:45:06 -0000 Author: sam Date: Thu Feb 19 05:45:05 2009 New Revision: 188788 URL: http://svn.freebsd.org/changeset/base/188788 Log: merge r188771: add HAL_DIAG_SETREGS to write registers via the diag api Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ah.c projects/vap7/sys/dev/ath/ath_hal/ah_internal.h projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ah.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ah.c Thu Feb 19 05:44:25 2009 (r188787) +++ projects/vap7/sys/dev/ath/ath_hal/ah.c Thu Feb 19 05:45:05 2009 (r188788) @@ -539,6 +539,15 @@ ath_hal_getregdump(struct ath_hal *ah, c } return (char *) dp - (char *) dstbuf; } + +static void +ath_hal_setregs(struct ath_hal *ah, const HAL_REGWRITE *regs, int space) +{ + while (space >= sizeof(HAL_REGWRITE)) { + OS_REG_WRITE(ah, regs->addr, regs->value); + regs++, space -= sizeof(HAL_REGWRITE); + } +} HAL_BOOL ath_hal_getdiagstate(struct ath_hal *ah, int request, @@ -553,6 +562,10 @@ ath_hal_getdiagstate(struct ath_hal *ah, case HAL_DIAG_REGS: *resultsize = ath_hal_getregdump(ah, args, *result,*resultsize); return AH_TRUE; + case HAL_DIAG_SETREGS: + ath_hal_setregs(ah, args, argsize); + *resultsize = 0; + return AH_TRUE; case HAL_DIAG_FATALERR: *result = &AH_PRIVATE(ah)->ah_fatalState[0]; *resultsize = sizeof(AH_PRIVATE(ah)->ah_fatalState); Modified: projects/vap7/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ah_internal.h Thu Feb 19 05:44:25 2009 (r188787) +++ projects/vap7/sys/dev/ath/ath_hal/ah_internal.h Thu Feb 19 05:45:05 2009 (r188788) @@ -49,6 +49,11 @@ typedef struct { uint16_t end; /* ending register or zero */ } HAL_REGRANGE; +typedef struct { + uint32_t addr; /* regiser address/offset */ + uint32_t value; /* value to write */ +} HAL_REGWRITE; + /* * Transmit power scale factor. * @@ -609,16 +614,14 @@ enum { HAL_DIAG_RESETKEY = 16, /* Reset keycache backdoor */ HAL_DIAG_EEREAD = 17, /* Read EEPROM word */ HAL_DIAG_EEWRITE = 18, /* Write EEPROM word */ - /* 19 was HAL_DIAG_TXCONT, 20-23 were for radar */ - HAL_DIAG_REGREAD = 24, /* Reg reads */ - HAL_DIAG_REGWRITE = 25, /* Reg writes */ - HAL_DIAG_GET_REGBASE = 26, /* Get register base */ + /* 19-26 removed, do not reuse */ HAL_DIAG_RDWRITE = 27, /* Write regulatory domain */ HAL_DIAG_RDREAD = 28, /* Get regulatory domain */ HAL_DIAG_FATALERR = 29, /* Read cached interrupt state */ HAL_DIAG_11NCOMPAT = 30, /* 11n compatibility tweaks */ HAL_DIAG_ANI_PARAMS = 31, /* ANI noise immunity parameters */ HAL_DIAG_CHECK_HANGS = 32, /* check h/w hangs */ + HAL_DIAG_SETREGS = 33, /* write registers */ }; enum { From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:45:41 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 978751065670; Thu, 19 Feb 2009 05:45:41 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 845508FC27; Thu, 19 Feb 2009 05:45:41 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5jfrl086071; Thu, 19 Feb 2009 05:45:41 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5jfPL086070; Thu, 19 Feb 2009 05:45:41 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190545.n1J5jfPL086070@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188789 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:45:41 -0000 Author: sam Date: Thu Feb 19 05:45:41 2009 New Revision: 188789 URL: http://svn.freebsd.org/changeset/base/188789 Log: merge r188772: add phy types for 1/2 and 1/4-rate modes Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/_ieee80211.h Modified: projects/vap7/sys/net80211/_ieee80211.h ============================================================================== --- projects/vap7/sys/net80211/_ieee80211.h Thu Feb 19 05:45:05 2009 (r188788) +++ projects/vap7/sys/net80211/_ieee80211.h Thu Feb 19 05:45:41 2009 (r188789) @@ -43,6 +43,8 @@ enum ieee80211_phytype { IEEE80211_T_OFDM, /* frequency division multiplexing */ IEEE80211_T_TURBO, /* high rate OFDM, aka turbo mode */ IEEE80211_T_HT, /* high throughput */ + IEEE80211_T_OFDM_HALF, /* 1/2 rate OFDM */ + IEEE80211_T_OFDM_QUARTER, /* 1/4 rate OFDM */ }; #define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclature */ From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:46:32 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1C79106566B; Thu, 19 Feb 2009 05:46:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4B968FC08; Thu, 19 Feb 2009 05:46:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5kWuu086142; Thu, 19 Feb 2009 05:46:32 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5kW1V086139; Thu, 19 Feb 2009 05:46:32 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190546.n1J5kW1V086139@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188790 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:46:33 -0000 Author: sam Date: Thu Feb 19 05:46:32 2009 New Revision: 188790 URL: http://svn.freebsd.org/changeset/base/188790 Log: merge r188773: cleanup ath_hal_computetxtime's handling of 1/2 and 1/4-width channels Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ah.c projects/vap7/sys/dev/ath/ath_hal/ah_internal.h projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_phy.c projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ah.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ah.c Thu Feb 19 05:45:41 2009 (r188789) +++ projects/vap7/sys/dev/ath/ath_hal/ah.c Thu Feb 19 05:46:32 2009 (r188790) @@ -166,11 +166,7 @@ ath_hal_computetxtime(struct ath_hal *ah if (kbps == 0) return 0; switch (rates->info[rateix].phy) { - case IEEE80211_T_CCK: -#define CCK_SIFS_TIME 10 -#define CCK_PREAMBLE_BITS 144 -#define CCK_PLCP_BITS 48 phyTime = CCK_PREAMBLE_BITS + CCK_PLCP_BITS; if (shortPreamble && rates->info[rateix].shortPreamble) phyTime >>= 1; @@ -178,81 +174,47 @@ ath_hal_computetxtime(struct ath_hal *ah txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000)/kbps); break; -#undef CCK_SIFS_TIME -#undef CCK_PREAMBLE_BITS -#undef CCK_PLCP_BITS - case IEEE80211_T_OFDM: -#define OFDM_SIFS_TIME 16 -#define OFDM_PREAMBLE_TIME 20 -#define OFDM_PLCP_BITS 22 -#define OFDM_SYMBOL_TIME 4 - -#define OFDM_SIFS_TIME_HALF 32 -#define OFDM_PREAMBLE_TIME_HALF 40 -#define OFDM_PLCP_BITS_HALF 22 -#define OFDM_SYMBOL_TIME_HALF 8 - -#define OFDM_SIFS_TIME_QUARTER 64 -#define OFDM_PREAMBLE_TIME_QUARTER 80 -#define OFDM_PLCP_BITS_QUARTER 22 -#define OFDM_SYMBOL_TIME_QUARTER 16 - - if (AH_PRIVATE(ah)->ah_curchan != AH_NULL && - IEEE80211_IS_CHAN_QUARTER(AH_PRIVATE(ah)->ah_curchan)) { - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000; - HALASSERT(bitsPerSymbol != 0); - - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME_QUARTER - + OFDM_PREAMBLE_TIME_QUARTER - + (numSymbols * OFDM_SYMBOL_TIME_QUARTER); - } else if (AH_PRIVATE(ah)->ah_curchan != AH_NULL && - IEEE80211_IS_CHAN_HALF(AH_PRIVATE(ah)->ah_curchan)) { - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000; - HALASSERT(bitsPerSymbol != 0); - - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME_HALF + - OFDM_PREAMBLE_TIME_HALF - + (numSymbols * OFDM_SYMBOL_TIME_HALF); - } else { /* full rate channel */ - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000; - HALASSERT(bitsPerSymbol != 0); - - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME + OFDM_PREAMBLE_TIME - + (numSymbols * OFDM_SYMBOL_TIME); - } + bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000; + HALASSERT(bitsPerSymbol != 0); + + numBits = OFDM_PLCP_BITS + (frameLen << 3); + numSymbols = howmany(numBits, bitsPerSymbol); + txTime = OFDM_SIFS_TIME + + OFDM_PREAMBLE_TIME + + (numSymbols * OFDM_SYMBOL_TIME); break; + case IEEE80211_T_OFDM_HALF: + bitsPerSymbol = (kbps * OFDM_HALF_SYMBOL_TIME) / 1000; + HALASSERT(bitsPerSymbol != 0); -#undef OFDM_SIFS_TIME -#undef OFDM_PREAMBLE_TIME -#undef OFDM_PLCP_BITS -#undef OFDM_SYMBOL_TIME + numBits = OFDM_HALF_PLCP_BITS + (frameLen << 3); + numSymbols = howmany(numBits, bitsPerSymbol); + txTime = OFDM_HALF_SIFS_TIME + + OFDM_HALF_PREAMBLE_TIME + + (numSymbols * OFDM_HALF_SYMBOL_TIME); + break; + case IEEE80211_T_OFDM_QUARTER: + bitsPerSymbol = (kbps * OFDM_QUARTER_SYMBOL_TIME) / 1000; + HALASSERT(bitsPerSymbol != 0); + numBits = OFDM_QUARTER_PLCP_BITS + (frameLen << 3); + numSymbols = howmany(numBits, bitsPerSymbol); + txTime = OFDM_QUARTER_SIFS_TIME + + OFDM_QUARTER_PREAMBLE_TIME + + (numSymbols * OFDM_QUARTER_SYMBOL_TIME); + break; case IEEE80211_T_TURBO: -#define TURBO_SIFS_TIME 8 -#define TURBO_PREAMBLE_TIME 14 -#define TURBO_PLCP_BITS 22 -#define TURBO_SYMBOL_TIME 4 /* we still save OFDM rates in kbps - so double them */ bitsPerSymbol = ((kbps << 1) * TURBO_SYMBOL_TIME) / 1000; HALASSERT(bitsPerSymbol != 0); - numBits = TURBO_PLCP_BITS + (frameLen << 3); - numSymbols = howmany(numBits, bitsPerSymbol); - txTime = TURBO_SIFS_TIME + TURBO_PREAMBLE_TIME - + (numSymbols * TURBO_SYMBOL_TIME); + numBits = TURBO_PLCP_BITS + (frameLen << 3); + numSymbols = howmany(numBits, bitsPerSymbol); + txTime = TURBO_SIFS_TIME + + TURBO_PREAMBLE_TIME + + (numSymbols * TURBO_SYMBOL_TIME); break; -#undef TURBO_SIFS_TIME -#undef TURBO_PREAMBLE_TIME -#undef TURBO_PLCP_BITS -#undef TURBO_SYMBOL_TIME - default: HALDEBUG(ah, HAL_DEBUG_PHYIO, "%s: unknown phy %u (rate ix %u)\n", Modified: projects/vap7/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ah_internal.h Thu Feb 19 05:45:41 2009 (r188789) +++ projects/vap7/sys/dev/ath/ath_hal/ah_internal.h Thu Feb 19 05:46:32 2009 (r188790) @@ -773,5 +773,29 @@ extern void ath_hal_ini_bank_setup(uint3 extern int ath_hal_ini_bank_write(struct ath_hal *ah, const HAL_INI_ARRAY *ia, const uint32_t data[], int regWr); +#define CCK_SIFS_TIME 10 +#define CCK_PREAMBLE_BITS 144 +#define CCK_PLCP_BITS 48 + +#define OFDM_SIFS_TIME 16 +#define OFDM_PREAMBLE_TIME 20 +#define OFDM_PLCP_BITS 22 +#define OFDM_SYMBOL_TIME 4 + +#define OFDM_HALF_SIFS_TIME 32 +#define OFDM_HALF_PREAMBLE_TIME 40 +#define OFDM_HALF_PLCP_BITS 22 +#define OFDM_HALF_SYMBOL_TIME 8 + +#define OFDM_QUARTER_SIFS_TIME 64 +#define OFDM_QUARTER_PREAMBLE_TIME 80 +#define OFDM_QUARTER_PLCP_BITS 22 +#define OFDM_QUARTER_SYMBOL_TIME 16 + +#define TURBO_SIFS_TIME 8 +#define TURBO_PREAMBLE_TIME 14 +#define TURBO_PLCP_BITS 22 +#define TURBO_SYMBOL_TIME 4 + #define WLAN_CTRL_FRAME_SIZE (2+2+6+4) /* ACK+FCS */ #endif /* _ATH_AH_INTERAL_H_ */ Modified: projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_phy.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_phy.c Thu Feb 19 05:45:41 2009 (r188789) +++ projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_phy.c Thu Feb 19 05:46:32 2009 (r188790) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ar5212_phy.c,v 1.5 2008/11/15 03:43:53 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -27,6 +27,8 @@ #define OFDM IEEE80211_T_OFDM #define CCK IEEE80211_T_CCK #define TURBO IEEE80211_T_TURBO +#define HALF IEEE80211_T_OFDM_HALF +#define QUART IEEE80211_T_OFDM_QUARTER HAL_RATE_TABLE ar5212_11a_table = { 8, /* number of rates */ @@ -51,14 +53,14 @@ HAL_RATE_TABLE ar5212_half_table = { { /* short ctrl */ /* valid rateCode Preamble dot11Rate Rate */ -/* 6 Mb */ { AH_TRUE, OFDM, 3000, 0x0b, 0x00, (0x80|6), 0 }, -/* 9 Mb */ { AH_TRUE, OFDM, 4500, 0x0f, 0x00, 9, 0 }, -/* 12 Mb */ { AH_TRUE, OFDM, 6000, 0x0a, 0x00, (0x80|12), 2 }, -/* 18 Mb */ { AH_TRUE, OFDM, 9000, 0x0e, 0x00, 18, 2 }, -/* 24 Mb */ { AH_TRUE, OFDM, 12000, 0x09, 0x00, (0x80|24), 4 }, -/* 36 Mb */ { AH_TRUE, OFDM, 18000, 0x0d, 0x00, 36, 4 }, -/* 48 Mb */ { AH_TRUE, OFDM, 24000, 0x08, 0x00, 48, 4 }, -/* 54 Mb */ { AH_TRUE, OFDM, 27000, 0x0c, 0x00, 54, 4 } +/* 3 Mb */ { AH_TRUE, HALF, 3000, 0x0b, 0x00, (0x80|6), 0 }, +/* 4.5 Mb */ { AH_TRUE, HALF, 4500, 0x0f, 0x00, 9, 0 }, +/* 6 Mb */ { AH_TRUE, HALF, 6000, 0x0a, 0x00, (0x80|12), 2 }, +/* 9 Mb */ { AH_TRUE, HALF, 9000, 0x0e, 0x00, 18, 2 }, +/* 12 Mb */ { AH_TRUE, HALF, 12000, 0x09, 0x00, (0x80|24), 4 }, +/* 18 Mb */ { AH_TRUE, HALF, 18000, 0x0d, 0x00, 36, 4 }, +/* 24 Mb */ { AH_TRUE, HALF, 24000, 0x08, 0x00, 48, 4 }, +/* 27 Mb */ { AH_TRUE, HALF, 27000, 0x0c, 0x00, 54, 4 } }, }; @@ -68,14 +70,14 @@ HAL_RATE_TABLE ar5212_quarter_table = { { /* short ctrl */ /* valid rateCode Preamble dot11Rate Rate */ -/* 6 Mb */ { AH_TRUE, OFDM, 1500, 0x0b, 0x00, (0x80|3), 0 }, -/* 9 Mb */ { AH_TRUE, OFDM, 2250, 0x0f, 0x00, 4, 0 }, -/* 12 Mb */ { AH_TRUE, OFDM, 3000, 0x0a, 0x00, (0x80|6), 2 }, -/* 18 Mb */ { AH_TRUE, OFDM, 4500, 0x0e, 0x00, 9, 2 }, -/* 24 Mb */ { AH_TRUE, OFDM, 6000, 0x09, 0x00, (0x80|12), 4 }, -/* 36 Mb */ { AH_TRUE, OFDM, 9000, 0x0d, 0x00, 18, 4 }, -/* 48 Mb */ { AH_TRUE, OFDM, 12000, 0x08, 0x00, 24, 4 }, -/* 54 Mb */ { AH_TRUE, OFDM, 13500, 0x0c, 0x00, 27, 4 } +/* 1.5 Mb */ { AH_TRUE, QUART, 1500, 0x0b, 0x00, (0x80|3), 0 }, +/* 2 Mb */ { AH_TRUE, QUART, 2250, 0x0f, 0x00, 4, 0 }, +/* 3 Mb */ { AH_TRUE, QUART, 3000, 0x0a, 0x00, (0x80|6), 2 }, +/* 4.5 Mb */ { AH_TRUE, QUART, 4500, 0x0e, 0x00, 9, 2 }, +/* 6 Mb */ { AH_TRUE, QUART, 6000, 0x09, 0x00, (0x80|12), 4 }, +/* 9 Mb */ { AH_TRUE, QUART, 9000, 0x0d, 0x00, 18, 4 }, +/* 12 Mb */ { AH_TRUE, QUART, 12000, 0x08, 0x00, 24, 4 }, +/*13.5 Mb */ { AH_TRUE, QUART, 13500, 0x0c, 0x00, 27, 4 } }, }; From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:47:19 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3ECB10657C5; Thu, 19 Feb 2009 05:47:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 548B38FC17; Thu, 19 Feb 2009 05:47:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5lJsm086205; Thu, 19 Feb 2009 05:47:19 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5lJ2J086203; Thu, 19 Feb 2009 05:47:19 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190547.n1J5lJ2J086203@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188791 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:47:20 -0000 Author: sam Date: Thu Feb 19 05:47:18 2009 New Revision: 188791 URL: http://svn.freebsd.org/changeset/base/188791 Log: merge r188774: don't special case 11na/g legacy rate sets Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211.c projects/vap7/sys/net80211/ieee80211_ioctl.c Modified: projects/vap7/sys/net80211/ieee80211.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211.c Thu Feb 19 05:46:32 2009 (r188790) +++ projects/vap7/sys/net80211/ieee80211.c Thu Feb 19 05:47:18 2009 (r188791) @@ -185,6 +185,8 @@ ieee80211_chan_init(struct ieee80211com DEFAULTRATES(IEEE80211_MODE_TURBO_A, ieee80211_rateset_11a); DEFAULTRATES(IEEE80211_MODE_TURBO_G, ieee80211_rateset_11g); DEFAULTRATES(IEEE80211_MODE_STURBO_A, ieee80211_rateset_11a); + DEFAULTRATES(IEEE80211_MODE_11NA, ieee80211_rateset_11a); + DEFAULTRATES(IEEE80211_MODE_11NG, ieee80211_rateset_11g); /* * Set auto mode to reset active channel state and any desired channel. @@ -1011,12 +1013,7 @@ ieee80211_get_suprates(struct ieee80211c return &ieee80211_rateset_half; if (IEEE80211_IS_CHAN_QUARTER(c)) return &ieee80211_rateset_quarter; - if (IEEE80211_IS_CHAN_HTA(c)) - return &ic->ic_sup_rates[IEEE80211_MODE_11A]; - if (IEEE80211_IS_CHAN_HTG(c)) { - /* XXX does this work for basic rates? */ - return &ic->ic_sup_rates[IEEE80211_MODE_11G]; - } + /* XXX does this work for 11ng basic rates? */ return &ic->ic_sup_rates[ieee80211_chan2mode(c)]; } Modified: projects/vap7/sys/net80211/ieee80211_ioctl.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_ioctl.c Thu Feb 19 05:46:32 2009 (r188790) +++ projects/vap7/sys/net80211/ieee80211_ioctl.c Thu Feb 19 05:47:18 2009 (r188791) @@ -2121,8 +2121,7 @@ ieee80211_ioctl_settxparams(struct ieee8 continue; src = &parms.params[i]; dst = &vap->iv_txparms[i]; - rs = &ic->ic_sup_rates[i == IEEE80211_MODE_11NA ? - IEEE80211_MODE_11A : IEEE80211_MODE_11G]; + rs = &ic->ic_sup_rates[i]; if (src->ucastrate != dst->ucastrate) { if (!checkmcs(src->ucastrate) && !checkrate(rs, src->ucastrate)) From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:47:51 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28C6E1065743; Thu, 19 Feb 2009 05:47:51 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 157F58FC19; Thu, 19 Feb 2009 05:47:51 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5loLl086261; Thu, 19 Feb 2009 05:47:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5loZj086260; Thu, 19 Feb 2009 05:47:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190547.n1J5loZj086260@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:47:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188792 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:47:51 -0000 Author: sam Date: Thu Feb 19 05:47:50 2009 New Revision: 188792 URL: http://svn.freebsd.org/changeset/base/188792 Log: merge r188775: check ptr against NULL Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211.c Modified: projects/vap7/sys/net80211/ieee80211.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211.c Thu Feb 19 05:47:18 2009 (r188791) +++ projects/vap7/sys/net80211/ieee80211.c Thu Feb 19 05:47:50 2009 (r188792) @@ -1442,7 +1442,7 @@ ieee80211_rate2media(struct ieee80211com return findmedia(rates, N(rates), rate | IFM_IEEE80211_FH); case IEEE80211_MODE_AUTO: /* NB: ic may be NULL for some drivers */ - if (ic && ic->ic_phytype == IEEE80211_T_FH) + if (ic != NULL && ic->ic_phytype == IEEE80211_T_FH) return findmedia(rates, N(rates), rate | IFM_IEEE80211_FH); /* NB: hack, 11g matches both 11b+11a rates */ From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:48:23 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8357E106566B; Thu, 19 Feb 2009 05:48:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FABD8FC1A; Thu, 19 Feb 2009 05:48:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5mN6I086324; Thu, 19 Feb 2009 05:48:23 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5mNQN086323; Thu, 19 Feb 2009 05:48:23 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190548.n1J5mNQN086323@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188793 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:48:23 -0000 Author: sam Date: Thu Feb 19 05:48:23 2009 New Revision: 188793 URL: http://svn.freebsd.org/changeset/base/188793 Log: merge r188776: simplify setting up the roaming parameters Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_scan.c Modified: projects/vap7/sys/net80211/ieee80211_scan.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_scan.c Thu Feb 19 05:47:50 2009 (r188792) +++ projects/vap7/sys/net80211/ieee80211_scan.c Thu Feb 19 05:48:23 2009 (r188793) @@ -73,16 +73,18 @@ struct scan_state { /* * Roaming-related defaults. RSSI thresholds are as returned by the - * driver (dBm). Transmit rate thresholds are IEEE rate codes (i.e + * driver (.5dBm). Transmit rate thresholds are IEEE rate codes (i.e * .5M units) or MCS. */ -#define ROAM_RSSI_11A_DEFAULT 14 /* rssi threshold for 11a bss */ -#define ROAM_RSSI_11B_DEFAULT 14 /* rssi threshold for 11b bss */ -#define ROAM_RSSI_11BONLY_DEFAULT 14 /* rssi threshold for 11b-only bss */ -#define ROAM_RATE_11A_DEFAULT 2*12 /* tx rate thresh for 11a bss */ -#define ROAM_RATE_11B_DEFAULT 2*5 /* tx rate thresh for 11b bss */ -#define ROAM_RATE_11BONLY_DEFAULT 2*1 /* tx rate thresh for 11b-only bss */ -#define ROAM_MCS_11N_DEFAULT 1 /* tx MCS thresh for 11n bss*/ +/* rssi thresholds */ +#define ROAM_RSSI_11A_DEFAULT 14 /* 11a bss */ +#define ROAM_RSSI_11B_DEFAULT 14 /* 11b bss */ +#define ROAM_RSSI_11BONLY_DEFAULT 14 /* 11b-only bss */ +/* transmit rate thresholds */ +#define ROAM_RATE_11A_DEFAULT 2*12 /* 11a bss */ +#define ROAM_RATE_11B_DEFAULT 2*5 /* 11b bss */ +#define ROAM_RATE_11BONLY_DEFAULT 2*1 /* 11b-only bss */ +#define ROAM_MCS_11N_DEFAULT (1 | IEEE80211_RATE_MCS) /* 11n bss */ static void scan_restart_pwrsav(void *); static void scan_curchan(struct ieee80211_scan_state *, unsigned long); @@ -126,50 +128,34 @@ ieee80211_scan_detach(struct ieee80211co } } -static __inline void -setparams(struct ieee80211_roamparam *rp, int8_t rssi, uint8_t txrate) -{ - rp->rssi = rssi; - rp->rate = txrate; -} +static const struct ieee80211_roamparam defroam[IEEE80211_MODE_MAX] = { + [IEEE80211_MODE_11A] = { .rssi = ROAM_RSSI_11A_DEFAULT, + .rate = ROAM_RATE_11A_DEFAULT }, + [IEEE80211_MODE_11G] = { .rssi = ROAM_RSSI_11B_DEFAULT, + .rate = ROAM_RATE_11B_DEFAULT }, + [IEEE80211_MODE_11B] = { .rssi = ROAM_RSSI_11BONLY_DEFAULT, + .rate = ROAM_RATE_11BONLY_DEFAULT }, + [IEEE80211_MODE_TURBO_A]= { .rssi = ROAM_RSSI_11A_DEFAULT, + .rate = ROAM_RATE_11A_DEFAULT }, + [IEEE80211_MODE_TURBO_G]= { .rssi = ROAM_RSSI_11A_DEFAULT, + .rate = ROAM_RATE_11A_DEFAULT }, + [IEEE80211_MODE_STURBO_A]={ .rssi = ROAM_RSSI_11A_DEFAULT, + .rate = ROAM_RATE_11A_DEFAULT }, + [IEEE80211_MODE_11NA] = { .rssi = ROAM_RSSI_11A_DEFAULT, + .rate = ROAM_MCS_11N_DEFAULT }, + [IEEE80211_MODE_11NG] = { .rssi = ROAM_RSSI_11B_DEFAULT, + .rate = ROAM_MCS_11N_DEFAULT }, +}; void ieee80211_scan_vattach(struct ieee80211vap *vap) { - struct ieee80211com *ic = vap->iv_ic; - vap->iv_bgscanidle = (IEEE80211_BGSCAN_IDLE_DEFAULT*1000)/hz; vap->iv_bgscanintvl = IEEE80211_BGSCAN_INTVAL_DEFAULT*hz; vap->iv_scanvalid = IEEE80211_SCAN_VALID_DEFAULT*hz; vap->iv_roaming = IEEE80211_ROAMING_AUTO; - - /* NB: only set supported modes so user apps can identify */ - if (isset(ic->ic_modecaps, IEEE80211_MODE_11A)) - setparams(&vap->iv_roamparms[IEEE80211_MODE_11A], - ROAM_RSSI_11A_DEFAULT, ROAM_RATE_11A_DEFAULT); - if (isset(ic->ic_modecaps, IEEE80211_MODE_11G)) - setparams(&vap->iv_roamparms[IEEE80211_MODE_11G], - ROAM_RSSI_11B_DEFAULT, ROAM_RATE_11B_DEFAULT); - if (isset(ic->ic_modecaps, IEEE80211_MODE_11B)) - setparams(&vap->iv_roamparms[IEEE80211_MODE_11B], - ROAM_RSSI_11BONLY_DEFAULT, ROAM_RATE_11BONLY_DEFAULT); - /* NB: default turbo controls to be the same as !turbo */ - if (isset(ic->ic_modecaps, IEEE80211_MODE_TURBO_A)) - vap->iv_roamparms[IEEE80211_MODE_TURBO_A] = - vap->iv_roamparms[IEEE80211_MODE_11A]; - if (isset(ic->ic_modecaps, IEEE80211_MODE_TURBO_G)) - vap->iv_roamparms[IEEE80211_MODE_TURBO_G] = - vap->iv_roamparms[IEEE80211_MODE_11G]; - if (isset(ic->ic_modecaps, IEEE80211_MODE_STURBO_A)) - vap->iv_roamparms[IEEE80211_MODE_STURBO_A] = - vap->iv_roamparms[IEEE80211_MODE_11A]; - if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA)) - setparams(&vap->iv_roamparms[IEEE80211_MODE_11NA], - ROAM_RSSI_11A_DEFAULT, ROAM_MCS_11N_DEFAULT | 0x80); - if (isset(ic->ic_modecaps, IEEE80211_MODE_11NG)) - setparams(&vap->iv_roamparms[IEEE80211_MODE_11NG], - ROAM_RSSI_11B_DEFAULT, ROAM_MCS_11N_DEFAULT | 0x80); + memcpy(vap->iv_roamparms, defroam, sizeof(defroam)); } void From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:48:59 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB7C21065670; Thu, 19 Feb 2009 05:48:59 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD7638FC15; Thu, 19 Feb 2009 05:48:59 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5mxx9086383; Thu, 19 Feb 2009 05:48:59 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5mxlL086382; Thu, 19 Feb 2009 05:48:59 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190548.n1J5mxlL086382@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188794 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:49:00 -0000 Author: sam Date: Thu Feb 19 05:48:59 2009 New Revision: 188794 URL: http://svn.freebsd.org/changeset/base/188794 Log: merge r188777: use c99 initializer Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_scan_sta.c Modified: projects/vap7/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_scan_sta.c Thu Feb 19 05:48:23 2009 (r188793) +++ projects/vap7/sys/net80211/ieee80211_scan_sta.c Thu Feb 19 05:48:59 2009 (r188794) @@ -405,17 +405,20 @@ find11gchannel(struct ieee80211com *ic, } return NULL; } + static const u_int chanflags[IEEE80211_MODE_MAX] = { - IEEE80211_CHAN_B, /* IEEE80211_MODE_AUTO */ - IEEE80211_CHAN_A, /* IEEE80211_MODE_11A */ - IEEE80211_CHAN_B, /* IEEE80211_MODE_11B */ - IEEE80211_CHAN_G, /* IEEE80211_MODE_11G */ - IEEE80211_CHAN_FHSS, /* IEEE80211_MODE_FH */ - IEEE80211_CHAN_A, /* IEEE80211_MODE_TURBO_A (check base channel)*/ - IEEE80211_CHAN_G, /* IEEE80211_MODE_TURBO_G */ - IEEE80211_CHAN_ST, /* IEEE80211_MODE_STURBO_A */ - IEEE80211_CHAN_A, /* IEEE80211_MODE_11NA (check legacy) */ - IEEE80211_CHAN_G, /* IEEE80211_MODE_11NG (check legacy) */ + [IEEE80211_MODE_AUTO] = IEEE80211_CHAN_B, + [IEEE80211_MODE_11A] = IEEE80211_CHAN_A, + [IEEE80211_MODE_11B] = IEEE80211_CHAN_B, + [IEEE80211_MODE_11G] = IEEE80211_CHAN_G, + [IEEE80211_MODE_FH] = IEEE80211_CHAN_FHSS, + /* check base channel */ + [IEEE80211_MODE_TURBO_A] = IEEE80211_CHAN_A, + [IEEE80211_MODE_TURBO_G] = IEEE80211_CHAN_G, + [IEEE80211_MODE_STURBO_A] = IEEE80211_CHAN_ST, + /* check legacy */ + [IEEE80211_MODE_11NA] = IEEE80211_CHAN_A, + [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, }; static void From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:49:32 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B0251065673; Thu, 19 Feb 2009 05:49:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47F418FC1E; Thu, 19 Feb 2009 05:49:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5nWOx086446; Thu, 19 Feb 2009 05:49:32 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5nWur086445; Thu, 19 Feb 2009 05:49:32 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190549.n1J5nWur086445@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188795 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:49:32 -0000 Author: sam Date: Thu Feb 19 05:49:31 2009 New Revision: 188795 URL: http://svn.freebsd.org/changeset/base/188795 Log: merge r188778: Change country ie construction Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_regdomain.c Modified: projects/vap7/sys/net80211/ieee80211_regdomain.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_regdomain.c Thu Feb 19 05:48:59 2009 (r188794) +++ projects/vap7/sys/net80211/ieee80211_regdomain.c Thu Feb 19 05:49:31 2009 (r188795) @@ -216,17 +216,19 @@ ieee80211_alloc_countryie(struct ieee802 /* XXX what about auto? */ /* flag set of channels to be excluded */ static const int skipflags[IEEE80211_MODE_MAX] = { - CHAN_UNINTERESTING, /* MODE_AUTO */ - CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ, /* MODE_11A */ - CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ, /* MODE_11B */ - CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ, /* MODE_11G */ - CHAN_UNINTERESTING | IEEE80211_CHAN_OFDM | /* MODE_FH */ - IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN, - CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ, /* MODE_TURBO_A */ - CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ, /* MODE_TURBO_G */ - CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ, /* MODE_STURBO_A */ - CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ, /* MODE_11NA */ - CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ, /* MODE_11NG */ + [IEEE80211_MODE_AUTO] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11A] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11B] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11G] = CHAN_UNINTERESTING, + [IEEE80211_MODE_FH] = CHAN_UNINTERESTING + | IEEE80211_CHAN_OFDM + | IEEE80211_CHAN_CCK + | IEEE80211_CHAN_DYN, + [IEEE80211_MODE_TURBO_A] = CHAN_UNINTERESTING, + [IEEE80211_MODE_TURBO_G] = CHAN_UNINTERESTING, + [IEEE80211_MODE_STURBO_A] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11NA] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11NG] = CHAN_UNINTERESTING, }; const struct ieee80211_regdomain *rd = &ic->ic_regdomain; uint8_t nextchan, chans[IEEE80211_CHAN_BYTES], *frm; @@ -268,6 +270,10 @@ ieee80211_alloc_countryie(struct ieee802 nruns = 0; memset(chans, 0, sizeof(chans)); skip = skipflags[ieee80211_chan2mode(ic->ic_bsschan)]; + if (IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan)) + skip |= IEEE80211_CHAN_2GHZ; + else if (IEEE80211_IS_CHAN_2GHZ(ic->ic_bsschan)) + skip |= IEEE80211_CHAN_5GHZ; for (i = 0; i < ic->ic_nchans; i++) { const struct ieee80211_channel *c = &ic->ic_channels[i]; From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:50:15 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83F94106564A; Thu, 19 Feb 2009 05:50:15 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 568C18FC19; Thu, 19 Feb 2009 05:50:15 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5oF3T086514; Thu, 19 Feb 2009 05:50:15 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5oFIL086513; Thu, 19 Feb 2009 05:50:15 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190550.n1J5oFIL086513@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188796 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:50:15 -0000 Author: sam Date: Thu Feb 19 05:50:15 2009 New Revision: 188796 URL: http://svn.freebsd.org/changeset/base/188796 Log: merge r188779: consolidate loops Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_proto.c Modified: projects/vap7/sys/net80211/ieee80211_proto.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_proto.c Thu Feb 19 05:49:31 2009 (r188795) +++ projects/vap7/sys/net80211/ieee80211_proto.c Thu Feb 19 05:50:15 2009 (r188796) @@ -182,22 +182,19 @@ ieee80211_proto_vattach(struct ieee80211 * max retry count. These settings can be changed by the * driver and/or user applications. */ - for (i = IEEE80211_MODE_11A; i < IEEE80211_MODE_11NA; i++) { + for (i = IEEE80211_MODE_11A; i < IEEE80211_MODE_MAX; i++) { const struct ieee80211_rateset *rs = &ic->ic_sup_rates[i]; vap->iv_txparms[i].ucastrate = IEEE80211_FIXED_RATE_NONE; - /* NB: we default to min supported rate for channel */ - vap->iv_txparms[i].mgmtrate = - rs->rs_rates[0] & IEEE80211_RATE_VAL; - vap->iv_txparms[i].mcastrate = - rs->rs_rates[0] & IEEE80211_RATE_VAL; - vap->iv_txparms[i].maxretry = IEEE80211_TXMAX_DEFAULT; - } - for (; i < IEEE80211_MODE_MAX; i++) { - vap->iv_txparms[i].ucastrate = IEEE80211_FIXED_RATE_NONE; - /* NB: default to MCS 0 */ - vap->iv_txparms[i].mgmtrate = 0 | 0x80; - vap->iv_txparms[i].mcastrate = 0 | 0x80; + if (i == IEEE80211_MODE_11NA || i == IEEE80211_MODE_11NG) { + vap->iv_txparms[i].mgmtrate = 0 | IEEE80211_RATE_MCS; + vap->iv_txparms[i].mcastrate = 0 | IEEE80211_RATE_MCS; + } else { + vap->iv_txparms[i].mgmtrate = + rs->rs_rates[0] & IEEE80211_RATE_VAL; + vap->iv_txparms[i].mcastrate = + rs->rs_rates[0] & IEEE80211_RATE_VAL; + } vap->iv_txparms[i].maxretry = IEEE80211_TXMAX_DEFAULT; } vap->iv_roaming = IEEE80211_ROAMING_AUTO; From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:50:50 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71F6C106564A; Thu, 19 Feb 2009 05:50:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D0828FC1F; Thu, 19 Feb 2009 05:50:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5ooat086572; Thu, 19 Feb 2009 05:50:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5ooxk086570; Thu, 19 Feb 2009 05:50:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190550.n1J5ooxk086570@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188797 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:50:50 -0000 Author: sam Date: Thu Feb 19 05:50:50 2009 New Revision: 188797 URL: http://svn.freebsd.org/changeset/base/188797 Log: merge r188780: use c99 initializers Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_ioctl.c projects/vap7/sys/net80211/ieee80211_proto.c Modified: projects/vap7/sys/net80211/ieee80211_ioctl.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_ioctl.c Thu Feb 19 05:50:15 2009 (r188796) +++ projects/vap7/sys/net80211/ieee80211_ioctl.c Thu Feb 19 05:50:50 2009 (r188797) @@ -1758,17 +1758,17 @@ static struct ieee80211_channel * findchannel(struct ieee80211com *ic, int ieee, int mode) { static const u_int chanflags[IEEE80211_MODE_MAX] = { - 0, /* IEEE80211_MODE_AUTO */ - IEEE80211_CHAN_A, /* IEEE80211_MODE_11A */ - IEEE80211_CHAN_B, /* IEEE80211_MODE_11B */ - IEEE80211_CHAN_G, /* IEEE80211_MODE_11G */ - IEEE80211_CHAN_FHSS, /* IEEE80211_MODE_FH */ - IEEE80211_CHAN_108A, /* IEEE80211_MODE_TURBO_A */ - IEEE80211_CHAN_108G, /* IEEE80211_MODE_TURBO_G */ - IEEE80211_CHAN_STURBO, /* IEEE80211_MODE_STURBO_A */ - /* NB: handled specially below */ - IEEE80211_CHAN_A, /* IEEE80211_MODE_11NA */ - IEEE80211_CHAN_G, /* IEEE80211_MODE_11NG */ + [IEEE80211_MODE_AUTO] = 0, + [IEEE80211_MODE_11A] = IEEE80211_CHAN_A, + [IEEE80211_MODE_11B] = IEEE80211_CHAN_B, + [IEEE80211_MODE_11G] = IEEE80211_CHAN_G, + [IEEE80211_MODE_FH] = IEEE80211_CHAN_FHSS, + [IEEE80211_MODE_TURBO_A] = IEEE80211_CHAN_108A, + [IEEE80211_MODE_TURBO_G] = IEEE80211_CHAN_108G, + [IEEE80211_MODE_STURBO_A] = IEEE80211_CHAN_STURBO, + /* NB: handled specially below */ + [IEEE80211_MODE_11NA] = IEEE80211_CHAN_A, + [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, }; u_int modeflags; int i; Modified: projects/vap7/sys/net80211/ieee80211_proto.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_proto.c Thu Feb 19 05:50:15 2009 (r188796) +++ projects/vap7/sys/net80211/ieee80211_proto.c Thu Feb 19 05:50:50 2009 (r188797) @@ -655,16 +655,16 @@ setbasicrates(struct ieee80211_rateset * enum ieee80211_phymode mode, int add) { static const struct ieee80211_rateset basic[IEEE80211_MODE_MAX] = { - { .rs_nrates = 0 }, /* IEEE80211_MODE_AUTO */ - { 3, { 12, 24, 48 } }, /* IEEE80211_MODE_11A */ - { 2, { 2, 4 } }, /* IEEE80211_MODE_11B */ - { 4, { 2, 4, 11, 22 } }, /* IEEE80211_MODE_11G (mixed b/g) */ - { .rs_nrates = 0 }, /* IEEE80211_MODE_FH */ - { 3, { 12, 24, 48 } }, /* IEEE80211_MODE_TURBO_A */ - { 4, { 2, 4, 11, 22 } }, /* IEEE80211_MODE_TURBO_G (mixed b/g) */ - { 3, { 12, 24, 48 } }, /* IEEE80211_MODE_STURBO_A */ - { 3, { 12, 24, 48 } }, /* IEEE80211_MODE_11NA */ - { 4, { 2, 4, 11, 22 } }, /* IEEE80211_MODE_11NG (mixed b/g) */ + [IEEE80211_MODE_11A] = { 3, { 12, 24, 48 } }, + [IEEE80211_MODE_11B] = { 2, { 2, 4 } }, + /* NB: mixed b/g */ + [IEEE80211_MODE_11G] = { 4, { 2, 4, 11, 22 } }, + [IEEE80211_MODE_TURBO_A] = { 3, { 12, 24, 48 } }, + [IEEE80211_MODE_TURBO_G] = { 4, { 2, 4, 11, 22 } }, + [IEEE80211_MODE_STURBO_A] = { 3, { 12, 24, 48 } }, + [IEEE80211_MODE_11NA] = { 3, { 12, 24, 48 } }, + /* NB: mixed b/g */ + [IEEE80211_MODE_11NG] = { 4, { 2, 4, 11, 22 } }, }; int i, j; @@ -717,89 +717,89 @@ typedef struct phyParamType { } paramType; static const struct phyParamType phyParamForAC_BE[IEEE80211_MODE_MAX] = { - { 3, 4, 6, 0, 0 }, /* IEEE80211_MODE_AUTO */ - { 3, 4, 6, 0, 0 }, /* IEEE80211_MODE_11A */ - { 3, 4, 6, 0, 0 }, /* IEEE80211_MODE_11B */ - { 3, 4, 6, 0, 0 }, /* IEEE80211_MODE_11G */ - { 3, 4, 6, 0, 0 }, /* IEEE80211_MODE_FH */ - { 2, 3, 5, 0, 0 }, /* IEEE80211_MODE_TURBO_A */ - { 2, 3, 5, 0, 0 }, /* IEEE80211_MODE_TURBO_G */ - { 2, 3, 5, 0, 0 }, /* IEEE80211_MODE_STURBO_A */ - { 3, 4, 6, 0, 0 }, /* IEEE80211_MODE_11NA */ - { 3, 4, 6, 0, 0 }, /* IEEE80211_MODE_11NG */ + [IEEE80211_MODE_AUTO] = { 3, 4, 6, 0, 0 }, + [IEEE80211_MODE_11A] = { 3, 4, 6, 0, 0 }, + [IEEE80211_MODE_11B] = { 3, 4, 6, 0, 0 }, + [IEEE80211_MODE_11G] = { 3, 4, 6, 0, 0 }, + [IEEE80211_MODE_FH] = { 3, 4, 6, 0, 0 }, + [IEEE80211_MODE_TURBO_A]= { 2, 3, 5, 0, 0 }, + [IEEE80211_MODE_TURBO_G]= { 2, 3, 5, 0, 0 }, + [IEEE80211_MODE_STURBO_A]={ 2, 3, 5, 0, 0 }, + [IEEE80211_MODE_11NA] = { 3, 4, 6, 0, 0 }, + [IEEE80211_MODE_11NG] = { 3, 4, 6, 0, 0 }, }; static const struct phyParamType phyParamForAC_BK[IEEE80211_MODE_MAX] = { - { 7, 4, 10, 0, 0 }, /* IEEE80211_MODE_AUTO */ - { 7, 4, 10, 0, 0 }, /* IEEE80211_MODE_11A */ - { 7, 4, 10, 0, 0 }, /* IEEE80211_MODE_11B */ - { 7, 4, 10, 0, 0 }, /* IEEE80211_MODE_11G */ - { 7, 4, 10, 0, 0 }, /* IEEE80211_MODE_FH */ - { 7, 3, 10, 0, 0 }, /* IEEE80211_MODE_TURBO_A */ - { 7, 3, 10, 0, 0 }, /* IEEE80211_MODE_TURBO_G */ - { 7, 3, 10, 0, 0 }, /* IEEE80211_MODE_STURBO_A */ - { 7, 4, 10, 0, 0 }, /* IEEE80211_MODE_11NA */ - { 7, 4, 10, 0, 0 }, /* IEEE80211_MODE_11NG */ + [IEEE80211_MODE_AUTO] = { 7, 4, 10, 0, 0 }, + [IEEE80211_MODE_11A] = { 7, 4, 10, 0, 0 }, + [IEEE80211_MODE_11B] = { 7, 4, 10, 0, 0 }, + [IEEE80211_MODE_11G] = { 7, 4, 10, 0, 0 }, + [IEEE80211_MODE_FH] = { 7, 4, 10, 0, 0 }, + [IEEE80211_MODE_TURBO_A]= { 7, 3, 10, 0, 0 }, + [IEEE80211_MODE_TURBO_G]= { 7, 3, 10, 0, 0 }, + [IEEE80211_MODE_STURBO_A]={ 7, 3, 10, 0, 0 }, + [IEEE80211_MODE_11NA] = { 7, 4, 10, 0, 0 }, + [IEEE80211_MODE_11NG] = { 7, 4, 10, 0, 0 }, }; static const struct phyParamType phyParamForAC_VI[IEEE80211_MODE_MAX] = { - { 1, 3, 4, 94, 0 }, /* IEEE80211_MODE_AUTO */ - { 1, 3, 4, 94, 0 }, /* IEEE80211_MODE_11A */ - { 1, 3, 4, 188, 0 }, /* IEEE80211_MODE_11B */ - { 1, 3, 4, 94, 0 }, /* IEEE80211_MODE_11G */ - { 1, 3, 4, 188, 0 }, /* IEEE80211_MODE_FH */ - { 1, 2, 3, 94, 0 }, /* IEEE80211_MODE_TURBO_A */ - { 1, 2, 3, 94, 0 }, /* IEEE80211_MODE_TURBO_G */ - { 1, 2, 3, 94, 0 }, /* IEEE80211_MODE_STURBO_A */ - { 1, 3, 4, 94, 0 }, /* IEEE80211_MODE_11NA */ - { 1, 3, 4, 94, 0 }, /* IEEE80211_MODE_11NG */ + [IEEE80211_MODE_AUTO] = { 1, 3, 4, 94, 0 }, + [IEEE80211_MODE_11A] = { 1, 3, 4, 94, 0 }, + [IEEE80211_MODE_11B] = { 1, 3, 4, 188, 0 }, + [IEEE80211_MODE_11G] = { 1, 3, 4, 94, 0 }, + [IEEE80211_MODE_FH] = { 1, 3, 4, 188, 0 }, + [IEEE80211_MODE_TURBO_A]= { 1, 2, 3, 94, 0 }, + [IEEE80211_MODE_TURBO_G]= { 1, 2, 3, 94, 0 }, + [IEEE80211_MODE_STURBO_A]={ 1, 2, 3, 94, 0 }, + [IEEE80211_MODE_11NA] = { 1, 3, 4, 94, 0 }, + [IEEE80211_MODE_11NG] = { 1, 3, 4, 94, 0 }, }; static const struct phyParamType phyParamForAC_VO[IEEE80211_MODE_MAX] = { - { 1, 2, 3, 47, 0 }, /* IEEE80211_MODE_AUTO */ - { 1, 2, 3, 47, 0 }, /* IEEE80211_MODE_11A */ - { 1, 2, 3, 102, 0 }, /* IEEE80211_MODE_11B */ - { 1, 2, 3, 47, 0 }, /* IEEE80211_MODE_11G */ - { 1, 2, 3, 102, 0 }, /* IEEE80211_MODE_FH */ - { 1, 2, 2, 47, 0 }, /* IEEE80211_MODE_TURBO_A */ - { 1, 2, 2, 47, 0 }, /* IEEE80211_MODE_TURBO_G */ - { 1, 2, 2, 47, 0 }, /* IEEE80211_MODE_STURBO_A */ - { 1, 2, 3, 47, 0 }, /* IEEE80211_MODE_11NA */ - { 1, 2, 3, 47, 0 }, /* IEEE80211_MODE_11NG */ + [IEEE80211_MODE_AUTO] = { 1, 2, 3, 47, 0 }, + [IEEE80211_MODE_11A] = { 1, 2, 3, 47, 0 }, + [IEEE80211_MODE_11B] = { 1, 2, 3, 102, 0 }, + [IEEE80211_MODE_11G] = { 1, 2, 3, 47, 0 }, + [IEEE80211_MODE_FH] = { 1, 2, 3, 102, 0 }, + [IEEE80211_MODE_TURBO_A]= { 1, 2, 2, 47, 0 }, + [IEEE80211_MODE_TURBO_G]= { 1, 2, 2, 47, 0 }, + [IEEE80211_MODE_STURBO_A]={ 1, 2, 2, 47, 0 }, + [IEEE80211_MODE_11NA] = { 1, 2, 3, 47, 0 }, + [IEEE80211_MODE_11NG] = { 1, 2, 3, 47, 0 }, }; static const struct phyParamType bssPhyParamForAC_BE[IEEE80211_MODE_MAX] = { - { 3, 4, 10, 0, 0 }, /* IEEE80211_MODE_AUTO */ - { 3, 4, 10, 0, 0 }, /* IEEE80211_MODE_11A */ - { 3, 4, 10, 0, 0 }, /* IEEE80211_MODE_11B */ - { 3, 4, 10, 0, 0 }, /* IEEE80211_MODE_11G */ - { 3, 4, 10, 0, 0 }, /* IEEE80211_MODE_FH */ - { 2, 3, 10, 0, 0 }, /* IEEE80211_MODE_TURBO_A */ - { 2, 3, 10, 0, 0 }, /* IEEE80211_MODE_TURBO_G */ - { 2, 3, 10, 0, 0 }, /* IEEE80211_MODE_STURBO_A */ - { 3, 4, 10, 0, 0 }, /* IEEE80211_MODE_11NA */ - { 3, 4, 10, 0, 0 }, /* IEEE80211_MODE_11NG */ + [IEEE80211_MODE_AUTO] = { 3, 4, 10, 0, 0 }, + [IEEE80211_MODE_11A] = { 3, 4, 10, 0, 0 }, + [IEEE80211_MODE_11B] = { 3, 4, 10, 0, 0 }, + [IEEE80211_MODE_11G] = { 3, 4, 10, 0, 0 }, + [IEEE80211_MODE_FH] = { 3, 4, 10, 0, 0 }, + [IEEE80211_MODE_TURBO_A]= { 2, 3, 10, 0, 0 }, + [IEEE80211_MODE_TURBO_G]= { 2, 3, 10, 0, 0 }, + [IEEE80211_MODE_STURBO_A]={ 2, 3, 10, 0, 0 }, + [IEEE80211_MODE_11NA] = { 3, 4, 10, 0, 0 }, + [IEEE80211_MODE_11NG] = { 3, 4, 10, 0, 0 }, }; static const struct phyParamType bssPhyParamForAC_VI[IEEE80211_MODE_MAX] = { - { 2, 3, 4, 94, 0 }, /* IEEE80211_MODE_AUTO */ - { 2, 3, 4, 94, 0 }, /* IEEE80211_MODE_11A */ - { 2, 3, 4, 188, 0 }, /* IEEE80211_MODE_11B */ - { 2, 3, 4, 94, 0 }, /* IEEE80211_MODE_11G */ - { 2, 3, 4, 188, 0 }, /* IEEE80211_MODE_FH */ - { 2, 2, 3, 94, 0 }, /* IEEE80211_MODE_TURBO_A */ - { 2, 2, 3, 94, 0 }, /* IEEE80211_MODE_TURBO_G */ - { 2, 2, 3, 94, 0 }, /* IEEE80211_MODE_STURBO_A */ - { 2, 3, 4, 94, 0 }, /* IEEE80211_MODE_11NA */ - { 2, 3, 4, 94, 0 }, /* IEEE80211_MODE_11NG */ + [IEEE80211_MODE_AUTO] = { 2, 3, 4, 94, 0 }, + [IEEE80211_MODE_11A] = { 2, 3, 4, 94, 0 }, + [IEEE80211_MODE_11B] = { 2, 3, 4, 188, 0 }, + [IEEE80211_MODE_11G] = { 2, 3, 4, 94, 0 }, + [IEEE80211_MODE_FH] = { 2, 3, 4, 188, 0 }, + [IEEE80211_MODE_TURBO_A]= { 2, 2, 3, 94, 0 }, + [IEEE80211_MODE_TURBO_G]= { 2, 2, 3, 94, 0 }, + [IEEE80211_MODE_STURBO_A]={ 2, 2, 3, 94, 0 }, + [IEEE80211_MODE_11NA] = { 2, 3, 4, 94, 0 }, + [IEEE80211_MODE_11NG] = { 2, 3, 4, 94, 0 }, }; static const struct phyParamType bssPhyParamForAC_VO[IEEE80211_MODE_MAX] = { - { 2, 2, 3, 47, 0 }, /* IEEE80211_MODE_AUTO */ - { 2, 2, 3, 47, 0 }, /* IEEE80211_MODE_11A */ - { 2, 2, 3, 102, 0 }, /* IEEE80211_MODE_11B */ - { 2, 2, 3, 47, 0 }, /* IEEE80211_MODE_11G */ - { 2, 2, 3, 102, 0 }, /* IEEE80211_MODE_FH */ - { 1, 2, 2, 47, 0 }, /* IEEE80211_MODE_TURBO_A */ - { 1, 2, 2, 47, 0 }, /* IEEE80211_MODE_TURBO_G */ - { 1, 2, 2, 47, 0 }, /* IEEE80211_MODE_STURBO_A */ - { 2, 2, 3, 47, 0 }, /* IEEE80211_MODE_11NA */ - { 2, 2, 3, 47, 0 }, /* IEEE80211_MODE_11NG */ + [IEEE80211_MODE_AUTO] = { 2, 2, 3, 47, 0 }, + [IEEE80211_MODE_11A] = { 2, 2, 3, 47, 0 }, + [IEEE80211_MODE_11B] = { 2, 2, 3, 102, 0 }, + [IEEE80211_MODE_11G] = { 2, 2, 3, 47, 0 }, + [IEEE80211_MODE_FH] = { 2, 2, 3, 102, 0 }, + [IEEE80211_MODE_TURBO_A]= { 1, 2, 2, 47, 0 }, + [IEEE80211_MODE_TURBO_G]= { 1, 2, 2, 47, 0 }, + [IEEE80211_MODE_STURBO_A]={ 1, 2, 2, 47, 0 }, + [IEEE80211_MODE_11NA] = { 2, 2, 3, 47, 0 }, + [IEEE80211_MODE_11NG] = { 2, 2, 3, 47, 0 }, }; static void @@ -922,16 +922,16 @@ void ieee80211_wme_updateparams_locked(struct ieee80211vap *vap) { static const paramType phyParam[IEEE80211_MODE_MAX] = { - { 2, 4, 10, 64, 0 }, /* IEEE80211_MODE_AUTO */ - { 2, 4, 10, 64, 0 }, /* IEEE80211_MODE_11A */ - { 2, 5, 10, 64, 0 }, /* IEEE80211_MODE_11B */ - { 2, 4, 10, 64, 0 }, /* IEEE80211_MODE_11G */ - { 2, 5, 10, 64, 0 }, /* IEEE80211_MODE_FH */ - { 1, 3, 10, 64, 0 }, /* IEEE80211_MODE_TURBO_A */ - { 1, 3, 10, 64, 0 }, /* IEEE80211_MODE_TURBO_G */ - { 1, 3, 10, 64, 0 }, /* IEEE80211_MODE_STURBO_A */ - { 2, 4, 10, 64, 0 }, /* IEEE80211_MODE_11NA */ /*XXXcheck*/ - { 2, 4, 10, 64, 0 }, /* IEEE80211_MODE_11NG */ /*XXXcheck*/ + [IEEE80211_MODE_AUTO] = { 2, 4, 10, 64, 0 }, + [IEEE80211_MODE_11A] = { 2, 4, 10, 64, 0 }, + [IEEE80211_MODE_11B] = { 2, 5, 10, 64, 0 }, + [IEEE80211_MODE_11G] = { 2, 4, 10, 64, 0 }, + [IEEE80211_MODE_FH] = { 2, 5, 10, 64, 0 }, + [IEEE80211_MODE_TURBO_A] = { 1, 3, 10, 64, 0 }, + [IEEE80211_MODE_TURBO_G] = { 1, 3, 10, 64, 0 }, + [IEEE80211_MODE_STURBO_A] = { 1, 3, 10, 64, 0 }, + [IEEE80211_MODE_11NA] = { 2, 4, 10, 64, 0 }, /* XXXcheck*/ + [IEEE80211_MODE_11NG] = { 2, 4, 10, 64, 0 }, /* XXXcheck*/ }; struct ieee80211com *ic = vap->iv_ic; struct ieee80211_wme_state *wme = &ic->ic_wme; @@ -1007,17 +1007,17 @@ ieee80211_wme_updateparams_locked(struct /* XXX multi-bss */ if (vap->iv_opmode == IEEE80211_M_HOSTAP && ic->ic_sta_assoc < 2 && (wme->wme_flags & WME_F_AGGRMODE) != 0) { - static const uint8_t logCwMin[IEEE80211_MODE_MAX] = { - 3, /* IEEE80211_MODE_AUTO */ - 3, /* IEEE80211_MODE_11A */ - 4, /* IEEE80211_MODE_11B */ - 3, /* IEEE80211_MODE_11G */ - 4, /* IEEE80211_MODE_FH */ - 3, /* IEEE80211_MODE_TURBO_A */ - 3, /* IEEE80211_MODE_TURBO_G */ - 3, /* IEEE80211_MODE_STURBO_A */ - 3, /* IEEE80211_MODE_11NA */ - 3, /* IEEE80211_MODE_11NG */ + static const uint8_t logCwMin[IEEE80211_MODE_MAX] = { + [IEEE80211_MODE_AUTO] = 3, + [IEEE80211_MODE_11A] = 3, + [IEEE80211_MODE_11B] = 4, + [IEEE80211_MODE_11G] = 3, + [IEEE80211_MODE_FH] = 4, + [IEEE80211_MODE_TURBO_A] = 3, + [IEEE80211_MODE_TURBO_G] = 3, + [IEEE80211_MODE_STURBO_A] = 3, + [IEEE80211_MODE_11NA] = 3, + [IEEE80211_MODE_11NG] = 3, }; chanp = &wme->wme_chanParams.cap_wmeParams[WME_AC_BE]; bssp = &wme->wme_bssChanParams.cap_wmeParams[WME_AC_BE]; From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:51:29 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61759106566C; Thu, 19 Feb 2009 05:51:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DE798FC1E; Thu, 19 Feb 2009 05:51:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5pTuV086640; Thu, 19 Feb 2009 05:51:29 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5pTKr086639; Thu, 19 Feb 2009 05:51:29 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190551.n1J5pTKr086639@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188798 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:51:29 -0000 Author: sam Date: Thu Feb 19 05:51:29 2009 New Revision: 188798 URL: http://svn.freebsd.org/changeset/base/188798 Log: merge r188781: prepare for adding new modes Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_ioctl.c Modified: projects/vap7/sys/net80211/ieee80211_ioctl.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_ioctl.c Thu Feb 19 05:50:50 2009 (r188797) +++ projects/vap7/sys/net80211/ieee80211_ioctl.c Thu Feb 19 05:51:29 2009 (r188798) @@ -675,19 +675,22 @@ static __noinline int ieee80211_ioctl_getroam(struct ieee80211vap *vap, const struct ieee80211req *ireq) { - if (ireq->i_len != sizeof(vap->iv_roamparms)) - return EINVAL; - return copyout(vap->iv_roamparms, ireq->i_data, - sizeof(vap->iv_roamparms)); + size_t len = ireq->i_len; + /* NB: accept short requests for backwards compat */ + if (len > sizeof(vap->iv_roamparms)) + len = sizeof(vap->iv_roamparms); + return copyout(vap->iv_roamparms, ireq->i_data, len); } static __noinline int ieee80211_ioctl_gettxparams(struct ieee80211vap *vap, const struct ieee80211req *ireq) { - if (ireq->i_len != sizeof(vap->iv_txparms)) - return EINVAL; - return copyout(vap->iv_txparms, ireq->i_data, sizeof(vap->iv_txparms)); + size_t len = ireq->i_len; + /* NB: accept short requests for backwards compat */ + if (len > sizeof(vap->iv_txparms)) + len = sizeof(vap->iv_txparms); + return copyout(vap->iv_txparms, ireq->i_data, len); } static __noinline int @@ -2082,61 +2085,40 @@ ieee80211_ioctl_settxparams(struct ieee8 struct ieee80211_txparams_req parms; /* XXX stack use? */ struct ieee80211_txparam *src, *dst; const struct ieee80211_rateset *rs; - int error, i, changed; + int error, mode, changed, is11n, nmodes; - if (ireq->i_len != sizeof(parms)) + /* NB: accept short requests for backwards compat */ + if (ireq->i_len > sizeof(parms)) return EINVAL; - error = copyin(ireq->i_data, &parms, sizeof(parms)); + error = copyin(ireq->i_data, &parms, ireq->i_len); if (error != 0) return error; + nmodes = ireq->i_len / sizeof(struct ieee80211_txparam); changed = 0; /* validate parameters and check if anything changed */ - for (i = IEEE80211_MODE_11A; i < IEEE80211_MODE_11NA; i++) { - if (isclr(ic->ic_modecaps, i)) - continue; - src = &parms.params[i]; - dst = &vap->iv_txparms[i]; - rs = &ic->ic_sup_rates[i]; - if (src->ucastrate != dst->ucastrate) { - if (!checkrate(rs, src->ucastrate)) - return EINVAL; - changed++; - } - if (src->mcastrate != dst->mcastrate) { - if (!checkrate(rs, src->mcastrate)) - return EINVAL; - changed++; - } - if (src->mgmtrate != dst->mgmtrate) { - if (!checkrate(rs, src->mgmtrate)) - return EINVAL; - changed++; - } - if (src->maxretry != dst->maxretry) /* NB: no bounds */ - changed++; - } - /* 11n parameters are handled differently */ - for (; i < IEEE80211_MODE_MAX; i++) { - if (isclr(ic->ic_modecaps, i)) + for (mode = IEEE80211_MODE_11A; mode < nmodes; mode++) { + if (isclr(ic->ic_modecaps, mode)) continue; - src = &parms.params[i]; - dst = &vap->iv_txparms[i]; - rs = &ic->ic_sup_rates[i]; + src = &parms.params[mode]; + dst = &vap->iv_txparms[mode]; + rs = &ic->ic_sup_rates[mode]; /* NB: 11n maps to legacy */ + is11n = (mode == IEEE80211_MODE_11NA || + mode == IEEE80211_MODE_11NG); if (src->ucastrate != dst->ucastrate) { - if (!checkmcs(src->ucastrate) && - !checkrate(rs, src->ucastrate)) + if (!checkrate(rs, src->ucastrate) && + (!is11n || !checkmcs(src->ucastrate))) return EINVAL; changed++; } if (src->mcastrate != dst->mcastrate) { - if (!checkmcs(src->mcastrate) && - !checkrate(rs, src->mcastrate)) + if (!checkrate(rs, src->mcastrate) && + (!is11n || !checkmcs(src->mcastrate))) return EINVAL; changed++; } if (src->mgmtrate != dst->mgmtrate) { - if (!checkmcs(src->mgmtrate) && - !checkrate(rs, src->mgmtrate)) + if (!checkrate(rs, src->mgmtrate) && + (!is11n || !checkmcs(src->mgmtrate))) return EINVAL; changed++; } @@ -2148,9 +2130,9 @@ ieee80211_ioctl_settxparams(struct ieee8 * Copy new parameters in place and notify the * driver so it can push state to the device. */ - for (i = IEEE80211_MODE_11A; i < IEEE80211_MODE_MAX; i++) { - if (isset(ic->ic_modecaps, i)) - vap->iv_txparms[i] = parms.params[i]; + for (mode = IEEE80211_MODE_11A; mode < nmodes; mode++) { + if (isset(ic->ic_modecaps, mode)) + vap->iv_txparms[mode] = parms.params[mode]; } /* XXX could be more intelligent, e.g. don't reset if setting not being used */ From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:52:14 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C53771065673; Thu, 19 Feb 2009 05:52:14 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0F268FC1A; Thu, 19 Feb 2009 05:52:14 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5qEPC086712; Thu, 19 Feb 2009 05:52:14 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5qE58086703; Thu, 19 Feb 2009 05:52:14 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190552.n1J5qE58086703@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188799 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:52:15 -0000 Author: sam Date: Thu Feb 19 05:52:14 2009 New Revision: 188799 URL: http://svn.freebsd.org/changeset/base/188799 Log: merge r188782: Add modes for 1/2 and 1/4-width channels so we have separate roaming and xmit parameters. This makes it possible to use tdma on fractional channels. Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/_ieee80211.h projects/vap7/sys/net80211/ieee80211.c projects/vap7/sys/net80211/ieee80211_ioctl.c projects/vap7/sys/net80211/ieee80211_node.c projects/vap7/sys/net80211/ieee80211_proto.c projects/vap7/sys/net80211/ieee80211_regdomain.c projects/vap7/sys/net80211/ieee80211_scan.c projects/vap7/sys/net80211/ieee80211_scan_sta.c projects/vap7/sys/net80211/ieee80211_tdma.c Modified: projects/vap7/sys/net80211/_ieee80211.h ============================================================================== --- projects/vap7/sys/net80211/_ieee80211.h Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/_ieee80211.h Thu Feb 19 05:52:14 2009 (r188799) @@ -66,8 +66,10 @@ enum ieee80211_phymode { IEEE80211_MODE_STURBO_A = 7, /* 5GHz, OFDM, 2x clock, static */ IEEE80211_MODE_11NA = 8, /* 5GHz, w/ HT */ IEEE80211_MODE_11NG = 9, /* 2GHz, w/ HT */ + IEEE80211_MODE_HALF = 10, /* OFDM, 1/2x clock */ + IEEE80211_MODE_QUARTER = 11, /* OFDM, 1/4x clock */ }; -#define IEEE80211_MODE_MAX (IEEE80211_MODE_11NG+1) +#define IEEE80211_MODE_MAX (IEEE80211_MODE_QUARTER+1) /* * Operating mode. Devices do not necessarily support Modified: projects/vap7/sys/net80211/ieee80211.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211.c Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/ieee80211.c Thu Feb 19 05:52:14 2009 (r188799) @@ -58,6 +58,8 @@ const char *ieee80211_phymode_name[IEEE8 [IEEE80211_MODE_TURBO_A] = "turboA", [IEEE80211_MODE_TURBO_G] = "turboG", [IEEE80211_MODE_STURBO_A] = "sturboA", + [IEEE80211_MODE_HALF] = "half", + [IEEE80211_MODE_QUARTER] = "quarter", [IEEE80211_MODE_11NA] = "11na", [IEEE80211_MODE_11NG] = "11ng", }; @@ -112,7 +114,7 @@ static void ieee80211_chan_init(struct ieee80211com *ic) { #define DEFAULTRATES(m, def) do { \ - if (isset(ic->ic_modecaps, m) && ic->ic_sup_rates[m].rs_nrates == 0) \ + if (ic->ic_sup_rates[m].rs_nrates == 0) \ ic->ic_sup_rates[m] = def; \ } while (0) struct ieee80211_channel *c; @@ -159,6 +161,10 @@ ieee80211_chan_init(struct ieee80211com setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_G); if (IEEE80211_IS_CHAN_ST(c)) setbit(ic->ic_modecaps, IEEE80211_MODE_STURBO_A); + if (IEEE80211_IS_CHAN_HALF(c)) + setbit(ic->ic_modecaps, IEEE80211_MODE_HALF); + if (IEEE80211_IS_CHAN_QUARTER(c)) + setbit(ic->ic_modecaps, IEEE80211_MODE_QUARTER); if (IEEE80211_IS_CHAN_HTA(c)) setbit(ic->ic_modecaps, IEEE80211_MODE_11NA); if (IEEE80211_IS_CHAN_HTG(c)) @@ -185,6 +191,8 @@ ieee80211_chan_init(struct ieee80211com DEFAULTRATES(IEEE80211_MODE_TURBO_A, ieee80211_rateset_11a); DEFAULTRATES(IEEE80211_MODE_TURBO_G, ieee80211_rateset_11g); DEFAULTRATES(IEEE80211_MODE_STURBO_A, ieee80211_rateset_11a); + DEFAULTRATES(IEEE80211_MODE_HALF, ieee80211_rateset_half); + DEFAULTRATES(IEEE80211_MODE_QUARTER, ieee80211_rateset_quarter); DEFAULTRATES(IEEE80211_MODE_11NA, ieee80211_rateset_11a); DEFAULTRATES(IEEE80211_MODE_11NG, ieee80211_rateset_11g); @@ -867,6 +875,8 @@ addmedia(struct ifmedia *media, int caps [IEEE80211_MODE_TURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO, [IEEE80211_MODE_TURBO_G] = IFM_IEEE80211_11G|IFM_IEEE80211_TURBO, [IEEE80211_MODE_STURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO, + [IEEE80211_MODE_HALF] = IFM_IEEE80211_11A, /* XXX */ + [IEEE80211_MODE_QUARTER] = IFM_IEEE80211_11A, /* XXX */ [IEEE80211_MODE_11NA] = IFM_IEEE80211_11NA, [IEEE80211_MODE_11NG] = IFM_IEEE80211_11NG, }; @@ -955,7 +965,7 @@ ieee80211_media_setup(struct ieee80211co * use a "placeholder" media subtype and any fixed MCS * must be specified with a different mechanism. */ - for (; mode < IEEE80211_MODE_MAX; mode++) { + for (; mode <= IEEE80211_MODE_11NG; mode++) { if (isclr(ic->ic_modecaps, mode)) continue; addmedia(media, caps, addsta, mode, IFM_AUTO); @@ -1006,13 +1016,10 @@ ieee80211_media_init(struct ieee80211com /* XXX need to propagate new media settings to vap's */ } +/* XXX inline or eliminate? */ const struct ieee80211_rateset * ieee80211_get_suprates(struct ieee80211com *ic, const struct ieee80211_channel *c) { - if (IEEE80211_IS_CHAN_HALF(c)) - return &ieee80211_rateset_half; - if (IEEE80211_IS_CHAN_QUARTER(c)) - return &ieee80211_rateset_quarter; /* XXX does this work for 11ng basic rates? */ return &ic->ic_sup_rates[ieee80211_chan2mode(c)]; } @@ -1317,6 +1324,10 @@ ieee80211_chan2mode(const struct ieee802 return IEEE80211_MODE_STURBO_A; else if (IEEE80211_IS_CHAN_TURBO(chan)) return IEEE80211_MODE_TURBO_A; + else if (IEEE80211_IS_CHAN_HALF(chan)) + return IEEE80211_MODE_HALF; + else if (IEEE80211_IS_CHAN_QUARTER(chan)) + return IEEE80211_MODE_QUARTER; else if (IEEE80211_IS_CHAN_A(chan)) return IEEE80211_MODE_11A; else if (IEEE80211_IS_CHAN_ANYG(chan)) @@ -1432,6 +1443,8 @@ ieee80211_rate2media(struct ieee80211com rate &= IEEE80211_RATE_VAL; switch (mode) { case IEEE80211_MODE_11A: + case IEEE80211_MODE_HALF: /* XXX good 'nuf */ + case IEEE80211_MODE_QUARTER: case IEEE80211_MODE_11NA: case IEEE80211_MODE_TURBO_A: case IEEE80211_MODE_STURBO_A: Modified: projects/vap7/sys/net80211/ieee80211_ioctl.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_ioctl.c Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/ieee80211_ioctl.c Thu Feb 19 05:52:14 2009 (r188799) @@ -1769,6 +1769,8 @@ findchannel(struct ieee80211com *ic, int [IEEE80211_MODE_TURBO_A] = IEEE80211_CHAN_108A, [IEEE80211_MODE_TURBO_G] = IEEE80211_CHAN_108G, [IEEE80211_MODE_STURBO_A] = IEEE80211_CHAN_STURBO, + [IEEE80211_MODE_HALF] = IEEE80211_CHAN_HALF, + [IEEE80211_MODE_QUARTER] = IEEE80211_CHAN_QUARTER, /* NB: handled specially below */ [IEEE80211_MODE_11NA] = IEEE80211_CHAN_A, [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, Modified: projects/vap7/sys/net80211/ieee80211_node.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_node.c Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/ieee80211_node.c Thu Feb 19 05:52:14 2009 (r188799) @@ -237,6 +237,10 @@ node_setuptxparms(struct ieee80211_node /* NB: 108A/108G should be handled as 11a/11g respectively */ if (IEEE80211_IS_CHAN_ST(ni->ni_chan)) mode = IEEE80211_MODE_STURBO_A; + else if (IEEE80211_IS_CHAN_HALF(ni->ni_chan)) + mode = IEEE80211_MODE_HALF; + else if (IEEE80211_IS_CHAN_QUARTER(ni->ni_chan)) + mode = IEEE80211_MODE_QUARTER; else if (IEEE80211_IS_CHAN_A(ni->ni_chan)) mode = IEEE80211_MODE_11A; else if (ni->ni_flags & IEEE80211_NODE_ERP) Modified: projects/vap7/sys/net80211/ieee80211_proto.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_proto.c Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/ieee80211_proto.c Thu Feb 19 05:52:14 2009 (r188799) @@ -662,6 +662,8 @@ setbasicrates(struct ieee80211_rateset * [IEEE80211_MODE_TURBO_A] = { 3, { 12, 24, 48 } }, [IEEE80211_MODE_TURBO_G] = { 4, { 2, 4, 11, 22 } }, [IEEE80211_MODE_STURBO_A] = { 3, { 12, 24, 48 } }, + [IEEE80211_MODE_HALF] = { 3, { 6, 12, 24 } }, + [IEEE80211_MODE_QUARTER] = { 3, { 3, 6, 12 } }, [IEEE80211_MODE_11NA] = { 3, { 12, 24, 48 } }, /* NB: mixed b/g */ [IEEE80211_MODE_11NG] = { 4, { 2, 4, 11, 22 } }, @@ -725,6 +727,8 @@ static const struct phyParamType phyPara [IEEE80211_MODE_TURBO_A]= { 2, 3, 5, 0, 0 }, [IEEE80211_MODE_TURBO_G]= { 2, 3, 5, 0, 0 }, [IEEE80211_MODE_STURBO_A]={ 2, 3, 5, 0, 0 }, + [IEEE80211_MODE_HALF] = { 3, 4, 6, 0, 0 }, + [IEEE80211_MODE_QUARTER]= { 3, 4, 6, 0, 0 }, [IEEE80211_MODE_11NA] = { 3, 4, 6, 0, 0 }, [IEEE80211_MODE_11NG] = { 3, 4, 6, 0, 0 }, }; @@ -737,6 +741,8 @@ static const struct phyParamType phyPara [IEEE80211_MODE_TURBO_A]= { 7, 3, 10, 0, 0 }, [IEEE80211_MODE_TURBO_G]= { 7, 3, 10, 0, 0 }, [IEEE80211_MODE_STURBO_A]={ 7, 3, 10, 0, 0 }, + [IEEE80211_MODE_HALF] = { 7, 4, 10, 0, 0 }, + [IEEE80211_MODE_QUARTER]= { 7, 4, 10, 0, 0 }, [IEEE80211_MODE_11NA] = { 7, 4, 10, 0, 0 }, [IEEE80211_MODE_11NG] = { 7, 4, 10, 0, 0 }, }; @@ -749,6 +755,8 @@ static const struct phyParamType phyPara [IEEE80211_MODE_TURBO_A]= { 1, 2, 3, 94, 0 }, [IEEE80211_MODE_TURBO_G]= { 1, 2, 3, 94, 0 }, [IEEE80211_MODE_STURBO_A]={ 1, 2, 3, 94, 0 }, + [IEEE80211_MODE_HALF] = { 1, 3, 4, 94, 0 }, + [IEEE80211_MODE_QUARTER]= { 1, 3, 4, 94, 0 }, [IEEE80211_MODE_11NA] = { 1, 3, 4, 94, 0 }, [IEEE80211_MODE_11NG] = { 1, 3, 4, 94, 0 }, }; @@ -761,6 +769,8 @@ static const struct phyParamType phyPara [IEEE80211_MODE_TURBO_A]= { 1, 2, 2, 47, 0 }, [IEEE80211_MODE_TURBO_G]= { 1, 2, 2, 47, 0 }, [IEEE80211_MODE_STURBO_A]={ 1, 2, 2, 47, 0 }, + [IEEE80211_MODE_HALF] = { 1, 2, 3, 47, 0 }, + [IEEE80211_MODE_QUARTER]= { 1, 2, 3, 47, 0 }, [IEEE80211_MODE_11NA] = { 1, 2, 3, 47, 0 }, [IEEE80211_MODE_11NG] = { 1, 2, 3, 47, 0 }, }; @@ -774,6 +784,8 @@ static const struct phyParamType bssPhyP [IEEE80211_MODE_TURBO_A]= { 2, 3, 10, 0, 0 }, [IEEE80211_MODE_TURBO_G]= { 2, 3, 10, 0, 0 }, [IEEE80211_MODE_STURBO_A]={ 2, 3, 10, 0, 0 }, + [IEEE80211_MODE_HALF] = { 3, 4, 10, 0, 0 }, + [IEEE80211_MODE_QUARTER]= { 3, 4, 10, 0, 0 }, [IEEE80211_MODE_11NA] = { 3, 4, 10, 0, 0 }, [IEEE80211_MODE_11NG] = { 3, 4, 10, 0, 0 }, }; @@ -786,6 +798,8 @@ static const struct phyParamType bssPhyP [IEEE80211_MODE_TURBO_A]= { 2, 2, 3, 94, 0 }, [IEEE80211_MODE_TURBO_G]= { 2, 2, 3, 94, 0 }, [IEEE80211_MODE_STURBO_A]={ 2, 2, 3, 94, 0 }, + [IEEE80211_MODE_HALF] = { 2, 3, 4, 94, 0 }, + [IEEE80211_MODE_QUARTER]= { 2, 3, 4, 94, 0 }, [IEEE80211_MODE_11NA] = { 2, 3, 4, 94, 0 }, [IEEE80211_MODE_11NG] = { 2, 3, 4, 94, 0 }, }; @@ -798,6 +812,8 @@ static const struct phyParamType bssPhyP [IEEE80211_MODE_TURBO_A]= { 1, 2, 2, 47, 0 }, [IEEE80211_MODE_TURBO_G]= { 1, 2, 2, 47, 0 }, [IEEE80211_MODE_STURBO_A]={ 1, 2, 2, 47, 0 }, + [IEEE80211_MODE_HALF] = { 2, 2, 3, 47, 0 }, + [IEEE80211_MODE_QUARTER]= { 2, 2, 3, 47, 0 }, [IEEE80211_MODE_11NA] = { 2, 2, 3, 47, 0 }, [IEEE80211_MODE_11NG] = { 2, 2, 3, 47, 0 }, }; @@ -930,6 +946,8 @@ ieee80211_wme_updateparams_locked(struct [IEEE80211_MODE_TURBO_A] = { 1, 3, 10, 64, 0 }, [IEEE80211_MODE_TURBO_G] = { 1, 3, 10, 64, 0 }, [IEEE80211_MODE_STURBO_A] = { 1, 3, 10, 64, 0 }, + [IEEE80211_MODE_HALF] = { 2, 4, 10, 64, 0 }, + [IEEE80211_MODE_QUARTER] = { 2, 4, 10, 64, 0 }, [IEEE80211_MODE_11NA] = { 2, 4, 10, 64, 0 }, /* XXXcheck*/ [IEEE80211_MODE_11NG] = { 2, 4, 10, 64, 0 }, /* XXXcheck*/ }; @@ -1016,6 +1034,8 @@ ieee80211_wme_updateparams_locked(struct [IEEE80211_MODE_TURBO_A] = 3, [IEEE80211_MODE_TURBO_G] = 3, [IEEE80211_MODE_STURBO_A] = 3, + [IEEE80211_MODE_HALF] = 3, + [IEEE80211_MODE_QUARTER] = 3, [IEEE80211_MODE_11NA] = 3, [IEEE80211_MODE_11NG] = 3, }; Modified: projects/vap7/sys/net80211/ieee80211_regdomain.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_regdomain.c Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/ieee80211_regdomain.c Thu Feb 19 05:52:14 2009 (r188799) @@ -214,7 +214,7 @@ ieee80211_alloc_countryie(struct ieee802 (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO | \ IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER) /* XXX what about auto? */ - /* flag set of channels to be excluded */ + /* flag set of channels to be excluded (band added below) */ static const int skipflags[IEEE80211_MODE_MAX] = { [IEEE80211_MODE_AUTO] = CHAN_UNINTERESTING, [IEEE80211_MODE_11A] = CHAN_UNINTERESTING, @@ -227,6 +227,10 @@ ieee80211_alloc_countryie(struct ieee802 [IEEE80211_MODE_TURBO_A] = CHAN_UNINTERESTING, [IEEE80211_MODE_TURBO_G] = CHAN_UNINTERESTING, [IEEE80211_MODE_STURBO_A] = CHAN_UNINTERESTING, + [IEEE80211_MODE_HALF] = IEEE80211_CHAN_TURBO + | IEEE80211_CHAN_STURBO, + [IEEE80211_MODE_QUARTER] = IEEE80211_CHAN_TURBO + | IEEE80211_CHAN_STURBO, [IEEE80211_MODE_11NA] = CHAN_UNINTERESTING, [IEEE80211_MODE_11NG] = CHAN_UNINTERESTING, }; Modified: projects/vap7/sys/net80211/ieee80211_scan.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_scan.c Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/ieee80211_scan.c Thu Feb 19 05:52:14 2009 (r188799) @@ -84,6 +84,8 @@ struct scan_state { #define ROAM_RATE_11A_DEFAULT 2*12 /* 11a bss */ #define ROAM_RATE_11B_DEFAULT 2*5 /* 11b bss */ #define ROAM_RATE_11BONLY_DEFAULT 2*1 /* 11b-only bss */ +#define ROAM_RATE_HALF_DEFAULT 2*6 /* half-width 11a/g bss */ +#define ROAM_RATE_QUARTER_DEFAULT 2*3 /* quarter-width 11a/g bss */ #define ROAM_MCS_11N_DEFAULT (1 | IEEE80211_RATE_MCS) /* 11n bss */ static void scan_restart_pwrsav(void *); @@ -141,6 +143,10 @@ static const struct ieee80211_roamparam .rate = ROAM_RATE_11A_DEFAULT }, [IEEE80211_MODE_STURBO_A]={ .rssi = ROAM_RSSI_11A_DEFAULT, .rate = ROAM_RATE_11A_DEFAULT }, + [IEEE80211_MODE_HALF] = { .rssi = ROAM_RSSI_11A_DEFAULT, + .rate = ROAM_RATE_HALF_DEFAULT }, + [IEEE80211_MODE_QUARTER]= { .rssi = ROAM_RSSI_11A_DEFAULT, + .rate = ROAM_RATE_QUARTER_DEFAULT }, [IEEE80211_MODE_11NA] = { .rssi = ROAM_RSSI_11A_DEFAULT, .rate = ROAM_MCS_11N_DEFAULT }, [IEEE80211_MODE_11NG] = { .rssi = ROAM_RSSI_11B_DEFAULT, Modified: projects/vap7/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_scan_sta.c Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/ieee80211_scan_sta.c Thu Feb 19 05:52:14 2009 (r188799) @@ -416,6 +416,8 @@ static const u_int chanflags[IEEE80211_M [IEEE80211_MODE_TURBO_A] = IEEE80211_CHAN_A, [IEEE80211_MODE_TURBO_G] = IEEE80211_CHAN_G, [IEEE80211_MODE_STURBO_A] = IEEE80211_CHAN_ST, + [IEEE80211_MODE_HALF] = IEEE80211_CHAN_HALF, + [IEEE80211_MODE_QUARTER] = IEEE80211_CHAN_QUARTER, /* check legacy */ [IEEE80211_MODE_11NA] = IEEE80211_CHAN_A, [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, Modified: projects/vap7/sys/net80211/ieee80211_tdma.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_tdma.c Thu Feb 19 05:51:29 2009 (r188798) +++ projects/vap7/sys/net80211/ieee80211_tdma.c Thu Feb 19 05:52:14 2009 (r188799) @@ -82,6 +82,12 @@ __FBSDID("$FreeBSD$"); #ifndef TDMA_TXRATE_STURBO_A_DEFAULT #define TDMA_TXRATE_STURBO_A_DEFAULT 2*24 #endif +#ifndef TDMA_TXRATE_HALF_DEFAULT +#define TDMA_TXRATE_HALF_DEFAULT 2*12 +#endif +#ifndef TDMA_TXRATE_QUARTER_DEFAULT +#define TDMA_TXRATE_QUARTER_DEFAULT 2*6 +#endif #ifndef TDMA_TXRATE_11NA_DEFAULT #define TDMA_TXRATE_11NA_DEFAULT (4 | IEEE80211_RATE_MCS) #endif @@ -148,6 +154,8 @@ ieee80211_tdma_vattach(struct ieee80211v settxparms(vap, IEEE80211_MODE_STURBO_A, TDMA_TXRATE_STURBO_A_DEFAULT); settxparms(vap, IEEE80211_MODE_11NA, TDMA_TXRATE_11NA_DEFAULT); settxparms(vap, IEEE80211_MODE_11NG, TDMA_TXRATE_11NG_DEFAULT); + settxparms(vap, IEEE80211_MODE_HALF, TDMA_TXRATE_HALF_DEFAULT); + settxparms(vap, IEEE80211_MODE_QUARTER, TDMA_TXRATE_QUARTER_DEFAULT); setackpolicy(vap->iv_ic, 1); /* disable ACK's */ From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:52:56 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 429801065676; Thu, 19 Feb 2009 05:52:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 145C88FC17; Thu, 19 Feb 2009 05:52:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5qtJi086774; Thu, 19 Feb 2009 05:52:55 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5qtJN086771; Thu, 19 Feb 2009 05:52:55 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190552.n1J5qtJN086771@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:52:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188800 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:52:56 -0000 Author: sam Date: Thu Feb 19 05:52:55 2009 New Revision: 188800 URL: http://svn.freebsd.org/changeset/base/188800 Log: merge r188783: remove private support for IEEE80211_MODE_HALF and IEEE80211_MODE_QUARTER now that net80211 has them Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/ath/if_ath.c projects/vap7/sys/dev/ath/if_athvar.h projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/if_ath.c ============================================================================== --- projects/vap7/sys/dev/ath/if_ath.c Thu Feb 19 05:52:14 2009 (r188799) +++ projects/vap7/sys/dev/ath/if_ath.c Thu Feb 19 05:52:55 2009 (r188800) @@ -5641,12 +5641,7 @@ ath_chan_change(struct ath_softc *sc, st * Change channels and update the h/w rate map * if we're switching; e.g. 11a to 11b/g. */ - if (IEEE80211_IS_CHAN_HALF(chan)) - mode = IEEE80211_MODE_HALF; - else if (IEEE80211_IS_CHAN_QUARTER(chan)) - mode = IEEE80211_MODE_QUARTER; - else - mode = ieee80211_chan2mode(chan); + mode = ieee80211_chan2mode(chan); if (mode != sc->sc_curmode) ath_setcurmode(sc, mode); sc->sc_curchan = chan; Modified: projects/vap7/sys/dev/ath/if_athvar.h ============================================================================== --- projects/vap7/sys/dev/ath/if_athvar.h Thu Feb 19 05:52:14 2009 (r188799) +++ projects/vap7/sys/dev/ath/if_athvar.h Thu Feb 19 05:52:55 2009 (r188800) @@ -259,9 +259,7 @@ struct ath_softc { uint32_t sc_eerd; /* regdomain from EEPROM */ uint32_t sc_eecc; /* country code from EEPROM */ /* rate tables */ -#define IEEE80211_MODE_HALF (IEEE80211_MODE_MAX+0) -#define IEEE80211_MODE_QUARTER (IEEE80211_MODE_MAX+1) - const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX+2]; + const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX]; const HAL_RATE_TABLE *sc_currates; /* current rate table */ enum ieee80211_phymode sc_curmode; /* current phy mode */ HAL_OPMODE sc_opmode; /* current operating mode */ From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:54:20 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B08B106564A; Thu, 19 Feb 2009 05:54:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88E1B8FC0A; Thu, 19 Feb 2009 05:54:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5sKoq086864; Thu, 19 Feb 2009 05:54:20 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5sKqQ086863; Thu, 19 Feb 2009 05:54:20 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190554.n1J5sKqQ086863@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188801 - projects/vap7/sbin/ifconfig X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:54:20 -0000 Author: sam Date: Thu Feb 19 05:54:20 2009 New Revision: 188801 URL: http://svn.freebsd.org/changeset/base/188801 Log: merge r188784: support 1/2 and 1/4-width channel modes Modified: projects/vap7/sbin/ifconfig/ (props changed) projects/vap7/sbin/ifconfig/ifieee80211.c Modified: projects/vap7/sbin/ifconfig/ifieee80211.c ============================================================================== --- projects/vap7/sbin/ifconfig/ifieee80211.c Thu Feb 19 05:52:55 2009 (r188800) +++ projects/vap7/sbin/ifconfig/ifieee80211.c Thu Feb 19 05:54:20 2009 (r188801) @@ -126,9 +126,19 @@ static void LINE_INIT(char c); static void LINE_BREAK(void); static void LINE_CHECK(const char *fmt, ...); -static const char *modename[] = { - "auto", "11a", "11b", "11g", "fh", "turboA", "turboG", - "sturbo", "11na", "11ng" +static const char *modename[IEEE80211_MODE_MAX] = { + [IEEE80211_MODE_AUTO] = "auto", + [IEEE80211_MODE_11A] = "11a", + [IEEE80211_MODE_11B] = "11b", + [IEEE80211_MODE_11G] = "11g", + [IEEE80211_MODE_FH] = "fh", + [IEEE80211_MODE_TURBO_A] = "turboA", + [IEEE80211_MODE_TURBO_G] = "turboG", + [IEEE80211_MODE_STURBO_A] = "sturbo", + [IEEE80211_MODE_11NA] = "11na", + [IEEE80211_MODE_11NG] = "11ng", + [IEEE80211_MODE_HALF] = "half", + [IEEE80211_MODE_QUARTER] = "quarter" }; static void set80211(int s, int type, int val, int len, void *data); @@ -357,6 +367,10 @@ chan2mode(const struct ieee80211_channel return IEEE80211_MODE_STURBO_A; if (IEEE80211_IS_CHAN_FHSS(c)) return IEEE80211_MODE_FH; + if (IEEE80211_IS_CHAN_HALF(c)) + return IEEE80211_MODE_HALF; + if (IEEE80211_IS_CHAN_QUARTER(c)) + return IEEE80211_MODE_QUARTER; if (IEEE80211_IS_CHAN_A(c)) return IEEE80211_MODE_11A; if (IEEE80211_IS_CHAN_ANYG(c)) @@ -1303,7 +1317,6 @@ getmodeflags(const char *val) case 'g': /* 802.11g */ flags |= IEEE80211_CHAN_G; break; - case 'h': /* ht = 802.11n */ case 'n': /* 802.11n */ flags |= IEEE80211_CHAN_HT; break; @@ -1318,6 +1331,12 @@ getmodeflags(const char *val) case 's': /* st = Atheros Static Turbo */ flags |= IEEE80211_CHAN_STURBO; break; + case 'h': /* 1/2-width channels */ + flags |= IEEE80211_CHAN_HALF; + break; + case 'q': /* 1/4-width channels */ + flags |= IEEE80211_CHAN_QUARTER; + break; default: errx(-1, "%s: Invalid mode attribute %c\n", val, *cp); @@ -1357,6 +1376,10 @@ getmodeflags(const char *val) _base.params[IEEE80211_MODE_11G]._param = _v; \ if ((_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B) \ _base.params[IEEE80211_MODE_11B]._param = _v; \ + if (_flags & IEEE80211_CHAN_HALF) \ + _base.params[IEEE80211_MODE_HALF]._param = _v; \ + if (_flags & IEEE80211_CHAN_QUARTER) \ + _base.params[IEEE80211_MODE_QUARTER]._param = _v; \ } while (0) #define _APPLY1(_flags, _base, _param, _v) do { \ if (_flags & IEEE80211_CHAN_HT) { \ @@ -1370,6 +1393,10 @@ getmodeflags(const char *val) _base.params[IEEE80211_MODE_TURBO_G]._param = _v; \ else if ((_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST) \ _base.params[IEEE80211_MODE_STURBO_A]._param = _v; \ + else if (_flags & IEEE80211_CHAN_HALF) \ + _base.params[IEEE80211_MODE_HALF]._param = _v; \ + else if (_flags & IEEE80211_CHAN_QUARTER) \ + _base.params[IEEE80211_MODE_QUARTER]._param = _v; \ else if ((_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A) \ _base.params[IEEE80211_MODE_11A]._param = _v; \ else if ((_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G) \ @@ -1379,50 +1406,15 @@ getmodeflags(const char *val) } while (0) #define _APPLY_RATE(_flags, _base, _param, _v) do { \ if (_flags & IEEE80211_CHAN_HT) { \ - if ((_flags & (IEEE80211_CHAN_5GHZ|IEEE80211_CHAN_2GHZ)) == 0) {\ - _base.params[IEEE80211_MODE_11NA]._param = _v|0x80; \ - _base.params[IEEE80211_MODE_11NG]._param = _v|0x80; \ - } else if (_flags & IEEE80211_CHAN_5GHZ) \ - _base.params[IEEE80211_MODE_11NA]._param = _v|0x80; \ - else \ - _base.params[IEEE80211_MODE_11NG]._param = _v|0x80; \ + (_v) = (_v / 2) | IEEE80211_RATE_MCS; \ } \ - if (_flags & IEEE80211_CHAN_TURBO) { \ - if ((_flags & (IEEE80211_CHAN_5GHZ|IEEE80211_CHAN_2GHZ)) == 0) {\ - _base.params[IEEE80211_MODE_TURBO_A]._param = 2*_v; \ - _base.params[IEEE80211_MODE_TURBO_G]._param = 2*_v; \ - } else if (_flags & IEEE80211_CHAN_5GHZ) \ - _base.params[IEEE80211_MODE_TURBO_A]._param = 2*_v; \ - else \ - _base.params[IEEE80211_MODE_TURBO_G]._param = 2*_v; \ - } \ - if (_flags & IEEE80211_CHAN_STURBO) \ - _base.params[IEEE80211_MODE_STURBO_A]._param = 2*_v; \ - if ((_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A) \ - _base.params[IEEE80211_MODE_11A]._param = 2*_v; \ - if ((_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G) \ - _base.params[IEEE80211_MODE_11G]._param = (_v == 5 ? 11 : 2*_v);\ - if ((_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B) \ - _base.params[IEEE80211_MODE_11B]._param = (_v == 5 ? 11 : 2*_v);\ + _APPLY(_flags, _base, _param, _v); \ } while (0) #define _APPLY_RATE1(_flags, _base, _param, _v) do { \ if (_flags & IEEE80211_CHAN_HT) { \ - if (_flags & IEEE80211_CHAN_5GHZ) \ - _base.params[IEEE80211_MODE_11NA]._param = _v|0x80; \ - else \ - _base.params[IEEE80211_MODE_11NG]._param = _v|0x80; \ - } else if ((_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A) \ - _base.params[IEEE80211_MODE_TURBO_A]._param = 2*_v; \ - else if ((_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G) \ - _base.params[IEEE80211_MODE_TURBO_G]._param = 2*_v; \ - else if ((_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST) \ - _base.params[IEEE80211_MODE_STURBO_A]._param = 2*_v; \ - else if ((_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A) \ - _base.params[IEEE80211_MODE_11A]._param = 2*_v; \ - else if ((_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G) \ - _base.params[IEEE80211_MODE_11G]._param = (_v == 5 ? 11 : 2*_v);\ - else if ((_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B) \ - _base.params[IEEE80211_MODE_11B]._param = (_v == 5 ? 11 : 2*_v);\ + (_v) = (_v / 2) | IEEE80211_RATE_MCS; \ + } \ + _APPLY1(_flags, _base, _param, _v); \ } while (0) static @@ -1444,55 +1436,70 @@ DECL_CMD_FUNC(set80211roamrssi, val, d) callback_register(setroam_cb, &roamparams); } +static int +getrate(const char *val, const char *tag) +{ + double v = atof(val); + int rate; + + rate = (int) (2*v); + if (rate != 2*v) + errx(-1, "invalid %s rate (must be .5 Mb/s units)", tag); + return rate; /* NB: returns 2x the specified value */ +} + static DECL_CMD_FUNC(set80211roamrate, val, d) { - int v = atoi(val), flags; + int rate, flags; + rate = getrate(val, "roam"); flags = getmodeflags(val); getroam(s); if (flags == 0) { /* NB: no flags => current channel */ flags = getcurchan(s)->ic_flags; - _APPLY_RATE1(flags, roamparams, rate, v); + _APPLY_RATE1(flags, roamparams, rate, rate); } else - _APPLY_RATE(flags, roamparams, rate, v); + _APPLY_RATE(flags, roamparams, rate, rate); callback_register(setroam_cb, &roamparams); } static DECL_CMD_FUNC(set80211mcastrate, val, d) { - int v = atoi(val), flags; + int rate, flags; + rate = getrate(val, "mcast"); flags = getmodeflags(val); gettxparams(s); if (flags == 0) { /* NB: no flags => current channel */ flags = getcurchan(s)->ic_flags; - _APPLY_RATE1(flags, txparams, mcastrate, v); + _APPLY_RATE1(flags, txparams, mcastrate, rate); } else - _APPLY_RATE(flags, txparams, mcastrate, v); + _APPLY_RATE(flags, txparams, mcastrate, rate); callback_register(settxparams_cb, &txparams); } static DECL_CMD_FUNC(set80211mgtrate, val, d) { - int v = atoi(val), flags; + int rate, flags; + rate = getrate(val, "mgmt"); flags = getmodeflags(val); gettxparams(s); if (flags == 0) { /* NB: no flags => current channel */ flags = getcurchan(s)->ic_flags; - _APPLY_RATE1(flags, txparams, mgmtrate, v); + _APPLY_RATE1(flags, txparams, mgmtrate, rate); } else - _APPLY_RATE(flags, txparams, mgmtrate, v); + _APPLY_RATE(flags, txparams, mgmtrate, rate); callback_register(settxparams_cb, &txparams); } static DECL_CMD_FUNC(set80211ucastrate, val, d) { - int v, flags; + int flags; gettxparams(s); flags = getmodeflags(val); @@ -1505,12 +1512,12 @@ DECL_CMD_FUNC(set80211ucastrate, val, d) _APPLY(flags, txparams, ucastrate, IEEE80211_FIXED_RATE_NONE); } else { - v = atoi(val); + int rate = getrate(val, "ucast"); if (flags == 0) { /* NB: no flags => current channel */ flags = getcurchan(s)->ic_flags; - _APPLY_RATE1(flags, txparams, ucastrate, v); + _APPLY_RATE1(flags, txparams, ucastrate, rate); } else - _APPLY_RATE(flags, txparams, ucastrate, v); + _APPLY_RATE(flags, txparams, ucastrate, rate); } callback_register(settxparams_cb, &txparams); } @@ -3518,27 +3525,27 @@ list_roam(int s) int mode; getroam(s); - for (mode = IEEE80211_MODE_11A; mode < IEEE80211_MODE_11NA; mode++) { - rp = &roamparams.params[mode]; - if (rp->rssi == 0 && rp->rate == 0) - continue; - if (rp->rssi & 1) - LINE_CHECK("roam:%-6.6s rssi %2u.5dBm rate %2u Mb/s", - modename[mode], rp->rssi/2, rp->rate/2); - else - LINE_CHECK("roam:%-6.6s rssi %4udBm rate %2u Mb/s", - modename[mode], rp->rssi/2, rp->rate/2); - } - for (; mode < IEEE80211_MODE_MAX; mode++) { + for (mode = IEEE80211_MODE_11A; mode < IEEE80211_MODE_MAX; mode++) { rp = &roamparams.params[mode]; if (rp->rssi == 0 && rp->rate == 0) continue; - if (rp->rssi & 1) - LINE_CHECK("roam:%-6.6s rssi %2u.5dBm MCS %2u ", - modename[mode], rp->rssi/2, rp->rate &~ 0x80); - else - LINE_CHECK("roam:%-6.6s rssi %4udBm MCS %2u ", - modename[mode], rp->rssi/2, rp->rate &~ 0x80); + if (mode == IEEE80211_MODE_11NA || mode == IEEE80211_MODE_11NG) { + if (rp->rssi & 1) + LINE_CHECK("roam:%-7.7s rssi %2u.5dBm MCS %2u ", + modename[mode], rp->rssi/2, + rp->rate &~ IEEE80211_RATE_MCS); + else + LINE_CHECK("roam:%-7.7s rssi %4udBm MCS %2u ", + modename[mode], rp->rssi/2, + rp->rate &~ IEEE80211_RATE_MCS); + } else { + if (rp->rssi & 1) + LINE_CHECK("roam:%-7.7s rssi %2u.5dBm rate %2u Mb/s", + modename[mode], rp->rssi/2, rp->rate/2); + else + LINE_CHECK("roam:%-7.7s rssi %4udBm rate %2u Mb/s", + modename[mode], rp->rssi/2, rp->rate/2); + } } } @@ -3549,36 +3556,40 @@ list_txparams(int s) int mode; gettxparams(s); - for (mode = IEEE80211_MODE_11A; mode < IEEE80211_MODE_11NA; mode++) { - tp = &txparams.params[mode]; - if (tp->mgmtrate == 0 && tp->mcastrate == 0) - continue; - if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) - LINE_CHECK("%-6.6s ucast NONE mgmt %2u Mb/s " - "mcast %2u Mb/s maxretry %u", - modename[mode], tp->mgmtrate/2, - tp->mcastrate/2, tp->maxretry); - else - LINE_CHECK("%-6.6s ucast %2u Mb/s mgmt %2u Mb/s " - "mcast %2u Mb/s maxretry %u", - modename[mode], tp->ucastrate/2, tp->mgmtrate/2, - tp->mcastrate/2, tp->maxretry); - } - for (; mode < IEEE80211_MODE_MAX; mode++) { + for (mode = IEEE80211_MODE_11A; mode < IEEE80211_MODE_MAX; mode++) { tp = &txparams.params[mode]; if (tp->mgmtrate == 0 && tp->mcastrate == 0) continue; - if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) - LINE_CHECK("%-6.6s ucast NONE mgmt %2u MCS " - "mcast %2u MCS maxretry %u", - modename[mode], tp->mgmtrate &~ 0x80, - tp->mcastrate &~ 0x80, tp->maxretry); - else - LINE_CHECK("%-6.6s ucast %2u MCS mgmt %2u MCS " - "mcast %2u MCS maxretry %u", - modename[mode], tp->ucastrate &~ 0x80, - tp->mgmtrate &~ 0x80, - tp->mcastrate &~ 0x80, tp->maxretry); + if (mode == IEEE80211_MODE_11NA || mode == IEEE80211_MODE_11NG) { + if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) + LINE_CHECK("%-7.7s ucast NONE mgmt %2u MCS " + "mcast %2u MCS maxretry %u", + modename[mode], + tp->mgmtrate &~ IEEE80211_RATE_MCS, + tp->mcastrate &~ IEEE80211_RATE_MCS, + tp->maxretry); + else + LINE_CHECK("%-7.7s ucast %2u MCS mgmt %2u MCS " + "mcast %2u MCS maxretry %u", + modename[mode], + tp->ucastrate &~ IEEE80211_RATE_MCS, + tp->mgmtrate &~ IEEE80211_RATE_MCS, + tp->mcastrate &~ IEEE80211_RATE_MCS, + tp->maxretry); + } else { + if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) + LINE_CHECK("%-7.7s ucast NONE mgmt %2u Mb/s " + "mcast %2u Mb/s maxretry %u", + modename[mode], + tp->mgmtrate/2, + tp->mcastrate/2, tp->maxretry); + else + LINE_CHECK("%-7.7s ucast %2u Mb/s mgmt %2u Mb/s " + "mcast %2u Mb/s maxretry %u", + modename[mode], + tp->ucastrate/2, tp->mgmtrate/2, + tp->mcastrate/2, tp->maxretry); + } } } @@ -3880,14 +3891,16 @@ printkey(const struct ieee80211req_key * static void printrate(const char *tag, int v, int defrate, int defmcs) { - if (v == 11) - LINE_CHECK("%s 5.5", tag); - else if (v & 0x80) { + if ((v & IEEE80211_RATE_MCS) == 0) { + if (v != defrate) { + if (v & 1) + LINE_CHECK("%s %d.5", tag, v/2); + else + LINE_CHECK("%s %d", tag, v/2); + } + } else { if (v != defmcs) LINE_CHECK("%s %d", tag, v &~ 0x80); - } else { - if (v != defrate) - LINE_CHECK("%s %d", tag, v/2); } } @@ -4180,8 +4193,10 @@ end: tp = &txparams.params[chan2mode(c)]; printrate("ucastrate", tp->ucastrate, IEEE80211_FIXED_RATE_NONE, IEEE80211_FIXED_RATE_NONE); - printrate("mcastrate", tp->mcastrate, 2*1, 0x80|0); - printrate("mgmtrate", tp->mgmtrate, 2*1, 0x80|0); + printrate("mcastrate", tp->mcastrate, 2*1, + IEEE80211_RATE_MCS|0); + printrate("mgmtrate", tp->mgmtrate, 2*1, + IEEE80211_RATE_MCS|0); if (tp->maxretry != 6) /* XXX */ LINE_CHECK("maxretry %d", tp->maxretry); } else { From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 05:59:50 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4B2C106566B; Thu, 19 Feb 2009 05:59:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C169A8FC23; Thu, 19 Feb 2009 05:59:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J5xoaS087054; Thu, 19 Feb 2009 05:59:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J5xoYl087053; Thu, 19 Feb 2009 05:59:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190559.n1J5xoYl087053@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 05:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188802 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 05:59:51 -0000 Author: sam Date: Thu Feb 19 05:59:50 2009 New Revision: 188802 URL: http://svn.freebsd.org/changeset/base/188802 Log: merge r188500,r188504: fix typo in AH_CHIP definition Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ah_internal.h projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ah_internal.h Thu Feb 19 05:54:20 2009 (r188801) +++ projects/vap7/sys/dev/ath/ath_hal/ah_internal.h Thu Feb 19 05:59:50 2009 (r188802) @@ -84,12 +84,12 @@ struct ath_hal_chip { }; #ifndef AH_CHIP #define AH_CHIP(_name, _probe, _attach) \ -static struct ath_hal_chip name##_chip = { \ +static struct ath_hal_chip _name##_chip = { \ .name = #_name, \ .probe = _probe, \ .attach = _attach \ }; \ -OS_DATA_SET(ah_chips, name##_chip) +OS_DATA_SET(ah_chips, _name##_chip) #endif /* From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 06:01:27 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DAFB106564A; Thu, 19 Feb 2009 06:01:27 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 500CC8FC18; Thu, 19 Feb 2009 06:01:27 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J61Rvt087176; Thu, 19 Feb 2009 06:01:27 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J61RuA087174; Thu, 19 Feb 2009 06:01:27 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190601.n1J61RuA087174@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 06:01:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188803 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 06:01:27 -0000 Author: sam Date: Thu Feb 19 06:01:26 2009 New Revision: 188803 URL: http://svn.freebsd.org/changeset/base/188803 Log: merge r188084: fix building w/ AH_DEBUG Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ah_regdomain.c projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ah_regdomain.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ah_regdomain.c Thu Feb 19 05:59:50 2009 (r188802) +++ projects/vap7/sys/dev/ath/ath_hal/ah_regdomain.c Thu Feb 19 06:01:26 2009 (r188803) @@ -2233,7 +2233,7 @@ assignPrivateChannels(struct ath_hal *ah /* new entry, assign a private channel entry */ if (next >= N(AH_PRIVATE(ah)->ah_channels)) { HALDEBUG(ah, HAL_DEBUG_ANY, - "%s: too many channels, max %u\n", + "%s: too many channels, max %zu\n", __func__, N(AH_PRIVATE(ah)->ah_channels)); return AH_FALSE; } Modified: projects/vap7/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Feb 19 05:59:50 2009 (r188802) +++ projects/vap7/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Feb 19 06:01:26 2009 (r188803) @@ -392,7 +392,7 @@ ar5416PerCalibrationN(struct ath_hal *ah HAL_CAL_LIST *currCal = cal->cal_curr; HAL_CHANNEL_INTERNAL *ichan; - OS_MARK(ah, AH_MARK_PERCAL, chan->channel); + OS_MARK(ah, AH_MARK_PERCAL, chan->ic_freq); *isCalDone = AH_TRUE; From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 06:02:32 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 034801065676; Thu, 19 Feb 2009 06:02:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3C2D8FC1B; Thu, 19 Feb 2009 06:02:31 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J62VL3087249; Thu, 19 Feb 2009 06:02:31 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J62VAt087248; Thu, 19 Feb 2009 06:02:31 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190602.n1J62VAt087248@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 06:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188804 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 06:02:32 -0000 Author: sam Date: Thu Feb 19 06:02:31 2009 New Revision: 188804 URL: http://svn.freebsd.org/changeset/base/188804 Log: merge r188012: unbreak ar2425 Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212.h projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Feb 19 06:01:26 2009 (r188803) +++ projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Feb 19 06:02:31 2009 (r188804) @@ -398,10 +398,11 @@ struct ath_hal_5212 { (_chan)->ic_flags &= ~IEEE80211_CHAN_CCK; \ (_chan)->ic_flags |= IEEE80211_CHAN_DYN; \ (_flag) = AH_TRUE; \ - } \ + } else \ + (_flag) = AH_FALSE; \ } while (0) #define RESTORE_CCK(_ah, _chan, _flag) do { \ - if ((IS_2425(_ah) || IS_2417(_ah)) && (_flag)) { \ + if ((_flag) && (IS_2425(_ah) || IS_2417(_ah))) { \ (_chan)->ic_flags &= ~IEEE80211_CHAN_DYN; \ (_chan)->ic_flags |= IEEE80211_CHAN_CCK; \ } \ From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 06:03:38 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C28BD1065676; Thu, 19 Feb 2009 06:03:38 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF0A78FC28; Thu, 19 Feb 2009 06:03:38 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J63c5X087320; Thu, 19 Feb 2009 06:03:38 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J63c9O087319; Thu, 19 Feb 2009 06:03:38 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190603.n1J63c9O087319@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 06:03:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188805 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 06:03:39 -0000 Author: sam Date: Thu Feb 19 06:03:38 2009 New Revision: 188805 URL: http://svn.freebsd.org/changeset/base/188805 Log: merge r188011: unbreak swan/nala Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c Thu Feb 19 06:02:31 2009 (r188804) +++ projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c Thu Feb 19 06:03:38 2009 (r188805) @@ -954,7 +954,7 @@ ar5212PerCalibrationN(struct ath_hal *ah int32_t qCoff, qCoffDenom; int32_t iqCorrMeas, iCoff, iCoffDenom; uint32_t powerMeasQ, powerMeasI; - HAL_BOOL isBmode; + HAL_BOOL isBmode = AH_FALSE; OS_MARK(ah, AH_MARK_PERCAL, chan->ic_freq); *isCalDone = AH_FALSE; From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 06:04:46 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5DE0106566B; Thu, 19 Feb 2009 06:04:46 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2DC28FC1F; Thu, 19 Feb 2009 06:04:46 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J64kO7087404; Thu, 19 Feb 2009 06:04:46 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J64kfo087403; Thu, 19 Feb 2009 06:04:46 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902190604.n1J64kfo087403@svn.freebsd.org> From: Sam Leffler Date: Thu, 19 Feb 2009 06:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188806 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 06:04:47 -0000 Author: sam Date: Thu Feb 19 06:04:46 2009 New Revision: 188806 URL: http://svn.freebsd.org/changeset/base/188806 Log: merge r188549: Recognize AR5212_AR2317_REV2 in ar5312Probe() Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c Thu Feb 19 06:03:38 2009 (r188805) +++ projects/vap7/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c Thu Feb 19 06:04:46 2009 (r188806) @@ -321,6 +321,7 @@ ar5312Probe(uint16_t vendorid, uint16_t case AR5212_AR2315_REV7: return "Atheros 2315 WiSoC"; case AR5212_AR2317_REV1: + case AR5212_AR2317_REV2: return "Atheros 2317 WiSoC"; case AR5212_AR2413: return "Atheros 2413"; From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 06:20:30 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EFAF106564A; Thu, 19 Feb 2009 06:20:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D5708FC08; Thu, 19 Feb 2009 06:20:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J6KUK3087797; Thu, 19 Feb 2009 06:20:30 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J6KUTE087796; Thu, 19 Feb 2009 06:20:30 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902190620.n1J6KUTE087796@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 19 Feb 2009 06:20:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188807 - projects/mips/sys/mips/atheros X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 06:20:30 -0000 Author: gonzo Date: Thu Feb 19 06:20:30 2009 New Revision: 188807 URL: http://svn.freebsd.org/changeset/base/188807 Log: - Add PLL, reset, ethernet and DMA registers/values Modified: projects/mips/sys/mips/atheros/ar71xxreg.h Modified: projects/mips/sys/mips/atheros/ar71xxreg.h ============================================================================== --- projects/mips/sys/mips/atheros/ar71xxreg.h Thu Feb 19 06:04:46 2009 (r188806) +++ projects/mips/sys/mips/atheros/ar71xxreg.h Thu Feb 19 06:20:30 2009 (r188807) @@ -101,6 +101,21 @@ #define AR71XX_UART_ADDR 0x18020000 +#define AR71XX_PLL_CPU_CONFIG 0x18050000 +#define AR71XX_PLL_SEC_CONFIG 0x18050004 +#define AR71XX_PLL_CPU_CLK_CTRL 0x18050008 +#define AR71XX_PLL_ETH_INT0_CLK 0x18050010 +#define AR71XX_PLL_ETH_INT1_CLK 0x18050014 +#define XPLL_ETH_INT_CLK_10 0x00991099 +#define XPLL_ETH_INT_CLK_100 0x00441011 +#define XPLL_ETH_INT_CLK_1000 0x13110000 +#define XPLL_ETH_INT_CLK_1000_GMII 0x14110000 +#define PLL_ETH_INT_CLK_10 0x00991099 +#define PLL_ETH_INT_CLK_100 0x00001099 +#define PLL_ETH_INT_CLK_1000 0x00110000 +#define AR71XX_PLL_ETH_EXT_CLK 0x18050018 +#define AR71XX_PLL_PCI_CLK 0x1805001C + /* * APB interrupt status and mask register and interrupt bit numbers for */ @@ -120,9 +135,155 @@ #define PCI_INTR_CORE (1 << 4) #define AR71XX_RST_RESET 0x18060024 -#define RST_RESET_PCI_CORE (1 << 0) -#define RST_RESET_PCI_BUS (1 << 1) -#define RST_RESET_CPU_COLD (1 << 20) /* Cold reset */ #define RST_RESET_FULL_CHIP (1 << 24) /* Same as pulling the reset pin */ +#define RST_RESET_CPU_COLD (1 << 20) /* Cold reset */ +#define RST_RESET_GE1_MAC (1 << 13) +#define RST_RESET_GE1_PHY (1 << 12) +#define RST_RESET_GE0_MAC (1 << 9) +#define RST_RESET_GE0_PHY (1 << 8) +#define RST_RESET_PCI_BUS (1 << 1) +#define RST_RESET_PCI_CORE (1 << 0) + +/* + * GigE adapters region + */ +#define AR71XX_MAC0_BASE 0x19000000 +#define AR71XX_MAC1_BASE 0x1A000000 + +#define AR71XX_MAC_CFG1 0x00 +#define MAC_CFG1_SOFT_RESET (1 << 31) +#define MAC_CFG1_SIMUL_RESET (1 << 30) +#define MAC_CFG1_MAC_RX_BLOCK_RESET (1 << 19) +#define MAC_CFG1_MAC_TX_BLOCK_RESET (1 << 18) +#define MAC_CFG1_RX_FUNC_RESET (1 << 17) +#define MAC_CFG1_TX_FUNC_RESET (1 << 16) +#define MAC_CFG1_LOOPBACK (1 << 8) +#define MAC_CFG1_RXFLOW_CTRL (1 << 5) +#define MAC_CFG1_TXFLOW_CTRL (1 << 4) +#define MAC_CFG1_SYNC_RX (1 << 3) +#define MAC_CFG1_RX_ENABLE (1 << 2) +#define MAC_CFG1_SYNC_TX (1 << 1) +#define MAC_CFG1_TX_ENABLE (1 << 0) +#define AR71XX_MAC_CFG2 0x04 +#define MAC_CFG2_PREAMBLE_LEN_MASK 0xf +#define MAC_CFG2_PREAMBLE_LEN_SHIFT 12 +#define MAC_CFG2_IFACE_MODE_1000 (2 << 8) +#define MAC_CFG2_IFACE_MODE_10_100 (1 << 8) +#define MAC_CFG2_IFACE_MODE_SHIFT 8 +#define MAC_CFG2_IFACE_MODE_MASK 3 +#define MAC_CFG2_HUGE_FRAME (1 << 5) +#define MAC_CFG2_LENGTH_FIELD (1 << 4) +#define MAC_CFG2_ENABLE_PADCRC (1 << 2) +#define MAC_CFG2_ENABLE_CRC (1 << 1) +#define MAC_CFG2_FULL_DUPLEX (1 << 0) +#define AR71XX_MAC_IFG 0x08 +#define AR71XX_MAC_HDUPLEX 0x0C +#define AR71XX_MAC_MAX_FRAME_LEN 0x10 +#define AR71XX_MAC_MII_CFG 0x20 +#define MAC_MII_CFG_RESET (1 << 31) +#define MAC_MII_CFG_SCAN_AUTO_INC (1 << 5) +#define MAC_MII_CFG_PREAMBLE_SUP (1 << 4) +#define MAC_MII_CFG_CLOCK_SELECT_MASK 0x7 +#define MAC_MII_CFG_CLOCK_DIV_4 0 +#define MAC_MII_CFG_CLOCK_DIV_6 2 +#define MAC_MII_CFG_CLOCK_DIV_8 3 +#define MAC_MII_CFG_CLOCK_DIV_10 4 +#define MAC_MII_CFG_CLOCK_DIV_14 5 +#define MAC_MII_CFG_CLOCK_DIV_20 6 +#define MAC_MII_CFG_CLOCK_DIV_28 7 +#define AR71XX_MAC_MII_CMD 0x24 +#define MAC_MII_CMD_SCAN_CYCLE (1 << 1) +#define MAC_MII_CMD_READ 1 +#define MAC_MII_CMD_WRITE 0 +#define AR71XX_MAC_MII_ADDR 0x28 +#define MAC_MII_PHY_ADDR_SHIFT 8 +#define MAC_MII_PHY_ADDR_MASK 0xff +#define MAC_MII_REG_MASK 0x1f +#define AR71XX_MAC_MII_CONTROL 0x2C +#define MAC_MII_CONTROL_MASK 0xffff +#define AR71XX_MAC_MII_STATUS 0x30 +#define MAC_MII_STATUS_MASK 0xffff +#define AR71XX_MAC_MII_INDICATOR 0x34 +#define MAC_MII_INDICATOR_NOT_VALID (1 << 2) +#define MAC_MII_INDICATOR_SCANNING (1 << 1) +#define MAC_MII_INDICATOR_BUSY (1 << 0) +#define AR71XX_MAC_IFCONTROL 0x38 +#define MAC_IFCONTROL_SPEED (1 << 16) +#define AR71XX_MAC_STA_ADDR1 0x40 +#define AR71XX_MAC_STA_ADDR2 0x44 +#define AR71XX_MAC_FIFO_CFG0 0x48 +#define FIFO_CFG0_TX_FABRIC (1 << 4) +#define FIFO_CFG0_TX_SYSTEM (1 << 3) +#define FIFO_CFG0_RX_FABRIC (1 << 2) +#define FIFO_CFG0_RX_SYSTEM (1 << 1) +#define FIFO_CFG0_WATERMARK (1 << 0) +#define FIFO_CFG0_ALL ((1 << 5) - 1) +#define FIFO_CFG0_ENABLE_SHIFT 8 +#define AR71XX_MAC_FIFO_CFG1 0x4C +#define AR71XX_MAC_FIFO_CFG2 0x50 +#define AR71XX_MAC_FIFO_TX_THRESHOLD 0x54 +#define AR71XX_MAC_FIFO_RX_FILTMATCH 0x58 +#define FIFO_RX_FILTMATCH_ALL ((1 << 18) - 1) +#define AR71XX_MAC_FIFO_RX_FILTMASK 0x5C +#define FIFO_RX_FILTMASK_BYTE_MODE (1 << 19) +#define FIFO_RX_FILTMASK_NO_SHORT_FRAME (1 << 18) +#define FIFO_RX_FILTMASK_ALL ((1 << 20) - 1) +/* + * These flags applicable both to AR71XX_MAC_FIFO_RX_FILTMASK and + * to AR71XX_MAC_FIFO_RX_FILTMATCH + */ +#define FIFO_RX_FILT_UNICAST (1 << 17) +#define FIFO_RX_FILT_TRUNC_FRAME (1 << 16) +#define FIFO_RX_FILT_VLAN_TAG (1 << 15) +#define FIFO_RX_FILT_UNSUP_OPCODE (1 << 14) +#define FIFO_RX_FILT_PAUSE_FRAME (1 << 13) +#define FIFO_RX_FILT_CTRL_FRAME (1 << 12) +#define FIFO_RX_FILT_LONG_EVENT (1 << 11) +#define FIFO_RX_FILT_DRIBBLE_NIBBLE (1 << 10) +#define FIFO_RX_FILT_BCAST (1 << 9) +#define FIFO_RX_FILT_MCAST (1 << 8) +#define FIFO_RX_FILT_OK (1 << 7) +#define FIFO_RX_FILT_OORANGE (1 << 6) +#define FIFO_RX_FILT_LEN_MSMTCH (1 << 5) +#define FIFO_RX_FILT_CRC_ERROR (1 << 4) +#define FIFO_RX_FILT_CODE_ERROR (1 << 3) +#define FIFO_RX_FILT_FALSE_CARRIER (1 << 2) +#define FIFO_RX_FILT_RX_DV_EVENT (1 << 1) +#define FIFO_RX_FILT_DROP_EVENT (1 << 0) +#define AR71XX_MAC_FIFO_RAM0 0x60 +#define AR71XX_MAC_FIFO_RAM1 0x64 +#define AR71XX_MAC_FIFO_RAM2 0x68 +#define AR71XX_MAC_FIFO_RAM3 0x6C +#define AR71XX_MAC_FIFO_RAM4 0x70 +#define AR71XX_MAC_FIFO_RAM5 0x74 +#define AR71XX_MAC_FIFO_RAM6 0x78 +#define AR71XX_DMA_TX_CONTROL 0x180 +#define DMA_TX_CONTROL_EN (1 << 0) +#define AR71XX_DMA_TX_DESC 0x184 +#define AR71XX_DMA_TX_STATUS 0x188 +#define DMA_TX_STATUS_PCOUNT_MASK 0xff +#define DMA_TX_STATUS_PCOUNT_SHIFT 16 +#define DMA_TX_STATUS_BUS_ERROR (1 << 3) +#define DMA_TX_STATUS_UNDERRUN (1 << 1) +#define DMA_TX_STATUS_PKT_SENT (1 << 0) +#define AR71XX_DMA_RX_CONTROL 0x18C +#define DMA_RX_CONTROL_EN (1 << 0) +#define AR71XX_DMA_RX_DESC 0x190 +#define AR71XX_DMA_RX_STATUS 0x194 +#define DMA_RX_STATUS_PCOUNT_MASK 0xff +#define DMA_RX_STATUS_PCOUNT_SHIFT 16 +#define DMA_RX_STATUS_BUS_ERROR (1 << 3) +#define DMA_RX_STATUS_OVERFLOW (1 << 1) +#define DMA_RX_STATUS_PKT_RECVD (1 << 0) +#define AR71XX_DMA_INTR 0x198 +#define AR71XX_DMA_INTR_STATUS 0x19C +#define DMA_INTR_ALL ((1 << 8) - 1) +#define DMA_INTR_RX_BUS_ERROR (1 << 7) +#define DMA_INTR_RX_OVERFLOW (1 << 6) +#define DMA_INTR_RX_PKT_RCVD (1 << 4) +#define DMA_INTR_TX_BUS_ERROR (1 << 3) +#define DMA_INTR_TX_UNDERRUN (1 << 1) +#define DMA_INTR_TX_PKT_SENT (1 << 0) + #endif /* _AR71XX_REG_H_ */ From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 06:23:57 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E7D01065670; Thu, 19 Feb 2009 06:23:57 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B51C8FC13; Thu, 19 Feb 2009 06:23:57 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J6NvYk087916; Thu, 19 Feb 2009 06:23:57 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J6Nv66087914; Thu, 19 Feb 2009 06:23:57 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902190623.n1J6Nv66087914@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 19 Feb 2009 06:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188808 - projects/mips/sys/mips/atheros X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 06:23:57 -0000 Author: gonzo Date: Thu Feb 19 06:23:56 2009 New Revision: 188808 URL: http://svn.freebsd.org/changeset/base/188808 Log: - Driver for on-board AR71XX ethernet Added: projects/mips/sys/mips/atheros/if_arge.c projects/mips/sys/mips/atheros/if_argevar.h Added: projects/mips/sys/mips/atheros/if_arge.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mips/sys/mips/atheros/if_arge.c Thu Feb 19 06:23:56 2009 (r188808) @@ -0,0 +1,1657 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * AR71XX gigabit ethernet driver + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +MODULE_DEPEND(arge, ether, 1, 1, 1); +MODULE_DEPEND(arge, miibus, 1, 1, 1); + +#include "miibus_if.h" + +#include +#include + +#undef ARGE_DEBUG +#ifdef ARGE_DEBUG +#define dprintf printf +#else +#define dprintf(x, arg...) +#endif + +static int arge_attach(device_t); +static int arge_detach(device_t); +static int arge_fix_chain(struct mbuf **mp); +static void arge_flush_ddr(struct arge_softc *); +static int arge_ifmedia_upd(struct ifnet *); +static void arge_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static int arge_ioctl(struct ifnet *, u_long, caddr_t); +static void arge_init(void *); +static void arge_init_locked(struct arge_softc *); +static void arge_link_task(void *, int); +static int arge_miibus_readreg(device_t, int, int); +static void arge_miibus_statchg(device_t); +static int arge_miibus_writereg(device_t, int, int, int); +static int arge_probe(device_t); +static void arge_reset_dma(struct arge_softc *); +static int arge_resume(device_t); +static int arge_rx_ring_init(struct arge_softc *); +static int arge_tx_ring_init(struct arge_softc *); +static void arge_shutdown(device_t); +static void arge_start(struct ifnet *); +static void arge_start_locked(struct ifnet *); +static void arge_stop(struct arge_softc *); +static int arge_suspend(device_t); + +static void arge_rx_locked(struct arge_softc *); +static void arge_tx_locked(struct arge_softc *); +static void arge_intr(void *); +static int arge_intr_filter(void *); +static void arge_tx_intr(struct arge_softc *, uint32_t); +static void arge_rx_intr(struct arge_softc *, uint32_t); +static void arge_tick(void *); + +static void arge_dmamap_cb(void *, bus_dma_segment_t *, int, int); +static int arge_dma_alloc(struct arge_softc *); +static void arge_dma_free(struct arge_softc *); +static int arge_newbuf(struct arge_softc *, int); +static __inline void arge_fixup_rx(struct mbuf *); + +static device_method_t arge_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, arge_probe), + DEVMETHOD(device_attach, arge_attach), + DEVMETHOD(device_detach, arge_detach), + DEVMETHOD(device_suspend, arge_suspend), + DEVMETHOD(device_resume, arge_resume), + DEVMETHOD(device_shutdown, arge_shutdown), + + /* bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_driver_added, bus_generic_driver_added), + + /* MII interface */ + DEVMETHOD(miibus_readreg, arge_miibus_readreg), + DEVMETHOD(miibus_writereg, arge_miibus_writereg), + DEVMETHOD(miibus_statchg, arge_miibus_statchg), + + { 0, 0 } +}; + +static driver_t arge_driver = { + "arge", + arge_methods, + sizeof(struct arge_softc) +}; + +static devclass_t arge_devclass; + +DRIVER_MODULE(arge, nexus, arge_driver, arge_devclass, 0, 0); +DRIVER_MODULE(miibus, arge, miibus_driver, miibus_devclass, 0, 0); + +/* + * Flushes all + */ +static void +arge_flush_ddr(struct arge_softc *sc) +{ + + ATH_WRITE_REG(sc->arge_ddr_flush_reg, 1); + while (ATH_READ_REG(sc->arge_ddr_flush_reg) & 1) + ; + + ATH_WRITE_REG(sc->arge_ddr_flush_reg, 1); + while (ATH_READ_REG(sc->arge_ddr_flush_reg) & 1) + ; +} + +static int +arge_probe(device_t dev) +{ + + device_set_desc(dev, "Atheros AR71xx built-in ethernet interface"); + return (0); +} + +static int +arge_attach(device_t dev) +{ + uint8_t eaddr[ETHER_ADDR_LEN]; + struct ifnet *ifp; + struct arge_softc *sc; + int error = 0, rid, phynum; + uint32_t reg; + + sc = device_get_softc(dev); + sc->arge_dev = dev; + sc->arge_mac_unit = device_get_unit(dev); + + KASSERT(((sc->arge_mac_unit == 0) || (sc->arge_mac_unit == 1)), + ("if_arge: Only MAC0 and MAC1 supported")); + if (sc->arge_mac_unit == 0) { + sc->arge_ddr_flush_reg = AR71XX_WB_FLUSH_GE0; + sc->arge_pll_reg = AR71XX_PLL_ETH_INT0_CLK; + } else { + sc->arge_ddr_flush_reg = AR71XX_WB_FLUSH_GE1; + sc->arge_pll_reg = AR71XX_PLL_ETH_INT1_CLK; + } + + /* + * Get which PHY of 5 available we should use for this unit + */ + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "phy", &phynum) != 0) { + /* + * Use port 4 (WAN) for GE0. For any other port use + * its PHY the same as its unit number + */ + if (sc->arge_mac_unit == 0) + phynum = 4; + else + phynum = sc->arge_mac_unit; + + device_printf(dev, "No PHY specified, using %d\n", phynum); + } + + sc->arge_phy_num = phynum; + + + mtx_init(&sc->arge_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->arge_stat_callout, &sc->arge_mtx, 0); + TASK_INIT(&sc->arge_link_task, 0, arge_link_task, sc); + + /* Map control/status registers. */ + sc->arge_rid = 0; + sc->arge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->arge_rid, RF_ACTIVE); + + if (sc->arge_res == NULL) { + device_printf(dev, "couldn't map memory\n"); + error = ENXIO; + goto fail; + } + + /* Allocate interrupts */ + rid = 0; + sc->arge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + + if (sc->arge_irq == NULL) { + device_printf(dev, "couldn't map interrupt\n"); + error = ENXIO; + goto fail; + } + + /* Allocate ifnet structure. */ + ifp = sc->arge_ifp = if_alloc(IFT_ETHER); + + if (ifp == NULL) { + device_printf(dev, "couldn't allocate ifnet structure\n"); + error = ENOSPC; + goto fail; + } + + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = arge_ioctl; + ifp->if_start = arge_start; + ifp->if_init = arge_init; + + /* XXX: add real size */ + IFQ_SET_MAXLEN(&ifp->if_snd, 9); + ifp->if_snd.ifq_maxlen = 9; + IFQ_SET_READY(&ifp->if_snd); + + ifp->if_capenable = ifp->if_capabilities; + + eaddr[0] = 0x00; + eaddr[1] = 0x15; + eaddr[2] = 0x6d; + eaddr[3] = 0xc1; + eaddr[4] = 0x28; + eaddr[5] = 0x2e; + + if (arge_dma_alloc(sc) != 0) { + error = ENXIO; + goto fail; + } + + ARGE_WRITE(sc, AR71XX_MAC_CFG1, + MAC_CFG1_SYNC_RX | MAC_CFG1_RX_ENABLE | + MAC_CFG1_SYNC_TX | MAC_CFG1_TX_ENABLE); + + reg = ARGE_READ(sc, AR71XX_MAC_CFG2); + reg |= MAC_CFG2_ENABLE_PADCRC | MAC_CFG2_LENGTH_FIELD ; + ARGE_WRITE(sc, AR71XX_MAC_CFG2, reg); + + ARGE_WRITE(sc, AR71XX_MAC_MAX_FRAME_LEN, 1536); + + /* Reset MII bus */ + ARGE_WRITE(sc, AR71XX_MAC_MII_CFG, MAC_MII_CFG_RESET); + DELAY(100); + ARGE_WRITE(sc, AR71XX_MAC_MII_CFG, MAC_MII_CFG_CLOCK_DIV_28); + DELAY(100); + + /* + * Set all Ethernet address registers to the same initial values + * set all four addresses to 66-88-aa-cc-dd-ee + */ + ARGE_WRITE(sc, AR71XX_MAC_STA_ADDR1, 0x6dc1282e); + ARGE_WRITE(sc, AR71XX_MAC_STA_ADDR2, 0x00000015); + + ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG0, + FIFO_CFG0_ALL << FIFO_CFG0_ENABLE_SHIFT); + ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG1, 0x0fff0000); + ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG2, 0x00001fff); + + reg = FIFO_RX_FILTMATCH_ALL; + ARGE_WRITE(sc, AR71XX_MAC_FIFO_RX_FILTMATCH, reg); + + reg = FIFO_RX_FILTMASK_ALL; + reg &= ~FIFO_RX_FILTMASK_BYTE_MODE; + ARGE_WRITE(sc, AR71XX_MAC_FIFO_RX_FILTMASK, reg); + + /* Do MII setup. */ + if (mii_phy_probe(dev, &sc->arge_miibus, + arge_ifmedia_upd, arge_ifmedia_sts)) { + device_printf(dev, "MII without any phy!\n"); + error = ENXIO; + goto fail; + } + + /* Call MI attach routine. */ + ether_ifattach(ifp, eaddr); + + /* Hook interrupt last to avoid having to lock softc */ + error = bus_setup_intr(dev, sc->arge_irq, INTR_TYPE_NET | INTR_MPSAFE, + arge_intr_filter, arge_intr, sc, &sc->arge_intrhand); + + if (error) { + device_printf(dev, "couldn't set up irq\n"); + ether_ifdetach(ifp); + goto fail; + } + +fail: + if (error) + arge_detach(dev); + + return (error); +} + +static int +arge_detach(device_t dev) +{ + struct arge_softc *sc = device_get_softc(dev); + struct ifnet *ifp = sc->arge_ifp; + + KASSERT(mtx_initialized(&sc->arge_mtx), ("arge mutex not initialized")); + + /* These should only be active if attach succeeded */ + if (device_is_attached(dev)) { + ARGE_LOCK(sc); + sc->arge_detach = 1; + arge_stop(sc); + ARGE_UNLOCK(sc); + taskqueue_drain(taskqueue_swi, &sc->arge_link_task); + ether_ifdetach(ifp); + } + + if (sc->arge_miibus) + device_delete_child(dev, sc->arge_miibus); + bus_generic_detach(dev); + + if (sc->arge_intrhand) + bus_teardown_intr(dev, sc->arge_irq, sc->arge_intrhand); + + if (sc->arge_res) + bus_release_resource(dev, SYS_RES_MEMORY, sc->arge_rid, + sc->arge_res); + + if (ifp) + if_free(ifp); + + arge_dma_free(sc); + + mtx_destroy(&sc->arge_mtx); + + return (0); + +} + +static int +arge_suspend(device_t dev) +{ + + panic("%s", __func__); + return 0; +} + +static int +arge_resume(device_t dev) +{ + + panic("%s", __func__); + return 0; +} + +static void +arge_shutdown(device_t dev) +{ + struct arge_softc *sc; + + sc = device_get_softc(dev); + + ARGE_LOCK(sc); + arge_stop(sc); + ARGE_UNLOCK(sc); +} + +static int +arge_miibus_readreg(device_t dev, int phy, int reg) +{ + struct arge_softc * sc = device_get_softc(dev); + int i, result; + uint32_t addr = 0x1000 | (phy << MAC_MII_PHY_ADDR_SHIFT) + | (reg & MAC_MII_REG_MASK); + + if (phy != sc->arge_phy_num) + return (0); + + ARGE_WRITE(sc, AR71XX_MAC_MII_CMD, MAC_MII_CMD_WRITE); + ARGE_WRITE(sc, AR71XX_MAC_MII_ADDR, addr); + ARGE_WRITE(sc, AR71XX_MAC_MII_CMD, MAC_MII_CMD_READ); + + i = ARGE_MII_TIMEOUT; + while ((ARGE_READ(sc, AR71XX_MAC_MII_INDICATOR) & + MAC_MII_INDICATOR_BUSY) && (i--)) + DELAY(5); + + if (i < 0) { + dprintf("%s timedout\n", __func__); + /* XXX: return ERRNO istead? */ + return (-1); + } + + result = ARGE_READ(sc, AR71XX_MAC_MII_STATUS) & MAC_MII_STATUS_MASK; + ARGE_WRITE(sc, AR71XX_MAC_MII_CMD, MAC_MII_CMD_WRITE); + dprintf("%s: phy=%d, reg=%02x, value[%08x]=%04x\n", __func__, + phy, reg, addr, result); + + return (result); +} + +static int +arge_miibus_writereg(device_t dev, int phy, int reg, int data) +{ + struct arge_softc * sc = device_get_softc(dev); + int i; + uint32_t addr = 0x1000 + | (phy << MAC_MII_PHY_ADDR_SHIFT) | (reg & MAC_MII_REG_MASK); + + dprintf("%s: phy=%d, reg=%02x, value=%04x\n", __func__, + phy, reg, data); + + ARGE_WRITE(sc, AR71XX_MAC_MII_ADDR, addr); + ARGE_WRITE(sc, AR71XX_MAC_MII_CONTROL, data); + + i = ARGE_MII_TIMEOUT; + while ((ARGE_READ(sc, AR71XX_MAC_MII_INDICATOR) & + MAC_MII_INDICATOR_BUSY) && (i--)) + DELAY(5); + + if (i < 0) { + dprintf("%s timedout\n", __func__); + /* XXX: return ERRNO istead? */ + return (-1); + } + + return (0); +} + +static void +arge_miibus_statchg(device_t dev) +{ + struct arge_softc *sc; + + sc = device_get_softc(dev); + taskqueue_enqueue(taskqueue_swi, &sc->arge_link_task); +} + +static void +arge_link_task(void *arg, int pending) +{ + struct arge_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t media; + uint32_t cfg, ifcontrol, rx_filtmask, pll, sec_cfg; + + sc = (struct arge_softc *)arg; + + ARGE_LOCK(sc); + mii = device_get_softc(sc->arge_miibus); + ifp = sc->arge_ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + ARGE_UNLOCK(sc); + return; + } + + if (mii->mii_media_status & IFM_ACTIVE) { + + media = IFM_SUBTYPE(mii->mii_media_active); + + if (media != IFM_NONE) { + sc->arge_link_status = 1; + + cfg = ARGE_READ(sc, AR71XX_MAC_CFG2); + ifcontrol = ARGE_READ(sc, AR71XX_MAC_IFCONTROL); + rx_filtmask = + ARGE_READ(sc, AR71XX_MAC_FIFO_RX_FILTMASK); + + cfg &= ~(MAC_CFG2_IFACE_MODE_1000 + | MAC_CFG2_IFACE_MODE_10_100 + | MAC_CFG2_FULL_DUPLEX); + ifcontrol &= ~MAC_IFCONTROL_SPEED; + rx_filtmask &= ~FIFO_RX_FILTMASK_BYTE_MODE; + + switch(media) { + case IFM_10_T: + cfg |= MAC_CFG2_IFACE_MODE_10_100; + pll = PLL_ETH_INT_CLK_10; + break; + case IFM_100_TX: + cfg |= MAC_CFG2_IFACE_MODE_10_100; + ifcontrol |= MAC_IFCONTROL_SPEED; + pll = PLL_ETH_INT_CLK_100; + break; + case IFM_1000_T: + case IFM_1000_SX: + cfg |= MAC_CFG2_IFACE_MODE_1000; + rx_filtmask |= FIFO_RX_FILTMASK_BYTE_MODE; + pll = PLL_ETH_INT_CLK_1000; + break; + default: + pll = PLL_ETH_INT_CLK_100; + device_printf(sc->arge_dev, + "Unknown media %d\n", media); + } + + ARGE_WRITE(sc, AR71XX_MAC_FIFO_TX_THRESHOLD, + 0x008001ff); + + ARGE_WRITE(sc, AR71XX_MAC_CFG2, cfg); + ARGE_WRITE(sc, AR71XX_MAC_IFCONTROL, ifcontrol); + ARGE_WRITE(sc, AR71XX_MAC_FIFO_RX_FILTMASK, + rx_filtmask); + + /* set PLL registers */ + sec_cfg = ATH_READ_REG(AR71XX_PLL_CPU_CONFIG); + sec_cfg &= ~(3 << 17); + sec_cfg |= (2 << 17); + + ATH_WRITE_REG(AR71XX_PLL_CPU_CONFIG, sec_cfg); + DELAY(100); + + ATH_WRITE_REG(sc->arge_pll_reg, pll); + + sec_cfg |= (3 << 17); + ATH_WRITE_REG(AR71XX_PLL_CPU_CONFIG, sec_cfg); + DELAY(100); + + sec_cfg &= ~(3 << 17); + ATH_WRITE_REG(AR71XX_PLL_CPU_CONFIG, sec_cfg); + DELAY(100); + } + } else + sc->arge_link_status = 0; + + ARGE_UNLOCK(sc); +} + +static void +arge_reset_dma(struct arge_softc *sc) +{ + unsigned int i; + + ARGE_WRITE(sc, AR71XX_DMA_RX_CONTROL, 0); + ARGE_WRITE(sc, AR71XX_DMA_TX_CONTROL, 0); + + ARGE_WRITE(sc, AR71XX_DMA_RX_DESC, 0); + ARGE_WRITE(sc, AR71XX_DMA_TX_DESC, 0); + + /* Clear all possible RX interrupts */ + for (i = 0; i < ARGE_RX_RING_COUNT; i++) + ARGE_WRITE(sc, AR71XX_DMA_RX_STATUS, DMA_RX_STATUS_PKT_RECVD); + + /* + * Clear all possible TX interrupts + */ + for (i = 0; i < ARGE_TX_RING_COUNT; i++) + ARGE_WRITE(sc, AR71XX_DMA_TX_STATUS, DMA_TX_STATUS_PKT_SENT); + + /* + * Now Rx/Tx errors + */ + ARGE_WRITE(sc, AR71XX_DMA_RX_STATUS, + DMA_RX_STATUS_BUS_ERROR | DMA_RX_STATUS_OVERFLOW); + ARGE_WRITE(sc, AR71XX_DMA_TX_STATUS, + DMA_TX_STATUS_BUS_ERROR | DMA_TX_STATUS_UNDERRUN); +} + + + +static void +arge_init(void *xsc) +{ + struct arge_softc *sc = xsc; + + ARGE_LOCK(sc); + arge_init_locked(sc); + ARGE_UNLOCK(sc); +} + +static void +arge_init_locked(struct arge_softc *sc) +{ + struct ifnet *ifp = sc->arge_ifp; + struct mii_data *mii; + + ARGE_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->arge_miibus); + + arge_stop(sc); + + /* Init circular RX list. */ + if (arge_rx_ring_init(sc) != 0) { + device_printf(sc->arge_dev, + "initialization failed: no memory for rx buffers\n"); + arge_stop(sc); + return; + } + + /* Init tx descriptors. */ + arge_tx_ring_init(sc); + + arge_reset_dma(sc); + + sc->arge_link_status = 0; + mii_mediachg(mii); + + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + + callout_reset(&sc->arge_stat_callout, hz, arge_tick, sc); + ARGE_WRITE(sc, AR71XX_DMA_TX_DESC, ARGE_TX_RING_ADDR(sc, 0)); + ARGE_WRITE(sc, AR71XX_DMA_RX_DESC, ARGE_RX_RING_ADDR(sc, 0)); + + /* Start listening */ + ARGE_WRITE(sc, AR71XX_DMA_RX_CONTROL, DMA_RX_CONTROL_EN); + + /* Enable interrupts */ + ARGE_WRITE(sc, AR71XX_DMA_INTR, DMA_INTR_ALL); +} + +/* + * Encapsulate an mbuf chain in a descriptor by coupling the mbuf data + * pointers to the fragment pointers. + */ +static int +arge_encap(struct arge_softc *sc, struct mbuf **m_head) +{ + struct arge_txdesc *txd; + struct arge_desc *desc, *prev_desc; + bus_dma_segment_t txsegs[ARGE_MAXFRAGS]; + int error, i, nsegs, prod, si, prev_prod; + + ARGE_LOCK_ASSERT(sc); + + prod = sc->arge_cdata.arge_tx_prod; + txd = &sc->arge_cdata.arge_txdesc[prod]; + error = bus_dmamap_load_mbuf_sg(sc->arge_cdata.arge_tx_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, BUS_DMA_NOWAIT); + + if (error == EFBIG) { + panic("EFBIG"); + } else if (error != 0) + return (error); + + if (nsegs == 0) { + m_freem(*m_head); + *m_head = NULL; + return (EIO); + } + + /* Check number of available descriptors. */ + if (sc->arge_cdata.arge_tx_cnt + nsegs >= (ARGE_TX_RING_COUNT - 1)) { + bus_dmamap_unload(sc->arge_cdata.arge_tx_tag, txd->tx_dmamap); + return (ENOBUFS); + } + + txd->tx_m = *m_head; + bus_dmamap_sync(sc->arge_cdata.arge_tx_tag, txd->tx_dmamap, + BUS_DMASYNC_PREWRITE); + + si = prod; + + /* + * Make a list of descriptors for this packet. DMA controller will + * walk through it while arge_link is not zero. + */ + prev_prod = prod; + desc = prev_desc = NULL; + for (i = 0; i < nsegs; i++) { + desc = &sc->arge_rdata.arge_tx_ring[prod]; + desc->packet_ctrl = ARGE_DMASIZE(txsegs[i].ds_len); + + desc->packet_addr = txsegs[i].ds_addr; + /* link with previous descriptor */ + if (prev_desc) + prev_desc->packet_ctrl |= ARGE_DESC_MORE; + + sc->arge_cdata.arge_tx_cnt++; + prev_desc = desc; + ARGE_INC(prod, ARGE_TX_RING_COUNT); + } + + /* Update producer index. */ + sc->arge_cdata.arge_tx_prod = prod; + + /* Sync descriptors. */ + bus_dmamap_sync(sc->arge_cdata.arge_tx_ring_tag, + sc->arge_cdata.arge_tx_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + /* Start transmitting */ + ARGE_WRITE(sc, AR71XX_DMA_TX_CONTROL, DMA_TX_CONTROL_EN); + return (0); +} + +static void +arge_start(struct ifnet *ifp) +{ + struct arge_softc *sc; + + sc = ifp->if_softc; + + ARGE_LOCK(sc); + arge_start_locked(ifp); + ARGE_UNLOCK(sc); +} + +static void +arge_start_locked(struct ifnet *ifp) +{ + struct arge_softc *sc; + struct mbuf *m_head; + int enq; + + sc = ifp->if_softc; + + ARGE_LOCK_ASSERT(sc); + + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || sc->arge_link_status == 0 ) + return; + + arge_flush_ddr(sc); + + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && + sc->arge_cdata.arge_tx_cnt < ARGE_TX_RING_COUNT - 2; ) { + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) + break; + + /* + * Fix mbuf chain, all fragments should be 4 bytes aligned and + * even 4 bytes + */ + arge_fix_chain(&m_head); + + if (m_head == NULL) { + dprintf("failed to adjust mbuf chain\n"); + } + + /* + * Pack the data into the transmit ring. + */ + if (arge_encap(sc, &m_head)) { + if (m_head == NULL) + break; + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + + enq++; + /* + * If there's a BPF listener, bounce a copy of this frame + * to him. + */ + ETHER_BPF_MTAP(ifp, m_head); + } +} + +static void +arge_stop(struct arge_softc *sc) +{ + struct ifnet *ifp; + + ARGE_LOCK_ASSERT(sc); + + ifp = sc->arge_ifp; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + callout_stop(&sc->arge_stat_callout); + + /* mask out interrupts */ + ARGE_WRITE(sc, AR71XX_DMA_INTR, 0); + + arge_reset_dma(sc); +} + + +static int +arge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct arge_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *) data; + struct mii_data *mii; + int error; + + switch (command) { + case SIOCSIFFLAGS: + printf("Implement me: SIOCSIFFLAGS\n"); + error = 0; + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + printf("Implement me: SIOCDELMULTI\n"); + error = 0; + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + printf("Implement me: SIOCSIFMEDIA\n"); + mii = device_get_softc(sc->arge_miibus); + error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); + break; + case SIOCSIFCAP: + error = 0; + ifp->if_hwassist = 0; + printf("Implement me: SIOCSIFCAP\n"); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + + return (error); +} + +/* + * Set media options. + */ +static int +arge_ifmedia_upd(struct ifnet *ifp) +{ + struct arge_softc *sc; + struct mii_data *mii; + struct mii_softc *miisc; + int error; + + sc = ifp->if_softc; + ARGE_LOCK(sc); + mii = device_get_softc(sc->arge_miibus); + if (mii->mii_instance) { + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); + } + error = mii_mediachg(mii); + ARGE_UNLOCK(sc); + + return (error); +} + +/* + * Report current media status. + */ +static void +arge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct arge_softc *sc = ifp->if_softc; + struct mii_data *mii; + + mii = device_get_softc(sc->arge_miibus); + ARGE_LOCK(sc); + mii_pollstat(mii); + ARGE_UNLOCK(sc); + ifmr->ifm_active = mii->mii_media_active; + ifmr->ifm_status = mii->mii_media_status; +} + +struct arge_dmamap_arg { + bus_addr_t arge_busaddr; +}; + +static void +arge_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct arge_dmamap_arg *ctx; + + if (error != 0) + return; + ctx = arg; + ctx->arge_busaddr = segs[0].ds_addr; +} + +static int +arge_dma_alloc(struct arge_softc *sc) +{ + struct arge_dmamap_arg ctx; + struct arge_txdesc *txd; + struct arge_rxdesc *rxd; + int error, i; + + /* Create parent DMA tag. */ + error = bus_dma_tag_create( + bus_get_dma_tag(sc->arge_dev), /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ + 0, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->arge_cdata.arge_parent_tag); + if (error != 0) { + device_printf(sc->arge_dev, "failed to create parent DMA tag\n"); + goto fail; + } + /* Create tag for Tx ring. */ + error = bus_dma_tag_create( + sc->arge_cdata.arge_parent_tag, /* parent */ + ARGE_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + ARGE_TX_DMA_SIZE, /* maxsize */ + 1, /* nsegments */ + ARGE_TX_DMA_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->arge_cdata.arge_tx_ring_tag); + if (error != 0) { + device_printf(sc->arge_dev, "failed to create Tx ring DMA tag\n"); + goto fail; + } + + /* Create tag for Rx ring. */ + error = bus_dma_tag_create( + sc->arge_cdata.arge_parent_tag, /* parent */ + ARGE_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + ARGE_RX_DMA_SIZE, /* maxsize */ + 1, /* nsegments */ + ARGE_RX_DMA_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->arge_cdata.arge_rx_ring_tag); + if (error != 0) { + device_printf(sc->arge_dev, "failed to create Rx ring DMA tag\n"); + goto fail; + } + + /* Create tag for Tx buffers. */ + error = bus_dma_tag_create( + sc->arge_cdata.arge_parent_tag, /* parent */ + sizeof(uint32_t), 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES * ARGE_MAXFRAGS, /* maxsize */ + ARGE_MAXFRAGS, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->arge_cdata.arge_tx_tag); + if (error != 0) { + device_printf(sc->arge_dev, "failed to create Tx DMA tag\n"); + goto fail; + } + + /* Create tag for Rx buffers. */ + error = bus_dma_tag_create( + sc->arge_cdata.arge_parent_tag, /* parent */ + ARGE_RX_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 06:24:33 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE73E106564A; Thu, 19 Feb 2009 06:24:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD7228FC0A; Thu, 19 Feb 2009 06:24:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J6OXES087969; Thu, 19 Feb 2009 06:24:33 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J6OXN6087968; Thu, 19 Feb 2009 06:24:33 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902190624.n1J6OXN6087968@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 19 Feb 2009 06:24:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188809 - projects/mips/sys/mips/atheros X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 06:24:34 -0000 Author: gonzo Date: Thu Feb 19 06:24:33 2009 New Revision: 188809 URL: http://svn.freebsd.org/changeset/base/188809 Log: - Add if_arge to build Modified: projects/mips/sys/mips/atheros/files.ar71xx Modified: projects/mips/sys/mips/atheros/files.ar71xx ============================================================================== --- projects/mips/sys/mips/atheros/files.ar71xx Thu Feb 19 06:23:56 2009 (r188808) +++ projects/mips/sys/mips/atheros/files.ar71xx Thu Feb 19 06:24:33 2009 (r188809) @@ -3,5 +3,6 @@ mips/atheros/apb.c standard mips/atheros/ar71xx_machdep.c standard mips/atheros/ar71xx_pci.c optional pci +mips/atheros/if_arge.c optional arge mips/atheros/uart_bus_ar71xx.c optional uart mips/atheros/uart_cpu_ar71xx.c optional uart From owner-svn-src-projects@FreeBSD.ORG Thu Feb 19 06:25:30 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54490106566B; Thu, 19 Feb 2009 06:25:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 436EE8FC0A; Thu, 19 Feb 2009 06:25:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1J6PUss088029; Thu, 19 Feb 2009 06:25:30 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1J6PUnb088028; Thu, 19 Feb 2009 06:25:30 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902190625.n1J6PUnb088028@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 19 Feb 2009 06:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188810 - projects/mips/sys/mips/conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 06:25:30 -0000 Author: gonzo Date: Thu Feb 19 06:25:29 2009 New Revision: 188810 URL: http://svn.freebsd.org/changeset/base/188810 Log: - Add GE0 port to hinted devices, GE1 will stay commented for a while Modified: projects/mips/sys/mips/conf/AR71XX.hints Modified: projects/mips/sys/mips/conf/AR71XX.hints ============================================================================== --- projects/mips/sys/mips/conf/AR71XX.hints Thu Feb 19 06:24:33 2009 (r188809) +++ projects/mips/sys/mips/conf/AR71XX.hints Thu Feb 19 06:25:29 2009 (r188810) @@ -14,3 +14,12 @@ hint.uart.0.irq=3 # pci hint.pcib.0.at="nexus0" hint.pcib.0.irq=0 + +hint.arge.0.at="nexus0" +hint.arge.0.maddr=0x19000000 +hint.arge.0.msize=0x1000 +hint.arge.0.irq=2 +# hint.arge.1.at="nexus0" +# hint.arge.1.maddr=0x1A000000 +# hint.arge.1.msize=0x1000 +# hint.arge.1.irq=3 From owner-svn-src-projects@FreeBSD.ORG Fri Feb 20 23:12:07 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F2901065687; Fri, 20 Feb 2009 23:12:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A9468FC1D; Fri, 20 Feb 2009 23:12:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1KNC6U7041674; Fri, 20 Feb 2009 23:12:06 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1KNC6Ck041673; Fri, 20 Feb 2009 23:12:06 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902202312.n1KNC6Ck041673@svn.freebsd.org> From: Sam Leffler Date: Fri, 20 Feb 2009 23:12:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188870 - in projects/vap7/sys: . arm/conf contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2009 23:12:08 -0000 Author: sam Date: Fri Feb 20 23:12:06 2009 New Revision: 188870 URL: http://svn.freebsd.org/changeset/base/188870 Log: merge r188744: use mii instead of miibus so we don't drag in all phy support Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/arm/conf/AVILA projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/arm/conf/AVILA ============================================================================== --- projects/vap7/sys/arm/conf/AVILA Fri Feb 20 23:05:05 2009 (r188869) +++ projects/vap7/sys/arm/conf/AVILA Fri Feb 20 23:12:06 2009 (r188870) @@ -110,7 +110,7 @@ device npe # Network Processing Engine device npe_fw device firmware device qmgr # Q Manager (required by npe) -device miibus # NB: required by npe +device mii # NB: required by npe device ether device bpf From owner-svn-src-projects@FreeBSD.ORG Fri Feb 20 23:13:04 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 955AF1065670; Fri, 20 Feb 2009 23:13:04 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F88C8FC08; Fri, 20 Feb 2009 23:13:04 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1KND4Sv041736; Fri, 20 Feb 2009 23:13:04 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1KND4mK041735; Fri, 20 Feb 2009 23:13:04 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902202313.n1KND4mK041735@svn.freebsd.org> From: Sam Leffler Date: Fri, 20 Feb 2009 23:13:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188871 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2009 23:13:05 -0000 Author: sam Date: Fri Feb 20 23:13:04 2009 New Revision: 188871 URL: http://svn.freebsd.org/changeset/base/188871 Log: merge r188821: use 1/2 and 1/4 rate phy types to simplify txtime calculation Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_phy.c Modified: projects/vap7/sys/net80211/ieee80211_phy.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_phy.c Fri Feb 20 23:12:06 2009 (r188870) +++ projects/vap7/sys/net80211/ieee80211_phy.c Fri Feb 20 23:13:04 2009 (r188871) @@ -58,7 +58,9 @@ struct ieee80211_ds_plcp_hdr { #define OFDM IEEE80211_T_OFDM #define CCK IEEE80211_T_CCK #define TURBO IEEE80211_T_TURBO -#define PBCC (IEEE80211_T_HT+1) /* XXX */ +#define HALF IEEE80211_T_OFDM_HALF +#define QUART IEEE80211_T_OFDM_QUARTER +#define PBCC (IEEE80211_T_OFDM_QUARTER+1) /* XXX */ #define B(r) (0x80 | r) #define Mb(x) (x*1000) @@ -116,14 +118,14 @@ static struct ieee80211_rate_table ieee8 .info = { /* short ctrl */ /* Preamble dot11Rate Rate */ - [0] = { .phy = OFDM, 3000, 0x00, B(6), 0 }, - [1] = { .phy = OFDM, 4500, 0x00, 9, 0 }, - [2] = { .phy = OFDM, 6000, 0x00, B(12), 2 }, - [3] = { .phy = OFDM, 9000, 0x00, 18, 2 }, - [4] = { .phy = OFDM, 12000, 0x00, B(24), 4 }, - [5] = { .phy = OFDM, 18000, 0x00, 36, 4 }, - [6] = { .phy = OFDM, 24000, 0x00, 48, 4 }, - [7] = { .phy = OFDM, 27000, 0x00, 54, 4 } + [0] = { .phy = HALF, 3000, 0x00, B(6), 0 }, + [1] = { .phy = HALF, 4500, 0x00, 9, 0 }, + [2] = { .phy = HALF, 6000, 0x00, B(12), 2 }, + [3] = { .phy = HALF, 9000, 0x00, 18, 2 }, + [4] = { .phy = HALF, 12000, 0x00, B(24), 4 }, + [5] = { .phy = HALF, 18000, 0x00, 36, 4 }, + [6] = { .phy = HALF, 24000, 0x00, 48, 4 }, + [7] = { .phy = HALF, 27000, 0x00, 54, 4 } }, }; @@ -132,14 +134,14 @@ static struct ieee80211_rate_table ieee8 .info = { /* short ctrl */ /* Preamble dot11Rate Rate */ - [0] = { .phy = OFDM, 1500, 0x00, B(3), 0 }, - [1] = { .phy = OFDM, 2250, 0x00, 4, 0 }, - [2] = { .phy = OFDM, 3000, 0x00, B(9), 2 }, - [3] = { .phy = OFDM, 4500, 0x00, 9, 2 }, - [4] = { .phy = OFDM, 6000, 0x00, B(12), 4 }, - [5] = { .phy = OFDM, 9000, 0x00, 18, 4 }, - [6] = { .phy = OFDM, 12000, 0x00, 24, 4 }, - [7] = { .phy = OFDM, 13500, 0x00, 27, 4 } + [0] = { .phy = QUART, 1500, 0x00, B(3), 0 }, + [1] = { .phy = QUART, 2250, 0x00, 4, 0 }, + [2] = { .phy = QUART, 3000, 0x00, B(9), 2 }, + [3] = { .phy = QUART, 4500, 0x00, 9, 2 }, + [4] = { .phy = QUART, 6000, 0x00, B(12), 4 }, + [5] = { .phy = QUART, 9000, 0x00, 18, 4 }, + [6] = { .phy = QUART, 12000, 0x00, 24, 4 }, + [7] = { .phy = QUART, 13500, 0x00, 27, 4 } }, }; @@ -177,6 +179,8 @@ static struct ieee80211_rate_table ieee8 #undef Mb #undef B #undef OFDM +#undef HALF +#undef QUART #undef CCK #undef TURBO #undef XR @@ -361,6 +365,30 @@ ieee80211_rate2plcp(int rate, enum ieee8 return 0; /* XXX unsupported/unknown rate */ } +#define CCK_SIFS_TIME 10 +#define CCK_PREAMBLE_BITS 144 +#define CCK_PLCP_BITS 48 + +#define OFDM_SIFS_TIME 16 +#define OFDM_PREAMBLE_TIME 20 +#define OFDM_PLCP_BITS 22 +#define OFDM_SYMBOL_TIME 4 + +#define OFDM_HALF_SIFS_TIME 32 +#define OFDM_HALF_PREAMBLE_TIME 40 +#define OFDM_HALF_PLCP_BITS 22 +#define OFDM_HALF_SYMBOL_TIME 8 + +#define OFDM_QUARTER_SIFS_TIME 64 +#define OFDM_QUARTER_PREAMBLE_TIME 80 +#define OFDM_QUARTER_PLCP_BITS 22 +#define OFDM_QUARTER_SYMBOL_TIME 16 + +#define TURBO_SIFS_TIME 8 +#define TURBO_PREAMBLE_TIME 14 +#define TURBO_PLCP_BITS 22 +#define TURBO_SYMBOL_TIME 4 + /* * Compute the time to transmit a frame of length frameLen bytes * using the specified rate, phy, and short preamble setting. @@ -381,9 +409,6 @@ ieee80211_compute_duration(const struct switch (rt->info[rix].phy) { case IEEE80211_T_CCK: -#define CCK_SIFS_TIME 10 -#define CCK_PREAMBLE_BITS 144 -#define CCK_PLCP_BITS 48 phyTime = CCK_PREAMBLE_BITS + CCK_PLCP_BITS; if (isShortPreamble && rt->info[rix].shortPreamble) phyTime >>= 1; @@ -391,65 +416,37 @@ ieee80211_compute_duration(const struct txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000)/kbps); break; -#undef CCK_SIFS_TIME -#undef CCK_PREAMBLE_BITS -#undef CCK_PLCP_BITS - case IEEE80211_T_OFDM: -#define OFDM_SIFS_TIME 16 -#define OFDM_PREAMBLE_TIME 20 -#define OFDM_PLCP_BITS 22 -#define OFDM_SYMBOL_TIME 4 + bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000; + KASSERT(bitsPerSymbol != 0, ("full rate bps")); -#define OFDM_SIFS_TIME_HALF 32 -#define OFDM_PREAMBLE_TIME_HALF 40 -#define OFDM_PLCP_BITS_HALF 22 -#define OFDM_SYMBOL_TIME_HALF 8 - -#define OFDM_SIFS_TIME_QUARTER 64 -#define OFDM_PREAMBLE_TIME_QUARTER 80 -#define OFDM_PLCP_BITS_QUARTER 22 -#define OFDM_SYMBOL_TIME_QUARTER 16 - if (rt == &ieee80211_half_table) { - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000; - KASSERT(bitsPerSymbol != 0, ("1/2 rate bps")); - - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME_QUARTER - + OFDM_PREAMBLE_TIME_QUARTER - + (numSymbols * OFDM_SYMBOL_TIME_QUARTER); - } else if (rt == &ieee80211_quarter_table) { - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000; - KASSERT(bitsPerSymbol != 0, ("1/4 rate bps")); - - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME_HALF - + OFDM_PREAMBLE_TIME_HALF - + (numSymbols * OFDM_SYMBOL_TIME_HALF); - } else { /* full rate channel */ - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000; - KASSERT(bitsPerSymbol != 0, ("full rate bps")); - - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME - + OFDM_PREAMBLE_TIME - + (numSymbols * OFDM_SYMBOL_TIME); - } + numBits = OFDM_PLCP_BITS + (frameLen << 3); + numSymbols = howmany(numBits, bitsPerSymbol); + txTime = OFDM_SIFS_TIME + + OFDM_PREAMBLE_TIME + + (numSymbols * OFDM_SYMBOL_TIME); + break; + case IEEE80211_T_OFDM_HALF: + bitsPerSymbol = (kbps * OFDM_HALF_SYMBOL_TIME) / 1000; + KASSERT(bitsPerSymbol != 0, ("1/4 rate bps")); + + numBits = OFDM_PLCP_BITS + (frameLen << 3); + numSymbols = howmany(numBits, bitsPerSymbol); + txTime = OFDM_HALF_SIFS_TIME + + OFDM_HALF_PREAMBLE_TIME + + (numSymbols * OFDM_HALF_SYMBOL_TIME); + break; + case IEEE80211_T_OFDM_QUARTER: + bitsPerSymbol = (kbps * OFDM_QUARTER_SYMBOL_TIME) / 1000; + KASSERT(bitsPerSymbol != 0, ("1/2 rate bps")); + + numBits = OFDM_PLCP_BITS + (frameLen << 3); + numSymbols = howmany(numBits, bitsPerSymbol); + txTime = OFDM_QUARTER_SIFS_TIME + + OFDM_QUARTER_PREAMBLE_TIME + + (numSymbols * OFDM_QUARTER_SYMBOL_TIME); break; - -#undef OFDM_SIFS_TIME -#undef OFDM_PREAMBLE_TIME -#undef OFDM_PLCP_BITS -#undef OFDM_SYMBOL_TIME - case IEEE80211_T_TURBO: -#define TURBO_SIFS_TIME 8 -#define TURBO_PREAMBLE_TIME 14 -#define TURBO_PLCP_BITS 22 -#define TURBO_SYMBOL_TIME 4 /* we still save OFDM rates in kbps - so double them */ bitsPerSymbol = ((kbps << 1) * TURBO_SYMBOL_TIME) / 1000; KASSERT(bitsPerSymbol != 0, ("turbo bps")); @@ -459,11 +456,6 @@ ieee80211_compute_duration(const struct txTime = TURBO_SIFS_TIME + TURBO_PREAMBLE_TIME + (numSymbols * TURBO_SYMBOL_TIME); break; -#undef TURBO_SIFS_TIME -#undef TURBO_PREAMBLE_TIME -#undef TURBO_PLCP_BITS -#undef TURBO_SYMBOL_TIME - default: panic("%s: unknown phy %u (rate %u)\n", __func__, rt->info[rix].phy, rate); From owner-svn-src-projects@FreeBSD.ORG Fri Feb 20 23:13:50 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A57B5106566C; Fri, 20 Feb 2009 23:13:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90D268FC0C; Fri, 20 Feb 2009 23:13:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1KNDoEk041799; Fri, 20 Feb 2009 23:13:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1KNDo06041798; Fri, 20 Feb 2009 23:13:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902202313.n1KNDo06041798@svn.freebsd.org> From: Sam Leffler Date: Fri, 20 Feb 2009 23:13:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188872 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2009 23:13:50 -0000 Author: sam Date: Fri Feb 20 23:13:50 2009 New Revision: 188872 URL: http://svn.freebsd.org/changeset/base/188872 Log: merge r188863: misc cleanup of wme parameter setting Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_proto.c Modified: projects/vap7/sys/net80211/ieee80211_proto.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_proto.c Fri Feb 20 23:13:04 2009 (r188871) +++ projects/vap7/sys/net80211/ieee80211_proto.c Fri Feb 20 23:13:50 2009 (r188872) @@ -819,6 +819,29 @@ static const struct phyParamType bssPhyP }; static void +_setifsparams(struct wmeParams *wmep, const paramType *phy) +{ + wmep->wmep_aifsn = phy->aifsn; + wmep->wmep_logcwmin = phy->logcwmin; + wmep->wmep_logcwmax = phy->logcwmax; + wmep->wmep_txopLimit = phy->txopLimit; +} + +static void +setwmeparams(struct ieee80211vap *vap, const char *type, int ac, + struct wmeParams *wmep, const paramType *phy) +{ + wmep->wmep_acm = phy->acm; + _setifsparams(wmep, phy); + + IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME, + "set %s (%s) [acm %u aifsn %u logcwmin %u logcwmax %u txop %u]\n", + ieee80211_wme_acnames[ac], type, + wmep->wmep_acm, wmep->wmep_aifsn, wmep->wmep_logcwmin, + wmep->wmep_logcwmax, wmep->wmep_txopLimit); +} + +static void ieee80211_wme_initparams_locked(struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; @@ -863,49 +886,14 @@ ieee80211_wme_initparams_locked(struct i pBssPhyParam = &bssPhyParamForAC_BE[mode]; break; } - wmep = &wme->wme_wmeChanParams.cap_wmeParams[i]; if (ic->ic_opmode == IEEE80211_M_HOSTAP) { - wmep->wmep_acm = pPhyParam->acm; - wmep->wmep_aifsn = pPhyParam->aifsn; - wmep->wmep_logcwmin = pPhyParam->logcwmin; - wmep->wmep_logcwmax = pPhyParam->logcwmax; - wmep->wmep_txopLimit = pPhyParam->txopLimit; + setwmeparams(vap, "chan", i, wmep, pPhyParam); } else { - wmep->wmep_acm = pBssPhyParam->acm; - wmep->wmep_aifsn = pBssPhyParam->aifsn; - wmep->wmep_logcwmin = pBssPhyParam->logcwmin; - wmep->wmep_logcwmax = pBssPhyParam->logcwmax; - wmep->wmep_txopLimit = pBssPhyParam->txopLimit; - + setwmeparams(vap, "chan", i, wmep, pBssPhyParam); } - IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME, - "%s: %s chan [acm %u aifsn %u log2(cwmin) %u " - "log2(cwmax) %u txpoLimit %u]\n", __func__ - , ieee80211_wme_acnames[i] - , wmep->wmep_acm - , wmep->wmep_aifsn - , wmep->wmep_logcwmin - , wmep->wmep_logcwmax - , wmep->wmep_txopLimit - ); - wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[i]; - wmep->wmep_acm = pBssPhyParam->acm; - wmep->wmep_aifsn = pBssPhyParam->aifsn; - wmep->wmep_logcwmin = pBssPhyParam->logcwmin; - wmep->wmep_logcwmax = pBssPhyParam->logcwmax; - wmep->wmep_txopLimit = pBssPhyParam->txopLimit; - IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME, - "%s: %s bss [acm %u aifsn %u log2(cwmin) %u " - "log2(cwmax) %u txpoLimit %u]\n", __func__ - , ieee80211_wme_acnames[i] - , wmep->wmep_acm - , wmep->wmep_aifsn - , wmep->wmep_logcwmin - , wmep->wmep_logcwmax - , wmep->wmep_txopLimit - ); + setwmeparams(vap, "bss ", i, wmep, pBssPhyParam); } /* NB: check ic_bss to avoid NULL deref on initial attach */ if (vap->iv_bss != NULL) { @@ -937,7 +925,7 @@ ieee80211_wme_initparams(struct ieee8021 void ieee80211_wme_updateparams_locked(struct ieee80211vap *vap) { - static const paramType phyParam[IEEE80211_MODE_MAX] = { + static const paramType aggrParam[IEEE80211_MODE_MAX] = { [IEEE80211_MODE_AUTO] = { 2, 4, 10, 64, 0 }, [IEEE80211_MODE_11A] = { 2, 4, 10, 64, 0 }, [IEEE80211_MODE_11B] = { 2, 5, 10, 64, 0 }, @@ -958,7 +946,10 @@ ieee80211_wme_updateparams_locked(struct enum ieee80211_phymode mode; int i; - /* set up the channel access parameters for the physical device */ + /* + * Set up the channel access parameters for the physical + * device. First populate the configured settings. + */ for (i = 0; i < WME_NUM_AC; i++) { chanp = &wme->wme_chanParams.cap_wmeParams[i]; wmep = &wme->wme_wmeChanParams.cap_wmeParams[i]; @@ -1002,27 +993,21 @@ ieee80211_wme_updateparams_locked(struct chanp = &wme->wme_chanParams.cap_wmeParams[WME_AC_BE]; bssp = &wme->wme_bssChanParams.cap_wmeParams[WME_AC_BE]; - chanp->wmep_aifsn = bssp->wmep_aifsn = phyParam[mode].aifsn; + chanp->wmep_aifsn = bssp->wmep_aifsn = aggrParam[mode].aifsn; chanp->wmep_logcwmin = bssp->wmep_logcwmin = - phyParam[mode].logcwmin; + aggrParam[mode].logcwmin; chanp->wmep_logcwmax = bssp->wmep_logcwmax = - phyParam[mode].logcwmax; + aggrParam[mode].logcwmax; chanp->wmep_txopLimit = bssp->wmep_txopLimit = - (vap->iv_flags & IEEE80211_F_BURST) ? - phyParam[mode].txopLimit : 0; + (vap->iv_flags & IEEE80211_F_BURST) ? + aggrParam[mode].txopLimit : 0; IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME, - "%s: %s [acm %u aifsn %u log2(cwmin) %u " - "log2(cwmax) %u txpoLimit %u]\n", __func__ - , ieee80211_wme_acnames[WME_AC_BE] - , chanp->wmep_acm - , chanp->wmep_aifsn - , chanp->wmep_logcwmin - , chanp->wmep_logcwmax - , chanp->wmep_txopLimit - ); + "update %s (chan+bss) [acm %u aifsn %u logcwmin %u " + "logcwmax %u txop %u]\n", ieee80211_wme_acnames[WME_AC_BE], + chanp->wmep_acm, chanp->wmep_aifsn, chanp->wmep_logcwmin, + chanp->wmep_logcwmax, chanp->wmep_txopLimit); } - /* XXX multi-bss */ if (vap->iv_opmode == IEEE80211_M_HOSTAP && ic->ic_sta_assoc < 2 && (wme->wme_flags & WME_F_AGGRMODE) != 0) { static const uint8_t logCwMin[IEEE80211_MODE_MAX] = { @@ -1044,10 +1029,8 @@ ieee80211_wme_updateparams_locked(struct chanp->wmep_logcwmin = bssp->wmep_logcwmin = logCwMin[mode]; IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME, - "%s: %s log2(cwmin) %u\n", __func__ - , ieee80211_wme_acnames[WME_AC_BE] - , chanp->wmep_logcwmin - ); + "update %s (chan+bss) logcwmin %u\n", + ieee80211_wme_acnames[WME_AC_BE], chanp->wmep_logcwmin); } if (vap->iv_opmode == IEEE80211_M_HOSTAP) { /* XXX ibss? */ /* @@ -1062,10 +1045,10 @@ ieee80211_wme_updateparams_locked(struct wme->wme_update(ic); IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME, - "%s: WME params updated, cap_info 0x%x\n", __func__, - vap->iv_opmode == IEEE80211_M_STA ? - wme->wme_wmeChanParams.cap_info : - wme->wme_bssChanParams.cap_info); + "%s: WME params updated, cap_info 0x%x\n", __func__, + vap->iv_opmode == IEEE80211_M_STA ? + wme->wme_wmeChanParams.cap_info : + wme->wme_bssChanParams.cap_info); } void From owner-svn-src-projects@FreeBSD.ORG Fri Feb 20 23:14:32 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B26BD1065672; Fri, 20 Feb 2009 23:14:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EAF78FC1B; Fri, 20 Feb 2009 23:14:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1KNEWgU041864; Fri, 20 Feb 2009 23:14:32 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1KNEWXr041863; Fri, 20 Feb 2009 23:14:32 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902202314.n1KNEWXr041863@svn.freebsd.org> From: Sam Leffler Date: Fri, 20 Feb 2009 23:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188873 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2009 23:14:32 -0000 Author: sam Date: Fri Feb 20 23:14:32 2009 New Revision: 188873 URL: http://svn.freebsd.org/changeset/base/188873 Log: merge r188864: wme fixups Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_proto.c Modified: projects/vap7/sys/net80211/ieee80211_proto.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_proto.c Fri Feb 20 23:13:50 2009 (r188872) +++ projects/vap7/sys/net80211/ieee80211_proto.c Fri Feb 20 23:14:32 2009 (r188873) @@ -853,7 +853,7 @@ ieee80211_wme_initparams_locked(struct i IEEE80211_LOCK_ASSERT(ic); - if ((ic->ic_caps & IEEE80211_C_WME) == 0) + if ((ic->ic_caps & IEEE80211_C_WME) == 0 || ic->ic_nrunning > 1) return; /* @@ -905,6 +905,7 @@ ieee80211_wme_initparams_locked(struct i */ wme->wme_hipri_switch_thresh = (HIGH_PRI_SWITCH_THRESH * vap->iv_bss->ni_intval) / 100; + wme->wme_flags &= ~WME_F_AGGRMODE; ieee80211_wme_updateparams(vap); } } From owner-svn-src-projects@FreeBSD.ORG Fri Feb 20 23:15:12 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BB3F1065670; Fri, 20 Feb 2009 23:15:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1D8F8FC0A; Fri, 20 Feb 2009 23:15:11 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1KNFBH7041931; Fri, 20 Feb 2009 23:15:11 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1KNFB2H041930; Fri, 20 Feb 2009 23:15:11 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902202315.n1KNFB2H041930@svn.freebsd.org> From: Sam Leffler Date: Fri, 20 Feb 2009 23:15:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188874 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2009 23:15:12 -0000 Author: sam Date: Fri Feb 20 23:15:11 2009 New Revision: 188874 URL: http://svn.freebsd.org/changeset/base/188874 Log: merge r188865: don't adjust core clk conversions for 1/2 and 1/4 rate channels Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ah.c projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ah.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ah.c Fri Feb 20 23:14:32 2009 (r188873) +++ projects/vap7/sys/dev/ath/ath_hal/ah.c Fri Feb 20 23:15:11 2009 (r188874) @@ -266,10 +266,6 @@ ath_hal_mac_clks(struct ath_hal *ah, u_i clks = usecs * CLOCK_RATE[ath_hal_chan2wmode(ah, c)]; if (IEEE80211_IS_CHAN_HT40(c)) clks <<= 1; - else if (IEEE80211_IS_CHAN_HALF(c)) - clks >>= 1; - else if (IEEE80211_IS_CHAN_QUARTER(c)) - clks >>= 2; } else clks = usecs * CLOCK_RATE[WIRELESS_MODE_11b]; return clks; @@ -286,10 +282,6 @@ ath_hal_mac_usec(struct ath_hal *ah, u_i usec = clks / CLOCK_RATE[ath_hal_chan2wmode(ah, c)]; if (IEEE80211_IS_CHAN_HT40(c)) usec >>= 1; - else if (IEEE80211_IS_CHAN_HALF(c)) - usec <<= 1; - else if (IEEE80211_IS_CHAN_QUARTER(c)) - usec <<= 2; } else usec = clks / CLOCK_RATE[WIRELESS_MODE_11b]; return usec; From owner-svn-src-projects@FreeBSD.ORG Fri Feb 20 23:15:56 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A92A1106564A; Fri, 20 Feb 2009 23:15:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B1D48FC13; Fri, 20 Feb 2009 23:15:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1KNFuhj041990; Fri, 20 Feb 2009 23:15:56 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1KNFu3G041989; Fri, 20 Feb 2009 23:15:56 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902202315.n1KNFu3G041989@svn.freebsd.org> From: Sam Leffler Date: Fri, 20 Feb 2009 23:15:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188875 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2009 23:15:56 -0000 Author: sam Date: Fri Feb 20 23:15:56 2009 New Revision: 188875 URL: http://svn.freebsd.org/changeset/base/188875 Log: merge r188866: correct SIFS setting Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Fri Feb 20 23:15:11 2009 (r188874) +++ projects/vap7/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Fri Feb 20 23:15:56 2009 (r188875) @@ -450,7 +450,7 @@ ar5212SetSifsTime(struct ath_hal *ah, u_ return AH_FALSE; } else { /* convert to system clocks */ - OS_REG_WRITE(ah, AR_D_GBL_IFS_SIFS, ath_hal_mac_clks(ah, us)); + OS_REG_WRITE(ah, AR_D_GBL_IFS_SIFS, ath_hal_mac_clks(ah, us-2)); ahp->ah_slottime = us; return AH_TRUE; } @@ -460,7 +460,7 @@ u_int ar5212GetSifsTime(struct ath_hal *ah) { u_int clks = OS_REG_READ(ah, AR_D_GBL_IFS_SIFS) & 0xffff; - return ath_hal_mac_usec(ah, clks); /* convert from system clocks */ + return ath_hal_mac_usec(ah, clks)+2; /* convert from system clocks */ } HAL_BOOL From owner-svn-src-projects@FreeBSD.ORG Fri Feb 20 23:16:47 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B2911065674; Fri, 20 Feb 2009 23:16:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 775C38FC08; Fri, 20 Feb 2009 23:16:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1KNGlqH042055; Fri, 20 Feb 2009 23:16:47 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1KNGl8W042054; Fri, 20 Feb 2009 23:16:47 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902202316.n1KNGl8W042054@svn.freebsd.org> From: Sam Leffler Date: Fri, 20 Feb 2009 23:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188876 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2009 23:16:47 -0000 Author: sam Date: Fri Feb 20 23:16:47 2009 New Revision: 188876 URL: http://svn.freebsd.org/changeset/base/188876 Log: merge r188869: nodes created by neighbor discovery need to be marked as ERP Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) projects/vap7/sys/net80211/ieee80211_node.c Modified: projects/vap7/sys/net80211/ieee80211_node.c ============================================================================== --- projects/vap7/sys/net80211/ieee80211_node.c Fri Feb 20 23:15:56 2009 (r188875) +++ projects/vap7/sys/net80211/ieee80211_node.c Fri Feb 20 23:16:47 2009 (r188876) @@ -1319,6 +1319,8 @@ ieee80211_fakeup_adhoc_node(struct ieee8 /* XXX no rate negotiation; just dup */ ni->ni_rates = vap->iv_bss->ni_rates; + if (ieee80211_iserp_rateset(&ni->ni_rates)) + ni->ni_flags |= IEEE80211_NODE_ERP; if (vap->iv_opmode == IEEE80211_M_AHDEMO) { /* * In adhoc demo mode there are no management @@ -1394,6 +1396,8 @@ ieee80211_add_neighbor(struct ieee80211v struct ieee80211com *ic = vap->iv_ic; ieee80211_init_neighbor(ni, wh, sp); + if (ieee80211_iserp_rateset(&ni->ni_rates)) + ni->ni_flags |= IEEE80211_NODE_ERP; node_setuptxparms(ni); if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, 1); From owner-svn-src-projects@FreeBSD.ORG Sat Feb 21 03:11:43 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E31CF106566B; Sat, 21 Feb 2009 03:11:43 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7A348FC14; Sat, 21 Feb 2009 03:11:43 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1L3BhgG046665; Sat, 21 Feb 2009 03:11:43 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1L3BhBM046664; Sat, 21 Feb 2009 03:11:43 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902210311.n1L3BhBM046664@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sat, 21 Feb 2009 03:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188881 - projects/mips/sys/mips/atheros X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Feb 2009 03:11:44 -0000 Author: gonzo Date: Sat Feb 21 03:11:43 2009 New Revision: 188881 URL: http://svn.freebsd.org/changeset/base/188881 Log: - Add USB-related registers Modified: projects/mips/sys/mips/atheros/ar71xxreg.h Modified: projects/mips/sys/mips/atheros/ar71xxreg.h ============================================================================== --- projects/mips/sys/mips/atheros/ar71xxreg.h Sat Feb 21 03:06:29 2009 (r188880) +++ projects/mips/sys/mips/atheros/ar71xxreg.h Sat Feb 21 03:11:43 2009 (r188881) @@ -101,6 +101,31 @@ #define AR71XX_UART_ADDR 0x18020000 +#define AR71XX_USB_CTRL_FLADJ 0x18030000 +#define USB_CTRL_FLADJ_HOST_SHIFT 12 +#define USB_CTRL_FLADJ_A5_SHIFT 10 +#define USB_CTRL_FLADJ_A4_SHIFT 8 +#define USB_CTRL_FLADJ_A3_SHIFT 6 +#define USB_CTRL_FLADJ_A2_SHIFT 4 +#define USB_CTRL_FLADJ_A1_SHIFT 2 +#define USB_CTRL_FLADJ_A0_SHIFT 0 +#define AR71XX_USB_CTRL_CONFIG 0x18030004 +#define USB_CTRL_CONFIG_OHCI_DES_SWAP (1 << 19) +#define USB_CTRL_CONFIG_OHCI_BUF_SWAP (1 << 18) +#define USB_CTRL_CONFIG_EHCI_DES_SWAP (1 << 17) +#define USB_CTRL_CONFIG_EHCI_BUF_SWAP (1 << 16) +#define USB_CTRL_CONFIG_DISABLE_XTL (1 << 13) +#define USB_CTRL_CONFIG_OVERRIDE_XTL (1 << 12) +#define USB_CTRL_CONFIG_CLK_SEL_SHIFT 4 +#define USB_CTRL_CONFIG_CLK_SEL_MASK 3 +#define USB_CTRL_CONFIG_CLK_SEL_12 0 +#define USB_CTRL_CONFIG_CLK_SEL_24 1 +#define USB_CTRL_CONFIG_CLK_SEL_48 2 +#define USB_CTRL_CONFIG_OVER_CURRENT_AS_GPIO (1 << 8) +#define USB_CTRL_CONFIG_SS_SIMULATION_MODE (1 << 2) +#define USB_CTRL_CONFIG_RESUME_UTMI_PLS_DIS (1 << 1) +#define USB_CTRL_CONFIG_UTMI_BACKWARD_ENB (1 << 0) + #define AR71XX_PLL_CPU_CONFIG 0x18050000 #define AR71XX_PLL_SEC_CONFIG 0x18050004 #define AR71XX_PLL_CPU_CLK_CTRL 0x18050008 @@ -142,6 +167,9 @@ #define RST_RESET_GE1_PHY (1 << 12) #define RST_RESET_GE0_MAC (1 << 9) #define RST_RESET_GE0_PHY (1 << 8) +#define RST_RESET_USB_OHCI_DLL (1 << 6) +#define RST_RESET_USB_HOST (1 << 5) +#define RST_RESET_USB_PHY (1 << 4) #define RST_RESET_PCI_BUS (1 << 1) #define RST_RESET_PCI_CORE (1 << 0) From owner-svn-src-projects@FreeBSD.ORG Sat Feb 21 03:13:11 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11EF9106564A; Sat, 21 Feb 2009 03:13:11 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00F218FC13; Sat, 21 Feb 2009 03:13:11 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1L3DA6R046724; Sat, 21 Feb 2009 03:13:10 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1L3DAkb046723; Sat, 21 Feb 2009 03:13:10 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902210313.n1L3DAkb046723@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sat, 21 Feb 2009 03:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188882 - projects/mips/sys/mips/atheros X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Feb 2009 03:13:11 -0000 Author: gonzo Date: Sat Feb 21 03:13:10 2009 New Revision: 188882 URL: http://svn.freebsd.org/changeset/base/188882 Log: - Reset USB chip and init control registers Modified: projects/mips/sys/mips/atheros/ar71xx_machdep.c Modified: projects/mips/sys/mips/atheros/ar71xx_machdep.c ============================================================================== --- projects/mips/sys/mips/atheros/ar71xx_machdep.c Sat Feb 21 03:11:43 2009 (r188881) +++ projects/mips/sys/mips/atheros/ar71xx_machdep.c Sat Feb 21 03:13:10 2009 (r188882) @@ -98,6 +98,7 @@ platform_start(__register_t a0 __unused, { vm_offset_t kernend; uint64_t platform_counter_freq; + uint32_t reg; /* clear the BSS and SBSS segments */ kernend = round_page((vm_offset_t)&end); @@ -134,6 +135,26 @@ platform_start(__register_t a0 __unused, mips_proc0_init(); mutex_init(); + /* + * Reset USB devices + */ + reg = ATH_READ_REG(AR71XX_RST_RESET); + reg |= + RST_RESET_USB_OHCI_DLL | RST_RESET_USB_HOST | RST_RESET_USB_PHY; + ATH_WRITE_REG(AR71XX_RST_RESET, reg); + DELAY(1000); + reg &= + ~(RST_RESET_USB_OHCI_DLL | RST_RESET_USB_HOST | RST_RESET_USB_PHY); + ATH_WRITE_REG(AR71XX_RST_RESET, reg); + + ATH_WRITE_REG(AR71XX_USB_CTRL_CONFIG, + USB_CTRL_CONFIG_OHCI_DES_SWAP | USB_CTRL_CONFIG_OHCI_BUF_SWAP | + USB_CTRL_CONFIG_EHCI_DES_SWAP | USB_CTRL_CONFIG_EHCI_BUF_SWAP); + + ATH_WRITE_REG(AR71XX_USB_CTRL_FLADJ, + (32 << USB_CTRL_FLADJ_HOST_SHIFT) | (3 << USB_CTRL_FLADJ_A5_SHIFT)); + DELAY(1000); + #ifdef DDB kdb_init(); #endif From owner-svn-src-projects@FreeBSD.ORG Sat Feb 21 03:14:44 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BA82106566B; Sat, 21 Feb 2009 03:14:44 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A4408FC1B; Sat, 21 Feb 2009 03:14:44 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1L3EiV2046791; Sat, 21 Feb 2009 03:14:44 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1L3EiS9046789; Sat, 21 Feb 2009 03:14:44 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902210314.n1L3EiS9046789@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sat, 21 Feb 2009 03:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188883 - projects/mips/sys/mips/atheros X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Feb 2009 03:14:44 -0000 Author: gonzo Date: Sat Feb 21 03:14:44 2009 New Revision: 188883 URL: http://svn.freebsd.org/changeset/base/188883 Log: - Add some debug output - Do not manage memory, it's not neccessary. Just pass request up to nexus to map it to KSEG1 Modified: projects/mips/sys/mips/atheros/apb.c projects/mips/sys/mips/atheros/apbvar.h Modified: projects/mips/sys/mips/atheros/apb.c ============================================================================== --- projects/mips/sys/mips/atheros/apb.c Sat Feb 21 03:13:10 2009 (r188882) +++ projects/mips/sys/mips/atheros/apb.c Sat Feb 21 03:14:44 2009 (r188883) @@ -42,6 +42,13 @@ __FBSDID("$FreeBSD$"); #include #include +#undef APB_DEBUG +#ifdef APB_DEBUG +#define dprintf printf +#else +#define dprintf(x, arg...) +#endif /* APB_DEBUG */ + static int apb_activate_resource(device_t, device_t, int, int, struct resource *); static device_t apb_add_child(device_t, int, const char *, int); @@ -94,13 +101,6 @@ apb_attach(device_t dev) int rid = 0; device_set_desc(dev, "APB Bus bridge"); - sc->apb_mem_rman.rm_type = RMAN_ARRAY; - sc->apb_mem_rman.rm_descr = "APB memory"; - if (rman_init(&sc->apb_mem_rman) != 0 || - rman_manage_region(&sc->apb_mem_rman, APB_MEM_START, - APB_MEM_END) != 0) - panic("apb_attach: failed to set up I/O rman"); - sc->apb_irq_rman.rm_type = RMAN_ARRAY; sc->apb_irq_rman.rm_descr = "APB IRQ"; @@ -142,9 +142,17 @@ apb_alloc_resource(device_t bus, device_ isdefault = (start == 0UL && end == ~0UL); needactivate = flags & RF_ACTIVE; - passthrough = (device_get_parent(child) != bus); + /* + * Pass memory requests to nexus device + */ + passthrough = (device_get_parent(child) != bus) || + (type == SYS_RES_MEMORY); rle = NULL; + dprintf("%s: entry (%p, %p, %d, %p, %p, %p, %ld, %d)\n", + __func__, bus, child, type, rid, (void *)(intptr_t)start, + (void *)(intptr_t)end, count, flags); + if (passthrough) return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, rid, start, end, count, flags)); @@ -157,6 +165,7 @@ apb_alloc_resource(device_t bus, device_ if (isdefault) { rle = resource_list_find(&ivar->resources, type, *rid); + printf("DEFAULT: %d, %p\n", *rid, rle); if (rle == NULL) { return (NULL); } @@ -167,15 +176,16 @@ apb_alloc_resource(device_t bus, device_ start = rle->start; end = rle->end; count = rle->count; + + dprintf("%s: default resource (%p, %p, %ld)\n", + __func__, (void *)(intptr_t)start, + (void *)(intptr_t)end, count); } switch (type) { case SYS_RES_IRQ: rm = &sc->apb_irq_rman; break; - case SYS_RES_MEMORY: - rm = &sc->apb_mem_rman; - break; default: printf("%s: unknown resource type %d\n", __func__, type); return (0); Modified: projects/mips/sys/mips/atheros/apbvar.h ============================================================================== --- projects/mips/sys/mips/atheros/apbvar.h Sat Feb 21 03:13:10 2009 (r188882) +++ projects/mips/sys/mips/atheros/apbvar.h Sat Feb 21 03:14:44 2009 (r188883) @@ -28,15 +28,11 @@ #ifndef _APBVAR_H_ #define _APBVAR_H_ -#define APB_MEM_START 0x18000000 -#define APB_MEM_END 0x18ffffff - #define APB_IRQ_BASE 0 #define APB_IRQ_END 7 #define APB_NIRQS 8 struct apb_softc { - struct rman apb_mem_rman; struct rman apb_irq_rman; /* IRQ events structs for child devices */ struct intr_event *sc_eventstab[APB_NIRQS]; From owner-svn-src-projects@FreeBSD.ORG Sat Feb 21 03:36:44 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81B9B106566B; Sat, 21 Feb 2009 03:36:44 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F1468FC0A; Sat, 21 Feb 2009 03:36:44 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1L3aix3047197; Sat, 21 Feb 2009 03:36:44 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1L3aihd047195; Sat, 21 Feb 2009 03:36:44 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902210336.n1L3aihd047195@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sat, 21 Feb 2009 03:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188884 - projects/mips/sys/mips/atheros X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Feb 2009 03:36:44 -0000 Author: gonzo Date: Sat Feb 21 03:36:43 2009 New Revision: 188884 URL: http://svn.freebsd.org/changeset/base/188884 Log: - Add integrated OHCI controller driver, just a wrapper around generic ohci driver Added: projects/mips/sys/mips/atheros/ar71xx_ohci.c Modified: projects/mips/sys/mips/atheros/files.ar71xx Added: projects/mips/sys/mips/atheros/ar71xx_ohci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mips/sys/mips/atheros/ar71xx_ohci.c Sat Feb 21 03:36:43 2009 (r188884) @@ -0,0 +1,205 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +static int ar71xx_ohci_attach(device_t dev); +static int ar71xx_ohci_detach(device_t dev); +static int ar71xx_ohci_probe(device_t dev); + +struct ar71xx_ohci_softc +{ + struct ohci_softc sc_ohci; +}; + +static int +ar71xx_ohci_probe(device_t dev) +{ + device_set_desc(dev, "AR71XX integrated OHCI controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +ar71xx_ohci_attach(device_t dev) +{ + struct ar71xx_ohci_softc *sc = device_get_softc(dev); + int err; + int rid; + + rid = 0; + sc->sc_ohci.io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_ohci.io_res == NULL) { + err = ENOMEM; + goto error; + } + sc->sc_ohci.iot = rman_get_bustag(sc->sc_ohci.io_res); + sc->sc_ohci.ioh = rman_get_bushandle(sc->sc_ohci.io_res); + + rid = 0; + sc->sc_ohci.irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->sc_ohci.irq_res == NULL) { + err = ENOMEM; + goto error; + } + sc->sc_ohci.sc_bus.bdev = device_add_child(dev, "usb", -1); + if (sc->sc_ohci.sc_bus.bdev == NULL) { + err = ENOMEM; + goto error; + } + device_set_ivars(sc->sc_ohci.sc_bus.bdev, &sc->sc_ohci.sc_bus); + + /* Allocate a parent dma tag for DMA maps */ + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0, + NULL, NULL, &sc->sc_ohci.sc_bus.parent_dmatag); + if (err) { + device_printf(dev, "Could not allocate parent DMA tag (%d)\n", + err); + err = ENXIO; + goto error; + } + + /* Allocate a dma tag for transfer buffers */ + err = bus_dma_tag_create(sc->sc_ohci.sc_bus.parent_dmatag, 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0, + busdma_lock_mutex, &Giant, &sc->sc_ohci.sc_bus.buffer_dmatag); + if (err) { + device_printf(dev, "Could not allocate transfer tag (%d)\n", + err); + err = ENXIO; + goto error; + } + + err = bus_setup_intr(dev, sc->sc_ohci.irq_res, INTR_TYPE_BIO, NULL, + ohci_intr, sc, &sc->sc_ohci.ih); + if (err) { + err = ENXIO; + goto error; + } + strlcpy(sc->sc_ohci.sc_vendor, "Atheros", + sizeof(sc->sc_ohci.sc_vendor)); + + bus_space_write_4(sc->sc_ohci.iot, sc->sc_ohci.ioh, OHCI_CONTROL, 0); + + err = ohci_init(&sc->sc_ohci); + if (!err) { + sc->sc_ohci.sc_flags |= OHCI_SCFLG_DONEINIT; + err = device_probe_and_attach(sc->sc_ohci.sc_bus.bdev); + } + +error: + if (err) { + ar71xx_ohci_detach(dev); + return (err); + } + return (err); +} + +static int +ar71xx_ohci_detach(device_t dev) +{ + struct ar71xx_ohci_softc *sc = device_get_softc(dev); + + if (sc->sc_ohci.sc_flags & OHCI_SCFLG_DONEINIT) { + ohci_detach(&sc->sc_ohci, 0); + sc->sc_ohci.sc_flags &= ~OHCI_SCFLG_DONEINIT; + } + + if (sc->sc_ohci.ih) { + bus_teardown_intr(dev, sc->sc_ohci.irq_res, sc->sc_ohci.ih); + sc->sc_ohci.ih = NULL; + } + + if (sc->sc_ohci.sc_bus.parent_dmatag != NULL) + bus_dma_tag_destroy(sc->sc_ohci.sc_bus.parent_dmatag); + if (sc->sc_ohci.sc_bus.buffer_dmatag != NULL) + bus_dma_tag_destroy(sc->sc_ohci.sc_bus.buffer_dmatag); + + if (sc->sc_ohci.sc_bus.bdev) { + device_delete_child(dev, sc->sc_ohci.sc_bus.bdev); + sc->sc_ohci.sc_bus.bdev = NULL; + } + if (sc->sc_ohci.irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_ohci.irq_res); + sc->sc_ohci.irq_res = NULL; + } + if (sc->sc_ohci.io_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_ohci.io_res); + sc->sc_ohci.io_res = NULL; + sc->sc_ohci.iot = 0; + sc->sc_ohci.ioh = 0; + } + return (0); +} + +static device_method_t ohci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ar71xx_ohci_probe), + DEVMETHOD(device_attach, ar71xx_ohci_attach), + DEVMETHOD(device_detach, ar71xx_ohci_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + + {0, 0} +}; + +static driver_t ohci_driver = { + "ohci", + ohci_methods, + sizeof(struct ar71xx_ohci_softc), +}; + +static devclass_t ohci_devclass; + +DRIVER_MODULE(ohci, apb, ohci_driver, ohci_devclass, 0, 0); Modified: projects/mips/sys/mips/atheros/files.ar71xx ============================================================================== --- projects/mips/sys/mips/atheros/files.ar71xx Sat Feb 21 03:14:44 2009 (r188883) +++ projects/mips/sys/mips/atheros/files.ar71xx Sat Feb 21 03:36:43 2009 (r188884) @@ -2,6 +2,7 @@ mips/atheros/apb.c standard mips/atheros/ar71xx_machdep.c standard +mips/atheros/ar71xx_ohci.c optional ohci mips/atheros/ar71xx_pci.c optional pci mips/atheros/if_arge.c optional arge mips/atheros/uart_bus_ar71xx.c optional uart From owner-svn-src-projects@FreeBSD.ORG Sat Feb 21 03:37:10 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2F0E106566B; Sat, 21 Feb 2009 03:37:10 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91AC98FC18; Sat, 21 Feb 2009 03:37:10 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1L3bAdV047243; Sat, 21 Feb 2009 03:37:10 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1L3bA8X047242; Sat, 21 Feb 2009 03:37:10 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200902210337.n1L3bA8X047242@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sat, 21 Feb 2009 03:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188885 - projects/mips/sys/mips/atheros X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Feb 2009 03:37:10 -0000 Author: gonzo Date: Sat Feb 21 03:37:10 2009 New Revision: 188885 URL: http://svn.freebsd.org/changeset/base/188885 Log: - Remove some garbage output Modified: projects/mips/sys/mips/atheros/apb.c Modified: projects/mips/sys/mips/atheros/apb.c ============================================================================== --- projects/mips/sys/mips/atheros/apb.c Sat Feb 21 03:36:43 2009 (r188884) +++ projects/mips/sys/mips/atheros/apb.c Sat Feb 21 03:37:10 2009 (r188885) @@ -165,7 +165,6 @@ apb_alloc_resource(device_t bus, device_ if (isdefault) { rle = resource_list_find(&ivar->resources, type, *rid); - printf("DEFAULT: %d, %p\n", *rid, rle); if (rle == NULL) { return (NULL); }