ix(4) and Unsupported SFP+ Module
Hi, On a 5.6-release I have an ix card which refuses to work with unsupported SFP+ modules, saying this : ix0 at pci1 dev 0 function 0 Intel 82599 rev 0x01Unsupported SFP+ Module. However, this seems to be an artificial limitation of the ix driver : the following diff (against sys.tar.gz as of 5.6-release) allows my SFP+ and it works fine so far. The patch was made in a hurry, so I probably have cut more than I should... Is there a simpler/better way to fix this ? diff -nur sys-ori/dev/pci/ixgbe_phy.c sys/dev/pci/ixgbe_phy.c --- sys-ori/dev/pci/ixgbe_phy.cMon Aug 5 21:58:06 2013 +++ sys/dev/pci/ixgbe_phy.cFri Dec 5 10:09:54 2014 @@ -1015,10 +1015,6 @@ /* LAN ID is needed for sfp_type determination */ hw-mac.ops.set_lan_id(hw); -if (identifier != IXGBE_SFF_IDENTIFIER_SFP) { -hw-phy.type = ixgbe_phy_sfp_unsupported; -status = IXGBE_ERR_SFP_NOT_SUPPORTED; -} else { status = hw-phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_1GBE_COMP_CODES, comp_codes_1g); @@ -1196,17 +1192,6 @@ goto out; } -/* Verify supported 1G SFP modules */ -if (comp_codes_10g == 0 -!(hw-phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || - hw-phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || - hw-phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || - hw-phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { -hw-phy.type = ixgbe_phy_sfp_unsupported; -status = IXGBE_ERR_SFP_NOT_SUPPORTED; -goto out; -} - /* Anything else 82598-based is supported */ if (hw-mac.type == ixgbe_mac_82598EB) { status = IXGBE_SUCCESS; @@ -1215,23 +1200,7 @@ if (hw-mac.type != ixgbe_mac_82598EB) ixgbe_get_device_caps_generic(hw, enforce_sfp); -if (!(enforce_sfp IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) -!(hw-phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || - hw-phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || - hw-phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || - hw-phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { -/* Make sure we're a supported PHY type */ -if (hw-phy.type == ixgbe_phy_sfp_intel) { -status = IXGBE_SUCCESS; -} else { -DEBUGOUT(SFP+ module not supported\n); -hw-phy.type = ixgbe_phy_sfp_unsupported; -status = IXGBE_ERR_SFP_NOT_SUPPORTED; -} -} else { -status = IXGBE_SUCCESS; -} -} +status = IXGBE_SUCCESS; out: return status; @@ -1262,9 +1231,6 @@ uint16_t sfp_type = hw-phy.sfp_type; DEBUGFUNC(ixgbe_get_sfp_init_sequence_offsets); - -if (hw-phy.sfp_type == ixgbe_sfp_type_unknown) -return IXGBE_ERR_SFP_NOT_SUPPORTED; if (hw-phy.sfp_type == ixgbe_sfp_type_not_present) return IXGBE_ERR_SFP_NOT_PRESENT;
Re: ix(4) and Unsupported SFP+ Module
On 12/05/14 13:08, Mike Belopuhov wrote: On Fri, Dec 05, 2014 at 11:24 +0100, Gabriel Linder wrote: Hi, On a 5.6-release I have an ix card which refuses to work with unsupported SFP+ modules, saying this : ix0 at pci1 dev 0 function 0 Intel 82599 rev 0x01Unsupported SFP+ Module. However, this seems to be an artificial limitation of the ix driver : the following diff (against sys.tar.gz as of 5.6-release) allows my SFP+ and it works fine so far. The patch was made in a hurry, so I probably have cut more than I should... Is there a simpler/better way to fix this ? I think this is roughly what I have recently committed to -current. But hey, thanks for taking your time for looking into this! Thanks you Mike and Jonathan for answering, I will backport your diff then :)
relayd redirects : forward [with synproxy] to web_pool check tcp
It is sometimes desirable to enable synproxy when using relayd's redirects, this diff allow just that. In case it gets mangled : http://dargor.servebeer.com/~dargor/openbsd/relayd-forward-with-synproxy.diff ok ? Index: parse.y === RCS file: /cvs/src/usr.sbin/relayd/parse.y,v retrieving revision 1.182 diff -u -p -r1.182 parse.y --- parse.y 12 May 2014 14:28:22 - 1.182 +++ parse.y 29 May 2014 00:15:28 - @@ -160,16 +160,17 @@ typedef struct { %token NODELAY NOTHING ON PARENT PATH PORT PREFORK PRIORITY PROTO %token QUERYSTR REAL REDIRECT RELAY REMOVE REQUEST RESPONSE RETRY %token RETURN ROUNDROBIN ROUTE SACK SCRIPT SEND SESSION SNMP SOCKET SPLICE -%token SSL STICKYADDR STYLE TABLE TAG TCP TIMEOUT TO ROUTER RTLABEL +%token SSL STICKYADDR STYLE SYNPROXY TABLE TAG TCP TIMEOUT TO ROUTER RTLABEL %token TRANSPARENT TRAP UPDATES URL VIRTUAL WITH TTL RTABLE MATCH %token RANDOM LEASTSTATES SRCHASH KEY CERTIFICATE PASSWORD ECDH CURVE %token v.stringSTRING -%token v.number NUMBER +%token v.numberNUMBER %type v.stringhostname interface table optstring %type v.numberhttp_type loglevel mark trap %type v.numberdirection dstmode flag forwardmode retry %type v.numberoptssl optsslclient sslcache %type v.numberredirect_proto relay_proto match +%type v.numberrdrsynproxy %type v.port port %type v.host host %type v.addr address @@ -467,63 +468,69 @@ rdropts_l : rdropts_l rdroptsl nl | rdroptsl optnl ; -rdroptsl : forwardmode TO tablespec interface{ +rdrsynproxy: /*empty*/ { $$ = 0; } + | WITH SYNPROXY { $$ = 1; } + ; + +rdroptsl : forwardmode rdrsynproxy TO tablespec interface{ switch ($1) { case FWD_NORMAL: - if ($4 == NULL) + if ($5 == NULL) break; yyerror(superfluous interface); - free($4); + free($5); YYERROR; case FWD_ROUTE: - if ($4 != NULL) + if ($5 != NULL) break; yyerror(missing interface to route to); - free($4); + free($5); YYERROR; case FWD_TRANS: yyerror(no transparent forward here); - if ($4 != NULL) - free($4); + if ($5 != NULL) + free($5); YYERROR; } - if ($4 != NULL) { - if (strlcpy($3-conf.ifname, $4, - sizeof($3-conf.ifname)) = - sizeof($3-conf.ifname)) { + if ($5 != NULL) { + if (strlcpy($4-conf.ifname, $5, + sizeof($4-conf.ifname)) = + sizeof($4-conf.ifname)) { yyerror(interface name truncated); - free($4); + free($5); YYERROR; } - free($4); + free($5); } - if ($3-conf.check == CHECK_NOCHECK) { - yyerror(table %s has no check, $3-conf.name); - purge_table(conf-sc_tables, $3); + if ($4-conf.check == CHECK_NOCHECK) { + yyerror(table %s has no check, $4-conf.name); + purge_table(conf-sc_tables, $4); YYERROR; } if (rdr-backup) { yyerror(only one backup table is allowed); - purge_table(conf-sc_tables, $3); + purge_table(conf-sc_tables, $4); YYERROR; } if (rdr-table) { - rdr-backup = $3; - rdr-conf.backup_id = $3-conf.id; + rdr-backup = $4; + rdr-conf.backup_id = $4-conf.id; if (dstmode != rdr-conf.mode) {
Sync pthread_set_name_np.3 with pthread_np.h
Index: pthread_set_name_np.3 === RCS file: /cvs/src/lib/libpthread/man/pthread_set_name_np.3,v retrieving revision 1.5 diff -u -p -r1.5 pthread_set_name_np.3 --- pthread_set_name_np.3 5 Jun 2013 03:44:50 - 1.5 +++ pthread_set_name_np.3 6 Mar 2014 07:59:58 - @@ -10,7 +10,7 @@ .In pthread.h .In pthread_np.h .Ft void -.Fn pthread_set_name_np pthread_t thread char *name +.Fn pthread_set_name_np pthread_t thread const char *name .Sh DESCRIPTION The .Fn pthread_set_name_np
Typos in net/bpf.h
While learning how to use BPF I fumbled on this, clarification is needed imho. ok ? Index: sys/net/bpf.h === RCS file: /cvs/src/sys/net/bpf.h,v retrieving revision 1.43 diff -u -r1.43 bpf.h --- sys/net/bpf.h26 Mar 2012 19:37:42 -1.43 +++ sys/net/bpf.h22 Mar 2013 14:48:21 - @@ -73,12 +73,12 @@ }; /* - * Struct return by BIOCVERSION. This represents the version number of + * Struct returned by BIOCVERSION. This represents the version number of * the filter language described by the instruction encodings below. - * bpf understands a program iff kernel_major == filter_major + * bpf understands a program if kernel_major == filter_major * kernel_minor = filter_minor, that is, if the value returned by the * running kernel has the same major number and a minor number equal - * equal to or less than the filter being downloaded. Otherwise, the + * to or greater than the filter being downloaded. Otherwise, the * results are undefined, meaning an error may be returned or packets * may be accepted haphazardly. * It has nothing to do with the source code version.
Re: Typos in net/bpf.h
On 03/22/13 17:25, Philip Guenther wrote: On Fri, Mar 22, 2013 at 7:53 AM, Gabriel Linder lin...@jeuxvideo.com wrote: - * bpf understands a program iff kernel_major == filter_major + * bpf understands a program if kernel_major == filter_major Not a typo: iff is a shorthand for if and only if that was inherited from the mathematics community. I did not know that, thanks. Maybe it should be spelled in full letters then ?
Re: Typos in net/bpf.h
On 03/22/13 17:38, Theo de Raadt wrote: On 03/22/13 17:25, Philip Guenther wrote: On Fri, Mar 22, 2013 at 7:53 AM, Gabriel Linder lin...@jeuxvideo.com wrote: - * bpf understands a program iff kernel_major == filter_major + * bpf understands a program if kernel_major == filter_major Not a typo: iff is a shorthand for if and only if that was inherited from the mathematics community. I did not know that, thanks. Maybe it should be spelled in full letters then ? iff is a useful technical word which avoids us typing it out in full every time. If we replaced such simple words everytime someone didn't understand them, eventually our in-line code would be full of babytalk. Makes sense. What about the rest of the diff ? Index: bpf.h === RCS file: /cvs/src/sys/net/bpf.h,v retrieving revision 1.43 diff -u -r1.43 bpf.h --- bpf.h 26 Mar 2012 19:37:42 - 1.43 +++ bpf.h 22 Mar 2013 16:44:35 - @@ -73,12 +73,12 @@ }; /* - * Struct return by BIOCVERSION. This represents the version number of + * Struct returned by BIOCVERSION. This represents the version number of * the filter language described by the instruction encodings below. * bpf understands a program iff kernel_major == filter_major * kernel_minor = filter_minor, that is, if the value returned by the * running kernel has the same major number and a minor number equal - * equal to or less than the filter being downloaded. Otherwise, the + * to or greater than the filter being downloaded. Otherwise, the * results are undefined, meaning an error may be returned or packets * may be accepted haphazardly. * It has nothing to do with the source code version.
Re: Send hostname to remote host with syslogd
On 02/07/13 17:38, Bob Beck wrote: This looks correct to me. Does this diff have a chance to be committed then ? On Thu, Feb 7, 2013 at 5:08 AM, Markus Friedl mfri...@gmail.com wrote: fwiw, this is what i have in my tree for some time now: Index: syslogd.c === RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v retrieving revision 1.104 diff -u -p -u -r1.104 syslogd.c --- syslogd.c 12 Jul 2011 11:28:31 - 1.104 +++ syslogd.c 7 Feb 2013 12:05:16 - @@ -195,6 +195,7 @@ int MarkInterval = 20 * 60; /* interval intMarkSeq = 0;/* mark sequence number */ intSecureMode = 1; /* when true, speak only unix domain socks */ intNoDNS = 0; /* when true, will refrain from doing DNS lookups */ +intIncludeHostname = 0;/* include RFC 3164 style hostnames when forwarding */ char *ctlsock_path = NULL; /* Path to control socket */ @@ -289,7 +290,7 @@ main(int argc, char *argv[]) struct addrinfo hints, *res, *res0; FILE *fp; - while ((ch = getopt(argc, argv, dnuf:m:p:a:s:)) != -1) + while ((ch = getopt(argc, argv, dhnuf:m:p:a:s:)) != -1) switch (ch) { case 'd': /* debug */ Debug++; @@ -297,6 +298,9 @@ main(int argc, char *argv[]) case 'f': /* configuration file */ ConfFile = optarg; break; + case 'h': /* RFC 3164 hostnames */ + IncludeHostname = 1; + break; case 'm': /* mark interval */ MarkInterval = atoi(optarg) * 60; break; @@ -611,7 +615,7 @@ usage(void) { (void)fprintf(stderr, - usage: syslogd [-dnu] [-a path] [-f config_file] [-m mark_interval]\n + usage: syslogd [-dnuh] [-a path] [-f config_file] [-m mark_interval]\n [-p log_socket] [-s reporting_socket]\n); exit(1); } @@ -888,8 +892,10 @@ fprintlog(struct filed *f, int flags, ch case F_FORW: dprintf( %s\n, f-f_un.f_forw.f_hname); - if ((l = snprintf(line, sizeof(line), %d%.15s %s, + if ((l = snprintf(line, sizeof(line), %d%.15s %s%s%s, f-f_prevpri, (char *)iov[0].iov_base, + IncludeHostname ? LocalHostName : , + IncludeHostname ? : , (char *)iov[4].iov_base)) = sizeof(line) || l == -1) l = strlen(line); if (sendto(pfd[PFD_INET].fd, line, l, 0,
Re: Send hostname to remote host with syslogd
On 02/01/13 15:30, Gabriel Linder wrote: On 02/01/13 11:57, Stuart Henderson wrote: I'm a bit undecided as to whether this is really useful (I suppose having it _in addition_ to the IP address might be useful where there's a NAT between log source and destination) but in any event if it's done, I think it should be optional and off by default; it changes the established format and eats into a limited 1K max line length. I will submit a new patch implementing this behaviour, then. And here it is. I tried to configure Thunderbird following git-format-patch(1), but just in case the diff is available at http://dargor.servebeer.com/~dargor/openbsd/syslogd.diff Index: syslogd.8 === RCS file: /cvs/src/usr.sbin/syslogd/syslogd.8,v retrieving revision 1.26 diff -u -r1.26 syslogd.8 --- syslogd.822 Oct 2009 15:02:13 -1.26 +++ syslogd.81 Feb 2013 16:06:53 - @@ -39,7 +39,7 @@ .Sh SYNOPSIS .Nm syslogd .Bk -words -.Op Fl dnu +.Op Fl Ndnu .Op Fl a Ar path .Op Fl f Ar config_file .Op Fl m Ar mark_interval @@ -54,6 +54,8 @@ .Pp The options are as follows: .Bl -tag -width Ds +.It Fl N +When logging to a remote host, send the local hostname with the log message. .It Fl a Pa path Specify a location where .Nm Index: syslogd.c === RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v retrieving revision 1.104 diff -u -r1.104 syslogd.c --- syslogd.c12 Jul 2011 11:28:31 -1.104 +++ syslogd.c1 Feb 2013 16:06:54 - @@ -184,6 +184,7 @@ intnfunix = 1;/* Number of Unix domain sockets requested */ char*funixn[MAXFUNIX] = { _PATH_LOG }; /* Paths to Unix domain sockets */ +intSendHName = 0;/* when true, send local hostname with messages */ intDebug;/* debug flag */ intStartup = 1;/* startup flag */ charLocalHostName[MAXHOSTNAMELEN];/* our hostname */ @@ -289,8 +290,11 @@ struct addrinfo hints, *res, *res0; FILE *fp; -while ((ch = getopt(argc, argv, dnuf:m:p:a:s:)) != -1) +while ((ch = getopt(argc, argv, Ndnuf:m:p:a:s:)) != -1) switch (ch) { +case 'N':/* send local hostname with messages */ +SendHName = 1; +break; case 'd':/* debug */ Debug++; break; @@ -888,9 +892,15 @@ case F_FORW: dprintf( %s\n, f-f_un.f_forw.f_hname); -if ((l = snprintf(line, sizeof(line), %d%.15s %s, -f-f_prevpri, (char *)iov[0].iov_base, -(char *)iov[4].iov_base)) = sizeof(line) || l == -1) +if (SendHName) +l = snprintf(line, sizeof(line), %d%.15s %s %s, +f-f_prevpri, (char *)iov[0].iov_base, LocalHostName, +(char *)iov[4].iov_base); +else +l = snprintf(line, sizeof(line), %d%.15s %s, +f-f_prevpri, (char *)iov[0].iov_base, +(char *)iov[4].iov_base); +if (l = sizeof(line) || l == -1) l = strlen(line); if (sendto(pfd[PFD_INET].fd, line, l, 0, (struct sockaddr *)f-f_un.f_forw.f_addr,
Re: Send hostname to remote host with syslogd
On 02/01/13 03:15, Rob Pierce wrote: We have seen the same behaviour and will hopefully be testing your patch this week. It would be great to have this capability in base as we don't want to install extra packages (i.e. rsyslog) and so far base does everything we need. Please keep in mind that this is a crude first try patch, I only tested it with base syslogd as client and syslog-ng as server. Base syslogd may need some tweaks to read given hostname instead of trying a DNS lookup, let me know if this is the case and I will take a look at it. - Original Message - From: Gabriel Linder lin...@jeuxvideo.com To: tech@openbsd.org Sent: Wednesday, December 26, 2012 9:40:40 AM Subject: Send hostname to remote host with syslogd While playing with base syslogd and syslog-ng to have a unique loghost on my network, I noticed that OpenBSD syslogd does not send the hostname (while other daemons like rsyslog send it), so my loghost log the IP instead of the hostname. Is there a reason for this behaviour ? The diff below fix this, works for me. Diff is also available at http://dargor.servebeer.com/~dargor/openbsd/syslogd.diff (thunderbird likes to mess with my tabs...) Index: syslogd.c === RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v retrieving revision 1.104 diff -u -r1.104 syslogd.c --- syslogd.c12 Jul 2011 11:28:31 -1.104 +++ syslogd.c26 Dec 2012 14:20:08 - @@ -888,8 +888,8 @@ case F_FORW: dprintf( %s\n, f-f_un.f_forw.f_hname); -if ((l = snprintf(line, sizeof(line), %d%.15s %s, -f-f_prevpri, (char *)iov[0].iov_base, +if ((l = snprintf(line, sizeof(line), %d%.15s %s %s, +f-f_prevpri, (char *)iov[0].iov_base, LocalHostName, (char *)iov[4].iov_base)) = sizeof(line) || l == -1) l = strlen(line); if (sendto(pfd[PFD_INET].fd, line, l, 0,
Re: Send hostname to remote host with syslogd
On 02/01/13 11:57, Stuart Henderson wrote: From: Gabriel Linder lin...@jeuxvideo.com To: tech@openbsd.org Sent: Wednesday, December 26, 2012 9:40:40 AM Subject: Send hostname to remote host with syslogd While playing with base syslogd and syslog-ng to have a unique loghost on my network, I noticed that OpenBSD syslogd does not send the hostname (while other daemons like rsyslog send it), so my loghost log the IP instead of the hostname. Is there a reason for this behaviour ? Does your loghost really log the provided hostname _instead of_ the IP address? That seems like bad information loss, especially as the hostname here does not include the domain name. Yes, I need only the short hostname (and it is friendler than an address, for us human beings). I'm a bit undecided as to whether this is really useful (I suppose having it _in addition_ to the IP address might be useful where there's a NAT between log source and destination) but in any event if it's done, I think it should be optional and off by default; it changes the established format and eats into a limited 1K max line length. I will submit a new patch implementing this behaviour, then. see git-format-patch(1) for information about how to correct your Thunderbird settings. Thanks for pointing this out.
Re: tar -J to extract xz archives
On 05/30/12 07:53, Landry Breuil wrote: On Tue, May 29, 2012 at 09:19:49PM -0400, Ted Unangst wrote: On Tue, May 29, 2012 at 17:46, Gabriel Linder wrote: I see more and more tar.xz archives, and thought it would be nice to have tar able to extract them directly as with gzip/bzip2. -J is what GNU and FreeBSD use, so I used it too. Based on what was done to add bzip2 support. So I never quite finished it in time before the -j patch went in, but I think tar should just auto detect the compression and use the right program. It requires reading about two bytes out of the stream. It's a little tricky if the data is piped in, but I don't think it's intractable. So -z would just always do the right thing. I think that's a better way to do it. Not an argument per se, but gtar uses -a/--auto-compress for that mode. And it even see to be default if no compression scheme is specified, ie 'gtar tf' and 'gtar xf' do the right thing (tm). See http://petereisentraut.blogspot.com/2012/05/time-to-retrain-fingers.html and the associated comments.. Landry That would be nice, I think. FreeBSD version seem able to do that too, from their manpage.
tar -J to extract xz archives
I see more and more tar.xz archives, and thought it would be nice to have tar able to extract them directly as with gzip/bzip2. -J is what GNU and FreeBSD use, so I used it too. Based on what was done to add bzip2 support. In case my client mess up with tabulations, here is a real file : http://dargor.servebeer.com/~dargor/openbsd/pax+xz.diff Index: cpio.1 === RCS file: /cvs/src/bin/pax/cpio.1,v retrieving revision 1.34 diff -u -r1.34 cpio.1 --- cpio.13 Sep 2011 22:59:08 -1.34 +++ cpio.125 May 2012 12:29:34 - @@ -32,7 +32,7 @@ .Sh SYNOPSIS .Nm cpio .Fl o -.Op Fl AaBcjLvZz +.Op Fl AaBcJjLvZz .Op Fl C Ar bytes .Op Fl F Ar archive .Op Fl H Ar format @@ -41,7 +41,7 @@ .Op \*(Gt Ar archive .Nm cpio .Fl i -.Op Fl 6BbcdfjmrSstuvZz +.Op Fl 6BbcdfJjmrSstuvZz .Op Fl C Ar bytes .Op Fl E Ar file .Op Fl F Ar archive @@ -110,6 +110,9 @@ .It Fl j Compress archive using the bzip2 format. The bzip2 utility must be installed separately. +.It Fl J +Compress archive using the xz format. +The xz utility must be installed separately. .It Fl L Follow symbolic links. .It Fl O Ar archive @@ -185,6 +188,9 @@ .It Fl j Uncompress archive using the bzip2 format. The bzip2 utility must be installed separately. +.It Fl J +Uncompress archive using the xz format. +The xz utility must be installed separately. .It Fl m Restore modification times on files. .It Fl r Index: options.c === RCS file: /cvs/src/bin/pax/options.c,v retrieving revision 1.75 diff -u -r1.75 options.c --- options.c4 Mar 2012 04:05:15 -1.75 +++ options.c25 May 2012 12:29:34 - @@ -81,6 +81,7 @@ #define GZIP_CMDgzip/* command to run as gzip */ #define COMPRESS_CMDcompress/* command to run as compress */ #define BZIP2_CMDbzip2/* command to run as bzip2 */ +#define XZ_CMDxz/* command to run as xz */ /* *Format specific routine table - MUST BE IN SORTED ORDER BY NAME @@ -192,7 +193,7 @@ /* * process option flags */ -while ((c=getopt(argc,argv,ab:cdf:ijklno:p:rs:tuvwx:zB:DE:G:HLOPT:U:XYZ0)) +while ((c=getopt(argc,argv,ab:cdf:ijklno:p:rs:tuvwx:zB:DE:G:HJLOPT:U:XYZ0)) != -1) { switch (c) { case 'a': @@ -444,6 +445,12 @@ Hflag = 1; flg |= CHF; break; +case 'J': +/* + * use xz. Non standard option. + */ +gzip_program = XZ_CMD; +break; case 'L': /* * follow symlinks @@ -620,7 +627,7 @@ * process option flags */ while ((c = getoldopt(argc, argv, -b:cef:hjmopqruts:vwxzBC:HI:LNOPXZ014578)) != -1) { +b:cef:hjmopqruts:vwxzBC:HI:JLNOPXZ014578)) != -1) { switch (c) { case 'b': /* @@ -779,6 +786,12 @@ incfiles[nincfiles - 1].file = optarg; incfiles[nincfiles - 1].dir = chdname; break; +case 'J': +/* + * use xz. Non standard option. + */ +gzip_program = XZ_CMD; +break; case 'L': /* * follow symlinks @@ -1053,7 +1066,7 @@ dflag = 1; act = -1; nodirs = 1; -while ((c=getopt(argc,argv,abcdfijklmoprstuvzABC:E:F:H:I:LO:SZ6)) != -1) +while ((c=getopt(argc,argv,abcdfijklmoprstuvzABC:E:F:H:I:JLO:SZ6)) != -1) switch (c) { case 'a': /* @@ -1224,6 +1237,12 @@ (void)fputs(\n\n, stderr); cpio_usage(); break; +case 'J': +/* + * use xz. Non standard option. + */ +gzip_program = XZ_CMD; +break; case 'L': /* * follow symbolic links @@ -1559,11 +1578,11 @@ pax_usage(void) { (void)fputs( -usage: pax [-0cdjnOvz] [-E limit] [-f archive] [-G group] [-s replstr]\n +usage: pax [-0cdJjnOvz] [-E limit] [-f archive] [-G group] [-s replstr]\n [-T range] [-U user] [pattern ...]\n - pax -r [-0cDdijknOuvYZz] [-E limit] [-f archive] [-G group] [-o options]\n + pax -r [-0cDdiJjknOuvYZz] [-E limit] [-f archive] [-G group] [-o options]\n [-p string] [-s replstr] [-T range] [-U user] [pattern ...]\n - pax -w [-0adHijLOPtuvXz] [-B bytes] [-b blocksize] [-f archive]\n + pax -w [-0adHiJjLOPtuvXz] [-B bytes] [-b blocksize] [-f archive]\n [-G group] [-o options] [-s replstr] [-T range] [-U user]\n [-x format] [file ...]\n pax -rw [-0DdHikLlnOPtuvXYZ] [-G group] [-p string] [-s replstr]\n @@ -1581,10 +1600,10 @@ tar_usage(void) {
Re: relayd and rdomain/prio defaults
On 03/05/12 21:10, Erik Lax wrote: On 3/2/12 5:09 PM, Gabriel Linder wrote: Since 5.0 rules injected by relayd includes on rdomain 0 and prio 0, I guess that's not intended ? I think you're right. And if so, the same problem seem to exist for the ftp-proxy (filter.c) as well. I guess this is what happens when default values aren't compatible with bzero :) Indeed :) Anything messing with anchors is probably concerned. I just saw that my MUA scrambled my previous diff by replacing tabs by spaces, here is a proper version http://dargor.servebeer.com/~dargor/openbsd/relayd/pfe_filter.c.diff
Fix two warnings in diffdir.c : edp1/edp2 may be used uninitialized
Index: diffdir.c === RCS file: /cvs/src/usr.bin/diff/diffdir.c,v retrieving revision 1.40 diff -u -r1.40 diffdir.c --- diffdir.c14 Nov 2010 18:24:43 -1.40 +++ diffdir.c18 Nov 2011 10:57:54 - @@ -48,8 +48,8 @@ void diffdir(char *p1, char *p2, int flags) { -struct dirent *dent1, **dp1, **edp1, **dirp1 = NULL; -struct dirent *dent2, **dp2, **edp2, **dirp2 = NULL; +struct dirent *dent1, **dp1, **edp1 = NULL, **dirp1 = NULL; +struct dirent *dent2, **dp2, **edp2 = NULL, **dirp2 = NULL; size_t dirlen1, dirlen2; char path1[MAXPATHLEN], path2[MAXPATHLEN]; int pos;
Re: alc(4) support for Atheros AR815x
On 05/02/11 14:23, Edd Barrett wrote: On Mon, May 02, 2011 at 11:02:41AM +0100, Stuart Henderson wrote: On 2011/05/02 01:16, Edd Barrett wrote: On Sun, May 01, 2011 at 08:10:56PM +0100, Stuart Henderson wrote: On 2011/05/01 18:35, Edd Barrett wrote: I have acquired a netboot (packard bell dot s), which I think uses this NIC. Is there an updated diff? Yes I just took the 2 minutes it took to apply it and fix the minor conflicts and linewrapping issue with the diff. Untested beyond it builds. Stu's diff seems to work, kevlo's diff really.. although the first time i booted my bsd.rd I was unable to install due to: alc0: watchdog timeout (missed link) I had a report of a system with alc(4) which only works if the cable is connected at boot. Is that what happens for you too? If so, try this, similar to freebsd r214542. This change was already included in kevlo's diff. It does seem like it could still be related to the link state. I managed to get another error by: * booting with no cable plugged in. * once the system is up, connect a cable * run dhclient alc0 Then as DHREQUESTs were sent some kernel messages: alc0: watchdog timeout alc0: could not disable RxQ/TxQ (0x0008)! alc0: could not disable RxQ/TxQ MAC(0x0008)! Might give some clues? After those messages, the interface does infact recieve a DHCP address and the interface does work. So I would not let this hold back the commit. Some hints : http://marc.info/?l=openbsd-techm=129651174131694w=2 http://dargor.servebeer.com/~dargor/openbsd/alc/ (very old diffs) I have an alc device too, and would like to fix it. Starting from kevlo's diff I updated it some month ago to compile, and compared FreeBSD driver to add some more things, finding some bugs in their driver (reported and fixed in their tree). I now have a working alc, with and without cable at boot or after boot but I have to update my tree (lagging some months behind) and probably fix some conflicts before posting an up to date diff. It would help me if someone could answer my silly questions about differences between FreeBSD and OpenBSD internals, by the way. Slides at http://www.openbsd.org/papers/ were very useful but do not cover this :)
Re: History for bc(1)
On 02/15/11 13:01, Otto Moerbeek wrote: sorry, in have a diff in my tree, but I see myself always ignoring it. I just almost never actually use the editing capabilities. It seems my 25yr finger memory is too strong. So I'm not a proper tester for this diff, other than it does not seem to cause a regression. I use it almost daily, and some people have shown their interest for this feature.
Re: History for bc(1)
On 02/14/11 17:43, Christiano F. Haesbaert wrote: Any news on this ? The diff still apply on -current. If there are changes needed I can work on it, but I have no news.
Re: alc(4) support for Atheros AR815x
On 01/25/11 11:24, Kevin Lo wrote: Hi, The following diff adds support for Atheros AR8151/AR8152 chipsets; mostly from FreeBSD. It also fixes an issue i386/6311. Tested on Acer AOD255E. Tried yesterday on EeePC 1005PX, some comments inline. @@ -515,6 +694,20 @@ alc_attach(struct device *parent, struct val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); val= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, + CSR_READ_4(sc, ALC_PCIE_PHYMISC) | + PCIE_PHYMISC_FORCE_RCV_DET); + if (sc-sc_product == PCI_PRODUCT_ATTANSIC_L2C_1 + sc-alc_rev == ATHEROS_AR8152_B_V10) { Using sc-sc_product and sc-alc_rev, but they are initialized later. @@ -551,12 +747,39 @@ alc_attach(struct device *parent, struct * used in AR8132 can't establish gigabit link even if it * shows the same PHY model/revision number of AR8131. */ - if (PCI_PRODUCT(pa-pa_id) == PCI_PRODUCT_ATTANSIC_L2C) - sc-alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_JUMBO; - else - sc-alc_flags |= ALC_FLAG_JUMBO | ALC_FLAG_ASPM_MON; + sc-sc_product = PCI_PRODUCT(pa-pa_id); Here is sc-sc_product, sc-alc_rev initialized line 569 of if_alc.c r1.9 alc_newbuf should always use M_DONTWAIT (get rid of init), see http://marc.info/?l=openbsd-techm=129639859909043w=2
Re: alc0 panic and splassert: assertwaitok: want -1 have 1
On 01/30/11 14:39, Mike Belopuhov wrote: hi, if you haven't fixed it yet, here's a diff. it also fixes a error/!error logic bug. could you please try it out? Thank you, I made a more complete diff fixing a few more problems http://marc.info/?l=openbsd-techm=129636716819943w=2 - I missed the error/!error logic bug, though. I updated my diff to take your changes, everything works ok. Complete and up-to-date diff at http://dargor.servebeer.com/~dargor/openbsd/if_alc_fix5.diff alc_newbuf is always called from the interrupt context so it can't sleep in any case. Bret Lambert pointed that out, it works indeed. Index: if_alc.c === RCS file: /cvs/src/sys/dev/pci/if_alc.c,v retrieving revision 1.9 diff -u -p -r1.9 if_alc.c --- if_alc.c29 Jan 2011 08:13:46 - 1.9 +++ if_alc.c30 Jan 2011 13:32:59 - @@ -104,7 +104,7 @@ voidalc_mac_config(struct alc_softc *); int alc_miibus_readreg(struct device *, int, int); void alc_miibus_statchg(struct device *); void alc_miibus_writereg(struct device *, int, int, int); -intalc_newbuf(struct alc_softc *, struct alc_rxdesc *, int); +intalc_newbuf(struct alc_softc *, struct alc_rxdesc *); void alc_phy_down(struct alc_softc *); void alc_phy_reset(struct alc_softc *); void alc_reset(struct alc_softc *); @@ -1552,16 +1552,16 @@ alc_txeof(struct alc_softc *sc) } int -alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd, int init) +alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd) { struct mbuf *m; bus_dmamap_t map; int error; - MGETHDR(m, init ? M_WAITOK : M_DONTWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); - MCLGET(m, init ? M_WAITOK : M_DONTWAIT); + MCLGET(m, M_DONTWAIT); if (!(m-m_flags M_EXT)) { m_freem(m); return (ENOBUFS); @@ -1573,18 +1573,8 @@ alc_newbuf(struct alc_softc *sc, struct sc-alc_cdata.alc_rx_sparemap, m, BUS_DMA_NOWAIT); if (error != 0) { - if (!error) { - bus_dmamap_unload(sc-sc_dmat, - sc-alc_cdata.alc_rx_sparemap); - error = EFBIG; - printf(%s: too many segments?!\n, - sc-sc_dev.dv_xname); - } m_freem(m); - - if (init) - printf(%s: can't load RX mbuf\n, sc-sc_dev.dv_xname); - + printf(%s: can't load RX mbuf\n, sc-sc_dev.dv_xname); return (error); } @@ -1707,7 +1697,7 @@ alc_rxeof(struct alc_softc *sc, struct r rxd =sc-alc_cdata.alc_rxdesc[rx_cons]; mp = rxd-rx_m; /* Add a new receive buffer to the ring. */ - if (alc_newbuf(sc, rxd, 0) != 0) { + if (alc_newbuf(sc, rxd) != 0) { ifp-if_iqdrops++; /* Reuse Rx buffers. */ if (sc-alc_cdata.alc_rxhead != NULL) @@ -2293,7 +2283,7 @@ alc_init_rx_ring(struct alc_softc *sc) rxd =sc-alc_cdata.alc_rxdesc[i]; rxd-rx_m = NULL; rxd-rx_desc =rd-alc_rx_ring[i]; - if (alc_newbuf(sc, rxd, 1) != 0) + if (alc_newbuf(sc, rxd) != 0) return (ENOBUFS); }
Re: Fix alc(4) watchdog timeouts and panics
On 01/30/11 06:04, Gabriel Linder wrote: This diff fix some problems on my EeePC 1005PX : - splassert failure when booting without a network cable - panic when unplugging a network cable - network does not come back when plugging a network cable - watchdog timeouts Mike Belopuhov found another logic bug, updated diff follows. cf http://marc.info/?l=openbsd-techm=129639859909043w=2 Index: if_alcreg.h === RCS file: /cvs/openbsd/src/sys/dev/pci/if_alcreg.h,v retrieving revision 1.1 diff -u -r1.1 if_alcreg.h --- if_alcreg.h 8 Aug 2009 09:31:13 - 1.1 +++ if_alcreg.h 30 Jan 2011 16:22:55 - @@ -18,12 +18,12 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMATE. + * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/alc/if_alcreg.h,v 1.1 2009/06/10 02:07:58 yongari Exp $ */ @@ -88,7 +88,7 @@ #definePM_CFG_PCIE_RECV0x8000 #definePM_CFG_L1_ENTRY_TIMER_MASK 0x000F #definePM_CFG_PM_REQ_TIMER_MASK0x00F0 -#definePM_CFG_LCKDET_TIMER_MASK0x3F00 +#definePM_CFG_LCKDET_TIMER_MASK0x0F00 #definePM_CFG_MAC_ASPM_CHK 0x4000 #definePM_CFG_HOTRST 0x8000 #definePM_CFG_L0S_ENTRY_TIMER_SHIFT8 @@ -98,8 +98,8 @@ #defineALC_MASTER_CFG 0x1400 #defineMASTER_RESET0x0001 +#defineMASTER_TEST_MODE_MASK 0x000C #defineMASTER_BERT_START 0x0010 -#defineMASTER_TEST_MODE_MASK 0x00C0 #defineMASTER_MTIMER_ENB 0x0100 #defineMASTER_MANUAL_INTR_ENB 0x0200 #defineMASTER_IM_TX_TIMER_ENB 0x0400 @@ -1133,7 +1133,6 @@ #defineALC_FLAG_ASPM_MON 0x0080 #defineALC_FLAG_CMB_BUG0x0100 #defineALC_FLAG_SMB_BUG0x0200 -#defineALC_FLAG_DETACH 0x4000 #defineALC_FLAG_LINK 0x8000 struct timeout alc_tick_ch; Index: if_alc.c === RCS file: /cvs/openbsd/src/sys/dev/pci/if_alc.c,v retrieving revision 1.9 diff -u -r1.9 if_alc.c --- if_alc.c29 Jan 2011 08:13:46 - 1.9 +++ if_alc.c30 Jan 2011 16:22:55 - @@ -76,7 +76,7 @@ #includedev/pci/if_alcreg.h -intalc_match(struct device *, void *, void *); +intalc_probe(struct device *, void *, void *); void alc_attach(struct device *, struct device *, void *); intalc_detach(struct device *, int); intalc_activate(struct device *, int); @@ -104,7 +104,7 @@ intalc_miibus_readreg(struct device *, int, int); void alc_miibus_statchg(struct device *); void alc_miibus_writereg(struct device *, int, int, int); -intalc_newbuf(struct alc_softc *, struct alc_rxdesc *, int); +intalc_newbuf(struct alc_softc *, struct alc_rxdesc *); void alc_phy_down(struct alc_softc *); void alc_phy_reset(struct alc_softc *); void alc_reset(struct alc_softc *); @@ -129,7 +129,7 @@ }; struct cfattach alc_ca = { - sizeof (struct alc_softc), alc_match, alc_attach, NULL, + sizeof (struct alc_softc), alc_probe, alc_attach, alc_detach, alc_activate }; @@ -200,14 +200,13 @@ { struct alc_softc *sc = (struct alc_softc *)dev; struct ifnet *ifp =sc-sc_arpcom.ac_if; - struct mii_data *mii; + struct mii_data *mii =sc-sc_miibus; uint32_t reg; - if ((ifp-if_flags IFF_RUNNING) == 0) + if (mii == NULL || ifp == NULL || + (ifp-if_flags IFF_RUNNING) == 0) return; - mii =sc-sc_miibus; - sc-alc_flags= ~ALC_FLAG_LINK; if ((mii-mii_media_status (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { @@ -236,8 +235,8 @@ reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); + alc_aspm(sc); } - alc_aspm(sc); } void @@ -246,6 +245,9 @@ struct alc_softc *sc = ifp-if_softc; struct mii_data *mii =sc-sc_miibus; + if ((ifp-if_flags IFF_UP) == 0) + return
Fix alc(4) watchdog timeouts and panics (new diff)
After some comments made by Brad and Mike Belopuhov, here's a new diff. Tested on EeePC 1005PX. cf. http://marc.info/?l=openbsd-techm=129636716819943w=2 Index: if_alcreg.h === RCS file: /cvs/openbsd/src/sys/dev/pci/if_alcreg.h,v retrieving revision 1.1 diff -u -r1.1 if_alcreg.h --- if_alcreg.h 8 Aug 2009 09:31:13 - 1.1 +++ if_alcreg.h 31 Jan 2011 14:30:56 - @@ -18,12 +18,12 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMATE. + * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/alc/if_alcreg.h,v 1.1 2009/06/10 02:07:58 yongari Exp $ */ @@ -88,7 +88,7 @@ #definePM_CFG_PCIE_RECV0x8000 #definePM_CFG_L1_ENTRY_TIMER_MASK 0x000F #definePM_CFG_PM_REQ_TIMER_MASK0x00F0 -#definePM_CFG_LCKDET_TIMER_MASK0x3F00 +#definePM_CFG_LCKDET_TIMER_MASK0x0F00 #definePM_CFG_MAC_ASPM_CHK 0x4000 #definePM_CFG_HOTRST 0x8000 #definePM_CFG_L0S_ENTRY_TIMER_SHIFT8 @@ -98,8 +98,8 @@ #defineALC_MASTER_CFG 0x1400 #defineMASTER_RESET0x0001 +#defineMASTER_TEST_MODE_MASK 0x000C #defineMASTER_BERT_START 0x0010 -#defineMASTER_TEST_MODE_MASK 0x00C0 #defineMASTER_MTIMER_ENB 0x0100 #defineMASTER_MANUAL_INTR_ENB 0x0200 #defineMASTER_IM_TX_TIMER_ENB 0x0400 @@ -1133,7 +1133,6 @@ #defineALC_FLAG_ASPM_MON 0x0080 #defineALC_FLAG_CMB_BUG0x0100 #defineALC_FLAG_SMB_BUG0x0200 -#defineALC_FLAG_DETACH 0x4000 #defineALC_FLAG_LINK 0x8000 struct timeout alc_tick_ch; Index: if_alc.c === RCS file: /cvs/openbsd/src/sys/dev/pci/if_alc.c,v retrieving revision 1.9 diff -u -r1.9 if_alc.c --- if_alc.c29 Jan 2011 08:13:46 - 1.9 +++ if_alc.c31 Jan 2011 14:30:56 - @@ -104,7 +104,7 @@ intalc_miibus_readreg(struct device *, int, int); void alc_miibus_statchg(struct device *); void alc_miibus_writereg(struct device *, int, int, int); -intalc_newbuf(struct alc_softc *, struct alc_rxdesc *, int); +intalc_newbuf(struct alc_softc *, struct alc_rxdesc *); void alc_phy_down(struct alc_softc *); void alc_phy_reset(struct alc_softc *); void alc_reset(struct alc_softc *); @@ -129,7 +129,7 @@ }; struct cfattach alc_ca = { - sizeof (struct alc_softc), alc_match, alc_attach, NULL, + sizeof (struct alc_softc), alc_match, alc_attach, alc_detach, alc_activate }; @@ -200,14 +200,13 @@ { struct alc_softc *sc = (struct alc_softc *)dev; struct ifnet *ifp = sc-sc_arpcom.ac_if; - struct mii_data *mii; + struct mii_data *mii = sc-sc_miibus; uint32_t reg; - if ((ifp-if_flags IFF_RUNNING) == 0) + if (mii == NULL || ifp == NULL || + (ifp-if_flags IFF_RUNNING) == 0) return; - mii = sc-sc_miibus; - sc-alc_flags = ~ALC_FLAG_LINK; if ((mii-mii_media_status (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { @@ -236,8 +235,8 @@ reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); + alc_aspm(sc); } - alc_aspm(sc); } void @@ -246,6 +245,9 @@ struct alc_softc *sc = ifp-if_softc; struct mii_data *mii = sc-sc_miibus; + if ((ifp-if_flags IFF_UP) == 0) + return; + mii_pollstat(mii); ifmr-ifm_status = mii-mii_media_status; ifmr-ifm_active = mii-mii_media_active; @@ -1138,13 +1140,14 @@ struct mbuf *m_head; int enq; - if ((ifp-if_flags (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) - return; - /* Reclaim transmitted frames. */ if (sc-alc_cdata.alc_tx_cnt = ALC_TX_DESC_HIWAT) alc_txeof(sc); + if ((ifp-if_flags (IFF_RUNNING | IFF_OACTIVE)) != + IFF_RUNNING || (sc-alc_flags ALC_FLAG_LINK)
Fix alc(4) watchdog timeouts and panics
This diff fix some problems on my EeePC 1005PX : - splassert failure when booting without a network cable - panic when unplugging a network cable - network does not come back when plugging a network cable - watchdog timeouts Most of the fixes are coming from FreeBSD. if_alcreg.h had only typos. If gmail mess with the diff there is a copy available at http://dargor.servebeer.com/~dargor/openbsd/if_alc_fix3.diff Index: if_alcreg.h === RCS file: /cvs/openbsd/src/sys/dev/pci/if_alcreg.h,v retrieving revision 1.1 diff -u -r1.1 if_alcreg.h --- if_alcreg.h 8 Aug 2009 09:31:13 - 1.1 +++ if_alcreg.h 30 Jan 2011 04:33:06 - @@ -18,12 +18,12 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMATE. + * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/alc/if_alcreg.h,v 1.1 2009/06/10 02:07:58 yongari Exp $ */ @@ -88,7 +88,7 @@ #definePM_CFG_PCIE_RECV0x8000 #definePM_CFG_L1_ENTRY_TIMER_MASK 0x000F #definePM_CFG_PM_REQ_TIMER_MASK0x00F0 -#definePM_CFG_LCKDET_TIMER_MASK0x3F00 +#definePM_CFG_LCKDET_TIMER_MASK0x0F00 #definePM_CFG_MAC_ASPM_CHK 0x4000 #definePM_CFG_HOTRST 0x8000 #definePM_CFG_L0S_ENTRY_TIMER_SHIFT8 @@ -98,8 +98,8 @@ #defineALC_MASTER_CFG 0x1400 #defineMASTER_RESET0x0001 +#defineMASTER_TEST_MODE_MASK 0x000C #defineMASTER_BERT_START 0x0010 -#defineMASTER_TEST_MODE_MASK 0x00C0 #defineMASTER_MTIMER_ENB 0x0100 #defineMASTER_MANUAL_INTR_ENB 0x0200 #defineMASTER_IM_TX_TIMER_ENB 0x0400 @@ -1133,7 +1133,6 @@ #defineALC_FLAG_ASPM_MON 0x0080 #defineALC_FLAG_CMB_BUG0x0100 #defineALC_FLAG_SMB_BUG0x0200 -#defineALC_FLAG_DETACH 0x4000 #defineALC_FLAG_LINK 0x8000 struct timeout alc_tick_ch; Index: if_alc.c === RCS file: /cvs/openbsd/src/sys/dev/pci/if_alc.c,v retrieving revision 1.9 diff -u -r1.9 if_alc.c --- if_alc.c29 Jan 2011 08:13:46 - 1.9 +++ if_alc.c30 Jan 2011 04:33:07 - @@ -76,7 +76,7 @@ #include dev/pci/if_alcreg.h -intalc_match(struct device *, void *, void *); +intalc_probe(struct device *, void *, void *); void alc_attach(struct device *, struct device *, void *); intalc_detach(struct device *, int); intalc_activate(struct device *, int); @@ -129,7 +129,7 @@ }; struct cfattach alc_ca = { - sizeof (struct alc_softc), alc_match, alc_attach, NULL, + sizeof (struct alc_softc), alc_probe, alc_attach, alc_detach, alc_activate }; @@ -200,14 +200,13 @@ { struct alc_softc *sc = (struct alc_softc *)dev; struct ifnet *ifp = sc-sc_arpcom.ac_if; - struct mii_data *mii; + struct mii_data *mii = sc-sc_miibus; uint32_t reg; - if ((ifp-if_flags IFF_RUNNING) == 0) + if (mii == NULL || ifp == NULL || + (ifp-if_flags IFF_RUNNING) == 0) return; - mii = sc-sc_miibus; - sc-alc_flags = ~ALC_FLAG_LINK; if ((mii-mii_media_status (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { @@ -236,8 +235,8 @@ reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); + alc_aspm(sc); } - alc_aspm(sc); } void @@ -246,6 +245,9 @@ struct alc_softc *sc = ifp-if_softc; struct mii_data *mii = sc-sc_miibus; + if ((ifp-if_flags IFF_UP) == 0) + return; + mii_pollstat(mii); ifmr-ifm_status = mii-mii_media_status; ifmr-ifm_active = mii-mii_media_active; @@ -270,7 +272,7 @@ } int -alc_match(struct device *dev, void *match, void *aux) +alc_probe(struct device *dev, void *match, void *aux) { return pci_matchbyid((struct pci_attach_args *)aux, alc_devices, nitems(alc_devices)); @@ -1138,7 +1140,8 @@ struct
Re: alc0 panic and splassert: assertwaitok: want -1 have 1
On 01/27/11 09:13, Gabriel Linder wrote: When booting 4.9-beta/amd64 without a network cable plugged, I get a lot of splassert failures. After changing kern.splassert to 3 I was able to get the following trace (get with dmesg after a reboot) : OpenBSD 4.9-beta (GENERIC.MP) #786: Tue Jan 25 17:46:34 MST 2011 t...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 1062797312 (1013MB) avail mem = 1020477440 (973MB) mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xf0760 (31 entries) bios0: vendor American Megatrends Inc. version 0904 date 08/12/2010 bios0: ASUSTeK Computer INC. 1005PX acpi0 at bios0: rev 2 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP APIC MCFG ECDT OEMB HPET GSCI SSDT SLIC acpi0: wakeup devices P0P1(S4) P0P4(S4) P0P5(S4) P0P6(S4) P0P7(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Atom(TM) CPU N450 @ 1.66GHz, 1666.71 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,NXE,LONG cpu0: 512KB 64b/line 8-way L2 cache cpu0: apic clock running at 166MHz cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R) Atom(TM) CPU N450 @ 1.66GHz, 1666.48 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,NXE,LONG cpu1: 512KB 64b/line 8-way L2 cache ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins ioapic0: misconfigured as apic 1, remapped to apid 2 acpimcfg0 at acpi0 addr 0xe000, bus 0-255 acpiec0 at acpi0acpiec _REG failed, broken BIOS acpihpet0 at acpi0: 14318179 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 4 (P0P4) acpiprt2 at acpi0: bus 2 (P0P5) acpiprt3 at acpi0: bus -1 (P0P6) acpiprt4 at acpi0: bus 1 (P0P7) acpiec at acpi0 not configured acpicpu0 at acpi0: C3, C2, C1, PSS acpicpu1 at acpi0: C3, C2, C1, PSS acpitz at acpi0 not configured acpibat at acpi0 not configured acpiac at acpi0 not configured acpiasus0 at acpi0 acpibtn0 at acpi0: LID_ acpibtn1 at acpi0: SLPB acpibtn2 at acpi0: PWRB acpivideo0 at acpi0: VGA_ acpivout0 at acpivideo0: CRTD acpivout1 at acpivideo0: TVOD acpivout2 at acpivideo0: LCDD cpu0: Enhanced SpeedStep 1666 MHz: speeds: 1667, 1333, 1000 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 Intel Pineview DMI rev 0x00 vga1 at pci0 dev 2 function 0 Intel Pineview Video rev 0x00 wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) wsdisplay0: screen 1-5 added (80x25, vt100 emulation) intagp0 at vga1 agp0 at intagp0: aperture at 0xd000, size 0x1000 inteldrm0 at vga1: apic 2 int 16 (irq 15) drm0 at inteldrm0 Intel Pineview Video rev 0x00 at pci0 dev 2 function 1 not configured azalia0 at pci0 dev 27 function 0 Intel 82801GB HD Audio rev 0x02: apic 2 int 22 (irq 4) azalia0: codecs: Realtek ALC269 audio0 at azalia0 ppb0 at pci0 dev 28 function 0 Intel 82801GB PCIE rev 0x02: apic 2 int 16 (irq 15) pci1 at ppb0 bus 4 ppb1 at pci0 dev 28 function 1 Intel 82801GB PCIE rev 0x02: apic 2 int 17 (irq 10) pci2 at ppb1 bus 2 athn0 at pci2 dev 0 function 0 Atheros AR2427 rev 0x01: apic 2 int 17 (irq 10) athn0: AR9285 rev 2 (1T1R), ROM rev 13, address 48:5d:60:24:0f:2b ppb2 at pci0 dev 28 function 3 Intel 82801GB PCIE rev 0x02: apic 2 int 19 (irq 11) pci3 at ppb2 bus 1 alc0 at pci3 dev 0 function 0 Attansic Technology L2C rev 0xc0: apic 2 int 19 (irq 11), address 20:cf:30:70:8f:31 atphy0 at alc0 phy 0: F1 10/100/1000 PHY, rev. 11 uhci0 at pci0 dev 29 function 0 Intel 82801GB USB rev 0x02: apic 2 int 23 (irq 3) uhci1 at pci0 dev 29 function 1 Intel 82801GB USB rev 0x02: apic 2 int 19 (irq 11) uhci2 at pci0 dev 29 function 2 Intel 82801GB USB rev 0x02: apic 2 int 18 (irq 7) uhci3 at pci0 dev 29 function 3 Intel 82801GB USB rev 0x02: apic 2 int 16 (irq 15) ehci0 at pci0 dev 29 function 7 Intel 82801GB USB rev 0x02: apic 2 int 23 (irq 3) usb0 at ehci0: USB revision 2.0 uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1 ppb3 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0xe2 pci4 at ppb3 bus 5 pcib0 at pci0 dev 31 function 0 Intel Tigerpoint LPC rev 0x02 ahci0 at pci0 dev 31 function 2 Intel 82801GR AHCI rev 0x02: apic 2 int 21 (irq 5), AHCI 1.1 scsibus0 at ahci0: 32 targets sd0 at scsibus0 targ 0 lun 0:ATA, WDC WD2500BEVT-8, 01.0 SCSI3 0/direct fixed sd0: 238475MB, 512 bytes/sec, 488397168 sec total ichiic0 at pci0 dev 31 function 3 Intel 82801GB SMBus rev 0x02: apic 2 int 21 (irq 11) iic0 at ichiic0 spdmem0 at iic0 addr 0x50: 1GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM usb1 at uhci0: USB revision 1.0 uhub1 at usb1 Intel UHCI root hub rev 1.00/1.00 addr 1 usb2 at uhci1: USB revision 1.0 uhub2 at usb2 Intel UHCI root hub rev 1.00/1.00 addr 1 usb3 at uhci2: USB revision 1.0 uhub3 at usb3 Intel UHCI root hub
History for bc(1)
This diff implements history for bc(1) using editline(3). History is not persistent, I can add this feature if needed. el_init with stderr should not be a problem for an interactive program, let me know otherwise. This is my first diff, so hints/advices/crucifixion are welcome :) Index: Makefile === RCS file: /cvs/src/usr.bin/bc/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- Makefile30 Jun 2006 19:02:28 - 1.4 +++ Makefile13 Aug 2010 11:23:19 - @@ -5,6 +5,8 @@ CPPFLAGS+= -I. -I${.CURDIR} CFLAGS+= -Wall -Wno-unused YFLAGS+= +LDADD= -lcurses -ledit +DPADD= ${LIBCURSES} ${LIBEDIT} beforeinstall: install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/bc.library \ Index: bc.y === RCS file: /cvs/src/usr.bin/bc/bc.y,v retrieving revision 1.33 diff -u -r1.33 bc.y --- bc.y27 Oct 2009 23:59:36 - 1.33 +++ bc.y13 Aug 2010 11:23:19 - @@ -43,6 +43,7 @@ #include stdbool.h #include string.h #include unistd.h +#include histedit.h #include extern.h #include pathnames.h @@ -1073,6 +1074,27 @@ } } +static void +init_editline(void) +{ + if (interactive) { + /* +* Our stdout will be stdin for dc, so we pass stderr as stdout. +*/ + if ((el = el_init(__progname, stdin, stderr, stderr)) == NULL) + err(1, cannot initialise editline); + if ((hl = history_init()) == NULL) + err(1, cannot initialise editline history); + history(hl, hev, H_SETSIZE, 100); + el_set(el, EL_HIST, history, hl); + el_set(el, EL_PROMPT, prompt); + el_set(el, EL_EDITOR, emacs); + el_set(el, EL_TERMINAL, NULL); + el_set(el, EL_SIGNAL, 1); + el_source(el, NULL); + } +} + int main(int argc, char *argv[]) { @@ -1129,6 +1151,7 @@ dup(p[1]); close(p[0]); close(p[1]); + init_editline(); } else { close(STDIN_FILENO); dup(p[0]); Index: extern.h === RCS file: /cvs/src/usr.bin/bc/extern.h,v retrieving revision 1.6 diff -u -r1.6 extern.h --- extern.h18 Mar 2006 20:44:43 - 1.6 +++ extern.h13 Aug 2010 11:23:19 - @@ -23,17 +23,23 @@ ssize_t store; }; -intyylex(void); -void yyerror(char *); -void fatal(const char *); -void abort_line(int); +intyylex(void); +void yyerror(char *); +void fatal(const char *); +void abort_line(int); -extern int lineno; -extern char*yytext; -extern FILE*yyin; -extern int fileindex; -extern int sargc; -extern char**sargv; -extern char*filename; -extern char*cmdexpr; -bool interactive; +extern int lineno; +extern char*yytext; +extern FILE*yyin; +extern int fileindex; +extern int sargc; +extern char**sargv; +extern char*filename; +extern char*cmdexpr; +extern boolinteractive; + +const char *prompt(EditLine *); + +extern History *hl; +extern HistEvent hev; +extern EditLine*el; Index: scan.l === RCS file: /cvs/src/usr.bin/bc/scan.l,v retrieving revision 1.23 diff -u -r1.23 scan.l --- scan.l 27 Oct 2009 23:59:36 - 1.23 +++ scan.l 13 Aug 2010 11:23:19 - @@ -22,6 +22,7 @@ #include stdbool.h #include string.h #include unistd.h +#include histedit.h #include extern.h #include pathnames.h @@ -30,6 +31,10 @@ intlineno; bool interactive; +History*hl; +HistEvent hev; +EditLine *el; + static char*strbuf = NULL; static size_t strbuf_sz = 1; static booldot_seen; @@ -37,6 +42,10 @@ static voidinit_strbuf(void); static voidadd_str(const char *); +static voidyy_input(char *, int *, const int); + +#define YY_INPUT(buf, result, max_size)(yy_input(buf, result, max_size)) + %} %option always-interactive @@ -280,3 +289,38 @@ return (1); } +/* ARGSUSED */ +const char * +prompt(EditLine *el) +{ + return ; +} + +static void +yy_input(char *buf, int *result, const int max_size) +{ + if (interactive) { + const char *line; + int count; + if ((line = el_gets(el, count)) == NULL || count = 0) { + if (count == 0) { + *result = YY_NULL; +
Re: History for bc(1)
On Fri, 13 Aug 2010 14:30:50 +0200 Otto Moerbeek o...@drijf.net wrote: Take a look at freebsd. They have added editline support to bc. If (big if) we're going to add command line editing and history, I'd rather take that. I will take a look at their implementation then, thank you.