Re: make net80211_input be nice to soekris
On Thu, Jul 12, 2012 at 05:51:32PM +0200, Stefan Sperling wrote: Running ifconfig ral0 debug down up can leave slow systems, such as edd@'s soekris, with an unusable wireless interface until reboot. The net80211 layer will run a scan when the interface comes up. The scan hops from channel to channel every 200msec. This hopping is controlled via a timeout that runs at IPL_SOFTCLOCK. When the scan reaches the last channel it terminates. The problem with soekris is that, in noisy environments, they take so much time printing debug messsages about received frames from ieee80211_input() to the serial console that another RX interrupt will run next at IPL_NET. This prevents the scan from running its 200msc timeout handler at IPL_SOFTCLOCK, and the scan never finishes. With the diff below, we print the message from a work queue at IPL_TTY instead (idea from guenther@). This allows the soekris to finish the scan. The box is still hardly responsive during the scan but at least concurrent SSH sessions remain somewhat responsive and eventually the soekris recovers completely. Improved diff after clue-stick from blambert about how work queues and IPLs really interact. Index: ieee80211_input.c === RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.119 diff -u -p -r1.119 ieee80211_input.c --- ieee80211_input.c 5 Apr 2011 11:48:28 - 1.119 +++ ieee80211_input.c 13 Jul 2012 08:37:13 - @@ -42,6 +42,7 @@ #include sys/errno.h #include sys/proc.h #include sys/sysctl.h +#include sys/workq.h #include net/if.h #include net/if_dl.h @@ -131,6 +132,9 @@ voidieee80211_recv_bar(struct ieee80211 void ieee80211_bar_tid(struct ieee80211com *, struct ieee80211_node *, u_int8_t, u_int16_t); #endif +void ieee80211_input_print(struct ieee80211com *, struct ifnet *, + struct ieee80211_frame *, struct ieee80211_rxinfo *); +void ieee80211_input_print_task(void *, void *); /* * Retrieve the length in bytes of an 802.11 header. @@ -152,6 +156,69 @@ ieee80211_get_hdrlen(const struct ieee80 return size; } +/* Work queue task that prints a received frame. Avoids printf() from + * interrupt context at IPL_NET making slow machines unusable when many + * frames are received and the interface is put in debug mode. */ +void +ieee80211_input_print_task(void *arg1, void *arg2) +{ + char *msg = arg1; + int s; + + s = spltty(); + printf(msg); + splx(s); + free(msg, M_DEVBUF); + +} + +void +ieee80211_input_print(struct ieee80211com *ic, struct ifnet *ifp, +struct ieee80211_frame *wh, struct ieee80211_rxinfo *rxi) +{ + int doprint, error; + char *msg; + u_int8_t subtype = wh-i_fc[0] IEEE80211_FC0_SUBTYPE_MASK; + + /* avoid to print too many frames */ + doprint = 0; + switch (subtype) { + case IEEE80211_FC0_SUBTYPE_BEACON: + if (ic-ic_state == IEEE80211_S_SCAN) + doprint = 1; + break; +#ifndef IEEE80211_STA_ONLY + case IEEE80211_FC0_SUBTYPE_PROBE_REQ: + if (ic-ic_opmode == IEEE80211_M_IBSS) + doprint = 1; + break; +#endif + default: + doprint = 1; + break; + } +#ifdef IEEE80211_DEBUG + doprint += ieee80211_debug; +#endif + if (!doprint) + return; + + msg = malloc(1024, M_DEVBUF, M_NOWAIT); + if (msg == NULL) + return; + + snprintf(msg, 1024, %s: received %s from %s rssi %d mode %s\n, + ifp-if_xname, + ieee80211_mgt_subtype_name[subtype IEEE80211_FC0_SUBTYPE_SHIFT], + ether_sprintf(wh-i_addr2), rxi-rxi_rssi, + ieee80211_phymode_name[ieee80211_chan2mode( + ic, ic-ic_bss-ni_chan)]); + + error = workq_add_task(NULL, 0, ieee80211_input_print_task, msg, NULL); + if (error) + free(msg, M_DEVBUF); +} + /* * Process a received frame. The node associated with the sender * should be supplied. If nothing was found in the node table then @@ -467,37 +534,8 @@ ieee80211_input(struct ifnet *ifp, struc goto out; } - if (ifp-if_flags IFF_DEBUG) { - /* avoid to print too many frames */ - int doprint = 0; - - switch (subtype) { - case IEEE80211_FC0_SUBTYPE_BEACON: - if (ic-ic_state == IEEE80211_S_SCAN) - doprint = 1; - break; -#ifndef IEEE80211_STA_ONLY - case IEEE80211_FC0_SUBTYPE_PROBE_REQ: - if (ic-ic_opmode == IEEE80211_M_IBSS) - doprint = 1; - break; -#endif
Re: make net80211_input be nice to soekris
Date: Fri, 13 Jul 2012 10:42:02 +0200 From: Stefan Sperling s...@openbsd.org On Thu, Jul 12, 2012 at 05:51:32PM +0200, Stefan Sperling wrote: Running ifconfig ral0 debug down up can leave slow systems, such as edd@'s soekris, with an unusable wireless interface until reboot. The net80211 layer will run a scan when the interface comes up. The scan hops from channel to channel every 200msec. This hopping is controlled via a timeout that runs at IPL_SOFTCLOCK. When the scan reaches the last channel it terminates. The problem with soekris is that, in noisy environments, they take so much time printing debug messsages about received frames from ieee80211_input() to the serial console that another RX interrupt will run next at IPL_NET. This prevents the scan from running its 200msc timeout handler at IPL_SOFTCLOCK, and the scan never finishes. With the diff below, we print the message from a work queue at IPL_TTY instead (idea from guenther@). This allows the soekris to finish the scan. The box is still hardly responsive during the scan but at least concurrent SSH sessions remain somewhat responsive and eventually the soekris recovers completely. Improved diff after clue-stick from blambert about how work queues and IPLs really interact. But doing the printf from spltty() doesn't make an awful lot of sense. We already protect printf(9) by a mutex at IPL_HIGH. Also... Index: ieee80211_input.c === RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.119 diff -u -p -r1.119 ieee80211_input.c --- ieee80211_input.c 5 Apr 2011 11:48:28 - 1.119 +++ ieee80211_input.c 13 Jul 2012 08:37:13 - @@ -42,6 +42,7 @@ #include sys/errno.h #include sys/proc.h #include sys/sysctl.h +#include sys/workq.h #include net/if.h #include net/if_dl.h @@ -131,6 +132,9 @@ void ieee80211_recv_bar(struct ieee80211 void ieee80211_bar_tid(struct ieee80211com *, struct ieee80211_node *, u_int8_t, u_int16_t); #endif +void ieee80211_input_print(struct ieee80211com *, struct ifnet *, + struct ieee80211_frame *, struct ieee80211_rxinfo *); +void ieee80211_input_print_task(void *, void *); /* * Retrieve the length in bytes of an 802.11 header. @@ -152,6 +156,69 @@ ieee80211_get_hdrlen(const struct ieee80 return size; } +/* Work queue task that prints a received frame. Avoids printf() from + * interrupt context at IPL_NET making slow machines unusable when many + * frames are received and the interface is put in debug mode. */ ...this comment isn't properly formatted: see style(9).
improve hostap in noisy environments
We've got lots of RF noise in the g2k12 hackroom. Edd's soekris sometimes failed to allow new nodes to associate and we found that this was due to ieee80211_node_alloc_helper() failing to add a new node to the cache. 'netstat -W ral0' showed the 'input packets dropped' counter, which corresponds to ic-ic_stats.is_rx_nodealloc, was increasing well beyond 2000 and rising. The diff below fixes this by tweaking cache eviction rules used when the node cache is full. It additionally kicks off new nodes in AUTH state which weren't active during the last chache wait interval (currently 5 seconds). Without this diff such nodes can occupy cache slots for an entire cache timeout interval (5 minutes), preventing legitimate users from associating. With this diff the soekris hasn't reported a single 'dropped' input packet yet within a couple of hours. # netstat -W ral0 | grep drop 0 input packets dropped ok? Index: ieee80211_node.c === RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v retrieving revision 1.68 diff -u -p -r1.68 ieee80211_node.c --- ieee80211_node.c25 Jan 2012 17:04:02 - 1.68 +++ ieee80211_node.c13 Jul 2012 07:23:34 - @@ -1141,8 +1141,8 @@ ieee80211_free_allnodes(struct ieee80211 * Else, this function is called because a new node must be allocated but the * node cache is full. In this case, return as soon as a free slot was made * available. If acting as hostap, clean cached nodes regardless of their - * recent activity and also allow de-authing inactive authenticated or - * associated nodes. + * recent activity and also allow de-authing of authenticated nodes older + * than one cache wait interval, and de-authing of inactive associated nodes. */ void ieee80211_clean_nodes(struct ieee80211com *ic, int cache_timeout) @@ -1172,7 +1172,15 @@ ieee80211_clean_nodes(struct ieee80211co ni-ni_inact IEEE80211_INACT_MAX)) continue; } else { - if (ni-ni_state != IEEE80211_STA_COLLECT + if (ic-ic_opmode == IEEE80211_M_HOSTAP + ((ni-ni_state == IEEE80211_STA_ASSOC + ni-ni_inact IEEE80211_INACT_MAX) || + (ni-ni_state == IEEE80211_STA_AUTH +ni-ni_inact == 0))) + continue; + + if (ic-ic_opmode == IEEE80211_M_IBSS + ni-ni_state != IEEE80211_STA_COLLECT ni-ni_state != IEEE80211_STA_CACHE ni-ni_inact IEEE80211_INACT_MAX) continue;
Re: make net80211_input be nice to soekris
+ printf(msg); This really should be printf(%s, msg); To avoid format string problems. Yes, you say you are completely in control of the string however someone could reuse this workq handler for some other purpose later.
Re: make net80211_input be nice to soekris
On Fri, Jul 13, 2012 at 03:16:27AM -0600, Theo de Raadt wrote: + printf(msg); This really should be printf(%s, msg); To avoid format string problems. Yes, you say you are completely in control of the string however someone could reuse this workq handler for some other purpose later. Agreed, thanks. New diff below, also includes a grammar fix in a comment from blambert (avoid to print - avoid printing) Index: ieee80211_input.c === RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.119 diff -u -p -r1.119 ieee80211_input.c --- ieee80211_input.c 5 Apr 2011 11:48:28 - 1.119 +++ ieee80211_input.c 13 Jul 2012 09:20:03 - @@ -42,6 +42,7 @@ #include sys/errno.h #include sys/proc.h #include sys/sysctl.h +#include sys/workq.h #include net/if.h #include net/if_dl.h @@ -131,6 +132,9 @@ voidieee80211_recv_bar(struct ieee80211 void ieee80211_bar_tid(struct ieee80211com *, struct ieee80211_node *, u_int8_t, u_int16_t); #endif +void ieee80211_input_print(struct ieee80211com *, struct ifnet *, + struct ieee80211_frame *, struct ieee80211_rxinfo *); +void ieee80211_input_print_task(void *, void *); /* * Retrieve the length in bytes of an 802.11 header. @@ -152,6 +156,68 @@ ieee80211_get_hdrlen(const struct ieee80 return size; } +/* + * Work queue task that prints a received frame. Avoids printf() from + * interrupt context at IPL_NET making slow machines unusable when many + * frames are received and the interface is put in debug mode. + */ +void +ieee80211_input_print_task(void *arg1, void *arg2) +{ + char *msg = arg1; + + printf(%s, msg); + free(msg, M_DEVBUF); + +} + +void +ieee80211_input_print(struct ieee80211com *ic, struct ifnet *ifp, +struct ieee80211_frame *wh, struct ieee80211_rxinfo *rxi) +{ + int doprint, error; + char *msg; + u_int8_t subtype = wh-i_fc[0] IEEE80211_FC0_SUBTYPE_MASK; + + /* avoid printing too many frames */ + doprint = 0; + switch (subtype) { + case IEEE80211_FC0_SUBTYPE_BEACON: + if (ic-ic_state == IEEE80211_S_SCAN) + doprint = 1; + break; +#ifndef IEEE80211_STA_ONLY + case IEEE80211_FC0_SUBTYPE_PROBE_REQ: + if (ic-ic_opmode == IEEE80211_M_IBSS) + doprint = 1; + break; +#endif + default: + doprint = 1; + break; + } +#ifdef IEEE80211_DEBUG + doprint += ieee80211_debug; +#endif + if (!doprint) + return; + + msg = malloc(1024, M_DEVBUF, M_NOWAIT); + if (msg == NULL) + return; + + snprintf(msg, 1024, %s: received %s from %s rssi %d mode %s\n, + ifp-if_xname, + ieee80211_mgt_subtype_name[subtype IEEE80211_FC0_SUBTYPE_SHIFT], + ether_sprintf(wh-i_addr2), rxi-rxi_rssi, + ieee80211_phymode_name[ieee80211_chan2mode( + ic, ic-ic_bss-ni_chan)]); + + error = workq_add_task(NULL, 0, ieee80211_input_print_task, msg, NULL); + if (error) + free(msg, M_DEVBUF); +} + /* * Process a received frame. The node associated with the sender * should be supplied. If nothing was found in the node table then @@ -467,37 +533,8 @@ ieee80211_input(struct ifnet *ifp, struc goto out; } - if (ifp-if_flags IFF_DEBUG) { - /* avoid to print too many frames */ - int doprint = 0; - - switch (subtype) { - case IEEE80211_FC0_SUBTYPE_BEACON: - if (ic-ic_state == IEEE80211_S_SCAN) - doprint = 1; - break; -#ifndef IEEE80211_STA_ONLY - case IEEE80211_FC0_SUBTYPE_PROBE_REQ: - if (ic-ic_opmode == IEEE80211_M_IBSS) - doprint = 1; - break; -#endif - default: - doprint = 1; - break; - } -#ifdef IEEE80211_DEBUG - doprint += ieee80211_debug; -#endif - if (doprint) - printf(%s: received %s from %s rssi %d mode %s\n, - ifp-if_xname, - ieee80211_mgt_subtype_name[subtype -IEEE80211_FC0_SUBTYPE_SHIFT], - ether_sprintf(wh-i_addr2), rxi-rxi_rssi, - ieee80211_phymode_name[ieee80211_chan2mode(ic, - ic-ic_bss-ni_chan)]); - } + if (ifp-if_flags
Re: ral(4) tx/prio queue fixes (was: rt2560 tx/prio queue fixes)
On Tue, Jul 10, 2012 at 05:56:29PM +0200, Stefan Sperling wrote: Updated version that includes similar fixes for the rt2661 variants. This seems to help soekris-based ral APs that get stuck with the OACTIVE flag set (see the flags line in ifconfig ral0 output when the AP stops responding) and then require ifconfig ral0 down up to recover. It would be great to get some more testing. Thanks! Anyone want to OK this? We've been testing this with edd's soekris (rt2661 minipci) and two rt2560/rt2661 ralink cardbus cards. Index: rt2560.c === RCS file: /cvs/src/sys/dev/ic/rt2560.c,v retrieving revision 1.58 diff -u -p -r1.58 rt2560.c --- rt2560.c 22 Feb 2011 20:05:03 - 1.58 +++ rt2560.c 10 Jul 2012 15:34:21 - @@ -995,9 +995,14 @@ rt2560_tx_intr(struct rt2560_softc *sc) sc-txq.next = (sc-txq.next + 1) % RT2560_TX_RING_COUNT; } - sc-sc_tx_timer = 0; - ifp-if_flags = ~IFF_OACTIVE; - rt2560_start(ifp); + if (sc-txq.queued == 0 sc-prioq.queued == 0) + sc-sc_tx_timer = 0; + if (sc-txq.queued RT2560_TX_RING_COUNT - 1) { + sc-sc_flags = ~RT2560_DATA_OACTIVE; + if (!(sc-sc_flags (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE))) + ifp-if_flags = ~IFF_OACTIVE; + rt2560_start(ifp); + } } void @@ -1061,9 +1066,14 @@ rt2560_prio_intr(struct rt2560_softc *sc sc-prioq.next = (sc-prioq.next + 1) % RT2560_PRIO_RING_COUNT; } - sc-sc_tx_timer = 0; - ifp-if_flags = ~IFF_OACTIVE; - rt2560_start(ifp); + if (sc-txq.queued == 0 sc-prioq.queued == 0) + sc-sc_tx_timer = 0; + if (sc-prioq.queued RT2560_PRIO_RING_COUNT) { + sc-sc_flags = ~RT2560_PRIO_OACTIVE; + if (!(sc-sc_flags (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE))) + ifp-if_flags = ~IFF_OACTIVE; + rt2560_start(ifp); + } } /* @@ -1931,6 +1941,7 @@ rt2560_start(struct ifnet *ifp) if (m0 != NULL) { if (sc-prioq.queued = RT2560_PRIO_RING_COUNT) { ifp-if_flags |= IFF_OACTIVE; + sc-sc_flags |= RT2560_PRIO_OACTIVE; break; } IF_DEQUEUE(ic-ic_mgtq, m0); @@ -1952,6 +1963,7 @@ rt2560_start(struct ifnet *ifp) break; if (sc-txq.queued = RT2560_TX_RING_COUNT - 1) { ifp-if_flags |= IFF_OACTIVE; + sc-sc_flags |= RT2560_DATA_OACTIVE; break; } IFQ_DEQUEUE(ifp-if_snd, m0); @@ -2685,6 +2697,7 @@ rt2560_stop(struct ifnet *ifp, int disab struct ieee80211com *ic = sc-sc_ic; sc-sc_tx_timer = 0; + sc-sc_flags = ~(RT2560_PRIO_OACTIVE|RT2560_DATA_OACTIVE); ifp-if_timer = 0; ifp-if_flags = ~(IFF_RUNNING | IFF_OACTIVE); Index: rt2560var.h === RCS file: /cvs/src/sys/dev/ic/rt2560var.h,v retrieving revision 1.9 diff -u -p -r1.9 rt2560var.h --- rt2560var.h 7 Sep 2010 16:21:42 - 1.9 +++ rt2560var.h 7 Jul 2012 15:58:58 - @@ -116,6 +116,8 @@ struct rt2560_softc { #define RT2560_ENABLED (1 0) #define RT2560_UPDATE_SLOT (1 1) #define RT2560_SET_SLOTTIME (1 2) +#define RT2560_PRIO_OACTIVE (1 3) +#define RT2560_DATA_OACTIVE (1 4) int sc_tx_timer; Index: rt2661.c === RCS file: /cvs/src/sys/dev/ic/rt2661.c,v retrieving revision 1.65 diff -u -p -r1.65 rt2661.c --- rt2661.c 18 Mar 2011 06:05:21 - 1.65 +++ rt2661.c 10 Jul 2012 15:38:03 - @@ -986,9 +986,18 @@ rt2661_tx_intr(struct rt2661_softc *sc) txq-stat = 0; } - sc-sc_tx_timer = 0; - ifp-if_flags = ~IFF_OACTIVE; - rt2661_start(ifp); + if (sc-mgtq.queued == 0 sc-txq[0].queued == 0) + sc-sc_tx_timer = 0; + if (sc-mgtq.queued RT2661_MGT_RING_COUNT + sc-txq[0].queued RT2661_TX_RING_COUNT - 1) { + if (sc-mgtq.queued RT2661_MGT_RING_COUNT) + sc-sc_flags = ~RT2661_MGT_OACTIVE; + if (sc-txq[0].queued RT2661_TX_RING_COUNT - 1) + sc-sc_flags = ~RT2661_DATA_OACTIVE; + if (!(sc-sc_flags (RT2661_MGT_OACTIVE|RT2661_DATA_OACTIVE))) + ifp-if_flags = ~IFF_OACTIVE; + rt2661_start(ifp); + } } void @@ -1805,6 +1814,7 @@ rt2661_start(struct ifnet *ifp) if (m0 != NULL) { if (sc-mgtq.queued = RT2661_MGT_RING_COUNT) {
kbd: Use NULL instead of 0 for pointers
Use NULL instead of 0 for pointers -- Alexandr Shadchin Index: kbd_wscons.c === RCS file: /cvs/src/sbin/kbd/kbd_wscons.c,v retrieving revision 1.25 diff -u -p -r1.25 kbd_wscons.c --- kbd_wscons.c23 Jun 2008 17:41:21 - 1.25 +++ kbd_wscons.c13 Jul 2012 09:34:14 - @@ -93,13 +93,13 @@ struct nameint { struct nameint kbdenc_tab[] = { KB_ENCTAB , - { 0, 0 } + { 0, NULL } }; struct nameint kbdvar_tab[] = { KB_VARTAB , - { 0, 0 } + { 0, NULL } }; extern char *__progname; @@ -232,7 +232,7 @@ kbd_list(void) } #ifndef NOKVM - if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == 0) + if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == NULL) errx(1, kvm_openfiles: %s, errbuf); if (kvm_nlist(kd, nl) == -1)
Re: kbd: Use NULL instead of 0 for pointers
no my area, but I like it better so ok gilles@ ;-) On Fri, Jul 13, 2012 at 03:37:08PM +0600, Alexandr Shadchin wrote: Use NULL instead of 0 for pointers -- Alexandr Shadchin Index: kbd_wscons.c === RCS file: /cvs/src/sbin/kbd/kbd_wscons.c,v retrieving revision 1.25 diff -u -p -r1.25 kbd_wscons.c --- kbd_wscons.c 23 Jun 2008 17:41:21 - 1.25 +++ kbd_wscons.c 13 Jul 2012 09:34:14 - @@ -93,13 +93,13 @@ struct nameint { struct nameint kbdenc_tab[] = { KB_ENCTAB , - { 0, 0 } + { 0, NULL } }; struct nameint kbdvar_tab[] = { KB_VARTAB , - { 0, 0 } + { 0, NULL } }; extern char *__progname; @@ -232,7 +232,7 @@ kbd_list(void) } #ifndef NOKVM - if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == 0) + if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == NULL) errx(1, kvm_openfiles: %s, errbuf); if (kvm_nlist(kd, nl) == -1) -- Gilles Chehade https://www.poolp.org @poolpOrg
Re: ncheck_ffs DUID support
On 07/12/12 22:55, Alexander Hall wrote: On 07/11/12 23:43, Jan Stary wrote: On Jul 11 19:18:21, Alexander Hall wrote: This adds DUID support to ncheck_ffs. Testers? ok? This indeed enables ncheck_ffs for DUIDs, but breaks ncheck_ffs for /dev/wd0x My fstab says 5d2ade1fc5a8d569.n /tmp ffs rw,softdep,nodev,nosuid 1 2 With your diff I can do 'ncheck_ffs /tmp', which previously said 5d2ade1fc5a8d569.n: no such file or directory But I can no longer do 'ncheck_ffs /dev/wd0n' which worked before this diff, but now says ncheck_ffs: cannot open /dev/wd0n: Device busy 'ncheck_ffs /dev/rwd0n' works though. Indeed, thanks. Another try follows, with less entangled diff. Does it work better? Bah, fix indendation from spaces to tabs. Comments? OK? /Alexander Index: Makefile === RCS file: /data/openbsd/cvs/src/sbin/ncheck_ffs/Makefile,v retrieving revision 1.3 diff -u -p -r1.3 Makefile --- Makefile29 Jun 1996 19:25:09 - 1.3 +++ Makefile11 Jul 2012 13:54:01 - @@ -1,6 +1,8 @@ # $OpenBSD: Makefile,v 1.3 1996/06/29 19:25:09 mickey Exp $ PROG= ncheck_ffs +LDADD= -lutil +DPADD= ${LIBUTIL} MAN= ncheck_ffs.8 LINKS= ${BINDIR}/ncheck_ffs ${BINDIR}/ncheck Index: ncheck_ffs.c === RCS file: /data/openbsd/cvs/src/sbin/ncheck_ffs/ncheck_ffs.c,v retrieving revision 1.35 diff -u -p -r1.35 ncheck_ffs.c --- ncheck_ffs.c27 Oct 2009 23:59:33 - 1.35 +++ ncheck_ffs.c13 Jul 2012 09:34:40 - @@ -542,24 +542,34 @@ main(int argc, char *argv[]) if (optind != argc - 1 || (mflag format)) usage(); - odisk = argv[optind]; - if (realpath(odisk, rdisk) == NULL) + disk = argv[optind]; + if ((diskfd = opendev(disk, O_RDONLY, 0, NULL)) = 0) { + if (fstat(diskfd, stblock)) + err(1, cannot stat %s, disk); + if (S_ISCHR(stblock.st_mode)) + goto gotdev; + close(diskfd); + } + + if (realpath(disk, rdisk) == NULL) err(1, cannot find real path for %s, odisk); disk = rdisk; if (stat(disk, stblock) 0) err(1, cannot stat %s, disk); -if (S_ISBLK(stblock.st_mode)) { + if (S_ISBLK(stblock.st_mode)) { disk = rawname(disk); } else if (!S_ISCHR(stblock.st_mode)) { if ((fsp = getfsfile(disk)) == NULL) err(1, could not find file system %s, disk); -disk = rawname(fsp-fs_spec); -} + disk = rawname(fsp-fs_spec); + } - if ((diskfd = open(disk, O_RDONLY)) 0) + if ((diskfd = opendev(disk, O_RDONLY, 0, NULL)) 0) err(1, cannot open %s, disk); + +gotdev: sblock = (struct fs *)sblock_buf; for (i = 0; sblock_try[i] != -1; i++) { n = pread(diskfd, sblock, SBLOCKSIZE, (off_t)sblock_try[i]);
Re: make acpiec _GLK aware
On Thu, Jul 12, 2012 at 09:56:40AM -0700, Matthew Dempsky wrote: On Thu, Jul 12, 2012 at 9:48 AM, Paul Irofti p...@irofti.net wrote: + if (aml_evalname(sc-sc_acpi, sc-sc_devnode, _GLK, 0, NULL, res)) + sc-sc_glk = 0; + if (res.type != AML_OBJTYPE_INTEGER) + sc-sc_glk = 0; + else + sc-sc_glk = res.v_integer ? 1 : 0; The second if should be an else if, no? Or is res.type guaranteed to be initialized even if aml_evalname() fails? Yup, there's a need for an else if there. Thanks!
I wanna share some happiness with you. Would you like some?)
I am Susanne by the way. I am really excited about your answer))
Re: mask support for ethernet bridge filtering
* sven falempin sven.falem...@gmail.com [2012-07-12 17:37]: Inline diff even without judging on wether we'll want that at all (I'm still sceptic): +//inline +int +bridge_test_ea(struct ether_addr *ea_packet, struct ether_addr *ea_rules, +struct ether_addr *ea_mask) { + int i; + struct ether_addr ea_cmp; + for (i = 0; i ETHER_ADDR_LEN; ++i) { + ea_cmp.ether_addr_octet[i] = ea_mask-ether_addr_octet[i] + ea_packet-ether_addr_octet[i]; + } + return (bcmp(ea_cmp, ea_rules, ETHER_ADDR_LEN)); +} + that is horribly ugly. spend some time with style(9). -- Henning Brauer, h...@bsws.de, henn...@openbsd.org BS Web Services, http://bsws.de, Full-Service ISP Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed Henning Brauer Consulting, http://henningbrauer.com/
proto cksum madness
after just 15 months i got this finally working. basically moving us to the assumption that there is some cksum offload engine in each an every output path, calling the software engine very late if we figure there is none. foremost this adds this logic to the alternate output pathes like bridge, the regular already followed that model. stop the cksum fucku^Wfixup in pf. just set the damn flags to indicate the packets needs to be re-checksummed. and since some stupid cards incorporated the terrible pseudo header checksum hack in hardware we have to fill that in as well. for now, this will have a little performance penalty since right now proto cksum offloading is disabled due to a bug in the pf-cksum-hw interaction that this change happens to eliminate, so we'll be able to turn on proto csum offloading in the drivers (which will lead to fun with silicone bugs, but that's another topic). i started hacking on that in iceland and touched it on every hackathon since... the horror. in6_proto_csum_out written by krw. Index: net/if_bridge.c === RCS file: /cvs/src/sys/net/if_bridge.c,v retrieving revision 1.193 diff -u -p -r1.193 if_bridge.c --- net/if_bridge.c 4 Jul 2011 06:54:49 - 1.193 +++ net/if_bridge.c 10 Jul 2012 10:23:33 - @@ -1061,15 +1061,6 @@ bridge_output(struct ifnet *ifp, struct return (0); } #endif /* IPSEC */ - - /* Catch packets that need TCP/UDP hardware checksumming */ - if (m-m_pkthdr.csum_flags M_TCP_CSUM_OUT || - m-m_pkthdr.csum_flags M_UDP_CSUM_OUT) { - m_freem(m); - splx(s); - return (0); - } - bridge_span(sc, NULL, m); LIST_FOREACH(p, sc-sc_iflist, next) { @@ -2458,6 +2449,12 @@ bridge_ipsec(struct bridge_softc *sc, st } if (m == NULL) return (1); + else if (af == AF_INET) + in_proto_cksum_out(m, encif); +#ifdef INET6 + else if (af == AF_INET6) + in6_proto_cksum_out(m, encif); +#endif /* INET6 */ #endif /* NPF */ ip = mtod(m, struct ip *); @@ -2610,6 +2607,7 @@ bridge_ip(struct bridge_softc *sc, int d return (NULL); if (m-m_len sizeof(struct ip)) goto dropit; + in_proto_cksum_out(m, ifp); ip = mtod(m, struct ip *); ip-ip_sum = 0; if (0 (ifp-if_capabilities IFCAP_CSUM_IPv4)) { @@ -2655,6 +2653,7 @@ bridge_ip(struct bridge_softc *sc, int d if (m == NULL) return (NULL); #endif /* NPF 0 */ + in6_proto_cksum_out(m, ifp); break; } Index: net/if_pflog.c === RCS file: /cvs/src/sys/net/if_pflog.c,v retrieving revision 1.50 diff -u -p -r1.50 if_pflog.c --- net/if_pflog.c 8 Jul 2012 07:58:09 - 1.50 +++ net/if_pflog.c 10 Jul 2012 10:18:29 - @@ -443,7 +443,7 @@ pflog_bpfcopy(const void *src_arg, void if (pd.virtual_proto != PF_VPROTO_FRAGMENT (pfloghdr-rewritten = pf_translate(pd, pfloghdr-saddr, pfloghdr-sport, pfloghdr-daddr, pfloghdr-dport, 0, - pfloghdr-dir))) { + pfloghdr-dir, pd.m))) { m_copyback(pd.m, pd.off, min(pd.m-m_len - pd.off, pd.hdrlen), pd.hdr.any, M_NOWAIT); #if INET INET6 Index: net/pf.c === RCS file: /cvs/src/sys/net/pf.c,v retrieving revision 1.808 diff -u -p -r1.808 pf.c --- net/pf.c10 Jul 2012 17:33:48 - 1.808 +++ net/pf.c13 Jul 2012 10:52:40 - @@ -2,7 +2,7 @@ /* * Copyright (c) 2001 Daniel Hartmeier - * Copyright (c) 2002 - 2010 Henning Brauer + * Copyright (c) 2002 - 2012 Henning Brauer henn...@openbsd.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -148,18 +148,16 @@ void pf_add_threshold(struct pf_thres int pf_check_threshold(struct pf_threshold *); voidpf_change_ap(struct pf_addr *, u_int16_t *, - u_int16_t *, struct pf_addr *, u_int16_t, - u_int8_t, sa_family_t, sa_family_t); + struct pf_addr *, u_int16_t, sa_family_t, + sa_family_t); int pf_modulate_sack(struct pf_pdesc *, struct pf_state_peer *); -voidpf_change_a6(struct pf_addr *, u_int16_t *, - struct pf_addr *, u_int8_t); +void
Re: ncheck_ffs DUID support
On Jul 13 11:54:11, Alexander Hall wrote: On 07/12/12 22:55, Alexander Hall wrote: On 07/11/12 23:43, Jan Stary wrote: On Jul 11 19:18:21, Alexander Hall wrote: This adds DUID support to ncheck_ffs. Testers? ok? This indeed enables ncheck_ffs for DUIDs, but breaks ncheck_ffs for /dev/wd0x My fstab says 5d2ade1fc5a8d569.n /tmpffs rw,softdep,nodev,nosuid 1 2 With your diff I can do 'ncheck_ffs /tmp', which previously said 5d2ade1fc5a8d569.n: no such file or directory But I can no longer do 'ncheck_ffs /dev/wd0n' which worked before this diff, but now says ncheck_ffs: cannot open /dev/wd0n: Device busy 'ncheck_ffs /dev/rwd0n' works though. Indeed, thanks. Another try follows, with less entangled diff. Does it work better? Bah, fix indendation from spaces to tabs. Comments? OK? Now all of the following work: ncheck_ffs /dev/wd0n ncheck_ffs /dev/rwd0n ncheck_ffs 5d2ade1fc5a8d569.n ncheck_ffs /tmp Jan Index: Makefile === RCS file: /data/openbsd/cvs/src/sbin/ncheck_ffs/Makefile,v retrieving revision 1.3 diff -u -p -r1.3 Makefile --- Makefile 29 Jun 1996 19:25:09 - 1.3 +++ Makefile 11 Jul 2012 13:54:01 - @@ -1,6 +1,8 @@ #$OpenBSD: Makefile,v 1.3 1996/06/29 19:25:09 mickey Exp $ PROG=ncheck_ffs +LDADD= -lutil +DPADD= ${LIBUTIL} MAN= ncheck_ffs.8 LINKS= ${BINDIR}/ncheck_ffs ${BINDIR}/ncheck Index: ncheck_ffs.c === RCS file: /data/openbsd/cvs/src/sbin/ncheck_ffs/ncheck_ffs.c,v retrieving revision 1.35 diff -u -p -r1.35 ncheck_ffs.c --- ncheck_ffs.c 27 Oct 2009 23:59:33 - 1.35 +++ ncheck_ffs.c 13 Jul 2012 09:34:40 - @@ -542,24 +542,34 @@ main(int argc, char *argv[]) if (optind != argc - 1 || (mflag format)) usage(); - odisk = argv[optind]; - if (realpath(odisk, rdisk) == NULL) + disk = argv[optind]; + if ((diskfd = opendev(disk, O_RDONLY, 0, NULL)) = 0) { + if (fstat(diskfd, stblock)) + err(1, cannot stat %s, disk); + if (S_ISCHR(stblock.st_mode)) + goto gotdev; + close(diskfd); + } + + if (realpath(disk, rdisk) == NULL) err(1, cannot find real path for %s, odisk); disk = rdisk; if (stat(disk, stblock) 0) err(1, cannot stat %s, disk); -if (S_ISBLK(stblock.st_mode)) { + if (S_ISBLK(stblock.st_mode)) { disk = rawname(disk); } else if (!S_ISCHR(stblock.st_mode)) { if ((fsp = getfsfile(disk)) == NULL) err(1, could not find file system %s, disk); -disk = rawname(fsp-fs_spec); -} + disk = rawname(fsp-fs_spec); + } - if ((diskfd = open(disk, O_RDONLY)) 0) + if ((diskfd = opendev(disk, O_RDONLY, 0, NULL)) 0) err(1, cannot open %s, disk); + +gotdev: sblock = (struct fs *)sblock_buf; for (i = 0; sblock_try[i] != -1; i++) { n = pread(diskfd, sblock, SBLOCKSIZE, (off_t)sblock_try[i]);
Re: Build cpu topology on amd64.
Ok so here is the version with #ifndef SMALL_KERNEL, the only question that remains is: do we keep the printf in dmesg ? or shall I take that out ? I'd like to keep it so we may know if the detection is correctly just by looking at sent dmesgs. Index: arch/amd64/amd64/identcpu.c === RCS file: /cvs/src/sys/arch/amd64/amd64/identcpu.c,v retrieving revision 1.36 diff -d -u -p -r1.36 identcpu.c --- arch/amd64/amd64/identcpu.c 22 Apr 2012 19:36:09 - 1.36 +++ arch/amd64/amd64/identcpu.c 13 Jul 2012 11:45:58 - @@ -446,4 +446,126 @@ identifycpu(struct cpu_info *ci) sensordev_install(ci-ci_sensordev); #endif } +#ifndef SMALL_KERNEL + cpu_topology(ci); +#endif +} + +#ifndef SMALL_KERNEL +/* + * Base 2 logarithm of an int. returns 0 for 0 (yeye, I know). + */ +static int +log2(unsigned int i) +{ + int ret = 0; + + while (i = 1) + ret++; + + return (ret); +} + +static int +mask_width(u_int x) +{ + int bit; + int mask; + int powerof2; + + powerof2 = ((x - 1) x) == 0; + mask = (x (1 - powerof2)) - 1; + + /* fls */ + if (mask == 0) + return (0); + for (bit = 1; mask != 1; bit++) + mask = (unsigned int)mask 1; + + return (bit); +} + +/* + * Build up cpu topology for given cpu, must run on the core itself. + */ +void +cpu_topology(struct cpu_info *ci) +{ + u_int32_t eax, ebx, ecx, edx; + u_int32_t apicid, max_apicid, max_coreid; + u_int32_t smt_bits, core_bits, pkg_bits; + u_int32_t smt_mask, core_mask, pkg_mask; + + /* We need at least apicid at CPUID 1 */ + CPUID(0, eax, ebx, ecx, edx); + if (eax 1) + goto no_topology; + + /* Initial apicid */ + CPUID(1, eax, ebx, ecx, edx); + apicid = (ebx 24) 0xff; + + if (strcmp(cpu_vendor, AuthenticAMD) == 0) { + /* We need at least apicid at CPUID 0x8008 */ + CPUID(0x8000, eax, ebx, ecx, edx); + if (eax 0x8008) + goto no_topology; + + CPUID(0x8008, eax, ebx, ecx, edx); + core_bits = (ecx 12) 0xf; + if (core_bits == 0) + goto no_topology; + /* So coreidsize 2 gives 3, 3 gives 7... */ + core_mask = (1 core_bits) - 1; + /* Core id is the least significant considering mask */ + ci-ci_core_id = apicid core_mask; + /* Pkg id is the upper remaining bits */ + ci-ci_pkg_id = apicid ~core_mask; + ci-ci_pkg_id = core_bits; + } else if (strcmp(cpu_vendor, GenuineIntel) == 0) { + /* We only support leaf 1/4 detection */ + CPUID(0, eax, ebx, ecx, edx); + if (eax 4) + goto no_topology; + /* Get max_apicid */ + CPUID(1, eax, ebx, ecx, edx); + max_apicid = (ebx 16) 0xff; + /* Get max_coreid */ + CPUID2(4, 0, eax, ebx, ecx, edx); + max_coreid = ((eax 26) 0x3f) + 1; + /* SMT */ + smt_bits = mask_width(max_apicid / max_coreid); + smt_mask = (1 smt_bits) - 1; + /* Core */ + core_bits = log2(max_coreid); + core_mask = (1 (core_bits + smt_bits)) - 1; + core_mask ^= smt_mask; + /* Pkg */ + pkg_bits = core_bits + smt_bits; + pkg_mask = -1 core_bits; + + ci-ci_smt_id = apicid smt_mask; + ci-ci_core_id = (apicid core_mask) smt_bits; + ci-ci_pkg_id = (apicid pkg_mask) pkg_bits; + } else + goto no_topology; +#ifdef DEBUG + printf(cpu%d: smt %u, core %u, pkg %u + (apicid 0x%x, max_apicid 0x%x, max_coreid 0x%x, smt_bits 0x%x, smt_mask 0x%x, + core_bits 0x%x, core_mask 0x%x, pkg_bits 0x%x, pkg_mask 0x%x)\n, + ci-ci_cpuid, ci-ci_smt_id, ci-ci_core_id, ci-ci_pkg_id, + apicid, max_apicid, max_coreid, smt_bits, smt_mask, core_bits, + core_mask, pkg_bits, pkg_mask); +#else + printf(cpu%d: smt %u, core %u, package %u\n, ci-ci_cpuid, + ci-ci_smt_id, ci-ci_core_id, ci-ci_pkg_id); + +#endif + return; + /* We can't map, so consider ci_core_id as ci_cpuid */ +no_topology: + ci-ci_smt_id = 0; + ci-ci_core_id = ci-ci_cpuid; + ci-ci_pkg_id = 0; } +#endif /* SMALL_KERNEL */ Index: arch/amd64/include/cpu.h === RCS file: /cvs/src/sys/arch/amd64/include/cpu.h,v retrieving revision 1.73 diff -d -u -p -r1.73 cpu.h --- arch/amd64/include/cpu.h17 Apr 2012 16:02:33 - 1.73
Re: Build cpu topology on amd64.
Date: Fri, 13 Jul 2012 14:57:11 +0200 From: Christiano F. Haesbaert haesba...@openbsd.org Ok so here is the version with #ifndef SMALL_KERNEL, the only question that remains is: do we keep the printf in dmesg ? or shall I take that out ? I'd like to keep it so we may know if the detection is correctly just by looking at sent dmesgs. Can you shelve this until you: a) Have the equivalent code for i386. b) Have something that actually uses this? Cheers, Mark Index: arch/amd64/amd64/identcpu.c === RCS file: /cvs/src/sys/arch/amd64/amd64/identcpu.c,v retrieving revision 1.36 diff -d -u -p -r1.36 identcpu.c --- arch/amd64/amd64/identcpu.c 22 Apr 2012 19:36:09 - 1.36 +++ arch/amd64/amd64/identcpu.c 13 Jul 2012 11:45:58 - @@ -446,4 +446,126 @@ identifycpu(struct cpu_info *ci) sensordev_install(ci-ci_sensordev); #endif } +#ifndef SMALL_KERNEL + cpu_topology(ci); +#endif +} + +#ifndef SMALL_KERNEL +/* + * Base 2 logarithm of an int. returns 0 for 0 (yeye, I know). + */ +static int +log2(unsigned int i) +{ + int ret = 0; + + while (i = 1) + ret++; + + return (ret); +} + +static int +mask_width(u_int x) +{ + int bit; + int mask; + int powerof2; + + powerof2 = ((x - 1) x) == 0; + mask = (x (1 - powerof2)) - 1; + + /* fls */ + if (mask == 0) + return (0); + for (bit = 1; mask != 1; bit++) + mask = (unsigned int)mask 1; + + return (bit); +} + +/* + * Build up cpu topology for given cpu, must run on the core itself. + */ +void +cpu_topology(struct cpu_info *ci) +{ + u_int32_t eax, ebx, ecx, edx; + u_int32_t apicid, max_apicid, max_coreid; + u_int32_t smt_bits, core_bits, pkg_bits; + u_int32_t smt_mask, core_mask, pkg_mask; + + /* We need at least apicid at CPUID 1 */ + CPUID(0, eax, ebx, ecx, edx); + if (eax 1) + goto no_topology; + + /* Initial apicid */ + CPUID(1, eax, ebx, ecx, edx); + apicid = (ebx 24) 0xff; + + if (strcmp(cpu_vendor, AuthenticAMD) == 0) { + /* We need at least apicid at CPUID 0x8008 */ + CPUID(0x8000, eax, ebx, ecx, edx); + if (eax 0x8008) + goto no_topology; + + CPUID(0x8008, eax, ebx, ecx, edx); + core_bits = (ecx 12) 0xf; + if (core_bits == 0) + goto no_topology; + /* So coreidsize 2 gives 3, 3 gives 7... */ + core_mask = (1 core_bits) - 1; + /* Core id is the least significant considering mask */ + ci-ci_core_id = apicid core_mask; + /* Pkg id is the upper remaining bits */ + ci-ci_pkg_id = apicid ~core_mask; + ci-ci_pkg_id = core_bits; + } else if (strcmp(cpu_vendor, GenuineIntel) == 0) { + /* We only support leaf 1/4 detection */ + CPUID(0, eax, ebx, ecx, edx); + if (eax 4) + goto no_topology; + /* Get max_apicid */ + CPUID(1, eax, ebx, ecx, edx); + max_apicid = (ebx 16) 0xff; + /* Get max_coreid */ + CPUID2(4, 0, eax, ebx, ecx, edx); + max_coreid = ((eax 26) 0x3f) + 1; + /* SMT */ + smt_bits = mask_width(max_apicid / max_coreid); + smt_mask = (1 smt_bits) - 1; + /* Core */ + core_bits = log2(max_coreid); + core_mask = (1 (core_bits + smt_bits)) - 1; + core_mask ^= smt_mask; + /* Pkg */ + pkg_bits = core_bits + smt_bits; + pkg_mask = -1 core_bits; + + ci-ci_smt_id = apicid smt_mask; + ci-ci_core_id = (apicid core_mask) smt_bits; + ci-ci_pkg_id = (apicid pkg_mask) pkg_bits; + } else + goto no_topology; +#ifdef DEBUG + printf(cpu%d: smt %u, core %u, pkg %u + (apicid 0x%x, max_apicid 0x%x, max_coreid 0x%x, smt_bits 0x%x, smt_mask 0x%x, + core_bits 0x%x, core_mask 0x%x, pkg_bits 0x%x, pkg_mask 0x%x)\n, + ci-ci_cpuid, ci-ci_smt_id, ci-ci_core_id, ci-ci_pkg_id, + apicid, max_apicid, max_coreid, smt_bits, smt_mask, core_bits, + core_mask, pkg_bits, pkg_mask); +#else + printf(cpu%d: smt %u, core %u, package %u\n, ci-ci_cpuid, + ci-ci_smt_id, ci-ci_core_id, ci-ci_pkg_id); + +#endif + return; + /* We can't map, so consider ci_core_id as ci_cpuid */ +no_topology: + ci-ci_smt_id = 0; + ci-ci_core_id = ci-ci_cpuid; + ci-ci_pkg_id = 0; } +#endif /* SMALL_KERNEL */ Index: arch/amd64/include/cpu.h
Re: rt2560 bbp/antenna diff
On Sat, Jul 07, 2012 at 08:14:34PM -0400, Brad Smith wrote: I had posted a diff for this and a few other bug fixes here.. http://marc.info/?l=openbsd-techm=124139607313719w=2 I've looked at the additional changes you ported from dragonfly in that diff. I don't know what impact these changes will really have so I'd rather not apply them. I cannot verify the slot-time change sephe made to fix problems with his AP, so I'd rather not apply that. The EEPROM values read for tx-txpow are all within the 24/25 range for me. I cannot tell how using these values for different channels will make a noticable difference. Maybe this works around broken EEPROMs in some cards but I'd rather have solid evidence that this is a real problem. The values we use for ARTCSR1 and ARTCSR2 are the same as the linux driver is using. I don't know the source of sephe's information so I cannot verify it. I have no idea what changing these bits really does. The problems with ral you were hoping to fix by porting these changes from dragonfly might already be fixed now in -current. I'm typing this mail across a ral AP that used to lock up very often and now apparently works without issues. I'd prefer waiting to see if we still get reports of failing hostap ral cards that require ifconfig down/up to restore before making more changes to the driver.
Re: kbd: Use NULL instead of 0 for pointers
I like these kind of diffs, some people don't, ok from me. On Fri, Jul 13, 2012 at 03:37:08PM +0600, Alexandr Shadchin wrote: Use NULL instead of 0 for pointers -- Alexandr Shadchin Index: kbd_wscons.c === RCS file: /cvs/src/sbin/kbd/kbd_wscons.c,v retrieving revision 1.25 diff -u -p -r1.25 kbd_wscons.c --- kbd_wscons.c 23 Jun 2008 17:41:21 - 1.25 +++ kbd_wscons.c 13 Jul 2012 09:34:14 - @@ -93,13 +93,13 @@ struct nameint { struct nameint kbdenc_tab[] = { KB_ENCTAB , - { 0, 0 } + { 0, NULL } }; struct nameint kbdvar_tab[] = { KB_VARTAB , - { 0, 0 } + { 0, NULL } }; extern char *__progname; @@ -232,7 +232,7 @@ kbd_list(void) } #ifndef NOKVM - if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == 0) + if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == NULL) errx(1, kvm_openfiles: %s, errbuf); if (kvm_nlist(kd, nl) == -1) -- Christiano Farina HAESBAERT Do NOT send me html mail.
Re: Build cpu topology on amd64.
On Fri, Jul 13, 2012 at 03:06:34PM +0200, Mark Kettenis wrote: Date: Fri, 13 Jul 2012 14:57:11 +0200 From: Christiano F. Haesbaert haesba...@openbsd.org Ok so here is the version with #ifndef SMALL_KERNEL, the only question that remains is: do we keep the printf in dmesg ? or shall I take that out ? I'd like to keep it so we may know if the detection is correctly just by looking at sent dmesgs. Can you shelve this until you: a) Have the equivalent code for i386. Sure, that should actually be the same code, I just need to make the identifycpu() stuff run on each cpu on i386 as in amd64. b) Have something that actually uses this? That won't be so simple, but ok :) Let me explain why, when I started all this I wanted to favor migration from procs on the same core, and then on the same package. So you would pay a penalty to cross cores and a double penalty to cross packages. But this is naive and stupid, sometimes, you want procs to go as far away as possible: think of 2 procs that trash the cachelines, Brett and I found a good metric from a paper from Alexandra Fedorova, it involves calculating a pain parameter, but we're far away from making that possible and viable, we have easier/bigger gains right now doing other stuff. I'll hold onto it, at least it's on the mailing lists so users can play with it :). Cheers Cheers, Mark Index: arch/amd64/amd64/identcpu.c === RCS file: /cvs/src/sys/arch/amd64/amd64/identcpu.c,v retrieving revision 1.36 diff -d -u -p -r1.36 identcpu.c --- arch/amd64/amd64/identcpu.c 22 Apr 2012 19:36:09 - 1.36 +++ arch/amd64/amd64/identcpu.c 13 Jul 2012 11:45:58 - @@ -446,4 +446,126 @@ identifycpu(struct cpu_info *ci) sensordev_install(ci-ci_sensordev); #endif } +#ifndef SMALL_KERNEL + cpu_topology(ci); +#endif +} + +#ifndef SMALL_KERNEL +/* + * Base 2 logarithm of an int. returns 0 for 0 (yeye, I know). + */ +static int +log2(unsigned int i) +{ + int ret = 0; + + while (i = 1) + ret++; + + return (ret); +} + +static int +mask_width(u_int x) +{ + int bit; + int mask; + int powerof2; + + powerof2 = ((x - 1) x) == 0; + mask = (x (1 - powerof2)) - 1; + + /* fls */ + if (mask == 0) + return (0); + for (bit = 1; mask != 1; bit++) + mask = (unsigned int)mask 1; + + return (bit); +} + +/* + * Build up cpu topology for given cpu, must run on the core itself. + */ +void +cpu_topology(struct cpu_info *ci) +{ + u_int32_t eax, ebx, ecx, edx; + u_int32_t apicid, max_apicid, max_coreid; + u_int32_t smt_bits, core_bits, pkg_bits; + u_int32_t smt_mask, core_mask, pkg_mask; + + /* We need at least apicid at CPUID 1 */ + CPUID(0, eax, ebx, ecx, edx); + if (eax 1) + goto no_topology; + + /* Initial apicid */ + CPUID(1, eax, ebx, ecx, edx); + apicid = (ebx 24) 0xff; + + if (strcmp(cpu_vendor, AuthenticAMD) == 0) { + /* We need at least apicid at CPUID 0x8008 */ + CPUID(0x8000, eax, ebx, ecx, edx); + if (eax 0x8008) + goto no_topology; + + CPUID(0x8008, eax, ebx, ecx, edx); + core_bits = (ecx 12) 0xf; + if (core_bits == 0) + goto no_topology; + /* So coreidsize 2 gives 3, 3 gives 7... */ + core_mask = (1 core_bits) - 1; + /* Core id is the least significant considering mask */ + ci-ci_core_id = apicid core_mask; + /* Pkg id is the upper remaining bits */ + ci-ci_pkg_id = apicid ~core_mask; + ci-ci_pkg_id = core_bits; + } else if (strcmp(cpu_vendor, GenuineIntel) == 0) { + /* We only support leaf 1/4 detection */ + CPUID(0, eax, ebx, ecx, edx); + if (eax 4) + goto no_topology; + /* Get max_apicid */ + CPUID(1, eax, ebx, ecx, edx); + max_apicid = (ebx 16) 0xff; + /* Get max_coreid */ + CPUID2(4, 0, eax, ebx, ecx, edx); + max_coreid = ((eax 26) 0x3f) + 1; + /* SMT */ + smt_bits = mask_width(max_apicid / max_coreid); + smt_mask = (1 smt_bits) - 1; + /* Core */ + core_bits = log2(max_coreid); + core_mask = (1 (core_bits + smt_bits)) - 1; + core_mask ^= smt_mask; + /* Pkg */ + pkg_bits = core_bits + smt_bits; + pkg_mask = -1 core_bits; + + ci-ci_smt_id = apicid smt_mask; + ci-ci_core_id = (apicid core_mask) smt_bits; + ci-ci_pkg_id = (apicid pkg_mask) pkg_bits; + } else + goto
Paga $53 por Pen Drive Kingston 8gb SOLO POR HOY!!!
Si no podes visualizar este mail, ingresa a: http://news1.bonuscupon.com.ar/r.html?uid=1.1y.295h.y7.3urkca5kl9
diff: missing break in switch
npppd used wrong AVPs as a `calling number' because `break' in switch case was missing. ok? Index: npppd/l2tp/l2tp_call.c === RCS file: /cvs/src/usr.sbin/npppd/l2tp/l2tp_call.c,v retrieving revision 1.12 diff -u -p -r1.12 l2tp_call.c --- npppd/l2tp/l2tp_call.c 8 May 2012 13:18:37 - 1.12 +++ npppd/l2tp/l2tp_call.c 13 Jul 2012 13:59:05 - @@ -329,6 +329,7 @@ l2tp_call_recv_ICRQ(l2tp_call *_this, u_ * Windows 98/Me/NT asserts mandatory bit in * Physical Channel Id */ + break; case L2TP_AVP_TYPE_CALLING_NUMBER: slen = MIN(sizeof(_this-calling_number) - 1, avp_attr_length(avp));
cosmetic netstat -W tweak
Input packets dropped isn't really a good description of what happened when we failed to allocate a new node in the net80211 stack. This allocation doesn't happen for every packet, only for new nodes that appear in reach of the antenna. And we already mention nodes elsewhere in the output: p(is_tx_nonode, \t%lu output packet%s failed for no nodes\n); p(is_node_timeout, \t%lu node%s timed out\n); Index: net80211.c === RCS file: /cvs/src/usr.bin/netstat/net80211.c,v retrieving revision 1.7 diff -u -p -r1.7 net80211.c --- net80211.c 4 Mar 2011 23:48:15 - 1.7 +++ net80211.c 13 Jul 2012 14:10:29 - @@ -80,7 +80,7 @@ net80211_ifstats(char *ifname) p(is_rx_elem_toosmall, \t%lu input packet%s with elements too small\n); p(is_rx_badchan, \t%lu input packet%s with invalid channel\n); p(is_rx_chanmismatch, \t%lu input packet%s with mismatched channel\n); - p(is_rx_nodealloc, \t%lu input packet%s dropped\n); + p(is_rx_nodealloc, \t%lu node allocation%s failed\n); p(is_rx_ssidmismatch, \t%lu input packet%s with mismatched ssid\n); p(is_rx_auth_unsupported, \t%lu input packet%s with unsupported auth algorithm\n); p(is_rx_auth_fail, \t%lu input authentication%s failed\n);
Re: diff: missing break in switch
On Fri, Jul 13, 2012 at 04:07:20PM +0200, Yasuoka Masahiko wrote: npppd used wrong AVPs as a `calling number' because `break' in switch case was missing. ok? OK. Index: npppd/l2tp/l2tp_call.c === RCS file: /cvs/src/usr.sbin/npppd/l2tp/l2tp_call.c,v retrieving revision 1.12 diff -u -p -r1.12 l2tp_call.c --- npppd/l2tp/l2tp_call.c8 May 2012 13:18:37 - 1.12 +++ npppd/l2tp/l2tp_call.c13 Jul 2012 13:59:05 - @@ -329,6 +329,7 @@ l2tp_call_recv_ICRQ(l2tp_call *_this, u_ * Windows 98/Me/NT asserts mandatory bit in * Physical Channel Id */ + break; case L2TP_AVP_TYPE_CALLING_NUMBER: slen = MIN(sizeof(_this-calling_number) - 1, avp_attr_length(avp)); -- :wq Claudio
new pci ids
Hi. Here is the bunch of pci devices, found in some laptops and desktops I get in my hands. OK to commit? Index: pcidevs === RCS file: /cvs/src/sys/dev/pci/pcidevs,v retrieving revision 1.1651 diff -u -r1.1651 pcidevs --- pcidevs 8 Jul 2012 09:48:38 - 1.1651 +++ pcidevs 11 Jul 2012 20:36:55 - @@ -155,6 +155,7 @@ vendor SIEMENS 0x110a Siemens vendor ZNYX0x110d Znyx Networks vendor ACCTON 0x1113 Accton +vendor ATMEL 0x1114 Atmel vendor VORTEX 0x1119 Vortex vendor EFFICIENTNETS 0x111a Efficent Networks vendor IDT 0x111d IDT @@ -906,6 +907,7 @@ /* ASMedia products */ product ASMEDIA ASM10420x1042 ASM1042 xHCI +product ASMEDIA ASM10800x1080 ASM1083/1085 PCIE-PCI /* Asustek products */ product ASUSTEK HFCPCI 0x0675 ISDN @@ -1258,6 +1260,7 @@ product ATI RADEON_X700_PCIE_S 0x5e6d Radeon X700 PCIE Sec product ATI RADEON_X700_SE 0x5e4f Radeon X700 SE product ATI RADEON_X700_SE_S 0x5e6f Radeon X700 SE Sec +product ATI RADEON_HD6670 0x6758 Radeon HD 6670 product ATI RADEON_HD5800 0x6899 Radeon HD 5800 product ATI RADEON_HD5700 0x68b8 Radeon HD 5700 product ATI RADEON_HD5670 0x68d8 Radeon HD 5670 @@ -1440,6 +1443,7 @@ product ATI RADEON_HD5700_HDA 0xaa58 Radeon HD 5700 Audio product ATI RADEON_HD5600_HDA 0xaa60 Radeon HD 5600 Audio product ATI RADEON_HD5470_HDA 0xaa68 Radeon HD 5470 Audio +product ATI RADEON_HD6670_HDA 0xaa90 Radeon HD 6670 Audio product ATI RADEON_HD6400_HDA 0xaa98 Radeon HD 6400 Audio product ATI RS100_AGP 0xcab0 RS100 AGP product ATI RS200_AGP 0xcab2 RS200 AGP @@ -1487,6 +1491,9 @@ product ATHEROS AR5211_FPGA11B 0xf11b AR5211Ref product ATHEROS AR5211_LEGACY 0xff12 AR5211Ref +/* Atmel products */ +product ATMEL AT76C506 0x0506 AT76C506 + /* Atronics products */ product ATRONICS IDE_2015PL0x2015 IDE-2015PL @@ -3586,6 +3593,7 @@ product ITEXPRESS IT8213F 0x8213 IT8213F product ITEXPRESS IT8330G 0x8330 IT8330G product ITEXPRESS ITF_ISA 0x ITF ISA +product ITEXPRESS IT8892 0x8892 IT8892 /* JMicron */ product JMICRON JMC250 0x0250 JMC250 @@ -3988,6 +3996,7 @@ product CMI CMI87380x0111 CMI8738/C3DX Audio product CMI CMI8738B 0x0112 CMI8738B Audio product CMI HSP56 0x0211 HSP56 AMR +product CMI CMI87880x8788 CMI8788 Oxygen HD Audio /* Netoctave */ product NETOCTAVE NSP2K0x0100 NSP2K @@ -4703,6 +4712,7 @@ product NVIDIA MCP77_RAID_30x0ada MCP77 RAID product NVIDIA MCP77_RAID_40x0adb MCP77 RAID product NVIDIA GF108_HDA 0x0bea GF108 HD Audio +product NVIDIA GF116_HDA 0x0bee GF116 HD Audio product NVIDIA MCP89_HB0x0d60 MCP89 Host product NVIDIA MCP89_MEM_1 0x0d68 MCP89 Memory product NVIDIA MCP89_MEM_2 0x0d69 MCP89 Memory @@ -4733,6 +4743,7 @@ product NVIDIA MCP89_OHCI 0x0d9c MCP89 USB product NVIDIA MCP89_EHCI 0x0d9d MCP89 USB product NVIDIA GEFORCE_425M0x0df0 GeForce 425M +product NVIDIA GEFORCEGTX550TI 0x1244 GeForce GTX 550 Ti /* Oak Technologies products */ product OAKTECH OTI10070x0107 OTI107 @@ -4880,6 +4891,7 @@ product PHILIPS SAA71330x7133 SAA7133 TV product PHILIPS SAA71340x7134 SAA7134 TV product PHILIPS SAA71350x7135 SAA7135 TV +product PHILIPS SAA72310x7231 SAA7231 TV /* Phison products */ product PHISON PS5000 0x5000 PS5000
Campamentos Cientificos en Tucuman
OBSERVATORIO ASTRONOMICO AMPIMPA TUCUMAN - ARGENTINA Declarado de Interés Educativo por el Ministerio de Educación de la Nación _ tech@openbsd.org At. Campamento Científico Internacional - SolarMax 2012 - La Ciencia en el Aula Nuevos enfoques didácticos Organiza: Observatorio Astronómico Ampimpa Departamento Formación Profesional Docente Destinado a: Maestros de Escuelas Primarias del 2° Ciclo, Profesores de Escuelas Secundarias, Profesores de Nivel Superior, Especialistas e Investigadores en Enseñanza de las Ciencias y Ciencias de la Educación, Directores y Asesores Pedagógicos de Establecimientos Educativos Fecha: 17, 18, 19 y 20 de Agosto de 2012 VER INFORMACION COMPLETA CON IMÁGENES http://www.skytuc.com.ar/Paginas/noticia.asp?id=157 Acreditación oficial: http://www.astrotuc.com.ar/temp/ResMinisterioCampCientificos_2012.doc Resolución Nro. 1498/5 (SGE) E - Exp. Nro 016894/230-O-11 http://www.skytuc.com.ar/temp/ResMinisterioCampCientificos_2012.doc 70 Hs. Cátedra http://www.astrotuc.com.ar/temp/ResMinisterioCampCientificos_2012.doc Lugar de Realización: Área Observatorio Astronómico Ampimpa Provincia de Tucumán - República Argentina - Ruta Provincial 307 km. 107,5 - Valles Calchaquíes - Provincia de Tucumán República Argentina www.astrotuc.com.ar http://www.astrotuc.com.ar Email: informesobservato...@astrotuc.com.ar mailto:informesobservato...@astrotuc.com.ar INSCRIPCIONES ON-LINE http://www.skytuc.com.ar/Paginas/formulario_inscripcion.asp?id=157 (CUPOS LIMITADOS) CRONOGRAMA DIA 1 - Viernes 17 de Agosto de 2012 09.00 Recepción. Desayuno de Bienvenida en San Miguel de Tucumán. 09.30 Presentación del equipo del Observatorio a cargo del Campamento. Instrucciones generales y objetivos. 10.00 Partida hacia el Observatorio. Durante el recorrido se realizarán mediciones utilizando instrumental científico como termómetros, altímetros, barómetros, gps; sumado al uso de imágenes satelitales del recorrido. Se mostrará así a los docentes participantes una forma activa y diferente de aboradar la didáctica de un viaje de estudios. 16.30 Arribo a Observatorio. Ubicación en las cabañas. Tiempo Libre hasta las 18.00 en que se sirve la merienda 19.00 Taller de cierre del viaje. Trazado del perfil geomorfológico y fitogeográfico del recorrido. Análisis de la formación Las Yungas y su relación con la barrera orográfica andina en Sudamérica. 20.30 Charlas de Reflexión Pedagógica. Temas a abordar: 1.- Problemas actuales en la enseñanza de las ciencias y causas del desinterés de niños y jóvenes. 2.- Recomendaciones de la Conferencia Mundial sobre Ciencia y Conocimiento Científico. Unesco 3.- Enseñar Ciencias en el Siglo XXI. Los nuevos paradigmas y la nueva didáctica en las aulas. 21.30 Observaciones Astronómicas. Las primeras observaciones comienzan con los objetos más cercanos: Planetas y La luna. Charla a Cielo Abierto.- Cena. Descanso nocturno. DIA 2 - Sábado 18 de Agosto de 2012 Desayuno. Formarción de los distintos grupos y la elección de los Proyectos Científicos. Todos estos proyectos tendrán actividades de gabinete y de campo. Los datos recogidos serán organizados, analizados y evaluados para llegar posteriormente a los resultados. Temáticas propuestas para el proyecto a elegir: - ASTRONOMÍA: Diseño de un programa de observación y astrofotografía de objetos celestes operando el telescopio de la Estación Astronómica - CIENCIAS DEL ESPACIO: Diseño, cáculo, construcción y lanzamiento de un cohete experimental - INGENIERIA DEL MEDIO AMBIENTE: Elaboración de línea de base y matriz de impacto ambiental. Evaluación de proyectos. - BIOLOGIA:Estudio comparativo de áreas protegidas y no protegidas. Determinación de Abundancia y Diversidad biológica - BIOLOGÍA:Detección de la presencia de mamíferos nativos de la zona. Huellas y rastros. - GEOLOGÍA: Estudio de rocas en el Área del Observatorio. Procesos geológicos endógenos y exógenos para una reconstrucción paleoambiental. - GEOGRAFIA: Trazado de mapas mediante el uso del Gps. Georeferenciamiento e interpretación de imágenes satelitales. - METEOROLOGÍA: Predicción básica del tiempo atmosférico mediante estación meteorológica y fotos satelitales - ENERGIA SOLAR: Estudio cuantitativo de niveles diarios de radiación solar en el espectro visible y ultravioleta. - MATEMÁTICAS: Estudio de la rotación diferencial del Sol con imágenes satelitales SOHO y SDO. Hacia el Máximo Solar 2012. - ARQUEOLOGÍA: Estudio de la acción antrópica y fenómenos naturales en sitios arqueológicos. Conservacionismo y protección de patrimonio. Por la noche, las Observaciones aproximarán objetos galácticos más lejanos: Nebulosas y Cúmulos Estelares y permitirán en el diálogo con los profesionales del Observatorio aclarar dudas sobre aspectos de la astronomía que posteriormente podrán volcar al aula. En Microcine El Universo en 3D y Viaje Virtual al Planeta Marte. Día 3 Domingo 19 de Agosto de 2012 Desayuno. Todos los grupos se abocan a la finalización
Simplify wsconsctl (mouse part)
Not need call ioctl(WSMOUSEIO_GCALIBCOORDS or WSMOUSEIO_SCALIBCOORDS) twice, enough once. OK ? -- Alexandr Shadchin Index: mouse.c === RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v retrieving revision 1.11 diff -u -p -r1.11 mouse.c --- mouse.c 20 Aug 2010 00:20:55 - 1.11 +++ mouse.c 13 Jul 2012 16:35:18 - @@ -44,7 +44,7 @@ static int resolution; static int samplerate; static int rawmode; -struct wsmouse_calibcoords wmcoords, wmcoords_save; +struct wsmouse_calibcoords wmcoords; struct field mouse_field_tab[] = { { resolution,resolution,FMT_UINT, FLG_WRONLY }, @@ -61,26 +61,20 @@ mouse_get_values(int fd) if (field_by_value(mouse_field_tab, mstype)-flags FLG_GET) if (ioctl(fd, WSMOUSEIO_GTYPE, mstype) 0) warn(WSMOUSEIO_GTYPE); - - if (field_by_value(mouse_field_tab, rawmode)-flags FLG_GET) { + + if ((field_by_value(mouse_field_tab, rawmode)-flags FLG_GET) || + (field_by_value(mouse_field_tab, wmcoords)-flags FLG_GET)) { if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, wmcoords) 0) { - if (errno == ENOTTY) + if (errno == ENOTTY) { field_by_value(mouse_field_tab, rawmode)-flags |= FLG_DEAD; - else + field_by_value(mouse_field_tab, + wmcoords)-flags |= FLG_DEAD; + } else warn(WSMOUSEIO_GCALIBCOORDS); } rawmode = wmcoords.samplelen; } - - if (field_by_value(mouse_field_tab, wmcoords)-flags FLG_GET) - if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, wmcoords) 0) { - if (errno == ENOTTY) - field_by_value(mouse_field_tab, - wmcoords)-flags |= FLG_DEAD; - else - warn(WSMOUSEIO_GCALIBCOORDS); - } } int @@ -98,29 +92,13 @@ mouse_put_values(int fd) return 1; } } - if (field_by_value(mouse_field_tab, rawmode)-flags FLG_SET) { + if ((field_by_value(mouse_field_tab, rawmode)-flags FLG_SET) || + (field_by_value(mouse_field_tab, wmcoords)-flags FLG_SET)) { wmcoords.samplelen = rawmode; if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, wmcoords) 0) { if (errno == ENOTTY) { field_by_value(mouse_field_tab, rawmode)-flags |= FLG_DEAD; - } else { - warn(WSMOUSEIO_SCALIBCOORDS); - return 1; - } - } - } - if (field_by_value(mouse_field_tab, wmcoords)-flags FLG_SET) { - if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, wmcoords_save) 0) { - if (errno == ENOTTY) - field_by_value(mouse_field_tab, - wmcoords)-flags |= FLG_DEAD; - else - warn(WSMOUSEIO_GCALIBCOORDS); - } - wmcoords.samplelen = wmcoords_save.samplelen; - if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, wmcoords) 0) { - if (errno == ENOTTY) { field_by_value(mouse_field_tab, wmcoords)-flags |= FLG_DEAD; } else {
Re: ftp mput recursiv upload diff for testing
On Fri, Jul 13, 2012 at 03:23:26AM +0200, Jan Klemkow wrote: + char *cmd, *tp, *xargv[] = {argv[0], NULL, NULL}; Put spaces inside {}: { argv[0], NULL, NULL } It took me a while to figure out what that code does, so I think the comments are usefull for everybody who tries to read it. + /* + * Copy the hole directory recursivly. + */ It is spelled recursively. The file type information comes from this special remglob2() function. There is no equivalent thing in the context of mput(). So I check the local file type with stat(2) and S_ISDIR(). if (mflag confirm(argv[0], *cpp)) { + + /* + * If file is a directory then create a new one + * at the remote machine. + */ + stat(*cpp, filestat); + + if (S_ISDIR(filestat.st_mode)) { + + if (depth == max_depth) + continue; With maximum depth mput() may prompt for directories it will skip later. So move the check before the prompt like in mget(): if (!mflag) continue; if (stat(*cpp, filestat) == -1) continue; if (S_ISDIR(filestat.st_mode) depth == max_depth) continue; if (!confirm(argv[0], *cpp)) continue; if (S_ISDIR(filestat.st_mode)) { The makedir() function has no return value, so it is not posible at the moment to detect an error inside that function. + xargv[1] = *cpp; + makedir(2, xargv); + + /* + * Copy the hole directory recursivly. + */ + if (chdir(*cpp) != 0) { + warn(local: %s, *cpp); + continue; + } + + xargv[1] = *cpp; + cd(2, xargv); + if (dirchange != 1) { + mflag = 0; + goto out; + } To verify that makedir() succeeded, do a cd() immediately after it. Reorder the function calls like this: /* * Copy the hole directory recursivly. */ if (chdir(*cpp) != 0) { warn(local: %s, *cpp); continue; } xargv[1] = *cpp; makedir(2, xargv); cd(2, xargv); if (dirchange != 1) { mflag = 0; goto out; } bluhm
Re: ftp mput recursiv upload diff for testing
On Fri, Jul 13, 2012 at 06:58:48PM +0200, Alexander Bluhm wrote: On Fri, Jul 13, 2012 at 03:23:26AM +0200, Jan Klemkow wrote: + char *cmd, *tp, *xargv[] = {argv[0], NULL, NULL}; Put spaces inside {}: { argv[0], NULL, NULL } It took me a while to figure out what that code does, so I think the comments are usefull for everybody who tries to read it. + /* +* Copy the hole directory recursivly. +*/ It is spelled recursively. and whole... -Otto
Re: rt2560 bbp/antenna diff
Date: Sat, 7 Jul 2012 16:35:46 +0200 From: Stefan Sperling s...@openbsd.org rt2560 is selecting antennas before initialising the baseband processor (BBP), however initialising antennas involves tweaking of BBP registers. The diff below (taken from dragonfly, written by sephe) ensures antennas are selected after the BBP has been initialised. Part of this diff was committed in r1.26 of rt2560.c and subsequently backed out because it caused problems. Apparently the missing piece was a busy-wait loop before reading in rt2560_bbp_read(), which has since been added to dragonfly: commit dd8ea05f8d30bd38ecd334718e4263d8c56ce67a Author: Sepherosa Ziehau se...@dragonflybsd.org Date: Thu Apr 12 12:54:07 2007 + When read BBP registers, avoid writing to BBPCSR until it is no longer busy. After this bug fixing, TX/RX antenna setup can be safely put after BBP initialization, which is a correct place for it, since BBP initialization will overwrite RX antenna BBP register with default value. Before this bug fixing, putting TX/RX antenna setup after BBP initailization always results in strange TX/RX problems, which I experienced when I fiddled with my ASUS WL-107G; and some OpenBSD folks had this problems too, before Damien reverted related changes in OpenBSD. Tested with an RT2560 cardbus ral which still seems happy. Any testers/oks? ok kettenis@ Index: rt2560.c === RCS file: /cvs/src/sys/dev/ic/rt2560.c,v retrieving revision 1.58 diff -u -p -r1.58 rt2560.c --- rt2560.c 22 Feb 2011 20:05:03 - 1.58 +++ rt2560.c 7 Jul 2012 14:23:42 - @@ -2102,6 +2102,16 @@ rt2560_bbp_read(struct rt2560_softc *sc, uint32_t val; int ntries; + for (ntries = 0; ntries 100; ntries++) { + if (!(RAL_READ(sc, RT2560_BBPCSR) RT2560_BBP_BUSY)) + break; + DELAY(1); + } + if (ntries == 100) { + printf(%s: could not read from BBP\n, sc-sc_dev.dv_xname); + return 0; + } + val = RT2560_BBP_BUSY | reg 8; RAL_WRITE(sc, RT2560_BBPCSR, val); @@ -2626,8 +2636,6 @@ rt2560_init(struct ifnet *ifp) /* set basic rate set (will be updated later) */ RAL_WRITE(sc, RT2560_ARSP_PLCP_1, 0x153); - rt2560_set_txantenna(sc, 1); - rt2560_set_rxantenna(sc, 1); rt2560_set_slottime(sc); rt2560_update_plcp(sc); rt2560_update_led(sc, 0, 0); @@ -2639,6 +2647,9 @@ rt2560_init(struct ifnet *ifp) rt2560_stop(ifp, 1); return EIO; } + + rt2560_set_txantenna(sc, 1); + rt2560_set_rxantenna(sc, 1); /* set default BSS channel */ ic-ic_bss-ni_chan = ic-ic_ibss_chan;
Re: ral(4) tx/prio queue fixes (was: rt2560 tx/prio queue fixes)
Date: Fri, 13 Jul 2012 11:37:41 +0200 From: Stefan Sperling s...@openbsd.org On Tue, Jul 10, 2012 at 05:56:29PM +0200, Stefan Sperling wrote: Updated version that includes similar fixes for the rt2661 variants. This seems to help soekris-based ral APs that get stuck with the OACTIVE flag set (see the flags line in ifconfig ral0 output when the AP stops responding) and then require ifconfig ral0 down up to recover. It would be great to get some more testing. Thanks! Anyone want to OK this? ok kettenis@ We've been testing this with edd's soekris (rt2661 minipci) and two rt2560/rt2661 ralink cardbus cards. Index: rt2560.c === RCS file: /cvs/src/sys/dev/ic/rt2560.c,v retrieving revision 1.58 diff -u -p -r1.58 rt2560.c --- rt2560.c22 Feb 2011 20:05:03 - 1.58 +++ rt2560.c10 Jul 2012 15:34:21 - @@ -995,9 +995,14 @@ rt2560_tx_intr(struct rt2560_softc *sc) sc-txq.next = (sc-txq.next + 1) % RT2560_TX_RING_COUNT; } - sc-sc_tx_timer = 0; - ifp-if_flags = ~IFF_OACTIVE; - rt2560_start(ifp); + if (sc-txq.queued == 0 sc-prioq.queued == 0) + sc-sc_tx_timer = 0; + if (sc-txq.queued RT2560_TX_RING_COUNT - 1) { + sc-sc_flags = ~RT2560_DATA_OACTIVE; + if (!(sc-sc_flags (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE))) + ifp-if_flags = ~IFF_OACTIVE; + rt2560_start(ifp); + } } void @@ -1061,9 +1066,14 @@ rt2560_prio_intr(struct rt2560_softc *sc sc-prioq.next = (sc-prioq.next + 1) % RT2560_PRIO_RING_COUNT; } - sc-sc_tx_timer = 0; - ifp-if_flags = ~IFF_OACTIVE; - rt2560_start(ifp); + if (sc-txq.queued == 0 sc-prioq.queued == 0) + sc-sc_tx_timer = 0; + if (sc-prioq.queued RT2560_PRIO_RING_COUNT) { + sc-sc_flags = ~RT2560_PRIO_OACTIVE; + if (!(sc-sc_flags (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE))) + ifp-if_flags = ~IFF_OACTIVE; + rt2560_start(ifp); + } } /* @@ -1931,6 +1941,7 @@ rt2560_start(struct ifnet *ifp) if (m0 != NULL) { if (sc-prioq.queued = RT2560_PRIO_RING_COUNT) { ifp-if_flags |= IFF_OACTIVE; + sc-sc_flags |= RT2560_PRIO_OACTIVE; break; } IF_DEQUEUE(ic-ic_mgtq, m0); @@ -1952,6 +1963,7 @@ rt2560_start(struct ifnet *ifp) break; if (sc-txq.queued = RT2560_TX_RING_COUNT - 1) { ifp-if_flags |= IFF_OACTIVE; + sc-sc_flags |= RT2560_DATA_OACTIVE; break; } IFQ_DEQUEUE(ifp-if_snd, m0); @@ -2685,6 +2697,7 @@ rt2560_stop(struct ifnet *ifp, int disab struct ieee80211com *ic = sc-sc_ic; sc-sc_tx_timer = 0; + sc-sc_flags = ~(RT2560_PRIO_OACTIVE|RT2560_DATA_OACTIVE); ifp-if_timer = 0; ifp-if_flags = ~(IFF_RUNNING | IFF_OACTIVE); Index: rt2560var.h === RCS file: /cvs/src/sys/dev/ic/rt2560var.h,v retrieving revision 1.9 diff -u -p -r1.9 rt2560var.h --- rt2560var.h 7 Sep 2010 16:21:42 - 1.9 +++ rt2560var.h 7 Jul 2012 15:58:58 - @@ -116,6 +116,8 @@ struct rt2560_softc { #define RT2560_ENABLED (1 0) #define RT2560_UPDATE_SLOT (1 1) #define RT2560_SET_SLOTTIME(1 2) +#define RT2560_PRIO_OACTIVE(1 3) +#define RT2560_DATA_OACTIVE(1 4) int sc_tx_timer; Index: rt2661.c === RCS file: /cvs/src/sys/dev/ic/rt2661.c,v retrieving revision 1.65 diff -u -p -r1.65 rt2661.c --- rt2661.c18 Mar 2011 06:05:21 - 1.65 +++ rt2661.c10 Jul 2012 15:38:03 - @@ -986,9 +986,18 @@ rt2661_tx_intr(struct rt2661_softc *sc) txq-stat = 0; } - sc-sc_tx_timer = 0; - ifp-if_flags = ~IFF_OACTIVE; - rt2661_start(ifp); + if (sc-mgtq.queued == 0 sc-txq[0].queued == 0) + sc-sc_tx_timer = 0; + if (sc-mgtq.queued RT2661_MGT_RING_COUNT + sc-txq[0].queued RT2661_TX_RING_COUNT - 1) { + if (sc-mgtq.queued RT2661_MGT_RING_COUNT) + sc-sc_flags = ~RT2661_MGT_OACTIVE; + if (sc-txq[0].queued RT2661_TX_RING_COUNT - 1) + sc-sc_flags = ~RT2661_DATA_OACTIVE; + if (!(sc-sc_flags (RT2661_MGT_OACTIVE|RT2661_DATA_OACTIVE))) + ifp-if_flags = ~IFF_OACTIVE; + rt2661_start(ifp); + } } void @@ -1805,6 +1814,7 @@ rt2661_start(struct ifnet
Re: fun with libtool for masochistic guys
Okay, current decision is to actually pass options we do not understand to cc, and to look harder at options. So far, this is actually finding problems in ports. Stuff that would be completely ignored, or miscompiled. Check ports-changes@ for details.
Fix type of WSKBDIO_?ETENCODING in wsconsctl.
From NetBSD -- Alexandr Shadchin Index: keyboard.c === RCS file: /cvs/src/sbin/wsconsctl/keyboard.c,v retrieving revision 1.10 diff -u -p -r1.10 keyboard.c --- keyboard.c 20 Aug 2010 00:20:55 - 1.10 +++ keyboard.c 13 Jul 2012 17:47:35 - @@ -49,7 +49,7 @@ struct wskbd_map_data kbmap = { KS_NUMKE static struct wskbd_keyrepeat_data repeat; static struct wskbd_keyrepeat_data dfrepeat; static int ledstate; -static int kbdencoding; +static kbd_t kbdencoding; struct field keyboard_field_tab[] = { { type, kbtype,FMT_KBDTYPE,FLG_RDONLY },
some more net80211 node leaks
The ieee80211_dup_bss() function internally calls ieee80211_alloc_node_helper(), which means we should check the node cache for an existing entry before calling ieee80211_dup_bss(). ieee80211_node.c already does this but there are some instances in ieee80211_input.c where we fail to check for existing cache entries first. This can leak nodes and distort our idea of how many nodes are in the cache. The diff below also prints a warning if the interface is in debug mode and a potential node leak is detected during the node cache cleanup timeout, which runs once per hour. This might make spotting such bugs easier in the future. Index: ieee80211_input.c === RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.120 diff -u -p -r1.120 ieee80211_input.c --- ieee80211_input.c 13 Jul 2012 11:25:04 - 1.120 +++ ieee80211_input.c 13 Jul 2012 17:47:15 - @@ -401,7 +401,9 @@ ieee80211_input(struct ifnet *ifp, struc DPRINTF((data from unknown src %s\n, ether_sprintf(wh-i_addr2))); /* NB: caller deals with reference */ - ni = ieee80211_dup_bss(ic, wh-i_addr2); + ni = ieee80211_find_node(ic, wh-i_addr2); + if (ni == NULL) + ni = ieee80211_dup_bss(ic, wh-i_addr2); if (ni != NULL) { IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_DEAUTH, @@ -1725,7 +1727,9 @@ ieee80211_recv_probe_req(struct ieee8021 } if (ni == ic-ic_bss) { - ni = ieee80211_dup_bss(ic, wh-i_addr2); + ni = ieee80211_find_node(ic, wh-i_addr2); + if (ni == NULL) + ni = ieee80211_dup_bss(ic, wh-i_addr2); if (ni == NULL) return; DPRINTF((new probe req from %s\n, @@ -1905,7 +1909,9 @@ ieee80211_recv_assoc_req(struct ieee8021 DPRINTF((deny %sassoc from %s, not authenticated\n, reassoc ? re : , ether_sprintf((u_int8_t *)wh-i_addr2))); - ni = ieee80211_dup_bss(ic, wh-i_addr2); + ni = ieee80211_find_node(ic, wh-i_addr2); + if (ni == NULL) + ni = ieee80211_dup_bss(ic, wh-i_addr2); if (ni != NULL) { IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_DEAUTH, Index: ieee80211_node.c === RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v retrieving revision 1.69 diff -u -p -r1.69 ieee80211_node.c --- ieee80211_node.c13 Jul 2012 09:46:33 - 1.69 +++ ieee80211_node.c13 Jul 2012 18:12:27 - @@ -1150,6 +1150,10 @@ ieee80211_clean_nodes(struct ieee80211co struct ieee80211_node *ni, *next_ni; u_int gen = ic-ic_scangen++; /* NB: ok 'cuz single-threaded*/ int s; +#ifndef IEEE80211_STA_ONLY + int nnodes = 0; + struct ifnet *ifp = ic-ic_if; +#endif s = splnet(); for (ni = RB_MIN(ieee80211_tree, ic-ic_tree); @@ -1159,6 +1163,9 @@ ieee80211_clean_nodes(struct ieee80211co break; if (ni-ni_scangen == gen) /* previously handled */ continue; +#ifndef IEEE80211_STA_ONLY + nnodes++; +#endif ni-ni_scangen = gen; if (ni-ni_refcnt 0) continue; @@ -1195,6 +1202,7 @@ ieee80211_clean_nodes(struct ieee80211co * the driver calls ieee80211_release_node(). */ #ifndef IEEE80211_STA_ONLY + nnodes--; if (ic-ic_opmode == IEEE80211_M_HOSTAP ni-ni_state = IEEE80211_STA_AUTH ni-ni_state != IEEE80211_STA_COLLECT) { @@ -1209,6 +1217,20 @@ ieee80211_clean_nodes(struct ieee80211co ieee80211_free_node(ic, ni); ic-ic_stats.is_node_timeout++; } + +#ifndef IEEE80211_STA_ONLY + /* +* During a cache timeout we iterate over all nodes. +* Check for node leaks by comparing the actual number of cached +* nodes with the ic_nnodes count, which is maintained while adding +* and removing nodes from the cache. +*/ + if ((ifp-if_flags IFF_DEBUG) cache_timeout + nnodes != ic-ic_nnodes) + printf(%s: number of cached nodes is %d, expected %d, + possible nodes leak\n, ifp-if_xname, nnodes, + ic-ic_nnodes); +#endif splx(s); }
Re: some more net80211 node leaks
On Fri, Jul 13, 2012 at 08:16:56PM +0200, Stefan Sperling wrote: The ieee80211_dup_bss() function internally calls ieee80211_alloc_node_helper(), which means we should check the node cache for an existing entry before calling ieee80211_dup_bss(). ieee80211_node.c already does this but there are some instances in ieee80211_input.c where we fail to check for existing cache entries first. This can leak nodes and distort our idea of how many nodes are in the cache. The diff below also prints a warning if the interface is in debug mode and a potential node leak is detected during the node cache cleanup timeout, which runs once per hour. This might make spotting such bugs easier in the future. Additional tweaks: Update the ic_nnodes counter, which tracks the number of nodes in the RB tree, near the RB_INSERT call in ieee80211_setup_node(). The corresponding decrement is already located near the RB_FREE. Assert that we're at IPL_NET when decrementing the counter (there are currently no calls to this function outside of IPL_NET but this makes the requirement explicit). Index: ieee80211_input.c === RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.120 diff -u -p -r1.120 ieee80211_input.c --- ieee80211_input.c 13 Jul 2012 11:25:04 - 1.120 +++ ieee80211_input.c 13 Jul 2012 17:47:15 - @@ -401,7 +401,9 @@ ieee80211_input(struct ifnet *ifp, struc DPRINTF((data from unknown src %s\n, ether_sprintf(wh-i_addr2))); /* NB: caller deals with reference */ - ni = ieee80211_dup_bss(ic, wh-i_addr2); + ni = ieee80211_find_node(ic, wh-i_addr2); + if (ni == NULL) + ni = ieee80211_dup_bss(ic, wh-i_addr2); if (ni != NULL) { IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_DEAUTH, @@ -1725,7 +1727,9 @@ ieee80211_recv_probe_req(struct ieee8021 } if (ni == ic-ic_bss) { - ni = ieee80211_dup_bss(ic, wh-i_addr2); + ni = ieee80211_find_node(ic, wh-i_addr2); + if (ni == NULL) + ni = ieee80211_dup_bss(ic, wh-i_addr2); if (ni == NULL) return; DPRINTF((new probe req from %s\n, @@ -1905,7 +1909,9 @@ ieee80211_recv_assoc_req(struct ieee8021 DPRINTF((deny %sassoc from %s, not authenticated\n, reassoc ? re : , ether_sprintf((u_int8_t *)wh-i_addr2))); - ni = ieee80211_dup_bss(ic, wh-i_addr2); + ni = ieee80211_find_node(ic, wh-i_addr2); + if (ni == NULL) + ni = ieee80211_dup_bss(ic, wh-i_addr2); if (ni != NULL) { IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_DEAUTH, Index: ieee80211_node.c === RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v retrieving revision 1.69 diff -u -p -r1.69 ieee80211_node.c --- ieee80211_node.c13 Jul 2012 09:46:33 - 1.69 +++ ieee80211_node.c13 Jul 2012 18:23:25 - @@ -189,8 +189,6 @@ ieee80211_alloc_node_helper(struct ieee8 if (ic-ic_nnodes = ic-ic_max_nnodes) return NULL; ni = (*ic-ic_node_alloc)(ic); - if (ni != NULL) - ic-ic_nnodes++; return ni; } @@ -815,6 +813,7 @@ ieee80211_setup_node(struct ieee80211com #endif s = splnet(); RB_INSERT(ieee80211_tree, ic-ic_tree, ni); + ic-ic_nnodes++; splx(s); } @@ -1081,6 +1080,8 @@ ieee80211_free_node(struct ieee80211com if (ni == ic-ic_bss) panic(freeing bss node); + splassert(IPL_NET); + DPRINTF((%s\n, ether_sprintf(ni-ni_macaddr))); #ifndef IEEE80211_STA_ONLY timeout_del(ni-ni_eapol_to); @@ -1150,6 +1151,10 @@ ieee80211_clean_nodes(struct ieee80211co struct ieee80211_node *ni, *next_ni; u_int gen = ic-ic_scangen++; /* NB: ok 'cuz single-threaded*/ int s; +#ifndef IEEE80211_STA_ONLY + int nnodes = 0; + struct ifnet *ifp = ic-ic_if; +#endif s = splnet(); for (ni = RB_MIN(ieee80211_tree, ic-ic_tree); @@ -1159,6 +1164,9 @@ ieee80211_clean_nodes(struct ieee80211co break; if (ni-ni_scangen == gen) /* previously handled */ continue; +#ifndef IEEE80211_STA_ONLY + nnodes++; +#endif ni-ni_scangen = gen; if (ni-ni_refcnt 0) continue; @@ -1195,6 +1203,7 @@
Re: garbage collect USE_GCC3/TARGET_USE_GCC3/4
On Thu, Jul 05, 2012 at 09:40:00PM -0400, Brad Smith wrote: This garbage collects the USE_GCC3/TARGET_USE_GCC3/4 variables within bsd.own.mk and Makefile.cross. I removed the last few instances of USE_GCC3 within the ports tree a number of releases ago and TARGET_USE_GCC3/4 was never used for anything. ping. Index: Makefile.cross === RCS file: /home/cvs/src/Makefile.cross,v retrieving revision 1.50 diff -u -p -r1.50 Makefile.cross --- Makefile.cross12 Nov 2011 18:32:35 - 1.50 +++ Makefile.cross10 Mar 2012 10:49:53 - @@ -93,14 +93,10 @@ OLD_BINUTILS_ARCH=m68k m88k vax .for _arch in ${TARGET_ARCH} .if !empty(GCC2_ARCH:M${_arch}) -USE_GCC3?=no -TARGET_USE_GCC3=No COMPILER_VERSION?=gcc2 .elif !empty(GCC4_ARCH:M${_arch}) -TARGET_USE_GCC4=Yes COMPILER_VERSION?=gcc4 .else -TARGET_USE_GCC3=Yes COMPILER_VERSION?=gcc3 .endif Index: share/mk/bsd.own.mk === RCS file: /home/cvs/src/share/mk/bsd.own.mk,v retrieving revision 1.114 diff -u -p -r1.114 bsd.own.mk --- share/mk/bsd.own.mk 25 Nov 2011 05:25:25 - 1.114 +++ share/mk/bsd.own.mk 10 Mar 2012 10:50:52 - @@ -38,12 +38,10 @@ BINUTILS217_ARCH=avr32 hppa64 ia64 .for _arch in ${MACHINE_ARCH} .if !empty(GCC2_ARCH:M${_arch}) -USE_GCC3?=no COMPILER_VERSION?=gcc2 .elif !empty(GCC4_ARCH:M${_arch}) COMPILER_VERSION?=gcc4 .else -USE_GCC3?=yes COMPILER_VERSION?=gcc3 .endif -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: Fix type of WSKBDIO_?ETENCODING in wsconsctl.
more fix type -- Alexandr Shadchin Index: display.c === RCS file: /cvs/src/sbin/wsconsctl/display.c,v retrieving revision 1.16 diff -u -p -r1.16 display.c --- display.c 20 Aug 2010 00:20:55 - 1.16 +++ display.c 13 Jul 2012 22:09:02 - @@ -40,7 +40,7 @@ #include string.h #include wsconsctl.h -int dpytype; +u_int dpytype; u_int width, height, depth; int focus; struct field_pc brightness, contrast, backlight; Index: keyboard.c === RCS file: /cvs/src/sbin/wsconsctl/keyboard.c,v retrieving revision 1.10 diff -u -p -r1.10 keyboard.c --- keyboard.c 20 Aug 2010 00:20:55 - 1.10 +++ keyboard.c 13 Jul 2012 22:09:02 - @@ -40,7 +40,7 @@ #include stdio.h #include wsconsctl.h -static int kbtype; +static u_int kbtype; static struct wskbd_bell_data bell; static struct wskbd_bell_data dfbell; static struct wscons_keymap mapdata[KS_NUMKEYCODES]; @@ -49,7 +49,7 @@ struct wskbd_map_data kbmap = { KS_NUMKE static struct wskbd_keyrepeat_data repeat; static struct wskbd_keyrepeat_data dfrepeat; static int ledstate; -static int kbdencoding; +static kbd_t kbdencoding; struct field keyboard_field_tab[] = { { type, kbtype,FMT_KBDTYPE,FLG_RDONLY }, Index: mouse.c === RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v retrieving revision 1.11 diff -u -p -r1.11 mouse.c --- mouse.c 20 Aug 2010 00:20:55 - 1.11 +++ mouse.c 13 Jul 2012 22:09:03 - @@ -39,9 +39,9 @@ #include stdio.h #include wsconsctl.h -static int mstype; -static int resolution; -static int samplerate; +static u_int mstype; +static u_int resolution; +static u_int samplerate; static int rawmode; struct wsmouse_calibcoords wmcoords, wmcoords_save;
cleanup wsconsctl 1/4
zap whitespace -- Alexandr Shadchin Index: keysym.c === RCS file: /cvs/src/sbin/wsconsctl/keysym.c,v retrieving revision 1.6 diff -u -p -r1.6 keysym.c --- keysym.c28 Jun 2010 20:40:39 - 1.6 +++ keysym.c13 Jul 2012 21:32:18 - @@ -160,7 +160,7 @@ ksym2name(int k) if (first_time) sort_ksym_tab(); - + r = bsearch(k, ksym_tab_by_ksym, NUMKSYMS, sizeof(struct ksym), bcmp_ksym_enc); Index: mouse.c === RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v retrieving revision 1.11 diff -u -p -r1.11 mouse.c --- mouse.c 20 Aug 2010 00:20:55 - 1.11 +++ mouse.c 13 Jul 2012 21:32:18 - @@ -44,7 +44,7 @@ static int resolution; static int samplerate; static int rawmode; -struct wsmouse_calibcoords wmcoords, wmcoords_save; +struct wsmouse_calibcoords wmcoords, wmcoords_save; struct field mouse_field_tab[] = { { resolution,resolution,FMT_UINT, FLG_WRONLY }, @@ -61,8 +61,8 @@ mouse_get_values(int fd) if (field_by_value(mouse_field_tab, mstype)-flags FLG_GET) if (ioctl(fd, WSMOUSEIO_GTYPE, mstype) 0) warn(WSMOUSEIO_GTYPE); - - if (field_by_value(mouse_field_tab, rawmode)-flags FLG_GET) { + + if (field_by_value(mouse_field_tab, rawmode)-flags FLG_GET) { if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, wmcoords) 0) { if (errno == ENOTTY) field_by_value(mouse_field_tab, @@ -80,7 +80,7 @@ mouse_get_values(int fd) wmcoords)-flags |= FLG_DEAD; else warn(WSMOUSEIO_GCALIBCOORDS); - } + } } int @@ -98,7 +98,7 @@ mouse_put_values(int fd) return 1; } } - if (field_by_value(mouse_field_tab, rawmode)-flags FLG_SET) { + if (field_by_value(mouse_field_tab, rawmode)-flags FLG_SET) { wmcoords.samplelen = rawmode; if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, wmcoords) 0) { if (errno == ENOTTY) { Index: util.c === RCS file: /cvs/src/sbin/wsconsctl/util.c,v retrieving revision 1.57 diff -u -p -r1.57 util.c --- util.c 17 Apr 2012 14:53:47 - 1.57 +++ util.c 13 Jul 2012 21:32:18 - @@ -45,7 +45,7 @@ extern struct wskbd_map_data kbmap;/* from keyboard.c */ extern struct wskbd_map_data newkbmap; /* from map_parse.y */ -extern struct wsmouse_calibcoords wmcoords;/* from mouse.c */ +extern struct wsmouse_calibcoords wmcoords;/* from mouse.c */ struct nameint { int value; Index: wsconsctl.c === RCS file: /cvs/src/sbin/wsconsctl/wsconsctl.c,v retrieving revision 1.26 diff -u -p -r1.26 wsconsctl.c --- wsconsctl.c 20 Aug 2010 00:20:55 - 1.26 +++ wsconsctl.c 13 Jul 2012 21:32:18 - @@ -125,7 +125,7 @@ main(int argc, char *argv[]) if (!device || errno != ENXIO) { if (device errno != ENOENT) { warn(%s, device); - error = 1; + error = 1; } break; } else @@ -319,7 +319,7 @@ tab_by_name(const char *var, int *idx) } } else i = 0; - + *idx = i; return (sw);
cleanup wsconsctl 2/4
fix typo -- Alexandr Shadchin Index: map_parse.y === RCS file: /cvs/src/sbin/wsconsctl/map_parse.y,v retrieving revision 1.6 diff -u -p -r1.6 map_parse.y --- map_parse.y 14 May 2012 06:19:51 - 1.6 +++ map_parse.y 13 Jul 2012 19:41:53 - @@ -41,7 +41,7 @@ * The first symbol may be a command. * The following symbols are assigned * to the normal and altgr groups. - * Missing symbols are generated automacically + * Missing symbols are generated automatically * as either the upper case variant or the * normal group. */
cleanup wsconsctl 3/4
ansify -- Alexandr Shadchin Index: map_scan.l === RCS file: /cvs/src/sbin/wsconsctl/map_scan.l,v retrieving revision 1.3 diff -u -p -r1.3 map_scan.l --- map_scan.l 26 Jun 2008 05:42:06 - 1.3 +++ map_scan.l 13 Jul 2012 21:20:13 - @@ -41,8 +41,7 @@ #define yywrap() 1 void -map_scan_setinput(str) - char *str; +map_scan_setinput(char *str) { yy_scan_string(str); } Index: wsconsctl.c === RCS file: /cvs/src/sbin/wsconsctl/wsconsctl.c,v retrieving revision 1.26 diff -u -p -r1.26 wsconsctl.c --- wsconsctl.c 20 Aug 2010 00:20:55 - 1.26 +++ wsconsctl.c 13 Jul 2012 21:20:13 - @@ -66,7 +66,7 @@ struct vartypesw { struct vartypesw *tab_by_name(const char *, int *); void -usage() +usage(void) { fprintf(stderr, usage: %s [-an]\n
cleanup wsconsctl 4/4
add options noinput and noyywrap -- Alexandr Shadchin Index: map_scan.l === RCS file: /cvs/src/sbin/wsconsctl/map_scan.l,v retrieving revision 1.3 diff -u -p -r1.3 map_scan.l --- map_scan.l 26 Jun 2008 05:42:06 - 1.3 +++ map_scan.l 13 Jul 2012 23:07:16 - @@ -38,8 +38,6 @@ #include wsconsctl.h #include y.tab.h -#define yywrap() 1 - void map_scan_setinput(str) char *str; @@ -48,6 +46,9 @@ map_scan_setinput(str) } %} + +%option noyywrap +%option noinput %%