[patch]: httpd: extend "include" to support glob(3) patterns.
Hi, the patch below teaches httpd's "include" keyword how to handle file patterns via glob(3) by introducing a new function "pushglob()". This allows something like the following in httpd.conf: include "/etc/httpd/sites-enabled/*.conf" If the pattern passed to pushglob() contains no globbing characters (e.g. a file path), the absence of the file is an error. In contrast, if the pattern contains globbing character and the pattern matches no files, it is NOT an error. pushglob() also supports the "secret" flag though it is not used in httpd. This should make it reuseable in other parse.y files in the tree. If secret equals true all matched files must be "valid" or pushglob() returns NULL. No change in existing behaviour intended. If you like this feature, i can prepare a diff for httpd.conf(5). Cheers, Fabian Index: parse.y === RCS file: /cvs/src/usr.sbin/httpd/parse.y,v retrieving revision 1.77 diff -u -p -r1.77 parse.y --- parse.y 22 Nov 2015 13:27:13 - 1.77 +++ parse.y 28 May 2016 13:38:03 - @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ static struct file { int lineno; int errors; } *file, *topfile; +struct file*pushglob(const char *, int, int *); struct file*pushfile(const char *, int); int popfile(void); int check_file_secrecy(int, const char *); @@ -157,15 +159,19 @@ grammar : /* empty */ include: INCLUDE STRING{ struct file *nfile; + int magchar, secret = 0; - if ((nfile = pushfile($2, 0)) == NULL) { - yyerror("failed to include file %s", $2); - free($2); - YYERROR; - } - free($2); + if ((nfile = pushglob($2, secret, )) == NULL) { + if (secret || !magchar) { + yyerror("failed to include %s %s", + magchar ? "pattern" : "file", $2); + free($2); + YYERROR; + } + } else + file = nfile; - file = nfile; + free($2); lungetc('\n'); } ; @@ -1471,6 +1477,33 @@ check_file_secrecy(int fd, const char *f return (-1); } return (0); +} + +struct file * +pushglob(const char *pattern, int secret, int *magchar) +{ + struct file *nfile = NULL, *tmp; + glob_t g; + int failed = 0, i; + + if (glob(pattern, GLOB_NOCHECK, NULL, ) != 0) { + log_warn("cannot glob %s", pattern); + *magchar = 0; + return (NULL); + } + + for (i = 0; i < g.gl_matchc; i++) { + tmp = pushfile(g.gl_pathv[i], secret); + if (tmp == NULL) { + if (secret) + failed = 1; + } else + nfile = tmp; + } + + *magchar = g.gl_flags & GLOB_MAGCHAR ? 1 : 0; + globfree(); + return (failed ? NULL : nfile); } struct file *
Re: carp: fix SIOCSVH if carpr.carpr_carpdev is \0
On Sun, Jan 03, 2016 at 11:54:18AM +0100, Martin Pieuchot wrote: > On 30/12/15(Wed) 12:51, Fabian Raetz wrote: > > Hi tech@, > > > > i've found the undocumented -carpdev option in ifconfig(8) which freezes > > my sytem if executed. > > > > As the -carpdev option is undocumented in both ifconfig(8) and carp(4) i > > propose two patches to remove this functionality. > > > > The patch below will return EINVAL in SIOCSVH if carpr.carpr_carpdev is not > > a > > valid interface name. > > Did you try this diff? The SIOCGVH ioctl(2) is not always issued with > carpr_carpdev set, so this will break your system. Hi Martin, in case carpr.carpr_carpdev is zeroed (like it was in ifconfig -carpdev) ifunit will not be invoked as carpr.carpr_carpdev[0] == '\0'. As a result carp_set_ifp will be called with ifp0 == NULL (line 2032) which doesn't check ifp0 for NULL and will try dereference ifp0 (line 1661). This does break my system. What this patch tries to archive is to unconditionally call ifunit (line 2026) to make sure ifp0 is always set or we return EINVAL. Are you worried about the case where carpr.carp_carpdev is not a \0 terminated string and if ifunit can handle these? (Note that this can happen with the current code too) I've done some simple testing and it seems to me, that strcmp does work in such a case as long as ifp->if_xname (net/if.c:1468) is always \0 terminated? strcmp(3) says that it compares \0 terminated strings though. Would it make sense to convert the strcmp in ifunit to strncmp? Index: if.c === RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.425 diff -u -p -r1.425 if.c --- if.c9 Dec 2015 03:22:39 - 1.425 +++ if.c3 Jan 2016 13:15:31 - @@ -1465,7 +1465,7 @@ ifunit(const char *name) struct ifnet *ifp; TAILQ_FOREACH(ifp, , if_list) { - if (strcmp(ifp->if_xname, name) == 0) + if (strncmp(ifp->if_xname, name, IFNAMSIZ) == 0) return (ifp); } return (NULL); Or are you worried about something completly different and i'm missing the point? > > > I will send another patch to @tech to remove -carpdev from ifconfig(8) > > > > Cheers, > > Fabian > > > > > > Index: ip_carp.c > > === > > RCS file: /cvs/src/sys/netinet/ip_carp.c,v > > retrieving revision 1.284 > > diff -u -p -r1.284 ip_carp.c > > --- ip_carp.c 19 Dec 2015 11:19:35 - 1.284 > > +++ ip_carp.c 30 Dec 2015 11:31:57 - > > @@ -2022,8 +2022,7 @@ carp_ioctl(struct ifnet *ifp, u_long cmd > > if ((error = copyin(ifr->ifr_data, , sizeof carpr))) > > break; > > error = 1; > > - if (carpr.carpr_carpdev[0] != '\0' && > > - (ifp0 = ifunit(carpr.carpr_carpdev)) == NULL) > > + if ((ifp0 = ifunit(carpr.carpr_carpdev)) == NULL) > > return (EINVAL); > > if (carpr.carpr_peer.s_addr == 0) > > sc->sc_peer.s_addr = INADDR_CARP_GROUP; > >
Re: carp: fix SIOCSVH if carpr.carpr_carpdev is \0
On Sun, Jan 03, 2016 at 03:54:16PM +0100, Martin Pieuchot wrote: > On 03/01/16(Sun) 14:19, Fabian Raetz wrote: > > On Sun, Jan 03, 2016 at 11:54:18AM +0100, Martin Pieuchot wrote: > > > On 30/12/15(Wed) 12:51, Fabian Raetz wrote: > > > > Hi tech@, > > > > > > > > i've found the undocumented -carpdev option in ifconfig(8) which freezes > > > > my sytem if executed. > > > > > > > > As the -carpdev option is undocumented in both ifconfig(8) and carp(4) i > > > > propose two patches to remove this functionality. > > > > > > > > The patch below will return EINVAL in SIOCSVH if carpr.carpr_carpdev is > > > > not a > > > > valid interface name. > > > > > > Did you try this diff? The SIOCGVH ioctl(2) is not always issued with > > > carpr_carpdev set, so this will break your system. > > [...] > > Or are you worried about something completly different and i'm missing > > the point? > > I'm worried about the fact that your diff breaks ifconfig(8) with > carp(4) interfaces because, as I said previously, the SIOCGVH ioctl(2) > is not always issued with carpr_carpdev set :) Ok, i've got it xD. I've tested your patch and it fixes the observed NULL dereference and ifconfig seems to be working. > > Here's a different approach that should prevent your NULL dereference > (untested): > > Index: netinet/ip_carp.c > === > RCS file: /cvs/src/sys/netinet/ip_carp.c,v > retrieving revision 1.284 > diff -u -p -r1.284 ip_carp.c > --- netinet/ip_carp.c 19 Dec 2015 11:19:35 - 1.284 > +++ netinet/ip_carp.c 3 Jan 2016 14:51:20 - > @@ -1653,11 +1653,9 @@ carp_set_ifp(struct carp_softc *sc, stru > int myself = 0, error = 0; > int s; > > + KASSERT(ifp0 != sc->sc_carpdev); > KERNEL_ASSERT_LOCKED(); /* touching vhif_vrs */ > > - if (ifp0 == sc->sc_carpdev) > - return (0); > - > if ((ifp0->if_flags & IFF_MULTICAST) == 0) > return (EADDRNOTAVAIL); > > @@ -1968,12 +1966,12 @@ carp_ioctl(struct ifnet *ifp, u_long cmd > struct carpreq carpr; > struct ifaddr *ifa = (struct ifaddr *)addr; > struct ifreq *ifr = (struct ifreq *)addr; > - struct ifnet *ifp0 = NULL; > + struct ifnet *ifp0 = sc->sc_carpdev; > int i, error = 0; > > switch (cmd) { > case SIOCSIFADDR: > - if (sc->sc_carpdev == NULL) > + if (ifp0 == NULL) > return (EINVAL); > > switch (ifa->ifa_addr->sa_family) { > @@ -2029,8 +2027,10 @@ carp_ioctl(struct ifnet *ifp, u_long cmd > sc->sc_peer.s_addr = INADDR_CARP_GROUP; > else > sc->sc_peer.s_addr = carpr.carpr_peer.s_addr; > - if ((error = carp_set_ifp(sc, ifp0))) > - return (error); > + if (ifp0 != sc->sc_carpdev) { > + if ((error = carp_set_ifp(sc, ifp0))) > + return (error); > + } > if (vhe->state != INIT && carpr.carpr_state != vhe->state) { > switch (carpr.carpr_state) { > case BACKUP: > @@ -2090,9 +2090,8 @@ carp_ioctl(struct ifnet *ifp, u_long cmd > > case SIOCGVH: > memset(, 0, sizeof(carpr)); > - if (sc->sc_carpdev != NULL) > - strlcpy(carpr.carpr_carpdev, sc->sc_carpdev->if_xname, > - IFNAMSIZ); > + if (ifp0 != NULL) > + strlcpy(carpr.carpr_carpdev, ifp0->if_xname, IFNAMSIZ); > i = 0; > KERNEL_ASSERT_LOCKED(); /* touching carp_vhosts */ > SRPL_FOREACH_LOCKED(vhe, >carp_vhosts, vhost_entries) {
ifconfig: rm not need variable noprint
Hi tech@, this patch removes the 'noprint' variable which was added to ifconfig.c in rev 1.216 and is not in use since rev. 1.220. Cheers, Fabian Index: sbin/ifconfig/ifconfig.c === --- sbin/ifconfig/ifconfig.c.orig +++ sbin/ifconfig/ifconfig.c @@ -604,7 +604,6 @@ main(int argc, char *argv[]) int Cflag = 0; int gflag = 0; int i; - int noprint = 0; /* If no args at all, print all interfaces. */ if (argc < 2) { @@ -760,7 +759,7 @@ nextarg: argc--, argv++; } - if (argc == 0 && actions == 0 && !noprint) { + if (argc == 0 && actions == 0) { printif(ifr.ifr_name, aflag ? ifaliases : 1); exit(0); }
carp: fix SIOCSVH if carpr.carpr_carpdev is \0
Hi tech@, i've found the undocumented -carpdev option in ifconfig(8) which freezes my sytem if executed. As the -carpdev option is undocumented in both ifconfig(8) and carp(4) i propose two patches to remove this functionality. The patch below will return EINVAL in SIOCSVH if carpr.carpr_carpdev is not a valid interface name. I will send another patch to @tech to remove -carpdev from ifconfig(8) Cheers, Fabian Index: ip_carp.c === RCS file: /cvs/src/sys/netinet/ip_carp.c,v retrieving revision 1.284 diff -u -p -r1.284 ip_carp.c --- ip_carp.c 19 Dec 2015 11:19:35 - 1.284 +++ ip_carp.c 30 Dec 2015 11:31:57 - @@ -2022,8 +2022,7 @@ carp_ioctl(struct ifnet *ifp, u_long cmd if ((error = copyin(ifr->ifr_data, , sizeof carpr))) break; error = 1; - if (carpr.carpr_carpdev[0] != '\0' && - (ifp0 = ifunit(carpr.carpr_carpdev)) == NULL) + if ((ifp0 = ifunit(carpr.carpr_carpdev)) == NULL) return (EINVAL); if (carpr.carpr_peer.s_addr == 0) sc->sc_peer.s_addr = INADDR_CARP_GROUP;
ifconfig: remove undocumented -carpdev
Hi, please find below a patch to remove the undocumented -carpdev command from ifconfig(8). Cheers, Fabian Index: ifconfig.c === RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.311 diff -u -p -r1.311 ifconfig.c --- ifconfig.c 10 Dec 2015 17:26:59 - 1.311 +++ ifconfig.c 30 Dec 2015 11:07:40 - @@ -236,7 +236,6 @@ voidsetcarp_passwd(const char *, int); void setcarp_vhid(const char *, int); void setcarp_state(const char *, int); void setcarpdev(const char *, int); -void unsetcarpdev(const char *, int); void setcarp_nodes(const char *, int); void setcarp_balancing(const char *, int); void setpfsync_syncdev(const char *, int); @@ -395,7 +394,6 @@ const structcmd { { "carpdev",NEXTARG,0, setcarpdev }, { "carpnodes", NEXTARG,0, setcarp_nodes }, { "balancing", NEXTARG,0, setcarp_balancing }, - { "-carpdev", 1, 0, unsetcarpdev }, { "syncdev",NEXTARG,0, setpfsync_syncdev }, { "-syncdev", 1, 0, unsetpfsync_syncdev }, { "syncif", NEXTARG,0, setpfsync_syncdev }, @@ -4008,23 +4006,6 @@ setcarpdev(const char *val, int d) err(1, "SIOCGVH"); strlcpy(carpr.carpr_carpdev, val, sizeof(carpr.carpr_carpdev)); - - if (ioctl(s, SIOCSVH, (caddr_t)) == -1) - err(1, "SIOCSVH"); -} - -void -unsetcarpdev(const char *val, int d) -{ - struct carpreq carpr; - - bzero(, sizeof(struct carpreq)); - ifr.ifr_data = (caddr_t) - - if (ioctl(s, SIOCGVH, (caddr_t)) == -1) - err(1, "SIOCGVH"); - - bzero(_carpdev, sizeof(carpr.carpr_carpdev)); if (ioctl(s, SIOCSVH, (caddr_t)) == -1) err(1, "SIOCSVH");
Re: ifconfig: remove undocumented -carpdev
On Wed, Dec 30, 2015 at 07:24:01AM -0500, Ted Unangst wrote: > Fabian Raetz wrote: > > Hi, > > > > please find below a patch to remove the undocumented -carpdev command from > > ifconfig(8). > > wouldn't it make more sense to document the command? as the command is broken [0] and nobody noticed it so far, i'm wondering if anybody needs -carpdev [0] https://www.marc.info/?l=openbsd-tech=145147632420539=2
Re: ehci(4) Full-speed isochronous transfers support
On Sat, Mar 28, 2015 at 11:29:11AM +0100, Martin Pieuchot wrote: With the increasing number of machines shipping with rate-matching hubs instead of companion controllers to support USB Full and Low- speed devices, a number of people asked me if it was possible to add support for Full-speed isochronous transfers in order to use USB1.1 uaudio(4) devices with ehci(4)-only systems. The diff below does that. It also contain some cleanups for the High-speed isochronous code and plug some memory leaks for free. Please let me know how it goes with 1.1 and 2.0 devices. Hi, i've done some testing over the weekend and as far as i can tell, it worked great so far. uaudio0 at uhub3 port 2 configuration 1 interface 0 Logitech Logitech USB Headset rev 1.10/1.30 addr 4 uaudio0: audio rev 1.00, 4 mixer controls audio1 at uaudio0 Tests include: - playback/recording with aucat(1) - playing sounds/videos via AUDIODEVICE={r,}snd/1 and as snd/0 with - firefox/chrome - mpv/vlc Probably unrelated to your diff but i problems with mpv while watching some video streams from twitch.tv When used as below, the audio output was slowed down. --- $ AUDIODEVICE=rsnd/1 mpv http://www.twitch.tv/gfinitytv Playing: http://www.twitch.tv/gfinitytv (+) Video --vid=1 (h264) (+) Audio --aid=1 (aac) AO: [sndio] 44100Hz stereo 2ch s16 [mixer] Hardware volume control unavailable. [mixer] Hardware volume control unavailable. VO: [opengl] 1280x720 yuv420p AV: 00:00:44 A-V: 0.000 Dropped: 4 Cache: 1s+0KB [ffmpeg] ?: skipping 1 segments ahead, expired from playlists AV: 00:00:46 A-V: -0.000 Dropped: 4 Cache: 3s+0KB * Audio/Video desynchronisation detected! * This means either the audio or the video is played too slowly. Possible reasons, problems, workarounds: - Your system is simply too slow for this file. Transcode it to a lower bitrate file with e.g. mpv encoding support. - Slow video output. Try a different --vo driver (--vo=help for a list). Make sure framedrop is not disabled, or experiment with different values for --framedrop. - Playing from a slow network source. Download the file instead. - Try to find out whether audio/video/subs are causing this by experimenting with --no-video, --no-audio, or --no-sub. - If you switched audio or video tracks, try seeking to force synchronization. If none of this helps you, file a bug report. AV: 00:00:46 A-V: 3.947 ct: 0.418 Dropped: 4 Cache: 1s+0KB --- I'm not an audio expert but could it have something to with the play.rate of my headset is only capable of max 32000? When watching the same stream with vlc, all worked fine. Anyway, thanks for this diff! Cheers, Fabian audioctl -f /dev/audio1 --- name=USB audio encodings=slinear_le:16:2:1 properties=full_duplex,independent hiwat=10 lowat=7 mode=play play.rate=32000 play.channels=2 play.precision=16 play.bps=2 play.msb=1 play.encoding=slinear_le play.samples=0 play.pause=0 play.active=0 play.block_size=6400 play.errors=0 record.rate=32000 record.channels=2 record.precision=16 record.bps=2 record.msb=1 record.encoding=slinear_le record.samples=0 record.pause=0 record.active=0 record.block_size=6400 record.errors=0 mixerctl -f /dev/mixer1 --- outputs.spkr.mute=off outputs.spkr=255,255 record.mic.mute=off record.mic=248 dmesg --- OpenBSD 5.7-current (GENERIC.MP) #4: Sat Mar 28 12:52:22 CET 2015 mis...@junk.fritz.box:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 3849830400 (3671MB) avail mem = 3729293312 (3556MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdabd5000 (68 entries) bios0: vendor LENOVO version H3ET70WW(1.07) date 12/12/2012 bios0: LENOVO 3354DSG acpi0 at bios0: rev 2 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP SSDT SSDT HPET APIC MCFG SLIC FPDT ASF! SSDT SSDT UEFI UEFI MSDM UEFI DBG2 acpi0: wakeup devices P0P1(S4) GLAN(S4) EHC1(S3) EHC2(S3) XHC_(S3) HDEF(S4) PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) RP05(S4) [...] acpitimer0 at acpi0: 3579545 Hz, 24 bits acpihpet0 at acpi0: 14318179 Hz acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz, 2594.44 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS cpu0: 256KB 64b/line 8-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges cpu0: apic clock running at 99MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R)
[PATCH] #include stdlib.h in parse.y when calloc is used
Hi tech@, should the stdlib.h header be included in parse.y files when calloc(3) is used? Regards, Fabian From ce8307e0bc7541b88a9a9bf949f6585adef46bb6 Mon Sep 17 00:00:00 2001 From: Fabian Raetz fabian.ra...@gmail.com Date: Sat, 28 Mar 2015 12:44:32 +0100 Subject: [PATCH] include stdlib.h because of calloc(3) usage --- bin/chio/parse.y | 1 + sbin/ipsecctl/parse.y | 1 + usr.sbin/bgpd/parse.y | 1 + usr.sbin/dvmrpd/parse.y | 1 + usr.sbin/httpd/parse.y| 1 + usr.sbin/ifstated/parse.y | 1 + usr.sbin/iscsictl/parse.y | 1 + usr.sbin/ldpd/parse.y | 1 + usr.sbin/ospf6d/parse.y | 1 + usr.sbin/ospfd/parse.y| 1 + usr.sbin/relayd/parse.y | 1 + usr.sbin/ripd/parse.y | 1 + usr.sbin/snmpd/parse.y| 1 + 13 files changed, 13 insertions(+) diff --git bin/chio/parse.y bin/chio/parse.y index 0d086c9..279d08f 100644 --- bin/chio/parse.y +++ bin/chio/parse.y @@ -31,6 +31,7 @@ #include limits.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); diff --git sbin/ipsecctl/parse.y sbin/ipsecctl/parse.y index 63d2796..f04ff88 100644 --- sbin/ipsecctl/parse.y +++ sbin/ipsecctl/parse.y @@ -40,6 +40,7 @@ #include netdb.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include syslog.h #include unistd.h diff --git usr.sbin/bgpd/parse.y usr.sbin/bgpd/parse.y index 2021fbd..769f6e4 100644 --- usr.sbin/bgpd/parse.y +++ usr.sbin/bgpd/parse.y @@ -34,6 +34,7 @@ #include limits.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include syslog.h diff --git usr.sbin/dvmrpd/parse.y usr.sbin/dvmrpd/parse.y index fabc9cc..56fcac7 100644 --- usr.sbin/dvmrpd/parse.y +++ usr.sbin/dvmrpd/parse.y @@ -36,6 +36,7 @@ #include errno.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include syslog.h diff --git usr.sbin/httpd/parse.y usr.sbin/httpd/parse.y index 006cf4e..ce1e060 100644 --- usr.sbin/httpd/parse.y +++ usr.sbin/httpd/parse.y @@ -46,6 +46,7 @@ #include stdint.h #include stdarg.h #include stdio.h +#include stdlib.h #include netdb.h #include string.h #include ifaddrs.h diff --git usr.sbin/ifstated/parse.y usr.sbin/ifstated/parse.y index a010f8c..c1f721e 100644 --- usr.sbin/ifstated/parse.y +++ usr.sbin/ifstated/parse.y @@ -36,6 +36,7 @@ #include limits.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include syslog.h #include event.h diff --git usr.sbin/iscsictl/parse.y usr.sbin/iscsictl/parse.y index d199c81..fecde41 100644 --- usr.sbin/iscsictl/parse.y +++ usr.sbin/iscsictl/parse.y @@ -38,6 +38,7 @@ #include netdb.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include unistd.h diff --git usr.sbin/ldpd/parse.y usr.sbin/ldpd/parse.y index ee070ca..4821d51 100644 --- usr.sbin/ldpd/parse.y +++ usr.sbin/ldpd/parse.y @@ -36,6 +36,7 @@ #include limits.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include syslog.h diff --git usr.sbin/ospf6d/parse.y usr.sbin/ospf6d/parse.y index 01a2731..1ba57c9 100644 --- usr.sbin/ospf6d/parse.y +++ usr.sbin/ospf6d/parse.y @@ -37,6 +37,7 @@ #include netdb.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include syslog.h diff --git usr.sbin/ospfd/parse.y usr.sbin/ospfd/parse.y index 09e6922..1909fa3 100644 --- usr.sbin/ospfd/parse.y +++ usr.sbin/ospfd/parse.y @@ -35,6 +35,7 @@ #include limits.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include syslog.h diff --git usr.sbin/relayd/parse.y usr.sbin/relayd/parse.y index 6bd980b..4092cd6 100644 --- usr.sbin/relayd/parse.y +++ usr.sbin/relayd/parse.y @@ -42,6 +42,7 @@ #include stdint.h #include stdarg.h #include stdio.h +#include stdlib.h #include unistd.h #include ctype.h #include err.h diff --git usr.sbin/ripd/parse.y usr.sbin/ripd/parse.y index dacb201..0d224c9 100644 --- usr.sbin/ripd/parse.y +++ usr.sbin/ripd/parse.y @@ -36,6 +36,7 @@ #include limits.h #include stdarg.h #include stdio.h +#include stdlib.h #include string.h #include syslog.h diff --git usr.sbin/snmpd/parse.y usr.sbin/snmpd/parse.y index cea9194..72f020f 100644 --- usr.sbin/snmpd/parse.y +++ usr.sbin/snmpd/parse.y @@ -44,6 +44,7 @@ #include stdint.h #include stdarg.h #include stdio.h +#include stdlib.h #include netdb.h #include string.h #include syslog.h -- 2.3.3
Re: event(3): add misssing prototypes / reorder
short event void (*fn)(int, short, void *) void *arg struct timeval *tv -.Ft int -.Fn event_base_once struct event_base *base int fd short event void (*fn)(int, short, void *) void *arg struct timeval *tv -.Ft int -.Fn event_pending struct event *ev short event struct timeval *tv +.Fn event_pending struct event *ev short event const struct timeval *tv .Ft int .Fn event_initialized struct event *ev -.Ft int -.Fn event_priority_init int npriorities -.Ft int -.Fn event_priority_set struct event *ev int priority .Ft void .Fn evtimer_set struct event *ev void (*fn)(int, short, void *) void *arg .Ft void -.Fn evtimer_add struct event *ev struct timeval * +.Fn evtimer_add struct event *ev const struct timeval *tv .Ft void .Fn evtimer_del struct event *ev .Ft int -.Fn evtimer_pending struct event *ev struct timeval *tv +.Fn evtimer_pending struct event *ev const struct timeval *tv .Ft int .Fn evtimer_initialized struct event *ev .Ft void .Fn signal_set struct event *ev int signal void (*fn)(int, short, void *) void *arg .Ft void -.Fn signal_add struct event *ev struct timeval * +.Fn signal_add struct event *ev const struct timeval *tv .Ft void .Fn signal_del struct event *ev .Ft int -.Fn signal_pending struct event *ev struct timeval *tv +.Fn signal_pending struct event *ev const struct timeval *tv .Ft int .Fn signal_initialized struct event *ev +.Ft int +.Fn event_once int fd short event void (*fn)(int, short, void *) void *arg const struct timeval *tv +.Ft int +.Fn event_loop int flags +.Ft int +.Fn event_loopexit const struct timeval *tv +.Ft int +.Fn event_loopbreak void +.Ft struct event_asr * +.Fn event_asr_run struct asr_query *aq void (*fn)(struct asr_result *, void *) void *arg +.Ft void +.Fn event_asr_abort struct event_asr *eva +.Ft int +.Fn event_priority_init int npriorities +.Ft int +.Fn event_priority_set struct event *ev int priority +.Ft int +.Fn event_base_dispatch struct event_base *base +.Ft int +.Fn event_base_loop struct event_base *base int flags +.Ft int +.Fn event_base_loopexit struct event_base *base const struct timeval *tv +.Ft int +.Fn event_base_loopbreak struct event_base *base +.Ft int +.Fn event_base_set struct event_base *base struct event *ev +.Ft int +.Fn event_base_once struct event_base *base int fd short event void (*fn)(int, short, void *) void *arg const struct timeval *tv +.Ft void +.Fn event_base_free struct event_base *base +.Ft int +.Fn bufferevent_base_set struct event_base *base struct bufferevent *bufev .Ft struct bufferevent * -.Fn bufferevent_new int fd evbuffercb readcb evbuffercb writecb everrorcb void *cbarg +.Fn bufferevent_new int fd evbuffercb readcb evbuffercb writecb everrorcb errorcb void *cbarg .Ft void .Fn bufferevent_free struct bufferevent *bufev .Ft int @@ -148,12 +154,6 @@ .Fn bufferevent_disable struct bufferevent *bufev short event .Ft void .Fn bufferevent_settimeout struct bufferevent *bufev int timeout_read int timeout_write -.Ft int -.Fn bufferevent_base_set struct event_base *base struct bufferevent *bufev -.Ft struct event_asr * -.Fn event_asr_run struct asr_query *aq void (*fn)(struct asr_result *, void *) void * -.Ft void -.Fn event_asr_abort struct event_asr *eva .Sh DESCRIPTION The .Nm event On Tue, Feb 17, 2015 at 10:55:38PM +0100, Fabian Raetz wrote: Hi tech@, below is a diff which 1) adds the following prototypes from event.h to event(3): - event_reinit - event_set_log_callback - event_get_version - event_get_method - event_base_new - event_base_priority_init - bufferevent_priority_set - bufferevent_setcb - bufferevent_setfd - bufferevent_setwatermark 2) I wasn't quite sure where to place them and i ended up with a little reordering of the present prototypes. Prototypes are now sorted loosely after their corresponding chapters within event(3). 3) sprinkled some missing const keywords on timeval arguments. 4) sprinkled some missing argument names. I'm planning to document these functions if this will get commited. Comments? ;) Regards, Fabian diff --git a/lib/libevent/Makefile b/lib/libevent/Makefile index f1226a2..89bdf91 100644 --- a/lib/libevent/Makefile +++ b/lib/libevent/Makefile @@ -8,25 +8,13 @@ SRCS= buffer.c evbuffer.c event.c event_tagging.c evutil.c kqueue.c \ HDRS= event.h evutil.h MAN= event.3 evbuffer_new.3 MLINKS=event.3 event_init.3 \ + event.3 event_reinit.3 \ event.3 event_dispatch.3 \ - event.3 event_loop.3 \ - event.3 event_loopexit.3 \ - event.3 event_loopbreak.3 \ event.3 event_set.3 \ - event.3 event_base_dispatch.3 \ - event.3 event_base_loop.3 \ - event.3 event_base_loopexit.3 \ - event.3 event_base_loopbreak.3 \ - event.3 event_base_set.3 \ - event.3 event_base_free.3 \ event.3 event_add.3 \ event.3 event_del.3 \ - event.3 event_once.3
event(3): add misssing prototypes / reorder
Hi tech@, below is a diff which 1) adds the following prototypes from event.h to event(3): - event_reinit - event_set_log_callback - event_get_version - event_get_method - event_base_new - event_base_priority_init - bufferevent_priority_set - bufferevent_setcb - bufferevent_setfd - bufferevent_setwatermark 2) I wasn't quite sure where to place them and i ended up with a little reordering of the present prototypes. Prototypes are now sorted loosely after their corresponding chapters within event(3). 3) sprinkled some missing const keywords on timeval arguments. 4) sprinkled some missing argument names. I'm planning to document these functions if this will get commited. Comments? ;) Regards, Fabian diff --git a/lib/libevent/Makefile b/lib/libevent/Makefile index f1226a2..89bdf91 100644 --- a/lib/libevent/Makefile +++ b/lib/libevent/Makefile @@ -8,25 +8,13 @@ SRCS= buffer.c evbuffer.c event.c event_tagging.c evutil.c kqueue.c \ HDRS= event.h evutil.h MAN= event.3 evbuffer_new.3 MLINKS=event.3 event_init.3 \ + event.3 event_reinit.3 \ event.3 event_dispatch.3 \ - event.3 event_loop.3 \ - event.3 event_loopexit.3 \ - event.3 event_loopbreak.3 \ event.3 event_set.3 \ - event.3 event_base_dispatch.3 \ - event.3 event_base_loop.3 \ - event.3 event_base_loopexit.3 \ - event.3 event_base_loopbreak.3 \ - event.3 event_base_set.3 \ - event.3 event_base_free.3 \ event.3 event_add.3 \ event.3 event_del.3 \ - event.3 event_once.3 \ - event.3 event_base_once.3 \ event.3 event_pending.3 \ event.3 event_initialized.3 \ - event.3 event_priority_init.3 \ - event.3 event_priority_set.3 \ event.3 evtimer_set.3 \ event.3 evtimer_add.3 \ event.3 evtimer_del.3 \ @@ -37,17 +25,40 @@ MLINKS= event.3 event_init.3 \ event.3 signal_del.3 \ event.3 signal_pending.3 \ event.3 signal_initialized.3 \ + event.3 event_once.3 \ + event.3 event_loop.3 \ + event.3 event_loopexit.3 \ + event.3 event_loopbreak.3 \ + event.3 event_asr_run.3 \ + event.3 event_asr_abort.3 \ + event.3 event_priority_init.3 \ + event.3 event_priority_set.3 \ + event.3 event_set_log_callback.3 \ + event.3 event_get_version.3 \ + event.3 event_get_method.3 \ + event.3 event_base_new.3 \ + event.3 event_base_dispatch.3 \ + event.3 event_base_loop.3 \ + event.3 event_base_loopexit.3 \ + event.3 event_base_loopbreak.3 \ + event.3 event_base_set.3 \ + event.3 event_base_once.3 \ + event.3 event_base_free.3 \ + event.3 event_base_get_method.3 \ + event.3 event_base_priority_init.3 \ + event.3 bufferevent_base_set.3 \ event.3 bufferevent_new.3 \ + event.3 bufferevent_priority_set.3 \ event.3 bufferevent_free.3 \ + event.3 bufferevent_setcb.3 \ + event.3 bufferevent_setfd.3 \ event.3 bufferevent_write.3 \ event.3 bufferevent_write_buffer.3 \ event.3 bufferevent_read.3 \ event.3 bufferevent_enable.3 \ event.3 bufferevent_disable.3 \ event.3 bufferevent_settimeout.3 \ - event.3 bufferevent_base_set.3 \ - event.3 event_asr_run.3 \ - event.3 event_asr_abort.3 \ + event.3 bufferevent_setwatermark.3 \ evbuffer_new.3 evbuffer_free.3 \ evbuffer_new.3 evbuffer_setcb.3 \ evbuffer_new.3 evbuffer_expand.3 \ diff --git a/lib/libevent/event.3 b/lib/libevent/event.3 index 7354b1a..29e338b 100644 --- a/lib/libevent/event.3 +++ b/lib/libevent/event.3 @@ -28,25 +28,13 @@ .Os .Sh NAME .Nm event_init , +.Nm event_reinit , .Nm event_dispatch , -.Nm event_loop , -.Nm event_loopexit , -.Nm event_loopbreak , .Nm event_set , -.Nm event_base_dispatch , -.Nm event_base_loop , -.Nm event_base_loopexit , -.Nm event_base_loopbreak , -.Nm event_base_set , -.Nm event_base_free , .Nm event_add , .Nm event_del , -.Nm event_once , -.Nm event_base_once , .Nm event_pending , .Nm event_initialized , -.Nm event_priority_init , -.Nm event_priority_set , .Nm evtimer_set , .Nm evtimer_add , .Nm evtimer_del , @@ -57,17 +45,40 @@ .Nm signal_del , .Nm signal_pending , .Nm signal_initialized , +.Nm event_once , +.Nm event_loop , +.Nm event_loopexit , +.Nm event_loopbreak , +.Nm event_asr_run , +.Nm event_asr_abort, +.Nm event_priority_init , +.Nm event_priority_set , +.Nm event_set_log_callback , +.Nm event_get_version , +.Nm event_get_method , +.Nm event_base_new , +.Nm event_base_dispatch , +.Nm event_base_loop , +.Nm event_base_loopexit , +.Nm event_base_loopbreak , +.Nm event_base_set , +.Nm event_base_once , +.Nm event_base_free , +.Nm event_base_get_method , +.Nm event_base_priority_init , +.Nm bufferevent_base_set , .Nm bufferevent_new , +.Nm bufferevent_priority_set , .Nm bufferevent_free , +.Nm
if_media.c: #include net/if_var.h
Hi, if_media.c needs net/if_var.h. This fixes the build with IFMEDIA_DEBUG. Regards, Fabian Index: sys/net/if_media.c === RCS file: /cvs/src/sys/net/if_media.c,v retrieving revision 1.24 diff -u -p -r1.24 if_media.c --- sys/net/if_media.c 9 Dec 2014 07:05:06 - 1.24 +++ sys/net/if_media.c 21 Jan 2015 22:18:29 - @@ -84,6 +84,7 @@ #include sys/malloc.h #include net/if.h +#include net/if_var.h #include net/if_media.h #include net/netisr.h
axen(4): two small changes
Hi, 1) axen_cmd() returns int instead of usbd_status. 2) the ifp variable in axen_tick_task() is not used so delete it. Cheers, Fabian Index: if_axen.c === RCS file: /cvs/src/sys/dev/usb/if_axen.c,v retrieving revision 1.10 diff -u -p -r1.10 if_axen.c --- if_axen.c 12 Jan 2015 18:18:42 - 1.10 +++ if_axen.c 15 Jan 2015 14:02:56 - @@ -176,7 +176,7 @@ int axen_miibus_readreg(struct device *dev, int phy, int reg) { struct axen_softc *sc = (void *)dev; - usbd_status err; + int err; uWord val; int ival; @@ -212,7 +212,7 @@ void axen_miibus_writereg(struct device *dev, int phy, int reg, int val) { struct axen_softc *sc = (void *)dev; - usbd_status err; + int err; uWord uval; if (usbd_is_dying(sc-axen_udev)) @@ -1184,7 +1184,6 @@ axen_tick_task(void *xsc) { int s; struct axen_softc *sc; - struct ifnet*ifp; struct mii_data *mii; sc = xsc; @@ -1195,7 +1194,6 @@ axen_tick_task(void *xsc) if (usbd_is_dying(sc-axen_udev)) return; - ifp = GET_IFP(sc); mii = GET_MII(sc); if (mii == NULL) return;
axen(4): use %zu modifier for size_t in DPRINTF
Hi, this fixes the build with AXEN_DEBUG defined for me. Trailing whitespace removed while here. Regards, Fabian Index: if_axen.c === RCS file: /cvs/src/sys/dev/usb/if_axen.c,v retrieving revision 1.9 diff -u -p -r1.9 if_axen.c --- if_axen.c 22 Dec 2014 02:28:52 - 1.9 +++ if_axen.c 12 Jan 2015 17:48:50 - @@ -1032,7 +1032,7 @@ axen_rxeof(struct usbd_xfer *xfer, void pkt_hdr = letoh32(*hdr_p); pkt_len = (pkt_hdr 16) 0x1fff; - DPRINTFN(10,(rxeof: packet#%d, pkt_hdr 0x%08x, pkt_len %d\n, + DPRINTFN(10,(rxeof: packet#%d, pkt_hdr 0x%08x, pkt_len %zu\n, pkt_count, pkt_hdr, pkt_len)); if ((pkt_hdr AXEN_RXHDR_CRC_ERR) ||
Re: PATCH: fix iwn(4) scan hangs
On Wed, Sep 10, 2014 at 08:52:42PM +0200, Marcin Piotr Pawlowski wrote: Hi, On 09/10/14 20:19, Fabian Raetz wrote: On Wed, Sep 10, 2014 at 02:42:43PM +0200, Marcin Piotr Pawlowski wrote: Yes, I think that it could be is possible to double clean the node cache. Updated diff with suggestion from Stefan. Hi, this patch works for me too. But is the problem not specific to the iwn(4) driver or at least only specific to drivers which override the default state machine and not calling into the original state machine when IEEE80211_S_SCAN is entered? ieee80211_begin_scan() calls ieee80211_free_allnodes() which prevents the problem for drivers which use the default scanning infrastructure. So would it make sense to move the call to ieee80211_clean_cached() into iwn(4) like in the modified patch below? Marcin pointed me to some other driver that could benefit from this and that iwn(4) is not that special as i thought, so i am ok with his original patch too (fwiw). Regards, Fabian I experimented a bit with calling ieee80211_free_allnodes() here as it is called in default scanning infrastructure but this does not work for me (yet) :) The ieee80211_begin_scan is used by ieee80211_newstate() but ifconfig scan is done by ioctl(SIOCS80211SCAN) which is processes by the ieee80211_ioctl() that then invokes ieee80211_new_state(). So both paths are independent and this issue is not specific to the iwn driver. I hope that I have not overlooked something. Best regards, mpp
Re: PATCH: fix iwn(4) scan hangs
On Wed, Sep 10, 2014 at 02:42:43PM +0200, Marcin Piotr Pawlowski wrote: Yes, I think that it could be is possible to double clean the node cache. Updated diff with suggestion from Stefan. Hi, this patch works for me too. But is the problem not specific to the iwn(4) driver or at least only specific to drivers which override the default state machine and not calling into the original state machine when IEEE80211_S_SCAN is entered? ieee80211_begin_scan() calls ieee80211_free_allnodes() which prevents the problem for drivers which use the default scanning infrastructure. So would it make sense to move the call to ieee80211_clean_cached() into iwn(4) like in the modified patch below? I experimented a bit with calling ieee80211_free_allnodes() here as it is called in default scanning infrastructure but this does not work for me (yet) :) Cheers, Fabian Index: dev/pci/if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.135 diff -u -p -r1.135 if_iwn.c --- dev/pci/if_iwn.c10 Sep 2014 07:22:09 - 1.135 +++ dev/pci/if_iwn.c10 Sep 2014 18:04:18 - @@ -1750,6 +1750,9 @@ iwn_newstate(struct ieee80211com *ic, en /* Make the link LED blink while we're scanning. */ iwn_set_led(sc, IWN_LED_LINK, 10, 10); + if (ic-ic_state != IEEE80211_S_SCAN) + ieee80211_clean_cached(ic); + if ((error = iwn_scan(sc, IEEE80211_CHAN_2GHZ)) != 0) { printf(%s: could not initiate scan\n, sc-sc_dev.dv_xname); Index: net80211/ieee80211_node.c === RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v retrieving revision 1.82 diff -u -p -r1.82 ieee80211_node.c --- net80211/ieee80211_node.c 8 Aug 2014 15:16:39 - 1.82 +++ net80211/ieee80211_node.c 10 Sep 2014 18:04:19 - @@ -1134,6 +1134,21 @@ ieee80211_free_allnodes(struct ieee80211 ieee80211_node_cleanup(ic, ic-ic_bss); /* for station mode */ } +void +ieee80211_clean_cached(struct ieee80211com *ic) +{ + struct ieee80211_node *ni, *next_ni; + int s; + + s = splnet(); + for (ni = RB_MIN(ieee80211_tree, ic-ic_tree); + ni != NULL; ni = next_ni) { + next_ni = RB_NEXT(ieee80211_tree, ic-ic_tree, ni); + if (ni-ni_state == IEEE80211_STA_CACHE) + ieee80211_free_node(ic, ni); + } + splx(s); +} /* * Timeout inactive nodes. * Index: net80211/ieee80211_node.h === RCS file: /cvs/src/sys/net80211/ieee80211_node.h,v retrieving revision 1.45 diff -u -p -r1.45 ieee80211_node.h --- net80211/ieee80211_node.h 20 Mar 2014 13:19:06 - 1.45 +++ net80211/ieee80211_node.h 10 Sep 2014 18:04:20 - @@ -325,6 +325,7 @@ extern void ieee80211_free_allnodes(stru typedef void ieee80211_iter_func(void *, struct ieee80211_node *); extern void ieee80211_iterate_nodes(struct ieee80211com *ic, ieee80211_iter_func *, void *); +extern void ieee80211_clean_cached(struct ieee80211com *ic); extern void ieee80211_clean_nodes(struct ieee80211com *, int); extern int ieee80211_setup_rates(struct ieee80211com *, struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int); Best regards, mpp On 09/10/14 14:34, Stefan Sperling wrote: On Wed, Sep 10, 2014 at 02:06:15PM +0200, Marcin Piotr Pawlowski wrote: On 09/10/14 10:15, Stefan Sperling wrote: On Tue, Sep 09, 2014 at 10:17:59PM +0200, Fabian Raetz wrote: Hm interesting ... i can reproduce it here with an 2.4GHz AP. The entry isn't cleared when scanning and the interface is up. Scanning when the interface is down works correct for me. I will take a look at it tommorow :) 2014-09-09 21:48 GMT+02:00 Stuart Henderson st...@openbsd.org: I have just noticed one thing with this; the 5GHz AP which I powered up for a test is still showing in my current scan result long after I turned it off again. Caching issue somewhere? Try this with other wifi cards, too. The AP could be lingering in the net80211 node cache which is device independent. I think that the hypothesis with net80211 node cache was correct. And following diff solves this issue for me. Best regards, mpp Index: ieee80211_ioctl.c === RCS file: /cvs/src/sys/net80211/ieee80211_ioctl.c,v retrieving revision 1.35 diff -u -r1.35 ieee80211_ioctl.c --- ieee80211_ioctl.c 10 Jul 2014 14:32:28 - 1.35 +++ ieee80211_ioctl.c 10 Sep 2014 12:04:13 - @@ -645,6 +645,7 @@ error = ENETDOWN; break; } + ieee80211_clean_cached(ic); Perhaps I'm wrong but couldn't
PATCH: fix iwn(4) scan hangs
Hi, below is a patch for iwn(4) which hopefully fixes a problem where iwn(4) does not return from a scan, if the interface is up. This patch was backported from this FreeBSD commit https://svnweb.freebsd.org/base?view=revisionrevision=258829 - Overhaul the iwn(4) scan infrastructure to be slightly more correct for these chipsets. * Correctly set the active/passive flag in the scan request - this is NOT a is the channel active|passive; it's to do with whether we have an SSID to actively scan for or not. The firmware takes care of the active/passive setup of the channel. * Calculate the active/passive dwell time based on the beacon interval and the channel mode, rather than using a hard coded value. * For now, hardcode the scan service_time. It's defined as: 31:22 - number of beacon intervals to come back onto the home channel for; 0:21 - time (microseconds) to come back onto the home channel for. When doing an active scan when the NIC is active (whether we're associated or not - it only matters if we've setup the NIC to a destination or not) this determines how much time to stay on the home channel for when scanning. We can tune this based on the amount of active traffic. For now it's 4 beacon intervals and 100 microseconds. * Fix the good crc threshold setting. It differs based on the NIC firmware. Some older firmware required a workaround; the later firmware instead treats the field as a flag. * Enforce that we are not sending a scan command if one is already pending. Any time this is done is a bug and it absolutely needs to be fixed - so be very loud. * Add the SCAN flag to a few debug messages that are scan related but only occuring under STATE. Now, this does get noisy when you're scanning in an actively busy 2GHz network as the firmware (for reason I don't quite yet understand) seems hell bent on staying on some passive channels longer than it should. However, it should eventually recover and complete the scan. -- Marcin Piotr Pawlowski came up with the same diff (without comments) and send it to me in a private mail. Thanks! I kept all comments to reduce the diff to FreeBSD's iwn(4). In iwn_limit_dwell(struct iwn_softc *sc, uint16_t dwell_time), the dwell_time is unused, so there could probably some code be removed. Devices tested so far: Inter WiFi Link 5100(Marcin Piotr Pawlowski) Intel Centrino Advanced-N 6205 (Mike Burns, who also reported the problem on misc@, thanks!) Intel Centrino Wireless-N 2230 (Fabian Raetz) More tests are much appreciated :) Regards, Fabian Index: if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.133 diff -u -p -r1.133 if_iwn.c --- if_iwn.c22 Jul 2014 13:12:11 - 1.133 +++ if_iwn.c9 Sep 2014 09:47:48 - @@ -220,6 +220,9 @@ int iwn_send_btcoex(struct iwn_softc *) intiwn_send_advanced_btcoex(struct iwn_softc *); intiwn5000_runtime_calib(struct iwn_softc *); intiwn_config(struct iwn_softc *); +uint16_t iwn_get_active_dwell_time(struct iwn_softc *, uint16_t, uint8_t); +uint16_t iwn_limit_dwell(struct iwn_softc *, uint16_t); +uint16_t iwn_get_passive_dwell_time(struct iwn_softc *, uint16_t); intiwn_scan(struct iwn_softc *, uint16_t); intiwn_auth(struct iwn_softc *); intiwn_run(struct iwn_softc *); @@ -4424,6 +4427,66 @@ iwn_config(struct iwn_softc *sc) return 0; } +uint16_t +iwn_get_active_dwell_time(struct iwn_softc *sc, +uint16_t flags, uint8_t n_probes) +{ + /* No channel? Default to 2GHz settings */ + if (flags IEEE80211_CHAN_2GHZ) { + return (IWN_ACTIVE_DWELL_TIME_2GHZ + + IWN_ACTIVE_DWELL_FACTOR_2GHZ * (n_probes + 1)); + } + + /* 5GHz dwell time */ + return (IWN_ACTIVE_DWELL_TIME_5GHZ + + IWN_ACTIVE_DWELL_FACTOR_5GHZ * (n_probes + 1)); +} + +/* + * Limit the total dwell time to 85% of the beacon interval. + * + * Returns the dwell time in milliseconds. + */ +uint16_t +iwn_limit_dwell(struct iwn_softc *sc, uint16_t dwell_time) +{ + struct ieee80211com *ic = sc-sc_ic; + struct ieee80211_node *ni = ic-ic_bss; + int bintval = 0; + + /* bintval is in TU (1.024mS) */ + if (ni != NULL) + bintval = ni-ni_intval; + + /* +* If it's non-zero, we should calculate the minimum of +* it and the DWELL_BASE. +* +* XXX Yes, the math should take into account that bintval +* is 1.024mS, not 1mS.. +*/ + if (bintval 0) { + return (MIN(IWN_PASSIVE_DWELL_BASE, ((bintval * 85) / 100))); + } + + /* No association context? Default */ + return (IWN_PASSIVE_DWELL_BASE); +} + +uint16_t +iwn_get_passive_dwell_time(struct iwn_softc *sc, uint16_t flags) +{ + uint16_t
Re: PATCH: fix iwn(4) scan hangs
On Tue, Sep 09, 2014 at 12:38:04PM +0200, Fabian Raetz wrote: Hi, below is a patch for iwn(4) which hopefully fixes a problem where iwn(4) does not return from a scan, if the interface is up. here's an updated version which does not set hdr-max_svc / hdr-pause_svc. Cristoph Zimmermann noticed that scan requests return no APs on his device (thanks for testing). iwn0 at pci2 dev 0 function 0 Intel WiFi Link 5100 rev 0x00: msi, MIMO 1T2R, MoW, address 00:21:6b:a3:70:7a As Piotr and Mike tested the patch from Piotr which does not set this values either and it still works on my card, this should the way to go for now. Index: if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.133 diff -u -p -r1.133 if_iwn.c --- if_iwn.c22 Jul 2014 13:12:11 - 1.133 +++ if_iwn.c9 Sep 2014 14:57:34 - @@ -220,6 +220,9 @@ int iwn_send_btcoex(struct iwn_softc *) intiwn_send_advanced_btcoex(struct iwn_softc *); intiwn5000_runtime_calib(struct iwn_softc *); intiwn_config(struct iwn_softc *); +uint16_t iwn_get_active_dwell_time(struct iwn_softc *, uint16_t, uint8_t); +uint16_t iwn_limit_dwell(struct iwn_softc *, uint16_t); +uint16_t iwn_get_passive_dwell_time(struct iwn_softc *, uint16_t); intiwn_scan(struct iwn_softc *, uint16_t); intiwn_auth(struct iwn_softc *); intiwn_run(struct iwn_softc *); @@ -4424,6 +4427,66 @@ iwn_config(struct iwn_softc *sc) return 0; } +uint16_t +iwn_get_active_dwell_time(struct iwn_softc *sc, +uint16_t flags, uint8_t n_probes) +{ + /* No channel? Default to 2GHz settings */ + if (flags IEEE80211_CHAN_2GHZ) { + return (IWN_ACTIVE_DWELL_TIME_2GHZ + + IWN_ACTIVE_DWELL_FACTOR_2GHZ * (n_probes + 1)); + } + + /* 5GHz dwell time */ + return (IWN_ACTIVE_DWELL_TIME_5GHZ + + IWN_ACTIVE_DWELL_FACTOR_5GHZ * (n_probes + 1)); +} + +/* + * Limit the total dwell time to 85% of the beacon interval. + * + * Returns the dwell time in milliseconds. + */ +uint16_t +iwn_limit_dwell(struct iwn_softc *sc, uint16_t dwell_time) +{ + struct ieee80211com *ic = sc-sc_ic; + struct ieee80211_node *ni = ic-ic_bss; + int bintval = 0; + + /* bintval is in TU (1.024mS) */ + if (ni != NULL) + bintval = ni-ni_intval; + + /* +* If it's non-zero, we should calculate the minimum of +* it and the DWELL_BASE. +* +* XXX Yes, the math should take into account that bintval +* is 1.024mS, not 1mS.. +*/ + if (bintval 0) { + return (MIN(IWN_PASSIVE_DWELL_BASE, ((bintval * 85) / 100))); + } + + /* No association context? Default */ + return (IWN_PASSIVE_DWELL_BASE); +} + +uint16_t +iwn_get_passive_dwell_time(struct iwn_softc *sc, uint16_t flags) +{ + uint16_t passive; + if (flags IEEE80211_CHAN_2GHZ) { + passive = IWN_PASSIVE_DWELL_BASE + IWN_PASSIVE_DWELL_TIME_2GHZ; + } else { + passive = IWN_PASSIVE_DWELL_BASE + IWN_PASSIVE_DWELL_TIME_5GHZ; + } + + /* Clamp to the beacon interval if we're associated */ + return (iwn_limit_dwell(sc, passive)); +} + int iwn_scan(struct iwn_softc *sc, uint16_t flags) { @@ -4436,9 +4499,9 @@ iwn_scan(struct iwn_softc *sc, uint16_t struct ieee80211_rateset *rs; struct ieee80211_channel *c; uint8_t *buf, *frm; - uint16_t rxchain; + uint16_t rxchain, dwell_active, dwell_passive; uint8_t txant; - int buflen, error; + int buflen, error, is_active; buf = malloc(IWN_SCAN_MAXSZ, M_DEVBUF, M_NOWAIT | M_ZERO); if (buf == NULL) { @@ -4474,7 +4537,6 @@ iwn_scan(struct iwn_softc *sc, uint16_t tx-lifetime = htole32(IWN_LIFETIME_INFINITE); if (flags IEEE80211_CHAN_5GHZ) { - hdr-crc_threshold = 0x; /* Send probe requests at 6Mbps. */ tx-plcp = iwn_rates[IWN_RIDX_OFDM6].plcp; rs = ic-ic_sup_rates[IEEE80211_MODE_11A]; @@ -4488,12 +4550,23 @@ iwn_scan(struct iwn_softc *sc, uint16_t /* Use the first valid TX antenna. */ txant = IWN_LSB(sc-txchainmask); tx-rflags |= IWN_RFLAG_ANT(txant); + + /* +* Only do active scanning if we're announcing a probe request +* for a given SSID (or more, if we ever add it to the driver.) +*/ + is_active = 0; + /* +* If we're scanning for a specific SSID, add it to the command. +*/ essid = (struct iwn_scan_essid *)(tx + 1); if (ic-ic_des_esslen != 0) { essid[0].id = IEEE80211_ELEMID_SSID; essid[0].len = ic-ic_des_esslen; memcpy(essid[0].data, ic-ic_des_essid, ic-ic_des_esslen
Re: PATCH: fix iwn(4) scan hangs
Hm interesting ... i can reproduce it here with an 2.4GHz AP. The entry isn't cleared when scanning and the interface is up. Scanning when the interface is down works correct for me. I will take a look at it tommorow :) 2014-09-09 21:48 GMT+02:00 Stuart Henderson st...@openbsd.org: I have just noticed one thing with this; the 5GHz AP which I powered up for a test is still showing in my current scan result long after I turned it off again. Caching issue somewhere?
Re: Patch: ifconfig - fix SIGSEGV
On Thu, Jun 05, 2014 at 07:39:01PM +0200, Fabian Raetz wrote: Hi tech@, Please ignore this thread! A reboot after rebuilding userland fixed the problem. Sorry! when calling ifconfig(8) with a not supported option like below, it segfaults. ifconfig [interface] -someParameterNotSupportedWithALeadingMinus ifconfig re0 -adaw ifconfig iwn0 -media Here's a backtrace: #0 strlcpy (dst=0x84c658 _entbuf+24 , src=0x0, siz=optimized out) at /usr/src/lib/libc/string/strlcpy.c:37 #1 0x00413a45 in _fillhostent (h=0x200f7f800, r=0x84c620 _hostent, buf=optimized out, len=4096) at /usr/src/lib/libc/asr/gethostnamadr.c:73 #2 0x00413ceb in _gethostbyname (h_errnop=optimized out, buflen=optimized out, buf=optimized out, ret=optimized out, af=optimized out, name=optimized out) at /usr/src/lib/libc/asr/gethostnamadr.c:125 #3 gethostbyname2 (name=optimized out, af=2) at /usr/src/lib/libc/asr/gethostnamadr.c:152 #4 0x0040ae78 in in_getaddr (s=0x7f7d6f93 -asdf, which=1) at /usr/src/sbin/ifconfig/ifconfig.c:4556 #5 0x004019b4 in setifaddr (addr=0x7f7d6f93 -asdf, param=0) at /usr/src/sbin/ifconfig/ifconfig.c:1112 #6 0x00400b01 in main (argc=1, argv=0x7f7d6d78) at /usr/src/sbin/ifconfig/ifconfig.c:738 And here a patch that fixes the problem for me. Hope this is the right place to errx(). Another thing i observed is that when calling ifconfig re0 awdawd it behaves like calling ifconfig re0 up but i have not looked into this. Tested against -current amd64 Regards, Fabian Index: ifconfig.c === RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.283 diff -u -p -r1.283 ifconfig.c --- ifconfig.c12 May 2014 08:47:37 - 1.283 +++ ifconfig.c5 Jun 2014 17:17:17 - @@ -4552,14 +4552,15 @@ in_getaddr(const char *s, int which) errx(1, %d: bad prefixlen, bits); in_getprefix(p, MASK); memcpy(sin-sin_addr, tsin.sin_addr, sizeof(sin-sin_addr)); - } else if (inet_aton(s, sin-sin_addr) == 0) { + } else if (inet_aton(s, sin-sin_addr) == 1) { if ((hp = gethostbyname(s))) memcpy(sin-sin_addr, hp-h_addr, hp-h_length); else if ((np = getnetbyname(s))) sin-sin_addr = inet_makeaddr(np-n_net, INADDR_ANY); else errx(1, %s: bad value, s); - } + } else + errx(1, %s: bad value, s); } /* ARGSUSED */
Patch: ifconfig - fix SIGSEGV
Hi tech@, when calling ifconfig(8) with a not supported option like below, it segfaults. ifconfig [interface] -someParameterNotSupportedWithALeadingMinus ifconfig re0 -adaw ifconfig iwn0 -media Here's a backtrace: #0 strlcpy (dst=0x84c658 _entbuf+24 , src=0x0, siz=optimized out) at /usr/src/lib/libc/string/strlcpy.c:37 #1 0x00413a45 in _fillhostent (h=0x200f7f800, r=0x84c620 _hostent, buf=optimized out, len=4096) at /usr/src/lib/libc/asr/gethostnamadr.c:73 #2 0x00413ceb in _gethostbyname (h_errnop=optimized out, buflen=optimized out, buf=optimized out, ret=optimized out, af=optimized out, name=optimized out) at /usr/src/lib/libc/asr/gethostnamadr.c:125 #3 gethostbyname2 (name=optimized out, af=2) at /usr/src/lib/libc/asr/gethostnamadr.c:152 #4 0x0040ae78 in in_getaddr (s=0x7f7d6f93 -asdf, which=1) at /usr/src/sbin/ifconfig/ifconfig.c:4556 #5 0x004019b4 in setifaddr (addr=0x7f7d6f93 -asdf, param=0) at /usr/src/sbin/ifconfig/ifconfig.c:1112 #6 0x00400b01 in main (argc=1, argv=0x7f7d6d78) at /usr/src/sbin/ifconfig/ifconfig.c:738 And here a patch that fixes the problem for me. Hope this is the right place to errx(). Another thing i observed is that when calling ifconfig re0 awdawd it behaves like calling ifconfig re0 up but i have not looked into this. Tested against -current amd64 Regards, Fabian Index: ifconfig.c === RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.283 diff -u -p -r1.283 ifconfig.c --- ifconfig.c 12 May 2014 08:47:37 - 1.283 +++ ifconfig.c 5 Jun 2014 17:17:17 - @@ -4552,14 +4552,15 @@ in_getaddr(const char *s, int which) errx(1, %d: bad prefixlen, bits); in_getprefix(p, MASK); memcpy(sin-sin_addr, tsin.sin_addr, sizeof(sin-sin_addr)); - } else if (inet_aton(s, sin-sin_addr) == 0) { + } else if (inet_aton(s, sin-sin_addr) == 1) { if ((hp = gethostbyname(s))) memcpy(sin-sin_addr, hp-h_addr, hp-h_length); else if ((np = getnetbyname(s))) sin-sin_addr = inet_makeaddr(np-n_net, INADDR_ANY); else errx(1, %s: bad value, s); - } + } else + errx(1, %s: bad value, s); } /* ARGSUSED */
PATCH: ACPI_DEBUG - format fixes
Hi, the following diff fixes kernel builds with ACPI_DEBUG defined. Not sure if these are the right ones, but at least it compiles again. Cheers, Fabian Index: acpi.c === RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.257 diff -u -p -r1.257 acpi.c --- acpi.c 25 Apr 2014 14:37:06 - 1.257 +++ acpi.c 16 May 2014 22:09:26 - @@ -435,7 +435,7 @@ acpi_matchhids(struct acpi_attach_args * if (aa-aaa_dev == NULL || aa-aaa_node == NULL) return (0); if (_acpi_matchhids(aa-aaa_dev, hids)) { - dnprintf(5, driver %s matches %s\n, driver, hids); + dnprintf(5, driver %s matches %s\n, driver, (char *)hids); return (1); } return (0); @@ -1336,7 +1336,7 @@ acpi_map_pmregs(struct acpi_softc *sc) break; } if (size addr) { - dnprintf(50, mapping: %.4x %.4x %s\n, + dnprintf(50, mapping: %.4lx %.4lx %s\n, addr, size, name); /* Size and address exist; map register space */ Index: acpicpu.c === RCS file: /cvs/src/sys/dev/acpi/acpicpu.c,v retrieving revision 1.57 diff -u -p -r1.57 acpicpu.c --- acpicpu.c 21 Jul 2010 19:35:15 - 1.57 +++ acpicpu.c 16 May 2014 22:09:26 - @@ -344,7 +344,7 @@ acpicpu_attach(struct device *parent, st #ifdef ACPI_DEBUG printf(: %s: , sc-sc_devnode-name); printf(\n: hdr:%x pblk:%x,%x duty:%x,%x pstate:%x - (%d throttling states)\n, sc-sc_acpi-sc_fadt-hdr_revision, + (%ld throttling states)\n, sc-sc_acpi-sc_fadt-hdr_revision, sc-sc_pblk_addr, sc-sc_pblk_len, sc-sc_duty_off, sc-sc_duty_wid, sc-sc_acpi-sc_fadt-pstate_cnt, CPU_MAXSTATE(sc)); @@ -519,7 +519,7 @@ acpicpu_getpct(struct acpicpu_softc *sc) goto ffh; } - dnprintf(10, _PCT(ctrl) : %02x %04x %02x %02x %02x %02x %016x\n, + dnprintf(10, _PCT(ctrl) : %02x %04x %02x %02x %02x %02x %016llx\n, sc-sc_pct.pct_ctrl.grd_descriptor, sc-sc_pct.pct_ctrl.grd_length, sc-sc_pct.pct_ctrl.grd_gas.address_space_id, @@ -528,7 +528,7 @@ acpicpu_getpct(struct acpicpu_softc *sc) sc-sc_pct.pct_ctrl.grd_gas.access_size, sc-sc_pct.pct_ctrl.grd_gas.address); - dnprintf(10, _PCT(status): %02x %04x %02x %02x %02x %02x %016x\n, + dnprintf(10, _PCT(status): %02x %04x %02x %02x %02x %02x %016llx\n, sc-sc_pct.pct_status.grd_descriptor, sc-sc_pct.pct_status.grd_length, sc-sc_pct.pct_status.grd_gas.address_space_id, Index: acpiec.c === RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v retrieving revision 1.48 diff -u -p -r1.48 acpiec.c --- acpiec.c2 Jul 2013 18:37:47 - 1.48 +++ acpiec.c16 May 2014 22:09:26 - @@ -142,9 +142,10 @@ acpiec_read_data(struct acpiec_softc *sc u_int8_tval; acpiec_wait(sc, EC_STAT_OBF, EC_STAT_OBF); - dnprintf(40, acpiec: read_data\n, (int)val); val = bus_space_read_1(sc-sc_data_bt, sc-sc_data_bh, 0); + dnprintf(40, acpiec: read_data %d\n, (int)val); + return (val); } @@ -482,7 +483,7 @@ acpiec_getcrs(struct acpiec_softc *sc, s /* XXX: todo - validate _CRS checksum? */ ecdtdone: - dnprintf(10, %s: Data: 0x%x, S/C: 0x%x\n, + dnprintf(10, %s: Data: 0x%lx, S/C: 0x%lx\n, DEVNAME(sc), ec_data, ec_sc); if (ctype == GAS_SYSTEM_IOSPACE) Index: atk0110.c === RCS file: /cvs/src/sys/dev/acpi/atk0110.c,v retrieving revision 1.8 diff -u -p -r1.8 atk0110.c --- atk0110.c 21 Feb 2014 16:25:57 - 1.8 +++ atk0110.c 16 May 2014 22:09:27 - @@ -448,13 +448,13 @@ aibs_getvalue(struct aibs_softc *sc, int } if (aml_evalnode(sc-sc_acpi, n, 1, req, res)) { - dprintf(%s: %s: %i: evaluation failed\n, + dprintf(%s: %s: %lld: evaluation failed\n, DEVNAME(sc), n-name, i); aml_freevalue(res); return (-1); } if (res.type != type) { - dprintf(%s: %s: %i: not an integer: type %i\n, + dprintf(%s: %s: %lld: not an integer: type %i\n, DEVNAME(sc), n-name, i, res.type); aml_freevalue(res); return (-1); @@ -462,14 +462,14 @@ aibs_getvalue(struct aibs_softc *sc, int if (sc-sc_mode) { if (res.length sizeof(ret)) { - dprintf(%s: %s: %i: result buffer too small\n, + dprintf(%s: %s: %lld: result buffer too small\n,
PATCH: acpibat - expose capacity as sensor
Hi, i want to expose capacity (full capacity design) as a sensor like the rest. This sensor will be used in an upcoming diff to upower to expose energy-full-design and capacity properties if this patch gets merged. Both patches together will fix wrong notifications about broken batteries in KDE4. Cheers, Fabian Index: acpidev.h === RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v retrieving revision 1.33 diff -u -p -r1.33 acpidev.h --- acpidev.h 13 Jul 2012 10:37:40 - 1.33 +++ acpidev.h 17 May 2014 15:51:29 - @@ -278,7 +278,7 @@ struct acpibat_softc { struct acpibat_bst sc_bst; volatile intsc_bat_present; - struct ksensor sc_sens[8]; + struct ksensor sc_sens[9]; struct ksensordev sc_sensdev; }; Index: acpibat.c === RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v retrieving revision 1.59 diff -u -p -r1.59 acpibat.c --- acpibat.c 16 Oct 2011 11:59:21 - 1.59 +++ acpibat.c 17 May 2014 15:51:29 - @@ -163,6 +163,12 @@ acpibat_monitor(struct acpibat_softc *sc sensor_attach(sc-sc_sensdev, sc-sc_sens[7]); sc-sc_sens[7].value = sc-sc_bst.bst_voltage * 1000; + strlcpy(sc-sc_sens[8].desc, capacity, + sizeof(sc-sc_sens[8].desc)); + sc-sc_sens[8].type = type; + sensor_attach(sc-sc_sensdev, sc-sc_sens[8]); + sc-sc_sens[8].value = sc-sc_bif.bif_capacity * 1000; + sensordev_install(sc-sc_sensdev); } @@ -176,7 +182,7 @@ acpibat_refresh(void *arg) sc-sc_devnode-name); if (!sc-sc_bat_present) { - for (i = 0; i 8; i++) { + for (i = 0; i 9; i++) { sc-sc_sens[i].value = 0; sc-sc_sens[i].status = SENSOR_S_UNSPEC; sc-sc_sens[i].flags = SENSOR_FINVALID; @@ -273,6 +279,16 @@ acpibat_refresh(void *arg) sc-sc_sens[7].value = sc-sc_bst.bst_voltage * 1000; sc-sc_sens[7].status = SENSOR_S_UNSPEC; sc-sc_sens[7].flags = 0; + } + + if (sc-sc_bif.bif_capacity == BIF_UNKNOWN) { + sc-sc_sens[8].value = 0; + sc-sc_sens[8].status = SENSOR_S_UNKNOWN; + sc-sc_sens[8].flags = SENSOR_FUNKNOWN; + } else { + sc-sc_sens[8].value = sc-sc_bif.bif_capacity * 1000; + sc-sc_sens[8].status = SENSOR_S_UNSPEC; + sc-sc_sens[8].flags = 0; } acpi_record_event(sc-sc_acpi, APM_POWER_CHANGE); }
s/REGRESS_DEPENDS/TEST_DEPENDS/ in packages-specs.7
Index: infrastructure/mk/README.internals === RCS file: /cvs/ports/infrastructure/mk/README.internals,v retrieving revision 1.11 diff -u -p -r1.11 README.internals --- infrastructure/mk/README.internals 11 Feb 2014 10:34:34 - 1.11 +++ infrastructure/mk/README.internals 17 May 2014 17:43:52 - @@ -302,7 +302,7 @@ Dependency variables Old legacy dependency styles are gone, so the compat code went away. The code has to deal with BUILD_DEPENDS, LIB_DEPENDS, RUN_DEPENDS, -REGRESS_DEPENDS, WANTLIB and RUN_DEPENDS-* LIB_DEPENDS-*, WANTLIB-* +TEST_DEPENDS, WANTLIB and RUN_DEPENDS-* LIB_DEPENDS-*, WANTLIB-* There is obviously completely different treatment for WANTLIB* and *DEPENDS*. Also, BUILD* stuff gets to inherit from LIB_DEPENDS* stripped
Re: s/REGRESS_DEPENDS/TEST_DEPENDS/ in packages-specs.7
On Sat, May 17, 2014 at 07:51:25PM +0200, Fabian Raetz wrote: Index: infrastructure/mk/README.internals === RCS file: /cvs/ports/infrastructure/mk/README.internals,v retrieving revision 1.11 diff -u -p -r1.11 README.internals --- infrastructure/mk/README.internals11 Feb 2014 10:34:34 - 1.11 +++ infrastructure/mk/README.internals17 May 2014 17:43:52 - @@ -302,7 +302,7 @@ Dependency variables Old legacy dependency styles are gone, so the compat code went away. The code has to deal with BUILD_DEPENDS, LIB_DEPENDS, RUN_DEPENDS, -REGRESS_DEPENDS, WANTLIB and RUN_DEPENDS-* LIB_DEPENDS-*, WANTLIB-* +TEST_DEPENDS, WANTLIB and RUN_DEPENDS-* LIB_DEPENDS-*, WANTLIB-* There is obviously completely different treatment for WANTLIB* and *DEPENDS*. Also, BUILD* stuff gets to inherit from LIB_DEPENDS* stripped This time with correct patch. Sorry! Index: packages-specs.7 === RCS file: /cvs/src/share/man/man7/packages-specs.7,v retrieving revision 1.24 diff -u -p -r1.24 packages-specs.7 --- packages-specs.712 Oct 2012 16:17:02 - 1.24 +++ packages-specs.717 May 2014 17:46:25 - @@ -197,7 +197,7 @@ Packages may depend on other packages, a Makefile, in a .Ev BUILD_DEPENDS , .Ev LIB_DEPENDS , -.Ev REGRESS_DEPENDS +.Ev TEST_DEPENDS or .Ev RUN_DEPENDS . All those conform to
axen(4) add USB 3.0 network gigabit adapter
Hi tech@, the diff below adds support for the Sitecom USB 3.0 network adapter. Cheers, Fabian dmesg: axen0 at uhub4 port 2 configuration 1 interface 0 Sitecom Europe BV Sitecom USB 3.0 Gigabit rev 2.10/1.00 addr 3 axen0: AX88179, address 64:d1:a3:29:46:1a rgephy1 at axen0 phy 3: RTL8169S/8110S PHY, rev. 5 Index: sys/dev/usb/usbdevs === RCS file: /cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.625 diff -u -p -r1.625 usbdevs --- sys/dev/usb/usbdevs 14 Mar 2014 14:58:56 - 1.625 +++ sys/dev/usb/usbdevs 15 Mar 2014 23:10:45 - @@ -3836,6 +3836,7 @@ product SITECOMEU RTL8192CU 0x0061 RTL81 product SITECOMEU WLA5000 0x0062 WLA-5000 product SITECOMEU LN0280x061c LN-028 product SITECOMEU RTL8192CU_2 0x0070 RTL8192CU +product SITECOMEU AX88179 0x0072 AX88179 product SITECOMEU WL1130x9071 WL-113 product SITECOMEU ZD1211B 0x9075 ZD1211B product SITECOMEU WL1720x90ac WL-172 Index: sys/dev/usb/if_axen.c === RCS file: /cvs/src/sys/dev/usb/if_axen.c,v retrieving revision 1.5 diff -u -p -r1.5 if_axen.c --- sys/dev/usb/if_axen.c 20 Nov 2013 08:53:27 - 1.5 +++ sys/dev/usb/if_axen.c 15 Mar 2014 23:10:45 - @@ -79,7 +79,8 @@ const struct axen_type axen_devs[] = { #if 0 /* not tested */ { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88178A}, AX178A }, #endif - { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88179}, AX179 } + { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88179}, AX179 }, + { { USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_AX88179}, AX179 } }; #define axen_lookup(v, p) ((struct axen_type *)usb_lookup(axen_devs, v, p)) Index: share/man/man4/axen.4 === RCS file: /cvs/src/share/man/man4/axen.4,v retrieving revision 1.2 diff -u -p -r1.2 axen.4 --- share/man/man4/axen.4 7 Oct 2013 07:18:36 - 1.2 +++ share/man/man4/axen.4 15 Mar 2014 23:10:45 - @@ -35,6 +35,7 @@ including the following: .Bl -tag -width Ds -offset indent -compact .It Kurotoshiko GbE-USB3.0 .It Logitec LAN-GTJU3 +.It Sitecom USB 3.0 Network Gigabit Adapter .El .Pp The
ISY IWL 4000 Wireless Micro Adapter support for urtwn(4)
Hi, the diff below adds the ISY IWL4000 USB Wireless Micro Adapter to urtwn(4). there was a similar diff to tech@ some time ago. See http://openbsd.7691.n7.nabble.com/USB-Wireless-Micro-Adapter-IWL-4000-support-td219255.html . I took the chipset from https://wikidevi.com/wiki/ISY_IWL_4000 . Cheers, Fabian Index: if_urtwn.c === RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v retrieving revision 1.33 diff -u -p -r1.33 if_urtwn.c --- if_urtwn.c 7 Mar 2014 18:39:02 - 1.33 +++ if_urtwn.c 13 Mar 2014 20:07:52 - @@ -84,6 +84,7 @@ static const struct usb_devno urtwn_devs { USB_VENDOR_BELKIN,USB_PRODUCT_BELKIN_RTL8188CU }, { USB_VENDOR_BELKIN,USB_PRODUCT_BELKIN_RTL8188CUS }, { USB_VENDOR_BELKIN,USB_PRODUCT_BELKIN_RTL8192CU }, + { USB_VENDOR_BELKIN,USB_PRODUCT_BELKIN_RTL8192CU_1 }, { USB_VENDOR_BELKIN,USB_PRODUCT_BELKIN_RTL8192CU_2 }, { USB_VENDOR_CHICONY, USB_PRODUCT_CHICONY_RTL8188CUS_1 }, { USB_VENDOR_CHICONY, USB_PRODUCT_CHICONY_RTL8188CUS_2 }, Index: usbdevs === RCS file: /cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.624 diff -u -p -r1.624 usbdevs --- usbdevs 9 Mar 2014 05:09:39 - 1.624 +++ usbdevs 13 Mar 2014 20:07:54 - @@ -1170,6 +1170,7 @@ product BELKIN RTL8188CUS 0x11f2 RTL8188 product BELKIN F5U120 0x1203 F5U120-PC Hub product BELKIN RTL8192CU 0x2102 RTL8192CU product BELKIN F7D2102 0x2103 F7D2102 +product BELKIN RTL8192CU_1 0x21f2 RTL8192CU product BELKIN F9L1004V1 0x1004 F9L1004V1 product BELKIN ZD1211B 0x4050 ZD1211B product BELKIN F5D5055 0x5055 F5D5055 Index: usbdevs.h === RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v retrieving revision 1.636 diff -u -p -r1.636 usbdevs.h --- usbdevs.h 9 Mar 2014 05:10:52 - 1.636 +++ usbdevs.h 13 Mar 2014 20:07:56 - @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs.h,v 1.636 2014/03/09 05:10:52 brad Exp $ */ +/* $OpenBSD$ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -1177,6 +1177,7 @@ #defineUSB_PRODUCT_BELKIN_F5U120 0x1203 /* F5U120-PC Hub */ #defineUSB_PRODUCT_BELKIN_RTL8192CU0x2102 /* RTL8192CU */ #defineUSB_PRODUCT_BELKIN_F7D2102 0x2103 /* F7D2102 */ +#defineUSB_PRODUCT_BELKIN_RTL8192CU_1 0x21f2 /* RTL8192CU */ #defineUSB_PRODUCT_BELKIN_F9L1004V10x1004 /* F9L1004V1 */ #defineUSB_PRODUCT_BELKIN_ZD1211B 0x4050 /* ZD1211B */ #defineUSB_PRODUCT_BELKIN_F5D5055 0x5055 /* F5D5055 */ Index: usbdevs_data.h === RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v retrieving revision 1.630 diff -u -p -r1.630 usbdevs_data.h --- usbdevs_data.h 9 Mar 2014 05:10:53 - 1.630 +++ usbdevs_data.h 13 Mar 2014 20:07:58 - @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs_data.h,v 1.630 2014/03/09 05:10:53 brad Exp $ */ +/* $OpenBSD$ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -1552,6 +1552,10 @@ const struct usb_known_product usb_known { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F7D2102, F7D2102, + }, + { + USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_RTL8192CU_1, + RTL8192CU, }, { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F9L1004V1,
Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)
On Sun, Feb 09, 2014 at 01:51:19PM +0100, Benoit Lecocq wrote: On 02/09/14 12:30, Mark Kettenis wrote: Date: Sun, 09 Feb 2014 10:34:04 +0100 From: Benoit Lecocq b...@arcane-labs.net On 02/08/14 23:34, Mark Kettenis wrote: Hi tech@, the diff below adds support for the Intel Centrino Wireless-N 2230 card found in my Lenovo E330 to iwn(4). iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2230 rev 0xc4: msi, MIMO 2T2R, BGN, address 60:6c:66:3b:ea:39 This is the 0x0888 version. I've got most changes from https://github.com/seanbruno/freebsd-iwl/commit/53e6056c2df7355650abab77068943ac097a70c6#diff-7a5322b995ac8545b4f5d9096c3b5a5aR5445 which (i think) mostly landed in freebsd as part of http://svnweb.freebsd.org/base?view=revisionrevision=258035 This is the only iwn(4) device i have, so hopefully i did not broke another supported device. Any feedback and tests are welcome. Regards, Fabian Raetz Hi Fabian, Finally had some time to look at this. I cleaned your diff up a bit. Also noticed that the sensitivy limits didn't match the Linux driver I was looking at. Does the diff below still result in working hardware for you? Thanks, Mark Hi, With your patch the network card is detected : iwn0 at pci3 dev 0 function 0 Intel Centrino Wireless-N 2030 rev 0xc4: msi, MIMO 2T2R, BGN, address 68:5d:43:20:8b:68 But I have the following message : iwn0: fatal firmware error firmware error log: error type = UNKNOWN (0x1038) program counter = 0x0002A698 source line = 0x1014 error data = 0x1014 branch link = 0x0002A5B40002A5B4 interrupt link = 0xEC7A time= 969333536 driver status: tx ring 0: qid=0 cur=6 queued=0 tx ring 1: qid=1 cur=0 queued=0 tx ring 2: qid=2 cur=0 queued=0 tx ring 3: qid=3 cur=0 queued=0 tx ring 4: qid=4 cur=36 queued=0 tx ring 5: qid=5 cur=0 queued=0 tx ring 6: qid=6 cur=0 queued=0 tx ring 7: qid=7 cur=0 queued=0 tx ring 8: qid=8 cur=0 queued=0 tx ring 9: qid=9 cur=0 queued=0 tx ring 10: qid=10 cur=0 queued=0 tx ring 11: qid=11 cur=0 queued=0 tx ring 12: qid=12 cur=0 queued=0 tx ring 13: qid=13 cur=0 queued=0 tx ring 14: qid=14 cur=0 queued=0 tx ring 15: qid=15 cur=0 queued=0 tx ring 16: qid=16 cur=0 queued=0 tx ring 17: qid=17 cur=0 queued=0 tx ring 18: qid=18 cur=0 queued=0 tx ring 19: qid=19 cur=0 queued=0 rx ring: cur=22 802.11 state 4 I have not the same issue with the patch from Fabian. Does the interface work despite this message? Does the following diff work better? Yes the interface work despite the message. Same messages with the new diff : iwn0: fatal firmware error firmware error log: error type = UNKNOWN (0x1967) program counter = 0x99C4 source line = 0x009F error data = 0x00FF0013 branch link = 0x99BA99BA interrupt link = 0xEC7A time= 254992438 driver status: tx ring 0: qid=0 cur=70 queued=0 tx ring 1: qid=1 cur=0 queued=0 tx ring 2: qid=2 cur=0 queued=0 tx ring 3: qid=3 cur=0 queued=0 tx ring 4: qid=4 cur=36 queued=0 tx ring 5: qid=5 cur=0 queued=0 tx ring 6: qid=6 cur=0 queued=0 tx ring 7: qid=7 cur=0 queued=0 tx ring 8: qid=8 cur=0 queued=0 tx ring 9: qid=9 cur=0 queued=0 tx ring 10: qid=10 cur=0 queued=0 tx ring 11: qid=11 cur=0 queued=0 tx ring 12: qid=12 cur=0 queued=0 tx ring 13: qid=13 cur=0 queued=0 tx ring 14: qid=14 cur=0 queued=0 tx ring 15: qid=15 cur=0 queued=0 tx ring 16: qid=16 cur=0 queued=0 tx ring 17: qid=17 cur=0 queued=0 tx ring 18: qid=18 cur=0 queued=0 tx ring 19: qid=19 cur=0 queued=0 rx ring: cur=22 802.11 state 4 Hi, i'm seeing the firmware error too with both of your diffs and i'm pretty sure i fixed this firmware error in my last diff send to this thread by handling IWN_FW_TLV_SENS and IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv() Except the firmware error, the card is working fine. Regards, Fabian
Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)
Hmm, my cleanup was based on the version you send out on December 31st. Can you send me the latest version of your diff? On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote: On 03/01/14(Fri) 14:24, Fabian Raetz wrote: Hi tech@, here is an updated patch. it seems like Intel Centrino Wireless-N 2030 and Intel Centrino Wireless-N 2230 have the same pciids... this makes patch apply again with newest pcidevs changes. Please also make sure to use tab and not space when appropriate ;) You can check style(9) if in doubt ! ups :) attached is a diff - which follows style(9) (hopefully) and - fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv(). @mike, only style changes since the last patch i send you. Regards, Fabian Index: if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.127 diff -u -p -r1.127 if_iwn.c --- if_iwn.c6 Dec 2013 21:03:04 - 1.127 +++ if_iwn.c7 Jan 2014 20:51:38 - @@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_1 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_2 }, }; intiwn_match(struct device *, void *, void *); @@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn intiwn5000_send_wimax_coex(struct iwn_softc *); intiwn5000_crystal_calib(struct iwn_softc *); intiwn5000_temp_offset_calib(struct iwn_softc *); +intiwn5000_temp_offset_calibv2(struct iwn_softc *); intiwn4965_post_alive(struct iwn_softc *); intiwn5000_post_alive(struct iwn_softc *); intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, @@ -605,6 +608,8 @@ iwn5000_attach(struct iwn_softc *sc, pci sc-fw_data_maxsz = IWN5000_FW_DATA_MAXSZ; sc-fwsz = IWN5000_FWSZ; sc-sched_txfact_addr = IWN5000_SCHED_TXFACT; + sc-reset_noise_gain = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; + sc-noise_gain = IWN5000_PHY_CALIB_NOISE_GAIN; switch (sc-hw_type) { case IWN_HW_REV_TYPE_5100: @@ -651,6 +656,11 @@ iwn5000_attach(struct iwn_softc *sc, pci } else sc-fwname = iwn-6005; break; + case IWN_HW_REV_TYPE_2030: + sc-limits = iwn2030_sensitivity_limits; + sc-fwname = iwn-2030; + sc-sc_flags |= IWN_FLAG_ADV_BT_COEX; + break; default: printf(: adapter type %d not supported\n, sc-hw_type); return ENOTSUP; @@ -1529,6 +1539,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc hdr.version, hdr.pa_type, letoh16(hdr.volt))); sc-calib_ver = hdr.version; + if (sc-hw_type == IWN_HW_REV_TYPE_2030) { + sc-eeprom_voltage = letoh16(hdr.volt); + iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); + sc-eeprom_temp_high = letoh16(val); + iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2); + sc-eeprom_temp = letoh16(val); + } + if (sc-hw_type == IWN_HW_REV_TYPE_5150) { /* Compute temperature offset. */ iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); @@ -2095,7 +2113,8 @@ iwn5000_rx_calib_results(struct iwn_soft switch (calib-code) { case IWN5000_PHY_CALIB_DC: - if (sc-hw_type == IWN_HW_REV_TYPE_5150) + if (sc-hw_type == IWN_HW_REV_TYPE_5150 || + sc-hw_type == IWN_HW_REV_TYPE_2030) idx = 0; break; case IWN5000_PHY_CALIB_LO: @@ -3822,7 +3841,7 @@ iwn5000_init_gains(struct iwn_softc *sc) struct iwn_phy_calib cmd; memset(cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; + cmd.code = sc-reset_noise_gain; cmd.ngroups = 1; cmd.isvalid = 1; DPRINTF((setting initial differential gains\n)); @@ -3872,7 +3891,7 @@ iwn5000_set_gains(struct iwn_softc *sc) div = (sc-hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30; memset(cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_NOISE_GAIN; + cmd.code = sc-noise_gain; cmd.ngroups = 1; cmd.isvalid = 1; /* Get first available RX antenna as referential. */ @@ -4161,28 +4180,51 @@ iwn_send_advanced_btcoex(struct iwn_soft 0xc0004000, 0x4000, 0xf0005000, 0xf0005000, }; struct iwn6000_btcoex_config btconfig; + struct iwn2000_btcoex_config btconfig2k; struct iwn_btcoex_priotable btprio; struct iwn_btcoex_prot btprot
Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)
On Sun, Feb 09, 2014 at 10:40:57AM -0500, Brad Smith wrote: On Sun, Feb 09, 2014 at 02:23:18PM +0100, Fabian Raetz wrote: Hmm, my cleanup was based on the version you send out on December 31st. Can you send me the latest version of your diff? On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote: On 03/01/14(Fri) 14:24, Fabian Raetz wrote: Hi tech@, here is an updated patch. it seems like Intel Centrino Wireless-N 2030 and Intel Centrino Wireless-N 2230 have the same pciids... this makes patch apply again with newest pcidevs changes. Please also make sure to use tab and not space when appropriate ;) You can check style(9) if in doubt ! ups :) attached is a diff - which follows style(9) (hopefully) and - fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv(). @mike, only style changes since the last patch i send you. Regards, Fabian Post the diff again but remove the pcidevs change. Index: if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.127 diff -u -p -r1.127 if_iwn.c --- if_iwn.c6 Dec 2013 21:03:04 - 1.127 +++ if_iwn.c9 Feb 2014 16:41:10 - @@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_1 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2030_2 }, }; intiwn_match(struct device *, void *, void *); @@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn intiwn5000_send_wimax_coex(struct iwn_softc *); intiwn5000_crystal_calib(struct iwn_softc *); intiwn5000_temp_offset_calib(struct iwn_softc *); +intiwn5000_temp_offset_calibv2(struct iwn_softc *); intiwn4965_post_alive(struct iwn_softc *); intiwn5000_post_alive(struct iwn_softc *); intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, @@ -605,6 +608,8 @@ iwn5000_attach(struct iwn_softc *sc, pci sc-fw_data_maxsz = IWN5000_FW_DATA_MAXSZ; sc-fwsz = IWN5000_FWSZ; sc-sched_txfact_addr = IWN5000_SCHED_TXFACT; + sc-reset_noise_gain = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; + sc-noise_gain = IWN5000_PHY_CALIB_NOISE_GAIN; switch (sc-hw_type) { case IWN_HW_REV_TYPE_5100: @@ -651,6 +656,11 @@ iwn5000_attach(struct iwn_softc *sc, pci } else sc-fwname = iwn-6005; break; + case IWN_HW_REV_TYPE_2030: + sc-limits = iwn2030_sensitivity_limits; + sc-fwname = iwn-2030; + sc-sc_flags |= IWN_FLAG_ADV_BT_COEX; + break; default: printf(: adapter type %d not supported\n, sc-hw_type); return ENOTSUP; @@ -1529,6 +1539,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc hdr.version, hdr.pa_type, letoh16(hdr.volt))); sc-calib_ver = hdr.version; + if (sc-hw_type == IWN_HW_REV_TYPE_2030) { + sc-eeprom_voltage = letoh16(hdr.volt); + iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); + sc-eeprom_temp_high = letoh16(val); + iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2); + sc-eeprom_temp = letoh16(val); + } + if (sc-hw_type == IWN_HW_REV_TYPE_5150) { /* Compute temperature offset. */ iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); @@ -2095,7 +2113,8 @@ iwn5000_rx_calib_results(struct iwn_soft switch (calib-code) { case IWN5000_PHY_CALIB_DC: - if (sc-hw_type == IWN_HW_REV_TYPE_5150) + if (sc-hw_type == IWN_HW_REV_TYPE_5150 || + sc-hw_type == IWN_HW_REV_TYPE_2030) idx = 0; break; case IWN5000_PHY_CALIB_LO: @@ -3822,7 +3841,7 @@ iwn5000_init_gains(struct iwn_softc *sc) struct iwn_phy_calib cmd; memset(cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; + cmd.code = sc-reset_noise_gain; cmd.ngroups = 1; cmd.isvalid = 1; DPRINTF((setting initial differential gains\n)); @@ -3872,7 +3891,7 @@ iwn5000_set_gains(struct iwn_softc *sc) div = (sc-hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30; memset(cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_NOISE_GAIN; + cmd.code = sc-noise_gain; cmd.ngroups = 1; cmd.isvalid = 1; /* Get first available RX antenna as referential. */ @@ -4161,28 +4180,51 @@ iwn_send_advanced_btcoex(struct iwn_soft
Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)
On Sun, Feb 09, 2014 at 09:32:15PM +0100, Mark Kettenis wrote: Date: Sun, 9 Feb 2014 14:23:18 +0100 From: Fabian Raetz fabian.ra...@gmail.com Hmm, my cleanup was based on the version you send out on December 31st. Can you send me the latest version of your diff? On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote: On 03/01/14(Fri) 14:24, Fabian Raetz wrote: Hi tech@, here is an updated patch. it seems like Intel Centrino Wireless-N 2030 and Intel Centrino Wireless-N 2230 have the same pciids... this makes patch apply again with newest pcidevs changes. Please also make sure to use tab and not space when appropriate ;) You can check style(9) if in doubt ! ups :) attached is a diff - which follows style(9) (hopefully) and - fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv(). @mike, only style changes since the last patch i send you. Thanks. I incorporated the changes in my cleaned up version. The change does affect other hardware types now, but I've tested this on a couple of systems: iwn0 at pci3 dev 0 function 0 Intel WiFi Link 5300 rev 0x00: msi, MIMO 3T3R, MoW iwn0 at pci3 dev 0 function 0 Intel Centrino Ultimate-N 6300 rev 0x35: msi, MIMO 3T3R, MoW iwn0 at pci2 dev 0 function 0 Intel Centrino Advanced-N 6205 rev 0x34: msi, MIMO 2T2R, MoW So if this one works for you and Benoit, I'll go ahead and commit this. works for me too. Thanks! iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2030 rev 0xc4: msi, MIMO 2T2R, BGN
Re: ibss and hostap support for urtwn(4)
Hi, i'm interested in testing your diff, but i will not get to testing until saturday. Regards, Fabian
Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)
On Tue, Jan 07, 2014 at 12:08:02PM +0100, Martin Pieuchot wrote: On 03/01/14(Fri) 14:24, Fabian Raetz wrote: Hi tech@, here is an updated patch. it seems like Intel Centrino Wireless-N 2030 and Intel Centrino Wireless-N 2230 have the same pciids... this makes patch apply again with newest pcidevs changes. Please also make sure to use tab and not space when appropriate ;) You can check style(9) if in doubt ! ups :) attached is a diff - which follows style(9) (hopefully) and - fixes a firmware error by handling IWN_FW_TLV_ENH_SENS and IWN_FW_TLV_PHY_CALIB in iwn_read_firmware_tlv(). @mike, only style changes since the last patch i send you. Regards, Fabian Index: if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.127 diff -u -p -r1.127 if_iwn.c --- if_iwn.c6 Dec 2013 21:03:04 - 1.127 +++ if_iwn.c7 Jan 2014 20:51:38 - @@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_1 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_2 }, }; intiwn_match(struct device *, void *, void *); @@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn intiwn5000_send_wimax_coex(struct iwn_softc *); intiwn5000_crystal_calib(struct iwn_softc *); intiwn5000_temp_offset_calib(struct iwn_softc *); +intiwn5000_temp_offset_calibv2(struct iwn_softc *); intiwn4965_post_alive(struct iwn_softc *); intiwn5000_post_alive(struct iwn_softc *); intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, @@ -605,6 +608,8 @@ iwn5000_attach(struct iwn_softc *sc, pci sc-fw_data_maxsz = IWN5000_FW_DATA_MAXSZ; sc-fwsz = IWN5000_FWSZ; sc-sched_txfact_addr = IWN5000_SCHED_TXFACT; + sc-reset_noise_gain = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; + sc-noise_gain = IWN5000_PHY_CALIB_NOISE_GAIN; switch (sc-hw_type) { case IWN_HW_REV_TYPE_5100: @@ -651,6 +656,11 @@ iwn5000_attach(struct iwn_softc *sc, pci } else sc-fwname = iwn-6005; break; + case IWN_HW_REV_TYPE_2030: + sc-limits = iwn2030_sensitivity_limits; + sc-fwname = iwn-2030; + sc-sc_flags |= IWN_FLAG_ADV_BT_COEX; + break; default: printf(: adapter type %d not supported\n, sc-hw_type); return ENOTSUP; @@ -1529,6 +1539,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc hdr.version, hdr.pa_type, letoh16(hdr.volt))); sc-calib_ver = hdr.version; + if (sc-hw_type == IWN_HW_REV_TYPE_2030) { + sc-eeprom_voltage = letoh16(hdr.volt); + iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); + sc-eeprom_temp_high = letoh16(val); + iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2); + sc-eeprom_temp = letoh16(val); + } + if (sc-hw_type == IWN_HW_REV_TYPE_5150) { /* Compute temperature offset. */ iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); @@ -2095,7 +2113,8 @@ iwn5000_rx_calib_results(struct iwn_soft switch (calib-code) { case IWN5000_PHY_CALIB_DC: - if (sc-hw_type == IWN_HW_REV_TYPE_5150) + if (sc-hw_type == IWN_HW_REV_TYPE_5150 || + sc-hw_type == IWN_HW_REV_TYPE_2030) idx = 0; break; case IWN5000_PHY_CALIB_LO: @@ -3822,7 +3841,7 @@ iwn5000_init_gains(struct iwn_softc *sc) struct iwn_phy_calib cmd; memset(cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; + cmd.code = sc-reset_noise_gain; cmd.ngroups = 1; cmd.isvalid = 1; DPRINTF((setting initial differential gains\n)); @@ -3872,7 +3891,7 @@ iwn5000_set_gains(struct iwn_softc *sc) div = (sc-hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30; memset(cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_NOISE_GAIN; + cmd.code = sc-noise_gain; cmd.ngroups = 1; cmd.isvalid = 1; /* Get first available RX antenna as referential. */ @@ -4161,28 +4180,51 @@ iwn_send_advanced_btcoex(struct iwn_soft 0xc0004000, 0x4000, 0xf0005000, 0xf0005000, }; struct iwn6000_btcoex_config btconfig; + struct iwn2000_btcoex_config btconfig2k; struct iwn_btcoex_priotable btprio; struct iwn_btcoex_prot btprot; int error, i; memset(btconfig, 0, sizeof btconfig); - btconfig.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION
Re: Add Intel Centrino Wireless-N 2230 support in iwn(4)
Hi tech@, here is an updated patch. it seems like Intel Centrino Wireless-N 2030 and Intel Centrino Wireless-N 2230 have the same pciids... this makes patch apply again with newest pcidevs changes. Index: if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.127 diff -u -p -r1.127 if_iwn.c --- if_iwn.c6 Dec 2013 21:03:04 - 1.127 +++ if_iwn.c3 Jan 2014 13:18:54 - @@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_1 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_2 }, }; intiwn_match(struct device *, void *, void *); @@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn intiwn5000_send_wimax_coex(struct iwn_softc *); intiwn5000_crystal_calib(struct iwn_softc *); intiwn5000_temp_offset_calib(struct iwn_softc *); +intiwn5000_temp_offset_calibv2(struct iwn_softc *); intiwn4965_post_alive(struct iwn_softc *); intiwn5000_post_alive(struct iwn_softc *); intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, @@ -651,6 +654,11 @@ iwn5000_attach(struct iwn_softc *sc, pci } else sc-fwname = iwn-6005; break; + case IWN_HW_REV_TYPE_2030: + sc-limits = iwn2030_sensitivity_limits; + sc-fwname = iwn-2030; +sc-sc_flags |= IWN_FLAG_ADV_BT_COEX; +break; default: printf(: adapter type %d not supported\n, sc-hw_type); return ENOTSUP; @@ -1529,6 +1537,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc hdr.version, hdr.pa_type, letoh16(hdr.volt))); sc-calib_ver = hdr.version; + if (sc-hw_type == IWN_HW_REV_TYPE_2030) { +sc-eeprom_voltage = letoh16(hdr.volt); +iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); +sc-eeprom_temp_high = letoh16(val); +iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2); +sc-eeprom_temp = letoh16(val); +} + if (sc-hw_type == IWN_HW_REV_TYPE_5150) { /* Compute temperature offset. */ iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); @@ -2095,7 +2111,8 @@ iwn5000_rx_calib_results(struct iwn_soft switch (calib-code) { case IWN5000_PHY_CALIB_DC: - if (sc-hw_type == IWN_HW_REV_TYPE_5150) + if (sc-hw_type == IWN_HW_REV_TYPE_5150 || +sc-hw_type == IWN_HW_REV_TYPE_2030) idx = 0; break; case IWN5000_PHY_CALIB_LO: @@ -4161,28 +4178,51 @@ iwn_send_advanced_btcoex(struct iwn_soft 0xc0004000, 0x4000, 0xf0005000, 0xf0005000, }; struct iwn6000_btcoex_config btconfig; +struct iwn2000_btcoex_config btconfig2k; struct iwn_btcoex_priotable btprio; struct iwn_btcoex_prot btprot; int error, i; memset(btconfig, 0, sizeof btconfig); - btconfig.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION | - (IWN_BT_FLAG_COEX6000_MODE_3W IWN_BT_FLAG_COEX6000_MODE_SHIFT) | - IWN_BT_FLAG_SYNC_2_BT_DISABLE; - btconfig.max_kill = 5; - btconfig.bt3_t7_timer = 1; - btconfig.kill_ack = htole32(0x); - btconfig.kill_cts = htole32(0x); - btconfig.sample_time = 2; - btconfig.bt3_t2_timer = 0xc; - for (i = 0; i 12; i++) - btconfig.lookup_table[i] = htole32(btcoex_3wire[i]); - btconfig.valid = htole16(0xff); - btconfig.prio_boost = 0xf0; - DPRINTF((configuring advanced bluetooth coexistence\n)); - error = iwn_cmd(sc, IWN_CMD_BT_COEX, btconfig, sizeof(btconfig), 1); - if (error != 0) - return (error); +memset(btconfig2k, 0, sizeof btconfig2k); + +if (sc-hw_type == IWN_HW_REV_TYPE_2030) { +btconfig2k.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION | +(IWN_BT_FLAG_COEX6000_MODE_3W IWN_BT_FLAG_COEX6000_MODE_SHIFT) | +IWN_BT_FLAG_SYNC_2_BT_DISABLE; +btconfig2k.max_kill = 5; +btconfig2k.bt3_t7_timer = 1; +btconfig2k.kill_ack = htole32(0x); +btconfig2k.kill_cts = htole32(0x); +btconfig2k.sample_time = 2; +btconfig2k.bt3_t2_timer = 0xc; +for (i = 0; i 12; i++) +btconfig2k.lookup_table[i] = htole32(btcoex_3wire[i]); +btconfig2k.valid = htole16(0xff); +btconfig2k.prio_boost = htole32(0xf0); +DPRINTF((configuring advanced bluetooth coexistence\n)); +error = iwn_cmd(sc, IWN_CMD_BT_COEX, btconfig2k, sizeof(btconfig2k), 1); +if (error
Add Intel Centrino Wireless-N 2230 support in iwn(4)
Hi tech@, the diff below adds support for the Intel Centrino Wireless-N 2230 card found in my Lenovo E330 to iwn(4). iwn0 at pci2 dev 0 function 0 Intel Centrino Wireless-N 2230 rev 0xc4: msi, MIMO 2T2R, BGN, address 60:6c:66:3b:ea:39 This is the 0x0888 version. I've got most changes from https://github.com/seanbruno/freebsd-iwl/commit/53e6056c2df7355650abab77068943ac097a70c6#diff-7a5322b995ac8545b4f5d9096c3b5a5aR5445 which (i think) mostly landed in freebsd as part of http://svnweb.freebsd.org/base?view=revisionrevision=258035 This is the only iwn(4) device i have, so hopefully i did not broke another supported device. Any feedback and tests are welcome. Regards, Fabian Raetz Index: if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.127 diff -u -p -r1.127 if_iwn.c --- if_iwn.c6 Dec 2013 21:03:04 - 1.127 +++ if_iwn.c30 Dec 2013 17:48:59 - @@ -94,6 +94,8 @@ static const struct pci_matchid iwn_devi { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_130_2 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_1 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_6235_2 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_1 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_2x30_2 }, }; intiwn_match(struct device *, void *, void *); @@ -244,6 +246,7 @@ int iwn5000_send_calibration(struct iwn intiwn5000_send_wimax_coex(struct iwn_softc *); intiwn5000_crystal_calib(struct iwn_softc *); intiwn5000_temp_offset_calib(struct iwn_softc *); +intiwn5000_temp_offset_calibv2(struct iwn_softc *); intiwn4965_post_alive(struct iwn_softc *); intiwn5000_post_alive(struct iwn_softc *); intiwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, @@ -651,6 +654,11 @@ iwn5000_attach(struct iwn_softc *sc, pci } else sc-fwname = iwn-6005; break; + case IWN_HW_REV_TYPE_2030: + sc-limits = iwn2030_sensitivity_limits; + sc-fwname = iwn-2030; +sc-sc_flags |= IWN_FLAG_ADV_BT_COEX; +break; default: printf(: adapter type %d not supported\n, sc-hw_type); return ENOTSUP; @@ -1529,6 +1537,14 @@ iwn5000_read_eeprom(struct iwn_softc *sc hdr.version, hdr.pa_type, letoh16(hdr.volt))); sc-calib_ver = hdr.version; + if (sc-hw_type == IWN_HW_REV_TYPE_2030) { +sc-eeprom_voltage = letoh16(hdr.volt); +iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); +sc-eeprom_temp_high = letoh16(val); +iwn_read_prom_data(sc, base + IWN5000_EEPROM_VOLT, val, 2); +sc-eeprom_temp = letoh16(val); +} + if (sc-hw_type == IWN_HW_REV_TYPE_5150) { /* Compute temperature offset. */ iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, val, 2); @@ -2095,7 +2111,8 @@ iwn5000_rx_calib_results(struct iwn_soft switch (calib-code) { case IWN5000_PHY_CALIB_DC: - if (sc-hw_type == IWN_HW_REV_TYPE_5150) + if (sc-hw_type == IWN_HW_REV_TYPE_5150 || +sc-hw_type == IWN_HW_REV_TYPE_2030) idx = 0; break; case IWN5000_PHY_CALIB_LO: @@ -4161,28 +4178,51 @@ iwn_send_advanced_btcoex(struct iwn_soft 0xc0004000, 0x4000, 0xf0005000, 0xf0005000, }; struct iwn6000_btcoex_config btconfig; +struct iwn2000_btcoex_config btconfig2k; struct iwn_btcoex_priotable btprio; struct iwn_btcoex_prot btprot; int error, i; memset(btconfig, 0, sizeof btconfig); - btconfig.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION | - (IWN_BT_FLAG_COEX6000_MODE_3W IWN_BT_FLAG_COEX6000_MODE_SHIFT) | - IWN_BT_FLAG_SYNC_2_BT_DISABLE; - btconfig.max_kill = 5; - btconfig.bt3_t7_timer = 1; - btconfig.kill_ack = htole32(0x); - btconfig.kill_cts = htole32(0x); - btconfig.sample_time = 2; - btconfig.bt3_t2_timer = 0xc; - for (i = 0; i 12; i++) - btconfig.lookup_table[i] = htole32(btcoex_3wire[i]); - btconfig.valid = htole16(0xff); - btconfig.prio_boost = 0xf0; - DPRINTF((configuring advanced bluetooth coexistence\n)); - error = iwn_cmd(sc, IWN_CMD_BT_COEX, btconfig, sizeof(btconfig), 1); - if (error != 0) - return (error); +memset(btconfig2k, 0, sizeof btconfig2k); + +if (sc-hw_type == IWN_HW_REV_TYPE_2030) { +btconfig2k.flags = IWN_BT_FLAG_COEX6000_CHAN_INHIBITION | +(IWN_BT_FLAG_COEX6000_MODE_3W IWN_BT_FLAG_COEX6000_MODE_SHIFT) | +IWN_BT_FLAG_SYNC_2_BT_DISABLE; +btconfig2k.max_kill = 5; +btconfig2k.bt3_t7_timer = 1; +btconfig2k.kill_ack = htole32