svn commit: r216515 - head/lib/libc/sys
Author: brucec Date: Sat Dec 18 10:09:07 2010 New Revision: 216515 URL: http://svn.freebsd.org/changeset/base/216515 Log: Sort cross references by section. Reported by: pluknet Modified: head/lib/libc/sys/shmget.2 Modified: head/lib/libc/sys/shmget.2 == --- head/lib/libc/sys/shmget.2 Sat Dec 18 06:51:48 2010(r216514) +++ head/lib/libc/sys/shmget.2 Sat Dec 18 10:09:07 2010(r216515) @@ -142,5 +142,5 @@ already exists. .Xr shmat 2 , .Xr shmctl 2 , .Xr shmdt 2 , -.Xr ftok 3 , -.Xr stat 2 +.Xr stat 2 , +.Xr ftok 3 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r216333 - head/sys/i386/i386
On 18-12-2010 3:17, Alan Cox wrote: Joel Dahl wrote: On 09-12-2010 20:16, Alan Cox wrote: Author: alc Date: Thu Dec 9 20:16:00 2010 New Revision: 216333 URL: http://svn.freebsd.org/changeset/base/216333 Log: When r207410 eliminated the acquisition and release of the page queues lock from pmap_extract_and_hold(), it didn't take into account that pmap_pte_quick() sometimes requires the page queues lock to be held. This change reimplements pmap_extract_and_hold() such that it no longer uses pmap_pte_quick(), and thus never requires the page queues lock. For consistency, adopt the same idiom as used by the new implementation of pmap_extract_and_hold() in pmap_extract() and pmap_mincore(). It also happens to make these functions shorter. Hi Alan, This commit makes my laptop hang everytime I quit X. I just get a black screen and the machine won't respond to any keys. Everything works if I go back to r216330. Can you please try the following change? I'm afraid the patch didn't make any difference. It still hangs. -- Joel ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r216333 - head/sys/i386/i386
On Sat, Dec 18, 2010 at 11:35:42AM +0100, Joel Dahl wrote: On 18-12-2010 3:17, Alan Cox wrote: Joel Dahl wrote: On 09-12-2010 20:16, Alan Cox wrote: Author: alc Date: Thu Dec 9 20:16:00 2010 New Revision: 216333 URL: http://svn.freebsd.org/changeset/base/216333 Log: When r207410 eliminated the acquisition and release of the page queues lock from pmap_extract_and_hold(), it didn't take into account that pmap_pte_quick() sometimes requires the page queues lock to be held. This change reimplements pmap_extract_and_hold() such that it no longer uses pmap_pte_quick(), and thus never requires the page queues lock. For consistency, adopt the same idiom as used by the new implementation of pmap_extract_and_hold() in pmap_extract() and pmap_mincore(). It also happens to make these functions shorter. Hi Alan, This commit makes my laptop hang everytime I quit X. I just get a black screen and the machine won't respond to any keys. Everything works if I go back to r216330. Can you please try the following change? I'm afraid the patch didn't make any difference. It still hangs. I already looked at the similar report. It seems that the driver allocates a page using kmem_alloc_contig(), then creates OBJT_SG object, and changes the mapping to use the fictitious page instantiated by sg object. Since kmem_free() sees wired mapping, it calls vm_fault_unwire(), which is incompatible with fictitious wired pages. I cannot guarantee that this is definitely what happens, but backtrace looked plausible. pgpeC7JREs10N.pgp Description: PGP signature
svn commit: r216516 - head/sys/i386/i386
Author: kib Date: Sat Dec 18 11:31:32 2010 New Revision: 216516 URL: http://svn.freebsd.org/changeset/base/216516 Log: In pmap_extract(), unlock pmap lock earlier. The calculation does not need the lock when operating on local variables. Reviewed by: alc Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c == --- head/sys/i386/i386/pmap.c Sat Dec 18 10:09:07 2010(r216515) +++ head/sys/i386/i386/pmap.c Sat Dec 18 11:31:32 2010(r216516) @@ -1299,13 +1299,13 @@ pmap_extract(pmap_t pmap, vm_offset_t va ptep = pmap_pte(pmap, va); pte = (ptep != NULL) ? *ptep : 0; pmap_pte_release(ptep); + PMAP_UNLOCK(pmap); if ((pte PG_V) != 0) { if ((pte PG_PS) != 0) rtval = (pte PG_PS_FRAME) | (va PDRMASK); else rtval = (pte PG_FRAME) | (va PAGE_MASK); } - PMAP_UNLOCK(pmap); return (rtval); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r216473 - head/sbin/geom/class/eli
On Thu, 16.12.2010 at 16:43:48 -0800, David O'Brien wrote: On Thu, Dec 16, 2010 at 12:27:04PM -0800, Xin LI wrote: On 12/16/10 12:23, Ulrich Spörlein wrote: Shamless plug: the attached, crude expect(1) script allows you to do $ cd /usr/src universe-build sbin/geom WARNS=6 with the minimal amount of compilation (you have to build the toolchain once, though). I found it invaluable. I think we could probably put that in src/tools/somewhere... Ulrich, Yes, please. I'd love to, but some tcl/expect expert should get in contact with me first, as the script has some serious deficiencies that need fixing before a public release. Uli ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216518 - in head/sys/dev: if_ndis le malo sound/pci
Author: tijl Date: Sat Dec 18 14:21:28 2010 New Revision: 216518 URL: http://svn.freebsd.org/changeset/base/216518 Log: Use convenience functions where possible instead of accessing the PCI configuration registers directly. Remove pci_enable_io calls where they are redundant. The PCI bus driver will set the right bits when the corresponding bus resource is activated. Remove redundant pci_* function calls from suspend/resume methods. The bus driver already saves and restores the PCI configuration. Reviewed by: jhb Approved by: kib (mentor) Modified: head/sys/dev/if_ndis/if_ndis_pci.c head/sys/dev/le/if_le_pci.c head/sys/dev/malo/if_malo_pci.c head/sys/dev/sound/pci/atiixp.c head/sys/dev/sound/pci/ich.c Modified: head/sys/dev/if_ndis/if_ndis_pci.c == --- head/sys/dev/if_ndis/if_ndis_pci.c Sat Dec 18 11:45:54 2010 (r216517) +++ head/sys/dev/if_ndis/if_ndis_pci.c Sat Dec 18 14:21:28 2010 (r216518) @@ -116,8 +116,8 @@ ndis_devcompare(bustype, t, dev) while(t-ndis_name != NULL) { if ((pci_get_vendor(dev) == t-ndis_vid) (pci_get_device(dev) == t-ndis_did) - ((pci_read_config(dev, PCIR_SUBVEND_0, 4) == - t-ndis_subsys) || t-ndis_subsys == 0)) { + (pci_get_subvendor(dev) == t-ndis_subsys || +t-ndis_subsys == 0)) { device_set_desc(dev, t-ndis_name); return(TRUE); } @@ -201,7 +201,6 @@ ndis_attach_pci(dev) error = ENXIO; goto fail; } - pci_enable_io(dev, SYS_RES_IOPORT); break; case SYS_RES_MEMORY: if (sc-ndis_res_altmem != NULL @@ -239,7 +238,6 @@ ndis_attach_pci(dev) goto fail; } } - pci_enable_io(dev, SYS_RES_MEMORY); break; case SYS_RES_IRQ: rid = rle-rid; @@ -309,11 +307,8 @@ ndis_attach_pci(dev) (pci_get_device(dev) == t-ndis_did)) { if (t-ndis_subsys == 0) defidx = devidx; - else { - if (t-ndis_subsys == - pci_read_config(dev, PCIR_SUBVEND_0, 4)) - break; - } + else if (pci_get_subvendor(dev) == t-ndis_subsys) + break; } t++; devidx++; Modified: head/sys/dev/le/if_le_pci.c == --- head/sys/dev/le/if_le_pci.c Sat Dec 18 11:45:54 2010(r216517) +++ head/sys/dev/le/if_le_pci.c Sat Dec 18 14:21:28 2010(r216518) @@ -312,7 +312,6 @@ le_pci_attach(device_t dev) LE_LOCK_INIT(sc, device_get_nameunit(dev)); pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_IOPORT); i = PCIR_BAR(0); lesc-sc_rres = bus_alloc_resource_any(dev, SYS_RES_IOPORT, Modified: head/sys/dev/malo/if_malo_pci.c == --- head/sys/dev/malo/if_malo_pci.c Sat Dec 18 11:45:54 2010 (r216517) +++ head/sys/dev/malo/if_malo_pci.c Sat Dec 18 14:21:28 2010 (r216518) @@ -150,21 +150,6 @@ malo_pci_probe(device_t dev) } static int -malo_pci_setup(device_t dev) -{ - - /* -* Enable memory mapping and bus mastering. -*/ - if (pci_enable_busmaster(dev) != 0) - return -1; - if (pci_enable_io(dev, SYS_RES_MEMORY) != 0) - return -1; - - return 0; -} - -static int malo_pci_attach(device_t dev) { int error = ENXIO, i, msic, reg; @@ -173,11 +158,7 @@ malo_pci_attach(device_t dev) sc-malo_dev = dev; - /* -* Enable memory mapping and bus mastering. -*/ - if (malo_pci_setup(dev)) - return (ENXIO); + pci_enable_busmaster(dev); /* * Setup memory-mapping of PCI registers. @@ -342,9 +323,6 @@ malo_pci_resume(device_t dev) { struct malo_pci_softc *psc = device_get_softc(dev); - if (!malo_pci_setup(dev)) - return ENXIO; - malo_resume(psc-malo_sc); return (0); Modified: head/sys/dev/sound/pci/atiixp.c == --- head/sys/dev/sound/pci/atiixp.c Sat Dec 18 11:45:54 2010
svn commit: r216519 - head/sys/dev/hifn
Author: tijl Date: Sat Dec 18 14:24:24 2010 New Revision: 216519 URL: http://svn.freebsd.org/changeset/base/216519 Log: No need to zero the softc. It's allocated with M_ZERO. Use pci_enable_busmaster instead of setting PCIM_CMD_BUSMASTEREN directly. There's no need to set PCIM_CMD_MEMEN. The bit is set when a SYS_RES_MEMORY resource is activated. Remove redundant pci_* function calls from suspend/resume methods. The bus driver already saves and restores the PCI configuration. Write 1 byte instead of 4 when setting the HIFN_TRDY_TIMEOUT register. It is only 1 byte according to the specification. Reviewed by: jhb Approved by: kib (mentor) Modified: head/sys/dev/hifn/hifn7751.c Modified: head/sys/dev/hifn/hifn7751.c == --- head/sys/dev/hifn/hifn7751.cSat Dec 18 14:21:28 2010 (r216518) +++ head/sys/dev/hifn/hifn7751.cSat Dec 18 14:24:24 2010 (r216519) @@ -355,14 +355,11 @@ static int hifn_attach(device_t dev) { struct hifn_softc *sc = device_get_softc(dev); - u_int32_t cmd; caddr_t kva; int rseg, rid; char rbase; u_int16_t ena, rev; - KASSERT(sc != NULL, (hifn_attach: null software carrier!)); - bzero(sc, sizeof (*sc)); sc-sc_dev = dev; mtx_init(sc-sc_mtx, device_get_nameunit(dev), hifn driver, MTX_DEF); @@ -402,30 +399,13 @@ hifn_attach(device_t dev) } /* -* Configure support for memory-mapped access to -* registers and for DMA operations. -*/ -#definePCIM_ENA(PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN) - cmd = pci_read_config(dev, PCIR_COMMAND, 4); - cmd |= PCIM_ENA; - pci_write_config(dev, PCIR_COMMAND, cmd, 4); - cmd = pci_read_config(dev, PCIR_COMMAND, 4); - if ((cmd PCIM_ENA) != PCIM_ENA) { - device_printf(dev, failed to enable %s\n, - (cmd PCIM_ENA) == 0 ? - memory mapping bus mastering : - (cmd PCIM_CMD_MEMEN) == 0 ? - memory mapping : bus mastering); - goto fail_pci; - } -#undef PCIM_ENA - - /* * Setup PCI resources. Note that we record the bus * tag and handle for each register mapping, this is * used by the READ_REG_0, WRITE_REG_0, READ_REG_1, * and WRITE_REG_1 macros throughout the driver. */ + pci_enable_busmaster(dev); + rid = HIFN_BAR0; sc-sc_bar0res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE); @@ -727,10 +707,6 @@ hifn_resume(device_t dev) { struct hifn_softc *sc = device_get_softc(dev); #ifdef notyet - /* reenable busmastering */ - pci_enable_busmaster(dev); - pci_enable_io(dev, HIFN_RES); - /* reinitialize interface if necessary */ if (ifp-if_flags IFF_UP) rl_init(sc); @@ -910,7 +886,7 @@ hifn_set_retry(struct hifn_softc *sc) { /* NB: RETRY only responds to 8-bit reads/writes */ pci_write_config(sc-sc_dev, HIFN_RETRY_TIMEOUT, 0, 1); - pci_write_config(sc-sc_dev, HIFN_TRDY_TIMEOUT, 0, 4); + pci_write_config(sc-sc_dev, HIFN_TRDY_TIMEOUT, 0, 1); } /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216520 - head
Author: nwhitehorn Date: Sat Dec 18 14:34:05 2010 New Revision: 216520 URL: http://svn.freebsd.org/changeset/base/216520 Log: Reconnect arm to the universe build, and connect big-endian MIPS and ARM and powerpc64 to universe for the first time. In general, provide (slightly hacky) knowledge of multi-architecture TARGETs to universe as well as the ability to distinguish the correct toolchain for a given kernel using config -m. Modified: head/Makefile Modified: head/Makefile == --- head/Makefile Sat Dec 18 14:24:24 2010(r216519) +++ head/Makefile Sat Dec 18 14:34:05 2010(r216520) @@ -281,7 +281,15 @@ tinderbox: # existing system is. # .if make(universe) || make(universe_kernels) || make(tinderbox) -TARGETS?=amd64 i386 ia64 pc98 powerpc sparc64 sun4v mips +TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v +TARGET_ARCHES_arm?=arm armeb +TARGET_ARCHES_mips?= mipsel mipseb +TARGET_ARCHES_powerpc?=powerpc powerpc64 +TARGET_ARCHES_pc98?= i386 +TARGET_ARCHES_sun4v?= sparc64 +.for target in ${TARGETS} +TARGET_ARCHES_${target}?= ${target} +.endfor .if defined(DOING_TINDERBOX) FAILFILE=tinderbox.failed @@ -301,16 +309,24 @@ universe_prologue: .for target in ${TARGETS} universe: universe_${target} .ORDER: universe_prologue universe_${target} universe_epilogue -universe_${target}: -.if !defined(MAKE_JUST_KERNELS) +universe_${target}: universe_${target}_prologue +universe_${target}_prologue: @echo ${target} started on `LC_ALL=C date` +.if !defined(MAKE_JUST_KERNELS) +.for target_arch in ${TARGET_ARCHES_${target}} +universe_${target}: universe_${target}_${target_arch} +universe_${target}_${target_arch}: universe_${target}_prologue + @echo ${target}.${target_arch} buildworld started on `LC_ALL=C date` @(cd ${.CURDIR} env __MAKE_CONF=/dev/null \ ${MAKE} ${JFLAG} buildworld \ TARGET=${target} \ -_.${target}.buildworld 21 || \ - (echo ${target} world failed, \ - check _.${target}.buildworld for details | ${MAKEFAIL})) - @echo ${target} buildworld completed on `LC_ALL=C date` + TARGET_ARCH=${target_arch} \ +_.${target}.${target_arch}.buildworld 21 || \ + (echo ${target}.${target_arch} world failed, \ + check _.${target}.${target_arch}.buildworld for details | \ + ${MAKEFAIL})) + @echo ${target}.${target_arch} buildworld completed on `LC_ALL=C date` +.endfor .endif .if !defined(MAKE_JUST_WORLDS) .if exists(${.CURDIR}/sys/${target}/conf/NOTES) @@ -333,9 +349,15 @@ KERNCONFS!=cd ${.CURDIR}/sys/${TARGET}/ ! -name DEFAULTS ! -name NOTES universe_kernconfs: .for kernel in ${KERNCONFS} +TARGET_ARCH_${kernel}!=cd ${.CURDIR}/sys/${TARGET}/conf \ + config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} | \ + cut -f 2 +universe_kernconfs: universe_kernconf_${TARGET}_${kernel} +universe_kernconf_${TARGET}_${kernel}: @(cd ${.CURDIR} env __MAKE_CONF=/dev/null \ ${MAKE} ${JFLAG} buildkernel \ TARGET=${TARGET} \ + TARGET_ARCH=${TARGET_ARCH_${kernel}} \ KERNCONF=${kernel} \ _.${TARGET}.${kernel} 21 || \ (echo ${TARGET} ${kernel} kernel failed, \ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216521 - head/sys/dev/wpi
Author: bschmidt Date: Sat Dec 18 15:25:21 2010 New Revision: 216521 URL: http://svn.freebsd.org/changeset/base/216521 Log: Fix a panic while disabling the RF kill button, caller of the wpi_rfkill_resume() function will take care of the lock. PR: kern/144898 MFC after:3 days Modified: head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/wpi/if_wpi.c == --- head/sys/dev/wpi/if_wpi.c Sat Dec 18 14:34:05 2010(r216520) +++ head/sys/dev/wpi/if_wpi.c Sat Dec 18 15:25:21 2010(r216521) @@ -3004,14 +3004,12 @@ wpi_rfkill_resume(struct wpi_softc *sc) if (ntries == 1000) { device_printf(sc-sc_dev, timeout waiting for thermal calibration\n); - WPI_UNLOCK(sc); return; } DPRINTFN(WPI_DEBUG_TEMP,(temperature %d\n, sc-temp)); if (wpi_config(sc) != 0) { device_printf(sc-sc_dev, device config failed\n); - WPI_UNLOCK(sc); return; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216522 - head/sys/dev/wpi
Author: bschmidt Date: Sat Dec 18 15:35:10 2010 New Revision: 216522 URL: http://svn.freebsd.org/changeset/base/216522 Log: Fix association on 5GHz channels. The device is initially configured using a 2GHz channel with appropriate flags set to sc-config. Due to not zeroing sc-config for auth/assoc those flags are still set while trying to connect on a 5GHz channel. MFC after:3 days Modified: head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/wpi/if_wpi.c == --- head/sys/dev/wpi/if_wpi.c Sat Dec 18 15:25:21 2010(r216521) +++ head/sys/dev/wpi/if_wpi.c Sat Dec 18 15:35:10 2010(r216522) @@ -2429,6 +2429,9 @@ wpi_auth(struct wpi_softc *sc, struct ie if (IEEE80211_IS_CHAN_2GHZ(ni-ni_chan)) { sc-config.flags |= htole32(WPI_CONFIG_AUTO | WPI_CONFIG_24GHZ); + } else { + sc-config.flags = ~htole32(WPI_CONFIG_AUTO | + WPI_CONFIG_24GHZ); } if (IEEE80211_IS_CHAN_A(ni-ni_chan)) { sc-config.cck_mask = 0; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216523 - head/sys/dev/wpi
Author: bschmidt Date: Sat Dec 18 15:45:10 2010 New Revision: 216523 URL: http://svn.freebsd.org/changeset/base/216523 Log: Add 2 missing bus_dmamap_sync() calls. Those fix random 'scan timeout', 'could not set power mode', 'device config failed' and other errors due reading invalid memory. Obtained from:OpenBSD MFC after:3 days Modified: head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/wpi/if_wpi.c == --- head/sys/dev/wpi/if_wpi.c Sat Dec 18 15:35:10 2010(r216522) +++ head/sys/dev/wpi/if_wpi.c Sat Dec 18 15:45:10 2010(r216523) @@ -1645,9 +1645,15 @@ wpi_notif_intr(struct wpi_softc *sc) struct wpi_rx_data *data; uint32_t hw; + bus_dmamap_sync(sc-shared_dma.tag, sc-shared_dma.map, + BUS_DMASYNC_POSTREAD); + hw = le32toh(sc-shared-next); while (sc-rxq.cur != hw) { data = sc-rxq.data[sc-rxq.cur]; + + bus_dmamap_sync(sc-rxq.data_dmat, data-map, + BUS_DMASYNC_POSTREAD); desc = (void *)data-m-m_ext.ext_buf; DPRINTFN(WPI_DEBUG_NOTIFY, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216524 - in head/sys: amd64/include i386/include
Author: kib Date: Sat Dec 18 16:41:11 2010 New Revision: 216524 URL: http://svn.freebsd.org/changeset/base/216524 Log: Inform a compiler which asm statements in the x86 implementation of atomics change eflags. Reviewed by: jhb MFC after:2 weeks Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h == --- head/sys/amd64/include/atomic.h Sat Dec 18 15:45:10 2010 (r216523) +++ head/sys/amd64/include/atomic.h Sat Dec 18 16:41:11 2010 (r216524) @@ -108,7 +108,8 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE { \ __asm __volatile(MPLOCKED OP\ : =m (*p) \ - : CONS (V), m (*p)); \ + : CONS (V), m (*p)\ + : cc);\ } \ \ static __inline void \ @@ -117,7 +118,7 @@ atomic_##NAME##_barr_##TYPE(volatile u_# __asm __volatile(MPLOCKED OP\ : =m (*p) \ : CONS (V), m (*p)\ - : memory);\ + : memory, cc); \ } \ struct __hack @@ -145,7 +146,7 @@ atomic_cmpset_int(volatile u_int *dst, u : r (src),/* 2 */ a (expect), /* 3 */ m (*dst)/* 4 */ - : memory); + : memory, cc); return (res); } @@ -166,7 +167,7 @@ atomic_cmpset_long(volatile u_long *dst, : r (src),/* 2 */ a (expect), /* 3 */ m (*dst)/* 4 */ - : memory); + : memory, cc); return (res); } @@ -185,8 +186,8 @@ atomic_fetchadd_int(volatile u_int *p, u # atomic_fetchadd_int : +r (v), /* 0 (result) */ =m (*p) /* 1 */ - : m (*p));/* 2 */ - + : m (*p) /* 2 */ + : cc); return (v); } @@ -204,8 +205,8 @@ atomic_fetchadd_long(volatile u_long *p, # atomic_fetchadd_long : +r (v), /* 0 (result) */ =m (*p) /* 1 */ - : m (*p));/* 2 */ - + : m (*p) /* 2 */ + : cc); return (v); } @@ -249,7 +250,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE : =a (res), /* 0 */ \ =m (*p) /* 1 */ \ : m (*p) /* 2 */ \ - : memory);\ + : memory, cc); \ \ return (res); \ } \ Modified: head/sys/i386/include/atomic.h == --- head/sys/i386/include/atomic.h Sat Dec 18 15:45:10 2010 (r216523) +++ head/sys/i386/include/atomic.h Sat Dec 18 16:41:11 2010 (r216524) @@ -106,7 +106,8 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE { \ __asm __volatile(MPLOCKED OP\ : =m (*p) \ - : CONS (V), m (*p)); \ + : CONS (V), m (*p)\ + : cc);\ } \ \ static __inline void \ @@ -115,7 +116,7 @@ atomic_##NAME##_barr_##TYPE(volatile u_# __asm __volatile(MPLOCKED OP\ : =m (*p) \ : CONS (V), m (*p)\ - : memory);\ + : memory, cc); \ } \ struct __hack @@ -172,7 +173,7 @@ atomic_cmpset_int(volatile u_int *dst, u : r (src),/* 2 */ a (expect), /* 3 */ m (*dst)/* 4 */ - : memory); + : memory, cc); return (res); } @@ -193,8 +194,8 @@ atomic_fetchadd_int(volatile u_int *p, u # atomic_fetchadd_int : +r (v), /*
Re: svn commit: r216473 - head/sbin/geom/class/eli
On 12/18/2010 08:34, Nathan Whitehorn wrote: On 12/17/10 13:07, Warner Losh wrote: On 12/17/2010 08:22, Nathan Whitehorn wrote: On 12/16/10 13:04, Robert Watson wrote: On Thu, 16 Dec 2010, David O'Brien wrote: Log: Bump WARNS to 6. Modified: head/sbin/geom/class/eli/Makefile FYI, this broke the tinderbox on arm, ia64, mips, and sparc64. Errr. Reverted. I built it on the architectures I had access to... For WARNS-related changes, I generally use make universe to test across architectures. This builds all of our architectures world + all available kernels, and seems the most effective way to avoid the above situations. (I've fallen into exactly the same trap...) The one thing to be cautious about is that make universe won't fail if an individual build fails, so you need to check the logs to make sure everything actually succeeded. The trouble with make universe is that it has been broken for months and months now. ARM and powerpc64 are disconnected from the build entirely, as are big-endian and 64-bit MIPS, and an increasing number of ARM and PowerPC kernels depend on FDT tools not built by default, and so do not build. Build infrastructure changes also make it appear that the PowerPC GENERIC64 kernel is broken when it is not. This severely reduces the coverage of make universe for problems like this. I have a patch at http://people.freebsd.org/~nwhitehorn/universe.diff that fixes both of these problems, by teaching the universe rule in src/Makefile about MACHINEs with multiple MACHINE_ARCHs and by enabling the build of the FDT tools by default, which adds about 300K to world. The way these are done is probably not optimal, but it is a better than the current situation and is a good stopgap. With the patch, all architectures succeed except for the ARM AVILA kernel, which seems genuinely broken, and the various 64-bit MIPS kernels, since 64-bit MIPS is not hooked up to the build yet. If I don't hear any objections, I would like to commit it on Wednesday the 22nd. That works for me. As far as I can tell, doing the MIPS64 stuff will just take about a day of patiently fixing some breakage... Maybe I'll get to it over the holidays. Thanks! With your imprimatur, I've committed the src/Makefile portion of the patch early. The FDT piece will wait until Wednesday, as announced. FDT should have always been built from the moment it went into the tree. It was a mistake to make it optional, since we have no good way to make host tools optional based on the target we're compiling... Warner ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r216473 - head/sbin/geom/class/eli
On Sat, Dec 18, 2010 at 4:51 AM, Ulrich Spörlein u...@spoerlein.net wrote: On Thu, 16.12.2010 at 16:43:48 -0800, David O'Brien wrote: On Thu, Dec 16, 2010 at 12:27:04PM -0800, Xin LI wrote: On 12/16/10 12:23, Ulrich Spörlein wrote: Shamless plug: the attached, crude expect(1) script allows you to do $ cd /usr/src universe-build sbin/geom WARNS=6 with the minimal amount of compilation (you have to build the toolchain once, though). I found it invaluable. I think we could probably put that in src/tools/somewhere... Ulrich, Yes, please. I'd love to, but some tcl/expect expert should get in contact with me first, as the script has some serious deficiencies that need fixing before a public release. I can help spotcheck the script. Feel free to CC a copy to me off-list. Thanks, -Garrett ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r216518 - in head/sys/dev: if_ndis le malo sound/pci
On 12/18/10, Tijl Coosemans t...@freebsd.org wrote: Author: tijl Date: Sat Dec 18 14:21:28 2010 New Revision: 216518 URL: http://svn.freebsd.org/changeset/base/216518 Log: Use convenience functions where possible instead of accessing the PCI configuration registers directly. Remove pci_enable_io calls where they are redundant. The PCI bus driver will set the right bits when the corresponding bus resource is activated. Remove redundant pci_* function calls from suspend/resume methods. The bus driver already saves and restores the PCI configuration. Reviewed by:jhb Approved by:kib (mentor) Please revert change to if_ndis regarding introduction of pci_get_subvendor(). You compare 16bit value with 32bit value - this will always fail. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r216491 - head/sys/dev/atkbdc
after updating svn revision = 216491 system is not detecting the device psm please take a look: http://docs.freebsd.org/cgi/mid.cgi?20101218203020.1cec8dc7 Thanks! ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216526 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 19:55:19 2010 New Revision: 216526 URL: http://svn.freebsd.org/changeset/base/216526 Log: Aggregate SIOCS80211 and SIOCG80211 ioctl request code. While here, bring the wpa_printf()/perror() messages in sync with upstream code. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 19:04:21 2010 (r216525) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 19:55:19 2010 (r216526) @@ -58,56 +58,67 @@ static int bsd_sta_deauth(void *priv, co int reason_code); static int -set80211var(struct bsd_driver_data *drv, int op, const void *arg, int arg_len) +bsd_set80211(void *priv, int op, int val, const void *arg, int arg_len) { + struct bsd_driver_data *drv = priv; struct ieee80211req ireq; - memset(ireq, 0, sizeof(ireq)); - strncpy(ireq.i_name, drv-iface, IFNAMSIZ); + os_memset(ireq, 0, sizeof(ireq)); + os_strlcpy(ireq.i_name, drv-iface, sizeof(ireq.i_name)); ireq.i_type = op; - ireq.i_len = arg_len; + ireq.i_val = val; ireq.i_data = (void *) arg; + ireq.i_len = arg_len; if (ioctl(drv-ioctl_sock, SIOCS80211, ireq) 0) { - perror(ioctl[SIOCS80211]); + wpa_printf(MSG_ERROR, ioctl[SIOCS80211, op=%u, val=%u, + arg_len=%u]: %s, op, val, arg_len, + strerror(errno)); return -1; } return 0; } static int -get80211var(struct bsd_driver_data *drv, int op, void *arg, int arg_len) +bsd_get80211(void *priv, struct ieee80211req *ireq, int op, void *arg, +int arg_len) { - struct ieee80211req ireq; + struct bsd_driver_data *drv = priv; - memset(ireq, 0, sizeof(ireq)); - strncpy(ireq.i_name, drv-iface, IFNAMSIZ); - ireq.i_type = op; - ireq.i_len = arg_len; - ireq.i_data = arg; + os_memset(ireq, 0, sizeof(*ireq)); + os_strlcpy(ireq-i_name, drv-iface, sizeof(ireq-i_name)); + ireq-i_type = op; + ireq-i_len = arg_len; + ireq-i_data = arg; - if (ioctl(drv-ioctl_sock, SIOCG80211, ireq) 0) { - perror(ioctl[SIOCG80211]); + if (ioctl(drv-ioctl_sock, SIOCG80211, ireq) 0) { + wpa_printf(MSG_ERROR, ioctl[SIOCS80211, op=%u, + arg_len=%u]: %s, op, arg_len, strerror(errno)); return -1; } - return ireq.i_len; + return 0; } static int -set80211param(struct bsd_driver_data *drv, int op, int arg) +get80211var(struct bsd_driver_data *drv, int op, void *arg, int arg_len) { struct ieee80211req ireq; - memset(ireq, 0, sizeof(ireq)); - strncpy(ireq.i_name, drv-iface, IFNAMSIZ); - ireq.i_type = op; - ireq.i_val = arg; - - if (ioctl(drv-ioctl_sock, SIOCS80211, ireq) 0) { - perror(ioctl[SIOCS80211]); + if (bsd_get80211(drv, ireq, op, arg, arg_len) 0) return -1; - } - return 0; + return ireq.i_len; +} + +static int +set80211var(struct bsd_driver_data *drv, int op, const void *arg, int arg_len) +{ + return bsd_set80211(drv, op, 0, arg, arg_len); +} + +static int +set80211param(struct bsd_driver_data *drv, int op, int arg) +{ + return bsd_set80211(drv, op, arg, NULL, 0); } static const char * @@ -395,24 +406,10 @@ bsd_sta_clear_stats(void *priv, const u8 static int bsd_set_opt_ie(void *priv, const u8 *ie, size_t ie_len) { - struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; - struct ieee80211req ireq; - - memset(ireq, 0, sizeof(ireq)); - strncpy(ireq.i_name, drv-iface, IFNAMSIZ); - ireq.i_type = IEEE80211_IOC_APPIE; - ireq.i_val = IEEE80211_APPIE_WPA; - ireq.i_data = (void *) ie; - ireq.i_len = ie_len; - - wpa_printf(MSG_DEBUG, %s: set WPA+RSN ie (len %d)\n, - __func__, ie_len); - if (ioctl(drv-ioctl_sock, SIOCS80211, ireq) 0) { - printf(Unable to set WPA+RSN ie\n); - return -1; - } - return 0; + wpa_printf(MSG_DEBUG, %s: set WPA+RSN ie (len %lu), __func__, + (unsigned long)ie_len); + return bsd_set80211(priv, IEEE80211_IOC_APPIE, IEEE80211_APPIE_WPA, + ie, ie_len); } static int ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216527 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 19:56:45 2010 New Revision: 216527 URL: http://svn.freebsd.org/changeset/base/216527 Log: Change bsd_del_key() to match upstream code: - change order of if/else - move wpa_printf() into the condition - change unsigned char* to u8* - prefer os_memset/os_memcpy Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 19:55:19 2010 (r216526) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 19:56:45 2010 (r216527) @@ -246,21 +246,19 @@ bsd_sta_set_flags(void *priv, const u8 * } static int -bsd_del_key(void *priv, const unsigned char *addr, int key_idx) +bsd_del_key(void *priv, const u8 *addr, int key_idx) { - struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; struct ieee80211req_del_key wk; - wpa_printf(MSG_DEBUG, %s: addr=%s key_idx=%d\n, - __func__, ether_sprintf(addr), key_idx); - - memset(wk, 0, sizeof(wk)); - if (addr != NULL) { - memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN); - wk.idk_keyix = (u_int8_t) IEEE80211_KEYIX_NONE; /* XXX */ - } else { + os_memset(wk, 0, sizeof(wk)); + if (addr == NULL) { + wpa_printf(MSG_DEBUG, %s: key_idx=%d, __func__, key_idx); wk.idk_keyix = key_idx; + } else { + wpa_printf(MSG_DEBUG, %s: addr= MACSTR, __func__, + MAC2STR(addr)); + os_memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN); + wk.idk_keyix = (u_int8_t) IEEE80211_KEYIX_NONE; /* XXX */ } return set80211var(priv, IEEE80211_IOC_DELKEY, wk, sizeof(wk)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216528 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 19:58:23 2010 New Revision: 216528 URL: http://svn.freebsd.org/changeset/base/216528 Log: Add bsd_send_mlme_param to aggregate IEEE80211_IOC_MLME ioctls: - merge bsd_set_sta_authorized and bsd_sta_set_flags - change bsd_set_sta_authorized, bsd_sta_deauth and bsd_sta_disassoc to use bsd_send_mlme_param Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 19:56:45 2010 (r216527) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 19:58:23 2010 (r216528) @@ -215,34 +215,35 @@ bsd_set_privacy(void *priv, int enabled) } static int -bsd_set_sta_authorized(void *priv, const u8 *addr, int authorized) +bsd_send_mlme_param(void *priv, const u8 op, const u16 reason, const u8 *addr) { - struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; struct ieee80211req_mlme mlme; - wpa_printf(MSG_DEBUG, %s: addr=%s authorized=%d\n, - __func__, ether_sprintf(addr), authorized); - - if (authorized) - mlme.im_op = IEEE80211_MLME_AUTHORIZE; - else - mlme.im_op = IEEE80211_MLME_UNAUTHORIZE; - mlme.im_reason = 0; - memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN); + os_memset(mlme, 0, sizeof(mlme)); + mlme.im_op = op; + mlme.im_reason = reason; + os_memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN); return set80211var(priv, IEEE80211_IOC_MLME, mlme, sizeof(mlme)); } static int -bsd_sta_set_flags(void *priv, const u8 *addr, int total_flags, - int flags_or, int flags_and) +bsd_set_sta_authorized(void *priv, const u8 *addr, + int total_flags, int flags_or, int flags_and) { + int authorized = -1; + /* For now, only support setting Authorized flag */ if (flags_or WPA_STA_AUTHORIZED) - return bsd_set_sta_authorized(priv, addr, 1); + authorized = 1; if (!(flags_and WPA_STA_AUTHORIZED)) - return bsd_set_sta_authorized(priv, addr, 0); - return 0; + authorized = 0; + + if (authorized 0) + return 0; + + return bsd_send_mlme_param(priv, authorized ? + IEEE80211_MLME_AUTHORIZE : + IEEE80211_MLME_UNAUTHORIZE, 0, addr); } static int @@ -413,32 +414,16 @@ bsd_set_opt_ie(void *priv, const u8 *ie, static int bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, int reason_code) { - struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; - struct ieee80211req_mlme mlme; - - wpa_printf(MSG_DEBUG, %s: addr=%s reason_code=%d\n, - __func__, ether_sprintf(addr), reason_code); - - mlme.im_op = IEEE80211_MLME_DEAUTH; - mlme.im_reason = reason_code; - memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN); - return set80211var(priv, IEEE80211_IOC_MLME, mlme, sizeof(mlme)); + return bsd_send_mlme_param(priv, IEEE80211_MLME_DEAUTH, reason_code, + addr); } static int -bsd_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr, int reason_code) +bsd_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr, +int reason_code) { - struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; - struct ieee80211req_mlme mlme; - - wpa_printf(MSG_DEBUG, %s: addr=%s reason_code=%d\n, - __func__, ether_sprintf(addr), reason_code); - - mlme.im_reason = reason_code; - memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN); - return set80211var(priv, IEEE80211_IOC_MLME, mlme, sizeof(mlme)); + return bsd_send_mlme_param(priv, IEEE80211_MLME_DISASSOC, reason_code, + addr); } static void @@ -807,7 +792,7 @@ const struct wpa_driver_ops wpa_driver_b .get_seqnum = bsd_get_seqnum, .flush = bsd_flush, .set_generic_elem = bsd_set_opt_ie, - .sta_set_flags = bsd_sta_set_flags, + .sta_set_flags = bsd_set_sta_authorized, .read_sta_data = bsd_read_sta_driver_data, .hapd_send_eapol= bsd_send_eapol, .sta_disassoc = bsd_sta_disassoc, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216529 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:00:28 2010 New Revision: 216529 URL: http://svn.freebsd.org/changeset/base/216529 Log: Move some functions around to match the upstream order. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 19:58:23 2010 (r216528) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:00:28 2010 (r216529) @@ -24,14 +24,11 @@ #include sys/socket.h #include net/if.h +#include net/route.h #include netinet/in.h #include net80211/ieee80211_ioctl.h - -#undef RSN_VERSION -#undef WPA_VERSION -#undef WPA_OUI_TYPE -#undef WME_OUI_TYPE +#include net80211/ieee80211_freebsd.h #include l2_packet/l2_packet.h @@ -54,9 +51,6 @@ struct bsd_driver_data { static const struct wpa_driver_ops bsd_driver_ops; -static int bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, -int reason_code); - static int bsd_set80211(void *priv, int op, int val, const void *arg, int arg_len) { @@ -121,16 +115,58 @@ set80211param(struct bsd_driver_data *dr return bsd_set80211(drv, op, arg, NULL, 0); } -static const char * -ether_sprintf(const u8 *addr) +static int +bsd_get_ssid(void *priv, u8 *buf, int len) { - static char buf[sizeof(MACSTR)]; + struct bsd_driver_data *drv = priv; - if (addr != NULL) - snprintf(buf, sizeof(buf), MACSTR, MAC2STR(addr)); - else - snprintf(buf, sizeof(buf), MACSTR, 0,0,0,0,0,0); - return buf; + int ssid_len = get80211var(priv, IEEE80211_IOC_SSID, buf, len); + + wpa_printf(MSG_DEBUG, %s: ssid=\%.*s\\n, __func__, ssid_len, buf); + + return ssid_len; +} + +static int +bsd_set_ssid(void *priv, const u8 *buf, int len) +{ + struct bsd_driver_data *drv = priv; + struct hostapd_data *hapd = drv-hapd; + + wpa_printf(MSG_DEBUG, %s: ssid=\%.*s\\n, __func__, len, buf); + + return set80211var(priv, IEEE80211_IOC_SSID, buf, len); +} + +static int +bsd_del_key(void *priv, const u8 *addr, int key_idx) +{ + struct ieee80211req_del_key wk; + + os_memset(wk, 0, sizeof(wk)); + if (addr == NULL) { + wpa_printf(MSG_DEBUG, %s: key_idx=%d, __func__, key_idx); + wk.idk_keyix = key_idx; + } else { + wpa_printf(MSG_DEBUG, %s: addr= MACSTR, __func__, + MAC2STR(addr)); + os_memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN); + wk.idk_keyix = (u_int8_t) IEEE80211_KEYIX_NONE; /* XXX */ + } + + return set80211var(priv, IEEE80211_IOC_DELKEY, wk, sizeof(wk)); +} + +static int +bsd_send_mlme_param(void *priv, const u8 op, const u16 reason, const u8 *addr) +{ + struct ieee80211req_mlme mlme; + + os_memset(mlme, 0, sizeof(mlme)); + mlme.im_op = op; + mlme.im_reason = reason; + os_memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN); + return set80211var(priv, IEEE80211_IOC_MLME, mlme, sizeof(mlme)); } static int @@ -178,6 +214,69 @@ bsd_commit(void *priv) } static int +bsd_set_key(const char *ifname, void *priv, enum wpa_alg alg, + const unsigned char *addr, int key_idx, int set_tx, const u8 *seq, + size_t seq_len, const u8 *key, size_t key_len) +{ + struct ieee80211req_key wk; + + wpa_printf(MSG_DEBUG, %s: alg=%d addr=%p key_idx=%d set_tx=%d + seq_len=%zu key_len=%zu, __func__, alg, addr, key_idx, + set_tx, seq_len, key_len); + + if (alg == WPA_ALG_NONE) { + return bsd_del_key(priv, addr, key_idx); + } + + os_memset(wk, 0, sizeof(wk)); + switch (alg) { + case WPA_ALG_WEP: + wk.ik_type = IEEE80211_CIPHER_WEP; + break; + case WPA_ALG_TKIP: + wk.ik_type = IEEE80211_CIPHER_TKIP; + break; + case WPA_ALG_CCMP: + wk.ik_type = IEEE80211_CIPHER_AES_CCM; + break; + default: + wpa_printf(MSG_ERROR, %s: unknown alg=%d, __func__, alg); + return -1; + } + + wk.ik_flags = IEEE80211_KEY_RECV; + if (set_tx) + wk.ik_flags |= IEEE80211_KEY_XMIT; + + if (addr == NULL) { + os_memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN); + wk.ik_keyix = key_idx; + } else { + os_memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN); + /* +* Deduce whether group/global or unicast key by checking +* the address (yech). Note also that we can only mark global +* keys default; doing this for a unicast key is an error. +*/ + if (os_memcmp(addr, \xff\xff\xff\xff\xff\xff, + IEEE80211_ADDR_LEN) == 0) { +
svn commit: r216530 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:04:47 2010 New Revision: 216530 URL: http://svn.freebsd.org/changeset/base/216530 Log: Rename ioctl_sock to just sock to match the upstream code. While here remove the no longer used wext_sock and bsd_driver_ops variables. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:00:28 2010 (r216529) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:04:47 2010 (r216530) @@ -35,8 +35,7 @@ struct bsd_driver_data { struct hostapd_data *hapd; /* back pointer */ - int ioctl_sock; /* open socket for 802.11 ioctls */ - int wext_sock; + int sock; /* open socket for 802.11 ioctls */ struct l2_packet_data *sock_xmit;/* raw packet xmit socket */ int route; /* routing socket for events */ chariface[IFNAMSIZ+1]; /* interface name */ @@ -49,8 +48,6 @@ struct bsd_driver_data { int prev_wpa; /* wpa state to restore on deinit */ }; -static const struct wpa_driver_ops bsd_driver_ops; - static int bsd_set80211(void *priv, int op, int val, const void *arg, int arg_len) { @@ -64,7 +61,7 @@ bsd_set80211(void *priv, int op, int val ireq.i_data = (void *) arg; ireq.i_len = arg_len; - if (ioctl(drv-ioctl_sock, SIOCS80211, ireq) 0) { + if (ioctl(drv-sock, SIOCS80211, ireq) 0) { wpa_printf(MSG_ERROR, ioctl[SIOCS80211, op=%u, val=%u, arg_len=%u]: %s, op, val, arg_len, strerror(errno)); @@ -85,7 +82,7 @@ bsd_get80211(void *priv, struct ieee8021 ireq-i_len = arg_len; ireq-i_data = arg; - if (ioctl(drv-ioctl_sock, SIOCG80211, ireq) 0) { + if (ioctl(drv-sock, SIOCG80211, ireq) 0) { wpa_printf(MSG_ERROR, ioctl[SIOCS80211, op=%u, arg_len=%u]: %s, op, arg_len, strerror(errno)); return -1; @@ -178,13 +175,13 @@ bsd_set_iface_flags(void *priv, int flag wpa_printf(MSG_DEBUG, %s: flags=0x%x\n, __func__, flags); - if (drv-ioctl_sock 0) + if (drv-sock 0) return -1; memset(ifr, 0, sizeof(ifr)); snprintf(ifr.ifr_name, IFNAMSIZ, %s, drv-iface); - if (ioctl(drv-ioctl_sock, SIOCGIFFLAGS, ifr) != 0) { + if (ioctl(drv-sock, SIOCGIFFLAGS, ifr) != 0) { perror(ioctl[SIOCGIFFLAGS]); return -1; } @@ -200,7 +197,7 @@ bsd_set_iface_flags(void *priv, int flag ifr.ifr_flags |= flags; } - if (ioctl(drv-ioctl_sock, SIOCSIFFLAGS, ifr) != 0) { + if (ioctl(drv-sock, SIOCSIFFLAGS, ifr) != 0) { perror(ioctl[SIOCSIFFLAGS]); return -1; } @@ -712,8 +709,8 @@ bsd_init(struct hostapd_data *hapd, stru } drv-hapd = hapd; - drv-ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); - if (drv-ioctl_sock 0) { + drv-sock = socket(PF_INET, SOCK_DGRAM, 0); + if (drv-sock 0) { perror(socket[PF_INET,SOCK_DGRAM]); goto bad; } @@ -755,8 +752,8 @@ bad: if (drv != NULL) { if (drv-sock_xmit != NULL) l2_packet_deinit(drv-sock_xmit); - if (drv-ioctl_sock = 0) - close(drv-ioctl_sock); + if (drv-sock = 0) + close(drv-sock); free(drv); } return NULL; @@ -773,8 +770,8 @@ bsd_deinit(void *priv) close(drv-route); } (void) bsd_set_iface_flags(drv, -IFF_UP); - if (drv-ioctl_sock = 0) - close(drv-ioctl_sock); + if (drv-sock = 0) + close(drv-sock); if (drv-sock_xmit != NULL) l2_packet_deinit(drv-sock_xmit); free(drv); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216531 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:08:21 2010 New Revision: 216531 URL: http://svn.freebsd.org/changeset/base/216531 Log: Rename iface to ifname to match the upstream code. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:04:47 2010 (r216530) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:08:21 2010 (r216531) @@ -38,7 +38,7 @@ struct bsd_driver_data { int sock; /* open socket for 802.11 ioctls */ struct l2_packet_data *sock_xmit;/* raw packet xmit socket */ int route; /* routing socket for events */ - chariface[IFNAMSIZ+1]; /* interface name */ + charifname[IFNAMSIZ+1]; /* interface name */ unsigned int ifindex; /* interface index */ void*ctx; struct wpa_driver_capa capa;/* driver capability */ @@ -55,7 +55,7 @@ bsd_set80211(void *priv, int op, int val struct ieee80211req ireq; os_memset(ireq, 0, sizeof(ireq)); - os_strlcpy(ireq.i_name, drv-iface, sizeof(ireq.i_name)); + os_strlcpy(ireq.i_name, drv-ifname, sizeof(ireq.i_name)); ireq.i_type = op; ireq.i_val = val; ireq.i_data = (void *) arg; @@ -77,7 +77,7 @@ bsd_get80211(void *priv, struct ieee8021 struct bsd_driver_data *drv = priv; os_memset(ireq, 0, sizeof(*ireq)); - os_strlcpy(ireq-i_name, drv-iface, sizeof(ireq-i_name)); + os_strlcpy(ireq-i_name, drv-ifname, sizeof(ireq-i_name)); ireq-i_type = op; ireq-i_len = arg_len; ireq-i_data = arg; @@ -179,7 +179,7 @@ bsd_set_iface_flags(void *priv, int flag return -1; memset(ifr, 0, sizeof(ifr)); - snprintf(ifr.ifr_name, IFNAMSIZ, %s, drv-iface); + snprintf(ifr.ifr_name, IFNAMSIZ, %s, drv-ifname); if (ioctl(drv-sock, SIOCGIFFLAGS, ifr) != 0) { perror(ioctl[SIOCGIFFLAGS]); @@ -714,7 +714,7 @@ bsd_init(struct hostapd_data *hapd, stru perror(socket[PF_INET,SOCK_DGRAM]); goto bad; } - memcpy(drv-iface, params-ifname, sizeof(drv-iface)); + memcpy(drv-ifname, params-ifname, sizeof(drv-ifname)); /* * NB: We require the interface name be mappable to an index. * This implies we do not support having wpa_supplicant @@ -722,13 +722,14 @@ bsd_init(struct hostapd_data *hapd, stru * doesn't belong here; it's really the job of devd. * XXXSCW: devd is FreeBSD-specific. */ - drv-ifindex = if_nametoindex(drv-iface); + drv-ifindex = if_nametoindex(drv-ifname); if (drv-ifindex == 0) { - printf(%s: interface %s does not exist, __func__, drv-iface); + printf(%s: interface %s does not exist, __func__, + drv-ifname); goto bad; } - drv-sock_xmit = l2_packet_init(drv-iface, NULL, ETH_P_EAPOL, + drv-sock_xmit = l2_packet_init(drv-ifname, NULL, ETH_P_EAPOL, handle_read, drv, 1); if (drv-sock_xmit == NULL) goto bad; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216532 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:11:09 2010 New Revision: 216532 URL: http://svn.freebsd.org/changeset/base/216532 Log: Remove debug messages which are no longer present in upstream code. While here remove some explicit line breaks. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:08:21 2010 (r216531) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:11:09 2010 (r216532) @@ -119,8 +119,6 @@ bsd_get_ssid(void *priv, u8 *buf, int le int ssid_len = get80211var(priv, IEEE80211_IOC_SSID, buf, len); - wpa_printf(MSG_DEBUG, %s: ssid=\%.*s\\n, __func__, ssid_len, buf); - return ssid_len; } @@ -130,8 +128,6 @@ bsd_set_ssid(void *priv, const u8 *buf, struct bsd_driver_data *drv = priv; struct hostapd_data *hapd = drv-hapd; - wpa_printf(MSG_DEBUG, %s: ssid=\%.*s\\n, __func__, len, buf); - return set80211var(priv, IEEE80211_IOC_SSID, buf, len); } @@ -173,8 +169,6 @@ bsd_set_iface_flags(void *priv, int flag struct hostapd_data *hapd = drv-hapd; struct ifreq ifr; - wpa_printf(MSG_DEBUG, %s: flags=0x%x\n, __func__, flags); - if (drv-sock 0) return -1; @@ -276,7 +270,7 @@ bsd_set_key(const char *ifname, void *pr static int bsd_set_ieee8021x(void *priv, struct wpa_bss_params *params) { - wpa_printf(MSG_DEBUG, %s: enabled=%d\n, __func__, params-enabled); + wpa_printf(MSG_DEBUG, %s: enabled=%d, __func__, params-enabled); if (!params-enabled) { /* XXX restore state */ @@ -425,7 +419,7 @@ ether_sprintf(const u8 *addr) static int bsd_set_privacy(void *priv, int enabled) { - wpa_printf(MSG_DEBUG, %s: enabled=%d\n, __func__, enabled); + wpa_printf(MSG_DEBUG, %s: enabled=%d, __func__, enabled); return set80211param(priv, IEEE80211_IOC_PRIVACY, enabled); } @@ -438,7 +432,7 @@ bsd_get_seqnum(const char *ifname, void struct hostapd_data *hapd = drv-hapd; struct ieee80211req_key wk; - wpa_printf(MSG_DEBUG, %s: addr=%s idx=%d\n, + wpa_printf(MSG_DEBUG, %s: addr=%s idx=%d, __func__, ether_sprintf(addr), idx); memset(wk, 0, sizeof(wk)); @@ -495,7 +489,7 @@ bsd_sta_clear_stats(void *priv, const u8 struct hostapd_data *hapd = drv-hapd; struct ieee80211req_sta_stats stats; - wpa_printf(MSG_DEBUG, %s: addr=%s\n, __func__, ether_sprintf(addr)); + wpa_printf(MSG_DEBUG, %s: addr=%s, __func__, ether_sprintf(addr)); /* zero station statistics */ memset(stats, 0, sizeof(stats)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216533 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:13:42 2010 New Revision: 216533 URL: http://svn.freebsd.org/changeset/base/216533 Log: Remove some unused variables and unnecessary casts. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:11:09 2010 (r216532) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:13:42 2010 (r216533) @@ -113,22 +113,19 @@ set80211param(struct bsd_driver_data *dr } static int -bsd_get_ssid(void *priv, u8 *buf, int len) +bsd_get_ssid(void *priv, u8 *ssid, int len) { struct bsd_driver_data *drv = priv; - int ssid_len = get80211var(priv, IEEE80211_IOC_SSID, buf, len); - - return ssid_len; + return get80211var(drv, IEEE80211_IOC_SSID, ssid, IEEE80211_NWID_LEN); } static int -bsd_set_ssid(void *priv, const u8 *buf, int len) +bsd_set_ssid(void *priv, const u8 *ssid, int ssid_len) { struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; - return set80211var(priv, IEEE80211_IOC_SSID, buf, len); + return set80211var(drv, IEEE80211_IOC_SSID, ssid, ssid_len); } static int @@ -166,7 +163,6 @@ static int bsd_set_iface_flags(void *priv, int flags) { struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; struct ifreq ifr; if (drv-sock 0) @@ -350,7 +346,6 @@ bsd_send_eapol(void *priv, const u8 *add { struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; unsigned char buf[3000]; unsigned char *bp = buf; struct l2_ethhdr *eth; @@ -428,8 +423,6 @@ static int bsd_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx, u8 *seq) { - struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; struct ieee80211req_key wk; wpa_printf(MSG_DEBUG, %s: addr=%s idx=%d, @@ -442,7 +435,7 @@ bsd_get_seqnum(const char *ifname, void memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN); wk.ik_keyix = idx; - if (get80211var(drv, IEEE80211_IOC_WPAKEY, wk, sizeof(wk)) 0) { + if (get80211var(priv, IEEE80211_IOC_WPAKEY, wk, sizeof(wk)) 0) { printf(Failed to get encryption.\n); return -1; } else { @@ -468,11 +461,11 @@ static int bsd_read_sta_driver_data(void *priv, struct hostap_sta_driver_data *data, const u8 *addr) { - struct bsd_driver_data *drv = priv; struct ieee80211req_sta_stats stats; memcpy(stats.is_u.macaddr, addr, IEEE80211_ADDR_LEN); - if (get80211var(drv, IEEE80211_IOC_STA_STATS, stats, sizeof(stats)) 0) { + if (get80211var(priv, IEEE80211_IOC_STA_STATS, stats, sizeof(stats)) +0) { /* XXX? do packets counts include non-data frames? */ data-rx_packets = stats.is_stats.ns_rx_data; data-rx_bytes = stats.is_stats.ns_rx_bytes; @@ -485,8 +478,6 @@ bsd_read_sta_driver_data(void *priv, str static int bsd_sta_clear_stats(void *priv, const u8 *addr) { - struct bsd_driver_data *drv = priv; - struct hostapd_data *hapd = drv-hapd; struct ieee80211req_sta_stats stats; wpa_printf(MSG_DEBUG, %s: addr=%s, __func__, ether_sprintf(addr)); @@ -494,7 +485,8 @@ bsd_sta_clear_stats(void *priv, const u8 /* zero station statistics */ memset(stats, 0, sizeof(stats)); memcpy(stats.is_u.macaddr, addr, IEEE80211_ADDR_LEN); - return set80211var(drv, IEEE80211_IOC_STA_STATS, stats, sizeof(stats)); + return set80211var(priv, IEEE80211_IOC_STA_STATS, stats, + sizeof(stats)); } static int @@ -516,7 +508,6 @@ static void bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx) { struct bsd_driver_data *drv = ctx; - struct hostapd_data *hapd = drv-hapd; char buf[2048]; struct if_announcemsghdr *ifan; struct rt_msghdr *rtm; @@ -588,12 +579,12 @@ bsd_wireless_event_receive(int sock, voi auth = (struct ieee80211_auth_event *) ifan[1]; wpa_printf(MSG_DEBUG, 802.11 AUTH, STA = MACSTR, MAC2STR(auth-iev_addr)); - n = hostapd_allowed_address(hapd, auth-iev_addr, + n = hostapd_allowed_address(drv-hapd, auth-iev_addr, NULL, 0, NULL, NULL, NULL); switch (n) { case HOSTAPD_ACL_ACCEPT: case HOSTAPD_ACL_REJECT: - hostapd_set_radius_acl_auth(hapd, + hostapd_set_radius_acl_auth(drv-hapd,
svn commit: r216535 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:15:47 2010 New Revision: 216535 URL: http://svn.freebsd.org/changeset/base/216535 Log: Prefer os_memset, os_strlcpy and os_free. While here adjust the return value checks for 2 ioctl calls and rewrite error handling in bsd_init to better integrate with upstream code. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:14:47 2010 (r216534) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:15:47 2010 (r216535) @@ -168,10 +168,10 @@ bsd_set_iface_flags(void *priv, int flag if (drv-sock 0) return -1; - memset(ifr, 0, sizeof(ifr)); - snprintf(ifr.ifr_name, IFNAMSIZ, %s, drv-ifname); + os_memset(ifr, 0, sizeof(ifr)); + os_strlcpy(ifr.ifr_name, drv-ifname, sizeof(ifr.ifr_name)); - if (ioctl(drv-sock, SIOCGIFFLAGS, ifr) != 0) { + if (ioctl(drv-sock, SIOCGIFFLAGS, ifr) 0) { perror(ioctl[SIOCGIFFLAGS]); return -1; } @@ -187,7 +187,7 @@ bsd_set_iface_flags(void *priv, int flag ifr.ifr_flags |= flags; } - if (ioctl(drv-sock, SIOCSIFFLAGS, ifr) != 0) { + if (ioctl(drv-sock, SIOCSIFFLAGS, ifr) 0) { perror(ioctl[SIOCSIFFLAGS]); return -1; } @@ -697,7 +697,7 @@ bsd_init(struct hostapd_data *hapd, stru perror(socket[PF_INET,SOCK_DGRAM]); goto bad; } - memcpy(drv-ifname, params-ifname, sizeof(drv-ifname)); + os_strlcpy(drv-ifname, params-ifname, sizeof(drv-ifname)); /* * NB: We require the interface name be mappable to an index. * This implies we do not support having wpa_supplicant @@ -733,13 +733,13 @@ bsd_init(struct hostapd_data *hapd, stru return drv; bad: - if (drv != NULL) { - if (drv-sock_xmit != NULL) - l2_packet_deinit(drv-sock_xmit); - if (drv-sock = 0) - close(drv-sock); - free(drv); - } + if (drv == NULL) + return NULL; + if (drv-sock_xmit != NULL) + l2_packet_deinit(drv-sock_xmit); + if (drv-sock = 0) + close(drv-sock); + os_free(drv); return NULL; } @@ -758,7 +758,7 @@ bsd_deinit(void *priv) close(drv-sock); if (drv-sock_xmit != NULL) l2_packet_deinit(drv-sock_xmit); - free(drv); + os_free(drv); } const struct wpa_driver_ops wpa_driver_bsd_ops = { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216536 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:17:10 2010 New Revision: 216536 URL: http://svn.freebsd.org/changeset/base/216536 Log: Import bsd_configure_wpa() to sync with upstream code. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:15:47 2010 (r216535) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:17:10 2010 (r216536) @@ -264,6 +264,17 @@ bsd_set_key(const char *ifname, void *pr } static int +bsd_configure_wpa(void *priv, struct wpa_bss_params *params) +{ + wpa_printf(MSG_DEBUG, %s: enable WPA= 0x%x, __func__, params-wpa); + if (set80211param(priv, IEEE80211_IOC_WPA, params-wpa)) { + printf(Unable to set WPA to %u\n, params-wpa); + return -1; + } + return 0; +} + +static int bsd_set_ieee8021x(void *priv, struct wpa_bss_params *params) { wpa_printf(MSG_DEBUG, %s: enabled=%d, __func__, params-enabled); @@ -278,7 +289,7 @@ bsd_set_ieee8021x(void *priv, struct wpa __func__); return -1; } - if (params-wpa set80211param(priv,IEEE80211_IOC_WPA, params-wpa)) { + if (params-wpa bsd_configure_wpa(priv, params) != 0) { wpa_printf(MSG_ERROR, %s: Failed to configure WPA state, __func__); return -1; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r216518 - in head/sys/dev: if_ndis le malo sound/pci
On 12/18/10, Tijl Coosemans t...@freebsd.org wrote: On Saturday 18 December 2010 19:41:13 Paul B Mahol wrote: On 12/18/10, Tijl Coosemans t...@freebsd.org wrote: Author: tijl Date: Sat Dec 18 14:21:28 2010 New Revision: 216518 URL: http://svn.freebsd.org/changeset/base/216518 Log: Use convenience functions where possible instead of accessing the PCI configuration registers directly. Remove pci_enable_io calls where they are redundant. The PCI bus driver will set the right bits when the corresponding bus resource is activated. Remove redundant pci_* function calls from suspend/resume methods. The bus driver already saves and restores the PCI configuration. Reviewed by: jhb Approved by: kib (mentor) Please revert change to if_ndis regarding introduction of pci_get_subvendor(). You compare 16bit value with 32bit value - this will always fail. Apologies. Instead of reverting, would the attached patch work for you? It moves the function calls out of the while loop and makes it more clear what subsys means. Looks fine. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216537 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:22:15 2010 New Revision: 216537 URL: http://svn.freebsd.org/changeset/base/216537 Log: Rename bsd_set_iface_flags to bsd_ctrl_iface and change arguments to match upstream. For the same reason rewrite bsd_get_seqnum. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:17:10 2010 (r216536) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:22:15 2010 (r216537) @@ -160,7 +160,7 @@ bsd_send_mlme_param(void *priv, const u8 } static int -bsd_set_iface_flags(void *priv, int flags) +bsd_ctrl_iface(void *priv, int enable) { struct bsd_driver_data *drv = priv; struct ifreq ifr; @@ -176,15 +176,14 @@ bsd_set_iface_flags(void *priv, int flag return -1; } - if (flags 0) { - flags = -flags; - if ((ifr.ifr_flags flags) == 0) + if (enable) { + if ((ifr.ifr_flags IFF_UP) == IFF_UP) return 0; - ifr.ifr_flags = ~flags; + ifr.ifr_flags |= IFF_UP; } else { - if ((ifr.ifr_flags flags) == flags) + if ((ifr.ifr_flags IFF_UP) == 0) return 0; - ifr.ifr_flags |= flags; + ifr.ifr_flags = ~IFF_UP; } if (ioctl(drv-sock, SIOCSIFFLAGS, ifr) 0) { @@ -197,7 +196,7 @@ bsd_set_iface_flags(void *priv, int flag static int bsd_commit(void *priv) { - return bsd_set_iface_flags(priv, IFF_UP); + return bsd_ctrl_iface(priv, 1); } static int @@ -449,12 +448,25 @@ bsd_get_seqnum(const char *ifname, void if (get80211var(priv, IEEE80211_IOC_WPAKEY, wk, sizeof(wk)) 0) { printf(Failed to get encryption.\n); return -1; - } else { - /* NB: upper layer expects tsc in network order */ - wk.ik_keytsc = htole64(wk.ik_keytsc); - memcpy(seq, wk.ik_keytsc, sizeof(wk.ik_keytsc)); - return 0; } + +#ifdef WORDS_BIGENDIAN + { + /* +* wk.ik_keytsc is in host byte order (big endian), need to +* swap it to match with the byte order used in WPA. +*/ + int i; + u8 tmp[WPA_KEY_RSC_LEN]; + memcpy(tmp, wk.ik_keytsc, sizeof(wk.ik_keytsc)); + for (i = 0; i WPA_KEY_RSC_LEN; i++) { + seq[i] = tmp[WPA_KEY_RSC_LEN - i - 1]; + } + } +#else /* WORDS_BIGENDIAN */ + memcpy(seq, wk.ik_keytsc, sizeof(wk.ik_keytsc)); +#endif /* WORDS_BIGENDIAN */ + return 0; } @@ -731,7 +743,7 @@ bsd_init(struct hostapd_data *hapd, stru goto bad; /* mark down during setup */ - if (bsd_set_iface_flags(drv, -IFF_UP) 0) + if (bsd_ctrl_iface(drv, 0) 0) goto bad; drv-route = socket(PF_ROUTE, SOCK_RAW, 0); @@ -764,7 +776,7 @@ bsd_deinit(void *priv) eloop_unregister_read_sock(drv-route); close(drv-route); } - (void) bsd_set_iface_flags(drv, -IFF_UP); + bsd_ctrl_iface(drv, 0); if (drv-sock = 0) close(drv-sock); if (drv-sock_xmit != NULL) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216538 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:23:28 2010 New Revision: 216538 URL: http://svn.freebsd.org/changeset/base/216538 Log: Add a comment explaining the undefs, while here remove one which is not required. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:22:15 2010 (r216537) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:23:28 2010 (r216538) @@ -401,10 +401,13 @@ bsd_set_opt_ie(void *priv, const u8 *ie, ie, ie_len); } +/* + * Avoid conflicts with hostapd definitions by undefining couple of defines + * from net80211 header files. + */ #undef RSN_VERSION #undef WPA_VERSION #undef WPA_OUI_TYPE -#undef WME_OUI_TYPE static int bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, int reason_code); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216539 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:25:25 2010 New Revision: 216539 URL: http://svn.freebsd.org/changeset/base/216539 Log: Change order in wpa_driver_bsd_ops to match upstream code. Add description while here. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:23:28 2010 (r216538) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:25:25 2010 (r216539) @@ -789,23 +789,24 @@ bsd_deinit(void *priv) const struct wpa_driver_ops wpa_driver_bsd_ops = { .name = bsd, + .desc = BSD 802.11 support, .hapd_init = bsd_init, .hapd_deinit= bsd_deinit, - .set_ieee8021x = bsd_set_ieee8021x, .set_privacy= bsd_set_privacy, - .set_key= bsd_set_key, .get_seqnum = bsd_get_seqnum, .flush = bsd_flush, - .set_generic_elem = bsd_set_opt_ie, - .sta_set_flags = bsd_set_sta_authorized, .read_sta_data = bsd_read_sta_driver_data, - .hapd_send_eapol= bsd_send_eapol, + .sta_clear_stats= bsd_sta_clear_stats, .sta_disassoc = bsd_sta_disassoc, .sta_deauth = bsd_sta_deauth, + .set_key= bsd_set_key, + .set_ieee8021x = bsd_set_ieee8021x, .hapd_set_ssid = bsd_set_ssid, .hapd_get_ssid = bsd_get_ssid, + .hapd_send_eapol= bsd_send_eapol, + .sta_set_flags = bsd_set_sta_authorized, + .set_generic_elem = bsd_set_opt_ie, .set_countermeasures= bsd_set_countermeasures, - .sta_clear_stats= bsd_sta_clear_stats, .commit = bsd_commit, #ifdef CONFIG_DRIVER_RADIUS_ACL_NOT_YET .set_radius_acl_auth= bsd_set_radius_acl_auth, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216540 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:27:09 2010 New Revision: 216540 URL: http://svn.freebsd.org/changeset/base/216540 Log: Fix some whitespace nits. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:25:25 2010 (r216539) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:27:09 2010 (r216540) @@ -14,6 +14,7 @@ * * $FreeBSD$ */ + #include includes.h #include sys/ioctl.h @@ -33,19 +34,19 @@ #include l2_packet/l2_packet.h struct bsd_driver_data { - struct hostapd_data *hapd; /* back pointer */ + struct hostapd_data *hapd; /* back pointer */ - int sock; /* open socket for 802.11 ioctls */ + int sock; /* open socket for 802.11 ioctls */ struct l2_packet_data *sock_xmit;/* raw packet xmit socket */ - int route; /* routing socket for events */ - charifname[IFNAMSIZ+1]; /* interface name */ - unsigned int ifindex; /* interface index */ - void*ctx; - struct wpa_driver_capa capa;/* driver capability */ - int is_ap; /* Access point mode */ - int prev_roaming; /* roaming state to restore on deinit */ - int prev_privacy; /* privacy state to restore on deinit */ - int prev_wpa; /* wpa state to restore on deinit */ + int route; /* routing socket for events */ + charifname[IFNAMSIZ+1]; /* interface name */ + unsigned int ifindex; /* interface index */ + void*ctx; + struct wpa_driver_capa capa;/* driver capability */ + int is_ap; /* Access point mode */ + int prev_roaming; /* roaming state to restore on deinit */ + int prev_privacy; /* privacy state to restore on deinit */ + int prev_wpa; /* wpa state to restore on deinit */ }; static int @@ -190,6 +191,7 @@ bsd_ctrl_iface(void *priv, int enable) perror(ioctl[SIOCSIFFLAGS]); return -1; } + return 0; } @@ -207,8 +209,8 @@ bsd_set_key(const char *ifname, void *pr struct ieee80211req_key wk; wpa_printf(MSG_DEBUG, %s: alg=%d addr=%p key_idx=%d set_tx=%d - seq_len=%zu key_len=%zu, __func__, alg, addr, key_idx, - set_tx, seq_len, key_len); + seq_len=%zu key_len=%zu, __func__, alg, addr, key_idx, + set_tx, seq_len, key_len); if (alg == WPA_ALG_NONE) { return bsd_del_key(priv, addr, key_idx); @@ -281,7 +283,7 @@ bsd_set_ieee8021x(void *priv, struct wpa if (!params-enabled) { /* XXX restore state */ return set80211param(priv, IEEE80211_IOC_AUTHMODE, - IEEE80211_AUTH_AUTO); +IEEE80211_AUTH_AUTO); } if (!params-wpa !params-ieee802_1x) { wpa_printf(MSG_ERROR, %s: No 802.1X or WPA enabled, @@ -290,11 +292,11 @@ bsd_set_ieee8021x(void *priv, struct wpa } if (params-wpa bsd_configure_wpa(priv, params) != 0) { wpa_printf(MSG_ERROR, %s: Failed to configure WPA state, - __func__); + __func__); return -1; } if (set80211param(priv, IEEE80211_IOC_AUTHMODE, - (params-wpa ? IEEE80211_AUTH_WPA : IEEE80211_AUTH_8021X))) { + (params-wpa ? IEEE80211_AUTH_WPA : IEEE80211_AUTH_8021X))) { wpa_printf(MSG_ERROR, %s: Failed to enable WPA/802.1X, __func__); return -1; @@ -346,14 +348,12 @@ bsd_new_sta(void *priv, void *ctx, u8 ad ielen += 2; no_ie: -drv_event_assoc(ctx, addr, iebuf, ielen); - + drv_event_assoc(ctx, addr, iebuf, ielen); } static int bsd_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len, int encrypt, const u8 *own_addr) - { struct bsd_driver_data *drv = priv; unsigned char buf[3000]; @@ -410,7 +410,7 @@ bsd_set_opt_ie(void *priv, const u8 *ie, #undef WPA_OUI_TYPE static int bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, -int reason_code); + int reason_code); static const char * ether_sprintf(const u8 *addr) @@ -439,7 +439,7 @@ bsd_get_seqnum(const char *ifname, void struct ieee80211req_key wk; wpa_printf(MSG_DEBUG, %s: addr=%s idx=%d, - __func__, ether_sprintf(addr), idx); + __func__, ether_sprintf(addr), idx); memset(wk, 0, sizeof(wk)); if (addr == NULL) @@ -505,7 +505,7 @@
svn commit: r216541 - head/usr.sbin/wpa/hostapd
Author: bschmidt Date: Sat Dec 18 20:29:41 2010 New Revision: 216541 URL: http://svn.freebsd.org/changeset/base/216541 Log: Unbreak hostapd. This code has been explicitly removed in upstream versions. Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c == --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:27:09 2010 (r216540) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Sat Dec 18 20:29:41 2010 (r216541) @@ -356,40 +356,11 @@ bsd_send_eapol(void *priv, const u8 *add int encrypt, const u8 *own_addr) { struct bsd_driver_data *drv = priv; - unsigned char buf[3000]; - unsigned char *bp = buf; - struct l2_ethhdr *eth; - size_t len; - int status; - /* -* Prepend the Etherent header. If the caller left us -* space at the front we could just insert it but since -* we don't know we copy to a local buffer. Given the frequency -* and size of frames this probably doesn't matter. -*/ - len = data_len + sizeof(struct l2_ethhdr); - if (len sizeof(buf)) { - bp = malloc(len); - if (bp == NULL) { - printf(EAPOL frame discarded, cannot malloc temp - buffer of size %u!\n, len); - return -1; - } - } - eth = (struct l2_ethhdr *) bp; - memcpy(eth-h_dest, addr, ETH_ALEN); - memcpy(eth-h_source, own_addr, ETH_ALEN); - eth-h_proto = htons(ETH_P_EAPOL); - memcpy(eth+1, data, data_len); - - wpa_hexdump(MSG_MSGDUMP, TX EAPOL, bp, len); - - status = l2_packet_send(drv-sock_xmit, addr, ETH_P_EAPOL, bp, len); - - if (bp != buf) - free(bp); - return status; + wpa_hexdump(MSG_MSGDUMP, TX EAPOL, data, data_len); + + return l2_packet_send(drv-sock_xmit, addr, ETH_P_EAPOL, data, + data_len); } static int @@ -739,7 +710,7 @@ bsd_init(struct hostapd_data *hapd, stru } drv-sock_xmit = l2_packet_init(drv-ifname, NULL, ETH_P_EAPOL, - handle_read, drv, 1); + handle_read, drv, 0); if (drv-sock_xmit == NULL) goto bad; if (l2_packet_get_own_addr(drv-sock_xmit, params-own_addr)) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216542 - head/usr.bin/csup
Author: lulf Date: Sat Dec 18 20:43:18 2010 New Revision: 216542 URL: http://svn.freebsd.org/changeset/base/216542 Log: - Signal that data should not be modified. Modified: head/usr.bin/csup/rcsfile.c head/usr.bin/csup/rcsfile.h Modified: head/usr.bin/csup/rcsfile.c == --- head/usr.bin/csup/rcsfile.c Sat Dec 18 20:29:41 2010(r216541) +++ head/usr.bin/csup/rcsfile.c Sat Dec 18 20:43:18 2010(r216542) @@ -175,7 +175,8 @@ print_stream(struct stream *s) * Parse rcsfile from path and return a pointer to it. */ struct rcsfile * -rcsfile_frompath(char *path, char *name, char *cvsroot, char *colltag, int ro) +rcsfile_frompath(const char *path, const char *name, const char *cvsroot, +const char *colltag, int ro) { struct rcsfile *rf; FILE *infp; Modified: head/usr.bin/csup/rcsfile.h == --- head/usr.bin/csup/rcsfile.h Sat Dec 18 20:29:41 2010(r216541) +++ head/usr.bin/csup/rcsfile.h Sat Dec 18 20:43:18 2010(r216542) @@ -42,7 +42,8 @@ struct delta; struct stream; /* Fetching, sending and writing an RCS file. */ -struct rcsfile *rcsfile_frompath(char *, char *, char *, char *, int); +struct rcsfile *rcsfile_frompath(const char *, const char *, const char *, + const char *, int); int rcsfile_send_details(struct rcsfile *, struct stream *); int rcsfile_write(struct rcsfile *, struct stream *); voidrcsfile_print(struct rcsfile *); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216544 - head/bin/sh
Author: uqs Date: Sat Dec 18 22:16:15 2010 New Revision: 216544 URL: http://svn.freebsd.org/changeset/base/216544 Log: Remove dead code. c is assigned 0 and *loc is pointing to NULL, so c!=0 cannot be true, and dereferencing loc would be a bad idea anyway. Coverity Prevent: CID 5113 Reviewed by: jilles Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c == --- head/bin/sh/expand.cSat Dec 18 20:56:49 2010(r216543) +++ head/bin/sh/expand.cSat Dec 18 22:16:15 2010(r216544) @@ -557,8 +557,6 @@ subevalvar(char *p, char *str, int strlo amount = startp - expdest; STADJUST(amount, expdest); varflags = ~VSNUL; - if (c != 0) - *loc = c; return 1; case VSQUESTION: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216546 - head/sys/dev/jme
Author: yongari Date: Sat Dec 18 23:03:38 2010 New Revision: 216546 URL: http://svn.freebsd.org/changeset/base/216546 Log: Consistently put a tab character between #define and the macro name. Modified: head/sys/dev/jme/if_jmevar.h Modified: head/sys/dev/jme/if_jmevar.h == --- head/sys/dev/jme/if_jmevar.hSat Dec 18 23:03:01 2010 (r216545) +++ head/sys/dev/jme/if_jmevar.hSat Dec 18 23:03:38 2010 (r216546) @@ -66,8 +66,8 @@ * JMC250 can send 9K jumbo frame on Tx path and can receive * 65535 bytes. */ -#define JME_JUMBO_FRAMELEN 9216 -#define JME_JUMBO_MTU \ +#defineJME_JUMBO_FRAMELEN 9216 +#defineJME_JUMBO_MTU \ (JME_JUMBO_FRAMELEN - sizeof(struct ether_vlan_header) -\ ETHER_HDR_LEN - ETHER_CRC_LEN) #defineJME_MAX_MTU \ @@ -143,14 +143,14 @@ struct jme_ring_data { bus_addr_t jme_ssb_block_paddr; }; -#define JME_TX_RING_ADDR(sc, i)\ +#defineJME_TX_RING_ADDR(sc, i) \ ((sc)-jme_rdata.jme_tx_ring_paddr + sizeof(struct jme_desc) * (i)) -#define JME_RX_RING_ADDR(sc, i)\ +#defineJME_RX_RING_ADDR(sc, i) \ ((sc)-jme_rdata.jme_rx_ring_paddr + sizeof(struct jme_desc) * (i)) -#define JME_TX_RING_SIZE \ +#defineJME_TX_RING_SIZE\ (sizeof(struct jme_desc) * JME_TX_RING_CNT) -#define JME_RX_RING_SIZE \ +#defineJME_RX_RING_SIZE\ (sizeof(struct jme_desc) * JME_RX_RING_CNT) #defineJME_SSB_SIZEsizeof(struct jme_ssb) @@ -223,14 +223,14 @@ struct jme_softc { }; /* Register access macros. */ -#define CSR_WRITE_4(_sc, reg, val) \ +#defineCSR_WRITE_4(_sc, reg, val) \ bus_write_4((_sc)-jme_res[0], (reg), (val)) -#define CSR_READ_4(_sc, reg) \ +#defineCSR_READ_4(_sc, reg)\ bus_read_4((_sc)-jme_res[0], (reg)) -#define JME_LOCK(_sc) mtx_lock((_sc)-jme_mtx) -#define JME_UNLOCK(_sc)mtx_unlock((_sc)-jme_mtx) -#define JME_LOCK_ASSERT(_sc) mtx_assert((_sc)-jme_mtx, MA_OWNED) +#defineJME_LOCK(_sc) mtx_lock((_sc)-jme_mtx) +#defineJME_UNLOCK(_sc) mtx_unlock((_sc)-jme_mtx) +#defineJME_LOCK_ASSERT(_sc)mtx_assert((_sc)-jme_mtx, MA_OWNED) #defineJME_MAXERR 5 @@ -242,8 +242,8 @@ do { \ } while (0) #defineJME_TX_TIMEOUT 5 -#define JME_TIMEOUT1000 -#define JME_PHY_TIMEOUT1000 -#define JME_EEPROM_TIMEOUT 1000 +#defineJME_TIMEOUT 1000 +#defineJME_PHY_TIMEOUT 1000 +#defineJME_EEPROM_TIMEOUT 1000 #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216547 - in head: bin/sh tools/regression/bin/sh/expansion
Author: jilles Date: Sat Dec 18 23:03:51 2010 New Revision: 216547 URL: http://svn.freebsd.org/changeset/base/216547 Log: sh: arith: Disallow decimal constants starting with 0 (containing 8 or 9). Constants in arithmetic starting with 0 should be octal only. This avoids the following highly puzzling result: $ echo $((018-017)) 3 by making it an error instead. Added: head/tools/regression/bin/sh/expansion/arith8.0 (contents, props changed) Modified: head/bin/sh/arith_lex.l Modified: head/bin/sh/arith_lex.l == --- head/bin/sh/arith_lex.l Sat Dec 18 23:03:38 2010(r216546) +++ head/bin/sh/arith_lex.l Sat Dec 18 23:03:51 2010(r216547) @@ -74,12 +74,12 @@ int yylex(void); return ARITH_NUM; } -0[0-7]+{ +0[0-7]*{ yylval.l_value = strtoarith_t(yytext, NULL, 8); return ARITH_NUM; } -[0-9]+ { +[1-9][0-9]*{ yylval.l_value = strtoarith_t(yytext, NULL, 10); return ARITH_NUM; } Added: head/tools/regression/bin/sh/expansion/arith8.0 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/arith8.0 Sat Dec 18 23:03:51 2010(r216547) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=$( (eval ': $((08))') 21 /dev/null) +[ $? -ne 0 ] [ -n $v ] ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216548 - head/sys/dev/jme
Author: yongari Date: Sat Dec 18 23:21:16 2010 New Revision: 216548 URL: http://svn.freebsd.org/changeset/base/216548 Log: Fix a regression introduced in r213893. FPGA version requires PHY probing so allow PHY probing on all possible addresses. Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c == --- head/sys/dev/jme/if_jme.c Sat Dec 18 23:03:51 2010(r216547) +++ head/sys/dev/jme/if_jme.c Sat Dec 18 23:21:16 2010(r216548) @@ -730,8 +730,9 @@ jme_attach(device_t dev) /* Set up MII bus. */ error = mii_attach(dev, sc-jme_miibus, ifp, jme_mediachange, - jme_mediastatus, BMSR_DEFCAPMASK, sc-jme_phyaddr, MII_OFFSET_ANY, - MIIF_DOPAUSE); + jme_mediastatus, BMSR_DEFCAPMASK, + sc-jme_flags JME_FLAG_FPGA ? MII_PHY_ANY : sc-jme_phyaddr, + MII_OFFSET_ANY, MIIF_DOPAUSE); if (error != 0) { device_printf(dev, attaching PHYs failed\n); goto fail; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216549 - head/sys/dev/jme
Author: yongari Date: Sat Dec 18 23:24:59 2010 New Revision: 216549 URL: http://svn.freebsd.org/changeset/base/216549 Log: Make sure whether driver allocated resource before releasing it. Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c == --- head/sys/dev/jme/if_jme.c Sat Dec 18 23:21:16 2010(r216548) +++ head/sys/dev/jme/if_jme.c Sat Dec 18 23:24:59 2010(r216549) @@ -854,10 +854,12 @@ jme_detach(device_t dev) } } - bus_release_resources(dev, sc-jme_irq_spec, sc-jme_irq); + if (sc-jme_irq[0] != NULL) + bus_release_resources(dev, sc-jme_irq_spec, sc-jme_irq); if ((sc-jme_flags (JME_FLAG_MSIX | JME_FLAG_MSI)) != 0) pci_release_msi(dev); - bus_release_resources(dev, sc-jme_res_spec, sc-jme_res); + if (sc-jme_res[0] != NULL) + bus_release_resources(dev, sc-jme_res_spec, sc-jme_res); mtx_destroy(sc-jme_mtx); return (0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216550 - head/sys/dev/jme
Author: yongari Date: Sat Dec 18 23:26:38 2010 New Revision: 216550 URL: http://svn.freebsd.org/changeset/base/216550 Log: Use system defined PCIR_EXPRESS_DEVICE_CTL instead of using magic number. Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c == --- head/sys/dev/jme/if_jme.c Sat Dec 18 23:24:59 2010(r216549) +++ head/sys/dev/jme/if_jme.c Sat Dec 18 23:26:38 2010(r216550) @@ -675,7 +675,7 @@ jme_attach(device_t dev) /* Set max allowable DMA size. */ if (pci_find_extcap(dev, PCIY_EXPRESS, i) == 0) { sc-jme_flags |= JME_FLAG_PCIE; - burst = pci_read_config(dev, i + 0x08, 2); + burst = pci_read_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, 2); if (bootverbose) { device_printf(dev, Read request size : %d bytes.\n, 128 ((burst 12) 0x07)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216551 - in head/sys/dev: jme mii
Author: yongari Date: Sat Dec 18 23:52:50 2010 New Revision: 216551 URL: http://svn.freebsd.org/changeset/base/216551 Log: Add support for JMicron JMC251/JMC261 Gigabit/Fast ethernet controller with Card Read Host Controller. These controllers are multi-function devices and have the same ethernet core of JMC250/JMC260. Starting from REVFM 5(chip full mask revision) controllers have the following features. o eFuse support o PCD(Packet Completion Deferring) o More advanced PHY power saving Because these controllers started to use eFuse, station address modified by driver is permanent as if it was written to EEPROM. If you have to change station address please save your controller default address to safe place before reprogramming it. There is no way to restore factory default station address. Many thanks to JMicron for continuing to support FreeBSD. HW donated by:JMicron Modified: head/sys/dev/jme/if_jme.c head/sys/dev/jme/if_jmereg.h head/sys/dev/jme/if_jmevar.h head/sys/dev/mii/jmphy.c head/sys/dev/mii/jmphyreg.h Modified: head/sys/dev/jme/if_jme.c == --- head/sys/dev/jme/if_jme.c Sat Dec 18 23:26:38 2010(r216550) +++ head/sys/dev/jme/if_jme.c Sat Dec 18 23:52:50 2010(r216551) @@ -97,9 +97,9 @@ static struct jme_dev { const char *jme_name; } jme_devs[] = { { VENDORID_JMICRON, DEVICEID_JMC250, - JMicron Inc, JMC250 Gigabit Ethernet }, + JMicron Inc, JMC25x Gigabit Ethernet }, { VENDORID_JMICRON, DEVICEID_JMC260, - JMicron Inc, JMC260 Fast Ethernet }, + JMicron Inc, JMC26x Fast Ethernet }, }; static int jme_miibus_readreg(device_t, int, int); @@ -110,7 +110,9 @@ static int jme_mediachange(struct ifnet static int jme_probe(device_t); static int jme_eeprom_read_byte(struct jme_softc *, uint8_t, uint8_t *); static int jme_eeprom_macaddr(struct jme_softc *); +static int jme_efuse_macaddr(struct jme_softc *); static void jme_reg_macaddr(struct jme_softc *); +static void jme_set_macaddr(struct jme_softc *, uint8_t *); static void jme_map_intr_vector(struct jme_softc *); static int jme_attach(device_t); static int jme_detach(device_t); @@ -152,6 +154,8 @@ static void jme_set_filter(struct jme_so static void jme_stats_clear(struct jme_softc *); static void jme_stats_save(struct jme_softc *); static void jme_stats_update(struct jme_softc *); +static void jme_phy_down(struct jme_softc *); +static void jme_phy_up(struct jme_softc *); static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int); static int sysctl_hw_jme_tx_coal_to(SYSCTL_HANDLER_ARGS); static int sysctl_hw_jme_tx_coal_pkt(SYSCTL_HANDLER_ARGS); @@ -432,6 +436,55 @@ jme_eeprom_macaddr(struct jme_softc *sc) return (ENOENT); } +static int +jme_efuse_macaddr(struct jme_softc *sc) +{ + uint32_t reg; + int i; + + reg = pci_read_config(sc-jme_dev, JME_EFUSE_CTL1, 4); + if ((reg (EFUSE_CTL1_AUTOLOAD_ERR | EFUSE_CTL1_AUTOLAOD_DONE)) != + EFUSE_CTL1_AUTOLAOD_DONE) + return (ENOENT); + /* Reset eFuse controller. */ + reg = pci_read_config(sc-jme_dev, JME_EFUSE_CTL2, 4); + reg |= EFUSE_CTL2_RESET; + pci_write_config(sc-jme_dev, JME_EFUSE_CTL2, reg, 4); + reg = pci_read_config(sc-jme_dev, JME_EFUSE_CTL2, 4); + reg = ~EFUSE_CTL2_RESET; + pci_write_config(sc-jme_dev, JME_EFUSE_CTL2, reg, 4); + + /* Have eFuse reload station address to MAC controller. */ + reg = pci_read_config(sc-jme_dev, JME_EFUSE_CTL1, 4); + reg = ~EFUSE_CTL1_CMD_MASK; + reg |= EFUSE_CTL1_CMD_AUTOLOAD | EFUSE_CTL1_EXECUTE; + pci_write_config(sc-jme_dev, JME_EFUSE_CTL1, reg, 4); + + /* +* Verify completion of eFuse autload command. It should be +* completed within 108us. +*/ + DELAY(110); + for (i = 10; i 0; i--) { + reg = pci_read_config(sc-jme_dev, JME_EFUSE_CTL1, 4); + if ((reg (EFUSE_CTL1_AUTOLOAD_ERR | + EFUSE_CTL1_AUTOLAOD_DONE)) != EFUSE_CTL1_AUTOLAOD_DONE) { + DELAY(20); + continue; + } + if ((reg EFUSE_CTL1_EXECUTE) == 0) + break; + /* Station address loading is still in progress. */ + DELAY(20); + } + if (i == 0) { + device_printf(sc-jme_dev, eFuse autoload timed out.\n); + return (ETIMEDOUT); + } + + return (0); +} + static void jme_reg_macaddr(struct jme_softc *sc) { @@ -446,6 +499,13 @@ jme_reg_macaddr(struct jme_softc *sc) device_printf(sc-jme_dev, Failed to retrieve Ethernet address.\n); } else { + /* +* For controllers that use eFuse, the station address +*
svn commit: r216552 - head/share/man/man4
Author: yongari Date: Sun Dec 19 00:00:29 2010 New Revision: 216552 URL: http://svn.freebsd.org/changeset/base/216552 Log: Document JMC251/JMC261 support. Modified: head/share/man/man4/jme.4 Modified: head/share/man/man4/jme.4 == --- head/share/man/man4/jme.4 Sat Dec 18 23:52:50 2010(r216551) +++ head/share/man/man4/jme.4 Sun Dec 19 00:00:29 2010(r216552) @@ -24,7 +24,7 @@ .\ .\ $FreeBSD$ .\ -.Dd October 6, 2008 +.Dd December 18, 2010 .Dt JME 4 .Os .Sh NAME @@ -48,8 +48,8 @@ if_jme_load=YES .Sh DESCRIPTION The .Nm -device driver provides support for JMicron JMC250 PCI Express -Gigabit Ethernet controllers and JMicron JMC260 PCI Express Fast +device driver provides support for JMicron JMC25x PCI Express +Gigabit Ethernet controllers and JMicron JMC26x PCI Express Fast Ethernet controllers. .Pp All LOMs supported by the @@ -59,7 +59,7 @@ TCP segmentation offload (TSO), hardware features, Wake On Lan (WOL) and an interrupt coalescing/moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The JMC250 also supports Jumbo Frames (up to 9216 bytes), which can be +The JMC25x also supports Jumbo Frames (up to 9216 bytes), which can be configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 @@ -103,7 +103,11 @@ device driver provides support for the f .It JMicron JMC250 PCI Express Gigabit Ethernet controller .It +JMicron JMC251 PCI Express Gigabit Ethernet with Card Read Host controller +.It JMicron JMC260 PCI Express Fast Ethernet controller +.It +JMicron JMC261 PCI Express Gigabit Ethernet with Card Read Host controller .El .Sh LOADER TUNABLES Tunables can be set at the ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216555 - head/sys/i386/i386
Author: alc Date: Sun Dec 19 07:31:56 2010 New Revision: 216555 URL: http://svn.freebsd.org/changeset/base/216555 Log: Redo some parts of r216333, specifically, the locking changes to pmap_extract_and_hold(), and undo the rest. In particular, I forgot that PG_PS and PG_PTE_PAT are the same bit. Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c == --- head/sys/i386/i386/pmap.c Sun Dec 19 06:09:02 2010(r216554) +++ head/sys/i386/i386/pmap.c Sun Dec 19 07:31:56 2010(r216555) @@ -1291,21 +1291,23 @@ pmap_pte_quick(pmap_t pmap, vm_offset_t vm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va) { - pt_entry_t pte, *ptep; vm_paddr_t rtval; + pt_entry_t *pte; + pd_entry_t pde; rtval = 0; PMAP_LOCK(pmap); - ptep = pmap_pte(pmap, va); - pte = (ptep != NULL) ? *ptep : 0; - pmap_pte_release(ptep); - PMAP_UNLOCK(pmap); - if ((pte PG_V) != 0) { - if ((pte PG_PS) != 0) - rtval = (pte PG_PS_FRAME) | (va PDRMASK); - else - rtval = (pte PG_FRAME) | (va PAGE_MASK); + pde = pmap-pm_pdir[va PDRSHIFT]; + if (pde != 0) { + if ((pde PG_PS) != 0) + rtval = (pde PG_PS_FRAME) | (va PDRMASK); + else { + pte = pmap_pte(pmap, va); + rtval = (*pte PG_FRAME) | (va PAGE_MASK); + pmap_pte_release(pte); + } } + PMAP_UNLOCK(pmap); return (rtval); } @@ -1319,30 +1321,40 @@ pmap_extract(pmap_t pmap, vm_offset_t va vm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) { + pd_entry_t pde; pt_entry_t pte, *ptep; - vm_paddr_t locked_pa, pa; vm_page_t m; + vm_paddr_t pa; - locked_pa = 0; + pa = 0; m = NULL; PMAP_LOCK(pmap); retry: - ptep = pmap_pte(pmap, va); - pte = (ptep != NULL) ? *ptep : 0; - pmap_pte_release(ptep); - if ((pte PG_V) != 0 - ((pte PG_RW) != 0 || (prot VM_PROT_WRITE) == 0)) { - if ((pte PG_PS) != 0) { - /* Compute the physical address of the 4KB page. */ - pa = (pte PG_PS_FRAME) | (va PG_FRAME PDRMASK); - } else - pa = pte PG_FRAME; - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); - PA_UNLOCK(locked_pa); + pde = *pmap_pde(pmap, va); + if (pde != 0) { + if (pde PG_PS) { + if ((pde PG_RW) || (prot VM_PROT_WRITE) == 0) { + if (vm_page_pa_tryrelock(pmap, (pde PG_PS_FRAME) | + (va PDRMASK), pa)) + goto retry; + m = PHYS_TO_VM_PAGE((pde PG_PS_FRAME) | + (va PDRMASK)); + vm_page_hold(m); + } + } else { + ptep = pmap_pte(pmap, va); + pte = *ptep; + pmap_pte_release(ptep); + if (pte != 0 + ((pte PG_RW) || (prot VM_PROT_WRITE) == 0)) { + if (vm_page_pa_tryrelock(pmap, pte PG_FRAME, pa)) + goto retry; + m = PHYS_TO_VM_PAGE(pte PG_FRAME); + vm_page_hold(m); + } + } } + PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); return (m); } @@ -4979,30 +4991,39 @@ pmap_change_attr(vm_offset_t va, vm_size int pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) { + pd_entry_t *pdep; pt_entry_t *ptep, pte; vm_paddr_t pa; int val; PMAP_LOCK(pmap); retry: - ptep = pmap_pte(pmap, addr); - pte = (ptep != NULL) ? *ptep : 0; - pmap_pte_release(ptep); - if ((pte PG_V) != 0) { - val = MINCORE_INCORE; - if ((pte PG_PS) != 0) { - val |= MINCORE_SUPER; + pdep = pmap_pde(pmap, addr); + if (*pdep != 0) { + if (*pdep PG_PS) { + pte = *pdep; /* Compute the physical address of the 4KB page. */ - pa = (pte PG_PS_FRAME) | (addr PG_FRAME PDRMASK); - } else + pa = ((*pdep PG_PS_FRAME) | (addr PDRMASK)) + PG_FRAME; + val = MINCORE_SUPER; + } else { +