From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 11:55:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAEB4106566C; Sun, 4 Dec 2011 11:55:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0CE78FC19; Sun, 4 Dec 2011 11:55:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4BtXFA085808; Sun, 4 Dec 2011 11:55:33 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4BtXeA085804; Sun, 4 Dec 2011 11:55:33 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112041155.pB4BtXeA085804@svn.freebsd.org> From: Adrian Chadd Date: Sun, 4 Dec 2011 11:55:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228257 - head/sys/dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 11:55:33 -0000 Author: adrian Date: Sun Dec 4 11:55:33 2011 New Revision: 228257 URL: http://svn.freebsd.org/changeset/base/228257 Log: Allow the i2c node requirements to be slightly relaxed. These realtek switch PHYs speak a variant of i2c with some slightly modified handling. From the submitter, slightly modified now that some further digging has been done: The I2C framework makes a assumption that the read/not-write bit of the first byte (the address) indicates whether reads or writes are to follow. The RTL8366 family uses the bus: after sending the address+read/not-write byte, two register address bytes are sent, then the 16-bit register value is sent or received. While the register write access can be performed as a 4-byte write, the read access requires the read bit to be set, but the first two bytes for the register address then need to be transmitted. This patch maintains the i2c protocol behaviour but allows it to be relaxed (for these kinds of switch PHYs, and whatever else Realtek may do with this almost-but-not-quite i2c bus) - by setting the "strict" hint to 0. The "strict" hint defaults to 1. Submitted by: Stefan Bethke Modified: head/sys/dev/iicbus/iicbus.c head/sys/dev/iicbus/iicbus.h head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iicbus.c ============================================================================== --- head/sys/dev/iicbus/iicbus.c Sun Dec 4 07:28:50 2011 (r228256) +++ head/sys/dev/iicbus/iicbus.c Sun Dec 4 11:55:33 2011 (r228257) @@ -92,10 +92,16 @@ iicbus_attach(device_t dev) unsigned char addr; #endif struct iicbus_softc *sc = IICBUS_SOFTC(dev); + int strict; sc->dev = dev; mtx_init(&sc->lock, "iicbus", NULL, MTX_DEF); iicbus_reset(dev, IIC_FASTEST, 0, NULL); + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "strict", &strict) == 0) + sc->strict = strict; + else + sc->strict = 1; /* device probing is meaningless since the bus is supposed to be * hot-plug. Moreover, some I2C chips do not appreciate random Modified: head/sys/dev/iicbus/iicbus.h ============================================================================== --- head/sys/dev/iicbus/iicbus.h Sun Dec 4 07:28:50 2011 (r228256) +++ head/sys/dev/iicbus/iicbus.h Sun Dec 4 11:55:33 2011 (r228257) @@ -41,6 +41,8 @@ struct iicbus_softc device_t owner; /* iicbus owner device structure */ u_char started; /* address of the 'started' slave * 0 if no start condition succeeded */ + u_char strict; /* deny operations that violate the + * I2C protocol */ struct mtx lock; }; Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Sun Dec 4 07:28:50 2011 (r228256) +++ head/sys/dev/iicbus/iiconf.c Sun Dec 4 11:55:33 2011 (r228257) @@ -243,8 +243,8 @@ iicbus_write(device_t bus, const char *b { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); - /* a slave must have been started with the appropriate address */ - if (!sc->started || (sc->started & LSB)) + /* a slave must have been started for writing */ + if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) != 0)) return (EINVAL); return (IICBUS_WRITE(device_get_parent(bus), buf, len, sent, timeout)); @@ -261,8 +261,8 @@ iicbus_read(device_t bus, char *buf, int { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); - /* a slave must have been started with the appropriate address */ - if (!sc->started || !(sc->started & LSB)) + /* a slave must have been started for reading */ + if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) == 0)) return (EINVAL); return (IICBUS_READ(device_get_parent(bus), buf, len, read, last, delay)); From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 12:10:25 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CCEF1065670; Sun, 4 Dec 2011 12:10:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F076D8FC13; Sun, 4 Dec 2011 12:10:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4CAOdb086296; Sun, 4 Dec 2011 12:10:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4CAOxL086294; Sun, 4 Dec 2011 12:10:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112041210.pB4CAOxL086294@svn.freebsd.org> From: Adrian Chadd Date: Sun, 4 Dec 2011 12:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228258 - head/sys/dev/gpio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 12:10:25 -0000 Author: adrian Date: Sun Dec 4 12:10:24 2011 New Revision: 228258 URL: http://svn.freebsd.org/changeset/base/228258 Log: Modify the GPIO i2c bus code to allow for arbitrary data/clock pins, rather than defaulting to 0 and 1. This way the pin order can be reversed. It is reversed with the TP-Link TL-WR1043nd. Submitted by: Stefan Bethke Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Sun Dec 4 11:55:33 2011 (r228257) +++ head/sys/dev/gpio/gpioiic.c Sun Dec 4 12:10:24 2011 (r228258) @@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$"); #include "iicbb_if.h" -#define SCL_PIN 0 /* gpiobus mapped pin 6 */ -#define SDA_PIN 1 /* gpiobus mapped pin 7 */ +#define SCL_PIN_DEFAULT 0 /* default index of SCL pin on gpiobus */ +#define SDA_PIN_DEFAULT 1 struct gpioiic_softc { @@ -57,6 +57,8 @@ struct gpioiic_softc device_t sc_busdev; struct mtx sc_mtx; struct cdev *sc_leddev; + int scl_pin; + int sda_pin; }; static int gpioiic_probe(device_t); @@ -88,6 +90,12 @@ gpioiic_attach(device_t dev) sc->sc_dev = dev; sc->sc_busdev = device_get_parent(dev); + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "scl", &sc->scl_pin)) + sc->scl_pin = SCL_PIN_DEFAULT; + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "sda", &sc->sda_pin)) + sc->sda_pin = SDA_PIN_DEFAULT; /* add generic bit-banging code */ bitbang = device_add_child(dev, "iicbb", -1); @@ -105,9 +113,9 @@ gpioiic_reset_bus(device_t dev) { struct gpioiic_softc *sc = device_get_softc(dev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SDA_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SCL_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, GPIO_PIN_INPUT); } @@ -142,11 +150,11 @@ gpioiic_setsda(device_t dev, int val) GPIOBUS_LOCK_BUS(sc->sc_busdev); if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, SDA_PIN, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SDA_PIN, + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, 0); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, GPIO_PIN_OUTPUT); } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SDA_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, GPIO_PIN_INPUT); } GPIOBUS_UNLOCK_BUS(sc->sc_busdev); @@ -159,11 +167,11 @@ gpioiic_setscl(device_t dev, int val) GPIOBUS_LOCK_BUS(sc->sc_busdev); if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, SCL_PIN, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SCL_PIN, + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, 0); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, GPIO_PIN_OUTPUT); } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SCL_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, GPIO_PIN_INPUT); } GPIOBUS_UNLOCK_BUS(sc->sc_busdev); @@ -176,9 +184,9 @@ gpioiic_getscl(device_t dev) unsigned int val; GPIOBUS_LOCK_BUS(sc->sc_busdev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SCL_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, SCL_PIN, &val); + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, &val); GPIOBUS_UNLOCK_BUS(sc->sc_busdev); return ((int)val); @@ -191,9 +199,9 @@ gpioiic_getsda(device_t dev) unsigned int val; GPIOBUS_LOCK_BUS(sc->sc_busdev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SDA_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, SDA_PIN, &val); + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, &val); GPIOBUS_UNLOCK_BUS(sc->sc_busdev); return ((int)val); From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 12:31:19 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AB36106567C; Sun, 4 Dec 2011 12:31:19 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 05E9F8FC15; Sun, 4 Dec 2011 12:31:18 +0000 (UTC) Received: from lstewart1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 6F1C47E84A; Sun, 4 Dec 2011 23:31:16 +1100 (EST) Message-ID: <4EDB6814.9040403@freebsd.org> Date: Sun, 04 Dec 2011 23:31:16 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111016 Thunderbird/7.0.1 MIME-Version: 1.0 To: Jung-uk Kim References: <201111210417.pAL4HOdi023556@svn.freebsd.org> <4ED8575D.2010405@freebsd.org> <201112021927.25234.jkim@FreeBSD.org> <201112022002.49618.jkim@FreeBSD.org> In-Reply-To: <201112022002.49618.jkim@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: src-committers@FreeBSD.org, John Baldwin , svn-src-all@FreeBSD.org, Julien Ridoux , Ben Kaduk , Benjamin Kaduk , svn-src-head@FreeBSD.org Subject: Re: svn commit: r227778 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 12:31:19 -0000 On 12/03/11 12:02, Jung-uk Kim wrote: > On Friday 02 December 2011 07:27 pm, Jung-uk Kim wrote: >> On Thursday 01 December 2011 11:43 pm, Lawrence Stewart wrote: >>> On 12/02/11 03:43, Jung-uk Kim wrote: >>>> On Thursday 01 December 2011 10:11 am, Lawrence Stewart wrote: >>>>> On 11/30/11 05:09, Jung-uk Kim wrote: >>>>>> On Tuesday 29 November 2011 11:13 am, Lawrence Stewart wrote: [snip] >>>>>>> Here's the first of the patches: >>>>>>> >>>>>>> http://people.freebsd.org/~lstewart/patches/misc/ffclock_bpf >>>>>>> _i nt act abi_10.x.r228130.patch >>>>>> >>>>>> I only glanced at it but it looks very close to what I wanted >>>>>> to suggest. >>>>> >>>>> Final candidate patch is at: >>>>> >>>>> http://people.freebsd.org/~lstewart/patches/misc/ffclock_bpf_i >>>>> nt act abi_10.x.r228180.patch >>>>> >>>>> Assuming it passes the "make tinderbox" build I'm currently >>>>> running and no further input is received from interested >>>>> parties, I plan to commit it in ~10 hours. >>>>> >>>>> Changes since the r228130 patch I sent previously: >>>>> >>>>> - The new flags in bpf.h are added unconditionally so that >>>>> they can always be referenced at compile time and a decision >>>>> made at runtime as to whether a flag will be set or not. Using >>>>> one of the new flags when the kernel doesn't have FFCLOCK >>>>> compiled in results in the flag being ignored. An app should >>>>> check for the existence of the "ffclock" kernel feature or the >>>>> "kern.sysclock" sysctl tree before attempting to use the >>>>> flags. >>>>> >>>>> - This patch will hopefully be MFCed at some point, so I added >>>>> a CTASSERT to bpf.c to ensure that the ABI of structs >>>>> bpf_hdr32, bpf_hdr and bpf_xhdr remains intact when FFCLOCK is >>>>> enabled and the union of a ffcounter and struct >>>>> timeval32/timeval/bpf_ts is switched in. >>>>> >>>>> - bpf_gettime() more comprehensively covers all the possible >>>>> cases of flag combination and does sensible things for each >>>>> case (even though some cases are rather silly). >>>>> >>>>> - The snippet of code at the beginning of catchpacket() that >>>>> was manipulating the struct bintime derived from bpf_gettime() >>>>> was gross and has been removed in favour of selecting the >>>>> right {get}bin{up}time() function call in bpf_gettime(). >>>> >>>> I did that to reduce branching. Since you are introducing more >>>> branches, it warrants a function pointer now. >> >> There's another reason, BTW. If mbufs are tagged with timestamps >> (where only monotonic timestamps are allowed), they must be >> converted within the bpf.c. I forgot all the details. :-( We should document this knowledge in some code comments. >>> I see, thanks for the explanation. Could you elaborate a bit more >>> about how you would implement the function pointer idea? I'm also >>> curious in the !FFCLOCK case just how much overhead having the >>> 2-layer nested if/else adds. I'm not an very optimisation savvy >>> person, but I'm wondering if it's actually worth micro-optimising >>> this code. >>> >>> My initial thoughts about your function pointer idea lead to >>> adding a function pointer in the bpf_d and setting it to the >>> appropriate function to get the timestamp from at bpf_d creation >>> or ioctl time. Whilst I like this idea, I can't see how it would >>> work given that the various functions involved in time/ffcounter >>> stamp generation all have different signatures. >>> >>> We could have multiple variants of bpf_gettime() which each call >>> the appropriate underlying functions to generate the appropriate >>> stamp. Would add quite a lot of code but would reduce the >>> overhead of calling bpf_gettime() to an indirect function call + >>> the underlying stamp generation function call. This also solves >>> the problem of multiple function signatures. >> >> Please see my patch: >> >> http://people.freebsd.org/~jkim/bpf_ffclock.diff > > I booted up the kernel and found it just crashes because of stupid > typos. Now a new patch is uploaded in place. Sorry. > > Anyway, I see no regression nor ABI breakage. :-) struct bpf_d being part of the ABI was the main thing I was concerned about, so given that it isn't I like your approach a lot. As noted by Julien, this approach does introduce problems with respect to the follow up patch that adds a permanent bh_ffcounter member to the bpf header. I thought the fromclock() API would sufficiently meet the needs of consumers like BPF, but if we were to proceed with something like Jung-uk's proposed patch I don't think that's true anymore. We decided to bite the bullet and devise an API that is more compact and can return all appropriate time information from all underlying sysclocks in an efficient manner - something like a more generic version of ffclock_abstime(). Julien and I spent quite some time today nutting out details, and Julien has done a proof of concept patch against my proposed BPF patch which looks good as a starting point for discussion: http://www.cubinlab.ee.unimelb.edu.au/~jrid/patches/r228254/sysclock_snap.patch It needs a bit more work and should be split into two patches (one introducing the API and the other being the BPF changes). With something like this though, the BPF patch becomes radically simplified in the FFCLOCK case. We don't even need a function pointer cached in the bpf_d anymore, but could cache a struct sysclock_snap there instead if we really wanted to minimise overhead in bpf_gettime(). We'll have a go at refining the patch tomorrow hopefully, but wanted to put this out there for early consideration. Cheers, Lawrence From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 14:44:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A48B01065670; Sun, 4 Dec 2011 14:44:32 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91FE28FC0A; Sun, 4 Dec 2011 14:44:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4EiWvw091084; Sun, 4 Dec 2011 14:44:32 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4EiWjW091072; Sun, 4 Dec 2011 14:44:32 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201112041444.pB4EiWjW091072@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sun, 4 Dec 2011 14:44:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228259 - in head: sbin/dhclient tools/regression/sbin tools/regression/sbin/dhclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 14:44:32 -0000 Author: dumbbell Date: Sun Dec 4 14:44:31 2011 New Revision: 228259 URL: http://svn.freebsd.org/changeset/base/228259 Log: Support domain-search in dhclient(8) The "domain-search" option (option 119) allows a DHCP server to publish a list of implicit domain suffixes used during name lookup. This option is described in RFC 3397. For instance, if the domain-search option says: ".example.org .example.com" and one wants to resolve "foobar", the resolver will try: 1. "foobar.example.org" 2. "foobar.example.com" The file /etc/resolv.conf is updated with a "search" directive if the DHCP server provides "domain-search". A regression test suite is included in this patch under tools/regression/sbin/dhclient. PR: bin/151940 Sponsored by Yakaz (http://www.yakaz.com) Added: head/tools/regression/sbin/dhclient/ head/tools/regression/sbin/dhclient/Makefile (contents, props changed) head/tools/regression/sbin/dhclient/fake.c (contents, props changed) head/tools/regression/sbin/dhclient/option-domain-search.c (contents, props changed) Modified: head/sbin/dhclient/clparse.c head/sbin/dhclient/dhclient-script head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcp-options.5 head/sbin/dhclient/dhcp.h head/sbin/dhclient/options.c head/sbin/dhclient/tables.c head/tools/regression/sbin/Makefile Modified: head/sbin/dhclient/clparse.c ============================================================================== --- head/sbin/dhclient/clparse.c Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/clparse.c Sun Dec 4 14:44:31 2011 (r228259) @@ -100,6 +100,8 @@ read_client_conf(void) DHO_DOMAIN_NAME_SERVERS; top_level_config.requested_options [top_level_config.requested_option_count++] = DHO_HOST_NAME; + top_level_config.requested_options + [top_level_config.requested_option_count++] = DHO_DOMAIN_SEARCH; if ((cfile = fopen(path_dhclient_conf, "r")) != NULL) { do { Modified: head/sbin/dhclient/dhclient-script ============================================================================== --- head/sbin/dhclient/dhclient-script Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/dhclient-script Sun Dec 4 14:44:31 2011 (r228259) @@ -201,7 +201,9 @@ add_new_resolv_conf() { local tmpres=/var/run/resolv.conf.${interface} rm -f $tmpres - if [ -n "$new_domain_name" ]; then + if [ -n "$new_domain_search" ]; then + echo "search $new_domain_search" >>$tmpres + elif [ -n "$new_domain_name" ]; then echo "search $new_domain_name" >>$tmpres fi Modified: head/sbin/dhclient/dhclient.c ============================================================================== --- head/sbin/dhclient/dhclient.c Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/dhclient.c Sun Dec 4 14:44:31 2011 (r228259) @@ -2401,6 +2401,7 @@ check_option(struct client_lease *l, int } return (1); case DHO_DOMAIN_NAME: + case DHO_DOMAIN_SEARCH: if (!res_hnok(sbuf)) { if (!check_search(sbuf)) { warning("Bogus domain search list %d: %s (%s)", Modified: head/sbin/dhclient/dhcp-options.5 ============================================================================== --- head/sbin/dhclient/dhcp-options.5 Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/dhcp-options.5 Sun Dec 4 14:44:31 2011 (r228259) @@ -265,6 +265,10 @@ character set. .It Ic option domain-name Ar string ; This option specifies the domain name that the client should use when resolving hostnames via the Domain Name System. +.It Ic option domain-search Ar string ; +This option specifies a list of domain names that the client should use +when resolving hostnames via the Domain Name System. This option is +defined in RFC 3397. .It Ic option swap-server Ar ip-address ; This specifies the IP address of the client's swap server. .It Ic option root-path Ar string ; Modified: head/sbin/dhclient/dhcp.h ============================================================================== --- head/sbin/dhclient/dhcp.h Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/dhcp.h Sun Dec 4 14:44:31 2011 (r228259) @@ -169,6 +169,7 @@ struct dhcp_packet { #define DHO_STREETTALK_SERVER 75 #define DHO_STREETTALK_DA_SERVER 76 #define DHO_DHCP_USER_CLASS_ID 77 +#define DHO_DOMAIN_SEARCH 119 #define DHO_CLASSLESS_ROUTES 121 #define DHO_END 255 Modified: head/sbin/dhclient/options.c ============================================================================== --- head/sbin/dhclient/options.c Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/options.c Sun Dec 4 14:44:31 2011 (r228259) @@ -55,6 +55,10 @@ void parse_options(struct packet *); void parse_option_buffer(struct packet *, unsigned char *, int); int store_options(unsigned char *, int, struct tree_cache **, unsigned char *, int, int, int, int); +void expand_domain_search(struct packet *packet); +int find_search_domain_name_len(struct option_data *option, int *offset); +void expand_search_domain_name(struct option_data *option, int *offset, + unsigned char **domain_search); /* @@ -94,6 +98,11 @@ parse_options(struct packet *packet) (unsigned char *)packet->raw->sname, sizeof(packet->raw->sname)); } + + /* Expand DHCP Domain Search option. */ + if (packet->options_valid) { + expand_domain_search(packet); + } } /* @@ -194,6 +203,163 @@ parse_option_buffer(struct packet *packe } /* + * Expand DHCP Domain Search option. The value of this option is + * encoded like DNS' list of labels. See: + * RFC 3397 + * RFC 1035 + */ +void +expand_domain_search(struct packet *packet) +{ + int offset, expanded_len; + struct option_data *option; + unsigned char *domain_search, *cursor; + + if (packet->options[DHO_DOMAIN_SEARCH].data == NULL) + return; + + option = &packet->options[DHO_DOMAIN_SEARCH]; + + /* Compute final expanded length. */ + expanded_len = 0; + offset = 0; + while (offset < option->len) { + /* We add 1 for the space between domain names. */ + expanded_len += + find_search_domain_name_len(option, &offset) + 1; + } + if (expanded_len > 0) + /* Remove 1 for the superfluous trailing space. */ + --expanded_len; + + domain_search = malloc(expanded_len + 1); + if (domain_search == NULL) + error("Can't allocate storage for expanded domain-search\n"); + + offset = 0; + cursor = domain_search; + while (offset < option->len) { + expand_search_domain_name(option, &offset, &cursor); + cursor[0] = ' '; + cursor++; + } + domain_search[expanded_len] = '\0'; + + free(option->data); + option->len = expanded_len; + option->data = domain_search; +} + +int +find_search_domain_name_len(struct option_data *option, int *offset) +{ + int domain_name_len, i, label_len, pointer, pointed_len; + + domain_name_len = 0; + + i = *offset; + while (i < option->len) { + label_len = option->data[i]; + if (label_len == 0) { + /* + * A zero-length label marks the end of this + * domain name. + */ + *offset = i + 1; + return (domain_name_len); + } else if (label_len & 0xC0) { + /* This is a pointer to another list of labels. */ + if (i + 1 >= option->len) { + /* The pointer is truncated. */ + error("Truncated pointer in DHCP Domain " + "Search option."); + } + + pointer = ((label_len & ~(0xC0)) << 8) + + option->data[i + 1]; + if (pointer >= *offset) { + /* + * The pointer must indicates a prior + * occurance. + */ + error("Invalid forward pointer in DHCP Domain " + "Search option compression."); + } + + pointed_len = find_search_domain_name_len(option, + &pointer); + domain_name_len += pointed_len; + + *offset = i + 2; + return (domain_name_len); + } + + if (i + label_len >= option->len) { + error("Truncated label in DHCP Domain Search option."); + } + + /* + * Update the domain name length with the length of the + * current label, plus a trailing dot ('.'). + */ + domain_name_len += label_len + 1; + + /* Move cursor. */ + i += label_len + 1; + } + + error("Truncated DHCP Domain Search option."); + + return (0); +} + +void +expand_search_domain_name(struct option_data *option, int *offset, + unsigned char **domain_search) +{ + int i, label_len, pointer; + unsigned char *cursor; + + /* + * This is the same loop than the function above + * (find_search_domain_name_len). Therefore, we remove checks, + * they're already done. Here, we just make the copy. + */ + i = *offset; + cursor = *domain_search; + while (i < option->len) { + label_len = option->data[i]; + if (label_len == 0) { + /* + * A zero-length label marks the end of this + * domain name. + */ + *offset = i + 1; + *domain_search = cursor; + return; + } else if (label_len & 0xC0) { + /* This is a pointer to another list of labels. */ + pointer = ((label_len & ~(0xC0)) << 8) + + option->data[i + 1]; + + expand_search_domain_name(option, &pointer, &cursor); + + *offset = i + 2; + *domain_search = cursor; + return; + } + + /* Copy the label found. */ + memcpy(cursor, option->data + i + 1, label_len); + cursor[label_len] = '.'; + + /* Move cursor. */ + i += label_len + 1; + cursor += label_len + 1; + } +} + +/* * cons options into a big buffer, and then split them out into the * three separate buffers if needed. This allows us to cons up a set of * vendor options using the same routine. Modified: head/sbin/dhclient/tables.c ============================================================================== --- head/sbin/dhclient/tables.c Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/tables.c Sun Dec 4 14:44:31 2011 (r228259) @@ -184,7 +184,7 @@ struct option dhcp_options[256] = { { "option-116", "X", &dhcp_universe, 116 }, { "option-117", "X", &dhcp_universe, 117 }, { "option-118", "X", &dhcp_universe, 118 }, - { "option-119", "X", &dhcp_universe, 119 }, + { "domain-search", "t", &dhcp_universe, 119 }, { "option-120", "X", &dhcp_universe, 120 }, { "classless-routes", "BA", &dhcp_universe, 121 }, { "option-122", "X", &dhcp_universe, 122 }, @@ -400,12 +400,13 @@ unsigned char dhcp_option_default_priori DHO_IRC_SERVER, DHO_STREETTALK_SERVER, DHO_STREETTALK_DA_SERVER, + DHO_DOMAIN_SEARCH, /* Presently-undefined options... */ 62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 118, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, Modified: head/tools/regression/sbin/Makefile ============================================================================== --- head/tools/regression/sbin/Makefile Sun Dec 4 12:10:24 2011 (r228258) +++ head/tools/regression/sbin/Makefile Sun Dec 4 14:44:31 2011 (r228259) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= growfs +SUBDIR= dhclient growfs .include Added: head/tools/regression/sbin/dhclient/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/dhclient/Makefile Sun Dec 4 14:44:31 2011 (r228259) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../../sbin/dhclient + +SRCS= alloc.c convert.c hash.c options.c tables.c \ + fake.c \ + option-domain-search.c + +CFLAGS+= -I${.CURDIR}/../../../../sbin/dhclient +LDADD= -lutil + +PROG= option-domain-search + +WARNS?= 2 + +.include Added: head/tools/regression/sbin/dhclient/fake.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/dhclient/fake.c Sun Dec 4 14:44:31 2011 (r228259) @@ -0,0 +1,60 @@ +/* $FreeBSD$ */ + +#include +#include +#include + +#include "dhcpd.h" + +extern jmp_buf env; + +void +error(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + + longjmp(env, 1); +} + +int +warning(char *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + + return ret; +} + +int +note(char *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + + return ret; +} + +void +bootp(struct packet *packet) +{ +} + +void +dhcp(struct packet *packet) +{ +} Added: head/tools/regression/sbin/dhclient/option-domain-search.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/dhclient/option-domain-search.c Sun Dec 4 14:44:31 2011 (r228259) @@ -0,0 +1,328 @@ +/* $FreeBSD$ */ + +#include +#include + +#include "dhcpd.h" + +jmp_buf env; + +void expand_domain_search(struct packet *packet); + +void +no_option_present() +{ + int ret; + struct option_data option; + struct packet p; + + option.data = NULL; + option.len = 0; + p.options[DHO_DOMAIN_SEARCH] = option; + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (p.options[DHO_DOMAIN_SEARCH].len != 0 || + p.options[DHO_DOMAIN_SEARCH].data != NULL) + abort(); +} + +void +one_domain_valid() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0"; + char *expected = "example.org."; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 13; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (option->len != strlen(expected) || + strcmp(option->data, expected) != 0) + abort(); + + free(option->data); +} + +void +one_domain_truncated1() +{ + int ret; + struct option_data *option; + struct packet p; + + char *data = "\007example\003org"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 12; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +one_domain_truncated2() +{ + int ret; + struct option_data *option; + struct packet p; + + char *data = "\007ex"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 3; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_valid() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0\007example\003com\0"; + char *expected = "example.org. example.com."; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 26; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (option->len != strlen(expected) || + strcmp(option->data, expected) != 0) + abort(); + + free(option->data); +} + +void +two_domains_truncated1() +{ + int ret; + struct option_data *option; + struct packet p; + + char *data = "\007example\003org\0\007example\003com"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 25; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_truncated2() +{ + int ret; + struct option_data *option; + struct packet p; + + char *data = "\007example\003org\0\007ex"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 16; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_compressed() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0\006foobar\xc0\x08"; + char *expected = "example.org. foobar.org."; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 22; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (option->len != strlen(expected) || + strcmp(option->data, expected) != 0) + abort(); + + free(option->data); +} + +void +two_domains_infloop() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0\006foobar\xc0\x0d"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 22; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_forwardptr() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\xc0\x0d\006foobar\0"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 22; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_truncatedptr() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0\006foobar\xc0"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 21; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +multiple_domains_valid() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = + "\007example\003org\0\002cl\006foobar\003com\0\002fr\xc0\x10"; + + char *expected = "example.org. cl.foobar.com. fr.foobar.com."; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 33; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (option->len != strlen(expected) || + strcmp(option->data, expected) != 0) + abort(); + + free(option->data); +} + +int +main(int argc, char *argv[]) +{ + + no_option_present(); + + one_domain_valid(); + one_domain_truncated1(); + one_domain_truncated2(); + + two_domains_valid(); + two_domains_truncated1(); + two_domains_truncated2(); + + two_domains_compressed(); + two_domains_infloop(); + two_domains_forwardptr(); + two_domains_truncatedptr(); + + multiple_domains_valid(); + + return (0); +} From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 16:33:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48848106566B; Sun, 4 Dec 2011 16:33:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37F718FC08; Sun, 4 Dec 2011 16:33:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4GX5mw094455; Sun, 4 Dec 2011 16:33:05 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4GX57R094453; Sun, 4 Dec 2011 16:33:05 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201112041633.pB4GX57R094453@svn.freebsd.org> From: Rick Macklem Date: Sun, 4 Dec 2011 16:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228260 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 16:33:05 -0000 Author: rmacklem Date: Sun Dec 4 16:33:04 2011 New Revision: 228260 URL: http://svn.freebsd.org/changeset/base/228260 Log: This patch adds a sysctl to the NFSv4 server which optionally disables the check for a UTF-8 compliant file name. Enabling this sysctl results in an NFSv4 server that is non-RFC3530 compliant, therefore it is not enabled by default. However, enabling this sysctl results in NFSv3 compatible behaviour and fixes the problem reported by "dan at sunsaturn.com" to freebsd-current@ on Nov. 14, 2011 under the subject "NFSV4 readlink_stat". Tested by: dan at sunsaturn.com Reviewed by: zack MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: head/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsubs.c Sun Dec 4 14:44:31 2011 (r228259) +++ head/sys/fs/nfsserver/nfs_nfsdsubs.c Sun Dec 4 16:33:04 2011 (r228260) @@ -56,6 +56,13 @@ static nfstype newnfsv2_type[9] = { NFNO extern nfstype nfsv34_type[9]; #endif /* !APPLEKEXT */ +SYSCTL_DECL(_vfs_nfsd); + +static int disable_checkutf8 = 0; +SYSCTL_INT(_vfs_nfsd, OID_AUTO, disable_checkutf8, CTLFLAG_RW, + &disable_checkutf8, 0, + "Disable the NFSv4 check for a UTF8 compliant name"); + static char nfsrv_hexdigit(char, int *); /* @@ -1963,7 +1970,8 @@ nfsrv_parsename(struct nfsrv_descript *n error = 0; goto nfsmout; } - if (nfsrv_checkutf8((u_int8_t *)bufp, outlen)) { + if (disable_checkutf8 == 0 && + nfsrv_checkutf8((u_int8_t *)bufp, outlen)) { nd->nd_repstat = NFSERR_INVAL; error = 0; goto nfsmout; From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 18:43:09 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9F06106566B; Sun, 4 Dec 2011 18:43:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99CDF8FC1C; Sun, 4 Dec 2011 18:43:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4Ih9Np098406; Sun, 4 Dec 2011 18:43:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4Ih92H098404; Sun, 4 Dec 2011 18:43:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112041843.pB4Ih92H098404@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 4 Dec 2011 18:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228261 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 18:43:09 -0000 Author: kib Date: Sun Dec 4 18:43:09 2011 New Revision: 228261 URL: http://svn.freebsd.org/changeset/base/228261 Log: Use explicit information from the kernel to detect the traps due to syscall entry and leave. Based on submision by: Dan Nelson MFC after: 1 month Modified: head/usr.bin/truss/setup.c Modified: head/usr.bin/truss/setup.c ============================================================================== --- head/usr.bin/truss/setup.c Sun Dec 4 16:33:04 2011 (r228260) +++ head/usr.bin/truss/setup.c Sun Dec 4 18:43:09 2011 (r228261) @@ -202,9 +202,19 @@ waitevent(struct trussinfo *info) find_thread(info, lwpinfo.pl_lwpid); switch(WSTOPSIG(waitval)) { case SIGTRAP: - info->pr_why = info->curthread->in_syscall?S_SCX:S_SCE; - info->curthread->in_syscall = 1 - info->curthread->in_syscall; - break; + if (lwpinfo.pl_flags & PL_FLAG_SCE) { + info->pr_why = S_SCE; + info->curthread->in_syscall = 1; + break; + } else if (lwpinfo.pl_flags & PL_FLAG_SCX) { + info->pr_why = S_SCX; + info->curthread->in_syscall = 0; + break; + } else { + errx(1, + "pl_flags %x contains neither PL_FLAG_SCE nor PL_FLAG_SCX", + lwpinfo.pl_flags); + } default: info->pr_why = S_SIG; info->pr_data = WSTOPSIG(waitval); From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 19:25:49 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFEA6106566C; Sun, 4 Dec 2011 19:25:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFAFB8FC0C; Sun, 4 Dec 2011 19:25:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4JPn2b099837; Sun, 4 Dec 2011 19:25:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4JPnmU099835; Sun, 4 Dec 2011 19:25:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112041925.pB4JPnmU099835@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 4 Dec 2011 19:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228263 - head/sys/fs/fifofs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 19:25:49 -0000 Author: kib Date: Sun Dec 4 19:25:49 2011 New Revision: 228263 URL: http://svn.freebsd.org/changeset/base/228263 Log: Initialize fifoinfo fi_wgen field on open. The only important is the difference between fi_wgen and f_seqcount, so the change is purely cosmetic, but it makes the code easier to understand. Submitted by: gianni MFC after: 2 weeks Modified: head/sys/fs/fifofs/fifo_vnops.c Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Sun Dec 4 18:55:19 2011 (r228262) +++ head/sys/fs/fifofs/fifo_vnops.c Sun Dec 4 19:25:49 2011 (r228263) @@ -218,7 +218,7 @@ fail1: free(fip, M_VNODE); return (error); } - fip->fi_readers = fip->fi_writers = 0; + fip->fi_wgen = fip->fi_readers = fip->fi_writers = 0; wso->so_snd.sb_lowat = PIPE_BUF; SOCKBUF_LOCK(&rso->so_rcv); rso->so_rcv.sb_state |= SBS_CANTRCVMORE; From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 21:24:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7055D1065673; Sun, 4 Dec 2011 21:24:01 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 608EF8FC22; Sun, 4 Dec 2011 21:24:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LO1HZ003573; Sun, 4 Dec 2011 21:24:01 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LO19M003571; Sun, 4 Dec 2011 21:24:01 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112042124.pB4LO19M003571@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 4 Dec 2011 21:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228264 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:24:01 -0000 Author: trociny Date: Sun Dec 4 21:24:01 2011 New Revision: 228264 URL: http://svn.freebsd.org/changeset/base/228264 Log: In sysctl_kern_proc_ps_strings() there is no much sense in checking for P_WEXIT and P_SYSTEM flags. Reviewed by: kib Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Dec 4 19:25:49 2011 (r228263) +++ head/sys/kern/kern_proc.c Sun Dec 4 21:24:01 2011 (r228264) @@ -2456,18 +2456,10 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL p = pfind((pid_t)name[0]); if (p == NULL) return (ESRCH); - if (p->p_flag & P_WEXIT) { - PROC_UNLOCK(p); - return (ESRCH); - } if ((error = p_cansee(curthread, p)) != 0) { PROC_UNLOCK(p); return (error); } - if ((p->p_flag & P_SYSTEM) != 0) { - PROC_UNLOCK(p); - return (0); - } #ifdef COMPAT_FREEBSD32 if ((req->flags & SCTL_MASK32) != 0) { /* From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 21:27:41 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 858F51065677; Sun, 4 Dec 2011 21:27:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75E5B8FC08; Sun, 4 Dec 2011 21:27:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LRfZZ003717; Sun, 4 Dec 2011 21:27:41 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LRfN5003715; Sun, 4 Dec 2011 21:27:41 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112042127.pB4LRfN5003715@svn.freebsd.org> From: Andriy Gapon Date: Sun, 4 Dec 2011 21:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228265 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:27:41 -0000 Author: avg Date: Sun Dec 4 21:27:41 2011 New Revision: 228265 URL: http://svn.freebsd.org/changeset/base/228265 Log: critical_exit: ignore td_owepreempt if kdb_active is set calling mi_switch in such a context results in a recursion via kdb_switch Suggested by: jhb Reviewed by: jhb MFC after: 5 weeks Modified: head/sys/kern/kern_switch.c Modified: head/sys/kern/kern_switch.c ============================================================================== --- head/sys/kern/kern_switch.c Sun Dec 4 21:24:01 2011 (r228264) +++ head/sys/kern/kern_switch.c Sun Dec 4 21:27:41 2011 (r228265) @@ -200,7 +200,7 @@ critical_exit(void) if (td->td_critnest == 1) { td->td_critnest = 0; - if (td->td_owepreempt) { + if (td->td_owepreempt && !kdb_active) { td->td_critnest = 1; thread_lock(td); td->td_critnest--; From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 21:29:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D03CF106566C; Sun, 4 Dec 2011 21:29:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C06838FC0C; Sun, 4 Dec 2011 21:29:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LTukn003819; Sun, 4 Dec 2011 21:29:56 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LTumU003817; Sun, 4 Dec 2011 21:29:56 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112042129.pB4LTumU003817@svn.freebsd.org> From: Andriy Gapon Date: Sun, 4 Dec 2011 21:29:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228266 - head/sys/boot/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:29:56 -0000 Author: avg Date: Sun Dec 4 21:29:56 2011 New Revision: 228266 URL: http://svn.freebsd.org/changeset/base/228266 Log: zfs boot: allow file vdevs to be used in testing (e.g. with zfsboottest) MFC after: 1 week Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Sun Dec 4 21:27:41 2011 (r228265) +++ head/sys/boot/zfs/zfsimpl.c Sun Dec 4 21:29:56 2011 (r228266) @@ -458,6 +458,9 @@ vdev_init_from_nvlist(const unsigned cha if (strcmp(type, VDEV_TYPE_MIRROR) && strcmp(type, VDEV_TYPE_DISK) +#ifdef ZFS_TEST + && strcmp(type, VDEV_TYPE_FILE) +#endif && strcmp(type, VDEV_TYPE_RAIDZ) && strcmp(type, VDEV_TYPE_REPLACING)) { printf("ZFS: can only boot from disk, mirror, raidz1, raidz2 and raidz3 vdevs\n"); From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 21:32:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88E421065680; Sun, 4 Dec 2011 21:32:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 790568FC1B; Sun, 4 Dec 2011 21:32:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LWI4p003932; Sun, 4 Dec 2011 21:32:18 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LWITl003931; Sun, 4 Dec 2011 21:32:18 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112042132.pB4LWITl003931@svn.freebsd.org> From: Andriy Gapon Date: Sun, 4 Dec 2011 21:32:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228267 - head/sys/boot/i386/zfsboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:32:18 -0000 Author: avg Date: Sun Dec 4 21:32:18 2011 New Revision: 228267 URL: http://svn.freebsd.org/changeset/base/228267 Log: zfsboot: print boot.config contents before parsing it as parsing can be a destructive operation MFC after: 2 weeks Modified: head/sys/boot/i386/zfsboot/zfsboot.c Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Sun Dec 4 21:29:56 2011 (r228266) +++ head/sys/boot/i386/zfsboot/zfsboot.c Sun Dec 4 21:32:18 2011 (r228267) @@ -541,10 +541,10 @@ main(void) } if (*cmd) { - if (parse()) - autoboot = 0; if (!OPT_CHECK(RBX_QUIET)) printf("%s: %s", PATH_CONFIG, cmd); + if (parse()) + autoboot = 0; /* Do not process this command twice */ *cmd = 0; } From owner-svn-src-head@FreeBSD.ORG Sun Dec 4 21:43:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84F18106566B; Sun, 4 Dec 2011 21:43:13 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 748A18FC14; Sun, 4 Dec 2011 21:43:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LhDeJ004299; Sun, 4 Dec 2011 21:43:13 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LhDYF004297; Sun, 4 Dec 2011 21:43:13 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112042143.pB4LhDYF004297@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 4 Dec 2011 21:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228268 - head/sys/compat/linprocfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:43:13 -0000 Author: trociny Date: Sun Dec 4 21:43:13 2011 New Revision: 228268 URL: http://svn.freebsd.org/changeset/base/228268 Log: Protect process environment variables with p_candebug(). Discussed with: jilles, kib, rwatson MFC after: 2 weeks Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sun Dec 4 21:32:18 2011 (r228267) +++ head/sys/compat/linprocfs/linprocfs.c Sun Dec 4 21:43:13 2011 (r228268) @@ -967,7 +967,7 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) int ret; PROC_LOCK(p); - if ((ret = p_cansee(td, p)) != 0) { + if ((ret = p_candebug(td, p)) != 0) { PROC_UNLOCK(p); return (ret); } From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 00:00:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 665AE106566B; Mon, 5 Dec 2011 00:00:48 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DA608FC0A; Mon, 5 Dec 2011 00:00:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB500mgk008550; Mon, 5 Dec 2011 00:00:48 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB500mrQ008548; Mon, 5 Dec 2011 00:00:48 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201112050000.pB500mrQ008548@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 5 Dec 2011 00:00:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228269 - head/lib/libc/locale X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 00:00:48 -0000 Author: jilles Date: Mon Dec 5 00:00:47 2011 New Revision: 228269 URL: http://svn.freebsd.org/changeset/base/228269 Log: libc: Eliminate 13 relative relocations in wctype(). Modified: head/lib/libc/locale/wctype.c Modified: head/lib/libc/locale/wctype.c ============================================================================== --- head/lib/libc/locale/wctype.c Sun Dec 4 21:43:13 2011 (r228268) +++ head/lib/libc/locale/wctype.c Mon Dec 5 00:00:47 2011 (r228269) @@ -57,35 +57,54 @@ iswctype_l(wint_t wc, wctype_t charclass wctype_t wctype_l(const char *property, locale_t locale) { - static const struct { - const char *name; - wctype_t mask; - } props[] = { - { "alnum", _CTYPE_A|_CTYPE_D }, - { "alpha", _CTYPE_A }, - { "blank", _CTYPE_B }, - { "cntrl", _CTYPE_C }, - { "digit", _CTYPE_D }, - { "graph", _CTYPE_G }, - { "lower", _CTYPE_L }, - { "print", _CTYPE_R }, - { "punct", _CTYPE_P }, - { "space", _CTYPE_S }, - { "upper", _CTYPE_U }, - { "xdigit", _CTYPE_X }, - { "ideogram", _CTYPE_I }, /* BSD extension */ - { "special", _CTYPE_T }, /* BSD extension */ - { "phonogram", _CTYPE_Q }, /* BSD extension */ - { "rune", 0xFFFFFF00L }, /* BSD extension */ - { NULL, 0UL }, /* Default */ + const char *propnames = + "alnum\0" + "alpha\0" + "blank\0" + "cntrl\0" + "digit\0" + "graph\0" + "lower\0" + "print\0" + "punct\0" + "space\0" + "upper\0" + "xdigit\0" + "ideogram\0" /* BSD extension */ + "special\0" /* BSD extension */ + "phonogram\0" /* BSD extension */ + "rune\0"; /* BSD extension */ + static const wctype_t propmasks[] = { + _CTYPE_A|_CTYPE_D, + _CTYPE_A, + _CTYPE_B, + _CTYPE_C, + _CTYPE_D, + _CTYPE_G, + _CTYPE_L, + _CTYPE_R, + _CTYPE_P, + _CTYPE_S, + _CTYPE_U, + _CTYPE_X, + _CTYPE_I, + _CTYPE_T, + _CTYPE_Q, + 0xFFFFFF00L }; - int i; + size_t len1, len2; + const char *p; + const wctype_t *q; - i = 0; - while (props[i].name != NULL && strcmp(props[i].name, property) != 0) - i++; + len1 = strlen(property); + q = propmasks; + for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { + if (len1 == len2 && memcmp(property, p, len1) == 0) + return (*q); + q++; + } - return (props[i].mask); + return (0UL); } wctype_t wctype(const char *property) From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 00:12:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83D9E106564A; Mon, 5 Dec 2011 00:12:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59C118FC13; Mon, 5 Dec 2011 00:12:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB50CA7I008921; Mon, 5 Dec 2011 00:12:10 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB50CATY008917; Mon, 5 Dec 2011 00:12:10 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201112050012.pB50CATY008917@svn.freebsd.org> From: Justin Hibbits Date: Mon, 5 Dec 2011 00:12:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228270 - in head: etc/devd sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 00:12:10 -0000 Author: jhibbits Date: Mon Dec 5 00:12:10 2011 New Revision: 228270 URL: http://svn.freebsd.org/changeset/base/228270 Log: Add a devd notification for closing/opening the lid on PowerBooks and iBooks. Approved by: nwhitehorn (mentor) Modified: head/etc/devd/apple.conf head/sys/powerpc/powermac/pmu.c head/sys/powerpc/powermac/pmuvar.h Modified: head/etc/devd/apple.conf ============================================================================== --- head/etc/devd/apple.conf Mon Dec 5 00:00:47 2011 (r228269) +++ head/etc/devd/apple.conf Mon Dec 5 00:12:10 2011 (r228270) @@ -11,6 +11,16 @@ notify 0 { }; +# Keyboard power key +notify 0 { + match "system" "PMU"; + match "subsystem" "lid"; + match "type" "close"; + match "notify" "0x0"; + action "shutdown -p now"; +}; + + # The next blocks enable volume hotkeys that can be found on Apple laptops notify 0 { match "system" "PMU"; Modified: head/sys/powerpc/powermac/pmu.c ============================================================================== --- head/sys/powerpc/powermac/pmu.c Mon Dec 5 00:00:47 2011 (r228269) +++ head/sys/powerpc/powermac/pmu.c Mon Dec 5 00:12:10 2011 (r228270) @@ -701,6 +701,20 @@ pmu_intr(void *arg) adb_receive_raw_packet(sc->adb_bus,resp[1],resp[2], len - 3,&resp[3]); } + if (resp[1] & PMU_INT_ENVIRONMENT) { + // if the lid was just closed, notify devd. + if ((resp[2] & PMU_ENV_LID_CLOSED) && (!sc->lid_closed)) { + sc->lid_closed = 1; + if (devctl_process_running()) + devctl_notify("PMU", "lid", "close", NULL); + } + else if (!(resp[2] & PMU_ENV_LID_CLOSED) && (sc->lid_closed)) { + // if the lid was just opened, notify devd. + if (devctl_process_running()) + devctl_notify("PMU", "lid", "open", NULL); + sc->lid_closed = 0; + } + } } static u_int Modified: head/sys/powerpc/powermac/pmuvar.h ============================================================================== --- head/sys/powerpc/powermac/pmuvar.h Mon Dec 5 00:00:47 2011 (r228269) +++ head/sys/powerpc/powermac/pmuvar.h Mon Dec 5 00:12:10 2011 (r228270) @@ -160,6 +160,7 @@ struct pmu_softc { volatile int sc_autopoll; int sc_batteries; struct cdev *sc_leddev; + int lid_closed; }; struct pmu_battstate { From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 02:56:09 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F48D106566B; Mon, 5 Dec 2011 02:56:09 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E9758FC15; Mon, 5 Dec 2011 02:56:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB52u8ni013957; Mon, 5 Dec 2011 02:56:08 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB52u8H6013955; Mon, 5 Dec 2011 02:56:08 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201112050256.pB52u8H6013955@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 5 Dec 2011 02:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228271 - head/sys/mips/nlm/hal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 02:56:09 -0000 Author: jchandra Date: Mon Dec 5 02:56:08 2011 New Revision: 228271 URL: http://svn.freebsd.org/changeset/base/228271 Log: Fix XLP compilation. Add definitions of LSU_DEBUG_ADDR and LSU_DEBUG_DATA0, the code that uses it was added in r227799 Reported by: gonzo Modified: head/sys/mips/nlm/hal/cpucontrol.h Modified: head/sys/mips/nlm/hal/cpucontrol.h ============================================================================== --- head/sys/mips/nlm/hal/cpucontrol.h Mon Dec 5 00:12:10 2011 (r228270) +++ head/sys/mips/nlm/hal/cpucontrol.h Mon Dec 5 02:56:08 2011 (r228271) @@ -44,6 +44,8 @@ #define CPU_BLOCKID_MAP 10 #define LSU_DEFEATURE 0x304 +#define LSU_DEBUG_ADDR 0x305 +#define LSU_DEBUG_DATA0 0x306 #define LSU_CERRLOG_REGID 0x09 #define SCHED_DEFEATURE 0x700 From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 03:10:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 477C41065676; Mon, 5 Dec 2011 03:10:02 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3199A8FC13; Mon, 5 Dec 2011 03:10:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB53A2aM014544; Mon, 5 Dec 2011 03:10:02 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB53A2bt014543; Mon, 5 Dec 2011 03:10:02 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201112050310.pB53A2bt014543@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 5 Dec 2011 03:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228272 - head/sys/mips/nlm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 03:10:02 -0000 Author: jchandra Date: Mon Dec 5 03:10:01 2011 New Revision: 228272 URL: http://svn.freebsd.org/changeset/base/228272 Log: Fix N32 compilation again for XLP. Disable DDB/KDB related options for N32, and add back a cast that was lost during the last set of updates. Reported by: gonzo, bz Modified: head/sys/mips/nlm/xlp_machdep.c Modified: head/sys/mips/nlm/xlp_machdep.c ============================================================================== --- head/sys/mips/nlm/xlp_machdep.c Mon Dec 5 02:56:08 2011 (r228271) +++ head/sys/mips/nlm/xlp_machdep.c Mon Dec 5 03:10:01 2011 (r228272) @@ -278,7 +278,7 @@ xlp_bootargs_init(__register_t arg) phandle_t chosen; ihandle_t mask; - dtbp = (void *)arg; + dtbp = (void *)(intptr_t)arg; #if defined(FDT_DTB_STATIC) /* * In case the device tree blob was not passed as argument try From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 03:18:41 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 225001065670; Mon, 5 Dec 2011 03:18:41 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 119D28FC08; Mon, 5 Dec 2011 03:18:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB53IeRH015015; Mon, 5 Dec 2011 03:18:40 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB53IeOo015013; Mon, 5 Dec 2011 03:18:40 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201112050318.pB53IeOo015013@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 5 Dec 2011 03:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228273 - head/sys/mips/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 03:18:41 -0000 Author: jchandra Date: Mon Dec 5 03:18:40 2011 New Revision: 228273 URL: http://svn.freebsd.org/changeset/base/228273 Log: Disable KDB/DDB options for XLP N32 compile. n32 abi is not supported in KDB/DDB yet, disable the option in XLPN32 conf. Reported by: gonzo, bz Modified: head/sys/mips/conf/XLPN32 Modified: head/sys/mips/conf/XLPN32 ============================================================================== --- head/sys/mips/conf/XLPN32 Mon Dec 5 03:10:01 2011 (r228272) +++ head/sys/mips/conf/XLPN32 Mon Dec 5 03:18:40 2011 (r228273) @@ -26,5 +26,11 @@ makeoptions KERNLOADADDR=0x80100000 include "std.XLP" +nooption DDB +nooption KDB +nooption GDB +nooption BREAK_TO_DEBUGGER +nooption ALT_BREAK_TO_DEBUGGER + makeoptions TRAMPLOADADDR=0xffffffff85000000 makeoptions TRAMP_ARCH_FLAGS="-mabi=64 -march=mips64" From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 04:20:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27BB81065670; Mon, 5 Dec 2011 04:20:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1E068FC16; Mon, 5 Dec 2011 04:20:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB54KDF2016882; Mon, 5 Dec 2011 04:20:13 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB54KDNg016878; Mon, 5 Dec 2011 04:20:13 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112050420.pB54KDNg016878@svn.freebsd.org> From: Eitan Adler Date: Mon, 5 Dec 2011 04:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228274 - head/tools/regression/pipe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 04:20:14 -0000 Author: eadler (ports committer) Date: Mon Dec 5 04:20:13 2011 New Revision: 228274 URL: http://svn.freebsd.org/changeset/base/228274 Log: Fix some uninitialized variables in pipe regression tests that result in failure. PR: misc/161175 Submitted by: gianni@ Approved by: nwhitehorn@ MFC after: 1 week Modified: head/tools/regression/pipe/pipe-fstatbug.c head/tools/regression/pipe/pipe-reverse.c head/tools/regression/pipe/pipe-wraparound.c Modified: head/tools/regression/pipe/pipe-fstatbug.c ============================================================================== --- head/tools/regression/pipe/pipe-fstatbug.c Mon Dec 5 03:18:40 2011 (r228273) +++ head/tools/regression/pipe/pipe-fstatbug.c Mon Dec 5 04:20:13 2011 (r228274) @@ -41,7 +41,7 @@ int main (void) { char buffer[32768], buffer2[32768]; int desc[2]; -int error, successes; +int error, successes = 0; struct stat status; pid_t new_pid; Modified: head/tools/regression/pipe/pipe-reverse.c ============================================================================== --- head/tools/regression/pipe/pipe-reverse.c Mon Dec 5 03:18:40 2011 (r228273) +++ head/tools/regression/pipe/pipe-reverse.c Mon Dec 5 04:20:13 2011 (r228274) @@ -44,6 +44,7 @@ struct stat status; pid_t new_pid; buggy = 0; +total = 0; error = pipe(desc); @@ -52,7 +53,7 @@ if (error) buffer[0] = 'A'; -for (i = 0; i < 65535; i++) { +for (i = 1; i < 65535; i++) { buffer[i] = buffer[i - 1] + 1; if (buffer[i] > 'Z') buffer[i] = 'A'; Modified: head/tools/regression/pipe/pipe-wraparound.c ============================================================================== --- head/tools/regression/pipe/pipe-wraparound.c Mon Dec 5 03:18:40 2011 (r228273) +++ head/tools/regression/pipe/pipe-wraparound.c Mon Dec 5 04:20:13 2011 (r228274) @@ -44,6 +44,7 @@ struct stat status; pid_t new_pid; buggy = 0; +total = 0; error = pipe(desc); @@ -52,7 +53,7 @@ if (error) buffer[0] = 'A'; -for (i = 0; i < 32768; i++) { +for (i = 1; i < 32768; i++) { buffer[i] = buffer[i - 1] + 1; if (buffer[i] > 'Z') buffer[i] = 'A'; From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 10:34:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33EE01065743; Mon, 5 Dec 2011 10:34:53 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A2CA8FC1D; Mon, 5 Dec 2011 10:34:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5AYqX2031129; Mon, 5 Dec 2011 10:34:52 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5AYqfq031127; Mon, 5 Dec 2011 10:34:52 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201112051034.pB5AYqfq031127@svn.freebsd.org> From: Kevin Lo Date: Mon, 5 Dec 2011 10:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228275 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 10:34:53 -0000 Author: kevlo Date: Mon Dec 5 10:34:52 2011 New Revision: 228275 URL: http://svn.freebsd.org/changeset/base/228275 Log: Add a missing curly bracket Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Mon Dec 5 04:20:13 2011 (r228274) +++ head/sys/kern/kern_cpuset.c Mon Dec 5 10:34:52 2011 (r228275) @@ -900,6 +900,7 @@ struct cpuset_getid_args { cpuwhich_t which; id_t id; cpusetid_t *setid; +}; #endif int sys_cpuset_getid(struct thread *td, struct cpuset_getid_args *uap) From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 11:04:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A08011065673; Mon, 5 Dec 2011 11:04:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 3ADF08FC0A; Mon, 5 Dec 2011 11:04:38 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pB5B4ZBE006113 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Dec 2011 13:04:35 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pB5B4ZAk002152; Mon, 5 Dec 2011 13:04:35 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pB5B4Zr8002151; Mon, 5 Dec 2011 13:04:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 5 Dec 2011 13:04:35 +0200 From: Kostik Belousov To: Jilles Tjoelker Message-ID: <20111205110435.GP50300@deviant.kiev.zoral.com.ua> References: <201112050000.pB500mrQ008548@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jCr45KaQ2ES41j5N" Content-Disposition: inline In-Reply-To: <201112050000.pB500mrQ008548@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228269 - head/lib/libc/locale X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 11:04:39 -0000 --jCr45KaQ2ES41j5N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 05, 2011 at 12:00:48AM +0000, Jilles Tjoelker wrote: > Author: jilles > Date: Mon Dec 5 00:00:47 2011 > New Revision: 228269 > URL: http://svn.freebsd.org/changeset/base/228269 >=20 > Log: > libc: Eliminate 13 relative relocations in wctype(). >=20 This reminds me the following change I had intended to do for quite some time. The hack for openssl is due to buggy assembler, which exactly the case I want to avoid for the base code. commit 3fdba61936a011b768845a8336ad2529e77e8ddb Author: Kostik Belousov Date: Mon Dec 5 13:01:48 2011 +0200 Fail the build when text relocations are generated for dso. diff --git a/secure/lib/libcrypto/Makefile b/secure/lib/libcrypto/Makefile index 0a1704c..73f5cb7 100644 --- a/secure/lib/libcrypto/Makefile +++ b/secure/lib/libcrypto/Makefile @@ -7,6 +7,7 @@ SUBDIR=3D engines =20 LIB=3D crypto SHLIB_MAJOR=3D 6 +ALLOW_SHARED_TEXTREL=3D =20 NO_LINT=3D =20 diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 1e43921..40632de 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -167,6 +167,11 @@ SOBJS+=3D ${OBJS:.o=3D.So} .if defined(SHLIB_NAME) _LIBS+=3D ${SHLIB_NAME} =20 +SOLINKOPTS=3D -shared -Wl,-x -Wl,--fatal-warnings +.if !defined(ALLOW_SHARED_TEXTREL) +SOLINKOPTS+=3D -Wl,--warn-shared-textrel +.endif + .if target(beforelinking) ${SHLIB_NAME}: ${SOBJS} beforelinking .else @@ -178,11 +183,11 @@ ${SHLIB_NAME}: ${SOBJS} @ln -fs ${.TARGET} ${SHLIB_LINK} .endif .if !defined(NM) - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `lorder ${SOBJS} | tsort -q` ${LDADD} .else - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `NM=3D'${NM}' lorder ${SOBJS} | tsort -q` ${LDADD} .endif --jCr45KaQ2ES41j5N Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7cpUIACgkQC3+MBN1Mb4jvuQCgrtwpBdGs62gNlrbc//IbwAck FpwAn1viuk26sLf0u/u0E7g4Ncz3ti3k =x5Y3 -----END PGP SIGNATURE----- --jCr45KaQ2ES41j5N-- From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 12:06:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75662106564A; Mon, 5 Dec 2011 12:06:53 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 626A58FC0C; Mon, 5 Dec 2011 12:06:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5C6rWr036349; Mon, 5 Dec 2011 12:06:53 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5C6rxH036343; Mon, 5 Dec 2011 12:06:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201112051206.pB5C6rxH036343@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 5 Dec 2011 12:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228276 - in head: sys/dev/ixgbe sys/dev/netmap sys/net tools/tools/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 12:06:53 -0000 Author: luigi Date: Mon Dec 5 12:06:53 2011 New Revision: 228276 URL: http://svn.freebsd.org/changeset/base/228276 Log: 1. Fix the handling of link reset while in netmap more. A link reset now is completely transparent for the netmap client: even if the NIC resets its own ring (e.g. restarting from 0), the client will not see any change in the current rx/tx positions, because the driver will keep track of the offset between the two. 2. make the device-specific code more uniform across different drivers There were some inconsistencies in the implementation of the netmap support routines, now drivers have been aligned to a common code structure. 3. import netmap support for ixgbe . This is implemented as a very small patch for ixgbe.c (233 lines, 11 chunks, mostly comments: in total the patch has only 54 lines of new code) , as most of the code is in an external file sys/dev/netmap/ixgbe_netmap.h , following some initial comments from Jack Vogel about making changes less intrusive. (Note, i have emailed Jack multiple times asking if he had comments on this structure of the code; i got no reply so i assume he is fine with it). Support for other drivers (em, lem, re, igb) will come later. "ixgbe" is now the reference driver for netmap support. Both the external file (sys/dev/netmap/ixgbe_netmap.h) and the device-specific patches (in sys/dev/ixgbe/ixgbe.c) are heavily commented and should serve as a reference for other device drivers. Tested on i386 and amd64 with the pkt-gen program in tools/tools/netmap, the sender does 14.88 Mpps at 1050 Mhz and 14.2 Mpps at 900 MHz on an i7-860 with 4 cores and 82599 card. Haven't tried yet more aggressive optimizations such as adding 'prefetch' instructions in the time-critical parts of the code. Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h head/sys/net/netmap.h head/tools/tools/netmap/pkt-gen.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Mon Dec 5 10:34:52 2011 (r228275) +++ head/sys/dev/ixgbe/ixgbe.c Mon Dec 5 12:06:53 2011 (r228276) @@ -313,6 +313,18 @@ static int atr_sample_rate = 20; static int fdir_pballoc = 1; #endif +#ifdef DEV_NETMAP +/* + * The #ifdef DEV_NETMAP / #endif blocks in this file are meant to + * be a reference on how to implement netmap support in a driver. + * Additional comments are in ixgbe_netmap.h . + * + * contains functions for netmap support + * that extend the standard driver. + */ +#include +#endif /* DEV_NETMAP */ + /********************************************************************* * Device identification routine * @@ -578,6 +590,9 @@ ixgbe_attach(device_t dev) ixgbe_add_hw_stats(adapter); +#ifdef DEV_NETMAP + ixgbe_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("ixgbe_attach: end"); return (0); err_late: @@ -652,6 +667,9 @@ ixgbe_detach(device_t dev) ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); +#ifdef DEV_NETMAP + netmap_detach(adapter->ifp); +#endif /* DEV_NETMAP */ ixgbe_free_pci_resources(adapter); bus_generic_detach(dev); if_free(adapter->ifp); @@ -2813,9 +2831,20 @@ ixgbe_setup_transmit_ring(struct tx_ring struct adapter *adapter = txr->adapter; struct ixgbe_tx_buf *txbuf; int i; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old ring contents */ IXGBE_TX_LOCK(txr); +#ifdef DEV_NETMAP + /* + * (under lock): if in netmap mode, do some consistency + * checks and set slot to entry 0 of the netmap ring. + */ + slot = netmap_reset(na, NR_TX, txr->me, 0); +#endif /* DEV_NETMAP */ bzero((void *)txr->tx_base, (sizeof(union ixgbe_adv_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -2832,6 +2861,26 @@ ixgbe_setup_transmit_ring(struct tx_ring m_freem(txbuf->m_head); txbuf->m_head = NULL; } +#ifdef DEV_NETMAP + /* + * In netmap mode, set the map for the packet buffer. + * NOTE: Some drivers (not this one) also need to set + * the physical buffer address in the NIC ring. + * Slots in the netmap ring (indexed by "si") are + * kring->nkr_hwofs positions "ahead" wrt the + * corresponding slot in the NIC ring. In some drivers + * (not here) nkr_hwofs can be negative. When computing + * si = i + kring->nkr_hwofs make sure to handle wraparounds. + */ + if (slot) { + int si = i + na->tx_rings[txr->me].nkr_hwofs; + + if (si >= na->num_tx_desc) + si -= na->num_tx_desc; + netmap_load_map(txr->txtag, txbuf->map, + NMB(slot + si), na->buff_size); + } +#endif /* DEV_NETMAP */ /* Clear the EOP index */ txbuf->eop_index = -1; } @@ -3310,6 +3359,29 @@ ixgbe_txeof(struct tx_ring *txr) mtx_assert(&txr->tx_mtx, MA_OWNED); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + /* + * In netmap mode, all the work is done in the context + * of the client thread. Interrupt handlers only wake up + * clients, which may be sleeping on individual rings + * or on a global resource for all rings. + * When the driver has separate locks, we need to + * release and re-acquire txlock to avoid deadlocks. + * XXX see if we can find a better way. + */ + selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); + IXGBE_TX_UNLOCK(txr); + IXGBE_CORE_LOCK(adapter); + selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + IXGBE_CORE_UNLOCK(adapter); + IXGBE_TX_LOCK(txr); + return FALSE; + } +#endif /* DEV_NETMAP */ + if (txr->tx_avail == adapter->num_tx_desc) { txr->queue_status = IXGBE_QUEUE_IDLE; return FALSE; @@ -3698,6 +3770,10 @@ ixgbe_setup_receive_ring(struct rx_ring bus_dma_segment_t pseg[1], hseg[1]; struct lro_ctrl *lro = &rxr->lro; int rsize, nsegs, error = 0; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(rxr->adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ adapter = rxr->adapter; ifp = adapter->ifp; @@ -3705,6 +3781,10 @@ ixgbe_setup_receive_ring(struct rx_ring /* Clear the ring contents */ IXGBE_RX_LOCK(rxr); +#ifdef DEV_NETMAP + /* same as in ixgbe_setup_transmit_ring() */ + slot = netmap_reset(na, NR_RX, rxr->me, 0); +#endif /* DEV_NETMAP */ rsize = roundup2(adapter->num_rx_desc * sizeof(union ixgbe_adv_rx_desc), DBA_ALIGN); bzero((void *)rxr->rx_base, rsize); @@ -3721,6 +3801,29 @@ ixgbe_setup_receive_ring(struct rx_ring struct mbuf *mh, *mp; rxbuf = &rxr->rx_buffers[j]; +#ifdef DEV_NETMAP + /* + * In netmap mode, fill the map and set the buffer + * address in the NIC ring, considering the offset + * between the netmap and NIC rings (see comment in + * ixgbe_setup_transmit_ring() ). No need to allocate + * an mbuf, so end the block with a continue; + */ + if (slot) { + int sj = j + na->rx_rings[rxr->me].nkr_hwofs; + void *addr; + + if (sj >= na->num_rx_desc) + sj -= na->num_rx_desc; + addr = NMB(slot + sj); + netmap_load_map(rxr->ptag, + rxbuf->pmap, addr, na->buff_size); + /* Update descriptor */ + rxr->rx_base[j].read.pkt_addr = + htole64(vtophys(addr)); + continue; + } +#endif /* DEV_NETMAP */ /* ** Don't allocate mbufs if not ** doing header split, its wasteful @@ -3913,6 +4016,35 @@ ixgbe_initialize_receive_units(struct ad /* Setup the HW Rx Head and Tail Descriptor Pointers */ IXGBE_WRITE_REG(hw, IXGBE_RDH(i), 0); +#ifdef DEV_NETMAP + /* + * In netmap mode, we must preserve the buffers made + * available to userspace before the if_init() + * (this is true by default on the TX side, because + * init makes all buffers available to userspace). + * + * netmap_reset() and the device specific routines + * (e.g. ixgbe_setup_receive_rings()) map these + * buffers at the end of the NIC ring, so here we + * must set the RDT (tail) register to make sure + * they are not overwritten. + * + * In this driver the NIC ring starts at RDH = 0, + * RDT points to the first 'busy' slot, so RDT = 0 + * means the whole ring is available, and + * RDT = (num_rx_desc - X) means X slots are available. + * Computations are done modulo the ring size. + */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = na->num_rx_desc - kring->nr_hwavail; + + if (t >= na->num_rx_desc) + t -= adapter->num_rx_desc; + IXGBE_WRITE_REG(hw, IXGBE_RDT(i), t); + } else +#endif /* DEV_NETMAP */ IXGBE_WRITE_REG(hw, IXGBE_RDT(i), 0); } @@ -4148,6 +4280,22 @@ ixgbe_rxeof(struct ix_queue *que, int co IXGBE_RX_LOCK(rxr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + /* + * Same as the txeof routine, only wakeup clients + * and make sure there are no deadlocks. + */ + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); + IXGBE_RX_UNLOCK(rxr); + IXGBE_CORE_LOCK(adapter); + selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + IXGBE_CORE_UNLOCK(adapter); + return (FALSE); + } +#endif /* DEV_NETMAP */ for (i = rxr->next_to_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; u32 rsc, ptype; Modified: head/sys/dev/netmap/if_em_netmap.h ============================================================================== --- head/sys/dev/netmap/if_em_netmap.h Mon Dec 5 10:34:52 2011 (r228275) +++ head/sys/dev/netmap/if_em_netmap.h Mon Dec 5 12:06:53 2011 (r228276) @@ -9,7 +9,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -25,9 +25,12 @@ /* * $FreeBSD$ - * $Id: if_em_netmap.h 9662 2011-11-16 13:18:06Z luigi $ + * $Id: if_em_netmap.h 9802 2011-12-02 18:42:37Z luigi $ * * netmap changes for if_em. + * + * For structure and details on the individual functions please see + * ixgbe_netmap.h */ #include @@ -58,12 +61,7 @@ em_netmap_attach(struct adapter *adapter na.nm_rxsync = em_netmap_rxsync; na.nm_lock = em_netmap_lock_wrapper; na.nm_register = em_netmap_reg; - /* - * adapter->rx_mbuf_sz is set by SIOCSETMTU, but in netmap mode - * we allocate the buffers on the first register. So we must - * disallow a SIOCSETMTU when if_capenable & IFCAP_NETMAP is set. - */ - na.buff_size = MCLBYTES; + na.buff_size = NETMAP_BUF_SIZE; netmap_attach(&na, adapter->num_queues); } @@ -100,6 +98,7 @@ em_netmap_lock_wrapper(void *_a, int wha } +// XXX do we need to block/unblock the tasks ? static void em_netmap_block_tasks(struct adapter *adapter) { @@ -162,9 +161,6 @@ em_netmap_reg(struct ifnet *ifp, int ono if (onoff) { ifp->if_capenable |= IFCAP_NETMAP; - /* save if_transmit for later restore. - * XXX also if_start and if_qflush ? - */ na->if_transmit = ifp->if_transmit; ifp->if_transmit = netmap_start; @@ -179,15 +175,13 @@ fail: ifp->if_transmit = na->if_transmit; ifp->if_capenable &= ~IFCAP_NETMAP; em_init_locked(adapter); /* also enable intr */ - } em_netmap_unblock_tasks(adapter); return (error); } /* - * Reconcile hardware and user view of the transmit ring, see - * ixgbe.c for details. + * Reconcile hardware and user view of the transmit ring. */ static int em_netmap_txsync(void *a, u_int ring_nr, int do_lock) @@ -197,13 +191,13 @@ em_netmap_txsync(void *a, u_int ring_nr, struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->tx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; k = ring->cur; - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) @@ -211,35 +205,20 @@ em_netmap_txsync(void *a, u_int ring_nr, bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_POSTREAD); - /* record completed transmissions TODO - * - * instead of using TDH, we could read the transmitted status bit. + /* check for new packets to send. + * j indexes the netmap ring, l indexes the nic ring, and + * j = kring->nr_hwcur, l = E1000_TDT (not tracked), + * j == (l + kring->nkr_hwofs) % ring_size */ - j = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); - if (j >= kring->nkr_num_slots) { /* XXX can happen */ - D("TDH wrap %d", j); - j -= kring->nkr_num_slots; - } - int delta = j - txr->next_to_clean; - if (delta) { - /* new transmissions were completed, increment - ring->nr_hwavail. */ - if (delta < 0) - delta += kring->nkr_num_slots; - txr->next_to_clean = j; - kring->nr_hwavail += delta; - } - - /* update avail to what the hardware knows */ - ring->avail = kring->nr_hwavail; - j = kring->nr_hwcur; if (j != k) { /* we have packets to send */ - n = 0; + l = j - kring->nkr_hwofs; + if (l < 0) + l += lim + 1; while (j != k) { struct netmap_slot *slot = &ring->slot[j]; - struct e1000_tx_desc *curr = &txr->tx_base[j]; - struct em_buffer *txbuf = &txr->tx_buffers[j]; + struct e1000_tx_desc *curr = &txr->tx_base[l]; + struct em_buffer *txbuf = &txr->tx_buffers[l]; int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? E1000_TXD_CMD_RS : 0; @@ -254,42 +233,61 @@ em_netmap_txsync(void *a, u_int ring_nr, slot->flags &= ~NS_REPORT; curr->upper.data = 0; curr->lower.data = - htole32( - adapter->txd_cmd | - (E1000_TXD_CMD_EOP | flags) | - slot->len); + htole32(adapter->txd_cmd | len | + (E1000_TXD_CMD_EOP | flags) ); if (slot->flags & NS_BUF_CHANGED) { curr->buffer_addr = htole64(vtophys(addr)); - /* buffer has changed, unload and reload map */ + /* buffer has changed, reload map */ netmap_reload_map(txr->txtag, txbuf->map, - addr, na->buff_size); + addr, na->buff_size); slot->flags &= ~NS_BUF_CHANGED; } bus_dmamap_sync(txr->txtag, txbuf->map, BUS_DMASYNC_PREWRITE); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; n++; } - kring->nr_hwcur = ring->cur; + kring->nr_hwcur = k; /* decrease avail by number of sent packets */ - ring->avail -= n; - kring->nr_hwavail = ring->avail; + kring->nr_hwavail -= n; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), - ring->cur); + E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), l); } + + if (n == 0 || kring->nr_hwavail < 1) { + int delta; + + /* record completed transmissions using THD. */ + l = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); + if (l >= kring->nkr_num_slots) { /* XXX can happen */ + D("TDH wrap %d", l); + l -= kring->nkr_num_slots; + } + delta = l - txr->next_to_clean; + if (delta) { + /* some completed, increment hwavail. */ + if (delta < 0) + delta += kring->nkr_num_slots; + txr->next_to_clean = l; + kring->nr_hwavail += delta; + } + } + /* update avail to what the hardware knows */ + ring->avail = kring->nr_hwavail; + if (do_lock) EM_TX_UNLOCK(txr); return 0; } /* - * Reconcile kernel and user view of the receive ring, see ixgbe.c + * Reconcile kernel and user view of the receive ring. */ static int em_netmap_rxsync(void *a, u_int ring_nr, int do_lock) @@ -299,10 +297,10 @@ em_netmap_rxsync(void *a, u_int ring_nr, struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->rx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n, lim = kring->nkr_num_slots - 1; k = ring->cur; - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) @@ -311,36 +309,52 @@ em_netmap_rxsync(void *a, u_int ring_nr, bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - /* acknowledge all the received packets. */ - j = rxr->next_to_check; + /* import newly received packets into the netmap ring. + * j is an index in the netmap ring, l in the NIC ring, and + * j = (kring->nr_hwcur + kring->nr_hwavail) % ring_size + * l = rxr->next_to_check; + * and + * j == (l + kring->nkr_hwofs) % ring_size + */ + l = rxr->next_to_check; + j = l + kring->nkr_hwofs; + /* here nkr_hwofs can be negative so must check for j < 0 */ + if (j < 0) + j += lim + 1; + else if (j > lim) + j -= lim + 1; for (n = 0; ; n++) { - struct e1000_rx_desc *curr = &rxr->rx_base[j]; + struct e1000_rx_desc *curr = &rxr->rx_base[l]; if ((curr->status & E1000_RXD_STAT_DD) == 0) break; ring->slot[j].len = le16toh(curr->length); - bus_dmamap_sync(rxr->tag, rxr->rx_buffers[j].map, + bus_dmamap_sync(rxr->tag, rxr->rx_buffers[l].map, BUS_DMASYNC_POSTREAD); j = (j == lim) ? 0 : j + 1; + /* make sure next_to_refresh follows next_to_check */ + rxr->next_to_refresh = l; // XXX + l = (l == lim) ? 0 : l + 1; } if (n) { - rxr->next_to_check = j; + rxr->next_to_check = l; kring->nr_hwavail += n; } - /* skip past packets that userspace has already processed: - * making them available for reception. - * advance nr_hwcur and issue a bus_dmamap_sync on the - * buffers so it is safe to write to them. - * Also increase nr_hwavail - */ + /* skip past packets that userspace has already processed */ j = kring->nr_hwcur; if (j != k) { /* userspace has read some packets. */ n = 0; + l = j - kring->nkr_hwofs; /* NIC ring index */ + /* here nkr_hwofs can be negative so check for l > lim */ + if (l < 0) + l += lim + 1; + else if (l > lim) + l -= lim + 1; while (j != k) { struct netmap_slot *slot = &ring->slot[j]; - struct e1000_rx_desc *curr = &rxr->rx_base[j]; - struct em_buffer *rxbuf = &rxr->rx_buffers[j]; + struct e1000_rx_desc *curr = &rxr->rx_base[l]; + struct em_buffer *rxbuf = &rxr->rx_buffers[l]; void *addr = NMB(slot); if (addr == netmap_buffer_base) { /* bad buf */ @@ -352,28 +366,29 @@ em_netmap_rxsync(void *a, u_int ring_nr, curr->status = 0; if (slot->flags & NS_BUF_CHANGED) { curr->buffer_addr = htole64(vtophys(addr)); - /* buffer has changed, unload and reload map */ + /* buffer has changed, reload map */ netmap_reload_map(rxr->rxtag, rxbuf->map, - addr, na->buff_size); + addr, na->buff_size); slot->flags &= ~NS_BUF_CHANGED; } bus_dmamap_sync(rxr->rxtag, rxbuf->map, - BUS_DMASYNC_PREREAD); + BUS_DMASYNC_PREREAD); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; n++; } kring->nr_hwavail -= n; - kring->nr_hwcur = ring->cur; + kring->nr_hwcur = k; bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* * IMPORTANT: we must leave one free slot in the ring, - * so move j back by one unit + * so move l back by one unit */ - j = (j == 0) ? lim : j - 1; - E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), j); + l = (l == 0) ? lim : l - 1; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), l); } /* tell userspace that there are new packets */ ring->avail = kring->nr_hwavail ; Modified: head/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- head/sys/dev/netmap/if_igb_netmap.h Mon Dec 5 10:34:52 2011 (r228275) +++ head/sys/dev/netmap/if_igb_netmap.h Mon Dec 5 12:06:53 2011 (r228276) @@ -25,7 +25,7 @@ /* * $FreeBSD$ - * $Id: if_igb_netmap.h 9662 2011-11-16 13:18:06Z luigi $ + * $Id: if_igb_netmap.h 9802 2011-12-02 18:42:37Z luigi $ * * netmap modifications for igb * contribured by Ahmed Kooli @@ -58,12 +58,7 @@ igb_netmap_attach(struct adapter *adapte na.nm_rxsync = igb_netmap_rxsync; na.nm_lock = igb_netmap_lock_wrapper; na.nm_register = igb_netmap_reg; - /* - * adapter->rx_mbuf_sz is set by SIOCSETMTU, but in netmap mode - * we allocate the buffers on the first register. So we must - * disallow a SIOCSETMTU when if_capenable & IFCAP_NETMAP is set. - */ - na.buff_size = MCLBYTES; + na.buff_size = NETMAP_BUF_SIZE; netmap_attach(&na, adapter->num_queues); } @@ -111,7 +106,7 @@ igb_netmap_reg(struct ifnet *ifp, int on struct netmap_adapter *na = NA(ifp); int error = 0; - if (!na) + if (na == NULL) return EINVAL; igb_disable_intr(adapter); @@ -144,21 +139,6 @@ fail: /* * Reconcile kernel and user view of the transmit ring. - * - * Userspace has filled tx slots up to cur (excluded). - * The last unused slot previously known to the kernel was nr_hwcur, - * and the last interrupt reported nr_hwavail slots available - * (using the special value -1 to indicate idle transmit ring). - * The function must first update avail to what the kernel - * knows, subtract the newly used slots (cur - nr_hwcur) - * from both avail and nr_hwavail, and set nr_hwcur = cur - * issuing a dmamap_sync on all slots. - * - * Check parameters in the struct netmap_ring. - * We don't use avail, only check for bogus values. - * Make sure cur is valid, and same goes for buffer indexes and lengths. - * To avoid races, read the values once, and never use those from - * the ring afterwards. */ static int igb_netmap_txsync(void *a, u_int ring_nr, int do_lock) @@ -168,54 +148,40 @@ igb_netmap_txsync(void *a, u_int ring_nr struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->tx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; - k = ring->cur; /* ring is not protected by any lock */ - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + k = ring->cur; + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) IGB_TX_LOCK(txr); bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, - BUS_DMASYNC_POSTREAD); - - /* record completed transmissions. TODO - * - * Instead of reading from the TDH register, we could and try to check - * the status bit of descriptor packets. - */ - j = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); - if (j >= kring->nkr_num_slots) /* XXX can it happen ? */ - j -= kring->nkr_num_slots; - int delta = j - txr->next_to_clean; - if (delta) { - /* new tx were completed */ - if (delta < 0) - delta += kring->nkr_num_slots; - txr->next_to_clean = j; - kring->nr_hwavail += delta; - } + BUS_DMASYNC_POSTREAD); /* update avail to what the hardware knows */ ring->avail = kring->nr_hwavail; - j = kring->nr_hwcur; + j = kring->nr_hwcur; /* netmap ring index */ if (j != k) { /* we have new packets to send */ u32 olinfo_status = 0; - n = 0; + int n = 0; + l = j - kring->nkr_hwofs; /* NIC ring index */ + if (l < 0) + l += lim + 1; /* 82575 needs the queue index added */ if (adapter->hw.mac.type == e1000_82575) olinfo_status |= txr->me << 4; while (j != k) { struct netmap_slot *slot = &ring->slot[j]; - struct igb_tx_buffer *txbuf = &txr->tx_buffers[j]; + struct igb_tx_buffer *txbuf = &txr->tx_buffers[l]; union e1000_adv_tx_desc *curr = - (union e1000_adv_tx_desc *)&txr->tx_base[j]; + (union e1000_adv_tx_desc *)&txr->tx_base[l]; void *addr = NMB(slot); int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? @@ -229,6 +195,7 @@ igb_netmap_txsync(void *a, u_int ring_nr } slot->flags &= ~NS_REPORT; + // XXX do we need to set the address ? curr->read.buffer_addr = htole64(vtophys(addr)); curr->read.olinfo_status = htole32(olinfo_status | @@ -239,7 +206,7 @@ igb_netmap_txsync(void *a, u_int ring_nr E1000_ADVTXD_DCMD_DEXT | E1000_ADVTXD_DCMD_EOP | flags); if (slot->flags & NS_BUF_CHANGED) { - /* buffer has changed, unload and reload map */ + /* buffer has changed, reload map */ netmap_reload_map(txr->txtag, txbuf->map, addr, na->buff_size); slot->flags &= ~NS_BUF_CHANGED; @@ -248,22 +215,40 @@ igb_netmap_txsync(void *a, u_int ring_nr bus_dmamap_sync(txr->txtag, txbuf->map, BUS_DMASYNC_PREWRITE); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; n++; } kring->nr_hwcur = k; /* decrease avail by number of sent packets */ - ring->avail -= n; - kring->nr_hwavail = ring->avail; + kring->nr_hwavail -= n; + ring->avail = kring->nr_hwavail; - /* Set the watchdog */ + /* Set the watchdog XXX ? */ txr->queue_status = IGB_QUEUE_WORKING; txr->watchdog_time = ticks; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), k); + E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), l); + } + if (n == 0 || kring->nr_hwavail < 1) { + int delta; + + /* record completed transmission using TDH */ + l = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); + if (l >= kring->nkr_num_slots) /* XXX can it happen ? */ + l -= kring->nkr_num_slots; + delta = l - txr->next_to_clean; + if (delta) { + /* new tx were completed */ + if (delta < 0) + delta += kring->nkr_num_slots; + txr->next_to_clean = l; + kring->nr_hwavail += delta; + ring->avail = kring->nr_hwavail; + } } if (do_lock) IGB_TX_UNLOCK(txr); @@ -273,15 +258,6 @@ igb_netmap_txsync(void *a, u_int ring_nr /* * Reconcile kernel and user view of the receive ring. - * - * Userspace has read rx slots up to cur (excluded). - * The last unread slot previously known to the kernel was nr_hwcur, - * and the last interrupt reported nr_hwavail slots available. - * We must subtract the newly consumed slots (cur - nr_hwcur) - * from nr_hwavail, clearing the descriptors for the next - * read, tell the hardware that they are available, - * and set nr_hwcur = cur and avail = nr_hwavail. - * issuing a dmamap_sync on all slots. */ static int igb_netmap_rxsync(void *a, u_int ring_nr, int do_lock) @@ -291,10 +267,10 @@ igb_netmap_rxsync(void *a, u_int ring_nr struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->rx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n, lim = kring->nkr_num_slots - 1; - k = ring->cur; /* ring is not protected by any lock */ - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + k = ring->cur; + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) @@ -304,9 +280,12 @@ igb_netmap_rxsync(void *a, u_int ring_nr bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - j = rxr->next_to_check; + l = rxr->next_to_check; + j = l + kring->nkr_hwofs; + if (j > lim) + j -= lim + 1; for (n = 0; ; n++) { - union e1000_adv_rx_desc *curr = &rxr->rx_base[j]; + union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; uint32_t staterr = le32toh(curr->wb.upper.status_error); if ((staterr & E1000_RXD_STAT_DD) == 0) @@ -314,15 +293,13 @@ igb_netmap_rxsync(void *a, u_int ring_nr ring->slot[j].len = le16toh(curr->wb.upper.length); bus_dmamap_sync(rxr->ptag, - rxr->rx_buffers[j].pmap, BUS_DMASYNC_POSTREAD); + rxr->rx_buffers[l].pmap, BUS_DMASYNC_POSTREAD); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; } if (n) { - rxr->next_to_check = j; + rxr->next_to_check = l; kring->nr_hwavail += n; - if (kring->nr_hwavail >= lim - 10) { - ND("rx ring %d almost full %d", ring_nr, kring->nr_hwavail); - } } /* skip past packets that userspace has already processed, @@ -332,12 +309,15 @@ igb_netmap_rxsync(void *a, u_int ring_nr * Also increase nr_hwavail */ j = kring->nr_hwcur; + l = kring->nr_hwcur - kring->nkr_hwofs; + if (l < 0) + l += lim + 1; if (j != k) { /* userspace has read some packets. */ n = 0; while (j != k) { struct netmap_slot *slot = ring->slot + j; - union e1000_adv_rx_desc *curr = &rxr->rx_base[j]; - struct igb_rx_buf *rxbuf = rxr->rx_buffers + j; + union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; + struct igb_rx_buf *rxbuf = rxr->rx_buffers + l; void *addr = NMB(slot); if (addr == netmap_buffer_base) { /* bad buf */ @@ -358,6 +338,7 @@ igb_netmap_rxsync(void *a, u_int ring_nr BUS_DMASYNC_PREREAD); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; n++; } kring->nr_hwavail -= n; @@ -365,10 +346,10 @@ igb_netmap_rxsync(void *a, u_int ring_nr bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* IMPORTANT: we must leave one free slot in the ring, - * so move j back by one unit + * so move l back by one unit */ - j = (j == 0) ? lim : j - 1; - E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), j); + l = (l == 0) ? lim : l - 1; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), l); } /* tell userspace that there are new packets */ ring->avail = kring->nr_hwavail ; Modified: head/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- head/sys/dev/netmap/if_lem_netmap.h Mon Dec 5 10:34:52 2011 (r228275) +++ head/sys/dev/netmap/if_lem_netmap.h Mon Dec 5 12:06:53 2011 (r228276) @@ -25,9 +25,12 @@ /* * $FreeBSD$ - * $Id: if_lem_netmap.h 9662 2011-11-16 13:18:06Z luigi $ + * $Id: if_lem_netmap.h 9802 2011-12-02 18:42:37Z luigi $ * * netmap support for if_lem.c + * + * For structure and details on the individual functions please see + * ixgbe_netmap.h */ #include @@ -59,7 +62,7 @@ lem_netmap_attach(struct adapter *adapte na.nm_rxsync = lem_netmap_rxsync; na.nm_lock = lem_netmap_lock_wrapper; na.nm_register = lem_netmap_reg; - na.buff_size = MCLBYTES; + na.buff_size = NETMAP_BUF_SIZE; netmap_attach(&na, 1); } @@ -94,7 +97,61 @@ lem_netmap_lock_wrapper(void *_a, int wh /* - * Reconcile kernel and user view of the transmit ring. see ixgbe.c + * Register/unregister routine + */ +static int +lem_netmap_reg(struct ifnet *ifp, int onoff) +{ + struct adapter *adapter = ifp->if_softc; + struct netmap_adapter *na = NA(ifp); + int error = 0; + + if (na == NULL) + return EINVAL; + + lem_disable_intr(adapter); + + /* Tell the stack that the interface is no longer active */ + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + /* lem_netmap_block_tasks(adapter); */ +#ifndef EM_LEGACY_IRQ // XXX do we need this ? + taskqueue_block(adapter->tq); + taskqueue_drain(adapter->tq, &adapter->rxtx_task); + taskqueue_drain(adapter->tq, &adapter->link_task); +#endif /* !EM_LEGCY_IRQ */ + if (onoff) { + ifp->if_capenable |= IFCAP_NETMAP; + + /* save if_transmit to restore it when exiting. + * XXX what about if_start and if_qflush ? + */ + na->if_transmit = ifp->if_transmit; + ifp->if_transmit = netmap_start; + + lem_init_locked(adapter); + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == 0) { + error = ENOMEM; + goto fail; + } + } else { +fail: + /* restore non-netmap mode */ + ifp->if_transmit = na->if_transmit; + ifp->if_capenable &= ~IFCAP_NETMAP; + lem_init_locked(adapter); /* also enables intr */ + } + +#ifndef EM_LEGACY_IRQ + taskqueue_unblock(adapter->tq); // XXX do we need this ? +#endif /* !EM_LEGCY_IRQ */ + + return (error); +} + + +/* + * Reconcile kernel and user view of the transmit ring. */ static int lem_netmap_txsync(void *a, u_int ring_nr, int do_lock) @@ -103,13 +160,13 @@ lem_netmap_txsync(void *a, u_int ring_nr struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->tx_rings[0]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; k = ring->cur; - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) @@ -117,33 +174,18 @@ lem_netmap_txsync(void *a, u_int ring_nr bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, BUS_DMASYNC_POSTREAD); - /* record completed transmissions TODO - * - * instead of using TDH, we could read the transmitted status bit. - */ - j = E1000_READ_REG(&adapter->hw, E1000_TDH(0)); - if (j >= kring->nkr_num_slots) { /* can it happen ? */ - D("bad TDH %d", j); - j -= kring->nkr_num_slots; - } - int delta = j - adapter->next_tx_to_clean; - if (delta) { - if (delta < 0) - delta += kring->nkr_num_slots; - adapter->next_tx_to_clean = j; - kring->nr_hwavail += delta; - } - /* update avail to what the hardware knows */ ring->avail = kring->nr_hwavail; - j = kring->nr_hwcur; + j = kring->nr_hwcur; /* points into the netmap ring */ if (j != k) { /* we have new packets to send */ - n = 0; + l = j - kring->nkr_hwofs; /* points into the NIC ring */ + if (l < 0) + l += lim + 1; while (j != k) { struct netmap_slot *slot = &ring->slot[j]; - struct e1000_tx_desc *curr = &adapter->tx_desc_base[j]; - struct em_buffer *txbuf = &adapter->tx_buffer_area[j]; + struct e1000_tx_desc *curr = &adapter->tx_desc_base[l]; + struct em_buffer *txbuf = &adapter->tx_buffer_area[l]; void *addr = NMB(slot); int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? @@ -156,34 +198,54 @@ lem_netmap_txsync(void *a, u_int ring_nr return netmap_ring_reinit(kring); } + slot->flags &= ~NS_REPORT; curr->upper.data = 0; - /* always interrupt. XXX make it conditional */ curr->lower.data = htole32( adapter->txd_cmd | len | (E1000_TXD_CMD_EOP | flags) ); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 14:13:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41EAB1065678; Mon, 5 Dec 2011 14:13:22 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 312788FC13; Mon, 5 Dec 2011 14:13:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5EDMLX040471; Mon, 5 Dec 2011 14:13:22 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5EDLr0040468; Mon, 5 Dec 2011 14:13:21 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201112051413.pB5EDLr0040468@svn.freebsd.org> From: Justin Hibbits Date: Mon, 5 Dec 2011 14:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228277 - in head: etc/devd sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 14:13:22 -0000 Author: jhibbits Date: Mon Dec 5 14:13:21 2011 New Revision: 228277 URL: http://svn.freebsd.org/changeset/base/228277 Log: Fix style(9) issues from r228270. Approved by: nwhitehorn (mentor) Modified: head/etc/devd/apple.conf head/sys/powerpc/powermac/pmu.c Modified: head/etc/devd/apple.conf ============================================================================== --- head/etc/devd/apple.conf Mon Dec 5 12:06:53 2011 (r228276) +++ head/etc/devd/apple.conf Mon Dec 5 14:13:21 2011 (r228277) @@ -11,7 +11,7 @@ notify 0 { }; -# Keyboard power key +# PowerBook and iBook lid close. notify 0 { match "system" "PMU"; match "subsystem" "lid"; Modified: head/sys/powerpc/powermac/pmu.c ============================================================================== --- head/sys/powerpc/powermac/pmu.c Mon Dec 5 12:06:53 2011 (r228276) +++ head/sys/powerpc/powermac/pmu.c Mon Dec 5 14:13:21 2011 (r228277) @@ -702,14 +702,14 @@ pmu_intr(void *arg) len - 3,&resp[3]); } if (resp[1] & PMU_INT_ENVIRONMENT) { - // if the lid was just closed, notify devd. + /* if the lid was just closed, notify devd. */ if ((resp[2] & PMU_ENV_LID_CLOSED) && (!sc->lid_closed)) { sc->lid_closed = 1; if (devctl_process_running()) devctl_notify("PMU", "lid", "close", NULL); } else if (!(resp[2] & PMU_ENV_LID_CLOSED) && (sc->lid_closed)) { - // if the lid was just opened, notify devd. + /* if the lid was just opened, notify devd. */ if (devctl_process_running()) devctl_notify("PMU", "lid", "open", NULL); sc->lid_closed = 0; From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 15:11:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EB2C106566B; Mon, 5 Dec 2011 15:11:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EFC58FC15; Mon, 5 Dec 2011 15:11:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5FBZ2v042262; Mon, 5 Dec 2011 15:11:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5FBZoS042260; Mon, 5 Dec 2011 15:11:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112051511.pB5FBZoS042260@svn.freebsd.org> From: John Baldwin Date: Mon, 5 Dec 2011 15:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228278 - head/usr.sbin/mfiutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 15:11:35 -0000 Author: jhb Date: Mon Dec 5 15:11:35 2011 New Revision: 228278 URL: http://svn.freebsd.org/changeset/base/228278 Log: Use the correct volume identifier field when parsing MR_EVT_ARG_LD_STRIP arguments. MFC after: 2 weeks Modified: head/usr.sbin/mfiutil/mfi_evt.c Modified: head/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_evt.c Mon Dec 5 14:13:21 2011 (r228277) +++ head/usr.sbin/mfiutil/mfi_evt.c Mon Dec 5 15:11:35 2011 (r228278) @@ -438,7 +438,7 @@ mfi_decode_evt(int fd, struct mfi_evt_de printf(": "); break; case MR_EVT_ARGS_LD_STRIP: - printf("VOL %s", volume_name(fd, &detail->args.ld_prog.ld)); + printf("VOL %s", volume_name(fd, &detail->args.ld_strip.ld)); if (verbose) { printf(" strip %lld", (long long)detail->args.ld_strip.strip); From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 15:21:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B8781065670; Mon, 5 Dec 2011 15:21:22 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B39C8FC0A; Mon, 5 Dec 2011 15:21:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5FLMfX042648; Mon, 5 Dec 2011 15:21:22 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5FLM2e042646; Mon, 5 Dec 2011 15:21:22 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201112051521.pB5FLM2e042646@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 5 Dec 2011 15:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228280 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 15:21:22 -0000 Author: luigi Date: Mon Dec 5 15:21:21 2011 New Revision: 228280 URL: http://svn.freebsd.org/changeset/base/228280 Log: revise the implementation of the rings connected to the host stack Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Mon Dec 5 15:16:47 2011 (r228279) +++ head/sys/dev/netmap/netmap.c Mon Dec 5 15:21:21 2011 (r228280) @@ -575,7 +575,13 @@ netmap_mmap(__unused struct cdev *dev, v /* - * handler for synchronization of the queues from/to the host + * Handlers for synchronization of the queues from/to the host. + * + * netmap_sync_to_host() passes packets up. We are called from a + * system call in user process context, and the only contention + * can be among multiple user threads erroneously calling + * this routine concurrently. In principle we should not even + * need to lock. */ static void netmap_sync_to_host(struct netmap_adapter *na) @@ -583,15 +589,20 @@ netmap_sync_to_host(struct netmap_adapte struct netmap_kring *kring = &na->tx_rings[na->num_queues]; struct netmap_ring *ring = kring->ring; struct mbuf *head = NULL, *tail = NULL, *m; - u_int n, lim = kring->nkr_num_slots - 1; + u_int k, n, lim = kring->nkr_num_slots - 1; - na->nm_lock(na->ifp->if_softc, NETMAP_CORE_LOCK, 0); + k = ring->cur; + if (k > lim) { + netmap_ring_reinit(kring); + return; + } + // na->nm_lock(na->ifp->if_softc, NETMAP_CORE_LOCK, 0); /* Take packets from hwcur to cur and pass them up. * In case of no buffers we give up. At the end of the loop, * the queue is drained in all cases. */ - for (n = kring->nr_hwcur; n != ring->cur;) { + for (n = kring->nr_hwcur; n != k;) { struct netmap_slot *slot = &ring->slot[n]; n = (n == lim) ? 0 : n + 1; @@ -610,9 +621,9 @@ netmap_sync_to_host(struct netmap_adapte tail = m; m->m_nextpkt = NULL; } - kring->nr_hwcur = ring->cur; + kring->nr_hwcur = k; kring->nr_hwavail = ring->avail = lim; - na->nm_lock(na->ifp->if_softc, NETMAP_CORE_UNLOCK, 0); + // na->nm_lock(na->ifp->if_softc, NETMAP_CORE_UNLOCK, 0); /* send packets up, outside the lock */ while ((m = head) != NULL) { @@ -626,6 +637,10 @@ netmap_sync_to_host(struct netmap_adapte } /* + * rxsync backend for packets coming from the host stack. + * They have been put in the queue by netmap_start() so we + * need to protect access to the kring using a lock. + * * This routine also does the selrecord if called from the poll handler * (we know because td != NULL). */ @@ -634,24 +649,29 @@ netmap_sync_from_host(struct netmap_adap { struct netmap_kring *kring = &na->rx_rings[na->num_queues]; struct netmap_ring *ring = kring->ring; - int delta; + int error = 1, delta; + u_int k = ring->cur, lim = kring->nkr_num_slots; na->nm_lock(na->ifp->if_softc, NETMAP_CORE_LOCK, 0); - - /* skip past packets processed by userspace, - * and then sync cur/avail with hwcur/hwavail - */ - delta = ring->cur - kring->nr_hwcur; + if (k >= lim) /* bad value */ + goto done; + delta = k - kring->nr_hwcur; if (delta < 0) - delta += kring->nkr_num_slots; + delta += lim; kring->nr_hwavail -= delta; - kring->nr_hwcur = ring->cur; - ring->avail = kring->nr_hwavail; - if (ring->avail == 0 && td) + if (kring->nr_hwavail < 0) /* error */ + goto done; + kring->nr_hwcur = k; + error = 0; + k = ring->avail = kring->nr_hwavail; + if (k == 0 && td) selrecord(td, &kring->si); - if (ring->avail && (netmap_verbose & NM_VERB_HOST)) - D("%d pkts from stack", ring->avail); + if (k && (netmap_verbose & NM_VERB_HOST)) + D("%d pkts from stack", k); +done: na->nm_lock(na->ifp->if_softc, NETMAP_CORE_UNLOCK, 0); + if (error) + netmap_ring_reinit(kring); } @@ -1262,25 +1282,24 @@ netmap_detach(struct ifnet *ifp) /* - * intercept packets coming from the network stack and present - * them to netmap as incoming packets on a separate ring. + * Intercept packets from the network stack and pass them + * to netmap as incoming packets on the 'software' ring. * We are not locked when called. */ int netmap_start(struct ifnet *ifp, struct mbuf *m) { struct netmap_adapter *na = NA(ifp); - u_int i, len, n = na->num_queues; - int error = EBUSY; - struct netmap_kring *kring = &na->rx_rings[n]; + struct netmap_kring *kring = &na->rx_rings[na->num_queues]; + u_int i, len = m->m_pkthdr.len; + int error = EBUSY, lim = kring->nkr_num_slots - 1; struct netmap_slot *slot; - len = m->m_pkthdr.len; if (netmap_verbose & NM_VERB_HOST) D("%s packet %d len %d from the stack", ifp->if_xname, kring->nr_hwcur + kring->nr_hwavail, len); na->nm_lock(ifp->if_softc, NETMAP_CORE_LOCK, 0); - if (kring->nr_hwavail >= (int)kring->nkr_num_slots - 1) { + if (kring->nr_hwavail >= lim) { D("stack ring %s full\n", ifp->if_xname); goto done; /* no space */ } @@ -1291,8 +1310,8 @@ netmap_start(struct ifnet *ifp, struct m /* compute the insert position */ i = kring->nr_hwcur + kring->nr_hwavail; - if (i >= kring->nkr_num_slots) - i -= kring->nkr_num_slots; + if (i > lim) + i -= lim + 1; slot = &kring->ring->slot[i]; m_copydata(m, 0, len, NMB(slot)); slot->len = len; From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 15:33:15 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5383D106564A; Mon, 5 Dec 2011 15:33:14 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42A848FC19; Mon, 5 Dec 2011 15:33:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5FXEBV043068; Mon, 5 Dec 2011 15:33:14 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5FXEuh043063; Mon, 5 Dec 2011 15:33:14 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201112051533.pB5FXEuh043063@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 5 Dec 2011 15:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 15:33:15 -0000 Author: luigi Date: Mon Dec 5 15:33:13 2011 New Revision: 228281 URL: http://svn.freebsd.org/changeset/base/228281 Log: add netmap support for "em", "lem", "igb" and "re". On my hardware, "em" in netmap mode does about 1.388 Mpps on one card (on an Asus motherboard), and 1.1 Mpps on another card (PCIe bus). Both seem to be NIC-limited, because i have the same rate even with the CPU running at 150 MHz. On the "re" driver the tx throughput is around 420-450 Kpps on various (8111C and the like) chipsets. On the Rx side performance seems much better, and i can receive the full load generated by the "em" cards. "igb" is untested as i don't have the hardware. Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/re/if_re.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Dec 5 15:21:21 2011 (r228280) +++ head/sys/dev/e1000/if_em.c Mon Dec 5 15:33:13 2011 (r228281) @@ -399,6 +399,10 @@ SYSCTL_INT(_hw_em, OID_AUTO, eee_setting /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ + /********************************************************************* * Device identification routine * @@ -714,6 +718,9 @@ em_attach(device_t dev) adapter->led_dev = led_create(em_led_func, adapter, device_get_nameunit(dev)); +#ifdef DEV_NETMAP + em_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("em_attach: end"); @@ -785,6 +792,10 @@ em_detach(device_t dev) ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ + em_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -3213,9 +3224,17 @@ em_setup_transmit_ring(struct tx_ring *t struct adapter *adapter = txr->adapter; struct em_buffer *txbuf; int i; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old descriptor contents */ EM_TX_LOCK(txr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_TX, txr->me, 0); +#endif /* DEV_NETMAP */ + bzero((void *)txr->tx_base, (sizeof(struct e1000_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -3232,6 +3251,22 @@ em_setup_transmit_ring(struct tx_ring *t m_freem(txbuf->m_head); txbuf->m_head = NULL; } +#ifdef DEV_NETMAP + if (slot) { + int si = i + na->tx_rings[txr->me].nkr_hwofs; + void *addr; + + if (si >= na->num_tx_desc) + si -= na->num_tx_desc; + addr = NMB(slot + si); + txr->tx_base[i].buffer_addr = + htole64(vtophys(addr)); + /* reload the map for netmap mode */ + netmap_load_map(txr->txtag, + txbuf->map, addr, na->buff_size); + } +#endif /* DEV_NETMAP */ + /* clear the watch index */ txbuf->next_eop = -1; } @@ -3682,6 +3717,19 @@ em_txeof(struct tx_ring *txr) struct ifnet *ifp = adapter->ifp; EM_TX_LOCK_ASSERT(txr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); + EM_TX_UNLOCK(txr); + EM_CORE_LOCK(adapter); + selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + EM_CORE_UNLOCK(adapter); + EM_TX_LOCK(txr); + return (FALSE); + } +#endif /* DEV_NETMAP */ /* No work, make sure watchdog is off */ if (txr->tx_avail == adapter->num_tx_desc) { @@ -3978,6 +4026,57 @@ em_setup_receive_ring(struct rx_ring *rx if (++j == adapter->num_rx_desc) j = 0; } +#ifdef DEV_NETMAP + { + /* + * This driver is slightly different from the standard: + * it refills the rings in blocks of 8, so the while() + * above completes any leftover work. Also, after if_init() + * the ring starts at rxr->next_to_check instead of 0. + * + * Currently: we leave the mbufs allocated even in netmap + * mode, and simply make the NIC ring point to the + * correct buffer (netmap_buf or mbuf) depending on + * the mode. To avoid mbuf leaks, when in netmap mode we + * must make sure that next_to_refresh == next_to_check - 1 + * so that the above while() loop is never run on init. + * + * A better way would be to free the mbufs when entering + * netmap mode, and set next_to_refresh/check in + * a way that the mbufs are completely reallocated + * when going back to standard mode. + */ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot = netmap_reset(na, + NR_RX, rxr->me, rxr->next_to_check); + int sj = slot ? na->rx_rings[rxr->me].nkr_hwofs : 0; + + /* slot sj corresponds to entry j in the NIC ring */ + if (sj < 0) + sj += adapter->num_rx_desc; + + for (j = 0; j != adapter->num_rx_desc; j++, sj++) { + void *addr; + int sz; + + rxbuf = &rxr->rx_buffers[j]; + /* no mbuf and regular mode -> skip this entry */ + if (rxbuf->m_head == NULL && !slot) + continue; + /* Handle wrap. Cannot use "na" here, could be NULL */ + if (sj >= adapter->num_rx_desc) + sj -= adapter->num_rx_desc; + /* see comment, set slot addr and map */ + addr = slot ? NMB(slot + sj) : rxbuf->m_head->m_data; + sz = slot ? na->buff_size : adapter->rx_mbuf_sz; + // XXX load or reload ? + netmap_load_map(rxr->rxtag, rxbuf->map, addr, sz); + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(vtophys(addr)); + bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); + } + } +#endif /* DEV_NETMAP */ fail: rxr->next_to_refresh = i; @@ -4170,6 +4269,23 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDBAL(i), (u32)bus_addr); /* Setup the Head and Tail Descriptor Pointers */ E1000_WRITE_REG(hw, E1000_RDH(i), rxr->next_to_check); +#ifdef DEV_NETMAP + /* + * an init() while a netmap client is active must + * preserve the rx buffers passed to userspace. + * In this driver it means we adjust RDT to + * something different from next_to_refresh. + */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = rxr->next_to_refresh - kring->nr_hwavail; + + if (t < 0) + t += na->num_rx_desc; + E1000_WRITE_REG(hw, E1000_RDT(i), t); + } else +#endif /* DEV_NETMAP */ E1000_WRITE_REG(hw, E1000_RDT(i), rxr->next_to_refresh); } @@ -4247,6 +4363,19 @@ em_rxeof(struct rx_ring *rxr, int count, EM_RX_LOCK(rxr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); + EM_RX_UNLOCK(rxr); + EM_CORE_LOCK(adapter); + selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + EM_CORE_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + for (i = rxr->next_to_check, processed = 0; count != 0;) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Dec 5 15:21:21 2011 (r228280) +++ head/sys/dev/e1000/if_igb.c Mon Dec 5 15:33:13 2011 (r228281) @@ -369,6 +369,9 @@ SYSCTL_INT(_hw_igb, OID_AUTO, rx_process &igb_rx_process_limit, 0, "Maximum number of received packets to process at a time, -1 means unlimited"); +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ /********************************************************************* * Device identification routine * @@ -664,6 +667,9 @@ igb_attach(device_t dev) adapter->led_dev = led_create(igb_led_func, adapter, device_get_nameunit(dev)); +#ifdef DEV_NETMAP + igb_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("igb_attach: end"); return (0); @@ -742,6 +748,9 @@ igb_detach(device_t dev) callout_drain(&adapter->timer); +#ifdef DEV_NETMAP + netmap_detach(adapter->ifp); +#endif /* DEV_NETMAP */ igb_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -3212,9 +3221,16 @@ igb_setup_transmit_ring(struct tx_ring * struct adapter *adapter = txr->adapter; struct igb_tx_buffer *txbuf; int i; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old descriptor contents */ IGB_TX_LOCK(txr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_TX, txr->me, 0); +#endif /* DEV_NETMAP */ bzero((void *)txr->tx_base, (sizeof(union e1000_adv_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -3231,6 +3247,17 @@ igb_setup_transmit_ring(struct tx_ring * m_freem(txbuf->m_head); txbuf->m_head = NULL; } +#ifdef DEV_NETMAP + if (slot) { + /* slot si is mapped to the i-th NIC-ring entry */ + int si = i + na->tx_rings[txr->me].nkr_hwofs; + + if (si < 0) + si += na->num_tx_desc; + netmap_load_map(txr->txtag, txbuf->map, + NMB(slot + si), na->buff_size); + } +#endif /* DEV_NETMAP */ /* clear the watch index */ txbuf->next_eop = -1; } @@ -3626,6 +3653,19 @@ igb_txeof(struct tx_ring *txr) IGB_TX_LOCK_ASSERT(txr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); + IGB_TX_UNLOCK(txr); + IGB_CORE_LOCK(adapter); + selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + IGB_CORE_UNLOCK(adapter); + IGB_TX_LOCK(txr); + return FALSE; + } +#endif /* DEV_NETMAP */ if (txr->tx_avail == adapter->num_tx_desc) { txr->queue_status = IGB_QUEUE_IDLE; return FALSE; @@ -3949,6 +3989,10 @@ igb_setup_receive_ring(struct rx_ring *r bus_dma_segment_t pseg[1], hseg[1]; struct lro_ctrl *lro = &rxr->lro; int rsize, nsegs, error = 0; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(rxr->adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ adapter = rxr->adapter; dev = adapter->dev; @@ -3956,6 +4000,9 @@ igb_setup_receive_ring(struct rx_ring *r /* Clear the ring contents */ IGB_RX_LOCK(rxr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_RX, rxr->me, 0); +#endif /* DEV_NETMAP */ rsize = roundup2(adapter->num_rx_desc * sizeof(union e1000_adv_rx_desc), IGB_DBA_ALIGN); bzero((void *)rxr->rx_base, rsize); @@ -3974,6 +4021,22 @@ igb_setup_receive_ring(struct rx_ring *r struct mbuf *mh, *mp; rxbuf = &rxr->rx_buffers[j]; +#ifdef DEV_NETMAP + if (slot) { + /* slot sj is mapped to the i-th NIC-ring entry */ + int sj = j + na->rx_rings[rxr->me].nkr_hwofs; + void *addr; + + if (sj < 0) + sj += na->num_rx_desc; + addr = NMB(slot + sj); + netmap_load_map(rxr->ptag, + rxbuf->pmap, addr, na->buff_size); + /* Update descriptor */ + rxr->rx_base[j].read.pkt_addr = htole64(vtophys(addr)); + continue; + } +#endif /* DEV_NETMAP */ if (rxr->hdr_split == FALSE) goto skip_head; @@ -4258,6 +4321,26 @@ igb_initialize_receive_units(struct adap for (int i = 0; i < adapter->num_queues; i++) { rxr = &adapter->rx_rings[i]; E1000_WRITE_REG(hw, E1000_RDH(i), rxr->next_to_check); +#ifdef DEV_NETMAP + /* + * an init() while a netmap client is active must + * preserve the rx buffers passed to userspace. + * In this driver it means we adjust RDT to + * somthing different from next_to_refresh + * (which is not used in netmap mode). + */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = rxr->next_to_refresh - kring->nr_hwavail; + + if (t >= adapter->num_rx_desc) + t -= adapter->num_rx_desc; + else if (t < 0) + t += adapter->num_rx_desc; + E1000_WRITE_REG(hw, E1000_RDT(i), t); + } else +#endif /* DEV_NETMAP */ E1000_WRITE_REG(hw, E1000_RDT(i), rxr->next_to_refresh); } return; @@ -4436,6 +4519,19 @@ igb_rxeof(struct igb_queue *que, int cou bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); + IGB_RX_UNLOCK(rxr); + IGB_CORE_LOCK(adapter); + selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + IGB_CORE_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + /* Main clean loop */ for (i = rxr->next_to_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Mon Dec 5 15:21:21 2011 (r228280) +++ head/sys/dev/e1000/if_lem.c Mon Dec 5 15:33:13 2011 (r228281) @@ -316,6 +316,10 @@ TUNABLE_INT("hw.em.fc_setting", &lem_fc_ /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ + /********************************************************************* * Device identification routine * @@ -646,6 +650,9 @@ lem_attach(device_t dev) adapter->led_dev = led_create(lem_led_func, adapter, device_get_nameunit(dev)); +#ifdef DEV_NETMAP + lem_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("lem_attach: end"); return (0); @@ -724,6 +731,9 @@ lem_detach(device_t dev) callout_drain(&adapter->timer); callout_drain(&adapter->tx_fifo_timer); +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ lem_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -2637,6 +2647,11 @@ static void lem_setup_transmit_structures(struct adapter *adapter) { struct em_buffer *tx_buffer; +#ifdef DEV_NETMAP + /* we are already locked */ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot = netmap_reset(na, NR_TX, 0, 0); +#endif /* DEV_NETMAP */ /* Clear the old ring contents */ bzero(adapter->tx_desc_base, @@ -2650,6 +2665,22 @@ lem_setup_transmit_structures(struct ada bus_dmamap_unload(adapter->txtag, tx_buffer->map); m_freem(tx_buffer->m_head); tx_buffer->m_head = NULL; +#ifdef DEV_NETMAP + if (slot) { + /* slot si is mapped to the i-th NIC-ring entry */ + int si = i + na->tx_rings[0].nkr_hwofs; + void *addr; + + if (si > na->num_tx_desc) + si -= na->num_tx_desc; + addr = NMB(slot + si); + adapter->tx_desc_base[si].buffer_addr = + htole64(vtophys(addr)); + /* reload the map for netmap mode */ + netmap_load_map(adapter->txtag, + tx_buffer->map, addr, na->buff_size); + } +#endif /* DEV_NETMAP */ tx_buffer->next_eop = -1; } @@ -2951,6 +2982,12 @@ lem_txeof(struct adapter *adapter) EM_TX_LOCK_ASSERT(adapter); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->tx_rings[0].si, PI_NET); + return; + } +#endif /* DEV_NETMAP */ if (adapter->num_tx_desc_avail == adapter->num_tx_desc) return; @@ -3181,6 +3218,11 @@ lem_setup_receive_structures(struct adap { struct em_buffer *rx_buffer; int i, error; +#ifdef DEV_NETMAP + /* we are already under lock */ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot = netmap_reset(na, NR_RX, 0, 0); +#endif /* Reset descriptor ring */ bzero(adapter->rx_desc_base, @@ -3200,6 +3242,23 @@ lem_setup_receive_structures(struct adap /* Allocate new ones. */ for (i = 0; i < adapter->num_rx_desc; i++) { +#ifdef DEV_NETMAP + if (slot) { + /* slot si is mapped to the i-th NIC-ring entry */ + int si = i + na->rx_rings[0].nkr_hwofs; + void *addr; + + if (si > na->num_rx_desc) + si -= na->num_rx_desc; + addr = NMB(slot + si); + netmap_load_map(adapter->rxtag, + rx_buffer->map, addr, na->buff_size); + /* Update descriptor */ + adapter->rx_desc_base[i].buffer_addr = + htole64(vtophys(addr)); + continue; + } +#endif /* DEV_NETMAP */ error = lem_get_buf(adapter, i); if (error) return (error); @@ -3324,6 +3383,18 @@ lem_initialize_receive_unit(struct adapt * Tail Descriptor Pointers */ E1000_WRITE_REG(&adapter->hw, E1000_RDH(0), 0); +#ifdef DEV_NETMAP + /* preserve buffers already made available to clients */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[0]; + int t = na->num_rx_desc - 1 - kring->nr_hwavail; + + if (t >= na->num_rx_desc) + t -= na->num_rx_desc; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), t); + } else +#endif /* DEV_NETMAP */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), adapter->num_rx_desc - 1); return; @@ -3407,6 +3478,14 @@ lem_rxeof(struct adapter *adapter, int c bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, BUS_DMASYNC_POSTREAD); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->rx_rings[0].si, PI_NET); + EM_RX_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + if (!((current_desc->status) & E1000_RXD_STAT_DD)) { if (done != NULL) *done = rx_sent; Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Dec 5 15:21:21 2011 (r228280) +++ head/sys/dev/re/if_re.c Mon Dec 5 15:33:13 2011 (r228281) @@ -296,6 +296,10 @@ static void re_setwol (struct rl_softc static void re_clrwol (struct rl_softc *); static void re_set_linkspeed (struct rl_softc *); +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* !DEV_NETMAP */ + #ifdef RE_DIAG static int re_diag (struct rl_softc *); #endif @@ -1620,6 +1624,9 @@ re_attach(device_t dev) */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); +#ifdef DEV_NETMAP + re_netmap_attach(sc); +#endif /* DEV_NETMAP */ #ifdef RE_DIAG /* * Perform hardware diagnostic on the original RTL8169. @@ -1815,6 +1822,9 @@ re_detach(device_t dev) bus_dma_tag_destroy(sc->rl_ldata.rl_stag); } +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ if (sc->rl_parent_tag) bus_dma_tag_destroy(sc->rl_parent_tag); @@ -1989,6 +1999,9 @@ re_tx_list_init(struct rl_softc *sc) sc->rl_ldata.rl_tx_desc_cnt * sizeof(struct rl_desc)); for (i = 0; i < sc->rl_ldata.rl_tx_desc_cnt; i++) sc->rl_ldata.rl_tx_desc[i].tx_m = NULL; +#ifdef DEV_NETMAP + re_netmap_tx_init(sc); +#endif /* DEV_NETMAP */ /* Set EOR. */ desc = &sc->rl_ldata.rl_tx_list[sc->rl_ldata.rl_tx_desc_cnt - 1]; desc->rl_cmdstat |= htole32(RL_TDESC_CMD_EOR); @@ -2016,6 +2029,9 @@ re_rx_list_init(struct rl_softc *sc) if ((error = re_newbuf(sc, i)) != 0) return (error); } +#ifdef DEV_NETMAP + re_netmap_rx_init(sc); +#endif /* DEV_NETMAP */ /* Flush the RX descriptors */ @@ -2072,6 +2088,12 @@ re_rxeof(struct rl_softc *sc, int *rx_np RL_LOCK_ASSERT(sc); ifp = sc->rl_ifp; +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->rx_rings->si, PI_NET); + return 0; + } +#endif /* DEV_NETMAP */ if (ifp->if_mtu > RL_MTU && (sc->rl_flags & RL_FLAG_JUMBOV2) != 0) jumbo = 1; else @@ -2313,6 +2335,12 @@ re_txeof(struct rl_softc *sc) return; ifp = sc->rl_ifp; +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->tx_rings[0].si, PI_NET); + return; + } +#endif /* DEV_NETMAP */ /* Invalidate the TX descriptor list */ bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag, sc->rl_ldata.rl_tx_list_map, @@ -2831,6 +2859,21 @@ re_start_locked(struct ifnet *ifp) sc = ifp->if_softc; +#ifdef DEV_NETMAP + /* XXX is this necessary ? */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_kring *kring = &NA(ifp)->tx_rings[0]; + if (sc->rl_ldata.rl_tx_prodidx != kring->nr_hwcur) { + /* kick the tx unit */ + CSR_WRITE_1(sc, sc->rl_txstart, RL_TXSTART_START); +#ifdef RE_TX_MODERATION + CSR_WRITE_4(sc, RL_TIMERCNT, 1); +#endif + sc->rl_watchdog_timer = 5; + } + return; + } +#endif /* DEV_NETMAP */ if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0) return; From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 16:08:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1613106564A; Mon, 5 Dec 2011 16:08:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A14028FC12; Mon, 5 Dec 2011 16:08:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5G8IL3044250; Mon, 5 Dec 2011 16:08:18 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5G8IbS044248; Mon, 5 Dec 2011 16:08:18 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112051608.pB5G8IbS044248@svn.freebsd.org> From: Ed Schouten Date: Mon, 5 Dec 2011 16:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228283 - head/sys/x86/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 16:08:18 -0000 Author: ed Date: Mon Dec 5 16:08:18 2011 New Revision: 228283 URL: http://svn.freebsd.org/changeset/base/228283 Log: Get rid of kludgy per-descriptor state handling in acpi_apm. Where i386/bios/apm.c requires no per-descriptor state, the ACPI version of these device do. Instead of using hackish clone lists that leave stale device nodes lying around, use the cdevpriv API. Modified: head/sys/x86/acpica/acpi_apm.c Modified: head/sys/x86/acpica/acpi_apm.c ============================================================================== --- head/sys/x86/acpica/acpi_apm.c Mon Dec 5 16:06:12 2011 (r228282) +++ head/sys/x86/acpica/acpi_apm.c Mon Dec 5 16:08:18 2011 (r228283) @@ -51,12 +51,10 @@ __FBSDID("$FreeBSD$"); #define APM_UNKNOWN 0xff static int apm_active; -static struct clonedevs *apm_clones; static MALLOC_DEFINE(M_APMDEV, "apmdev", "APM device emulation"); static d_open_t apmopen; -static d_close_t apmclose; static d_write_t apmwrite; static d_ioctl_t apmioctl; static d_poll_t apmpoll; @@ -71,9 +69,7 @@ static struct filterops apm_readfiltops static struct cdevsw apm_cdevsw = { .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE | D_NEEDMINOR, .d_open = apmopen, - .d_close = apmclose, .d_write = apmwrite, .d_ioctl = apmioctl, .d_poll = apmpoll, @@ -202,39 +198,6 @@ acpi_capm_get_pwstatus(apm_pwstatus_t ap return (0); } -/* Create single-use devices for /dev/apm and /dev/apmctl. */ -static void -apm_clone(void *arg, struct ucred *cred, char *name, int namelen, - struct cdev **dev) -{ - int ctl_dev, unit; - - if (*dev != NULL) - return; - if (strcmp(name, "apmctl") == 0) - ctl_dev = TRUE; - else if (strcmp(name, "apm") == 0) - ctl_dev = FALSE; - else - return; - - /* Always create a new device and unit number. */ - unit = -1; - if (clone_create(&apm_clones, &apm_cdevsw, &unit, dev, 0)) { - if (ctl_dev) { - *dev = make_dev(&apm_cdevsw, unit, - UID_ROOT, GID_OPERATOR, 0660, "apmctl%d", unit); - } else { - *dev = make_dev(&apm_cdevsw, unit, - UID_ROOT, GID_OPERATOR, 0664, "apm%d", unit); - } - if (*dev != NULL) { - dev_ref(*dev); - (*dev)->si_flags |= SI_CHEAPCLONE; - } - } -} - /* Create a struct for tracking per-device suspend notification. */ static struct apm_clone_data * apm_create_clone(struct cdev *dev, struct acpi_softc *acpi_sc) @@ -263,30 +226,13 @@ apm_create_clone(struct cdev *dev, struc return (clone); } -static int -apmopen(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - struct acpi_softc *acpi_sc; - struct apm_clone_data *clone; - - acpi_sc = devclass_get_softc(devclass_find("acpi"), 0); - clone = apm_create_clone(dev, acpi_sc); - dev->si_drv1 = clone; - - /* If the device is opened for write, record that. */ - if ((flag & FWRITE) != 0) - clone->flags |= ACPI_EVF_WRITE; - - return (0); -} - -static int -apmclose(struct cdev *dev, int flag, int fmt, struct thread *td) +static void +apmdtor(void *data) { struct apm_clone_data *clone; struct acpi_softc *acpi_sc; - clone = dev->si_drv1; + clone = data; acpi_sc = clone->acpi_sc; /* We are about to lose a reference so check if suspend should occur */ @@ -301,7 +247,22 @@ apmclose(struct cdev *dev, int flag, int knlist_destroy(&clone->sel_read.si_note); ACPI_UNLOCK(acpi); free(clone, M_APMDEV); - destroy_dev_sched(dev); +} + +static int +apmopen(struct cdev *dev, int flag, int fmt, struct thread *td) +{ + struct acpi_softc *acpi_sc; + struct apm_clone_data *clone; + + acpi_sc = devclass_get_softc(devclass_find("acpi"), 0); + clone = apm_create_clone(dev, acpi_sc); + devfs_set_cdevpriv(clone, apmdtor); + + /* If the device is opened for write, record that. */ + if ((flag & FWRITE) != 0) + clone->flags |= ACPI_EVF_WRITE; + return (0); } @@ -316,7 +277,7 @@ apmioctl(struct cdev *dev, u_long cmd, c apm_info_old_t aiop; error = 0; - clone = dev->si_drv1; + devfs_get_cdevpriv((void **)&clone); acpi_sc = clone->acpi_sc; switch (cmd) { @@ -430,8 +391,8 @@ apmpoll(struct cdev *dev, int events, st int revents; revents = 0; + devfs_get_cdevpriv((void **)&clone); ACPI_LOCK(acpi); - clone = dev->si_drv1; if (clone->acpi_sc->acpi_next_sstate) revents |= events & (POLLIN | POLLRDNORM); else @@ -445,8 +406,8 @@ apmkqfilter(struct cdev *dev, struct kno { struct apm_clone_data *clone; + devfs_get_cdevpriv((void **)&clone); ACPI_LOCK(acpi); - clone = dev->si_drv1; kn->kn_hook = clone; kn->kn_fop = &apm_readfiltops; knlist_add(&clone->sel_read.si_note, kn, 0); @@ -485,6 +446,7 @@ acpi_apm_init(struct acpi_softc *sc) /* Create a clone for /dev/acpi also. */ STAILQ_INIT(&sc->apm_cdevs); sc->acpi_clone = apm_create_clone(sc->acpi_dev_t, sc); - clone_setup(&apm_clones); - EVENTHANDLER_REGISTER(dev_clone, apm_clone, 0, 1000); + + make_dev(&apm_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0660, "apmctl"); + make_dev(&apm_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0664, "apm"); } From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 16:38:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C11ED106564A; Mon, 5 Dec 2011 16:38:52 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B174F8FC12; Mon, 5 Dec 2011 16:38:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5GcqYe047945; Mon, 5 Dec 2011 16:38:52 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5GcqPo047942; Mon, 5 Dec 2011 16:38:52 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201112051638.pB5GcqPo047942@svn.freebsd.org> From: Hajimu UMEMOTO Date: Mon, 5 Dec 2011 16:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228284 - in head/kerberos5: . lib/libhdb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 16:38:52 -0000 Author: ume Date: Mon Dec 5 16:38:52 2011 New Revision: 228284 URL: http://svn.freebsd.org/changeset/base/228284 Log: - Make heimdal buildable with WITH_OPENLDAP defined, again. - Our heimdal uses the deprecated OpenLDAP functions. Modified: head/kerberos5/Makefile.inc head/kerberos5/lib/libhdb/Makefile Modified: head/kerberos5/Makefile.inc ============================================================================== --- head/kerberos5/Makefile.inc Mon Dec 5 16:08:18 2011 (r228283) +++ head/kerberos5/Makefile.inc Mon Dec 5 16:38:52 2011 (r228284) @@ -10,7 +10,7 @@ CFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR}/.. OPENLDAPBASE?= /usr/local LDAPLDADD= -lldap -llber LDAPDPADD= ${LDAPLDADD:C;^-l(.*)$;${OPENLDAPBASE}/lib/lib\1.a;} -LDAPCFLAGS= -I${OPENLDAPBASE}/include -DOPENLDAP=1 +LDAPCFLAGS= -I${OPENLDAPBASE}/include -DOPENLDAP=1 -DLDAP_DEPRECATED=1 LDAPLDFLAGS= -L${OPENLDAPBASE}/lib -Wl,-rpath,${OPENLDAPBASE}/lib .endif Modified: head/kerberos5/lib/libhdb/Makefile ============================================================================== --- head/kerberos5/lib/libhdb/Makefile Mon Dec 5 16:08:18 2011 (r228283) +++ head/kerberos5/lib/libhdb/Makefile Mon Dec 5 16:38:52 2011 (r228284) @@ -1,9 +1,9 @@ # $FreeBSD$ LIB= hdb -LDFLAGS= -Wl,--no-undefined -LDADD= -lasn1 -lcom_err -lkrb5 -lroken -DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBKRB5} ${LIBROKEN} +LDFLAGS= -Wl,--no-undefined ${LDAPLDFLAGS} +LDADD= -lasn1 -lcom_err -lkrb5 -lroken ${LDAPLDADD} +DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBKRB5} ${LIBROKEN} ${LDAPDPADD} INCS= hdb-private.h \ hdb-protos.h \ From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 18:10:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76BDD1065675; Mon, 5 Dec 2011 18:10:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6721C8FC0C; Mon, 5 Dec 2011 18:10:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5IAh0e051864; Mon, 5 Dec 2011 18:10:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5IAhgg051862; Mon, 5 Dec 2011 18:10:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112051810.pB5IAhgg051862@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 5 Dec 2011 18:10:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228286 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 18:10:43 -0000 Author: yongari Date: Mon Dec 5 18:10:43 2011 New Revision: 228286 URL: http://svn.freebsd.org/changeset/base/228286 Log: Fix off by one error in mbuf access. Previously it caused panic. While I'm here use NULL to compare mbuf pointer and add additional check for zero length mbuf before accessing the mbuf. PR: kern/162932 Modified: head/sys/dev/ed/if_ed.c Modified: head/sys/dev/ed/if_ed.c ============================================================================== --- head/sys/dev/ed/if_ed.c Mon Dec 5 17:44:12 2011 (r228285) +++ head/sys/dev/ed/if_ed.c Mon Dec 5 18:10:43 2011 (r228286) @@ -1709,12 +1709,19 @@ ed_shmem_write_mbufs(struct ed_softc *sc break; } } - for (len = 0; m != 0; m = m->m_next) { - if (sc->isa16bit) - bus_space_write_region_2(sc->mem_bst, - sc->mem_bsh, dst, - mtod(m, uint16_t *), (m->m_len + 1)/ 2); - else + for (len = 0; m != NULL; m = m->m_next) { + if (m->m_len == 0) + continue; + if (sc->isa16bit) { + if (m->m_len > 1) + bus_space_write_region_2(sc->mem_bst, + sc->mem_bsh, dst, + mtod(m, uint16_t *), m->m_len / 2); + if ((m->m_len & 1) != 0) + bus_space_write_1(sc->mem_bst, sc->mem_bsh, + dst + m->m_len - 1, + *(mtod(m, uint8_t *) + m->m_len - 1)); + } else bus_space_write_region_1(sc->mem_bst, sc->mem_bsh, dst, mtod(m, uint8_t *), m->m_len); From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 18:29:25 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6066B1065677; Mon, 5 Dec 2011 18:29:25 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5042F8FC1E; Mon, 5 Dec 2011 18:29:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5ITPWd052447; Mon, 5 Dec 2011 18:29:25 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5ITP1f052443; Mon, 5 Dec 2011 18:29:25 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112051829.pB5ITP1f052443@svn.freebsd.org> From: Alan Cox Date: Mon, 5 Dec 2011 18:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228287 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 18:29:25 -0000 Author: alc Date: Mon Dec 5 18:29:25 2011 New Revision: 228287 URL: http://svn.freebsd.org/changeset/base/228287 Log: Introduce vm_reserv_alloc_contig() and teach vm_page_alloc_contig() how to use superpage reservations. So, for the first time, kernel virtual memory that is allocated by contigmalloc(), kmem_alloc_attr(), and kmem_alloc_contig() can be promoted to superpages. In fact, even a series of small contigmalloc() allocations may collectively result in a promoted superpage. Eliminate some duplication of code in vm_reserv_alloc_page(). Change the type of vm_reserv_reclaim_contig()'s first parameter in order that it be consistent with other vm_*_contig() functions. Tested by: marius (sparc64) Modified: head/sys/vm/vm_page.c head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Dec 5 18:10:43 2011 (r228286) +++ head/sys/vm/vm_page.c Mon Dec 5 18:29:25 2011 (r228287) @@ -1554,9 +1554,12 @@ vm_page_alloc_contig(vm_object_t object, cnt.v_free_count + cnt.v_cache_count >= npages)) { #if VM_NRESERVLEVEL > 0 retry: + if (object == NULL || (object->flags & OBJ_COLORED) == 0 || + (m_ret = vm_reserv_alloc_contig(object, pindex, npages, + low, high, alignment, boundary)) == NULL) #endif - m_ret = vm_phys_alloc_contig(npages, low, high, alignment, - boundary); + m_ret = vm_phys_alloc_contig(npages, low, high, + alignment, boundary); } else { mtx_unlock(&vm_page_queue_free_mtx); atomic_add_int(&vm_pageout_deficit, npages); @@ -1581,8 +1584,8 @@ retry: } else { #if VM_NRESERVLEVEL > 0 - if (vm_reserv_reclaim_contig(npages << PAGE_SHIFT, low, high, - alignment, boundary)) + if (vm_reserv_reclaim_contig(npages, low, high, alignment, + boundary)) goto retry; #endif } Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Mon Dec 5 18:10:43 2011 (r228286) +++ head/sys/vm/vm_reserv.c Mon Dec 5 18:29:25 2011 (r228287) @@ -31,6 +31,9 @@ /* * Superpage reservation management module + * + * Any external functions defined by this module are only to be used by the + * virtual memory system. */ #include @@ -285,25 +288,54 @@ vm_reserv_populate(vm_reserv_t rv) } /* - * Allocates a page from an existing or newly-created reservation. + * Allocates a contiguous set of physical pages of the given size "npages" + * from an existing or newly-created reservation. All of the physical pages + * must be at or above the given physical address "low" and below the given + * physical address "high". The given value "alignment" determines the + * alignment of the first physical page in the set. If the given value + * "boundary" is non-zero, then the set of physical pages cannot cross any + * physical address boundary that is a multiple of that value. Both + * "alignment" and "boundary" must be a power of two. * * The object and free page queue must be locked. */ vm_page_t -vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex) +vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, u_long npages, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { - vm_page_t m, mpred, msucc; + vm_paddr_t pa, size; + vm_page_t m, m_ret, mpred, msucc; vm_pindex_t first, leftcap, rightcap; vm_reserv_t rv; + u_long allocpages, maxpages, minpages; + int i, index, n; mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + KASSERT(npages != 0, ("vm_reserv_alloc_contig: npages is 0")); /* - * Is a reservation fundamentally not possible? + * Is a reservation fundamentally impossible? */ - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); if (pindex < VM_RESERV_INDEX(object, pindex) || - pindex >= object->size) + pindex + npages > object->size) + return (NULL); + + /* + * All reservations of a particular size have the same alignment. + * Assuming that the first page is allocated from a reservation, the + * least significant bits of its physical address can be determined + * from its offset from the beginning of the reservation and the size + * of the reservation. + * + * Could the specified index within a reservation of the smallest + * possible size satisfy the alignment and boundary requirements? + */ + pa = VM_RESERV_INDEX(object, pindex) << PAGE_SHIFT; + if ((pa & (alignment - 1)) != 0) + return (NULL); + size = npages << PAGE_SHIFT; + if (((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) return (NULL); /* @@ -313,31 +345,21 @@ vm_reserv_alloc_page(vm_object_t object, mpred = object->root; while (mpred != NULL) { KASSERT(mpred->pindex != pindex, - ("vm_reserv_alloc_page: pindex already allocated")); + ("vm_reserv_alloc_contig: pindex already allocated")); rv = vm_reserv_from_page(mpred); - if (rv->object == object && vm_reserv_has_pindex(rv, pindex)) { - m = &rv->pages[VM_RESERV_INDEX(object, pindex)]; - /* Handle vm_page_rename(m, new_object, ...). */ - if ((m->flags & (PG_CACHED | PG_FREE)) == 0) - return (NULL); - vm_reserv_populate(rv); - return (m); - } else if (mpred->pindex < pindex) { + if (rv->object == object && vm_reserv_has_pindex(rv, pindex)) + goto found; + else if (mpred->pindex < pindex) { if (msucc != NULL || (msucc = TAILQ_NEXT(mpred, listq)) == NULL) break; KASSERT(msucc->pindex != pindex, - ("vm_reserv_alloc_page: pindex already allocated")); + ("vm_reserv_alloc_contig: pindex already allocated")); rv = vm_reserv_from_page(msucc); if (rv->object == object && - vm_reserv_has_pindex(rv, pindex)) { - m = &rv->pages[VM_RESERV_INDEX(object, pindex)]; - /* Handle vm_page_rename(m, new_object, ...). */ - if ((m->flags & (PG_CACHED | PG_FREE)) == 0) - return (NULL); - vm_reserv_populate(rv); - return (m); - } else if (pindex < msucc->pindex) + vm_reserv_has_pindex(rv, pindex)) + goto found; + else if (pindex < msucc->pindex) break; } else if (msucc == NULL) { msucc = mpred; @@ -349,72 +371,238 @@ vm_reserv_alloc_page(vm_object_t object, } /* - * Determine the first index to the left that can be used. - */ - if (mpred == NULL) - leftcap = 0; - else if ((rv = vm_reserv_from_page(mpred))->object != object) - leftcap = mpred->pindex + 1; - else - leftcap = rv->pindex + VM_LEVEL_0_NPAGES; - - /* - * Determine the first index to the right that cannot be used. - */ - if (msucc == NULL) - rightcap = pindex + VM_LEVEL_0_NPAGES; - else if ((rv = vm_reserv_from_page(msucc))->object != object) - rightcap = msucc->pindex; - else - rightcap = rv->pindex; - - /* - * Determine if a reservation fits between the first index to - * the left that can be used and the first index to the right - * that cannot be used. + * Could at least one reservation fit between the first index to the + * left that can be used and the first index to the right that cannot + * be used? */ first = pindex - VM_RESERV_INDEX(object, pindex); - if (first < leftcap || first + VM_LEVEL_0_NPAGES > rightcap) - return (NULL); + if (mpred != NULL) { + if ((rv = vm_reserv_from_page(mpred))->object != object) + leftcap = mpred->pindex + 1; + else + leftcap = rv->pindex + VM_LEVEL_0_NPAGES; + if (leftcap > first) + return (NULL); + } + minpages = VM_RESERV_INDEX(object, pindex) + npages; + maxpages = roundup2(minpages, VM_LEVEL_0_NPAGES); + allocpages = maxpages; + if (msucc != NULL) { + if ((rv = vm_reserv_from_page(msucc))->object != object) + rightcap = msucc->pindex; + else + rightcap = rv->pindex; + if (first + maxpages > rightcap) { + if (maxpages == VM_LEVEL_0_NPAGES) + return (NULL); + allocpages = minpages; + } + } /* - * Would a new reservation extend past the end of the given object? + * Would the last new reservation extend past the end of the object? */ - if (object->size < first + VM_LEVEL_0_NPAGES) { + if (first + maxpages > object->size) { /* - * Don't allocate a new reservation if the object is a vnode or - * backed by another object that is a vnode. + * Don't allocate the last new reservation if the object is a + * vnode or backed by another object that is a vnode. */ if (object->type == OBJT_VNODE || (object->backing_object != NULL && - object->backing_object->type == OBJT_VNODE)) - return (NULL); + object->backing_object->type == OBJT_VNODE)) { + if (maxpages == VM_LEVEL_0_NPAGES) + return (NULL); + allocpages = minpages; + } /* Speculate that the object may grow. */ } /* - * Allocate a new reservation. - */ - m = vm_phys_alloc_pages(VM_FREEPOOL_DEFAULT, VM_LEVEL_0_ORDER); - if (m != NULL) { + * Allocate and populate the new reservations. The alignment and + * boundary specified for this allocation may be different from the + * alignment and boundary specified for the requested pages. For + * instance, the specified index may not be the first page within the + * first new reservation. + */ + m = vm_phys_alloc_contig(allocpages, low, high, ulmax(alignment, + VM_LEVEL_0_SIZE), boundary > VM_LEVEL_0_SIZE ? boundary : 0); + if (m == NULL) + return (NULL); + m_ret = NULL; + index = VM_RESERV_INDEX(object, pindex); + do { rv = vm_reserv_from_page(m); KASSERT(rv->pages == m, - ("vm_reserv_alloc_page: reserv %p's pages is corrupted", + ("vm_reserv_alloc_contig: reserv %p's pages is corrupted", rv)); KASSERT(rv->object == NULL, - ("vm_reserv_alloc_page: reserv %p isn't free", rv)); + ("vm_reserv_alloc_contig: reserv %p isn't free", rv)); LIST_INSERT_HEAD(&object->rvq, rv, objq); rv->object = object; rv->pindex = first; KASSERT(rv->popcnt == 0, - ("vm_reserv_alloc_page: reserv %p's popcnt is corrupted", + ("vm_reserv_alloc_contig: reserv %p's popcnt is corrupted", rv)); KASSERT(!rv->inpartpopq, - ("vm_reserv_alloc_page: reserv %p's inpartpopq is TRUE", + ("vm_reserv_alloc_contig: reserv %p's inpartpopq is TRUE", rv)); + n = ulmin(VM_LEVEL_0_NPAGES - index, npages); + for (i = 0; i < n; i++) + vm_reserv_populate(rv); + npages -= n; + if (m_ret == NULL) { + m_ret = &rv->pages[index]; + index = 0; + } + m += VM_LEVEL_0_NPAGES; + first += VM_LEVEL_0_NPAGES; + allocpages -= VM_LEVEL_0_NPAGES; + } while (allocpages > VM_LEVEL_0_NPAGES); + return (m_ret); + + /* + * Found a matching reservation. + */ +found: + index = VM_RESERV_INDEX(object, pindex); + /* Does the allocation fit within the reservation? */ + if (index + npages > VM_LEVEL_0_NPAGES) + return (NULL); + m = &rv->pages[index]; + pa = VM_PAGE_TO_PHYS(m); + if (pa < low || pa + size > high || (pa & (alignment - 1)) != 0 || + ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) + return (NULL); + /* Handle vm_page_rename(m, new_object, ...). */ + for (i = 0; i < npages; i++) + if ((rv->pages[index + i].flags & (PG_CACHED | PG_FREE)) == 0) + return (NULL); + for (i = 0; i < npages; i++) vm_reserv_populate(rv); - m = &rv->pages[VM_RESERV_INDEX(object, pindex)]; + return (m); +} + +/* + * Allocates a page from an existing or newly-created reservation. + * + * The object and free page queue must be locked. + */ +vm_page_t +vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex) +{ + vm_page_t m, mpred, msucc; + vm_pindex_t first, leftcap, rightcap; + vm_reserv_t rv; + + mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + + /* + * Is a reservation fundamentally impossible? + */ + if (pindex < VM_RESERV_INDEX(object, pindex) || + pindex >= object->size) + return (NULL); + + /* + * Look for an existing reservation. + */ + msucc = NULL; + mpred = object->root; + while (mpred != NULL) { + KASSERT(mpred->pindex != pindex, + ("vm_reserv_alloc_page: pindex already allocated")); + rv = vm_reserv_from_page(mpred); + if (rv->object == object && vm_reserv_has_pindex(rv, pindex)) + goto found; + else if (mpred->pindex < pindex) { + if (msucc != NULL || + (msucc = TAILQ_NEXT(mpred, listq)) == NULL) + break; + KASSERT(msucc->pindex != pindex, + ("vm_reserv_alloc_page: pindex already allocated")); + rv = vm_reserv_from_page(msucc); + if (rv->object == object && + vm_reserv_has_pindex(rv, pindex)) + goto found; + else if (pindex < msucc->pindex) + break; + } else if (msucc == NULL) { + msucc = mpred; + mpred = TAILQ_PREV(msucc, pglist, listq); + continue; + } + msucc = NULL; + mpred = object->root = vm_page_splay(pindex, object->root); } + + /* + * Could a reservation fit between the first index to the left that + * can be used and the first index to the right that cannot be used? + */ + first = pindex - VM_RESERV_INDEX(object, pindex); + if (mpred != NULL) { + if ((rv = vm_reserv_from_page(mpred))->object != object) + leftcap = mpred->pindex + 1; + else + leftcap = rv->pindex + VM_LEVEL_0_NPAGES; + if (leftcap > first) + return (NULL); + } + if (msucc != NULL) { + if ((rv = vm_reserv_from_page(msucc))->object != object) + rightcap = msucc->pindex; + else + rightcap = rv->pindex; + if (first + VM_LEVEL_0_NPAGES > rightcap) + return (NULL); + } + + /* + * Would a new reservation extend past the end of the object? + */ + if (first + VM_LEVEL_0_NPAGES > object->size) { + /* + * Don't allocate a new reservation if the object is a vnode or + * backed by another object that is a vnode. + */ + if (object->type == OBJT_VNODE || + (object->backing_object != NULL && + object->backing_object->type == OBJT_VNODE)) + return (NULL); + /* Speculate that the object may grow. */ + } + + /* + * Allocate and populate the new reservation. + */ + m = vm_phys_alloc_pages(VM_FREEPOOL_DEFAULT, VM_LEVEL_0_ORDER); + if (m == NULL) + return (NULL); + rv = vm_reserv_from_page(m); + KASSERT(rv->pages == m, + ("vm_reserv_alloc_page: reserv %p's pages is corrupted", rv)); + KASSERT(rv->object == NULL, + ("vm_reserv_alloc_page: reserv %p isn't free", rv)); + LIST_INSERT_HEAD(&object->rvq, rv, objq); + rv->object = object; + rv->pindex = first; + KASSERT(rv->popcnt == 0, + ("vm_reserv_alloc_page: reserv %p's popcnt is corrupted", rv)); + KASSERT(!rv->inpartpopq, + ("vm_reserv_alloc_page: reserv %p's inpartpopq is TRUE", rv)); + vm_reserv_populate(rv); + return (&rv->pages[VM_RESERV_INDEX(object, pindex)]); + + /* + * Found a matching reservation. + */ +found: + m = &rv->pages[VM_RESERV_INDEX(object, pindex)]; + /* Handle vm_page_rename(m, new_object, ...). */ + if ((m->flags & (PG_CACHED | PG_FREE)) == 0) + return (NULL); + vm_reserv_populate(rv); return (m); } @@ -627,16 +815,17 @@ vm_reserv_reclaim_inactive(void) * The free page queue lock must be held. */ boolean_t -vm_reserv_reclaim_contig(vm_paddr_t size, vm_paddr_t low, vm_paddr_t high, +vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { - vm_paddr_t pa, pa_length; + vm_paddr_t pa, pa_length, size; vm_reserv_t rv; int i; mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - if (size > VM_LEVEL_0_SIZE - PAGE_SIZE) + if (npages > VM_LEVEL_0_NPAGES - 1) return (FALSE); + size = npages << PAGE_SHIFT; TAILQ_FOREACH(rv, &vm_rvq_partpop, partpopq) { pa = VM_PAGE_TO_PHYS(&rv->pages[VM_LEVEL_0_NPAGES - 1]); if (pa + PAGE_SIZE - size < low) { Modified: head/sys/vm/vm_reserv.h ============================================================================== --- head/sys/vm/vm_reserv.h Mon Dec 5 18:10:43 2011 (r228286) +++ head/sys/vm/vm_reserv.h Mon Dec 5 18:29:25 2011 (r228287) @@ -42,13 +42,19 @@ #if VM_NRESERVLEVEL > 0 +/* + * The following functions are only to be used by the virtual memory system. + */ +vm_page_t vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, + u_long npages, vm_paddr_t low, vm_paddr_t high, + u_long alignment, vm_paddr_t boundary); vm_page_t vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex); void vm_reserv_break_all(vm_object_t object); boolean_t vm_reserv_free_page(vm_page_t m); void vm_reserv_init(void); int vm_reserv_level_iffullpop(vm_page_t m); boolean_t vm_reserv_reactivate_page(vm_page_t m); -boolean_t vm_reserv_reclaim_contig(vm_paddr_t size, vm_paddr_t low, +boolean_t vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); boolean_t vm_reserv_reclaim_inactive(void); void vm_reserv_rename(vm_page_t m, vm_object_t new_object, From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 18:38:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 560ED106564A; Mon, 5 Dec 2011 18:38:56 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id E0B298FC12; Mon, 5 Dec 2011 18:38:55 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id pB5IcsOx097863; Mon, 5 Dec 2011 19:38:54 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id pB5Icskr097862; Mon, 5 Dec 2011 19:38:54 +0100 (CET) (envelope-from marius) Date: Mon, 5 Dec 2011 19:38:54 +0100 From: Marius Strobl To: Luigi Rizzo Message-ID: <20111205183854.GC54475@alchemy.franken.de> References: <201112051533.pB5FXEuh043063@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112051533.pB5FXEuh043063@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 18:38:56 -0000 On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: > Author: luigi > Date: Mon Dec 5 15:33:13 2011 > New Revision: 228281 > URL: http://svn.freebsd.org/changeset/base/228281 > > Log: > add netmap support for "em", "lem", "igb" and "re". > > On my hardware, "em" in netmap mode does about 1.388 Mpps > on one card (on an Asus motherboard), and 1.1 Mpps on another > card (PCIe bus). Both seem to be NIC-limited, because > i have the same rate even with the CPU running at 150 MHz. > > On the "re" driver the tx throughput is around 420-450 Kpps > on various (8111C and the like) chipsets. On the Rx side > performance seems much better, and i can receive the full > load generated by the "em" cards. > > "igb" is untested as i don't have the hardware. > <...> > +#ifdef DEV_NETMAP > + if (slot) { > + int si = i + na->tx_rings[txr->me].nkr_hwofs; > + void *addr; > + > + if (si >= na->num_tx_desc) > + si -= na->num_tx_desc; > + addr = NMB(slot + si); > + txr->tx_base[i].buffer_addr = > + htole64(vtophys(addr)); > + /* reload the map for netmap mode */ > + netmap_load_map(txr->txtag, > + txbuf->map, addr, na->buff_size); > + } > +#endif /* DEV_NETMAP */ Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap works with bounce buffers, IOMMUs etc? Marius From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 19:32:31 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE521106566B; Mon, 5 Dec 2011 19:32:31 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 9AC5A8FC1A; Mon, 5 Dec 2011 19:32:31 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 6613E7300A; Mon, 5 Dec 2011 20:31:50 +0100 (CET) Date: Mon, 5 Dec 2011 20:31:50 +0100 From: Luigi Rizzo To: Marius Strobl Message-ID: <20111205193150.GB49118@onelab2.iet.unipi.it> References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111205183854.GC54475@alchemy.franken.de> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 19:32:32 -0000 On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: > On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: ... > > +#ifdef DEV_NETMAP > > + if (slot) { > > + int si = i + na->tx_rings[txr->me].nkr_hwofs; > > + void *addr; > > + > > + if (si >= na->num_tx_desc) > > + si -= na->num_tx_desc; > > + addr = NMB(slot + si); > > + txr->tx_base[i].buffer_addr = > > + htole64(vtophys(addr)); > > + /* reload the map for netmap mode */ > > + netmap_load_map(txr->txtag, > > + txbuf->map, addr, na->buff_size); > > + } > > +#endif /* DEV_NETMAP */ > > Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap > works with bounce buffers, IOMMUs etc? maybe. Can you suggest how to change it ? Consider that (not here but in other places) vtophys() is called in a time-critical loop so performance matters a lot. As long as i can compute the physical address in advance and cache it in my own array, i suppose that should be fine (in which case the calls to vtophys(addr) would become NMPB(slot + si) where the NMPB() macro would hide translations and checks. cheers luigi > From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 19:34:03 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4262B106564A; Mon, 5 Dec 2011 19:34:03 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32CF88FC15; Mon, 5 Dec 2011 19:34:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5JY36f054962; Mon, 5 Dec 2011 19:34:03 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5JY3iK054960; Mon, 5 Dec 2011 19:34:03 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112051934.pB5JY3iK054960@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 5 Dec 2011 19:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228288 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 19:34:03 -0000 Author: trociny Date: Mon Dec 5 19:34:02 2011 New Revision: 228288 URL: http://svn.freebsd.org/changeset/base/228288 Log: Protect kern.proc.auxv and kern.proc.ps_strings sysctls with p_candebug(). Citing jilles: If we are ever going to do ASLR, the AUXV information tells an attacker where the stack, executable and RTLD are located, which defeats much of the point of randomizing the addresses in the first place. Given that the AUXV information seems to be used by debuggers only anyway, I think it would be good to move it to p_candebug() now. The full virtual memory maps (KERN_PROC_VMMAP, procstat -v) are already under p_candebug(). Suggested by: jilles Discussed with: rwatson MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Mon Dec 5 18:29:25 2011 (r228287) +++ head/sys/kern/kern_proc.c Mon Dec 5 19:34:02 2011 (r228288) @@ -1782,7 +1782,8 @@ sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARG PROC_UNLOCK(p); return (ESRCH); } - if ((error = p_cansee(curthread, p)) != 0) { + error = p_candebug(curthread, p); + if (error != 0) { PROC_UNLOCK(p); return (error); } @@ -2456,7 +2457,8 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL p = pfind((pid_t)name[0]); if (p == NULL) return (ESRCH); - if ((error = p_cansee(curthread, p)) != 0) { + error = p_cansee(curthread, p); + if (error != 0) { PROC_UNLOCK(p); return (error); } From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 19:39:15 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DF57106564A; Mon, 5 Dec 2011 19:39:15 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E3958FC08; Mon, 5 Dec 2011 19:39:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5JdFAN055153; Mon, 5 Dec 2011 19:39:15 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5JdF7k055151; Mon, 5 Dec 2011 19:39:15 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112051939.pB5JdF7k055151@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 5 Dec 2011 19:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228289 - head/usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 19:39:15 -0000 Author: trociny Date: Mon Dec 5 19:39:15 2011 New Revision: 228289 URL: http://svn.freebsd.org/changeset/base/228289 Log: Don't output a warning if kern.proc.auxv sysctl has returned EPERM. After r228288 this is rather a normal situation. MFC after: 1 week Modified: head/usr.bin/procstat/procstat_auxv.c Modified: head/usr.bin/procstat/procstat_auxv.c ============================================================================== --- head/usr.bin/procstat/procstat_auxv.c Mon Dec 5 19:34:02 2011 (r228288) +++ head/usr.bin/procstat/procstat_auxv.c Mon Dec 5 19:39:15 2011 (r228289) @@ -66,7 +66,7 @@ procstat_auxv(struct kinfo_proc *kipp) name[3] = kipp->ki_pid; len = sizeof(auxv) * sizeof(*auxv); error = sysctl(name, 4, auxv, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { + if (error < 0 && errno != ESRCH && errno != EPERM) { warn("sysctl: kern.proc.auxv: %d: %d", kipp->ki_pid, errno); return; } From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 20:14:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39D731065672; Mon, 5 Dec 2011 20:14:52 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id A91E88FC18; Mon, 5 Dec 2011 20:14:51 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id pB5KEomL098182; Mon, 5 Dec 2011 21:14:50 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id pB5KEomJ098181; Mon, 5 Dec 2011 21:14:50 +0100 (CET) (envelope-from marius) Date: Mon, 5 Dec 2011 21:14:50 +0100 From: Marius Strobl To: Luigi Rizzo Message-ID: <20111205201450.GR60194@alchemy.franken.de> References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> <20111205193150.GB49118@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111205193150.GB49118@onelab2.iet.unipi.it> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 20:14:52 -0000 On Mon, Dec 05, 2011 at 08:31:50PM +0100, Luigi Rizzo wrote: > On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: > > On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: > ... > > > +#ifdef DEV_NETMAP > > > + if (slot) { > > > + int si = i + na->tx_rings[txr->me].nkr_hwofs; > > > + void *addr; > > > + > > > + if (si >= na->num_tx_desc) > > > + si -= na->num_tx_desc; > > > + addr = NMB(slot + si); > > > + txr->tx_base[i].buffer_addr = > > > + htole64(vtophys(addr)); > > > + /* reload the map for netmap mode */ > > > + netmap_load_map(txr->txtag, > > > + txbuf->map, addr, na->buff_size); > > > + } > > > +#endif /* DEV_NETMAP */ > > > > Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap > > works with bounce buffers, IOMMUs etc? > > maybe. Can you suggest how to change it ? > > Consider that (not here but in other places) vtophys() is called > in a time-critical loop so performance matters a lot. As long as i > can compute the physical address in advance and cache it in my own > array, i suppose that should be fine (in which case the calls to > vtophys(addr) would become NMPB(slot + si) where the NMPB() macro > would hide translations and checks. > Basically, you'd call bus_dmamap_load(9) on the netmap buffers using the tags and maps the driver also uses in the !netmap case to load mbufs. If you're generally pre-allocating the netmap buffers (sorry, I don't have time to check the netmap code) it should also be fine to cache the resulting physical addresses obtained via the bus_dma callback. You'd still need to call bus_dmamap_sync(9) whenever you actually assign a buffer to the hardware and when taking off of it so the bounce buffers are copied over, streaming buffers are synced etc. Marius From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 20:46:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D06A7106566B; Mon, 5 Dec 2011 20:46:38 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe09.c2i.net [212.247.155.2]) by mx1.freebsd.org (Postfix) with ESMTP id 999788FC08; Mon, 5 Dec 2011 20:46:37 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe09.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 38381043; Mon, 05 Dec 2011 21:46:34 +0100 From: Hans Petter Selasky To: Max Khon Date: Mon, 5 Dec 2011 21:43:59 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201111301811.pAUIBnr6008539@svn.freebsd.org> In-Reply-To: <201111301811.pAUIBnr6008539@svn.freebsd.org> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201112052143.59972.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r228158 - in head: . share/mk sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 20:46:38 -0000 Hi, I see regressions when building kernel modules from /usr/ports: On Monday 05 December 2011 14:39:56 Robert Huff wrote: > Hello: > When trying to update I get: > > ===> Building for cuse4bsd-kmod-0.1.21_2 > make -f > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > 21/Makefile.lib HAVE_DEBUG=YES all Warning: Object directory not changed > from original > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > 21 make -f > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > 21/Makefile.kmod all "/sys/conf/kmod.mk", line 204: Malformed conditional > (${MK_CTF} != "no") "/sys/conf/kmod.mk", line 206: if-less endif > make: fatal errors encountered -- cannot continue > *** Error code 1 --HPS From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 21:38:45 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA1301065678; Mon, 5 Dec 2011 21:38:45 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA4718FC12; Mon, 5 Dec 2011 21:38:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5LcjMe058891; Mon, 5 Dec 2011 21:38:45 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5LcjH0058889; Mon, 5 Dec 2011 21:38:45 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201112052138.pB5LcjH0058889@svn.freebsd.org> From: Marius Strobl Date: Mon, 5 Dec 2011 21:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228290 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 21:38:46 -0000 Author: marius Date: Mon Dec 5 21:38:45 2011 New Revision: 228290 URL: http://svn.freebsd.org/changeset/base/228290 Log: - In mii_attach(9) just set the driver for a newly added miibus(4) instance before calling bus_enumerate_hinted_children(9) (which is the minimum for this to work) instead of fully probing it so later on we can just call bus_generic_attach(9) on the parent of the miibus(4) instance. The latter is necessary in order to work around what seems to be a bzzarre race in newbus affecting a few machines since r227687, causing no driver being probed for the newly added miibus(4) instance. Presumably this is the same race that was the motivation for the work around done in r215348. Reported and tested by: yongari - Revert the removal of a static in r221913 in order to help compilers to produce more optimal code. Modified: head/sys/dev/mii/mii.c Modified: head/sys/dev/mii/mii.c ============================================================================== --- head/sys/dev/mii/mii.c Mon Dec 5 19:39:15 2011 (r228289) +++ head/sys/dev/mii/mii.c Mon Dec 5 21:38:45 2011 (r228290) @@ -499,7 +499,7 @@ mii_attach(device_t dev, device_t *miibu free(children, M_TEMP); if (first != 0) { - rv = device_probe(*miibus); + rv = device_set_driver(*miibus, &miibus_driver); if (rv != 0) goto fail; bus_enumerate_hinted_children(*miibus); @@ -511,7 +511,7 @@ mii_attach(device_t dev, device_t *miibu rv = ENXIO; goto fail; } - rv = device_attach(*miibus); + rv = bus_generic_attach(dev); if (rv != 0) goto fail; @@ -626,7 +626,7 @@ mii_down(struct mii_data *mii) static unsigned char mii_bitreverse(unsigned char x) { - unsigned const char const nibbletab[16] = { + static unsigned const char const nibbletab[16] = { 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 }; From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 22:09:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1192106566C; Mon, 5 Dec 2011 22:09:07 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7E438FC1B; Mon, 5 Dec 2011 22:09:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5M97tA060262; Mon, 5 Dec 2011 22:09:07 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5M97vE060260; Mon, 5 Dec 2011 22:09:07 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112052209.pB5M97vE060260@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 5 Dec 2011 22:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228291 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 22:09:08 -0000 Author: yongari Date: Mon Dec 5 22:09:07 2011 New Revision: 228291 URL: http://svn.freebsd.org/changeset/base/228291 Log: Remove NetBSD license. r199548 removed all bit macros that were derived from NetBSD. Modified: head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Mon Dec 5 21:38:45 2011 (r228290) +++ head/sys/dev/et/if_etreg.h Mon Dec 5 22:09:07 2011 (r228291) @@ -34,41 +34,6 @@ * $DragonFly: src/sys/dev/netif/et/if_etreg.h,v 1.3 2007/10/23 14:28:42 sephe Exp $ * $FreeBSD$ */ -/*- - * Portions of this code is derived from NetBSD which is covered by - * the following license: - * - * Copyright (c) 2004, 2005 David Young. All rights reserved. - * - * Programmed for NetBSD by David Young. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of David Young may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David - * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * $DragonFly: src/sys/sys/bitops.h,v 1.1 2007/10/14 04:15:17 sephe Exp $ - */ #ifndef _IF_ETREG_H #define _IF_ETREG_H From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 22:22:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 949A91065670; Mon, 5 Dec 2011 22:22:39 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84C5B8FC0A; Mon, 5 Dec 2011 22:22:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5MMdRw060736; Mon, 5 Dec 2011 22:22:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5MMdNU060734; Mon, 5 Dec 2011 22:22:39 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112052222.pB5MMdNU060734@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 5 Dec 2011 22:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228292 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 22:22:39 -0000 Author: yongari Date: Mon Dec 5 22:22:39 2011 New Revision: 228292 URL: http://svn.freebsd.org/changeset/base/228292 Log: Implement suspend/resume methods. Driver has no issue with suspend/resume. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Mon Dec 5 22:09:07 2011 (r228291) +++ head/sys/dev/et/if_et.c Mon Dec 5 22:22:39 2011 (r228292) @@ -87,6 +87,8 @@ static int et_probe(device_t); static int et_attach(device_t); static int et_detach(device_t); static int et_shutdown(device_t); +static int et_suspend(device_t); +static int et_resume(device_t); static int et_miibus_readreg(device_t, int, int); static int et_miibus_writereg(device_t, int, int, int); @@ -169,6 +171,8 @@ static device_method_t et_methods[] = { DEVMETHOD(device_attach, et_attach), DEVMETHOD(device_detach, et_detach), DEVMETHOD(device_shutdown, et_shutdown), + DEVMETHOD(device_suspend, et_suspend), + DEVMETHOD(device_resume, et_resume), DEVMETHOD(miibus_readreg, et_miibus_readreg), DEVMETHOD(miibus_writereg, et_miibus_writereg), @@ -2451,3 +2455,29 @@ et_setup_rxdesc(struct et_rxbuf_data *rb bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, BUS_DMASYNC_PREWRITE); } + +static int +et_suspend(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + et_stop(sc); + ET_UNLOCK(sc); + return (0); +} + +static int +et_resume(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_flags & IFF_UP) != 0) + et_init_locked(sc); + ET_UNLOCK(sc); + return (0); +} From owner-svn-src-head@FreeBSD.ORG Mon Dec 5 22:55:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4CE3106564A; Mon, 5 Dec 2011 22:55:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B49F8FC1B; Mon, 5 Dec 2011 22:55:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5Mtqi7061721; Mon, 5 Dec 2011 22:55:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5MtqVt061719; Mon, 5 Dec 2011 22:55:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112052255.pB5MtqVt061719@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 5 Dec 2011 22:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228293 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 22:55:52 -0000 Author: yongari Date: Mon Dec 5 22:55:52 2011 New Revision: 228293 URL: http://svn.freebsd.org/changeset/base/228293 Log: Fix alt(4) support. Also add check for number of available TX descriptors before trying to send frames. If we're not able to send a frame, make sure to prepend it to if_snd queue such that alt(4) should work. While I'm here prefer ETHER_BPF_MTAP to BPF_MTAP. ETHER_BPF_MTAP should be used for controllers that support VLAN hardware tag insertion. The controller supports VLAN tag insertion but lacks VLAN tag stripping in RX path though. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Mon Dec 5 22:22:39 2011 (r228292) +++ head/sys/dev/et/if_et.c Mon Dec 5 22:55:52 2011 (r228293) @@ -338,7 +338,8 @@ et_attach(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; - IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC); + ifp->if_snd.ifq_drv_maxlen = ET_TX_NDESC - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC - 1); IFQ_SET_READY(&ifp->if_snd); et_chip_attach(sc); @@ -1257,12 +1258,13 @@ et_ioctl(struct ifnet *ifp, u_long cmd, static void et_start_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + struct mbuf *m_head = NULL; struct et_txbuf_data *tbd; - int trans; + int enq; + sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - tbd = &sc->sc_tx_data; if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) return; @@ -1270,30 +1272,32 @@ et_start_locked(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; - trans = 0; - for (;;) { - struct mbuf *m; - - if ((tbd->tbd_used + ET_NSEG_SPARE) > ET_TX_NDESC) { + tbd = &sc->sc_tx_data; + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { + if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) break; - if (et_encap(sc, &m)) { - ifp->if_oerrors++; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + if (et_encap(sc, &m_head)) { + if (m_head == NULL) { + ifp->if_oerrors++; + break; + } + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (tbd->tbd_used > 0) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - trans = 1; - - BPF_MTAP(ifp, m); + enq++; + ETHER_BPF_MTAP(ifp, m_head); } - if (trans) + if (enq > 0) sc->watchdog_timer = 5; } From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 00:18:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 084091065670; Tue, 6 Dec 2011 00:18:38 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC8168FC0A; Tue, 6 Dec 2011 00:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB60IbOj064428; Tue, 6 Dec 2011 00:18:37 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB60Ibfa064426; Tue, 6 Dec 2011 00:18:37 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112060018.pB60Ibfa064426@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 6 Dec 2011 00:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228297 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 00:18:38 -0000 Author: yongari Date: Tue Dec 6 00:18:37 2011 New Revision: 228297 URL: http://svn.freebsd.org/changeset/base/228297 Log: et(4) supports VLAN oversized frame so correctly set header length. While I'm here remove initializing if_mtu, it is set by ether_ifattach(9). Also move callout_init_mtx(9) to the right below driver lock initialization. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Tue Dec 6 00:13:40 2011 (r228296) +++ head/sys/dev/et/if_et.c Tue Dec 6 00:18:37 2011 (r228297) @@ -244,6 +244,7 @@ et_attach(device_t dev) sc->dev = dev; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -335,7 +336,6 @@ et_attach(device_t dev) ifp->if_init = et_init; ifp->if_ioctl = et_ioctl; ifp->if_start = et_start; - ifp->if_mtu = ETHERMTU; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; ifp->if_snd.ifq_drv_maxlen = ET_TX_NDESC - 1; @@ -352,7 +352,9 @@ et_attach(device_t dev) } ether_ifattach(ifp, eaddr); - callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); + + /* Tell the upper layer(s) we support long frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE, NULL, et_intr, sc, &sc->sc_irq_handle); From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 00:58:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64E8D106564A; Tue, 6 Dec 2011 00:58:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B8ED8FC0C; Tue, 6 Dec 2011 00:58:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB60whQ0065619; Tue, 6 Dec 2011 00:58:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB60whiT065617; Tue, 6 Dec 2011 00:58:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112060058.pB60whiT065617@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 6 Dec 2011 00:58:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228298 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 00:58:43 -0000 Author: yongari Date: Tue Dec 6 00:58:42 2011 New Revision: 228298 URL: http://svn.freebsd.org/changeset/base/228298 Log: Make et_probe() return BUS_PROBE_DEFAULT such that allow other driver that has high precedence for the controller override et(4). Add missing callout_drain(9) in device detach and rework detach routine. While I'm here use rman_get_rid(9) instead of using cached resource id because bus methods are free to change the id. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Tue Dec 6 00:18:37 2011 (r228297) +++ head/sys/dev/et/if_et.c Tue Dec 6 00:58:42 2011 (r228298) @@ -226,7 +226,7 @@ et_probe(device_t dev) for (d = et_devices; d->desc != NULL; ++d) { if (vid == d->vid && did == d->did) { device_set_desc(dev, d->desc); - return (0); + return (BUS_PROBE_DEFAULT); } } return (ENXIO); @@ -378,31 +378,27 @@ et_detach(device_t dev) struct et_softc *sc = device_get_softc(dev); if (device_is_attached(dev)) { - struct ifnet *ifp = sc->ifp; - + ether_ifdetach(sc->ifp); ET_LOCK(sc); et_stop(sc); - bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); ET_UNLOCK(sc); - - ether_ifdetach(ifp); + callout_drain(&sc->sc_tick); } if (sc->sc_miibus != NULL) device_delete_child(dev, sc->sc_miibus); bus_generic_detach(dev); - if (sc->sc_irq_res != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, - sc->sc_irq_res); - } + if (sc->sc_irq_handle != NULL) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); if ((sc->sc_flags & ET_FLAG_MSI) != 0) pci_release_msi(dev); - - if (sc->sc_mem_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, - sc->sc_mem_res); - } + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); if (sc->ifp != NULL) if_free(sc->ifp); From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 06:28:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E259106566C; Tue, 6 Dec 2011 06:28:33 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2628FC18; Tue, 6 Dec 2011 06:28:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB66SX09076104; Tue, 6 Dec 2011 06:28:33 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB66SWVG076093; Tue, 6 Dec 2011 06:28:32 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201112060628.pB66SWVG076093@svn.freebsd.org> From: Peter Grehan Date: Tue, 6 Dec 2011 06:28:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228301 - in head/sys/dev/virtio: . balloon block network pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 06:28:33 -0000 Author: grehan Date: Tue Dec 6 06:28:32 2011 New Revision: 228301 URL: http://svn.freebsd.org/changeset/base/228301 Log: Catch up with Bryan Venteicher's virtio Hg repo: c162516 Remove vtblk_sector_size c162515 Wrap long license lines c162514 Remove vtblk_unit c162513 Wrap long lines in the license. c162512 Remove verbose messages when link goes up/down. A similar message is printed elsewhere as a result of if_link_state_change(). c162511 Explicity compare pointer to NULL c162510 Allocate the mac filter table at attach time. c162509 Add real BSD licenses to the header files copied from Linux. The chases upstream changes made in Linux awhile ago. c162508 Only notify if we actually dequeued something. c162507 Change a couple of if () { KASSERT(...) } to just KASSERTs. In non-debug kernels, the if() { } probably get optomized away, but I guess this is clearer. c162506 Remove VIRTIO_BLK_F_TOPOLOGY fields in the config. TOPOLOGY has since been removed from the spec, and the FreeBSD didn't really do anything with the fields anyways. c162505 Move vtblk_enqueue_request() outside the locks when getting the ident. c162504 Remove soon to be uneeded trylock during dump [1]. http://lists.freebsd.org/pipermail/freebsd-current/2011-November/029226.html c162503 Remove emtpy line c162502 Drop frame if cannot allocate a vtnet_tx_header. If we don't, we set OACTIVE, but if there are no other frames in flight, vtnet_txeof() will never be called to unset OACTIVE. The interface would have to be down/up'ed in order to become usable. We could be cuter here and only do this if the virtqueue is emtpy, but its probably not worth the complication. c162501 Start mbuf replacement loop at 1 for clarity Obtained from: Bryan Venteicher bryanv at daemoninthecloset dot org Modified: head/sys/dev/virtio/balloon/virtio_balloon.c head/sys/dev/virtio/balloon/virtio_balloon.h head/sys/dev/virtio/block/virtio_blk.c head/sys/dev/virtio/block/virtio_blk.h head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/network/if_vtnetvar.h head/sys/dev/virtio/network/virtio_net.h head/sys/dev/virtio/pci/virtio_pci.h head/sys/dev/virtio/virtio.h head/sys/dev/virtio/virtio_ring.h Modified: head/sys/dev/virtio/balloon/virtio_balloon.c ============================================================================== --- head/sys/dev/virtio/balloon/virtio_balloon.c Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/balloon/virtio_balloon.c Tue Dec 6 06:28:32 2011 (r228301) @@ -475,7 +475,6 @@ vtballoon_update_size(struct vtballoon_s virtio_write_dev_config_4(sc->vtballoon_dev, offsetof(struct virtio_balloon_config, actual), htole32(sc->vtballoon_current_npages)); - } static int Modified: head/sys/dev/virtio/balloon/virtio_balloon.h ============================================================================== --- head/sys/dev/virtio/balloon/virtio_balloon.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/balloon/virtio_balloon.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,7 +1,30 @@ -/* +/*- * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * * $FreeBSD$ */ Modified: head/sys/dev/virtio/block/virtio_blk.c ============================================================================== --- head/sys/dev/virtio/block/virtio_blk.c Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/block/virtio_blk.c Tue Dec 6 06:28:32 2011 (r228301) @@ -87,9 +87,7 @@ struct vtblk_softc { struct taskqueue *vtblk_tq; struct task vtblk_intr_task; - int vtblk_sector_size; int vtblk_max_nsegs; - int vtblk_unit; int vtblk_request_count; struct vtblk_request vtblk_dump_request; @@ -185,7 +183,6 @@ TUNABLE_INT("hw.vtblk.no_ident", &vtblk_ mtx_init(VTBLK_MTX((_sc)), (_name), \ "VTBLK Lock", MTX_DEF) #define VTBLK_LOCK(_sc) mtx_lock(VTBLK_MTX((_sc))) -#define VTBLK_TRYLOCK(_sc) mtx_trylock(VTBLK_MTX((_sc))) #define VTBLK_UNLOCK(_sc) mtx_unlock(VTBLK_MTX((_sc))) #define VTBLK_LOCK_DESTROY(_sc) mtx_destroy(VTBLK_MTX((_sc))) #define VTBLK_LOCK_ASSERT(_sc) mtx_assert(VTBLK_MTX((_sc)), MA_OWNED) @@ -281,7 +278,6 @@ vtblk_attach(device_t dev) sc = device_get_softc(dev); sc->vtblk_dev = dev; - sc->vtblk_unit = device_get_unit(dev); VTBLK_LOCK_INIT(sc, device_get_nameunit(dev)); @@ -299,13 +295,8 @@ vtblk_attach(device_t dev) sc->vtblk_flags |= VTBLK_FLAG_READONLY; /* Get local copy of config. */ - if (virtio_with_feature(dev, VIRTIO_BLK_F_TOPOLOGY) == 0) { - bzero(&blkcfg, sizeof(struct virtio_blk_config)); - virtio_read_device_config(dev, 0, &blkcfg, - offsetof(struct virtio_blk_config, physical_block_exp)); - } else - virtio_read_device_config(dev, 0, &blkcfg, - sizeof(struct virtio_blk_config)); + virtio_read_device_config(dev, 0, &blkcfg, + sizeof(struct virtio_blk_config)); /* * With the current sglist(9) implementation, it is not easy @@ -498,12 +489,6 @@ vtblk_dump(void *arg, void *virtual, vm_ if ((sc = dp->d_drv1) == NULL) return (ENXIO); - if (VTBLK_TRYLOCK(sc) == 0) { - device_printf(sc->vtblk_dev, - "softc already locked, cannot dump...\n"); - return (EBUSY); - } - if ((sc->vtblk_flags & VTBLK_FLAG_DUMPING) == 0) { vtblk_prepare_dump(sc); sc->vtblk_flags |= VTBLK_FLAG_DUMPING; @@ -622,7 +607,7 @@ vtblk_alloc_disk(struct vtblk_softc *sc, dp->d_ioctl = vtblk_ioctl; dp->d_strategy = vtblk_strategy; dp->d_name = VTBLK_DISK_NAME; - dp->d_unit = sc->vtblk_unit; + dp->d_unit = device_get_unit(dev); dp->d_drv1 = sc; if ((sc->vtblk_flags & VTBLK_FLAG_READONLY) == 0) @@ -632,10 +617,9 @@ vtblk_alloc_disk(struct vtblk_softc *sc, dp->d_mediasize = blkcfg->capacity * 512; if (virtio_with_feature(dev, VIRTIO_BLK_F_BLK_SIZE)) - sc->vtblk_sector_size = blkcfg->blk_size; + dp->d_sectorsize = blkcfg->blk_size; else - sc->vtblk_sector_size = 512; - dp->d_sectorsize = sc->vtblk_sector_size; + dp->d_sectorsize = 512; /* * The VirtIO maximum I/O size is given in terms of segments. @@ -905,9 +889,10 @@ vtblk_get_ident(struct vtblk_softc *sc) VTBLK_LOCK(sc); error = vtblk_poll_request(sc, req); - vtblk_enqueue_request(sc, req); VTBLK_UNLOCK(sc); + vtblk_enqueue_request(sc, req); + if (error) { device_printf(sc->vtblk_dev, "error getting device identifier: %d\n", error); Modified: head/sys/dev/virtio/block/virtio_blk.h ============================================================================== --- head/sys/dev/virtio/block/virtio_blk.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/block/virtio_blk.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,7 +1,30 @@ -/* +/*- * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * * $FreeBSD$ */ @@ -39,16 +62,6 @@ struct virtio_blk_config { /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ uint32_t blk_size; - - /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */ - /* exponent for physical block per logical block. */ - uint8_t physical_block_exp; - /* alignment offset in logical blocks. */ - uint8_t alignment_offset; - /* minimum I/O size without performance penalty in logical blocks. */ - uint16_t min_io_size; - /* optimal sustained I/O size in logical blocks. */ - uint32_t opt_io_size; } __packed; /* Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/network/if_vtnet.c Tue Dec 6 06:28:32 2011 (r228301) @@ -317,8 +317,20 @@ vtnet_attach(device_t dev) if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_VQ)) { sc->vtnet_flags |= VTNET_FLAG_CTRL_VQ; - if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_RX)) + if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_RX)) { + sc->vtnet_mac_filter = malloc( + sizeof(struct vtnet_mac_filter), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (sc->vtnet_mac_filter == NULL) { + device_printf(dev, + "cannot allocate mac filter table\n"); + error = ENOMEM; + goto fail; + } + sc->vtnet_flags |= VTNET_FLAG_CTRL_RX; + } + if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_VLAN)) sc->vtnet_flags |= VTNET_FLAG_VLAN_FILTER; } @@ -505,7 +517,12 @@ vtnet_detach(device_t dev) sc->vtnet_vlan_detach = NULL; } - if (ifp) { + if (sc->vtnet_mac_filter != NULL) { + free(sc->vtnet_mac_filter, M_DEVBUF); + sc->vtnet_mac_filter = NULL; + } + + if (ifp != NULL) { if_free(ifp); sc->vtnet_ifp = NULL; } @@ -742,17 +759,11 @@ vtnet_update_link_status(struct vtnet_so if (link && ((sc->vtnet_flags & VTNET_FLAG_LINK) == 0)) { sc->vtnet_flags |= VTNET_FLAG_LINK; - if (bootverbose) - device_printf(dev, "Link is up\n"); - if_link_state_change(ifp, LINK_STATE_UP); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vtnet_start_locked(ifp); } else if (!link && (sc->vtnet_flags & VTNET_FLAG_LINK)) { sc->vtnet_flags &= ~VTNET_FLAG_LINK; - if (bootverbose) - device_printf(dev, "Link is down\n"); - if_link_state_change(ifp, LINK_STATE_DOWN); } } @@ -1105,7 +1116,7 @@ vtnet_alloc_rxbuf(struct vtnet_softc *sc KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG, ("chained Rx mbuf requested without LRO_NOMRG")); - for (i = 0; i < nbufs - 1; i++) { + for (i = 1; i < nbufs; i++) { m = m_getjcl(M_DONTWAIT, MT_DATA, 0, clsize); if (m == NULL) goto fail; @@ -1143,9 +1154,8 @@ vtnet_replace_rxbuf(struct vtnet_softc * clsize = sc->vtnet_rx_mbuf_size; nreplace = 0; - if (m->m_next != NULL) - KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG, - ("chained Rx mbuf without LRO_NOMRG")); + KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG || + m->m_next == NULL, ("chained Rx mbuf without LRO_NOMRG")); /* * Since LRO_NOMRG mbuf chains are so large, we want to avoid @@ -1275,8 +1285,8 @@ vtnet_enqueue_rxbuf(struct vtnet_softc * int offset, error; VTNET_LOCK_ASSERT(sc); - if ((sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG) == 0) - KASSERT(m->m_next == NULL, ("chained Rx mbuf")); + KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG || + m->m_next == NULL, ("chained Rx mbuf without LRO_NOMRG")); sglist_init(&sg, VTNET_MAX_RX_SEGS, segs); @@ -1688,7 +1698,8 @@ vtnet_rxeof(struct vtnet_softc *sc, int break; } - virtqueue_notify(vq); + if (deq > 0) + virtqueue_notify(vq); if (rx_npktsp != NULL) *rx_npktsp = rx_npkts; @@ -1946,9 +1957,14 @@ vtnet_encap(struct vtnet_softc *sc, stru struct mbuf *m; int error; + m = *m_head; + txhdr = uma_zalloc(vtnet_tx_header_zone, M_NOWAIT | M_ZERO); - if (txhdr == NULL) + if (txhdr == NULL) { + *m_head = NULL; + m_freem(m); return (ENOMEM); + } /* * Always use the non-mergeable header to simplify things. When @@ -1957,21 +1973,22 @@ vtnet_encap(struct vtnet_softc *sc, stru * the correct header size to the host. */ hdr = &txhdr->vth_uhdr.hdr; - m = *m_head; - - error = ENOBUFS; if (m->m_flags & M_VLANTAG) { m = ether_vlanencap(m, m->m_pkthdr.ether_vtag); - if ((*m_head = m) == NULL) + if ((*m_head = m) == NULL) { + error = ENOBUFS; goto fail; + } m->m_flags &= ~M_VLANTAG; } if (m->m_pkthdr.csum_flags != 0) { m = vtnet_tx_offload(sc, m, hdr); - if ((*m_head = m) == NULL) + if ((*m_head = m) == NULL) { + error = ENOBUFS; goto fail; + } } error = vtnet_enqueue_txbuf(sc, m_head, txhdr); @@ -2387,6 +2404,7 @@ vtnet_rx_filter_mac(struct vtnet_softc * uint8_t ack; ifp = sc->vtnet_ifp; + filter = sc->vtnet_mac_filter; ucnt = 0; mcnt = 0; promisc = 0; @@ -2397,19 +2415,6 @@ vtnet_rx_filter_mac(struct vtnet_softc * KASSERT(sc->vtnet_flags & VTNET_FLAG_CTRL_RX, ("CTRL_RX feature not negotiated")); - /* - * Allocate the MAC filtering table. Note we could do this - * at attach time, but it is probably not worth keeping it - * around for an infrequent occurrence. - */ - filter = malloc(sizeof(struct vtnet_mac_filter), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (filter == NULL) { - device_printf(sc->vtnet_dev, - "cannot allocate MAC address filtering table\n"); - return; - } - /* Unicast MAC addresses: */ if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -2481,8 +2486,6 @@ vtnet_rx_filter_mac(struct vtnet_softc * if_printf(ifp, "error setting host MAC filter table\n"); out: - free(filter, M_DEVBUF); - if (promisc) if (vtnet_set_promisc(sc, 1) != 0) if_printf(ifp, "cannot enable promiscuous mode\n"); Modified: head/sys/dev/virtio/network/if_vtnetvar.h ============================================================================== --- head/sys/dev/virtio/network/if_vtnetvar.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/network/if_vtnetvar.h Tue Dec 6 06:28:32 2011 (r228301) @@ -99,6 +99,7 @@ struct vtnet_softc { #define VTNET_MEDIATYPE (IFM_ETHER | IFM_1000_T | IFM_FDX) char vtnet_hwaddr[ETHER_ADDR_LEN]; + struct vtnet_mac_filter *vtnet_mac_filter; /* * During reset, the host's VLAN filtering table is lost. The * array below is used to restore all the VLANs configured on Modified: head/sys/dev/virtio/network/virtio_net.h ============================================================================== --- head/sys/dev/virtio/network/virtio_net.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/network/virtio_net.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,7 +1,30 @@ -/* +/*- * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * * $FreeBSD$ */ Modified: head/sys/dev/virtio/pci/virtio_pci.h ============================================================================== --- head/sys/dev/virtio/pci/virtio_pci.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/pci/virtio_pci.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,4 +1,4 @@ -/* +/*- * Copyright IBM Corp. 2007 * * Authors: @@ -7,6 +7,29 @@ * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * * $FreeBSD$ */ Modified: head/sys/dev/virtio/virtio.h ============================================================================== --- head/sys/dev/virtio/virtio.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/virtio.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,7 +1,30 @@ -/* +/*- * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * * $FreeBSD$ */ Modified: head/sys/dev/virtio/virtio_ring.h ============================================================================== --- head/sys/dev/virtio/virtio_ring.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/virtio_ring.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,10 +1,34 @@ -/* - * This header is BSD licensed so anyone can use the definitions - * to implement compatible drivers/servers. - * +/*- * Copyright Rusty Russell IBM Corporation 2007. + * + * This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ */ -/* $FreeBSD$ */ #ifndef VIRTIO_RING_H #define VIRTIO_RING_H From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 06:40:15 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C33D1065676; Tue, 6 Dec 2011 06:40:15 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C7F88FC14; Tue, 6 Dec 2011 06:40:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB66eFrm076480; Tue, 6 Dec 2011 06:40:15 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB66eFuQ076478; Tue, 6 Dec 2011 06:40:15 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112060640.pB66eFuQ076478@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 6 Dec 2011 06:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228302 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 06:40:15 -0000 Author: trociny Date: Tue Dec 6 06:40:14 2011 New Revision: 228302 URL: http://svn.freebsd.org/changeset/base/228302 Log: Really protect kern.proc.ps_strings sysctls with p_candebug(). This was intended to be in r228288. Spotted by: many MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Dec 6 06:28:32 2011 (r228301) +++ head/sys/kern/kern_proc.c Tue Dec 6 06:40:14 2011 (r228302) @@ -2457,7 +2457,7 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL p = pfind((pid_t)name[0]); if (p == NULL) return (ESRCH); - error = p_cansee(curthread, p); + error = p_candebug(curthread, p); if (error != 0) { PROC_UNLOCK(p); return (error); From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 07:55:25 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D2B0106566C; Tue, 6 Dec 2011 07:55:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CEFB8FC13; Tue, 6 Dec 2011 07:55:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB67tP0i078742; Tue, 6 Dec 2011 07:55:25 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB67tPQC078740; Tue, 6 Dec 2011 07:55:25 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112060755.pB67tPQC078740@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 6 Dec 2011 07:55:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228303 - head/sys/dev/usb/wlan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 07:55:25 -0000 Author: hselasky Date: Tue Dec 6 07:55:25 2011 New Revision: 228303 URL: http://svn.freebsd.org/changeset/base/228303 Log: Fix compile warning when using clang to compile the code. Submitted by: arundel @ MFC after: 3 days Modified: head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Tue Dec 6 06:40:14 2011 (r228302) +++ head/sys/dev/usb/wlan/if_zyd.c Tue Dec 6 07:55:25 2011 (r228303) @@ -686,7 +686,7 @@ zyd_intr_read_callback(struct usb_xfer * memcpy(rqp->odata, cmd->data, rqp->olen); DPRINTF(sc, ZYD_DEBUG_CMD, "command %p complete, data = %*D \n", - rqp, rqp->olen, rqp->odata, ":"); + rqp, rqp->olen, (char *)rqp->odata, ":"); wakeup(rqp); /* wakeup caller */ break; } From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 08:08:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E834106564A; Tue, 6 Dec 2011 08:08:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83EED8FC0A; Tue, 6 Dec 2011 08:08:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB688qXJ079176; Tue, 6 Dec 2011 08:08:52 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB688qNq079171; Tue, 6 Dec 2011 08:08:52 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112060808.pB688qNq079171@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 6 Dec 2011 08:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228304 - head/sys/dev/usb/template X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 08:08:52 -0000 Author: hselasky Date: Tue Dec 6 08:08:52 2011 New Revision: 228304 URL: http://svn.freebsd.org/changeset/base/228304 Log: Correct some bInterval USB template descriptor values. MFC after: 3 days Modified: head/sys/dev/usb/template/usb_template.c head/sys/dev/usb/template/usb_template_kbd.c head/sys/dev/usb/template/usb_template_modem.c head/sys/dev/usb/template/usb_template_mouse.c Modified: head/sys/dev/usb/template/usb_template.c ============================================================================== --- head/sys/dev/usb/template/usb_template.c Tue Dec 6 07:55:25 2011 (r228303) +++ head/sys/dev/usb/template/usb_template.c Tue Dec 6 08:08:52 2011 (r228304) @@ -260,7 +260,7 @@ usb_make_endpoint_desc(struct usb_temp_s ed->bInterval = 1; /* 1 ms */ break; default: - ed->bInterval = 8; /* 8*125 us */ + ed->bInterval = 4; /* 1 ms */ break; } break; Modified: head/sys/dev/usb/template/usb_template_kbd.c ============================================================================== --- head/sys/dev/usb/template/usb_template_kbd.c Tue Dec 6 07:55:25 2011 (r228303) +++ head/sys/dev/usb/template/usb_template_kbd.c Tue Dec 6 08:08:52 2011 (r228304) @@ -89,9 +89,9 @@ static const struct usb_temp_packet_size }; static const struct usb_temp_interval keyboard_intr_interval = { - .bInterval[USB_SPEED_LOW] = 2, /* ms */ - .bInterval[USB_SPEED_FULL] = 2, - .bInterval[USB_SPEED_HIGH] = 2 * 8, + .bInterval[USB_SPEED_LOW] = 2, /* 2 ms */ + .bInterval[USB_SPEED_FULL] = 2, /* 2 ms */ + .bInterval[USB_SPEED_HIGH] = 5, /* 2 ms */ }; /* The following HID descriptor was dumped from a HP keyboard. */ Modified: head/sys/dev/usb/template/usb_template_modem.c ============================================================================== --- head/sys/dev/usb/template/usb_template_modem.c Tue Dec 6 07:55:25 2011 (r228303) +++ head/sys/dev/usb/template/usb_template_modem.c Tue Dec 6 08:08:52 2011 (r228304) @@ -98,9 +98,9 @@ static const struct usb_temp_packet_size }; static const struct usb_temp_interval modem_intr_interval = { - .bInterval[USB_SPEED_LOW] = 10, - .bInterval[USB_SPEED_FULL] = 10, - .bInterval[USB_SPEED_HIGH] = 10 * 8, + .bInterval[USB_SPEED_LOW] = 8, /* 8ms */ + .bInterval[USB_SPEED_FULL] = 8, /* 8ms */ + .bInterval[USB_SPEED_HIGH] = 7, /* 8ms */ }; static const struct usb_temp_endpoint_desc modem_ep_0 = { Modified: head/sys/dev/usb/template/usb_template_mouse.c ============================================================================== --- head/sys/dev/usb/template/usb_template_mouse.c Tue Dec 6 07:55:25 2011 (r228303) +++ head/sys/dev/usb/template/usb_template_mouse.c Tue Dec 6 08:08:52 2011 (r228304) @@ -101,9 +101,9 @@ static const struct usb_temp_packet_size }; static const struct usb_temp_interval mouse_intr_interval = { - .bInterval[USB_SPEED_LOW] = 2, - .bInterval[USB_SPEED_FULL] = 2, - .bInterval[USB_SPEED_HIGH] = 2 * 8, + .bInterval[USB_SPEED_LOW] = 2, /* 2ms */ + .bInterval[USB_SPEED_FULL] = 2, /* 2ms */ + .bInterval[USB_SPEED_HIGH] = 5, /* 2ms */ }; static const struct usb_temp_endpoint_desc mouse_ep_0 = { From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 09:12:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07F4A106566C; Tue, 6 Dec 2011 09:12:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBE368FC0A; Tue, 6 Dec 2011 09:12:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB69CBQf081189; Tue, 6 Dec 2011 09:12:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB69CBcJ081187; Tue, 6 Dec 2011 09:12:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201112060912.pB69CBcJ081187@svn.freebsd.org> From: Alexander Motin Date: Tue, 6 Dec 2011 09:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228305 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 09:12:12 -0000 Author: mav Date: Tue Dec 6 09:12:11 2011 New Revision: 228305 URL: http://svn.freebsd.org/changeset/base/228305 Log: Mention that Cold Presence Detection feature used for hot-plug detection when interface power management is enabled. Modified: head/share/man/man4/ahci.4 Modified: head/share/man/man4/ahci.4 ============================================================================== --- head/share/man/man4/ahci.4 Tue Dec 6 08:08:52 2011 (r228304) +++ head/share/man/man4/ahci.4 Tue Dec 6 09:12:11 2011 (r228305) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2011 +.Dd December 6, 2011 .Dt AHCI 4 .Os .Sh NAME @@ -90,9 +90,9 @@ Some controllers, such as ICH8, do not i Because of artificial entering latency, performance degradation in modes 4 and 5 is much smaller then in modes 2 and 3. .Pp -Note that interface Power Management is not compatible with -device presence detection. -A manual bus reset is needed on device hot-plug. +Note that interface Power Management complicates device presence detection. +A manual bus reset/rescan may be needed after device hot-plug, unless hardware +implements Cold Presence Detection. .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 09:31:20 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F8AB106564A; Tue, 6 Dec 2011 09:31:20 +0000 (UTC) (envelope-from gljennjohn@googlemail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id C8BAA8FC14; Tue, 6 Dec 2011 09:31:19 +0000 (UTC) Received: by eaai12 with SMTP id i12so6830222eaa.13 for ; Tue, 06 Dec 2011 01:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :x-mailer:mime-version:content-type:content-transfer-encoding; bh=rqSzNaDu3EZnkAl5CCOk/JjdL02EdWksO88FXSavH8A=; b=UwLtrrrAvLGA3oT3dyu2ZbD9ebnZVTg+EBr92JFA+yK+coOjxiPMVtk3JOCLCvuvE+ /OOiZP5lgYgXof/lVV5523mNts+HGseyfaHHnyVJhsIwb4IC5xwa9zZF9uEFQwk8KqxP vECfKxlHf+VKRxDIyRyz2KeGMyyrmuGgiNBWA= Received: by 10.213.28.8 with SMTP id k8mr2138518ebc.61.1323162408259; Tue, 06 Dec 2011 01:06:48 -0800 (PST) Received: from ernst.jennejohn.org (p578E3F12.dip.t-dialin.net. [87.142.63.18]) by mx.google.com with ESMTPS id d6sm68844135eec.10.2011.12.06.01.06.46 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Dec 2011 01:06:47 -0800 (PST) Date: Tue, 6 Dec 2011 10:06:44 +0100 From: Gary Jennejohn To: Hans Petter Selasky Message-ID: <20111206100644.6f61eb4c@ernst.jennejohn.org> In-Reply-To: <201112052143.59972.hselasky@c2i.net> References: <201111301811.pAUIBnr6008539@svn.freebsd.org> <201112052143.59972.hselasky@c2i.net> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , Max Khon , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r228158 - in head: . share/mk sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gljennjohn@googlemail.com List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 09:31:20 -0000 On Mon, 5 Dec 2011 21:43:59 +0100 Hans Petter Selasky wrote: > Hi, > > I see regressions when building kernel modules from /usr/ports: > > On Monday 05 December 2011 14:39:56 Robert Huff wrote: > > Hello: > > When trying to update I get: > > > > ===> Building for cuse4bsd-kmod-0.1.21_2 > > make -f > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21/Makefile.lib HAVE_DEBUG=YES all Warning: Object directory not changed > > from original > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21 make -f > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21/Makefile.kmod all "/sys/conf/kmod.mk", line 204: Malformed conditional > > (${MK_CTF} != "no") "/sys/conf/kmod.mk", line 206: if-less endif > > make: fatal errors encountered -- cannot continue > > *** Error code 1 > I encountered this problem yesterday. My quick hack was to put .if defined(MK_CTF) .endif around the offending lines, similar to EXPORT_SYMS. -- Gary Jennejohn From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 11:24:04 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BB791065676; Tue, 6 Dec 2011 11:24:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32ED28FC21; Tue, 6 Dec 2011 11:24:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6BO4aG087536; Tue, 6 Dec 2011 11:24:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6BO4Sc087534; Tue, 6 Dec 2011 11:24:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112061124.pB6BO4Sc087534@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Dec 2011 11:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228306 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 11:24:04 -0000 Author: kib Date: Tue Dec 6 11:24:03 2011 New Revision: 228306 URL: http://svn.freebsd.org/changeset/base/228306 Log: Most users of pipe(2) do not call fstat(2) on the returned pipe descriptors. Optimize for the case, by lazily allocating the pipe inode number at the fstat(2) time. If alloc_unr(9) returns failure, do not fail fstat(2), since uses of inode numbers are even rare then fstat(2), but provide zero inode forever. Note that alloc_unr() failure is unlikely due to total number of pipes in the system limited by the number of file descriptors. Based on the submission by: gianni MFC after: 2 weeks Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Tue Dec 6 09:12:11 2011 (r228305) +++ head/sys/kern/sys_pipe.c Tue Dec 6 11:24:03 2011 (r228306) @@ -569,12 +569,7 @@ pipe_create(pipe, backing) /* If we're not backing this pipe, no need to do anything. */ error = 0; } - if (error == 0) { - pipe->pipe_ino = alloc_unr(pipeino_unr); - if (pipe->pipe_ino == -1) - /* pipeclose will clear allocated kva */ - error = ENOMEM; - } + pipe->pipe_ino = -1; return (error); } @@ -1398,16 +1393,40 @@ pipe_stat(fp, ub, active_cred, td) struct ucred *active_cred; struct thread *td; { - struct pipe *pipe = fp->f_data; + struct pipe *pipe; + int new_unr; #ifdef MAC int error; +#endif + pipe = fp->f_data; PIPE_LOCK(pipe); +#ifdef MAC error = mac_pipe_check_stat(active_cred, pipe->pipe_pair); - PIPE_UNLOCK(pipe); - if (error) + if (error) { + PIPE_UNLOCK(pipe); return (error); + } #endif + /* + * Lazily allocate an inode number for the pipe. Most pipe + * users do not call fstat(2) on the pipe, which means that + * postponing the inode allocation until it is must be + * returned to userland is useful. If alloc_unr failed, + * assign st_ino zero instead of returning an error. + * Special pipe_ino values: + * -1 - not yet initialized; + * 0 - alloc_unr failed, return 0 as st_ino forever. + */ + if (pipe->pipe_ino == (ino_t)-1) { + new_unr = alloc_unr(pipeino_unr); + if (new_unr != -1) + pipe->pipe_ino = new_unr; + else + pipe->pipe_ino = 0; + } + PIPE_UNLOCK(pipe); + bzero(ub, sizeof(*ub)); ub->st_mode = S_IFIFO; ub->st_blksize = PAGE_SIZE; From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 11:28:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 863D4106566B; Tue, 6 Dec 2011 11:28:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75BB08FC18; Tue, 6 Dec 2011 11:28:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6BSH9u087707; Tue, 6 Dec 2011 11:28:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6BSH3t087704; Tue, 6 Dec 2011 11:28:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112061128.pB6BSH3t087704@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Dec 2011 11:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228307 - in head: secure/lib/libcrypto share/mk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 11:28:17 -0000 Author: kib Date: Tue Dec 6 11:28:17 2011 New Revision: 228307 URL: http://svn.freebsd.org/changeset/base/228307 Log: Force linker error when created shared library contains a relocation against text. Provide the override switch to turn off the strict behaviour. Apparently, openssl libcrypto needs it due to assembler code not being PIC. Discussed with: bf MFC after: 2 weeks Modified: head/secure/lib/libcrypto/Makefile head/share/mk/bsd.lib.mk Modified: head/secure/lib/libcrypto/Makefile ============================================================================== --- head/secure/lib/libcrypto/Makefile Tue Dec 6 11:24:03 2011 (r228306) +++ head/secure/lib/libcrypto/Makefile Tue Dec 6 11:28:17 2011 (r228307) @@ -7,6 +7,7 @@ SUBDIR= engines LIB= crypto SHLIB_MAJOR= 6 +ALLOW_SHARED_TEXTREL= NO_LINT= Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Dec 6 11:24:03 2011 (r228306) +++ head/share/mk/bsd.lib.mk Tue Dec 6 11:28:17 2011 (r228307) @@ -167,6 +167,11 @@ SOBJS+= ${OBJS:.o=.So} .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} +SOLINKOPTS= -shared -Wl,-x +.if !defined(ALLOW_SHARED_TEXTREL) +SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel +.endif + .if target(beforelinking) ${SHLIB_NAME}: ${SOBJS} beforelinking .else @@ -178,11 +183,11 @@ ${SHLIB_NAME}: ${SOBJS} @ln -fs ${.TARGET} ${SHLIB_LINK} .endif .if !defined(NM) - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `lorder ${SOBJS} | tsort -q` ${LDADD} .else - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD} .endif From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 12:03:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B25C106566B; Tue, 6 Dec 2011 12:03:02 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4ADBD8FC12; Tue, 6 Dec 2011 12:03:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6C323o088821; Tue, 6 Dec 2011 12:03:02 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6C32vm088819; Tue, 6 Dec 2011 12:03:02 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201112061203.pB6C32vm088819@svn.freebsd.org> From: Hajimu UMEMOTO Date: Tue, 6 Dec 2011 12:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228308 - head/kerberos5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 12:03:02 -0000 Author: ume Date: Tue Dec 6 12:03:01 2011 New Revision: 228308 URL: http://svn.freebsd.org/changeset/base/228308 Log: Don't support OpenLDAP during lib32 build. Modified: head/kerberos5/Makefile.inc Modified: head/kerberos5/Makefile.inc ============================================================================== --- head/kerberos5/Makefile.inc Tue Dec 6 11:28:17 2011 (r228307) +++ head/kerberos5/Makefile.inc Tue Dec 6 12:03:01 2011 (r228308) @@ -6,7 +6,7 @@ KRB5DIR= ${.CURDIR}/../../../crypto/heim CFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR}/../../include -.if defined(WITH_OPENLDAP) +.if defined(WITH_OPENLDAP) && !defined(COMPAT_32BIT) OPENLDAPBASE?= /usr/local LDAPLDADD= -lldap -llber LDAPDPADD= ${LDAPLDADD:C;^-l(.*)$;${OPENLDAPBASE}/lib/lib\1.a;} From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 13:00:03 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BF5C106566C; Tue, 6 Dec 2011 13:00:03 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 491B18FC12; Tue, 6 Dec 2011 13:00:02 +0000 (UTC) Received: by lagv3 with SMTP id v3so1090138lag.13 for ; Tue, 06 Dec 2011 05:00:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=SVsPmA4STmuZJayrSbm2a3jx+qx2eKeeroeRc4MRMUw=; b=qmfs0BL0JTpsHtTSNWsAmDyvutu9wRgKbFAFuqbZyzBjvQdx2UzleydZSTMgRD+8Hc hNrYduJYdt3hYHgYuLMcZp/dAA56ItBlrhi6K+mMfKH2CW8cgb9QdDfhP35M23k/YABX xg8Hl636hcuC7cWoHQgzIj11LpGNiqO1alyGY= Received: by 10.152.111.1 with SMTP id ie1mr9149996lab.7.1323176400289; Tue, 06 Dec 2011 05:00:00 -0800 (PST) Received: from localhost ([78.157.92.5]) by mx.google.com with ESMTPS id mi5sm20934229lab.14.2011.12.06.04.59.59 (version=SSLv3 cipher=OTHER); Tue, 06 Dec 2011 04:59:59 -0800 (PST) Date: Tue, 6 Dec 2011 15:00:02 +0200 From: Gleb Kurtsou To: Hans Petter Selasky Message-ID: <20111206130002.GA1915@reks> References: <201111301811.pAUIBnr6008539@svn.freebsd.org> <201112052143.59972.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201112052143.59972.hselasky@c2i.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "svn-src-head@freebsd.org" , Max Khon , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r228158 - in head: . share/mk sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 13:00:03 -0000 On (05/12/2011 21:43), Hans Petter Selasky wrote: > Hi, > > I see regressions when building kernel modules from /usr/ports: make buildworld && make installworld should fix it > > On Monday 05 December 2011 14:39:56 Robert Huff wrote: > > Hello: > > When trying to update I get: > > > > ===> Building for cuse4bsd-kmod-0.1.21_2 > > make -f > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21/Makefile.lib HAVE_DEBUG=YES all Warning: Object directory not changed > > from original > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21 make -f > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21/Makefile.kmod all "/sys/conf/kmod.mk", line 204: Malformed conditional > > (${MK_CTF} != "no") "/sys/conf/kmod.mk", line 206: if-less endif > > make: fatal errors encountered -- cannot continue > > *** Error code 1 > > > --HPS From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 17:27:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C498E106567A; Tue, 6 Dec 2011 17:27:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 62B948FC08; Tue, 6 Dec 2011 17:27:17 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 16D9746B06; Tue, 6 Dec 2011 12:27:17 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9AEEFB946; Tue, 6 Dec 2011 12:27:16 -0500 (EST) From: John Baldwin To: Ivan Klymenko Date: Tue, 6 Dec 2011 12:24:48 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201112021959.pB2Jxka6006739@svn.freebsd.org> <20111203125142.442e4bf6@nonamehost.> In-Reply-To: <20111203125142.442e4bf6@nonamehost.> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201112061224.48146.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 06 Dec 2011 12:27:16 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228207 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 17:27:17 -0000 On Saturday, December 03, 2011 5:51:42 am Ivan Klymenko wrote: > =D0=92 Fri, 2 Dec 2011 19:59:46 +0000 (UTC) > John Baldwin =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >=20 > > Author: jhb > > Date: Fri Dec 2 19:59:46 2011 > > New Revision: 228207 > > URL: http://svn.freebsd.org/changeset/base/228207 > >=20 > > Log: > > When changing the user priority of a thread, change the real > > priority in addition to the user priority for threads whose current > > real priority is equal to the previous user priority or if the new > > priority is a real-time priority. This allows priority changes of > > other threads to have an immediate effect. > > =20 > Thank you! > It's a little corrected the situation with interactivity with using ULE > scheduler... > But quite a bit... :) Hmm, I would not have expected this to make much of a difference unless you= =20 are explicitly running the 'rtprio' command. =2D-=20 John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 18:01:09 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9203106566C; Tue, 6 Dec 2011 18:01:09 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A97198FC08; Tue, 6 Dec 2011 18:01:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6I19Aj002345; Tue, 6 Dec 2011 18:01:09 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6I19dU002343; Tue, 6 Dec 2011 18:01:09 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201112061801.pB6I19dU002343@svn.freebsd.org> From: Max Khon Date: Tue, 6 Dec 2011 18:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228311 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 18:01:09 -0000 Author: fjoe Date: Tue Dec 6 18:01:09 2011 New Revision: 228311 URL: http://svn.freebsd.org/changeset/base/228311 Log: MK_CTF is not defined when kmod.mk is used with old bsd.own.mk. Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Tue Dec 6 17:54:59 2011 (r228310) +++ head/sys/conf/kmod.mk Tue Dec 6 18:01:09 2011 (r228311) @@ -201,7 +201,7 @@ ${KMOD}.kld: ${OBJS} ${FULLPROG}: ${OBJS} .endif ${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS} -.if ${MK_CTF} != "no" +.if defined(MK_CTF) && ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} .endif .if defined(EXPORT_SYMS) From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 18:01:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82E201065679; Tue, 6 Dec 2011 18:01:53 +0000 (UTC) (envelope-from fjoe@samodelkin.net) Received: from mail-qw0-f47.google.com (mail-qw0-f47.google.com [209.85.216.47]) by mx1.freebsd.org (Postfix) with ESMTP id 194108FC0A; Tue, 6 Dec 2011 18:01:52 +0000 (UTC) Received: by qadb17 with SMTP id b17so3059325qad.13 for ; Tue, 06 Dec 2011 10:01:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.88.99 with SMTP id bf3mr2870738obb.73.1323194511398; Tue, 06 Dec 2011 10:01:51 -0800 (PST) Sender: fjoe@samodelkin.net Received: by 10.182.76.225 with HTTP; Tue, 6 Dec 2011 10:01:51 -0800 (PST) X-Originating-IP: [80.89.199.122] In-Reply-To: <20111206100644.6f61eb4c@ernst.jennejohn.org> References: <201111301811.pAUIBnr6008539@svn.freebsd.org> <201112052143.59972.hselasky@c2i.net> <20111206100644.6f61eb4c@ernst.jennejohn.org> Date: Wed, 7 Dec 2011 00:01:51 +0600 X-Google-Sender-Auth: cqCRpZh4GT29_iRnoKOfI4jEyqU Message-ID: From: Max Khon To: gljennjohn@googlemail.com Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Hans Petter Selasky Subject: Re: svn commit: r228158 - in head: . share/mk sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 18:01:53 -0000 Gary, Hans, On Tue, Dec 6, 2011 at 4:06 PM, Gary Jennejohn wrote: > I see regressions when building kernel modules from /usr/ports: > > > > On Monday 05 December 2011 14:39:56 Robert Huff wrote: > > > Hello: > > > When trying to update I get: > > > > > > ===> Building for cuse4bsd-kmod-0.1.21_2 > > > make -f > > > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > > 21/Makefile.lib HAVE_DEBUG=YES all Warning: Object directory not > changed > > > from original > > > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > > 21 make -f > > > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > > 21/Makefile.kmod all "/sys/conf/kmod.mk", line 204: Malformed > conditional > > > (${MK_CTF} != "no") "/sys/conf/kmod.mk", line 206: if-less endif > > > make: fatal errors encountered -- cannot continue > > > *** Error code 1 > > > > I encountered this problem yesterday. My quick hack was to put > .if defined(MK_CTF) .endif around the offending lines, similar to > EXPORT_SYMS. > This should be fixed now (rev. 228311) Max From owner-svn-src-head@FreeBSD.ORG Tue Dec 6 20:55:20 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 813C8106564A; Tue, 6 Dec 2011 20:55:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 579158FC13; Tue, 6 Dec 2011 20:55:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6KtKiK007949; Tue, 6 Dec 2011 20:55:20 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6KtKlX007947; Tue, 6 Dec 2011 20:55:20 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112062055.pB6KtKlX007947@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 6 Dec 2011 20:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228313 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 20:55:20 -0000 Author: glebius Date: Tue Dec 6 20:55:20 2011 New Revision: 228313 URL: http://svn.freebsd.org/changeset/base/228313 Log: Fix a very special case when SIOCAIFADDR supplies mask of 0.0.0.0, don't overwrite the mask with autoguessing based on classes. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Dec 6 19:04:45 2011 (r228312) +++ head/sys/netinet/in.c Tue Dec 6 20:55:20 2011 (r228313) @@ -73,7 +73,7 @@ static int in_addprefix(struct in_ifaddr static int in_scrubprefix(struct in_ifaddr *, u_int); static void in_socktrim(struct sockaddr_in *); static int in_ifinit(struct ifnet *, - struct in_ifaddr *, struct sockaddr_in *, int); + struct in_ifaddr *, struct sockaddr_in *, int, int); static void in_purgemaddrs(struct ifnet *); static VNET_DEFINE(int, sameprefixcarponly); @@ -517,7 +517,7 @@ in_control(struct socket *so, u_long cmd case SIOCSIFADDR: error = in_ifinit(ifp, ia, - (struct sockaddr_in *) &ifr->ifr_addr, 1); + (struct sockaddr_in *) &ifr->ifr_addr, 1, 0); if (error != 0 && iaIsNew) break; if (error == 0) { @@ -569,7 +569,8 @@ in_control(struct socket *so, u_long cmd maskIsNew = 1; /* We lie; but the effect's the same */ } if (hostIsNew || maskIsNew) - error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0); + error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0, + maskIsNew); if (error != 0 && iaIsNew) break; @@ -842,7 +843,7 @@ in_ifscrub(struct ifnet *ifp, struct in_ */ static int in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin, - int scrub) + int scrub, int masksupplied) { register u_long i = ntohl(sin->sin_addr.s_addr); int flags = RTF_UP, error = 0; @@ -872,7 +873,7 @@ in_ifinit(struct ifnet *ifp, struct in_i * Be compatible with network classes, if netmask isn't supplied, * guess it based on classes. */ - if (ia->ia_subnetmask == 0) { + if (!masksupplied) { if (IN_CLASSA(i)) ia->ia_subnetmask = IN_CLASSA_NET; else if (IN_CLASSB(i)) From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 07:03:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7401106564A; Wed, 7 Dec 2011 07:03:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A73F48FC14; Wed, 7 Dec 2011 07:03:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB773EW4026851; Wed, 7 Dec 2011 07:03:14 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB773EWl026849; Wed, 7 Dec 2011 07:03:14 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112070703.pB773EWl026849@svn.freebsd.org> From: Alan Cox Date: Wed, 7 Dec 2011 07:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228317 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 07:03:14 -0000 Author: alc Date: Wed Dec 7 07:03:14 2011 New Revision: 228317 URL: http://svn.freebsd.org/changeset/base/228317 Log: Eliminate the possibility of 32-bit arithmetic overflow in the calculation of vm_kmem_size that may occur if the system administrator has specified a vm.vm_kmem_size tunable value that exceeds the hard cap. PR: 162741 Submitted by: Adam McDougall Reviewed by: bde@ MFC after: 3 weeks Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Dec 7 00:22:34 2011 (r228316) +++ head/sys/kern/kern_malloc.c Wed Dec 7 07:03:14 2011 (r228317) @@ -740,11 +740,11 @@ kmeminit(void *dummy) /* * Limit kmem virtual size to twice the physical memory. * This allows for kmem map sparseness, but limits the size - * to something sane. Be careful to not overflow the 32bit - * ints while doing the check. + * to something sane. Be careful to not overflow the 32bit + * ints while doing the check or the adjustment. */ - if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count) - vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE; + if (vm_kmem_size / 2 / PAGE_SIZE > mem_size) + vm_kmem_size = 2 * mem_size * PAGE_SIZE; #ifdef DEBUG_MEMGUARD tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 11:06:19 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44A7A106564A; Wed, 7 Dec 2011 11:06:19 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDFC58FC08; Wed, 7 Dec 2011 11:06:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7B6IJU036781; Wed, 7 Dec 2011 11:06:18 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7B6Iot036779; Wed, 7 Dec 2011 11:06:18 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112071106.pB7B6Iot036779@svn.freebsd.org> From: Ruslan Ermilov Date: Wed, 7 Dec 2011 11:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228318 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 11:06:19 -0000 Author: ru Date: Wed Dec 7 11:06:18 2011 New Revision: 228318 URL: http://svn.freebsd.org/changeset/base/228318 Log: The NOTE_COPY should have been named NOTE_FFCOPY from the very beginning. Submitted by: Igor Sysoev Modified: head/lib/libc/sys/kqueue.2 Modified: head/lib/libc/sys/kqueue.2 ============================================================================== --- head/lib/libc/sys/kqueue.2 Wed Dec 7 07:03:14 2011 (r228317) +++ head/lib/libc/sys/kqueue.2 Wed Dec 7 11:06:18 2011 (r228318) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2009 +.Dd December 7, 2011 .Dt KQUEUE 2 .Os .Sh NAME @@ -459,7 +459,7 @@ Bitwise AND .It Dv NOTE_FFOR Bitwise OR .Va fflags . -.It Dv NOTE_COPY +.It Dv NOTE_FFCOPY Copy .Va fflags . .It Dv NOTE_FFCTRLMASK From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 12:25:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39FCA106566B; Wed, 7 Dec 2011 12:25:29 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 105CC8FC0C; Wed, 7 Dec 2011 12:25:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7CPSxt039284; Wed, 7 Dec 2011 12:25:28 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7CPS1D039280; Wed, 7 Dec 2011 12:25:28 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201112071225.pB7CPS1D039280@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 7 Dec 2011 12:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228319 - head/usr.bin/grep X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 12:25:29 -0000 Author: gabor Date: Wed Dec 7 12:25:28 2011 New Revision: 228319 URL: http://svn.freebsd.org/changeset/base/228319 Log: - Match GNU behavior of exit code - Rename variable that has a different meaning now PR: bin/162930 Submitted by: Jan Beich MFC after: 1 week Modified: head/usr.bin/grep/grep.c head/usr.bin/grep/grep.h head/usr.bin/grep/util.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Wed Dec 7 11:06:18 2011 (r228318) +++ head/usr.bin/grep/grep.c Wed Dec 7 12:25:28 2011 (r228319) @@ -148,7 +148,7 @@ static inline const char *init_color(con bool first = true; /* flag whether we are processing the first match */ bool prev; /* flag whether or not the previous line matched */ int tail; /* lines left to print */ -bool notfound; /* file not found */ +bool file_err; /* file reading error */ /* * Prints usage information and returns 2. @@ -728,5 +728,5 @@ main(int argc, char *argv[]) /* Find out the correct return value according to the results and the command line option. */ - exit(c ? (notfound ? (qflag ? 0 : 2) : 0) : (notfound ? 2 : 1)); + exit(c ? (file_err ? (qflag ? 0 : 2) : 0) : (file_err ? 2 : 1)); } Modified: head/usr.bin/grep/grep.h ============================================================================== --- head/usr.bin/grep/grep.h Wed Dec 7 11:06:18 2011 (r228318) +++ head/usr.bin/grep/grep.h Wed Dec 7 12:25:28 2011 (r228319) @@ -119,7 +119,7 @@ extern char *label; extern const char *color; extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave; -extern bool first, matchall, notfound, prev; +extern bool file_err, first, matchall, prev; extern int tail; extern unsigned int dpatterns, fpatterns, patterns; extern struct pat *pattern; Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Wed Dec 7 11:06:18 2011 (r228318) +++ head/usr.bin/grep/util.c Wed Dec 7 12:25:28 2011 (r228319) @@ -130,7 +130,7 @@ grep_tree(char **argv) case FTS_DNR: /* FALLTHROUGH */ case FTS_ERR: - notfound = true; + file_err = true; if(!sflag) warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); break; @@ -195,10 +195,9 @@ procfile(const char *fn) f = grep_open(fn); } if (f == NULL) { + file_err = true; if (!sflag) warn("%s", fn); - if (errno == ENOENT) - notfound = true; return (0); } From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 13:37:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39D07106564A; Wed, 7 Dec 2011 13:37:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29A2A8FC0C; Wed, 7 Dec 2011 13:37:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7DbhTm041523; Wed, 7 Dec 2011 13:37:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7Dbhqv041521; Wed, 7 Dec 2011 13:37:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112071337.pB7Dbhqv041521@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 7 Dec 2011 13:37:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228321 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 13:37:43 -0000 Author: glebius Date: Wed Dec 7 13:37:42 2011 New Revision: 228321 URL: http://svn.freebsd.org/changeset/base/228321 Log: Fix double free. PR: kern/163089 Submitted by: Herbie Robinson Modified: head/sys/netinet6/mld6.c Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Wed Dec 7 12:48:11 2011 (r228320) +++ head/sys/netinet6/mld6.c Wed Dec 7 13:37:42 2011 (r228321) @@ -3090,7 +3090,6 @@ mld_dispatch_packet(struct mbuf *m) m0 = mld_v2_encap_report(ifp, m); if (m0 == NULL) { CTR2(KTR_MLD, "%s: dropped %p", __func__, m); - m_freem(m); IP6STAT_INC(ip6s_odropped); goto out; } From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 15:25:49 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45663106564A; Wed, 7 Dec 2011 15:25:49 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32DFC8FC16; Wed, 7 Dec 2011 15:25:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7FPnAX044906; Wed, 7 Dec 2011 15:25:49 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7FPmkH044896; Wed, 7 Dec 2011 15:25:48 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112071525.pB7FPmkH044896@svn.freebsd.org> From: David Chisnall Date: Wed, 7 Dec 2011 15:25:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 15:25:49 -0000 Author: theraven Date: Wed Dec 7 15:25:48 2011 New Revision: 228322 URL: http://svn.freebsd.org/changeset/base/228322 Log: Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a __noreturn macro and modify the other exiting functions to use it. The __noreturn macro, unlike __dead2, must be used BEFORE the function. This is in line with the C and C++ specifications that place _Noreturn (c1x) and [[noreturn]] (C++11) in front of the functions. As with __dead2, this macro falls back to using the GCC attribute. Unfortunately, clang currently sets the same value for the C version macro in C99 and C1x modes, so these functions are hidden by default. At some point before 10.0, I need to go through the headers and clean up the C1x / C++11 visibility. Reviewed by: brooks (mentor) Added: head/lib/libc/stdlib/at_quick_exit.3 (contents, props changed) head/lib/libc/stdlib/quick_exit.3 (contents, props changed) head/lib/libc/stdlib/quick_exit.c (contents, props changed) Modified: head/include/stdlib.h head/lib/libc/stdlib/Makefile.inc head/lib/libc/stdlib/Symbol.map head/lib/libc/stdlib/atexit.3 head/lib/libc/stdlib/exit.3 head/sys/sys/cdefs.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Wed Dec 7 13:37:42 2011 (r228321) +++ head/include/stdlib.h Wed Dec 7 15:25:48 2011 (r228322) @@ -76,7 +76,7 @@ extern int __mb_cur_max; extern int ___mb_cur_max(void); #define MB_CUR_MAX (___mb_cur_max()) -void abort(void) __dead2; +__noreturn void abort(void); int abs(int) __pure2; int atexit(void (*)(void)); double atof(const char *); @@ -86,7 +86,7 @@ void *bsearch(const void *, const void * size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t) __malloc_like; div_t div(int, int) __pure2; -void exit(int) __dead2; +__noreturn void exit(int); void free(void *); char *getenv(const char *); long labs(long) __pure2; @@ -145,10 +145,18 @@ unsigned long long strtoull(const char * __restrict, char ** __restrict, int); #endif /* __LONG_LONG_SUPPORTED */ -void _Exit(int) __dead2; +__noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ /* + * If we're in a mode greater than C99, expose C1x functions. + */ +#if __ISO_C_VISIBLE > 1999 +__noreturn void quick_exit(int) +int +at_quick_exit(void (*func)(void)); +#endif /* __ISO_C_VISIBLE > 1999 */ +/* * Extensions made by POSIX relative to C. We don't know yet which edition * of POSIX made these extensions, so assume they've always been there until * research can be done. Modified: head/lib/libc/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/Makefile.inc Wed Dec 7 13:37:42 2011 (r228321) +++ head/lib/libc/stdlib/Makefile.inc Wed Dec 7 15:25:48 2011 (r228322) @@ -8,8 +8,8 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \ getsubopt.c hcreate.c heapsort.c imaxabs.c imaxdiv.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c malloc.c \ - merge.c ptsname.c qsort.c qsort_r.c radixsort.c rand.c random.c \ - reallocf.c realpath.c remque.c strfmon.c strtoimax.c \ + merge.c ptsname.c qsort.c qsort_r.c quick_exit.c radixsort.c rand.c \ + random.c reallocf.c realpath.c remque.c strfmon.c strtoimax.c \ strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c @@ -18,10 +18,12 @@ SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map # machine-dependent stdlib sources .sinclude "${.CURDIR}/${LIBC_ARCH}/stdlib/Makefile.inc" -MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \ +MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 \ + at_quick_exit.3 bsearch.3 \ div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \ hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \ lsearch.3 malloc.3 memory.3 posix_memalign.3 ptsname.3 qsort.3 \ + quick_exit.3 \ radixsort.3 rand.3 random.3 \ realpath.3 strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \ tsearch.3 Modified: head/lib/libc/stdlib/Symbol.map ============================================================================== --- head/lib/libc/stdlib/Symbol.map Wed Dec 7 13:37:42 2011 (r228321) +++ head/lib/libc/stdlib/Symbol.map Wed Dec 7 15:25:48 2011 (r228322) @@ -97,6 +97,8 @@ FBSD_1.3 { atoi_l; atol_l; atoll_l; + at_quick_exit; + quick_exit; strtod_l; strtol_l; strtoll_l; Added: head/lib/libc/stdlib/at_quick_exit.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/at_quick_exit.3 Wed Dec 7 15:25:48 2011 (r228322) @@ -0,0 +1,58 @@ +.\" Copyright (c) 2011 David Chisnall +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" / +.Dd December 7, 2011o.Dt ATEXIT 3 +.Dt AT_QUICK_EXIT 3 +.Os +.Sh NAME +.Nm at_quick_exit +.Nd Registers a cleanup function to run on quick exit. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdlib.h +.Ft int +.Fn at_quick_exit "void (*func)(void)" +.Sh DESCRIPTION +The +.Fn at_quick_exit +function registers a cleanup function to be called when the program exits as a +result of calling +.Xr quick_exit 3 . +The cleanup functions are called in the reverse order and will not be called if +the program exits by calling +.Xr exit 3 , +.Xr _Exit 3 , +or +.Xr abort 3 . +.El +.Sh SEE ALSO +.Xr exit 3 , +.Xr at_quick_exit 3 +.Sh STANDARDS +The +.Fn at_quick_exit +function conforms to the C1x draft specification. Modified: head/lib/libc/stdlib/atexit.3 ============================================================================== --- head/lib/libc/stdlib/atexit.3 Wed Dec 7 13:37:42 2011 (r228321) +++ head/lib/libc/stdlib/atexit.3 Wed Dec 7 15:25:48 2011 (r228322) @@ -79,6 +79,7 @@ No memory was available to add the funct The existing list of functions is unmodified. .El .Sh SEE ALSO +.Xr at_quick_exit 3 .Xr exit 3 .Sh STANDARDS The Modified: head/lib/libc/stdlib/exit.3 ============================================================================== --- head/lib/libc/stdlib/exit.3 Wed Dec 7 13:37:42 2011 (r228321) +++ head/lib/libc/stdlib/exit.3 Wed Dec 7 15:25:48 2011 (r228322) @@ -118,7 +118,9 @@ never return. .Xr _exit 2 , .Xr wait 2 , .Xr atexit 3 , +.Xr at_quick_exit 3 , .Xr intro 3 , +.Xr quick_exit 3 , .Xr sysexits 3 , .Xr tmpfile 3 .Sh STANDARDS Added: head/lib/libc/stdlib/quick_exit.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/quick_exit.3 Wed Dec 7 15:25:48 2011 (r228322) @@ -0,0 +1,55 @@ +.\" Copyright (c) 2011 David Chisnall +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" / +.Dd December 7, 2011o.Dt ATEXIT 3 +.Dt QUICK_EXIT 3 +.Os +.Sh NAME +.Nm quick_exit +.Nd Exits a program quickly, running minimal cleanup +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdlib.h +.Ft _Noreturn void +.Fn quick_exit "void" +.Sh DESCRIPTION +The +.Fn quick_exit +function exits the program quickly calling any cleanup functions registered +with +.Xr at_quick_exit 3 +but not any C++ destructors or cleanup code registered with +.Xr atexit 3 . +.El +.Sh SEE ALSO +.Xr exit 3 , +.Xr at_quick_exit 3 +.Sh STANDARDS +The +.Fn quick_exit +function conforms to the C1x draft specification. + Added: head/lib/libc/stdlib/quick_exit.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/quick_exit.c Wed Dec 7 15:25:48 2011 (r228322) @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 2011 David Chisnall + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +/** + * Linked list of quick exit handlers. This is simpler than the atexit() + * version, because it is not required to support C++ destructors or + * DSO-specific cleanups. + */ +struct quick_exit_handler { + struct quick_exit_handler *next; + void (*cleanup)(void); +}; + +__attribute((weak)) +void _ZSt9terminatev(void); + +/** + * Lock protecting the handlers list. + */ +static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER; +/** + * Stack of cleanup handlers. These will be invoked in reverse order when + */ +static struct quick_exit_handler *handlers; + +int +at_quick_exit(void (*func)(void)) +{ + struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler)); + + if (0 == h) { + return 1; + } + h->cleanup = func; + pthread_mutex_lock(&atexit_mutex); + h->next = handlers; + handlers = h; + pthread_mutex_unlock(&atexit_mutex); + return 0; +} + +void quick_exit(int status) +{ + /* + * XXX: The C++ spec requires us to call std::terminate if there is an + * exception here. + */ + for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h->next) + { + h->cleanup(); + } + _Exit(status); +} Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Wed Dec 7 13:37:42 2011 (r228321) +++ head/sys/sys/cdefs.h Wed Dec 7 15:25:48 2011 (r228322) @@ -218,6 +218,17 @@ #endif #endif + +#if defined(__cplusplus) && __cplusplus >= 201103L +#define __noreturn [[noreturn]] +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L +#define __noreturn _Noreturn +#elif defined(__GNUC__) +#define __noreturn __attribute__((__noreturn__)) +#else +#define __noreturn +#endif + #if __GNUC_PREREQ__(2, 96) #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 15:53:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB56A1065670; Wed, 7 Dec 2011 15:53:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 84AF78FC0A; Wed, 7 Dec 2011 15:53:14 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pB7FrA5R028188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 7 Dec 2011 17:53:10 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pB7FrA7A011466; Wed, 7 Dec 2011 17:53:10 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pB7Fr9Bm011465; Wed, 7 Dec 2011 17:53:09 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 7 Dec 2011 17:53:09 +0200 From: Kostik Belousov To: David Chisnall , brooks@freebsd.org Message-ID: <20111207155309.GH50300@deviant.kiev.zoral.com.ua> References: <201112071525.pB7FPmkH044896@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5qk+VjjGZp9A4i1j" Content-Disposition: inline In-Reply-To: <201112071525.pB7FPmkH044896@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 15:53:15 -0000 --5qk+VjjGZp9A4i1j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 07, 2011 at 03:25:48PM +0000, David Chisnall wrote: > Author: theraven > Date: Wed Dec 7 15:25:48 2011 > New Revision: 228322 > URL: http://svn.freebsd.org/changeset/base/228322 >=20 > Log: > Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a > __noreturn macro and modify the other exiting functions to use it. > =20 > The __noreturn macro, unlike __dead2, must be used BEFORE the function. > This is in line with the C and C++ specifications that place _Noreturn = (c1x) > and [[noreturn]] (C++11) in front of the functions. As with __dead2, t= his > macro falls back to using the GCC attribute. > =20 > Unfortunately, clang currently sets the same value for the C version ma= cro > in C99 and C1x modes, so these functions are hidden by default. At some > point before 10.0, I need to go through the headers and clean up the C1= x / > C++11 visibility. > =20 > Reviewed by: brooks (mentor) And, was it approved ? > +#include > +#include > + > +/** > + * Linked list of quick exit handlers. This is simpler than the atexit() > + * version, because it is not required to support C++ destructors or > + * DSO-specific cleanups. > + */ > +struct quick_exit_handler { > + struct quick_exit_handler *next; > + void (*cleanup)(void); > +}; > + > +__attribute((weak)) > +void _ZSt9terminatev(void); Why do you need this ? You are not calling terminate() anyway, and added an explicit comment. > + > +/** > + * Lock protecting the handlers list. > + */ > +static pthread_mutex_t atexit_mutex =3D PTHREAD_MUTEX_INITIALIZER; > +/** > + * Stack of cleanup handlers. These will be invoked in reverse order wh= en=20 > + */ > +static struct quick_exit_handler *handlers; > + > +int > +at_quick_exit(void (*func)(void)) > +{ > + struct quick_exit_handler *h =3D malloc(sizeof(struct quick_exit_handle= r)); You are making initialization at the declaration place, which is not recommended by style. > + > + if (0 =3D=3D h) { Why 0 and not NULL ? Later, you use NULL. The {} are not needed. > + return 1; This shall be return (1); > + } > + h->cleanup =3D func; > + pthread_mutex_lock(&atexit_mutex); Note that libc code is careful to only call pthread mutex functions if __isthreaded variable is set. Also note that libc uses mangled names to allow the application interpositi= on of the functions. E.g. ANSI C code is allowed to have pthread_mutex_lock() function defined. > + h->next =3D handlers; > + handlers =3D h; > + pthread_mutex_unlock(&atexit_mutex); > + return 0; And this shall be return (0); > +} > + > +void quick_exit(int status) The function name shall start at the column 0. > +{ > + /* > + * XXX: The C++ spec requires us to call std::terminate if there is an > + * exception here. > + */ > + for (struct quick_exit_handler *h =3D handlers ; NULL !=3D h ; h =3D h-= >next) This fragment violates so many style requirements that I probably fail to enumerate them all. The h declaration shall go at the start of function, and not at the for statement. The opening '{' shall be placed on the line of 'for'. More, the {} bracing is not needed there. No space is needed before ';', three times. > + { > + h->cleanup(); > + } > + _Exit(status); > +} --5qk+VjjGZp9A4i1j Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7fi+UACgkQC3+MBN1Mb4gx/gCg7LO58prTbsavYzvPC6I1zPaO szsAnR0Bk2AII9fhoa30RsMP3oEgbrXr =qn2t -----END PGP SIGNATURE----- --5qk+VjjGZp9A4i1j-- From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 16:03:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23C2B106566B; Wed, 7 Dec 2011 16:03:33 +0000 (UTC) (envelope-from stefan@fafoe.narf.at) Received: from fep20.mx.upcmail.net (fep20.mx.upcmail.net [62.179.121.40]) by mx1.freebsd.org (Postfix) with ESMTP id E1AE58FC19; Wed, 7 Dec 2011 16:03:31 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep20-int.chello.at (InterMail vM.8.01.05.04 201-2260-151-105-20111014) with ESMTP id <20111207160330.NBGI11861.viefep20-int.chello.at@edge04.upcmail.net>; Wed, 7 Dec 2011 17:03:30 +0100 Received: from mole.fafoe.narf.at ([213.47.85.26]) by edge04.upcmail.net with edge id 6G301i00s0a5KZh04G30PU; Wed, 07 Dec 2011 17:03:30 +0100 X-SourceIP: 213.47.85.26 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id 4861B6D432; Wed, 7 Dec 2011 17:03:00 +0100 (CET) Date: Wed, 7 Dec 2011 17:03:00 +0100 From: Stefan Farfeleder To: David Chisnall Message-ID: <20111207160259.GA1622@mole.fafoe.narf.at> References: <201112071525.pB7FPmkH044896@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112071525.pB7FPmkH044896@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 16:03:33 -0000 On Wed, Dec 07, 2011 at 03:25:48PM +0000, David Chisnall wrote: > > /* > + * If we're in a mode greater than C99, expose C1x functions. > + */ > +#if __ISO_C_VISIBLE > 1999 > +__noreturn void quick_exit(int) > +int > +at_quick_exit(void (*func)(void)); > +#endif /* __ISO_C_VISIBLE > 1999 */ > +/* > * Extensions made by POSIX relative to C. We don't know yet which edition Shouldn't it be visible in the default mode too (__BSD_VISIBLE)? From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 16:12:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9742C1065675; Wed, 7 Dec 2011 16:12:54 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 874BF8FC0C; Wed, 7 Dec 2011 16:12:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7GCs6E046454; Wed, 7 Dec 2011 16:12:54 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7GCsjN046451; Wed, 7 Dec 2011 16:12:54 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112071612.pB7GCsjN046451@svn.freebsd.org> From: David Chisnall Date: Wed, 7 Dec 2011 16:12:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228323 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 16:12:54 -0000 Author: theraven Date: Wed Dec 7 16:12:54 2011 New Revision: 228323 URL: http://svn.freebsd.org/changeset/base/228323 Log: style(9) cleanups. Approved by: brooks (mentor) Modified: head/lib/libc/stdlib/quick_exit.c Modified: head/lib/libc/stdlib/quick_exit.c ============================================================================== --- head/lib/libc/stdlib/quick_exit.c Wed Dec 7 15:25:48 2011 (r228322) +++ head/lib/libc/stdlib/quick_exit.c Wed Dec 7 16:12:54 2011 (r228323) @@ -39,9 +39,6 @@ struct quick_exit_handler { void (*cleanup)(void); }; -__attribute((weak)) -void _ZSt9terminatev(void); - /** * Lock protecting the handlers list. */ @@ -56,26 +53,26 @@ at_quick_exit(void (*func)(void)) { struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler)); - if (0 == h) { + if (NULL == h) return 1; - } h->cleanup = func; pthread_mutex_lock(&atexit_mutex); h->next = handlers; handlers = h; pthread_mutex_unlock(&atexit_mutex); - return 0; + return (0); } -void quick_exit(int status) +void +quick_exit(int status) { + struct quick_exit_handler *h; + /* * XXX: The C++ spec requires us to call std::terminate if there is an * exception here. */ - for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h->next) - { + for (h = handlers; NULL != h; h = h->next) h->cleanup(); - } _Exit(status); } From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 16:27:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86A67106567A; Wed, 7 Dec 2011 16:27:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76B828FC18; Wed, 7 Dec 2011 16:27:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7GROTp046914; Wed, 7 Dec 2011 16:27:24 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7GRORQ046912; Wed, 7 Dec 2011 16:27:24 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112071627.pB7GRORQ046912@svn.freebsd.org> From: Alan Cox Date: Wed, 7 Dec 2011 16:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228324 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 16:27:24 -0000 Author: alc Date: Wed Dec 7 16:27:23 2011 New Revision: 228324 URL: http://svn.freebsd.org/changeset/base/228324 Log: Eliminate stale numbers from a comment. Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Dec 7 16:12:54 2011 (r228323) +++ head/sys/kern/kern_malloc.c Wed Dec 7 16:27:23 2011 (r228324) @@ -698,12 +698,9 @@ kmeminit(void *dummy) /* * Try to auto-tune the kernel memory size, so that it is - * more applicable for a wider range of machine sizes. - * On an X86, a VM_KMEM_SIZE_SCALE value of 4 is good, while - * a VM_KMEM_SIZE of 12MB is a fair compromise. The + * more applicable for a wider range of machine sizes. The * VM_KMEM_SIZE_MAX is dependent on the maximum KVA space - * available, and on an X86 with a total KVA space of 256MB, - * try to keep VM_KMEM_SIZE_MAX at 80MB or below. + * available. * * Note that the kmem_map is also used by the zone allocator, * so make sure that there is enough space. From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 17:30:29 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2915F106567B; Wed, 7 Dec 2011 17:30:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id B7ADC8FC14; Wed, 7 Dec 2011 17:30:28 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pB7HUQAj022580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Dec 2011 04:30:27 +1100 Date: Thu, 8 Dec 2011 04:30:26 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kostik Belousov In-Reply-To: <20111207155309.GH50300@deviant.kiev.zoral.com.ua> Message-ID: <20111208041138.Q2451@besplex.bde.org> References: <201112071525.pB7FPmkH044896@svn.freebsd.org> <20111207155309.GH50300@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, brooks@FreeBSD.org, David Chisnall , src-committers@FreeBSD.org Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 17:30:29 -0000 On Wed, 7 Dec 2011, Kostik Belousov wrote: > On Wed, Dec 07, 2011 at 03:25:48PM +0000, David Chisnall wrote: >> Log: >> Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a >> __noreturn macro and modify the other exiting functions to use it. >> ... >> +struct quick_exit_handler { >> + struct quick_exit_handler *next; >> + void (*cleanup)(void); >> +}; >> + >> +__attribute((weak)) >> +void _ZSt9terminatev(void); >> ... >> +{ >> + /* >> + * XXX: The C++ spec requires us to call std::terminate if there is an >> + * exception here. >> + */ >> + for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h->next) > This fragment violates so many style requirements that I probably fail > to enumerate them all. > ... :-). And you didn't point the style violations in the __attribute(()) declaration above. These include - a hard-coded gccism - formatting of part of the declaration on a separate line - spelling __attribute__(()) unusually. I'm not sure what the weak attribute does by itself. only defines __weak_reference() and does it less unportably without using __attribute__(). > The h declaration shall go at the start of function, and not at the for > statement. The style rules may be different for C++. It is hard to know what they are since we don't have any. This declaration wouldn't even compile in C90, and style(9) barely supports that since it is based on K&R C. The declaration compiles in C99, but unnecessary use of C99 features is a style bug (because style(9) gives no examples of it). > ... Bruce From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 17:37:27 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41D261065672; Wed, 7 Dec 2011 17:37:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id BAB8C8FC12; Wed, 7 Dec 2011 17:37:26 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pB7HbOOl026013 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Dec 2011 04:37:25 +1100 Date: Thu, 8 Dec 2011 04:37:24 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Chisnall In-Reply-To: <201112071612.pB7GCsjN046451@svn.freebsd.org> Message-ID: <20111208043100.M2451@besplex.bde.org> References: <201112071612.pB7GCsjN046451@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228323 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 17:37:27 -0000 On Wed, 7 Dec 2011, David Chisnall wrote: > Log: > style(9) cleanups. Thanks, but many style bugs are still visible. > Modified: head/lib/libc/stdlib/quick_exit.c > ============================================================================== > --- head/lib/libc/stdlib/quick_exit.c Wed Dec 7 15:25:48 2011 (r228322) > +++ head/lib/libc/stdlib/quick_exit.c Wed Dec 7 16:12:54 2011 (r228323) > ... > @@ -56,26 +53,26 @@ at_quick_exit(void (*func)(void)) > { > struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler)); This still has: - initialization in declaration - line too long - sizeof(typename) instead of sizeof(var). Maybe this is only a style bug for me, but for long typename's the verboseness given by sizeof(typename) helps implement the previous bug. > > - if (0 == h) { > + if (NULL == h) (h == NULL) would be normal. > return 1; This return is still missing parentheses. > - } > h->cleanup = func; > pthread_mutex_lock(&atexit_mutex); > h->next = handlers; > handlers = h; > pthread_mutex_unlock(&atexit_mutex); > - return 0; > + return (0); The one is fixed, so now the style for returns in this file is internally inconsistent. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 18:17:09 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EF741065672; Wed, 7 Dec 2011 18:17:09 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CEC38FC12; Wed, 7 Dec 2011 18:17:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7IH9hO050216; Wed, 7 Dec 2011 18:17:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7IH9e4050213; Wed, 7 Dec 2011 18:17:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112071817.pB7IH9e4050213@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 18:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228325 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 18:17:09 -0000 Author: yongari Date: Wed Dec 7 18:17:09 2011 New Revision: 228325 URL: http://svn.freebsd.org/changeset/base/228325 Log: Overhaul bus_dma(9) usage in et(4) and clean up TX/RX path. This change should make et(4) work on any architectures. o Remove m_getl inline function and replace it with stanard mbuf interfaces. Previous code tried to minimize code duplication but this came from incorrect use of common DMA tag. Driver may be still use a common RX allocation handler with additional structure changes but I don't see much point to do that it would make it hard to understand the code. o Remove DragonflyBSD specific constant EVL_ENCAPLEN, use ETHER_VLAN_ENCAP_LEN instead. o Add bunch of new RX status definition. It seems controller supports RX checksum offloading but I was not able to make the feature work yet. Currently driver checks whether recevied frame is good one or not. o Avoid a typedef ending in '_t' as style(9) says. o Controller has no restriction on DMA address space, so there is no reason to limit the DMA address to 32bit. Descriptor rings, status blocks and TX/RX buffers now use full 64bit DMA addressing. o Allocate DMA memory shared between host and controller as coherent. o Create 3 separate DMA tags to be used as TX, mini RX ring and stanard RX ring. Previously it created a single DMA tag and it was used to all three rings. o et(4) does not support jumbo frame at this moment and I still don't quite understand how jumbo frame works on this controller so use two RX rings to handle small sized frame and normal sized frame respectively. The mini RX ring will be used to receive frames that are less than or equal to 127 bytes. The second RX ring is used to receive frames that are not handled by the first RX ring. If jumbo frame support is implemented, driver may have to choose better RX scheme by letting the second RX ring handle jumbo frames. This scheme will mimic Broadcom's efficient jumbo frame handling feature. However RAM buffer size(16KB) of the controller is too small to hold 2 jumbo frames, if 9KB jumbo frame is used, I'm not sure how good performance would it have. o In et_rxeof(), make sure to check whether controller received good frame or not. Passing corrupted frame to upper layer is bad idea. o If driver receives a bad frame or driver fails to allocate RX buffer due to resource shortage condition, reuse previously loaded DMA map for RX buffer instead of unloading/loading RX buffer again. o et_init_tx_ring() never fails so change return type to void. o In watchdog handler, show TX DMA write back status of errored frame which could be used as a clue to debug watchdog timeout. o Add missing bus_dmamap_sync() in various places such that et(4) should work with bounce buffers(e.g. PAE). o TX side bus_dmamap_load_mbuf_sg(9) support. o RX side bus_dmamap_load_mbuf_sg(9) support. o Controller has no DMA alignment limit in RX buffer so use m_adj(9) in RX buffer allocation to make IP header align on 2 bytes boundary. Otherwise it would trigger unaligned access error in upper layer on strict alignment architectures. One of down side of controller is it provides limited set of RX buffer length like most Intel controllers. This is not problem at this moment because driver does not support jumbo frame yet but it may require alignment fixup code to support jumbo frame on strict alignment architectures. o In et_txeof(), don't zero TX descriptors for transmitted frames. TX descriptors don't need write access after transmission. Driver sets IFF_DRV_OACTIVE when the number of available TX descriptors are less than or equal to ET_NSEG_SPARE. Make sure to clear IFF_DRV_OACTIVE only when the number of available TX descriptor is greater than ET_NSEG_SPARE. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 16:27:23 2011 (r228324) +++ head/sys/dev/et/if_et.c Wed Dec 7 18:17:09 2011 (r228325) @@ -99,7 +99,7 @@ static void et_init(void *); static int et_ioctl(struct ifnet *, u_long, caddr_t); static void et_start_locked(struct ifnet *); static void et_start(struct ifnet *); -static void et_watchdog(struct et_softc *); +static int et_watchdog(struct et_softc *); static int et_ifmedia_upd_locked(struct ifnet *); static int et_ifmedia_upd(struct ifnet *); static void et_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -114,24 +114,22 @@ static void et_disable_intrs(struct et_s static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); -static int et_dma_alloc(device_t); -static void et_dma_free(device_t); -static int et_dma_mem_create(device_t, bus_size_t, bus_dma_tag_t *, - void **, bus_addr_t *, bus_dmamap_t *); -static void et_dma_mem_destroy(bus_dma_tag_t, void *, bus_dmamap_t); -static int et_dma_mbuf_create(device_t); -static void et_dma_mbuf_destroy(device_t, int, const int[]); -static void et_dma_ring_addr(void *, bus_dma_segment_t *, int, int); -static void et_dma_buf_addr(void *, bus_dma_segment_t *, int, - bus_size_t, int); -static int et_init_tx_ring(struct et_softc *); +static int et_dma_alloc(struct et_softc *); +static void et_dma_free(struct et_softc *); +static void et_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int et_dma_ring_alloc(struct et_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, + const char *); +static void et_dma_ring_free(struct et_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); +static void et_init_tx_ring(struct et_softc *); static int et_init_rx_ring(struct et_softc *); static void et_free_tx_ring(struct et_softc *); static void et_free_rx_ring(struct et_softc *); static int et_encap(struct et_softc *, struct mbuf **); -static int et_newbuf(struct et_rxbuf_data *, int, int, int); -static int et_newbuf_cluster(struct et_rxbuf_data *, int, int); -static int et_newbuf_hdr(struct et_rxbuf_data *, int, int); +static int et_newbuf_cluster(struct et_rxbuf_data *, int); +static int et_newbuf_hdr(struct et_rxbuf_data *, int); +static void et_rxbuf_discard(struct et_rxbuf_data *, int); static void et_stop(struct et_softc *); static int et_chip_init(struct et_softc *); @@ -152,7 +150,6 @@ static void et_get_eaddr(device_t, uint8 static void et_setmulti(struct et_softc *); static void et_tick(void *); static void et_setmedia(struct et_softc *); -static void et_setup_rxdesc(struct et_rxbuf_data *, int, bus_addr_t); static const struct et_dev { uint16_t vid; @@ -202,18 +199,6 @@ TUNABLE_INT("hw.et.rx_intr_npkts", &et_r TUNABLE_INT("hw.et.rx_intr_delay", &et_rx_intr_delay); TUNABLE_INT("hw.et.tx_intr_nsegs", &et_tx_intr_nsegs); -struct et_bsize { - int bufsize; - et_newbuf_t newbuf; -}; - -static const struct et_bsize et_bufsize_std[ET_RX_NRING] = { - { .bufsize = ET_RXDMA_CTRL_RING0_128, - .newbuf = et_newbuf_hdr }, - { .bufsize = ET_RXDMA_CTRL_RING1_2048, - .newbuf = et_newbuf_cluster }, -}; - static int et_probe(device_t dev) { @@ -326,7 +311,7 @@ et_attach(device_t dev) et_disable_intrs(sc); - error = et_dma_alloc(dev); + error = et_dma_alloc(sc); if (error) goto fail; @@ -403,7 +388,7 @@ et_detach(device_t dev) if (sc->ifp != NULL) if_free(sc->ifp); - et_dma_free(dev); + et_dma_free(sc); mtx_destroy(&sc->sc_mtx); @@ -699,235 +684,250 @@ et_enable_intrs(struct et_softc *sc, uin CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); } +struct et_dmamap_arg { + bus_addr_t et_busaddr; +}; + +static void +et_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct et_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->et_busaddr = segs->ds_addr; +} + static int -et_dma_alloc(device_t dev) +et_dma_ring_alloc(struct et_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, error; + struct et_dmamap_arg ctx; + int error; - /* - * Create top level DMA tag - */ - error = bus_dma_tag_create(NULL, 1, 0, - BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, - NULL, NULL, - MAXBSIZE, - BUS_SPACE_UNRESTRICTED, - BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, &sc->sc_dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); + error = bus_dma_tag_create(sc->sc_dtag, alignment, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, maxsize, 1, maxsize, 0, NULL, NULL, + tag); + if (error != 0) { + device_printf(sc->dev, "could not create %s dma tag\n", msg); return (error); } - - /* - * Create TX ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_TX_RING_SIZE, &tx_ring->tr_dtag, - (void **)&tx_ring->tr_desc, - &tx_ring->tr_paddr, &tx_ring->tr_dmap); - if (error) { - device_printf(dev, "can't create TX ring DMA stuffs\n"); + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate DMA'able memory for %s\n", msg); return (error); } - - /* - * Create TX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(uint32_t), &txsd->txsd_dtag, - (void **)&txsd->txsd_status, - &txsd->txsd_paddr, &txsd->txsd_dmap); - if (error) { - device_printf(dev, "can't create TX status DMA stuffs\n"); + /* Load the address of the ring. */ + ctx.et_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, et_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->dev, + "could not load DMA'able memory for %s\n", msg); return (error); } + *paddr = ctx.et_busaddr; + return (0); +} - /* - * Create DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - static const uint32_t rx_ring_posreg[ET_RX_NRING] = - { ET_RX_RING0_POS, ET_RX_RING1_POS }; - - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; +static void +et_dma_ring_free(struct et_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ - error = et_dma_mem_create(dev, ET_RX_RING_SIZE, - &rx_ring->rr_dtag, - (void **)&rx_ring->rr_desc, - &rx_ring->rr_paddr, - &rx_ring->rr_dmap); - if (error) { - device_printf(dev, "can't create DMA stuffs for " - "the %d RX ring\n", i); - return (error); - } - rx_ring->rr_posreg = rx_ring_posreg[i]; + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; } - - /* - * Create RX stat ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_RXSTAT_RING_SIZE, - &rxst_ring->rsr_dtag, - (void **)&rxst_ring->rsr_stat, - &rxst_ring->rsr_paddr, &rxst_ring->rsr_dmap); - if (error) { - device_printf(dev, "can't create RX stat ring DMA stuffs\n"); - return (error); + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; } +} - /* - * Create RX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(struct et_rxstatus), - &rxsd->rxsd_dtag, - (void **)&rxsd->rxsd_status, - &rxsd->rxsd_paddr, &rxsd->rxsd_dmap); - if (error) { - device_printf(dev, "can't create RX status DMA stuffs\n"); +static int +et_dma_alloc(struct et_softc *sc) +{ + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + int i, error; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_dtag); + if (error != 0) { + device_printf(sc->dev, "could not allocate parent dma tag\n"); return (error); } - /* - * Create mbuf DMA stuffs - */ - error = et_dma_mbuf_create(dev); + /* TX ring. */ + tx_ring = &sc->sc_tx_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_TX_RING_SIZE, + &tx_ring->tr_dtag, (uint8_t **)&tx_ring->tr_desc, &tx_ring->tr_dmap, + &tx_ring->tr_paddr, "TX ring"); if (error) return (error); - return (0); -} + /* TX status block. */ + txsd = &sc->sc_tx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, sizeof(uint32_t), + &txsd->txsd_dtag, (uint8_t **)&txsd->txsd_status, &txsd->txsd_dmap, + &txsd->txsd_paddr, "TX status block"); + if (error) + return (error); -static void -et_dma_free(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, rx_done[ET_RX_NRING]; + /* RX ring 0, used as to recive small sized frames. */ + rx_ring = &sc->sc_rx_ring[0]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 0"); + rx_ring->rr_posreg = ET_RX_RING0_POS; + if (error) + return (error); - /* - * Destroy TX ring DMA stuffs - */ - et_dma_mem_destroy(tx_ring->tr_dtag, tx_ring->tr_desc, - tx_ring->tr_dmap); + /* RX ring 1, used as to store normal sized frames. */ + rx_ring = &sc->sc_rx_ring[1]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 1"); + rx_ring->rr_posreg = ET_RX_RING1_POS; + if (error) + return (error); - /* - * Destroy TX status DMA stuffs - */ - et_dma_mem_destroy(txsd->txsd_dtag, txsd->txsd_status, - txsd->txsd_dmap); + /* RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RXSTAT_RING_SIZE, + &rxst_ring->rsr_dtag, (uint8_t **)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap, &rxst_ring->rsr_paddr, "RX stat ring"); + if (error) + return (error); - /* - * Destroy DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; + /* RX status block. */ + rxsd = &sc->sc_rx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, + sizeof(struct et_rxstatus), &rxsd->rxsd_dtag, + (uint8_t **)&rxsd->rxsd_status, &rxsd->rxsd_dmap, + &rxsd->rxsd_paddr, "RX status block"); + if (error) + return (error); - et_dma_mem_destroy(rx_ring->rr_dtag, rx_ring->rr_desc, - rx_ring->rr_dmap); + /* Create parent DMA tag for mbufs. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_mbuf_dtag); + if (error != 0) { + device_printf(sc->dev, + "could not allocate parent dma tag for mbuf\n"); + return (error); } - /* - * Destroy RX stat ring DMA stuffs - */ - et_dma_mem_destroy(rxst_ring->rsr_dtag, rxst_ring->rsr_stat, - rxst_ring->rsr_dmap); - - /* - * Destroy RX status DMA stuffs - */ - et_dma_mem_destroy(rxsd->rxsd_dtag, rxsd->rxsd_status, - rxsd->rxsd_dmap); - - /* - * Destroy mbuf DMA stuffs - */ - for (i = 0; i < ET_RX_NRING; ++i) - rx_done[i] = ET_RX_NDESC; - et_dma_mbuf_destroy(dev, ET_TX_NDESC, rx_done); - - /* - * Destroy top level DMA tag - */ - if (sc->sc_dtag != NULL) - bus_dma_tag_destroy(sc->sc_dtag); -} - -static int -et_dma_mbuf_create(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; - int i, error, rx_done[ET_RX_NRING]; + /* Create DMA tag for mini RX mbufs to use RX ring 0. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->sc_rx_mini_tag); + if (error) { + device_printf(sc->dev, "could not create mini RX dma tag\n"); + return (error); + } - /* - * Create mbuf DMA tag - */ - error = bus_dma_tag_create(sc->sc_dtag, 1, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - ET_JUMBO_FRAMELEN, ET_NSEG_MAX, - BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_mbuf_dtag); + /* Create DMA tag for standard RX mbufs to use RX ring 1. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->sc_rx_tag); if (error) { - device_printf(dev, "can't create mbuf DMA tag\n"); + device_printf(sc->dev, "could not create RX dma tag\n"); return (error); } - /* - * Create spare DMA map for RX mbufs - */ - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, &sc->sc_mbuf_tmp_dmap); + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * ET_NSEG_MAX, ET_NSEG_MAX, MCLBYTES, 0, NULL, NULL, + &sc->sc_tx_tag); if (error) { - device_printf(dev, "can't create spare mbuf DMA map\n"); - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; + device_printf(sc->dev, "could not create TX dma tag\n"); return (error); } - /* - * Create DMA maps for RX mbufs - */ - bzero(rx_done, sizeof(rx_done)); - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; + /* Initialize RX ring 0. */ + rbd = &sc->sc_rx_data[0]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING0_128; + rbd->rbd_newbuf = et_newbuf_hdr; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[0]; + /* Create DMA maps for mini RX buffers, ring 0. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); + } + } - for (j = 0; j < ET_RX_NDESC; ++j) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &rbd->rbd_buf[j].rb_dmap); - if (error) { - device_printf(dev, "can't create %d RX mbuf " - "for %d RX ring\n", j, i); - rx_done[i] = j; - et_dma_mbuf_destroy(dev, 0, rx_done); - return (error); - } + /* Create a spare DMA map for mini RX buffers, ring 0. */ + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &sc->sc_rx_mini_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for mini RX mbuf\n"); + return (error); + } + + /* Initialize RX ring 1. */ + rbd = &sc->sc_rx_data[1]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING1_2048; + rbd->rbd_newbuf = et_newbuf_cluster; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[1]; + /* Create DMA maps for standard RX buffers, ring 1. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); } - rx_done[i] = ET_RX_NDESC; + } - rbd->rbd_softc = sc; - rbd->rbd_ring = &sc->sc_rx_ring[i]; + /* Create a spare DMA map for standard RX buffers, ring 1. */ + error = bus_dmamap_create(sc->sc_rx_tag, 0, &sc->sc_rx_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for RX mbuf\n"); + return (error); } - /* - * Create DMA maps for TX mbufs - */ - for (i = 0; i < ET_TX_NDESC; ++i) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &tbd->tbd_buf[i].tb_dmap); + /* Create DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_tx_tag, 0, + &tbd->tbd_buf[i].tb_dmap); if (error) { - device_printf(dev, "can't create %d TX mbuf " - "DMA map\n", i); - et_dma_mbuf_destroy(dev, i, rx_done); + device_printf(sc->dev, + "could not create DMA map for TX mbufs\n"); return (error); } } @@ -936,106 +936,97 @@ et_dma_mbuf_create(device_t dev) } static void -et_dma_mbuf_destroy(device_t dev, int tx_done, const int rx_done[]) +et_dma_free(struct et_softc *sc) { - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_txstatus_data *txsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; int i; - if (sc->sc_mbuf_dtag == NULL) - return; - - /* - * Destroy DMA maps for RX mbufs - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; - - for (j = 0; j < rx_done[i]; ++j) { - struct et_rxbuf *rb = &rbd->rbd_buf[j]; - - KASSERT(rb->rb_mbuf == NULL, - ("RX mbuf in %d RX ring is not freed yet\n", i)); - bus_dmamap_destroy(sc->sc_mbuf_dtag, rb->rb_dmap); + /* Destroy DMA maps for mini RX buffers, ring 0. */ + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; } } - - /* - * Destroy DMA maps for TX mbufs - */ - for (i = 0; i < tx_done; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - - KASSERT(tb->tb_mbuf == NULL, ("TX mbuf is not freed yet\n")); - bus_dmamap_destroy(sc->sc_mbuf_dtag, tb->tb_dmap); + if (sc->sc_rx_mini_sparemap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, sc->sc_rx_mini_sparemap); + sc->sc_rx_mini_sparemap = NULL; } - - /* - * Destroy spare mbuf DMA map - */ - bus_dmamap_destroy(sc->sc_mbuf_dtag, sc->sc_mbuf_tmp_dmap); - - /* - * Destroy mbuf DMA tag - */ - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; -} - -static int -et_dma_mem_create(device_t dev, bus_size_t size, bus_dma_tag_t *dtag, - void **addr, bus_addr_t *paddr, bus_dmamap_t *dmap) -{ - struct et_softc *sc = device_get_softc(dev); - int error; - - error = bus_dma_tag_create(sc->sc_dtag, ET_ALIGN, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - size, 1, BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); - return (error); + if (sc->sc_rx_mini_tag) { + bus_dma_tag_destroy(sc->sc_rx_mini_tag); + sc->sc_rx_mini_tag = NULL; } - error = bus_dmamem_alloc(*dtag, addr, BUS_DMA_WAITOK | BUS_DMA_ZERO, - dmap); - if (error) { - device_printf(dev, "can't allocate DMA mem\n"); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + /* Destroy DMA maps for standard RX buffers, ring 1. */ + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; + } } - - error = bus_dmamap_load(*dtag, *dmap, *addr, size, - et_dma_ring_addr, paddr, BUS_DMA_WAITOK); - if (error) { - device_printf(dev, "can't load DMA mem\n"); - bus_dmamem_free(*dtag, *addr, *dmap); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + if (sc->sc_rx_sparemap) { + bus_dmamap_destroy(sc->sc_rx_tag, sc->sc_rx_sparemap); + sc->sc_rx_sparemap = NULL; + } + if (sc->sc_rx_tag) { + bus_dma_tag_destroy(sc->sc_rx_tag); + sc->sc_rx_tag = NULL; } - return (0); -} -static void -et_dma_mem_destroy(bus_dma_tag_t dtag, void *addr, bus_dmamap_t dmap) -{ - if (dtag != NULL) { - bus_dmamap_unload(dtag, dmap); - bus_dmamem_free(dtag, addr, dmap); - bus_dma_tag_destroy(dtag); + /* Destroy DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + if (tbd->tbd_buf[i].tb_dmap) { + bus_dmamap_destroy(sc->sc_tx_tag, + tbd->tbd_buf[i].tb_dmap); + tbd->tbd_buf[i].tb_dmap = NULL; + } + } + if (sc->sc_tx_tag) { + bus_dma_tag_destroy(sc->sc_tx_tag); + sc->sc_tx_tag = NULL; } -} -static void -et_dma_ring_addr(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - KASSERT(nseg == 1, ("too many segments\n")); - *((bus_addr_t *)arg) = seg->ds_addr; + /* Destroy mini RX ring, ring 0. */ + rx_ring = &sc->sc_rx_ring[0]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy standard RX ring, ring 1. */ + rx_ring = &sc->sc_rx_ring[1]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy RX status block. */ + rxsd = &sc->sc_rx_status; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy TX ring. */ + tx_ring = &sc->sc_tx_ring; + et_dma_ring_free(sc, &tx_ring->tr_dtag, (void *)&tx_ring->tr_desc, + &tx_ring->tr_dmap); + /* Destroy TX status block. */ + txsd = &sc->sc_tx_status; + et_dma_ring_free(sc, &txsd->txsd_dtag, (void *)&txsd->txsd_status, + &txsd->txsd_dmap); + + /* Destroy the parent tag. */ + if (sc->sc_dtag) { + bus_dma_tag_destroy(sc->sc_dtag); + sc->sc_dtag = NULL; + } } static void @@ -1113,30 +1104,21 @@ back: static void et_init_locked(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const struct et_bsize *arr; - int error, i; + struct ifnet *ifp; + int error; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; et_stop(sc); - arr = et_bufsize_std; - for (i = 0; i < ET_RX_NRING; ++i) { - sc->sc_rx_data[i].rbd_bufsize = arr[i].bufsize; - sc->sc_rx_data[i].rbd_newbuf = arr[i].newbuf; - } - - error = et_init_tx_ring(sc); - if (error) - goto back; - + et_init_tx_ring(sc); error = et_init_rx_ring(sc); if (error) - goto back; + return; error = et_chip_init(sc); if (error) @@ -1309,20 +1291,26 @@ et_start(struct ifnet *ifp) ET_UNLOCK(sc); } -static void +static int et_watchdog(struct et_softc *sc) { + uint32_t status; + ET_LOCK_ASSERT(sc); if (sc->watchdog_timer == 0 || --sc->watchdog_timer) - return; + return (0); - if_printf(sc->ifp, "watchdog timed out\n"); + bus_dmamap_sync(sc->sc_tx_status.txsd_dtag, sc->sc_tx_status.txsd_dmap, + BUS_DMASYNC_POSTREAD); + status = le32toh(*(sc->sc_tx_status.txsd_status)); + if_printf(sc->ifp, "watchdog timed out (0x%08x) -- resetting\n", + status); sc->ifp->if_oerrors++; sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; et_init_locked(sc); - et_start_locked(sc->ifp); + return (EJUSTRETURN); } static int @@ -1350,49 +1338,59 @@ et_stop_txdma(struct et_softc *sc) static void et_free_tx_ring(struct et_softc *sc) { - struct et_txbuf_data *tbd = &sc->sc_tx_data; - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txbuf *tb; int i; + tbd = &sc->sc_tx_data; + tx_ring = &sc->sc_tx_ring; for (i = 0; i < ET_TX_NDESC; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - + tb = &tbd->tbd_buf[i]; if (tb->tb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_tx_tag, tb->tb_dmap, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_mbuf_dtag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; } } - - bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); } static void et_free_rx_ring(struct et_softc *sc) { - int n; - - for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[n]; - int i; - - for (i = 0; i < ET_RX_NDESC; ++i) { - struct et_rxbuf *rb = &rbd->rbd_buf[i]; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxbuf *rb; + int i; - if (rb->rb_mbuf != NULL) { - bus_dmamap_unload(sc->sc_mbuf_dtag, - rb->rb_dmap); - m_freem(rb->rb_mbuf); - rb->rb_mbuf = NULL; - } + /* Ring 0 */ + rx_ring = &sc->sc_rx_ring[0]; + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_mini_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_mini_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; } + } - bzero(rx_ring->rr_desc, ET_RX_RING_SIZE); - bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, - BUS_DMASYNC_PREWRITE); + /* Ring 1 */ + rx_ring = &sc->sc_rx_ring[1]; + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; + } } } @@ -1519,40 +1517,41 @@ et_chip_init(struct et_softc *sc) return (0); } -static int +static void et_init_tx_ring(struct et_softc *sc) { - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + tx_ring = &sc->sc_tx_ring; bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREWRITE); + tbd = &sc->sc_tx_data; tbd->tbd_start_index = 0; tbd->tbd_start_wrap = 0; tbd->tbd_used = 0; + txsd = &sc->sc_tx_status; bzero(txsd->txsd_status, sizeof(uint32_t)); bus_dmamap_sync(txsd->txsd_dtag, txsd->txsd_dmap, - BUS_DMASYNC_PREWRITE); - return (0); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } static int et_init_rx_ring(struct et_softc *sc) { - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - int n; + struct et_rxstatus_data *rxsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxbuf_data *rbd; + int i, error, n; for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - int i, error; - + rbd = &sc->sc_rx_data[n]; for (i = 0; i < ET_RX_NDESC; ++i) { - error = rbd->rbd_newbuf(rbd, i, 1); + error = rbd->rbd_newbuf(rbd, i); if (error) { if_printf(sc->ifp, "%d ring %d buf, " "newbuf failed: %d\n", n, i, error); @@ -1561,37 +1560,19 @@ et_init_rx_ring(struct et_softc *sc) } } + rxsd = &sc->sc_rx_status; bzero(rxsd->rxsd_status, sizeof(struct et_rxstatus)); bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + rxst_ring = &sc->sc_rxstat_ring; bzero(rxst_ring->rsr_stat, ET_RXSTAT_RING_SIZE); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } -static void -et_dma_buf_addr(void *xctx, bus_dma_segment_t *segs, int nsegs, - bus_size_t mapsz __unused, int error) -{ - struct et_dmamap_ctx *ctx = xctx; - int i; - - if (error) - return; - - if (nsegs > ctx->nsegs) { - ctx->nsegs = 0; - return; - } - - ctx->nsegs = nsegs; - for (i = 0; i < nsegs; ++i) - ctx->segs[i] = segs[i]; -} - static int et_init_rxdma(struct et_softc *sc) { @@ -1929,13 +1910,20 @@ et_enable_txrx(struct et_softc *sc, int static void et_rxeof(struct et_softc *sc) { - struct ifnet *ifp; struct et_rxstatus_data *rxsd; struct et_rxstat_ring *rxst_ring; - uint32_t rxs_stat_ring, rxst_info2; - int rxst_wrap, rxst_index; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat *st; + struct ifnet *ifp; + struct mbuf *m; + uint32_t rxstat_pos, rxring_pos; + uint32_t rxst_info1, rxst_info2, rxs_stat_ring; + int buflen, buf_idx, npost[2], ring_idx; + int rxst_index, rxst_wrap; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; rxsd = &sc->sc_rx_status; rxst_ring = &sc->sc_rxstat_ring; @@ -1944,26 +1932,24 @@ et_rxeof(struct et_softc *sc) return; bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 19:08:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAE15106564A; Wed, 7 Dec 2011 19:08:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FAB78FC08; Wed, 7 Dec 2011 19:08:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7J8sj0051833; Wed, 7 Dec 2011 19:08:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7J8sbo051830; Wed, 7 Dec 2011 19:08:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112071908.pB7J8sbo051830@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 19:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228326 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 19:08:54 -0000 Author: yongari Date: Wed Dec 7 19:08:54 2011 New Revision: 228326 URL: http://svn.freebsd.org/changeset/base/228326 Log: Controller does not require TX start command for every frame. So send a single TX command after setting up all TX frames. This removes unnecessary register accesses and bus_dmamap_sync(9) calls. et(4) uses TX interrupt moderation so it's possible to have TX buffers that were already transmitted but waiting for TX completion interrupt. If the number of available TX descriptor is less then 1/3 of total TX descriptor, try reclaiming first to get enough free TX descriptors before setting up TX descriptors. After r228325, et_txeof() no longer tries to send frames after reclaiming TX buffers. That change was made to give more chance to transmit frames in main interrupt handler since we can still send frames in interrupt handler with RX interrupt. So right before exiting interrupt hander, after enabling interrupt, try to send more frames. This gives slightly better performance numbers. While I'm here reduce number of spare TX descriptors from 8 to 4. Controller does not require reserved TX descriptors, it was just to reduce TX overhead. After r228325, driver has much lower TX overhead so it does not make sense to reserve 8 TX descriptors. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 18:17:09 2011 (r228325) +++ head/sys/dev/et/if_et.c Wed Dec 7 19:08:54 2011 (r228326) @@ -1097,7 +1097,11 @@ et_intr(void *xsc) if (intrs & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); back: - et_enable_intrs(sc, ET_INTRS); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + et_enable_intrs(sc, ET_INTRS); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + et_start_locked(ifp); + } ET_UNLOCK(sc); } @@ -1240,7 +1244,9 @@ et_start_locked(struct ifnet *ifp) { struct et_softc *sc; struct mbuf *m_head = NULL; + struct et_txdesc_ring *tx_ring; struct et_txbuf_data *tbd; + uint32_t tx_ready_pos; int enq; sc = ifp->if_softc; @@ -1252,7 +1258,18 @@ et_start_locked(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; + /* + * Driver does not request TX completion interrupt for every + * queued frames to prevent generating excessive interrupts. + * This means driver may wait for TX completion interrupt even + * though some frames were sucessfully transmitted. Reclaiming + * transmitted frames will ensure driver see all available + * descriptors. + */ tbd = &sc->sc_tx_data; + if (tbd->tbd_used > (ET_TX_NDESC * 2) / 3) + et_txeof(sc); + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -1277,8 +1294,17 @@ et_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (enq > 0) + if (enq > 0) { + tx_ring = &sc->sc_tx_ring; + bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, + BUS_DMASYNC_PREWRITE); + tx_ready_pos = tx_ring->tr_ready_index & + ET_TX_READY_POS_INDEX_MASK; + if (tx_ring->tr_ready_wrap) + tx_ready_pos |= ET_TX_READY_POS_WRAP; + CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); sc->watchdog_timer = 5; + } } static void @@ -2036,7 +2062,7 @@ et_encap(struct et_softc *sc, struct mbu struct mbuf *m; bus_dma_segment_t segs[ET_NSEG_MAX]; bus_dmamap_t map; - uint32_t csum_flags, last_td_ctrl2, tx_ready_pos; + uint32_t csum_flags, last_td_ctrl2; int error, i, idx, first_idx, last_idx, nsegs; tx_ring = &sc->sc_tx_ring; @@ -2121,12 +2147,6 @@ et_encap(struct et_softc *sc, struct mbu tbd->tbd_used += nsegs; MPASS(tbd->tbd_used <= ET_TX_NDESC); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); - tx_ready_pos = tx_ring->tr_ready_index & ET_TX_READY_POS_INDEX_MASK; - if (tx_ring->tr_ready_wrap) - tx_ready_pos |= ET_TX_READY_POS_WRAP; - CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); return (0); } Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Wed Dec 7 18:17:09 2011 (r228325) +++ head/sys/dev/et/if_etvar.h Wed Dec 7 19:08:54 2011 (r228326) @@ -41,7 +41,7 @@ #define ET_RING_ALIGN 4096 #define ET_STATUS_ALIGN 8 #define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 8 +#define ET_NSEG_SPARE 4 #define ET_TX_NDESC 512 #define ET_RX_NDESC 512 From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 19:11:36 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D295106566B; Wed, 7 Dec 2011 19:11:36 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 447E18FC12; Wed, 7 Dec 2011 19:11:35 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id pB7JBYvg020928; Wed, 7 Dec 2011 14:11:34 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id pB7JBYXQ020927; Wed, 7 Dec 2011 14:11:34 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Wed, 7 Dec 2011 14:11:34 -0500 From: David Schultz To: David Chisnall Message-ID: <20111207191134.GA20850@zim.MIT.EDU> Mail-Followup-To: David Chisnall , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112071525.pB7FPmkH044896@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112071525.pB7FPmkH044896@svn.freebsd.org> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 19:11:36 -0000 On Wed, Dec 07, 2011, David Chisnall wrote: > Author: theraven > Date: Wed Dec 7 15:25:48 2011 > New Revision: 228322 > URL: http://svn.freebsd.org/changeset/base/228322 > > Log: > Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a > __noreturn macro and modify the other exiting functions to use it. > > The __noreturn macro, unlike __dead2, must be used BEFORE the function. > This is in line with the C and C++ specifications that place _Noreturn (c1x) > and [[noreturn]] (C++11) in front of the functions. As with __dead2, this > macro falls back to using the GCC attribute. > > Unfortunately, clang currently sets the same value for the C version macro > in C99 and C1x modes, so these functions are hidden by default. At some > point before 10.0, I need to go through the headers and clean up the C1x / > C++11 visibility. Nice. Why not use the standard spelling, '_Noreturn'? In pre-C1X modes, _Noreturn is a reserved identifier since it starts with an underscore and capital letter, so it's not considered namespace pollution. From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 19:43:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FF5C1065673; Wed, 7 Dec 2011 19:43:05 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45F3E8FC13; Wed, 7 Dec 2011 19:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7Jh5vY052896; Wed, 7 Dec 2011 19:43:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7Jh5VQ052894; Wed, 7 Dec 2011 19:43:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112071943.pB7Jh5VQ052894@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 19:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228327 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 19:43:05 -0000 Author: yongari Date: Wed Dec 7 19:43:04 2011 New Revision: 228327 URL: http://svn.freebsd.org/changeset/base/228327 Log: Remove et_enable_intrs(), et_disable_intrs() functions and manipulation of interrupt register access is done through CSR_WRITE_4 macro. Also add disabling interrupt into et_reset() because we want interrupt disabled state after controller reset. While I'm here slightly change interrupt handler to be more readable one. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 19:08:54 2011 (r228326) +++ head/sys/dev/et/if_et.c Wed Dec 7 19:43:04 2011 (r228327) @@ -109,8 +109,6 @@ static int et_sysctl_rx_intr_npkts(SYSCT static int et_sysctl_rx_intr_delay(SYSCTL_HANDLER_ARGS); static void et_intr(void *); -static void et_enable_intrs(struct et_softc *, uint32_t); -static void et_disable_intrs(struct et_softc *); static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); @@ -309,8 +307,6 @@ et_attach(device_t dev) et_reset(sc); - et_disable_intrs(sc); - error = et_dma_alloc(sc); if (error) goto fail; @@ -540,12 +536,12 @@ et_stop(struct et_softc *sc) ET_LOCK_ASSERT(sc); callout_stop(&sc->sc_tick); + /* Disable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); et_stop_rxdma(sc); et_stop_txdma(sc); - et_disable_intrs(sc); - et_free_tx_ring(sc); et_free_rx_ring(sc); @@ -670,20 +666,10 @@ et_reset(struct et_softc *sc) ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC); CSR_WRITE_4(sc, ET_MAC_CFG1, 0); -} - -static void -et_disable_intrs(struct et_softc *sc) -{ + /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); } -static void -et_enable_intrs(struct et_softc *sc, uint32_t intrs) -{ - CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); -} - struct et_dmamap_arg { bus_addr_t et_busaddr; }; @@ -1083,12 +1069,12 @@ et_intr(void *xsc) return; } - et_disable_intrs(sc); + /* Disable further interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); intrs = CSR_READ_4(sc, ET_INTR_STATUS); - intrs &= ET_INTRS; - if (intrs == 0) /* Not interested */ - goto back; + if ((intrs & ET_INTRS) == 0) + goto done; if (intrs & ET_INTR_RXEOF) et_rxeof(sc); @@ -1096,9 +1082,9 @@ et_intr(void *xsc) et_txeof(sc); if (intrs & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -back: +done: if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - et_enable_intrs(sc, ET_INTRS); + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) et_start_locked(ifp); } @@ -1132,7 +1118,8 @@ et_init_locked(struct et_softc *sc) if (error) goto back; - et_enable_intrs(sc, ET_INTRS); + /* Enable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); callout_reset(&sc->sc_tick, hz, et_tick, sc); From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 21:00:34 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 150A81065670; Wed, 7 Dec 2011 21:00:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF1698FC22; Wed, 7 Dec 2011 21:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7L0XhX055352; Wed, 7 Dec 2011 21:00:33 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7L0XXd055349; Wed, 7 Dec 2011 21:00:33 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112072100.pB7L0XXd055349@svn.freebsd.org> From: Dimitry Andric Date: Wed, 7 Dec 2011 21:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228328 - head/contrib/libstdc++/include/debug X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:00:34 -0000 Author: dim Date: Wed Dec 7 21:00:33 2011 New Revision: 228328 URL: http://svn.freebsd.org/changeset/base/228328 Log: Make it possible to use the debug versions of std::map and std::multimap with clang, by removing two unneeded using declarations. Otherwise, you would get errors similar to: /usr/include/c++/4.2/debug/map.h:77:20: error: dependent using declaration resolved to type without 'typename' using _Base::value_compare; ^ N.B.: Take care when you actually use the debug versions of any libstdc++ header. They are more likely to contain problems, because they are exercised far less often, and since the standard library complexity guarantees don't always apply anymore, compile times can drastically increase. MFC after: 2 weeks Modified: head/contrib/libstdc++/include/debug/map.h head/contrib/libstdc++/include/debug/multimap.h Modified: head/contrib/libstdc++/include/debug/map.h ============================================================================== --- head/contrib/libstdc++/include/debug/map.h Wed Dec 7 19:43:04 2011 (r228327) +++ head/contrib/libstdc++/include/debug/map.h Wed Dec 7 21:00:33 2011 (r228328) @@ -74,8 +74,6 @@ namespace __debug typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - using _Base::value_compare; - // 23.3.1.1 construct/copy/destroy: explicit map(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) Modified: head/contrib/libstdc++/include/debug/multimap.h ============================================================================== --- head/contrib/libstdc++/include/debug/multimap.h Wed Dec 7 19:43:04 2011 (r228327) +++ head/contrib/libstdc++/include/debug/multimap.h Wed Dec 7 21:00:33 2011 (r228328) @@ -74,8 +74,6 @@ namespace __debug typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - using _Base::value_compare; - // 23.3.1.1 construct/copy/destroy: explicit multimap(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 21:02:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 668C71065678; Wed, 7 Dec 2011 21:02:36 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C47F8FC0C; Wed, 7 Dec 2011 21:02:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7L2aOe055452; Wed, 7 Dec 2011 21:02:36 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7L2at5055449; Wed, 7 Dec 2011 21:02:36 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112072102.pB7L2at5055449@svn.freebsd.org> From: David Chisnall Date: Wed, 7 Dec 2011 21:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228329 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:02:36 -0000 Author: theraven Date: Wed Dec 7 21:02:35 2011 New Revision: 228329 URL: http://svn.freebsd.org/changeset/base/228329 Log: Some fixes to the man pages for [at_]quick_exit(3) Reviewed by: pluknet Approved by: dim (mentor) Modified: head/lib/libc/stdlib/at_quick_exit.3 head/lib/libc/stdlib/quick_exit.3 Modified: head/lib/libc/stdlib/at_quick_exit.3 ============================================================================== --- head/lib/libc/stdlib/at_quick_exit.3 Wed Dec 7 21:00:33 2011 (r228328) +++ head/lib/libc/stdlib/at_quick_exit.3 Wed Dec 7 21:02:35 2011 (r228329) @@ -23,13 +23,13 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.\" / -.Dd December 7, 2011o.Dt ATEXIT 3 +.\" +.Dd December 7, 2011 .Dt AT_QUICK_EXIT 3 .Os .Sh NAME .Nm at_quick_exit -.Nd Registers a cleanup function to run on quick exit. +.Nd registers a cleanup function to run on quick exit .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -48,10 +48,13 @@ the program exits by calling .Xr _Exit 3 , or .Xr abort 3 . -.El +.Sh RETURN VALUES +The +.Fn at_quick_exit +function returns the value 0 if successful and a non-zero value on failure. .Sh SEE ALSO .Xr exit 3 , -.Xr at_quick_exit 3 +.Xr quick_exit 3 .Sh STANDARDS The .Fn at_quick_exit Modified: head/lib/libc/stdlib/quick_exit.3 ============================================================================== --- head/lib/libc/stdlib/quick_exit.3 Wed Dec 7 21:00:33 2011 (r228328) +++ head/lib/libc/stdlib/quick_exit.3 Wed Dec 7 21:02:35 2011 (r228329) @@ -23,13 +23,13 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.\" / -.Dd December 7, 2011o.Dt ATEXIT 3 +.\" +.Dd December 7, 2011 .Dt QUICK_EXIT 3 .Os .Sh NAME .Nm quick_exit -.Nd Exits a program quickly, running minimal cleanup +.Nd exits a program quickly, running minimal cleanup .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -44,12 +44,14 @@ with .Xr at_quick_exit 3 but not any C++ destructors or cleanup code registered with .Xr atexit 3 . -.El +.Sh RETURN VALUES +The +.Fn quick_exit +function does not return. .Sh SEE ALSO -.Xr exit 3 , -.Xr at_quick_exit 3 +.Xr at_quick_exit 3 , +.Xr exit 3 .Sh STANDARDS The .Fn quick_exit function conforms to the C1x draft specification. - From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 21:03:37 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73D451065672; Wed, 7 Dec 2011 21:03:37 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theravensnest.org [109.169.23.128]) by mx1.freebsd.org (Postfix) with ESMTP id ED0978FC08; Wed, 7 Dec 2011 21:03:36 +0000 (UTC) Received: from [192.168.0.2] (cpc2-cwma5-0-0-cust875.7-3.cable.virginmedia.com [86.11.39.108]) (authenticated bits=0) by theravensnest.org (8.14.4/8.14.4) with ESMTP id pB7L3Ywt087091 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Wed, 7 Dec 2011 21:03:35 GMT (envelope-from theraven@FreeBSD.org) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <20111207191134.GA20850@zim.MIT.EDU> Date: Wed, 7 Dec 2011 21:03:29 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <201112071525.pB7FPmkH044896@svn.freebsd.org> <20111207191134.GA20850@zim.MIT.EDU> To: David Schultz X-Mailer: Apple Mail (2.1251.1) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:03:37 -0000 On 7 Dec 2011, at 19:11, David Schultz wrote: > Why not use the standard spelling, '_Noreturn'? In pre-C1X modes, > _Noreturn is a reserved identifier since it starts with an underscore > and capital letter, so it's not considered namespace pollution. Because that would be too obvious... David From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 21:17:51 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21D05106564A; Wed, 7 Dec 2011 21:17:51 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBCA88FC14; Wed, 7 Dec 2011 21:17:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7LHowI055975; Wed, 7 Dec 2011 21:17:50 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7LHoaL055972; Wed, 7 Dec 2011 21:17:50 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112072117.pB7LHoaL055972@svn.freebsd.org> From: David Chisnall Date: Wed, 7 Dec 2011 21:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228330 - in head: include sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:17:51 -0000 Author: theraven Date: Wed Dec 7 21:17:50 2011 New Revision: 228330 URL: http://svn.freebsd.org/changeset/base/228330 Log: As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an identifier reserved for the implementation in C99 and earlier so there is no sensible reason for introducing yet another reserved identifier when we could just use the one C1x uses. Approved by: brooks (mentor) Modified: head/include/stdlib.h head/sys/sys/cdefs.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Wed Dec 7 21:02:35 2011 (r228329) +++ head/include/stdlib.h Wed Dec 7 21:17:50 2011 (r228330) @@ -76,7 +76,7 @@ extern int __mb_cur_max; extern int ___mb_cur_max(void); #define MB_CUR_MAX (___mb_cur_max()) -__noreturn void abort(void); +_Noreturn void abort(void); int abs(int) __pure2; int atexit(void (*)(void)); double atof(const char *); @@ -86,7 +86,7 @@ void *bsearch(const void *, const void * size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t) __malloc_like; div_t div(int, int) __pure2; -__noreturn void exit(int); +_Noreturn void exit(int); void free(void *); char *getenv(const char *); long labs(long) __pure2; @@ -145,14 +145,14 @@ unsigned long long strtoull(const char * __restrict, char ** __restrict, int); #endif /* __LONG_LONG_SUPPORTED */ -__noreturn void _Exit(int); +_Noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ /* * If we're in a mode greater than C99, expose C1x functions. */ #if __ISO_C_VISIBLE > 1999 -__noreturn void quick_exit(int) +_Noreturn void quick_exit(int) int at_quick_exit(void (*func)(void)); #endif /* __ISO_C_VISIBLE > 1999 */ Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Wed Dec 7 21:02:35 2011 (r228329) +++ head/sys/sys/cdefs.h Wed Dec 7 21:17:50 2011 (r228330) @@ -220,13 +220,13 @@ #if defined(__cplusplus) && __cplusplus >= 201103L -#define __noreturn [[noreturn]] +#define _Noreturn [[noreturn]] #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L -#define __noreturn _Noreturn +/* Do nothing - _Noreturn is a keyword */ #elif defined(__GNUC__) -#define __noreturn __attribute__((__noreturn__)) +#define _Noreturn __attribute__((__noreturn__)) #else -#define __noreturn +#define _Noreturn #endif #if __GNUC_PREREQ__(2, 96) From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 21:19:49 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC1B1106566B; Wed, 7 Dec 2011 21:19:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail14.syd.optusnet.com.au (mail14.syd.optusnet.com.au [211.29.132.195]) by mx1.freebsd.org (Postfix) with ESMTP id 75D528FC15; Wed, 7 Dec 2011 21:19:49 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail14.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pB7LJkgw029673 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Dec 2011 08:19:47 +1100 Date: Thu, 8 Dec 2011 08:19:46 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Schultz In-Reply-To: <20111207191134.GA20850@zim.MIT.EDU> Message-ID: <20111208071024.J2931@besplex.bde.org> References: <201112071525.pB7FPmkH044896@svn.freebsd.org> <20111207191134.GA20850@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, David Chisnall Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:19:50 -0000 On Wed, 7 Dec 2011, David Schultz wrote: > On Wed, Dec 07, 2011, David Chisnall wrote: >> Log: >> Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a >> __noreturn macro and modify the other exiting functions to use it. >> >> The __noreturn macro, unlike __dead2, must be used BEFORE the function. >> This is in line with the C and C++ specifications that place _Noreturn (c1x) >> and [[noreturn]] (C++11) in front of the functions. As with __dead2, this >> macro falls back to using the GCC attribute. >> >> Unfortunately, clang currently sets the same value for the C version macro >> in C99 and C1x modes, so these functions are hidden by default. At some >> point before 10.0, I need to go through the headers and clean up the C1x / >> C++11 visibility. > > Nice. > > Why not use the standard spelling, '_Noreturn'? In pre-C1X modes, > _Noreturn is a reserved identifier since it starts with an underscore > and capital letter, so it's not considered namespace pollution. There is also the __dead attribute for gcc-1 and some versions of gcc-2. It has the same syntax as __noreturn, since it was implemented as `volatile' in gcc-1, and `volatile' must be in the declarator BEFORE the function name. This was changed in gcc-2 because it was determined that `volatile' for a function has some defined meaning that of course can't be the gcc-1 one. FreeBSD introduced __dead2 for newer versions of gcc-2 and kept __dead for a while. __dead remains dead (reserved for gcc-1, or perhaps anything that uses the same syntax). Not quite similarly for __pure. Someone broke its reservedness by using it for gcc-2.96+'s new __pure__ attribute, which is subtly different from the old __pure and the current __pure2 FreeBSD macros. NetBSD still had the old __dead and __pure, and no __dead2 or __pure2, as late as 2005. It still use[d] (as well as defining) __dead in a few places, and uses a hard __attribute__((__noreturn__)) instead of __dead2. Sometimes both. This change seems to break compatibility cruft related to this in the critical header , since __Noreturn is actually used there and replaces __dead2 and has a different syntax that might not work with old compilers (sys/cdefs.h still has mounds of compatibility cruft for old compilers, although this doesn't include __dead for gcc-1, and probably mostly doesn't actually work). Here is the change in cdefs.h: % Index: cdefs.h % =================================================================== % RCS file: /home/ncvs/src/sys/sys/cdefs.h,v % retrieving revision 1.117 % retrieving revision 1.118 % diff -u -2 -r1.117 -r1.118 % --- cdefs.h 12 Nov 2011 23:17:54 -0000 1.117 % +++ cdefs.h 7 Dec 2011 15:25:48 -0000 1.118 % @@ -219,4 +219,15 @@ % #endif % % + Style bug (extra blank line). % +#if defined(__cplusplus) && __cplusplus >= 201103L % +#define __noreturn [[noreturn]] % +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L % +#define __noreturn _Noreturn % +#elif defined(__GNUC__) % +#define __noreturn __attribute__((__noreturn__)) This assumes that all versions of gcc support the __noreturn__ attribute, and the new uses of this attribute assumes that __attribute__(()) works BEFORE the function name when it is used there, as it now is in . The first assumption bogotifies the fussy ifdefs used later in cdefs.h. __attribute__((__noreturn__)) is already used later, to define __dead2, and this is under several ifdefs with ugly duplication: - one for gcc-2.5 and 2.6 vs older gcc's - one for gcc >= 2.7 - one for __INTEL_COMPILER (twisted by interaction with the ones for very old gcc's) I don't trust most of the version numbers in the GNC_PREREQ()s, but these have more chance than most of being correct since they are old and detailed. If they are correct, then we see that the above is incorrect mainly for gcc-2.0 through 2.4. gcc-1 is already fully unsupported (except as a generic compiler). gcc-2.0 through gcc-2.4 are old enough to unsupport, so this is mainly a style bug. The second assumption is probably not satisfied by middle versions of gcc-2. IIRC, the reason for switching the syntax from __dead (placed before the function name) to __dead2 (placed after) was that early implementations of __attribute__() only worked if they were placed after. Otherwise, we would have just ifdefed another case for __dead. I don't know when gcc fixed this. % +#else % +#define __noreturn Defaulting to nothing for a generic/unknown compiler is good, but this combined with actually using __noreturn seems to break some previously supported cases, in particular __INTEL_COMPILER sees a null __noreturn for declarations in where it used to see a non-null __dead2. Apparently it doesn't pretend to be gcc, but it supports most gcc features so it mostly works, but it needs messy ifdefs to use these features. Perhaps __INTEL_COMPILER should be unsupported together with gcc-2. It is painful to maintain all these compatibilty ifdefs, especially if they are required to actually work. clang avoids most problems in this area by claiming to be gcc-4. % +#endif % + % ... Bruce From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 21:29:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 370E0106564A; Wed, 7 Dec 2011 21:29:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BB408FC12; Wed, 7 Dec 2011 21:29:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7LTpGq056553; Wed, 7 Dec 2011 21:29:51 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7LTpLB056549; Wed, 7 Dec 2011 21:29:51 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072129.pB7LTpLB056549@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 21:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228331 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:29:52 -0000 Author: yongari Date: Wed Dec 7 21:29:51 2011 New Revision: 228331 URL: http://svn.freebsd.org/changeset/base/228331 Log: Rework link state tracking and TX/RX MAC configuration. o Do not report link status if driver is not running. o TX/RX MAC configuration should be done with resolved speed, duplex and flow control after establishing a link so it can't be done in driver initialization routine. Move the configuration to miibus_statchg callback which will be called whenever any link state change is detected. At this moment, flow-control is not enabled yet mainly because I was not able to set correct flow control parameters to generate TX pause frames. o Now TX/RX MAC is enabled only when a valid link is detected. Rearragnge hardware initialization routine a bit to leave enabling MAC to miibus_statchg callback. In order to that, TX/RX DMA engine is enabled in et_init_locked(). o Introduce ET_FLAG_LINK flag to track current link state. o Introduce ET_FLAG_FASTETHER flag to mark whether controller is fast ethernet. This flag is checked in miibus_statchg callback to know whether PHY established a valid link. o In et_stop(), TX/RX MAC is explicitly disabled instead of relying on et_reset(). And move et_reset() from et_stop() to controller initialization. Controler reset is not required here and it would also clear critial registers(i.e station address, RX filter configuration, WOL etc) that are required to make WOL work. o Switching to current media is done in et_init_locked() after setting IFF_DRV_RUNNING flag. This should ensure reliable auto-negotiation/manual link establishment. o In et_start_locked(), check whether driver got a valid link before trying to send frames. o Remove checking a link in et_tick() as this is done by miibus_statchg callback. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 21:17:50 2011 (r228330) +++ head/sys/dev/et/if_et.c Wed Dec 7 21:29:51 2011 (r228331) @@ -141,13 +141,11 @@ static int et_start_rxdma(struct et_soft static int et_start_txdma(struct et_softc *); static int et_stop_rxdma(struct et_softc *); static int et_stop_txdma(struct et_softc *); -static int et_enable_txrx(struct et_softc *, int); static void et_reset(struct et_softc *); static int et_bus_config(struct et_softc *); static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); -static void et_setmedia(struct et_softc *); static const struct et_dev { uint16_t vid; @@ -296,6 +294,9 @@ et_attach(device_t dev) goto fail; } + if (pci_get_device(dev) == PCI_PRODUCT_LUCENT_ET1310_FAST) + sc->sc_flags |= ET_FLAG_FASTETHER; + error = et_bus_config(sc); if (error) goto fail; @@ -487,7 +488,89 @@ et_miibus_writereg(device_t dev, int phy static void et_miibus_statchg(device_t dev) { - et_setmedia(device_get_softc(dev)); + struct et_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t cfg1, cfg2, ctrl; + int i; + + sc = device_get_softc(dev); + + mii = device_get_softc(sc->sc_miibus); + ifp = sc->ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + sc->sc_flags &= ~ET_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->sc_flags |= ET_FLAG_LINK; + break; + case IFM_1000_T: + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + sc->sc_flags |= ET_FLAG_LINK; + break; + } + } + + /* XXX Stop TX/RX MAC? */ + if ((sc->sc_flags & ET_FLAG_LINK) == 0) + return; + + /* Program MACs with resolved speed/duplex/flow-control. */ + ctrl = CSR_READ_4(sc, ET_MAC_CTRL); + ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + cfg1 &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | + ET_MAC_CFG1_LOOPBACK); + cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); + cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | + ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); + cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | + ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & + ET_MAC_CFG2_PREAMBLE_LEN_MASK); + + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) + cfg2 |= ET_MAC_CFG2_MODE_GMII; + else { + cfg2 |= ET_MAC_CFG2_MODE_MII; + ctrl |= ET_MAC_CTRL_MODE_MII; + } + + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { + cfg2 |= ET_MAC_CFG2_FDX; +#ifdef notyet + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) + cfg1 |= ET_MAC_CFG1_TXFLOW; + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) + cfg1 |= ET_MAC_CFG1_RXFLOW; +#endif + } else + ctrl |= ET_MAC_CTRL_GHDX; + + CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); + CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + cfg1 |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; + CSR_WRITE_4(sc, ET_MAC_CFG1, cfg1); + +#define NRETRY 50 + + for (i = 0; i < NRETRY; ++i) { + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + if ((cfg1 & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == + (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) + break; + DELAY(100); + } + if (i == NRETRY) + if_printf(ifp, "can't enable RX/TX\n"); + sc->sc_flags |= ET_FLAG_TXRX_ENABLED; + +#undef NRETRY } static int @@ -518,10 +601,17 @@ et_ifmedia_upd(struct ifnet *ifp) static void et_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; + sc = ifp->if_softc; ET_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + ET_UNLOCK(sc); + return; + } + + mii = device_get_softc(sc->sc_miibus); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; @@ -539,14 +629,16 @@ et_stop(struct et_softc *sc) /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); + CSR_WRITE_4(sc, ET_MAC_CFG1, CSR_READ_4(sc, ET_MAC_CFG1) & ~( + ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN)); + DELAY(100); + et_stop_rxdma(sc); et_stop_txdma(sc); et_free_tx_ring(sc); et_free_rx_ring(sc); - et_reset(sc); - sc->sc_tx = 0; sc->sc_tx_intr = 0; sc->sc_flags &= ~ET_FLAG_TXRX_ENABLED; @@ -1104,6 +1196,7 @@ et_init_locked(struct et_softc *sc) return; et_stop(sc); + et_reset(sc); et_init_tx_ring(sc); error = et_init_rx_ring(sc); @@ -1112,22 +1205,33 @@ et_init_locked(struct et_softc *sc) error = et_chip_init(sc); if (error) - goto back; + goto fail; - error = et_enable_txrx(sc, 1); + /* + * Start TX/RX DMA engine + */ + error = et_start_rxdma(sc); if (error) - goto back; + return; + + error = et_start_txdma(sc); + if (error) + return; /* Enable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); - callout_reset(&sc->sc_tick, hz, et_tick, sc); - CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; -back: + + sc->sc_flags &= ~ET_FLAG_LINK; + et_ifmedia_upd_locked(ifp); + + callout_reset(&sc->sc_tick, hz, et_tick, sc); + +fail: if (error) et_stop(sc); } @@ -1239,10 +1343,10 @@ et_start_locked(struct ifnet *ifp) sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) - return; - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || + (sc->sc_flags & (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) != + (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) return; /* @@ -1870,56 +1974,6 @@ et_start_txdma(struct et_softc *sc) return (0); } -static int -et_enable_txrx(struct et_softc *sc, int media_upd) -{ - struct ifnet *ifp = sc->ifp; - uint32_t val; - int i, error; - - val = CSR_READ_4(sc, ET_MAC_CFG1); - val |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; - val &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | - ET_MAC_CFG1_LOOPBACK); - CSR_WRITE_4(sc, ET_MAC_CFG1, val); - - if (media_upd) - et_ifmedia_upd_locked(ifp); - else - et_setmedia(sc); - -#define NRETRY 50 - - for (i = 0; i < NRETRY; ++i) { - val = CSR_READ_4(sc, ET_MAC_CFG1); - if ((val & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == - (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) - break; - - DELAY(100); - } - if (i == NRETRY) { - if_printf(ifp, "can't enable RX/TX\n"); - return (0); - } - sc->sc_flags |= ET_FLAG_TXRX_ENABLED; - -#undef NRETRY - - /* - * Start TX/RX DMA engine - */ - error = et_start_rxdma(sc); - if (error) - return (error); - - error = et_start_txdma(sc); - if (error) - return (error); - - return (0); -} - static void et_rxeof(struct et_softc *sc) { @@ -2192,6 +2246,7 @@ et_txeof(struct et_softc *sc) if (tbd->tbd_used + ET_NSEG_SPARE < ET_TX_NDESC) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } + static void et_tick(void *xsc) { @@ -2204,13 +2259,6 @@ et_tick(void *xsc) mii = device_get_softc(sc->sc_miibus); mii_tick(mii); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0 && - (mii->mii_media_status & IFM_ACTIVE) && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - if_printf(ifp, "Link up, enable TX/RX\n"); - if (et_enable_txrx(sc, 0) == 0) - et_start_locked(ifp); - } if (et_watchdog(sc) == EJUSTRETURN) return; callout_reset(&sc->sc_tick, hz, et_tick, sc); @@ -2398,38 +2446,6 @@ back: return (error); } -static void -et_setmedia(struct et_softc *sc) -{ - struct mii_data *mii = device_get_softc(sc->sc_miibus); - uint32_t cfg2, ctrl; - - cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); - cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | - ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); - cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | - ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & - ET_MAC_CFG2_PREAMBLE_LEN_MASK); - - ctrl = CSR_READ_4(sc, ET_MAC_CTRL); - ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); - - if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) { - cfg2 |= ET_MAC_CFG2_MODE_GMII; - } else { - cfg2 |= ET_MAC_CFG2_MODE_MII; - ctrl |= ET_MAC_CTRL_MODE_MII; - } - - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) - cfg2 |= ET_MAC_CFG2_FDX; - else - ctrl |= ET_MAC_CTRL_GHDX; - - CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); - CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); -} - static int et_suspend(device_t dev) { Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Wed Dec 7 21:17:50 2011 (r228330) +++ head/sys/dev/et/if_etvar.h Wed Dec 7 21:29:51 2011 (r228331) @@ -289,7 +289,9 @@ struct et_softc { #define ET_FLAG_PCIE 0x0001 #define ET_FLAG_MSI 0x0002 +#define ET_FLAG_FASTETHER 0x0004 #define ET_FLAG_TXRX_ENABLED 0x0100 #define ET_FLAG_JUMBO 0x0200 +#define ET_FLAG_LINK 0x8000 #endif /* !_IF_ETVAR_H */ From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 21:46:09 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E764106564A; Wed, 7 Dec 2011 21:46:09 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C44E8FC12; Wed, 7 Dec 2011 21:46:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7Lk9bD057130; Wed, 7 Dec 2011 21:46:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7Lk9L8057126; Wed, 7 Dec 2011 21:46:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072146.pB7Lk9L8057126@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 21:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228332 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:46:09 -0000 Author: yongari Date: Wed Dec 7 21:46:09 2011 New Revision: 228332 URL: http://svn.freebsd.org/changeset/base/228332 Log: Implement hardware MAC statistics counter. Counters could be queried with dev.et.%d.stats sysctl node where %d is an instance of device. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 21:29:51 2011 (r228331) +++ head/sys/dev/et/if_et.c Wed Dec 7 21:46:09 2011 (r228332) @@ -146,6 +146,7 @@ static int et_bus_config(struct et_softc static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); +static void et_stats_update(struct et_softc *); static const struct et_dev { uint16_t vid; @@ -635,6 +636,7 @@ et_stop(struct et_softc *sc) et_stop_rxdma(sc); et_stop_txdma(sc); + et_stats_update(sc); et_free_tx_ring(sc); et_free_rx_ring(sc); @@ -2049,7 +2051,6 @@ et_rxeof(struct et_softc *sc) m = rbd->rbd_buf[buf_idx].rb_mbuf; if ((rxst_info1 & ET_RXST_INFO1_OK) == 0){ /* Discard errored frame. */ - ifp->if_ierrors++; rbd->rbd_discard(rbd, buf_idx); } else if (rbd->rbd_newbuf(rbd, buf_idx) != 0) { /* No available mbufs, discard it. */ @@ -2063,7 +2064,6 @@ et_rxeof(struct et_softc *sc) } else { m->m_pkthdr.len = m->m_len = buflen; m->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; ET_UNLOCK(sc); ifp->if_input(ifp, m); ET_LOCK(sc); @@ -2229,7 +2229,6 @@ et_txeof(struct et_softc *sc) bus_dmamap_unload(sc->sc_tx_tag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; - ifp->if_opackets++; } if (++tbd->tbd_start_index == ET_TX_NDESC) { @@ -2259,6 +2258,7 @@ et_tick(void *xsc) mii = device_get_softc(sc->sc_miibus); mii_tick(mii); + et_stats_update(sc); if (et_watchdog(sc) == EJUSTRETURN) return; callout_reset(&sc->sc_tick, hz, et_tick, sc); @@ -2371,6 +2371,11 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, return (0); } +#define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) +#define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + /* * Create sysctl tree */ @@ -2378,7 +2383,9 @@ static void et_add_sysctls(struct et_softc * sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children; + struct sysctl_oid_list *children, *parent; + struct sysctl_oid *tree; + struct et_hw_stats *stats; ctx = device_get_sysctl_ctx(sc->dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); @@ -2394,8 +2401,116 @@ et_add_sysctls(struct et_softc * sc) "TX IM, # segments per TX interrupt"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "timer", CTLFLAG_RW, &sc->sc_timer, 0, "TX timer"); + + tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "ET statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* TX/RX statistics. */ + stats = &sc->sc_stats; + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_64", &stats->pkts_64, + "0 to 64 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_65_127", &stats->pkts_65, + "65 to 127 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_128_255", &stats->pkts_128, + "128 to 255 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_256_511", &stats->pkts_256, + "256 to 511 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_512_1023", &stats->pkts_512, + "512 to 1023 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1024_1518", &stats->pkts_1024, + "1024 to 1518 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1519_1522", &stats->pkts_1519, + "1519 to 1522 bytes frames"); + + /* RX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "RX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->rx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->rx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->rx_crcerrs, "CRC errors"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->rx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->rx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->rx_control, "Control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->rx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "unknown_control", + &stats->rx_unknown_control, "Unknown control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "align_errs", + &stats->rx_alignerrs, "Alignment errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "len_errs", + &stats->rx_lenerrs, "Frames with length mismatched"); + ET_SYSCTL_STAT_ADD32(ctx, children, "code_errs", + &stats->rx_codeerrs, "Frames with code error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "cs_errs", + &stats->rx_cserrs, "Frames with carrier sense error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "runts", + &stats->rx_runts, "Too short frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->rx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->rx_fragments, "Fragmented frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->rx_jabbers, "Frames with jabber error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->rx_drop, "Dropped frames"); + + /* TX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "TX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->tx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->tx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->tx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->tx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->tx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "deferred", + &stats->tx_deferred, "Deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_deferred", + &stats->tx_excess_deferred, "Excessively deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "single_colls", + &stats->tx_single_colls, "Single collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "multi_colls", + &stats->tx_multi_colls, "Multiple collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "late_colls", + &stats->tx_late_colls, "Late collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_colls", + &stats->tx_excess_colls, "Excess collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "total_colls", + &stats->tx_total_colls, "Total collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause_honored", + &stats->tx_pause_honored, "Honored pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->tx_drop, "Dropped frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->tx_jabbers, "Frames with jabber errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->tx_crcerrs, "Frames with CRC errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->tx_control, "Control frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->tx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "undersize", + &stats->tx_undersize, "Undersized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->tx_fragments, "Fragmented frames"); } +#undef ET_SYSCTL_STAT_ADD32 +#undef ET_SYSCTL_STAT_ADD64 + static int et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_ARGS) { @@ -2446,6 +2561,73 @@ back: return (error); } +static void +et_stats_update(struct et_softc *sc) +{ + struct ifnet *ifp; + struct et_hw_stats *stats; + + stats = &sc->sc_stats; + stats->pkts_64 += CSR_READ_4(sc, ET_STAT_PKTS_64); + stats->pkts_65 += CSR_READ_4(sc, ET_STAT_PKTS_65_127); + stats->pkts_128 += CSR_READ_4(sc, ET_STAT_PKTS_128_255); + stats->pkts_256 += CSR_READ_4(sc, ET_STAT_PKTS_256_511); + stats->pkts_512 += CSR_READ_4(sc, ET_STAT_PKTS_512_1023); + stats->pkts_1024 += CSR_READ_4(sc, ET_STAT_PKTS_1024_1518); + stats->pkts_1519 += CSR_READ_4(sc, ET_STAT_PKTS_1519_1522); + + stats->rx_bytes += CSR_READ_4(sc, ET_STAT_RX_BYTES); + stats->rx_frames += CSR_READ_4(sc, ET_STAT_RX_FRAMES); + stats->rx_crcerrs += CSR_READ_4(sc, ET_STAT_RX_CRC_ERR); + stats->rx_mcast += CSR_READ_4(sc, ET_STAT_RX_MCAST); + stats->rx_bcast += CSR_READ_4(sc, ET_STAT_RX_BCAST); + stats->rx_control += CSR_READ_4(sc, ET_STAT_RX_CTL); + stats->rx_pause += CSR_READ_4(sc, ET_STAT_RX_PAUSE); + stats->rx_unknown_control += CSR_READ_4(sc, ET_STAT_RX_UNKNOWN_CTL); + stats->rx_alignerrs += CSR_READ_4(sc, ET_STAT_RX_ALIGN_ERR); + stats->rx_lenerrs += CSR_READ_4(sc, ET_STAT_RX_LEN_ERR); + stats->rx_codeerrs += CSR_READ_4(sc, ET_STAT_RX_CODE_ERR); + stats->rx_cserrs += CSR_READ_4(sc, ET_STAT_RX_CS_ERR); + stats->rx_runts += CSR_READ_4(sc, ET_STAT_RX_RUNT); + stats->rx_oversize += CSR_READ_4(sc, ET_STAT_RX_OVERSIZE); + stats->rx_fragments += CSR_READ_4(sc, ET_STAT_RX_FRAG); + stats->rx_jabbers += CSR_READ_4(sc, ET_STAT_RX_JABBER); + stats->rx_drop += CSR_READ_4(sc, ET_STAT_RX_DROP); + + stats->tx_bytes += CSR_READ_4(sc, ET_STAT_TX_BYTES); + stats->tx_frames += CSR_READ_4(sc, ET_STAT_TX_FRAMES); + stats->tx_mcast += CSR_READ_4(sc, ET_STAT_TX_MCAST); + stats->tx_bcast += CSR_READ_4(sc, ET_STAT_TX_BCAST); + stats->tx_pause += CSR_READ_4(sc, ET_STAT_TX_PAUSE); + stats->tx_deferred += CSR_READ_4(sc, ET_STAT_TX_DEFER); + stats->tx_excess_deferred += CSR_READ_4(sc, ET_STAT_TX_EXCESS_DEFER); + stats->tx_single_colls += CSR_READ_4(sc, ET_STAT_TX_SINGLE_COL); + stats->tx_multi_colls += CSR_READ_4(sc, ET_STAT_TX_MULTI_COL); + stats->tx_late_colls += CSR_READ_4(sc, ET_STAT_TX_LATE_COL); + stats->tx_excess_colls += CSR_READ_4(sc, ET_STAT_TX_EXCESS_COL); + stats->tx_total_colls += CSR_READ_4(sc, ET_STAT_TX_TOTAL_COL); + stats->tx_pause_honored += CSR_READ_4(sc, ET_STAT_TX_PAUSE_HONOR); + stats->tx_drop += CSR_READ_4(sc, ET_STAT_TX_DROP); + stats->tx_jabbers += CSR_READ_4(sc, ET_STAT_TX_JABBER); + stats->tx_crcerrs += CSR_READ_4(sc, ET_STAT_TX_CRC_ERR); + stats->tx_control += CSR_READ_4(sc, ET_STAT_TX_CTL); + stats->tx_oversize += CSR_READ_4(sc, ET_STAT_TX_OVERSIZE); + stats->tx_undersize += CSR_READ_4(sc, ET_STAT_TX_UNDERSIZE); + stats->tx_fragments += CSR_READ_4(sc, ET_STAT_TX_FRAG); + + /* Update ifnet counters. */ + ifp = sc->ifp; + ifp->if_opackets = (u_long)stats->tx_frames; + ifp->if_collisions = stats->tx_total_colls; + ifp->if_oerrors = stats->tx_drop + stats->tx_jabbers + + stats->tx_crcerrs + stats->tx_excess_deferred + + stats->tx_late_colls; + ifp->if_ipackets = (u_long)stats->rx_frames; + ifp->if_ierrors = stats->rx_crcerrs + stats->rx_alignerrs + + stats->rx_lenerrs + stats->rx_codeerrs + stats->rx_cserrs + + stats->rx_runts + stats->rx_jabbers + stats->rx_drop; +} + static int et_suspend(device_t dev) { Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Wed Dec 7 21:29:51 2011 (r228331) +++ head/sys/dev/et/if_etreg.h Wed Dec 7 21:46:09 2011 (r228332) @@ -318,6 +318,52 @@ #define ET_MAC_ADDR1 0x5040 #define ET_MAC_ADDR2 0x5044 +/* MAC statistics counters. */ +#define ET_STAT_PKTS_64 0x6080 +#define ET_STAT_PKTS_65_127 0x6084 +#define ET_STAT_PKTS_128_255 0x6088 +#define ET_STAT_PKTS_256_511 0x608C +#define ET_STAT_PKTS_512_1023 0x6090 +#define ET_STAT_PKTS_1024_1518 0x6094 +#define ET_STAT_PKTS_1519_1522 0x6098 +#define ET_STAT_RX_BYTES 0x609C +#define ET_STAT_RX_FRAMES 0x60A0 +#define ET_STAT_RX_CRC_ERR 0x60A4 +#define ET_STAT_RX_MCAST 0x60A8 +#define ET_STAT_RX_BCAST 0x60AC +#define ET_STAT_RX_CTL 0x60B0 +#define ET_STAT_RX_PAUSE 0x60B4 +#define ET_STAT_RX_UNKNOWN_CTL 0x60B8 +#define ET_STAT_RX_ALIGN_ERR 0x60BC +#define ET_STAT_RX_LEN_ERR 0x60C0 +#define ET_STAT_RX_CODE_ERR 0x60C4 +#define ET_STAT_RX_CS_ERR 0x60C8 +#define ET_STAT_RX_RUNT 0x60CC +#define ET_STAT_RX_OVERSIZE 0x60D0 +#define ET_STAT_RX_FRAG 0x60D4 +#define ET_STAT_RX_JABBER 0x60D8 +#define ET_STAT_RX_DROP 0x60DC +#define ET_STAT_TX_BYTES 0x60E0 +#define ET_STAT_TX_FRAMES 0x60E4 +#define ET_STAT_TX_MCAST 0x60E8 +#define ET_STAT_TX_BCAST 0x60EC +#define ET_STAT_TX_PAUSE 0x60F0 +#define ET_STAT_TX_DEFER 0x60F4 +#define ET_STAT_TX_EXCESS_DEFER 0x60F8 +#define ET_STAT_TX_SINGLE_COL 0x60FC +#define ET_STAT_TX_MULTI_COL 0x6100 +#define ET_STAT_TX_LATE_COL 0x6104 +#define ET_STAT_TX_EXCESS_COL 0x6108 +#define ET_STAT_TX_TOTAL_COL 0x610C +#define ET_STAT_TX_PAUSE_HONOR 0x6110 +#define ET_STAT_TX_DROP 0x6114 +#define ET_STAT_TX_JABBER 0x6118 +#define ET_STAT_TX_CRC_ERR 0x611C +#define ET_STAT_TX_CTL 0x6120 +#define ET_STAT_TX_OVERSIZE 0x6124 +#define ET_STAT_TX_UNDERSIZE 0x6128 +#define ET_STAT_TX_FRAG 0x612C + #define ET_MMC_CTRL 0x7000 #define ET_MMC_CTRL_ENABLE 0x00000001 #define ET_MMC_CTRL_ARB_DISABLE 0x00000002 Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Wed Dec 7 21:29:51 2011 (r228331) +++ head/sys/dev/et/if_etvar.h Wed Dec 7 21:46:09 2011 (r228332) @@ -231,6 +231,56 @@ struct et_rxbuf_data { void (*rbd_discard)(struct et_rxbuf_data *, int); }; +struct et_hw_stats { + /* RX/TX stats. */ + uint64_t pkts_64; + uint64_t pkts_65; + uint64_t pkts_128; + uint64_t pkts_256; + uint64_t pkts_512; + uint64_t pkts_1024; + uint64_t pkts_1519; + /* RX stats. */ + uint64_t rx_bytes; + uint64_t rx_frames; + uint32_t rx_crcerrs; + uint64_t rx_mcast; + uint64_t rx_bcast; + uint32_t rx_control; + uint32_t rx_pause; + uint32_t rx_unknown_control; + uint32_t rx_alignerrs; + uint32_t rx_lenerrs; + uint32_t rx_codeerrs; + uint32_t rx_cserrs; + uint32_t rx_runts; + uint64_t rx_oversize; + uint32_t rx_fragments; + uint32_t rx_jabbers; + uint32_t rx_drop; + /* TX stats. */ + uint64_t tx_bytes; + uint64_t tx_frames; + uint64_t tx_mcast; + uint64_t tx_bcast; + uint32_t tx_pause; + uint32_t tx_deferred; + uint32_t tx_excess_deferred; + uint32_t tx_single_colls; + uint32_t tx_multi_colls; + uint32_t tx_late_colls; + uint32_t tx_excess_colls; + uint32_t tx_total_colls; + uint32_t tx_pause_honored; + uint32_t tx_drop; + uint32_t tx_jabbers; + uint32_t tx_crcerrs; + uint32_t tx_control; + uint64_t tx_oversize; + uint32_t tx_undersize; + uint32_t tx_fragments; +}; + struct et_softc { struct ifnet *ifp; device_t dev; @@ -271,6 +321,7 @@ struct et_softc { struct et_rxbuf_data sc_rx_data[ET_RX_NRING]; struct et_txbuf_data sc_tx_data; + struct et_hw_stats sc_stats; uint32_t sc_tx; uint32_t sc_tx_intr; From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 21:54:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DB30106564A; Wed, 7 Dec 2011 21:54:44 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D58D8FC0A; Wed, 7 Dec 2011 21:54:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7LsiKa057437; Wed, 7 Dec 2011 21:54:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7LsiXb057435; Wed, 7 Dec 2011 21:54:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072154.pB7LsiXb057435@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 21:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228333 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:54:44 -0000 Author: yongari Date: Wed Dec 7 21:54:44 2011 New Revision: 228333 URL: http://svn.freebsd.org/changeset/base/228333 Log: Protect SIOCSIFMTU ioctl handler with driver lock. Don't blindly re-initialize controller whenever MTU is changed. Now, reinitializing is done only when driver is running. While here, remove unnecessary assignment of error value since it was already initialized to 0. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 21:46:09 2011 (r228332) +++ head/sys/dev/et/if_et.c Wed Dec 7 21:54:44 2011 (r228333) @@ -1287,11 +1287,11 @@ et_ioctl(struct ifnet *ifp, u_long cmd, ET_LOCK(sc); et_setmulti(sc); ET_UNLOCK(sc); - error = 0; } break; case SIOCSIFMTU: + ET_LOCK(sc); #if 0 if (sc->sc_flags & ET_FLAG_JUMBO) max_framelen = ET_JUMBO_FRAMELEN; @@ -1301,14 +1301,18 @@ et_ioctl(struct ifnet *ifp, u_long cmd, if (ET_FRAMELEN(ifr->ifr_mtu) > max_framelen) { error = EOPNOTSUPP; + ET_UNLOCK(sc); break; } if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - et_init(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + } } + ET_UNLOCK(sc); break; case SIOCSIFCAP: From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 22:04:57 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 610BF1065675; Wed, 7 Dec 2011 22:04:57 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 505228FC15; Wed, 7 Dec 2011 22:04:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7M4vl9057846; Wed, 7 Dec 2011 22:04:57 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7M4vfa057843; Wed, 7 Dec 2011 22:04:57 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072204.pB7M4vfa057843@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 22:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228335 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 22:04:57 -0000 Author: yongari Date: Wed Dec 7 22:04:57 2011 New Revision: 228335 URL: http://svn.freebsd.org/changeset/base/228335 Log: Consistently use a tab character instead of using either a space or tab after #define. While I'm here consistently use capital letters when it uses hexadecimal notation. No functional changes. Modified: head/sys/dev/et/if_etreg.h head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Wed Dec 7 21:55:11 2011 (r228334) +++ head/sys/dev/et/if_etreg.h Wed Dec 7 22:04:57 2011 (r228335) @@ -38,11 +38,11 @@ #ifndef _IF_ETREG_H #define _IF_ETREG_H -#define ET_MEM_TXSIZE_EX 182 -#define ET_MEM_RXSIZE_MIN 608 -#define ET_MEM_RXSIZE_DEFAULT 11216 -#define ET_MEM_SIZE 16384 -#define ET_MEM_UNIT 16 +#define ET_MEM_TXSIZE_EX 182 +#define ET_MEM_RXSIZE_MIN 608 +#define ET_MEM_RXSIZE_DEFAULT 11216 +#define ET_MEM_SIZE 16384 +#define ET_MEM_UNIT 16 /* * PCI registers @@ -53,270 +53,270 @@ * ET_PCIV_REPLAY_TIMER_{128,256} are from * PCI EXPRESS BASE SPECIFICATION, REV. 1.0a, Table 3-4 */ -#define ET_PCIR_BAR PCIR_BAR(0) +#define ET_PCIR_BAR PCIR_BAR(0) -#define ET_PCIR_DEVICE_CAPS 0x4c -#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ -#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 -#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 +#define ET_PCIR_DEVICE_CAPS 0x4C +#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ +#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 +#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 -#define ET_PCIR_DEVICE_CTRL 0x50 -#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ -#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 +#define ET_PCIR_DEVICE_CTRL 0x50 +#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ +#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 -#define ET_PCIR_MAC_ADDR0 0xa4 -#define ET_PCIR_MAC_ADDR1 0xa8 +#define ET_PCIR_MAC_ADDR0 0xA4 +#define ET_PCIR_MAC_ADDR1 0xA8 -#define ET_PCIR_EEPROM_STATUS 0xb2 /* XXX undocumented */ -#define ET_PCIM_EEPROM_STATUS_ERROR 0x4c +#define ET_PCIR_EEPROM_STATUS 0xB2 /* XXX undocumented */ +#define ET_PCIM_EEPROM_STATUS_ERROR 0x4C -#define ET_PCIR_ACK_LATENCY 0xc0 -#define ET_PCIV_ACK_LATENCY_128 237 -#define ET_PCIV_ACK_LATENCY_256 416 +#define ET_PCIR_ACK_LATENCY 0xC0 +#define ET_PCIV_ACK_LATENCY_128 237 +#define ET_PCIV_ACK_LATENCY_256 416 -#define ET_PCIR_REPLAY_TIMER 0xc2 -#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ -#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) +#define ET_PCIR_REPLAY_TIMER 0xC2 +#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ +#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) +#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIR_L0S_L1_LATENCY 0xcf +#define ET_PCIR_L0S_L1_LATENCY 0xCF /* * CSR */ -#define ET_TXQUEUE_START 0x0000 -#define ET_TXQUEUE_END 0x0004 -#define ET_RXQUEUE_START 0x0008 -#define ET_RXQUEUE_END 0x000c -#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) -#define ET_QUEUE_ADDR_START 0 -#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) - -#define ET_PM 0x0010 -#define ET_PM_SYSCLK_GATE 0x00000008 -#define ET_PM_TXCLK_GATE 0x00000010 -#define ET_PM_RXCLK_GATE 0x00000020 - -#define ET_INTR_STATUS 0x0018 -#define ET_INTR_MASK 0x001c - -#define ET_SWRST 0x0028 -#define ET_SWRST_TXDMA 0x00000001 -#define ET_SWRST_RXDMA 0x00000002 -#define ET_SWRST_TXMAC 0x00000004 -#define ET_SWRST_RXMAC 0x00000008 -#define ET_SWRST_MAC 0x00000010 -#define ET_SWRST_MAC_STAT 0x00000020 -#define ET_SWRST_MMC 0x00000040 -#define ET_SWRST_SELFCLR_DISABLE 0x80000000 - -#define ET_MSI_CFG 0x0030 - -#define ET_LOOPBACK 0x0034 - -#define ET_TIMER 0x0038 - -#define ET_TXDMA_CTRL 0x1000 -#define ET_TXDMA_CTRL_HALT 0x00000001 -#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 -#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ - -#define ET_TX_RING_HI 0x1004 -#define ET_TX_RING_LO 0x1008 -#define ET_TX_RING_CNT 0x100c - -#define ET_TX_STATUS_HI 0x101c -#define ET_TX_STATUS_LO 0x1020 - -#define ET_TX_READY_POS 0x1024 -#define ET_TX_READY_POS_INDEX_MASK 0x000003FF -#define ET_TX_READY_POS_WRAP 0x00000400 - -#define ET_TX_DONE_POS 0x1060 -#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF -#define ET_TX_DONE_POS_WRAP 0x000000400 - -#define ET_RXDMA_CTRL 0x2000 -#define ET_RXDMA_CTRL_HALT 0x00000001 -#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 -#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ -#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ -#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ -#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ -#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 -#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 -#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ -#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ -#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ -#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ -#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 -#define ET_RXDMA_CTRL_HALTED 0x00020000 - -#define ET_RX_STATUS_LO 0x2004 -#define ET_RX_STATUS_HI 0x2008 - -#define ET_RX_INTR_NPKTS 0x200c -#define ET_RX_INTR_DELAY 0x2010 - -#define ET_RXSTAT_LO 0x2020 -#define ET_RXSTAT_HI 0x2024 -#define ET_RXSTAT_CNT 0x2028 - -#define ET_RXSTAT_POS 0x2030 -#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF -#define ET_RXSTAT_POS_WRAP 0x00001000 - -#define ET_RXSTAT_MINCNT 0x2038 - -#define ET_RX_RING0_LO 0x203c -#define ET_RX_RING0_HI 0x2040 -#define ET_RX_RING0_CNT 0x2044 - -#define ET_RX_RING0_POS 0x204c -#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING0_POS_WRAP 0x00000400 - -#define ET_RX_RING0_MINCNT 0x2054 - -#define ET_RX_RING1_LO 0x2058 -#define ET_RX_RING1_HI 0x205c -#define ET_RX_RING1_CNT 0x2060 - -#define ET_RX_RING1_POS 0x2068 -#define ET_RX_RING1_POS_INDEX 0x000003FF -#define ET_RX_RING1_POS_WRAP 0x00000400 - -#define ET_RX_RING1_MINCNT 0x2070 - -#define ET_TXMAC_CTRL 0x3000 -#define ET_TXMAC_CTRL_ENABLE 0x00000001 -#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 - -#define ET_TXMAC_FLOWCTRL 0x3010 - -#define ET_RXMAC_CTRL 0x4000 -#define ET_RXMAC_CTRL_ENABLE 0x00000001 -#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 -#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 - -#define ET_WOL_CRC 0x4004 -#define ET_WOL_SA_LO 0x4010 -#define ET_WOL_SA_HI 0x4014 -#define ET_WOL_MASK 0x4018 - -#define ET_UCAST_FILTADDR1 0x4068 -#define ET_UCAST_FILTADDR2 0x406c -#define ET_UCAST_FILTADDR3 0x4070 - -#define ET_MULTI_HASH 0x4074 - -#define ET_PKTFILT 0x4084 -#define ET_PKTFILT_BCAST 0x00000001 -#define ET_PKTFILT_MCAST 0x00000002 -#define ET_PKTFILT_UCAST 0x00000004 -#define ET_PKTFILT_FRAG 0x00000008 -#define ET_PKTFILT_MINLEN_MASK 0x007F0000 -#define ET_PKTFILT_MINLEN_SHIFT 16 - -#define ET_RXMAC_MC_SEGSZ 0x4088 -#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 -#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 -#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC -#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) -#define ET_RXMAC_CUT_THRU_FRMLEN 8074 - -#define ET_RXMAC_MC_WATERMARK 0x408c -#define ET_RXMAC_SPACE_AVL 0x4094 - -#define ET_RXMAC_MGT 0x4098 -#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 -#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 -#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 -#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 - -#define ET_MAC_CFG1 0x5000 -#define ET_MAC_CFG1_TXEN 0x00000001 -#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 -#define ET_MAC_CFG1_RXEN 0x00000004 -#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 -#define ET_MAC_CFG1_TXFLOW 0x00000010 -#define ET_MAC_CFG1_RXFLOW 0x00000020 -#define ET_MAC_CFG1_LOOPBACK 0x00000100 -#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 -#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 -#define ET_MAC_CFG1_RST_TXMC 0x00040000 -#define ET_MAC_CFG1_RST_RXMC 0x00080000 -#define ET_MAC_CFG1_SIM_RST 0x40000000 -#define ET_MAC_CFG1_SOFT_RST 0x80000000 - -#define ET_MAC_CFG2 0x5004 -#define ET_MAC_CFG2_FDX 0x00000001 -#define ET_MAC_CFG2_CRC 0x00000002 -#define ET_MAC_CFG2_PADCRC 0x00000004 -#define ET_MAC_CFG2_LENCHK 0x00000010 -#define ET_MAC_CFG2_BIGFRM 0x00000020 -#define ET_MAC_CFG2_MODE_MII 0x00000100 -#define ET_MAC_CFG2_MODE_GMII 0x00000200 -#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 -#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 - -#define ET_IPG 0x5008 -#define ET_IPG_B2B_MASK 0x0000007F -#define ET_IPG_MINIFG_MASK 0x0000FF00 -#define ET_IPG_NONB2B_2_MASK 0x007F0000 -#define ET_IPG_NONB2B_1_MASK 0x7F000000 -#define ET_IPG_B2B_SHIFT 0 -#define ET_IPG_MINIFG_SHIFT 8 -#define ET_IPG_NONB2B_2_SHIFT 16 -#define ET_IPG_NONB2B_1_SHIFT 24 - -#define ET_MAC_HDX 0x500c -#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF -#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 -#define ET_MAC_HDX_EXC_DEFER 0x00010000 -#define ET_MAC_HDX_NOBACKOFF 0x00020000 -#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 -#define ET_MAC_HDX_ALT_BEB 0x00080000 -#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 -#define ET_MAC_HDX_COLLWIN_SHIFT 0 -#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 -#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 - -#define ET_MAX_FRMLEN 0x5010 - -#define ET_MII_CFG 0x5020 -#define ET_MII_CFG_CLKRST 0x00000007 -#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 -#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 -#define ET_MII_CFG_RST 0x80000000 - -#define ET_MII_CMD 0x5024 -#define ET_MII_CMD_READ 0x00000001 - -#define ET_MII_ADDR 0x5028 -#define ET_MII_ADDR_REG_MASK 0x0000001F -#define ET_MII_ADDR_PHY_MASK 0x00001F00 -#define ET_MII_ADDR_REG_SHIFT 0 -#define ET_MII_ADDR_PHY_SHIFT 8 - -#define ET_MII_CTRL 0x502c -#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF -#define ET_MII_CTRL_VALUE_SHIFT 0 - -#define ET_MII_STAT 0x5030 -#define ET_MII_STAT_VALUE_MASK 0x0000FFFF - -#define ET_MII_IND 0x5034 -#define ET_MII_IND_BUSY 0x00000001 -#define ET_MII_IND_INVALID 0x00000004 - -#define ET_MAC_CTRL 0x5038 -#define ET_MAC_CTRL_MODE_MII 0x01000000 -#define ET_MAC_CTRL_LHDX 0x02000000 -#define ET_MAC_CTRL_GHDX 0x04000000 +#define ET_TXQUEUE_START 0x0000 +#define ET_TXQUEUE_END 0x0004 +#define ET_RXQUEUE_START 0x0008 +#define ET_RXQUEUE_END 0x000C +#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) +#define ET_QUEUE_ADDR_START 0 +#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) + +#define ET_PM 0x0010 +#define ET_PM_SYSCLK_GATE 0x00000008 +#define ET_PM_TXCLK_GATE 0x00000010 +#define ET_PM_RXCLK_GATE 0x00000020 + +#define ET_INTR_STATUS 0x0018 +#define ET_INTR_MASK 0x001C + +#define ET_SWRST 0x0028 +#define ET_SWRST_TXDMA 0x00000001 +#define ET_SWRST_RXDMA 0x00000002 +#define ET_SWRST_TXMAC 0x00000004 +#define ET_SWRST_RXMAC 0x00000008 +#define ET_SWRST_MAC 0x00000010 +#define ET_SWRST_MAC_STAT 0x00000020 +#define ET_SWRST_MMC 0x00000040 +#define ET_SWRST_SELFCLR_DISABLE 0x80000000 + +#define ET_MSI_CFG 0x0030 + +#define ET_LOOPBACK 0x0034 + +#define ET_TIMER 0x0038 + +#define ET_TXDMA_CTRL 0x1000 +#define ET_TXDMA_CTRL_HALT 0x00000001 +#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 +#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ + +#define ET_TX_RING_HI 0x1004 +#define ET_TX_RING_LO 0x1008 +#define ET_TX_RING_CNT 0x100C + +#define ET_TX_STATUS_HI 0x101C +#define ET_TX_STATUS_LO 0x1020 + +#define ET_TX_READY_POS 0x1024 +#define ET_TX_READY_POS_INDEX_MASK 0x000003FF +#define ET_TX_READY_POS_WRAP 0x00000400 + +#define ET_TX_DONE_POS 0x1060 +#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF +#define ET_TX_DONE_POS_WRAP 0x000000400 + +#define ET_RXDMA_CTRL 0x2000 +#define ET_RXDMA_CTRL_HALT 0x00000001 +#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 +#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ +#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ +#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ +#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ +#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 +#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 +#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ +#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ +#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ +#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ +#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 +#define ET_RXDMA_CTRL_HALTED 0x00020000 + +#define ET_RX_STATUS_LO 0x2004 +#define ET_RX_STATUS_HI 0x2008 + +#define ET_RX_INTR_NPKTS 0x200C +#define ET_RX_INTR_DELAY 0x2010 + +#define ET_RXSTAT_LO 0x2020 +#define ET_RXSTAT_HI 0x2024 +#define ET_RXSTAT_CNT 0x2028 + +#define ET_RXSTAT_POS 0x2030 +#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF +#define ET_RXSTAT_POS_WRAP 0x00001000 + +#define ET_RXSTAT_MINCNT 0x2038 + +#define ET_RX_RING0_LO 0x203C +#define ET_RX_RING0_HI 0x2040 +#define ET_RX_RING0_CNT 0x2044 + +#define ET_RX_RING0_POS 0x204C +#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING0_POS_WRAP 0x00000400 + +#define ET_RX_RING0_MINCNT 0x2054 + +#define ET_RX_RING1_LO 0x2058 +#define ET_RX_RING1_HI 0x205C +#define ET_RX_RING1_CNT 0x2060 + +#define ET_RX_RING1_POS 0x2068 +#define ET_RX_RING1_POS_INDEX 0x000003FF +#define ET_RX_RING1_POS_WRAP 0x00000400 + +#define ET_RX_RING1_MINCNT 0x2070 + +#define ET_TXMAC_CTRL 0x3000 +#define ET_TXMAC_CTRL_ENABLE 0x00000001 +#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 + +#define ET_TXMAC_FLOWCTRL 0x3010 + +#define ET_RXMAC_CTRL 0x4000 +#define ET_RXMAC_CTRL_ENABLE 0x00000001 +#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 +#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 + +#define ET_WOL_CRC 0x4004 +#define ET_WOL_SA_LO 0x4010 +#define ET_WOL_SA_HI 0x4014 +#define ET_WOL_MASK 0x4018 + +#define ET_UCAST_FILTADDR1 0x4068 +#define ET_UCAST_FILTADDR2 0x406C +#define ET_UCAST_FILTADDR3 0x4070 + +#define ET_MULTI_HASH 0x4074 + +#define ET_PKTFILT 0x4084 +#define ET_PKTFILT_BCAST 0x00000001 +#define ET_PKTFILT_MCAST 0x00000002 +#define ET_PKTFILT_UCAST 0x00000004 +#define ET_PKTFILT_FRAG 0x00000008 +#define ET_PKTFILT_MINLEN_MASK 0x007F0000 +#define ET_PKTFILT_MINLEN_SHIFT 16 + +#define ET_RXMAC_MC_SEGSZ 0x4088 +#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 +#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 +#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC +#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) +#define ET_RXMAC_CUT_THRU_FRMLEN 8074 + +#define ET_RXMAC_MC_WATERMARK 0x408C +#define ET_RXMAC_SPACE_AVL 0x4094 + +#define ET_RXMAC_MGT 0x4098 +#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 +#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 +#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 +#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 + +#define ET_MAC_CFG1 0x5000 +#define ET_MAC_CFG1_TXEN 0x00000001 +#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 +#define ET_MAC_CFG1_RXEN 0x00000004 +#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 +#define ET_MAC_CFG1_TXFLOW 0x00000010 +#define ET_MAC_CFG1_RXFLOW 0x00000020 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 +#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RST_TXMC 0x00040000 +#define ET_MAC_CFG1_RST_RXMC 0x00080000 +#define ET_MAC_CFG1_SIM_RST 0x40000000 +#define ET_MAC_CFG1_SOFT_RST 0x80000000 + +#define ET_MAC_CFG2 0x5004 +#define ET_MAC_CFG2_FDX 0x00000001 +#define ET_MAC_CFG2_CRC 0x00000002 +#define ET_MAC_CFG2_PADCRC 0x00000004 +#define ET_MAC_CFG2_LENCHK 0x00000010 +#define ET_MAC_CFG2_BIGFRM 0x00000020 +#define ET_MAC_CFG2_MODE_MII 0x00000100 +#define ET_MAC_CFG2_MODE_GMII 0x00000200 +#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 +#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 + +#define ET_IPG 0x5008 +#define ET_IPG_B2B_MASK 0x0000007F +#define ET_IPG_MINIFG_MASK 0x0000FF00 +#define ET_IPG_NONB2B_2_MASK 0x007F0000 +#define ET_IPG_NONB2B_1_MASK 0x7F000000 +#define ET_IPG_B2B_SHIFT 0 +#define ET_IPG_MINIFG_SHIFT 8 +#define ET_IPG_NONB2B_2_SHIFT 16 +#define ET_IPG_NONB2B_1_SHIFT 24 + +#define ET_MAC_HDX 0x500C +#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF +#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 +#define ET_MAC_HDX_EXC_DEFER 0x00010000 +#define ET_MAC_HDX_NOBACKOFF 0x00020000 +#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 +#define ET_MAC_HDX_ALT_BEB 0x00080000 +#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 +#define ET_MAC_HDX_COLLWIN_SHIFT 0 +#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 +#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 + +#define ET_MAX_FRMLEN 0x5010 + +#define ET_MII_CFG 0x5020 +#define ET_MII_CFG_CLKRST 0x00000007 +#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 +#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 +#define ET_MII_CFG_RST 0x80000000 + +#define ET_MII_CMD 0x5024 +#define ET_MII_CMD_READ 0x00000001 + +#define ET_MII_ADDR 0x5028 +#define ET_MII_ADDR_REG_MASK 0x0000001F +#define ET_MII_ADDR_PHY_MASK 0x00001F00 +#define ET_MII_ADDR_REG_SHIFT 0 +#define ET_MII_ADDR_PHY_SHIFT 8 + +#define ET_MII_CTRL 0x502C +#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF +#define ET_MII_CTRL_VALUE_SHIFT 0 + +#define ET_MII_STAT 0x5030 +#define ET_MII_STAT_VALUE_MASK 0x0000FFFF + +#define ET_MII_IND 0x5034 +#define ET_MII_IND_BUSY 0x00000001 +#define ET_MII_IND_INVALID 0x00000004 + +#define ET_MAC_CTRL 0x5038 +#define ET_MAC_CTRL_MODE_MII 0x01000000 +#define ET_MAC_CTRL_LHDX 0x02000000 +#define ET_MAC_CTRL_GHDX 0x04000000 -#define ET_MAC_ADDR1 0x5040 -#define ET_MAC_ADDR2 0x5044 +#define ET_MAC_ADDR1 0x5040 +#define ET_MAC_ADDR2 0x5044 /* MAC statistics counters. */ #define ET_STAT_PKTS_64 0x6080 @@ -364,48 +364,48 @@ #define ET_STAT_TX_UNDERSIZE 0x6128 #define ET_STAT_TX_FRAG 0x612C -#define ET_MMC_CTRL 0x7000 -#define ET_MMC_CTRL_ENABLE 0x00000001 -#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 -#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 -#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 -#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 -#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 -#define ET_MMC_CTRL_FORCE_CE 0x00000040 +#define ET_MMC_CTRL 0x7000 +#define ET_MMC_CTRL_ENABLE 0x00000001 +#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 +#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 +#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 +#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 +#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 +#define ET_MMC_CTRL_FORCE_CE 0x00000040 /* * Interrupts */ -#define ET_INTR_TXEOF 0x00000008 -#define ET_INTR_TXDMA_ERROR 0x00000010 -#define ET_INTR_RXEOF 0x00000020 -#define ET_INTR_RXRING0_LOW 0x00000040 -#define ET_INTR_RXRING1_LOW 0x00000080 -#define ET_INTR_RXSTAT_LOW 0x00000100 -#define ET_INTR_RXDMA_ERROR 0x00000200 -#define ET_INTR_TIMER 0x00004000 -#define ET_INTR_WOL 0x00008000 -#define ET_INTR_PHY 0x00010000 -#define ET_INTR_TXMAC 0x00020000 -#define ET_INTR_RXMAC 0x00040000 -#define ET_INTR_MAC_STATS 0x00080000 -#define ET_INTR_SLAVE_TO 0x00100000 +#define ET_INTR_TXEOF 0x00000008 +#define ET_INTR_TXDMA_ERROR 0x00000010 +#define ET_INTR_RXEOF 0x00000020 +#define ET_INTR_RXRING0_LOW 0x00000040 +#define ET_INTR_RXRING1_LOW 0x00000080 +#define ET_INTR_RXSTAT_LOW 0x00000100 +#define ET_INTR_RXDMA_ERROR 0x00000200 +#define ET_INTR_TIMER 0x00004000 +#define ET_INTR_WOL 0x00008000 +#define ET_INTR_PHY 0x00010000 +#define ET_INTR_TXMAC 0x00020000 +#define ET_INTR_RXMAC 0x00040000 +#define ET_INTR_MAC_STATS 0x00080000 +#define ET_INTR_SLAVE_TO 0x00100000 -#define ET_INTRS (ET_INTR_TXEOF | \ +#define ET_INTRS (ET_INTR_TXEOF | \ ET_INTR_RXEOF | \ ET_INTR_TIMER) /* * RX ring position uses same layout */ -#define ET_RX_RING_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING_POS_WRAP 0x00000400 +#define ET_RX_RING_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING_POS_WRAP 0x00000400 /* * PCI IDs */ -#define PCI_VENDOR_LUCENT 0x11c1 -#define PCI_PRODUCT_LUCENT_ET1310 0xed00 /* ET1310 10/100/1000M Ethernet */ -#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xed01 /* ET1310 10/100M Ethernet */ +#define PCI_VENDOR_LUCENT 0x11C1 +#define PCI_PRODUCT_LUCENT_ET1310 0xED00 /* ET1310 10/100/1000M Ethernet */ +#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xED01 /* ET1310 10/100M Ethernet */ #endif /* !_IF_ETREG_H */ Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Wed Dec 7 21:55:11 2011 (r228334) +++ head/sys/dev/et/if_etvar.h Wed Dec 7 22:04:57 2011 (r228335) @@ -38,39 +38,39 @@ #ifndef _IF_ETVAR_H #define _IF_ETVAR_H -#define ET_RING_ALIGN 4096 -#define ET_STATUS_ALIGN 8 -#define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 4 - -#define ET_TX_NDESC 512 -#define ET_RX_NDESC 512 -#define ET_RX_NRING 2 -#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) - -#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) -#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) -#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) +#define ET_RING_ALIGN 4096 +#define ET_STATUS_ALIGN 8 +#define ET_NSEG_MAX 32 /* XXX no limit actually */ +#define ET_NSEG_SPARE 4 + +#define ET_TX_NDESC 512 +#define ET_RX_NDESC 512 +#define ET_RX_NRING 2 +#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) + +#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) +#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) +#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) -#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ +#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ ET_MEM_TXSIZE_EX) -#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ +#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ EVL_ENCAPLEN - ETHER_CRC_LEN) -#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ +#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ (mtu) + ETHER_CRC_LEN) -#define ET_JSLOTS (ET_RX_NDESC + 128) -#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) -#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) +#define ET_JSLOTS (ET_RX_NDESC + 128) +#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) +#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) -#define CSR_WRITE_4(sc, reg, val) \ +#define CSR_WRITE_4(sc, reg, val) \ bus_write_4((sc)->sc_mem_res, (reg), (val)) -#define CSR_READ_4(sc, reg) \ +#define CSR_READ_4(sc, reg) \ bus_read_4((sc)->sc_mem_res, (reg)) -#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) -#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) +#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) +#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) struct et_txdesc { uint32_t td_addr_hi; @@ -79,23 +79,23 @@ struct et_txdesc { uint32_t td_ctrl2; /* ET_TDCTRL2_ */ }; -#define ET_TDCTRL1_LEN_MASK 0x0000FFFF +#define ET_TDCTRL1_LEN_MASK 0x0000FFFF -#define ET_TDCTRL2_LAST_FRAG 0x00000001 -#define ET_TDCTRL2_FIRST_FRAG 0x00000002 -#define ET_TDCTRL2_INTR 0x00000004 -#define ET_TDCTRL2_CTRL_WORD 0x00000008 -#define ET_TDCTRL2_HDX_BACKP 0x00000010 -#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 -#define ET_TDCTRL2_FRAME_ERR 0x00000040 -#define ET_TDCTRL2_NO_CRC 0x00000080 -#define ET_TDCTRL2_MAC_OVRRD 0x00000100 -#define ET_TDCTRL2_PAD_PACKET 0x00000200 -#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 -#define ET_TDCTRL2_INS_VLAN 0x00000800 -#define ET_TDCTRL2_CSUM_IP 0x00001000 -#define ET_TDCTRL2_CSUM_TCP 0x00002000 -#define ET_TDCTRL2_CSUM_UDP 0x00004000 +#define ET_TDCTRL2_LAST_FRAG 0x00000001 +#define ET_TDCTRL2_FIRST_FRAG 0x00000002 +#define ET_TDCTRL2_INTR 0x00000004 +#define ET_TDCTRL2_CTRL_WORD 0x00000008 +#define ET_TDCTRL2_HDX_BACKP 0x00000010 +#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 +#define ET_TDCTRL2_FRAME_ERR 0x00000040 +#define ET_TDCTRL2_NO_CRC 0x00000080 +#define ET_TDCTRL2_MAC_OVRRD 0x00000100 +#define ET_TDCTRL2_PAD_PACKET 0x00000200 +#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 +#define ET_TDCTRL2_INS_VLAN 0x00000800 +#define ET_TDCTRL2_CSUM_IP 0x00001000 +#define ET_TDCTRL2_CSUM_TCP 0x00002000 +#define ET_TDCTRL2_CSUM_UDP 0x00004000 struct et_rxdesc { uint32_t rd_addr_lo; @@ -103,56 +103,56 @@ struct et_rxdesc { uint32_t rd_ctrl; /* ET_RDCTRL_ */ }; -#define ET_RDCTRL_BUFIDX_MASK 0x000003FF +#define ET_RDCTRL_BUFIDX_MASK 0x000003FF struct et_rxstat { uint32_t rxst_info1; uint32_t rxst_info2; /* ET_RXST_INFO2_ */ }; -#define ET_RXST_INFO1_HASH_PASS 0x00000001 -#define ET_RXST_INFO1_IPCSUM 0x00000002 -#define ET_RXST_INFO1_IPCSUM_OK 0x00000004 -#define ET_RXST_INFO1_TCPCSUM 0x00000008 -#define ET_RXST_INFO1_TCPCSUM_OK 0x00000010 -#define ET_RXST_INFO1_WOL 0x00000020 -#define ET_RXST_INFO1_RXMAC_ERR 0x00000040 -#define ET_RXST_INFO1_DROP 0x00000080 -#define ET_RXST_INFO1_FRAME_TRUNC 0x00000100 -#define ET_RXST_INFO1_JUMBO 0x00000200 -#define ET_RXST_INFO1_VLAN 0x00000400 -#define ET_RXST_INFO1_PREV_FRMAE_DROP 0x00010000 -#define ET_RXST_INFO1_SHORT 0x00020000 -#define ET_RXST_INFO1_BAD_CARRIER 0x00040000 -#define ET_RXST_INFO1_CODE_ERR 0x00080000 -#define ET_RXST_INFO1_CRC_ERR 0x00100000 -#define ET_RXST_INFO1_LEN_MISMATCH 0x00200000 -#define ET_RXST_INFO1_TOO_LONG 0x00400000 -#define ET_RXST_INFO1_OK 0x00800000 -#define ET_RXST_INFO1_MULTICAST 0x01000000 -#define ET_RXST_INFO1_BROADCAST 0x02000000 -#define ET_RXST_INFO1_DRIBBLE 0x04000000 -#define ET_RXST_INFO1_CTL_FRAME 0x08000000 -#define ET_RXST_INFO1_PAUSE_FRAME 0x10000000 -#define ET_RXST_INFO1_UNKWN_CTL_FRAME 0x20000000 -#define ET_RXST_INFO1_VLAN_TAG 0x40000000 -#define ET_RXST_INFO1_LONG_EVENT 0x80000000 - -#define ET_RXST_INFO2_LEN_MASK 0x0000FFFF -#define ET_RXST_INFO2_LEN_SHIFT 0 -#define ET_RXST_INFO2_BUFIDX_MASK 0x03FF0000 -#define ET_RXST_INFO2_BUFIDX_SHIFT 16 -#define ET_RXST_INFO2_RINGIDX_MASK 0x0C000000 -#define ET_RXST_INFO2_RINGIDX_SHIFT 26 +#define ET_RXST_INFO1_HASH_PASS 0x00000001 +#define ET_RXST_INFO1_IPCSUM 0x00000002 +#define ET_RXST_INFO1_IPCSUM_OK 0x00000004 +#define ET_RXST_INFO1_TCPCSUM 0x00000008 +#define ET_RXST_INFO1_TCPCSUM_OK 0x00000010 +#define ET_RXST_INFO1_WOL 0x00000020 +#define ET_RXST_INFO1_RXMAC_ERR 0x00000040 +#define ET_RXST_INFO1_DROP 0x00000080 +#define ET_RXST_INFO1_FRAME_TRUNC 0x00000100 +#define ET_RXST_INFO1_JUMBO 0x00000200 +#define ET_RXST_INFO1_VLAN 0x00000400 +#define ET_RXST_INFO1_PREV_FRMAE_DROP 0x00010000 +#define ET_RXST_INFO1_SHORT 0x00020000 +#define ET_RXST_INFO1_BAD_CARRIER 0x00040000 +#define ET_RXST_INFO1_CODE_ERR 0x00080000 +#define ET_RXST_INFO1_CRC_ERR 0x00100000 +#define ET_RXST_INFO1_LEN_MISMATCH 0x00200000 +#define ET_RXST_INFO1_TOO_LONG 0x00400000 +#define ET_RXST_INFO1_OK 0x00800000 +#define ET_RXST_INFO1_MULTICAST 0x01000000 +#define ET_RXST_INFO1_BROADCAST 0x02000000 +#define ET_RXST_INFO1_DRIBBLE 0x04000000 +#define ET_RXST_INFO1_CTL_FRAME 0x08000000 +#define ET_RXST_INFO1_PAUSE_FRAME 0x10000000 +#define ET_RXST_INFO1_UNKWN_CTL_FRAME 0x20000000 +#define ET_RXST_INFO1_VLAN_TAG 0x40000000 +#define ET_RXST_INFO1_LONG_EVENT 0x80000000 + +#define ET_RXST_INFO2_LEN_MASK 0x0000FFFF +#define ET_RXST_INFO2_LEN_SHIFT 0 +#define ET_RXST_INFO2_BUFIDX_MASK 0x03FF0000 +#define ET_RXST_INFO2_BUFIDX_SHIFT 16 +#define ET_RXST_INFO2_RINGIDX_MASK 0x0C000000 +#define ET_RXST_INFO2_RINGIDX_SHIFT 26 struct et_rxstatus { uint32_t rxs_ring; uint32_t rxs_stat_ring; /* ET_RXS_STATRING_ */ }; -#define ET_RXS_STATRING_INDEX_MASK 0x0FFF0000 -#define ET_RXS_STATRING_INDEX_SHIFT 16 -#define ET_RXS_STATRING_WRAP 0x10000000 +#define ET_RXS_STATRING_INDEX_MASK 0x0FFF0000 +#define ET_RXS_STATRING_INDEX_SHIFT 16 +#define ET_RXS_STATRING_WRAP 0x10000000 struct et_txbuf { struct mbuf *tb_mbuf; @@ -334,15 +334,15 @@ struct et_softc { uint32_t sc_timer; }; -#define ET_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) -#define ET_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) -#define ET_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) - -#define ET_FLAG_PCIE 0x0001 -#define ET_FLAG_MSI 0x0002 -#define ET_FLAG_FASTETHER 0x0004 -#define ET_FLAG_TXRX_ENABLED 0x0100 -#define ET_FLAG_JUMBO 0x0200 -#define ET_FLAG_LINK 0x8000 +#define ET_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define ET_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define ET_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) + +#define ET_FLAG_PCIE 0x0001 +#define ET_FLAG_MSI 0x0002 +#define ET_FLAG_FASTETHER 0x0004 +#define ET_FLAG_TXRX_ENABLED 0x0100 +#define ET_FLAG_JUMBO 0x0200 +#define ET_FLAG_LINK 0x8000 #endif /* !_IF_ETVAR_H */ From owner-svn-src-head@FreeBSD.ORG Wed Dec 7 23:20:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2965106566B; Wed, 7 Dec 2011 23:20:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B94A78FC08; Wed, 7 Dec 2011 23:20:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7NKEAI060256; Wed, 7 Dec 2011 23:20:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7NKEIM060253; Wed, 7 Dec 2011 23:20:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072320.pB7NKEIM060253@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 23:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228336 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 23:20:15 -0000 Author: yongari Date: Wed Dec 7 23:20:14 2011 New Revision: 228336 URL: http://svn.freebsd.org/changeset/base/228336 Log: Disable all clocks and put PHY into COMA before entering into suspend state. This will save more power. On resume, make sure to enable all clocks. While I'm here, if controller is not fast ethernet, enable gigabit PHY. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 22:04:57 2011 (r228335) +++ head/sys/dev/et/if_et.c Wed Dec 7 23:20:14 2011 (r228336) @@ -220,6 +220,7 @@ et_attach(device_t dev) struct et_softc *sc; struct ifnet *ifp; uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t pmcfg; int cap, error, msic; sc = device_get_softc(dev); @@ -304,8 +305,11 @@ et_attach(device_t dev) et_get_eaddr(dev, eaddr); - CSR_WRITE_4(sc, ET_PM, - ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); et_reset(sc); @@ -2636,11 +2640,18 @@ static int et_suspend(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) et_stop(sc); + /* Diable all clocks and put PHY into COMA. */ + pmcfg = CSR_READ_4(sc, ET_PM); + pmcfg &= ~(EM_PM_GIGEPHY_ENB | ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | + ET_PM_RXCLK_GATE); + pmcfg |= ET_PM_PHY_SW_COMA; + CSR_WRITE_4(sc, ET_PM, pmcfg); ET_UNLOCK(sc); return (0); } @@ -2649,9 +2660,15 @@ static int et_resume(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); if ((sc->ifp->if_flags & IFF_UP) != 0) et_init_locked(sc); ET_UNLOCK(sc); Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Wed Dec 7 22:04:57 2011 (r228335) +++ head/sys/dev/et/if_etreg.h Wed Dec 7 23:20:14 2011 (r228336) @@ -93,9 +93,11 @@ #define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) #define ET_PM 0x0010 +#define EM_PM_GIGEPHY_ENB 0x00000001 #define ET_PM_SYSCLK_GATE 0x00000008 #define ET_PM_TXCLK_GATE 0x00000010 #define ET_PM_RXCLK_GATE 0x00000020 +#define ET_PM_PHY_SW_COMA 0x00000040 #define ET_INTR_STATUS 0x0018 #define ET_INTR_MASK 0x001C From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 02:40:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66DEB106564A; Thu, 8 Dec 2011 02:40:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 565878FC0C; Thu, 8 Dec 2011 02:40:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB82ekIL066641; Thu, 8 Dec 2011 02:40:46 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB82ek4Q066638; Thu, 8 Dec 2011 02:40:46 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112080240.pB82ek4Q066638@svn.freebsd.org> From: Eitan Adler Date: Thu, 8 Dec 2011 02:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228342 - head/contrib/tzcode/zic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 02:40:46 -0000 Author: eadler (ports committer) Date: Thu Dec 8 02:40:46 2011 New Revision: 228342 URL: http://svn.freebsd.org/changeset/base/228342 Log: - set progname for use in usage() PR: bin/162908 Submitted by: Oleg Ginzburg Approved by: sbruno@ MFC after: 3 days Modified: head/contrib/tzcode/zic/zdump.c Modified: head/contrib/tzcode/zic/zdump.c ============================================================================== --- head/contrib/tzcode/zic/zdump.c Thu Dec 8 00:56:23 2011 (r228341) +++ head/contrib/tzcode/zic/zdump.c Thu Dec 8 02:40:46 2011 (r228342) @@ -260,6 +260,7 @@ char * argv[]; register struct tm * tmp; register struct tm * newtmp; + progname=argv[0]; INITIALIZE(cutlotime); INITIALIZE(cuthitime); #if HAVE_GETTEXT From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 03:20:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56ABA1065672; Thu, 8 Dec 2011 03:20:39 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 468058FC0C; Thu, 8 Dec 2011 03:20:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB83KdeA068177; Thu, 8 Dec 2011 03:20:39 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB83KdkV068175; Thu, 8 Dec 2011 03:20:39 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112080320.pB83KdkV068175@svn.freebsd.org> From: Eitan Adler Date: Thu, 8 Dec 2011 03:20:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228343 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 03:20:39 -0000 Author: eadler (ports committer) Date: Thu Dec 8 03:20:38 2011 New Revision: 228343 URL: http://svn.freebsd.org/changeset/base/228343 Log: - Fix ktrace leakage if error is set PR: kern/163098 Submitted by: Loganaden Velvindron Approved by: sbruno@ MFC after: 1 month Modified: head/sys/kern/kern_ktrace.c Modified: head/sys/kern/kern_ktrace.c ============================================================================== --- head/sys/kern/kern_ktrace.c Thu Dec 8 02:40:46 2011 (r228342) +++ head/sys/kern/kern_ktrace.c Thu Dec 8 03:20:38 2011 (r228343) @@ -478,7 +478,7 @@ ktrsysret(code, error, retval) ktp = &req->ktr_data.ktr_sysret; ktp->ktr_code = code; ktp->ktr_error = error; - ktp->ktr_retval = retval; /* what about val2 ? */ + ktp->ktr_retval = ((error == 0) ? retval: 0); /* what about val2 ? */ ktr_submitrequest(curthread, req); } From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 03:20:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6896A106564A; Thu, 8 Dec 2011 03:20:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5859A8FC15; Thu, 8 Dec 2011 03:20:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB83Kmsw068220; Thu, 8 Dec 2011 03:20:48 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB83KmCO068218; Thu, 8 Dec 2011 03:20:48 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112080320.pB83KmCO068218@svn.freebsd.org> From: Eitan Adler Date: Thu, 8 Dec 2011 03:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228344 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 03:20:48 -0000 Author: eadler (ports committer) Date: Thu Dec 8 03:20:48 2011 New Revision: 228344 URL: http://svn.freebsd.org/changeset/base/228344 Log: - Add support for Support SEAGATE DAT Scopion 130 PR: kern/141934 Submitted by: HASHI Hiroaki Approved by: sbruno@ MFC after: 1 week Modified: head/sys/cam/scsi/scsi_sa.c Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Thu Dec 8 03:20:38 2011 (r228343) +++ head/sys/cam/scsi/scsi_sa.c Thu Dec 8 03:20:48 2011 (r228344) @@ -334,6 +334,10 @@ static struct sa_quirk_entry sa_quirk_ta "STT20000*", "*"}, SA_QUIRK_1FM, 0 }, { + { T_SEQUENTIAL, SIP_MEDIA_REMOVABLE, "SEAGATE", + "DAT 06241-XXX", "*"}, SA_QUIRK_VARIABLE|SA_QUIRK_2FM, 0 + }, + { { T_SEQUENTIAL, SIP_MEDIA_REMOVABLE, "TANDBERG", " TDC 3600", "U07:"}, SA_QUIRK_NOCOMP|SA_QUIRK_1FM, 512 }, From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 07:33:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE9571065672; Thu, 8 Dec 2011 07:33:10 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 91CAA8FC0A; Thu, 8 Dec 2011 07:33:10 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 5841C74C; Thu, 8 Dec 2011 08:33:09 +0100 (CET) Date: Thu, 8 Dec 2011 08:32:10 +0100 From: Pawel Jakub Dawidek To: Eitan Adler Message-ID: <20111208073210.GC1678@garage.freebsd.pl> References: <201112080240.pB82ek4Q066638@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WplhKdTI2c8ulnbP" Content-Disposition: inline In-Reply-To: <201112080240.pB82ek4Q066638@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228342 - head/contrib/tzcode/zic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 07:33:11 -0000 --WplhKdTI2c8ulnbP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 08, 2011 at 02:40:46AM +0000, Eitan Adler wrote: > Author: eadler (ports committer) > Date: Thu Dec 8 02:40:46 2011 > New Revision: 228342 > URL: http://svn.freebsd.org/changeset/base/228342 >=20 > Log: > - set progname for use in usage() > =20 > PR: bin/162908 > Submitted by: Oleg Ginzburg > Approved by: sbruno@ > MFC after: 3 days >=20 > Modified: > head/contrib/tzcode/zic/zdump.c >=20 > Modified: head/contrib/tzcode/zic/zdump.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/contrib/tzcode/zic/zdump.c Thu Dec 8 00:56:23 2011 (r228341) > +++ head/contrib/tzcode/zic/zdump.c Thu Dec 8 02:40:46 2011 (r228342) > @@ -260,6 +260,7 @@ char * argv[]; > register struct tm * tmp; > register struct tm * newtmp; > =20 > + progname=3Dargv[0]; > INITIALIZE(cutlotime); > INITIALIZE(cuthitime); > #if HAVE_GETTEXT It will good to to try to upstream it as this is contributed code. This change doesn't seem to be consistent with the style of this file. They use spaces around =3D. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --WplhKdTI2c8ulnbP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk7gZ/oACgkQForvXbEpPzRjswCeOZA0Gpw/p36FXaY0MV7aLz58 X8cAoO/iWsc+o5QPAchS4V0b2figXRy7 =Bh37 -----END PGP SIGNATURE----- --WplhKdTI2c8ulnbP-- From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 11:13:10 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7E0D106564A; Thu, 8 Dec 2011 11:13:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 12EC68FC0A; Thu, 8 Dec 2011 11:13:09 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pB8BD4KR027877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Dec 2011 22:13:06 +1100 Date: Thu, 8 Dec 2011 22:13:04 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <20111208073210.GC1678@garage.freebsd.pl> Message-ID: <20111208200957.F1091@besplex.bde.org> References: <201112080240.pB82ek4Q066638@svn.freebsd.org> <20111208073210.GC1678@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler Subject: Re: svn commit: r228342 - head/contrib/tzcode/zic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 11:13:10 -0000 On Thu, 8 Dec 2011, Pawel Jakub Dawidek wrote: > On Thu, Dec 08, 2011 at 02:40:46AM +0000, Eitan Adler wrote: >> Log: >> - set progname for use in usage() >> >> Modified: head/contrib/tzcode/zic/zdump.c >> ============================================================================== >> --- head/contrib/tzcode/zic/zdump.c Thu Dec 8 00:56:23 2011 (r228341) >> +++ head/contrib/tzcode/zic/zdump.c Thu Dec 8 02:40:46 2011 (r228342) >> @@ -260,6 +260,7 @@ char * argv[]; >> register struct tm * tmp; >> register struct tm * newtmp; >> >> + progname=argv[0]; >> INITIALIZE(cutlotime); >> INITIALIZE(cuthitime); >> #if HAVE_GETTEXT > > It will good to to try to upstream it as this is contributed code. > This change doesn't seem to be consistent with the style of this file. > They use spaces around =. Also, if this were not contrib'ed code, then using progname in it would involve 2 layers of style bugs: - user-visible layer: in FreeBSD, the program name printed by usage() is literal and doesn't depend on the pathname with which the program was invoked. In old versions of zdump in FreeBSD, one of the main changes was to convert it to FreeBSD style. Old versions were also missing the uninitialization of progrname, even in the vendor version: % Index: zdump.c % =================================================================== % RCS file: /home/ncvs/src/usr.sbin/zic/zdump.c,v % retrieving revision 1.1.1.4 % retrieving revision 1.9 % diff -r1.1.1.4 -r1.9 % ... % 130d132 % < static char * progname; % 131a134 % > static void usage(void); % 160d162 % < progname = argv[0]; % 163,164c165 % < (void) printf("%s\n", elsieid); % < (void) exit(EXIT_SUCCESS); % --- % > errx(EXIT_SUCCESS, "%s", elsieid); % 174,177c175 % < (void) fprintf(stderr, % < _("%s: usage is %s [ --version ] [ -v ] [ -c cutoff ] zonename ...\n"), % < argv[0], argv[0]); % < (void) exit(EXIT_FAILURE); % --- % > usage(); % 204,207c202,205 % < (fakeenv[0] = (char *) malloc(longest + 4)) == NULL) { % < (void) perror(progname); % < (void) exit(EXIT_FAILURE); % < } % --- % > (fakeenv[0] = (char *) malloc((size_t) (longest + % > 4))) == NULL) % > errx(EXIT_FAILURE, % > _("malloc() failed")); % 266,270c264,265 % < if (fflush(stdout) || ferror(stdout)) { % < (void) fprintf(stderr, "%s: ", argv[0]); % < (void) perror(_("Error writing standard output")); % < (void) exit(EXIT_FAILURE); % < } % --- % > if (fflush(stdout) || ferror(stdout)) % > errx(EXIT_FAILURE, _("error writing standard output")); % 277a273,280 % > static void % > usage(void) % > { % > fprintf(stderr, % > _("usage: zdump [--version] [-v] [-c cutoff] zonename ...\n")); % > exit(EXIT_FAILURE); % > } This change also breaks the vendor style, since it doesn't use an excessive (void) cast on the fprintf() in usage(). The other changes mostly involve changing perror() and [f]printf() to errx(). This is a user-visible change if the [f]printf() was to stdout instead of stderr, and perhaps if errx() gives better formatting than perror(). The current version uses the unportable errx() instead of perror() plus exit(), but still uses [f]printf() instead of warnx() when not exiting. I can't see any vendor version of it using cvs. - FreeBSD and NetBSD programs never use progname = argv[0] or use progname explicitly. They use getprogname(3). This is implemented by setting a variable __progname to argv[0] in crt. The setting may be changed by setprogname(3). This gives minor inconsistencies which may be considered features: usage() always prints the literal program name, while the errx() family uses getprogname() and this prints argv[0] or whatever setprogname() changed __progname too. Grepping for progname in /usr/src/*bin shows only a few violations of the above rules: % bin/chio/chio.c: " [inv]\n", getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: (void) fprintf(stderr, "usage: %s %s\n", getprogname(), cname); % bin/chio/chio.c: (void) fprintf(stderr, "usage: %s %s\n", getprogname(), cname); % bin/chio/chio.c: (void) fprintf(stderr, "usage: %s %s \n", getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: " \n", getprogname(), cname); % bin/chio/chio.c: "arg1 arg2 [arg3 [...]]\n", getprogname()); chio doesn't look like FreeBSD sources. It came from NetBSD. % bin/ps/ps.c: getprogname(), *argv); Someone broke ps. It is internally inconsistent: it prints getprogname() here, and then immediately calls usage() which prints a literal "ps". % bin/pkill/pkill.c: if (strcmp(getprogname(), "pgrep") == 0) { % bin/pkill/pkill.c: " [-t tty] [-u euid] pattern ...\n", getprogname(), pkill can be a link to pgrep. This is the only excuse for using getprograme() in usage(). __progname is actually initialized to an edited version of argv[0], with the path prefix stripped. Thus if pkill is copied to ./cat, and run from any path leading to ./cat, the above bogusly prints that its name is `cat'. When pkill is invoked under any other name that pgrep, it defaults to acting as pkill, but it doesn't change its name to pkill so what it is acting as is hard to tell from its error messages if its name is not pkill. Before getprogname() existed, usage() would probably have printed a name that matched its action using a flag set when its action was determined (acting_as_pgrep ? "pgrep" : "pkill"). Using getprogname(), the logic should probably be that if the action is defaulted then the name should be changed to match the defaulted action. But it would be clearer to default to an error, with a special usage message. This the existence of getprogname() doesn't simplify printing of the active program name in usage() for programs whose action depends on their name. % bin/echo/echo.c: char *progname = argv[0]; % bin/echo/echo.c: errexit(progname, "malloc"); % bin/echo/echo.c: errexit(progname, "write"); echo has contortions to avoid using err() since that might break sh when echo is sh's builtin. It should use getprogname() here. IIRC, this was implemented before gteprogname() existed. % sbin/newfs/newfs.c: getprogname(), SOmeone broken newfs. Fixed in my version. % sbin/fsck_ffs/main.c: getprogname()); % sbin/fsck/fsutil.c: dev, getprogname()); % sbin/fsck/fsck.c: getprogname(), common); This is probably from NetBSD> % sbin/dhclient/dhclient.c: extern char *__progname; % sbin/dhclient/dhclient.c: openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); % sbin/dhclient/dhclient.c: extern char *__progname; % sbin/dhclient/dhclient.c: fprintf(stderr, "usage: %s [-bdqu] ", __progname); Chumminess with the implementation. % sbin/mdmfs/mdmfs.c: if (strcmp(getprogname(), "mount_mfs") == 0 || % sbin/mdmfs/mdmfs.c: strcmp(getprogname(), "mfs") == 0) { % sbin/mdmfs/mdmfs.c:"\tmd-device mount-point\n", getprogname()); Because it is sometimes named mount_mfs, and this is supported (like pkill/pgrep). % sbin/hastctl/hastctl.c: getprogname()); % sbin/hastctl/hastctl.c: getprogname()); % sbin/hastctl/hastctl.c: getprogname()); % sbin/hastctl/hastctl.c: getprogname()); Apparently just style bugs. % sbin/swapon/swapon.c: getprogname(), % sbin/swapon/swapon.c: getprogname(), which_prog == SWAPOFF ? "remov" : "add", % sbin/swapon/swapon.c: fprintf(stderr, "usage: %s ", getprogname()); Because it is sometimes named swapoff or swapctl. % sbin/devfs/rule.c: setprogname("devfs rule"); % sbin/devfs/rule.c: setprogname("devfs ruleset"); Change to a strange program name with spaces in it. This name would be hard to parse if it is actually used. % sbin/md5/md5.c: const char *progname; % sbin/md5/md5.c: const char* progname; % sbin/md5/md5.c: if ((progname = strrchr(argv[0], '/')) == NULL) % sbin/md5/md5.c: progname = argv[0]; % sbin/md5/md5.c: progname++; Home made version of getprogname(). Probably written before the latter existed. % sbin/md5/md5.c: if (strcasecmp(Algorithm[digest].progname, progname) == 0) % sbin/md5/md5.c: fprintf(stderr, "usage: %s [-pqrtx] [-s string] [files ...]\n", alg->progname); Because it can have various names. [... 249 more lines] Got bored here. The above examples are enough to show that the FreeBSD style is to use getprogname() in usage() if and only if the program can have various _supported_ names (not unsupported names like a copy of /bin/rm to ./cat would have). Oops. I chose rm for maximal danger when it is renamed to a harmless command. But rm is linked to unlink. Its logic for determining its action and name are slightly broken, as for pkill/pgrep but more: - to determine whether it should act like unlink, it uses a home made getprogname(). - when its name is neither rm nor unlink, it acts like rm - when its name is unlink, it normally doesn't call usage(), so if there is an error then its name is reported as being unlink. However, it calls usage() if it has any option or no args. usage() doesn't use getprogname(), so it then prints the usage message for rm, including rm's literal name. But usage() prints the message for unlink too. usage() always prints both messages. This gives noise more for the case where the program is just rm. Related bug: the program name returned by getprogname() is initialized as if by setprogname(argv[0]). pkill.c depends on this, but this is not documented in getprogname(3). It is documented that setprogname() sets the program name to the last component of its arg, but not that initialization uses either argv[0] or setprogname() on it. The man page also says that getprogname() manipulates the program name. These bugs are fixed or moot in NetBSD's man page, but the semantics of setprogname() are very different in NetBSD (at least in 2005). In NetBSD, setprogname() is always called from crt (as in FreeBSD), but subsequent calls have no effect. It is recommended that all programs start with a call to setprogname() in main(), just for portability to systems that don't call it automatically. For systems that don't have it at all, these calls can be implemented in a special library or annulled by a macro. It's amazing how complicated keeping track of your own name is when you use a library/bureauocracy that might not exist to do it :-). Bruce From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 12:31:47 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1E47106566B; Thu, 8 Dec 2011 12:31:47 +0000 (UTC) (envelope-from rmh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1FB68FC19; Thu, 8 Dec 2011 12:31:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8CVlU9086769; Thu, 8 Dec 2011 12:31:47 GMT (envelope-from rmh@svn.freebsd.org) Received: (from rmh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8CVlKf086767; Thu, 8 Dec 2011 12:31:47 GMT (envelope-from rmh@svn.freebsd.org) Message-Id: <201112081231.pB8CVlKf086767@svn.freebsd.org> From: Robert Millan Date: Thu, 8 Dec 2011 12:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228349 - head/lib/libufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 12:31:47 -0000 Author: rmh Date: Thu Dec 8 12:31:47 2011 New Revision: 228349 URL: http://svn.freebsd.org/changeset/base/228349 Log: Make berase() work on platforms whose kernel lacks DIOCGDELETE ioctl. Approved by: kib (mentor) Modified: head/lib/libufs/block.c Modified: head/lib/libufs/block.c ============================================================================== --- head/lib/libufs/block.c Thu Dec 8 10:42:38 2011 (r228348) +++ head/lib/libufs/block.c Thu Dec 8 12:31:47 2011 (r228349) @@ -139,10 +139,56 @@ bwrite(struct uufsd *disk, ufs2_daddr_t return (cnt); } +#ifdef __FreeBSD_kernel__ + +static int +berase_helper(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) +{ + off_t ioarg[2]; + + ioarg[0] = blockno * disk->d_bsize; + ioarg[1] = size; + return (ioctl(disk->d_fd, DIOCGDELETE, ioarg)); +} + +#else + +static int +berase_helper(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) +{ + char *zero_chunk; + off_t offset, zero_chunk_size, pwrite_size; + int rv; + + offset = blockno * disk->d_bsize; + zero_chunk_size = 65536 * disk->d_bsize; + zero_chunk = calloc(1, zero_chunk_size); + if (zero_chunk == NULL) { + ERROR(disk, "failed to allocate memory"); + return (-1); + } + while (size > 0) { + pwrite_size = size; + if (pwrite_size > zero_chunk_size) + pwrite_size = zero_chunk_size; + rv = pwrite(disk->d_fd, zero_chunk, pwrite_size, offset); + if (rv == -1) { + ERROR(disk, "failed writing to disk"); + break; + } + size -= rv; + offset += rv; + rv = 0; + } + free(zero_chunk); + return (rv); +} + +#endif + int berase(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) { - off_t ioarg[2]; int rv; ERROR(disk, NULL); @@ -151,8 +197,5 @@ berase(struct uufsd *disk, ufs2_daddr_t ERROR(disk, "failed to open disk for writing"); return(rv); } - ioarg[0] = blockno * disk->d_bsize; - ioarg[1] = size; - rv = ioctl(disk->d_fd, DIOCGDELETE, ioarg); - return (rv); + return (berase_helper(disk, blockno, size)); } From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 13:54:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 288FB1065670; Thu, 8 Dec 2011 13:54:07 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15E238FC12; Thu, 8 Dec 2011 13:54:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8Ds7Y1089481; Thu, 8 Dec 2011 13:54:07 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8Ds6P2089475; Thu, 8 Dec 2011 13:54:06 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112081354.pB8Ds6P2089475@svn.freebsd.org> From: Ruslan Ermilov Date: Thu, 8 Dec 2011 13:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228351 - in head: contrib/groff/tmac gnu/usr.bin/groff/tmac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 13:54:07 -0000 Author: ru Date: Thu Dec 8 13:54:06 2011 New Revision: 228351 URL: http://svn.freebsd.org/changeset/base/228351 Log: Pull up vendor changes to mdoc(7). Modified: head/contrib/groff/tmac/doc-common head/contrib/groff/tmac/doc-syms head/contrib/groff/tmac/doc.tmac head/contrib/groff/tmac/groff_mdoc.man head/gnu/usr.bin/groff/tmac/mdoc.local Directory Properties: head/contrib/groff/ (props changed) Modified: head/contrib/groff/tmac/doc-common ============================================================================== --- head/contrib/groff/tmac/doc-common Thu Dec 8 13:45:32 2011 (r228350) +++ head/contrib/groff/tmac/doc-common Thu Dec 8 13:54:06 2011 (r228351) @@ -264,50 +264,72 @@ .ds doc-volume-as-algor algor .ds doc-volume-as-amd64 amd64 .ds doc-volume-as-amiga amiga +.ds doc-volume-as-amigappc amigappc .ds doc-volume-as-arc arc +.ds doc-volume-as-arm arm .ds doc-volume-as-arm26 arm26 .ds doc-volume-as-arm32 arm32 +.ds doc-volume-as-armish armish .ds doc-volume-as-atari atari +.ds doc-volume-as-aviion aviion +.ds doc-volume-as-beagle beagle .ds doc-volume-as-bebox bebox .ds doc-volume-as-cats cats .ds doc-volume-as-cesfic cesfic .ds doc-volume-as-cobalt cobalt .ds doc-volume-as-dreamcast dreamcast +.ds doc-volume-as-emips emips .ds doc-volume-as-evbarm evbarm .ds doc-volume-as-evbmips evbmips .ds doc-volume-as-evbppc evbppc .ds doc-volume-as-evbsh3 evbsh3 +.ds doc-volume-as-ews4800mips ews4800mips .ds doc-volume-as-hp300 hp300 .ds doc-volume-as-hp700 hp700 .ds doc-volume-as-hpcarm hpcarm .ds doc-volume-as-hpcmips hpcmips .ds doc-volume-as-hpcsh hpcsh +.ds doc-volume-as-hppa hppa +.ds doc-volume-as-hppa64 hppa64 .ds doc-volume-as-i386 i386 +.ds doc-volume-as-ia64 ia64 +.ds doc-volume-as-ibmnws ibmnws +.ds doc-volume-as-iyonix iyonix +.ds doc-volume-as-landisk landisk +.ds doc-volume-as-loongson loongson .ds doc-volume-as-luna68k luna68k +.ds doc-volume-as-luna88k luna88k .ds doc-volume-as-m68k m68k .ds doc-volume-as-mac68k mac68k .ds doc-volume-as-macppc macppc .ds doc-volume-as-mips mips +.ds doc-volume-as-mips64 mips64 .ds doc-volume-as-mipsco mipsco .ds doc-volume-as-mmeye mmeye .ds doc-volume-as-mvme68k mvme68k +.ds doc-volume-as-mvme88k mvme88k .ds doc-volume-as-mvmeppc mvmeppc .ds doc-volume-as-netwinder netwinder .ds doc-volume-as-news68k news68k .ds doc-volume-as-newsmips newsmips .ds doc-volume-as-next68k next68k .ds doc-volume-as-ofppc ofppc +.ds doc-volume-as-palm palm .ds doc-volume-as-pc532 pc532 .ds doc-volume-as-playstation2 playstation2 .ds doc-volume-as-pmax pmax .ds doc-volume-as-pmppc pmppc .ds doc-volume-as-powerpc powerpc .ds doc-volume-as-prep prep +.ds doc-volume-as-rs6000 rs6000 .ds doc-volume-as-sandpoint sandpoint .ds doc-volume-as-sbmips sbmips +.ds doc-volume-as-sgi sgi .ds doc-volume-as-sgimips sgimips .ds doc-volume-as-sh3 sh3 .ds doc-volume-as-shark shark +.ds doc-volume-as-socppc socppc +.ds doc-volume-as-solbourne solbourne .ds doc-volume-as-sparc sparc .ds doc-volume-as-sparc64 sparc64 .ds doc-volume-as-sun2 sun2 @@ -316,6 +338,8 @@ .ds doc-volume-as-vax vax .ds doc-volume-as-x68k x68k .ds doc-volume-as-x86_64 x86_64 +.ds doc-volume-as-xen xen +.ds doc-volume-as-zaurus zaurus . .de Dt . \" reset default arguments @@ -451,12 +475,16 @@ .ds doc-operating-system-NetBSD-3.0 3.0 .ds doc-operating-system-NetBSD-3.0.1 3.0.1 .ds doc-operating-system-NetBSD-3.0.2 3.0.2 +.ds doc-operating-system-NetBSD-3.0.3 3.0.3 .ds doc-operating-system-NetBSD-3.1 3.1 +.ds doc-operating-system-NetBSD-3.1.1 3.1.1 .ds doc-operating-system-NetBSD-4.0 4.0 .ds doc-operating-system-NetBSD-4.0.1 4.0.1 .ds doc-operating-system-NetBSD-5.0 5.0 .ds doc-operating-system-NetBSD-5.0.1 5.0.1 .ds doc-operating-system-NetBSD-5.0.2 5.0.2 +.ds doc-operating-system-NetBSD-5.1 5.1 +.ds doc-operating-system-NetBSD-6.0 6.0 . .ds doc-operating-system-OpenBSD-2.0 2.0 .ds doc-operating-system-OpenBSD-2.1 2.1 @@ -487,6 +515,8 @@ .ds doc-operating-system-OpenBSD-4.6 4.6 .ds doc-operating-system-OpenBSD-4.7 4.7 .ds doc-operating-system-OpenBSD-4.8 4.8 +.ds doc-operating-system-OpenBSD-4.9 4.9 +.ds doc-operating-system-OpenBSD-5.0 5.0 . .ds doc-operating-system-FreeBSD-1.0 1.0 .ds doc-operating-system-FreeBSD-1.1 1.1 @@ -544,6 +574,7 @@ .ds doc-operating-system-FreeBSD-8.0 8.0 .ds doc-operating-system-FreeBSD-8.1 8.1 .ds doc-operating-system-FreeBSD-8.2 8.2 +.ds doc-operating-system-FreeBSD-9.0 9.0 . .ds doc-operating-system-Darwin-8.0.0 8.0.0 .ds doc-operating-system-Darwin-8.1.0 8.1.0 @@ -566,7 +597,6 @@ .ds doc-operating-system-Darwin-9.6.0 9.6.0 .ds doc-operating-system-Darwin-9.7.0 9.7.0 .ds doc-operating-system-Darwin-9.8.0 9.8.0 -.ds doc-operating-system-Darwin-10.6.0 10.6.0 .ds doc-operating-system-Darwin-10.1.0 10.1.0 .ds doc-operating-system-Darwin-10.2.0 10.2.0 .ds doc-operating-system-Darwin-10.3.0 10.3.0 @@ -593,6 +623,11 @@ .ds doc-operating-system-DragonFly-2.4 2.4 .ds doc-operating-system-DragonFly-2.6 2.6 .ds doc-operating-system-DragonFly-2.8 2.8 +.ds doc-operating-system-DragonFly-2.9 2.9 +.ds doc-operating-system-DragonFly-2.9.1 2.9.1 +.ds doc-operating-system-DragonFly-2.10 2.10 +.ds doc-operating-system-DragonFly-2.10.1 2.10.1 +.ds doc-operating-system-DragonFly-2.11 2.11 . .de Os . ds doc-command-name Modified: head/contrib/groff/tmac/doc-syms ============================================================================== --- head/contrib/groff/tmac/doc-syms Thu Dec 8 13:45:32 2011 (r228350) +++ head/contrib/groff/tmac/doc-syms Thu Dec 8 13:54:06 2011 (r228351) @@ -754,38 +754,74 @@ .\" NS .\" NS width register `Lb' defined in doc-common . +.ds doc-str-Lb-libarchive Reading and Writing Streaming Archives Library (libarchive, \-larchive) .ds doc-str-Lb-libarm ARM Architecture Library (libarm, \-larm) .ds doc-str-Lb-libarm32 ARM32 Architecture Library (libarm32, \-larm32) +.ds doc-str-Lb-libbluetooth Bluetooth Library (libbluetooth, \-lbluetooth) .ds doc-str-Lb-libbsm Basic Security Module Library (libbsm, \-lbsm) .ds doc-str-Lb-libc Standard C\~Library (libc, \-lc) +.ds doc-str-Lb-libc_r Reentrant C\~Library (libc_r, \-lc_r) +.ds doc-str-Lb-libcalendar Calendar Arithmetic Library (libcalendar, \-lcalendar) +.ds doc-str-Lb-libcam Common Access Method User Library (libcam, \-lcam) .ds doc-str-Lb-libcdk Curses Development Kit Library (libcdk, \-lcdk) +.ds doc-str-Lb-libcipher FreeSec Crypt Library (libcipher, \-lcipher) .ds doc-str-Lb-libcompat Compatibility Library (libcompat, \-lcompat) .ds doc-str-Lb-libcrypt Crypt Library (libcrypt, \-lcrypt) .ds doc-str-Lb-libcurses Curses Library (libcurses, \-lcurses) +.ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-ldevinfo) +.ds doc-str-Lb-libdevstat Device Statistics Library (libdevstat, \-ldevstat) +.ds doc-str-Lb-libdisk Interface to Slice and Partition Labels Library (libdisk, \-ldisk) +.ds doc-str-Lb-libdwarf DWARF Access Library (libdwarf, \-ldwarf) .ds doc-str-Lb-libedit Command Line Editor Library (libedit, \-ledit) +.ds doc-str-Lb-libelf ELF Access Library (libelf, \-lelf) .ds doc-str-Lb-libevent Event Notification Library (libevent, \-levent) +.ds doc-str-Lb-libfetch File Transfer Library for URLs (libfetch, \-lfetch) .ds doc-str-Lb-libform Curses Form Library (libform, \-lform) +.ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom) +.ds doc-str-Lb-libgpib General-Purpose Instrument Bus (GPIB) library (libgpib, \-lgpib) .ds doc-str-Lb-libi386 i386 Architecture Library (libi386, \-li386) .ds doc-str-Lb-libintl Internationalized Message Handling Library (libintl, \-lintl) .ds doc-str-Lb-libipsec IPsec Policy Control Library (libipsec, \-lipsec) +.ds doc-str-Lb-libipx IPX Address Conversion Support Library (libipx, \-lipx) +.ds doc-str-Lb-libiscsi iSCSI protocol library (libiscsi, \-liscsi) +.ds doc-str-Lb-libjail Jail Library (libjail, \-ljail) +.ds doc-str-Lb-libkiconv Kernel side iconv library (libkiconv, \-lkiconv) +.ds doc-str-Lb-libkse N:M Threading Library (libkse, \-lkse) .ds doc-str-Lb-libkvm Kernel Data Access Library (libkvm, \-lkvm) .ds doc-str-Lb-libm Math Library (libm, \-lm) .ds doc-str-Lb-libm68k m68k Architecture Library (libm68k, \-lm68k) .ds doc-str-Lb-libmagic Magic Number Recognition Library (libmagic, \-lmagic) +.ds doc-str-Lb-libmd Message Digest (MD4, MD5, etc.) Support Library (libmd, \-lmd) +.ds doc-str-Lb-libmemstat Kernel Memory Allocator Statistics Library (libmemstat, \-lmemstat) .ds doc-str-Lb-libmenu Curses Menu Library (libmenu, \-lmenu) +.ds doc-str-Lb-libnetgraph Netgraph User Library (libnetgraph, \-lnetgraph) +.ds doc-str-Lb-libnetpgp Netpgp signing, verification, encryption and decryption (libnetpgp, \-lnetpgp) .ds doc-str-Lb-libossaudio OSS Audio Emulation Library (libossaudio, \-lossaudio) .ds doc-str-Lb-libpam Pluggable Authentication Module Library (libpam, \-lpam) .ds doc-str-Lb-libpcap Packet Capture Library (libpcap, \-lpcap) .ds doc-str-Lb-libpci PCI Bus Access Library (libpci, \-lpci) .ds doc-str-Lb-libpmc Performance Counters Library (libpmc, \-lpmc) .ds doc-str-Lb-libposix \*[Px] \*[doc-str-Lb]Compatibility Library (libposix, \-lposix) +.ds doc-str-Lb-libprop Property Container Object Library (libprop, \-lprop) .ds doc-str-Lb-libpthread \*[Px] \*[doc-str-Lb]Threads Library (libpthread, \-lpthread) +.ds doc-str-Lb-libpuffs puffs Convenience Library (libpuffs, \-lpuffs) +.ds doc-str-Lb-librefuse File System in Userspace Convenience Library (librefuse, \-lrefuse) .ds doc-str-Lb-libresolv DNS Resolver Library (libresolv, \-lresolv) +.ds doc-str-Lb-librpcsec_gss RPC GSS-API Authentication Library (librpcsec_gss, \-lrpcsec_gss) +.ds doc-str-Lb-librpcsvc RPC Service Library (librpcsvc, \-lrpcsvc) .ds doc-str-Lb-librt \*[Px] \*[doc-str-Lb]Real-time Library (librt, \-lrt) +.ds doc-str-Lb-libsdp Bluetooth Service Discovery Protocol User Library (libsdp, \-lsdp) +.ds doc-str-Lb-libssp Buffer Overflow Protection Library (libssp, \-lssp) .ds doc-str-Lb-libSystem System Library (libSystem, \-lSystem) .ds doc-str-Lb-libtermcap Termcap Access Library (libtermcap, \-ltermcap) +.ds doc-str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo) +.ds doc-str-Lb-libthr 1:1 Threading Library (libthr, \-lthr) +.ds doc-str-Lb-libufs UFS File System Access Library (libufs, \-lufs) +.ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) +.ds doc-str-Lb-libulog User Login Record Library (libulog, \-lulog) .ds doc-str-Lb-libusbhid USB Human Interface Devices Library (libusbhid, \-lusbhid) .ds doc-str-Lb-libutil System Utilities Library (libutil, \-lutil) +.ds doc-str-Lb-libvgl Video Graphics Library (libvgl, \-lvgl) .ds doc-str-Lb-libx86_64 x86_64 Architecture Library (libx86_64, \-lx86_64) .ds doc-str-Lb-libz Compression Library (libz, \-lz) . Modified: head/contrib/groff/tmac/doc.tmac ============================================================================== --- head/contrib/groff/tmac/doc.tmac Thu Dec 8 13:45:32 2011 (r228350) +++ head/contrib/groff/tmac/doc.tmac Thu Dec 8 13:54:06 2011 (r228351) @@ -4268,7 +4268,7 @@ . if (\n[doc-arg-limit] > \n[doc-arg-ptr]) \{\ . nr doc-reg-Xr (\n[doc-arg-ptr] + 1) . \" modify second argument if it is a string and -. \" remove space inbetween +. \" remove space in between . if (\n[doc-type\n[doc-reg-Xr]] == 2) \{\ . ds doc-arg\n[doc-reg-Xr] \*[lp]\*[doc-arg\n[doc-reg-Xr]]\*[rp] . ds doc-space\n[doc-arg-ptr] @@ -5091,7 +5091,7 @@ . . .\" NS doc-build-func-string macro -.\" NS collect function arguments and set hard spaces inbetween +.\" NS collect function arguments and set hard spaces in between .\" NS .\" NS modifies: .\" NS doc-func-arg Modified: head/contrib/groff/tmac/groff_mdoc.man ============================================================================== --- head/contrib/groff/tmac/groff_mdoc.man Thu Dec 8 13:45:32 2011 (r228350) +++ head/contrib/groff/tmac/groff_mdoc.man Thu Dec 8 13:54:06 2011 (r228351) @@ -769,13 +769,18 @@ By default, the following architecture k . \# we use `No' to avoid hyphenation .Bd -ragged -offset indent -.No alpha , acorn26 , acorn32 , algor , amd64 , amiga , arc , arm26 , -.No arm32 , atari , bebox , cats , cesfic , cobalt , dreamcast , evbarm , -.No evbmips , evbppc , evbsh3 , hp300 , hp700 , hpcmips , i386 , luna68k , -.No m68k , mac68k , macppc , mips , mmeye , mvme68k , mvmeppc , netwinder , -.No news68k , newsmips , next68k , ofppc , pc532 , pmax , pmppc , powerpc , -.No prep , sandpoint , sgimips , sh3 , shark , sparc , sparc64 , sun3 , -.No tahoe , vax , x68k , x86_64 +.No acorn26 , acorn32 , algor , alpha , amd64 , amiga , amigappc , +.No arc , arm , arm26 , arm32 , armish , atari , aviion , +.No beagle , bebox , cats , cesfic , cobalt , dreamcast , +.No emips , evbarm , evbmips , evbppc , evbsh3 , ews4800mips , +.No hp300 , hp700 , hpcarm , hpcmips , hpcsh , hppa , hppa64 , +.No i386 , ia64 , ibmnws , iyonix , landisk , loongson , luna68k , luna88k , +.No m68k , mac68k , macppc , mips , mips64 , mipsco , mmeye , +.No mvme68k , mvme88k , mvmeppc , netwinder , news68k , newsmips , next68k , +.No ofppc , palm , pc532 , playstation2 , pmax , pmppc , powerpc , prep , +.No rs6000 , sandpoint , sbmips , sgi , sgimips , sh3 , shark , +.No socppc , solbourne , sparc , sparc64 , sun2 , sun3 , +.No tahoe , vax , x68k , x86_64 , xen , zaurus .Ed .Pp . @@ -864,23 +869,25 @@ the release ID. .It NetBSD 0.8, 0.8a, 0.9, 0.9a, 1.0, 1.0a, 1.1, 1.2, 1.2a, 1.2b, 1.2c, 1.2d, 1.2e, 1.3, 1.3a, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.6.1, -1.6.2, 1.6.3, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 3.0, 3.0.1, 3.0.2, 3.1, 4.0, -4.0.1, 5.0, 5.0.1, 5.0.2 +1.6.2, 1.6.3, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 3.0, 3.0.1, 3.0.2, 3.0.3, +3.1, 3.1.1, 4.0, 4.0.1, 5.0, 5.0.1, 5.0.2, 5.1, 6.0 .It FreeBSD 1.0, 1.1, 1.1.5, 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5, 2.1.6, 2.1.7, 2.2, 2.2.1, 2.2.2, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 4.0, 4.1, 4.1.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.6.2, 4.7, 4.8, 4.9, 4.10, 4.11, 5.0, 5.1, 5.2, 5.2.1, 5.3, 5.4, 5.5, 6.0, 6.1, 6.2, 6.3, 6.4, 7.0, 7.1, 7.2, 7.3, 8.0, -8.1 +8.1, 8.2, 9.0 .It OpenBSD 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, -3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8 +3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, +5.0 .It DragonFly 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 1.8.1, 1.10, 1.12, 1.12.2, 2.0, 2.2, -2.4, 2.6, 2.8 +2.4, 2.6, 2.8, 2.9, 2.9.1, 2.10, 2.10.1, 2.11 .It Darwin 8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 8.5.0, 8.6.0, 8.7.0, 8.8.0, 8.9.0, -8.10.0, 8.11.0, 9.0.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.6.0 +8.10.0, 8.11.0, 9.0.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.6.0, 9.7.0, +9.8.0, 10.1.0, 10.2.0, 10.3.0, 10.4.0, 10.5.0, 10.6.0, 10.7.0, 11.0.0 .El .Ed .Pp @@ -1673,33 +1680,73 @@ Available arguments to and their results are: . .Pp -.Bl -tag -width ".Li libossaudio" -compact -offset indent +.Bl -tag -width ".Li librpcsec_gss" -compact -offset indent +.It Li libarchive +.Lb libarchive .It Li libarm .Lb libarm .It Li libarm32 .Lb libarm32 +.It Li libbluetooth +.Lb libbluetooth +.It Li libbsm +.Lb libbsm .It Li libc .Lb libc +.It Li libc_r +.Lb libc_r +.It Li libcalendar +.Lb libcalendar +.It Li libcam +.Lb libcam .It Li libcdk .Lb libcdk +.It Li libcipher +.Lb libcipher .It Li libcompat .Lb libcompat .It Li libcrypt .Lb libcrypt .It Li libcurses .Lb libcurses +.It Li libdevinfo +.Lb libdevinfo +.It Li libdevstat +.Lb libdevstat +.It Li libdisk +.Lb libdisk +.It Li libdwarf +.Lb libdwarf .It Li libedit .Lb libedit +.It Li libelf +.Lb libelf .It Li libevent .Lb libevent +.It Li libfetch +.Lb libfetch .It Li libform .Lb libform +.It Li libgeom +.Lb libgeom +.It Li libgpib +.Lb libgpib .It Li libi386 .Lb libi386 .It Li libintl .Lb libintl .It Li libipsec .Lb libipsec +.It Li libipx +.Lb libipx +.It Li libiscsi +.Lb libiscsi +.It Li libjail +.Lb libjail +.It Li libkiconv +.Lb libkiconv +.It Li libkse +.Lb libkse .It Li libkvm .Lb libkvm .It Li libm @@ -1708,8 +1755,16 @@ and their results are: .Lb libm68k .It Li libmagic .Lb libmagic +.It Li libmd +.Lb libmd +.It Li libmemstat +.Lb libmemstat .It Li libmenu .Lb libmenu +.It Li libnetgraph +.Lb libnetgraph +.It Li libnetpgp +.Lb libnetpgp .It Li libossaudio .Lb libossaudio .It Li libpam @@ -1722,18 +1777,46 @@ and their results are: .Lb libpmc .It Li libposix .Lb libposix +.It Li libprop +.Lb libprop .It Li libpthread .Lb libpthread +.It Li libpuffs +.Lb libpuffs +.It Li librefuse +.Lb librefuse .It Li libresolv .Lb libresolv +.It Li librpcsec_gss +.Lb librpcsec_gss +.It Li librpcsvc +.Lb librpcsvc .It Li librt .Lb librt +.It Li libsdp +.Lb libsdp +.It Li libssp +.Lb libssp +.It Li libSystem +.Lb libSystem .It Li libtermcap .Lb libtermcap +.It Li libterminfo +.Lb libterminfo +.It Li libthr +.Lb libthr +.It Li libufs +.Lb libufs +.It Li libugidfw +.Lb libugidfw +.It Li libulog +.Lb libulog .It Li libusbhid .Lb libusbhid .It Li libutil .Lb libutil +.It Li libvgl +.Lb libvgl .It Li libx86_64 .Lb libx86_64 .It Li libz Modified: head/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- head/gnu/usr.bin/groff/tmac/mdoc.local Thu Dec 8 13:45:32 2011 (r228350) +++ head/gnu/usr.bin/groff/tmac/mdoc.local Thu Dec 8 13:54:06 2011 (r228351) @@ -34,41 +34,14 @@ .\" FreeBSD .Lb values .ds doc-str-Lb-libarchive Streaming Archive Library (libarchive, \-larchive) .ds doc-str-Lb-libbluetooth Bluetooth User Library (libbluetooth, \-lbluetooth) -.ds doc-str-Lb-libc_r Reentrant C\~Library (libc_r, \-lc_r) -.ds doc-str-Lb-libcalendar Calendar Arithmetic Library (libcalendar, \-lcalendar) -.ds doc-str-Lb-libcam Common Access Method User Library (libcam, \-lcam) -.ds doc-str-Lb-libcipher FreeSec Crypt Library (libcipher, \-lcipher) -.ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-ldevinfo) -.ds doc-str-Lb-libdevstat Device Statistics Library (libdevstat, \-ldevstat) -.ds doc-str-Lb-libdisk Interface to Slice and Partition Labels Library (libdisk, \-ldisk) .ds doc-str-Lb-libedit Line Editor and History Library (libedit, \-ledit) .ds doc-str-Lb-libefi EFI Runtime Services Library (libefi, \-lefi) .ds doc-str-Lb-libelf ELF Parsing Library (libelf, \-lelf) .ds doc-str-Lb-libfetch File Transfer Library (libfetch, \-lfetch) -.ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom) -.ds doc-str-Lb-libgpib General-Purpose Instrument Bus (GPIB) library (libgpib, \-lgpib) -.ds doc-str-Lb-libipx IPX Address Conversion Support Library (libipx, \-lipx) -.ds doc-str-Lb-libjail Jail Library (libjail, \-ljail) -.ds doc-str-Lb-libkiconv Kernel side iconv library (libkiconv, \-lkiconv) -.ds doc-str-Lb-libkse N:M Threading Library (libkse, \-lkse) -.ds doc-str-Lb-libmd Message Digest (MD4, MD5, etc.) Support Library (libmd, \-lmd) -.ds doc-str-Lb-libmemstat Kernel Memory Allocator Statistics Library (libmemstat, \-lmemstat) -.ds doc-str-Lb-libnetgraph Netgraph User Library (libnetgraph, \-lnetgraph) .ds doc-str-Lb-libpmc Performance Monitoring Counters Interface Library (libpmc, \-lpmc) .ds doc-str-Lb-libproc Processor Monitoring and Analysis Library (libproc, \-lproc) .ds doc-str-Lb-libprocstat Process and Files Information Retrieval (libprocstat, \-lprocstat) -.ds doc-str-Lb-librpcsec_gss RPC GSS-API Authentication Library (librpcsec_gss, \-lrpcsec_gss) -.ds doc-str-Lb-librpcsvc RPC Service Library (librpcsvc, \-lrpcsvc) .ds doc-str-Lb-librtld_db Run-time Linker Debugging Library (librtld_db, \-lrtld_db) -.ds doc-str-Lb-libsdp Bluetooth Service Discovery Protocol User Library (libsdp, \-lsdp) -.ds doc-str-Lb-libthr 1:1 Threading Library (libthr, \-lthr) -.ds doc-str-Lb-libufs UFS File System Access Library (libufs, \-lufs) -.ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) -.ds doc-str-Lb-libulog User Login Record Library (libulog, \-lulog) -.ds doc-str-Lb-libvgl Video Graphics Library (libvgl, \-lvgl) -. -.\" FreeBSD architectures not found in doc-common -.ds doc-volume-as-arm arm . .\" Default .Os value .ds doc-default-operating-system FreeBSD\~10.0 @@ -76,7 +49,6 @@ .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 .ds doc-operating-system-FreeBSD-8.3 8.3 -.ds doc-operating-system-FreeBSD-9.0 9.0 .ds doc-operating-system-FreeBSD-10.0 10.0 . .\" Definitions not (yet) in doc-syms From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 17:49:20 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 569B21065675; Thu, 8 Dec 2011 17:49:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 02CD38FC08; Thu, 8 Dec 2011 17:49:20 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id AAB1946B0D; Thu, 8 Dec 2011 12:49:19 -0500 (EST) Received: from John-Baldwins-MacBook-Air.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 18139B93A; Thu, 8 Dec 2011 12:49:19 -0500 (EST) Message-ID: <4EE0F89E.1070107@FreeBSD.org> Date: Thu, 08 Dec 2011 12:49:18 -0500 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Luigi Rizzo References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> <20111205193150.GB49118@onelab2.iet.unipi.it> In-Reply-To: <20111205193150.GB49118@onelab2.iet.unipi.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 08 Dec 2011 12:49:19 -0500 (EST) Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Marius Strobl Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 17:49:20 -0000 On 12/5/11 2:31 PM, Luigi Rizzo wrote: > On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: >> On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: > ... >>> +#ifdef DEV_NETMAP >>> + if (slot) { >>> + int si = i + na->tx_rings[txr->me].nkr_hwofs; >>> + void *addr; >>> + >>> + if (si>= na->num_tx_desc) >>> + si -= na->num_tx_desc; >>> + addr = NMB(slot + si); >>> + txr->tx_base[i].buffer_addr = >>> + htole64(vtophys(addr)); >>> + /* reload the map for netmap mode */ >>> + netmap_load_map(txr->txtag, >>> + txbuf->map, addr, na->buff_size); >>> + } >>> +#endif /* DEV_NETMAP */ >> >> Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap >> works with bounce buffers, IOMMUs etc? > > maybe. Can you suggest how to change it ? > > Consider that (not here but in other places) vtophys() is called > in a time-critical loop so performance matters a lot. As long as i > can compute the physical address in advance and cache it in my own > array, i suppose that should be fine (in which case the calls to > vtophys(addr) would become NMPB(slot + si) where the NMPB() macro > would hide translations and checks. For your use case, you probably don't want to be coping with bounce buffers at all. That is, if you are preallocating long-lived buffers that keep getting reused while netmap is active that are allocated at startup and free'd at teardown, you probably want to allocate buffers that won't require bounce buffers. That means you have to let the drivers allocate the buffers (or give you a suitable bus_dma tag since different devices have different addressing requirements, etc.). You could then use bus_dmamem_alloc() to allocate your buffers. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 18:13:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D79B106566B; Thu, 8 Dec 2011 18:13:24 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 0BCE78FC14; Thu, 8 Dec 2011 18:13:22 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 7EF597300A; Thu, 8 Dec 2011 19:29:32 +0100 (CET) Date: Thu, 8 Dec 2011 19:29:32 +0100 From: Luigi Rizzo To: John Baldwin Message-ID: <20111208182932.GA82488@onelab2.iet.unipi.it> References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> <20111205193150.GB49118@onelab2.iet.unipi.it> <4EE0F89E.1070107@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EE0F89E.1070107@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Marius Strobl Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 18:13:24 -0000 On Thu, Dec 08, 2011 at 12:49:18PM -0500, John Baldwin wrote: > On 12/5/11 2:31 PM, Luigi Rizzo wrote: > >On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: > >>On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: > >... > >>>+#ifdef DEV_NETMAP > >>>+ if (slot) { > >>>+ int si = i + na->tx_rings[txr->me].nkr_hwofs; > >>>+ void *addr; > >>>+ > >>>+ if (si>= na->num_tx_desc) > >>>+ si -= na->num_tx_desc; > >>>+ addr = NMB(slot + si); > >>>+ txr->tx_base[i].buffer_addr = > >>>+ htole64(vtophys(addr)); > >>>+ /* reload the map for netmap mode */ > >>>+ netmap_load_map(txr->txtag, > >>>+ txbuf->map, addr, na->buff_size); > >>>+ } > >>>+#endif /* DEV_NETMAP */ > >> > >>Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap > >>works with bounce buffers, IOMMUs etc? > > > >maybe. Can you suggest how to change it ? > > > >Consider that (not here but in other places) vtophys() is called > >in a time-critical loop so performance matters a lot. As long as i > >can compute the physical address in advance and cache it in my own > >array, i suppose that should be fine (in which case the calls to > >vtophys(addr) would become NMPB(slot + si) where the NMPB() macro > >would hide translations and checks. > > For your use case, you probably don't want to be coping with bounce > buffers at all. That is, if you are preallocating long-lived buffers > that keep getting reused while netmap is active that are allocated at > startup and free'd at teardown, you probably want to allocate buffers > that won't require bounce buffers. That means you have to let the > drivers allocate the buffers (or give you a suitable bus_dma tag since > different devices have different addressing requirements, etc.). You > could then use bus_dmamem_alloc() to allocate your buffers. certainly i don't want to use netmap with bounce buffers. I am not sure about IOMMU (I basically don't need it but maybe using a compatible API is always nice). Right now i am allocating a huge chunk of memory with contigmalloc. Ryan Stone suggested that a plain malloc may work as well (as long as i make sure that each buffer is within a single page). Eventually I may want to play with cache alignment (also suggested by Ryan) so allocate smaller chunks of contigmalloc'ed memory (say each buffer is 2K - 64 bytes, then a contiguous block of 64K fits exactly 33 buffers). cheers luigi may also work as long as i make sure th > > -- > John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 18:25:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 250581065672; Thu, 8 Dec 2011 18:25:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D96898FC0A; Thu, 8 Dec 2011 18:25:26 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 7386046B3B; Thu, 8 Dec 2011 13:25:26 -0500 (EST) Received: from John-Baldwins-MacBook-Air.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D20B5B93E; Thu, 8 Dec 2011 13:25:25 -0500 (EST) Message-ID: <4EE10115.3050309@FreeBSD.org> Date: Thu, 08 Dec 2011 13:25:25 -0500 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Luigi Rizzo References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> <20111205193150.GB49118@onelab2.iet.unipi.it> <4EE0F89E.1070107@FreeBSD.org> <20111208182932.GA82488@onelab2.iet.unipi.it> In-Reply-To: <20111208182932.GA82488@onelab2.iet.unipi.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 08 Dec 2011 13:25:26 -0500 (EST) Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Marius Strobl Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 18:25:27 -0000 On 12/8/11 1:29 PM, Luigi Rizzo wrote: > On Thu, Dec 08, 2011 at 12:49:18PM -0500, John Baldwin wrote: >> On 12/5/11 2:31 PM, Luigi Rizzo wrote: >>> On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: >>>> On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: >>> ... >>>>> +#ifdef DEV_NETMAP >>>>> + if (slot) { >>>>> + int si = i + na->tx_rings[txr->me].nkr_hwofs; >>>>> + void *addr; >>>>> + >>>>> + if (si>= na->num_tx_desc) >>>>> + si -= na->num_tx_desc; >>>>> + addr = NMB(slot + si); >>>>> + txr->tx_base[i].buffer_addr = >>>>> + htole64(vtophys(addr)); >>>>> + /* reload the map for netmap mode */ >>>>> + netmap_load_map(txr->txtag, >>>>> + txbuf->map, addr, na->buff_size); >>>>> + } >>>>> +#endif /* DEV_NETMAP */ >>>> >>>> Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap >>>> works with bounce buffers, IOMMUs etc? >>> >>> maybe. Can you suggest how to change it ? >>> >>> Consider that (not here but in other places) vtophys() is called >>> in a time-critical loop so performance matters a lot. As long as i >>> can compute the physical address in advance and cache it in my own >>> array, i suppose that should be fine (in which case the calls to >>> vtophys(addr) would become NMPB(slot + si) where the NMPB() macro >>> would hide translations and checks. >> >> For your use case, you probably don't want to be coping with bounce >> buffers at all. That is, if you are preallocating long-lived buffers >> that keep getting reused while netmap is active that are allocated at >> startup and free'd at teardown, you probably want to allocate buffers >> that won't require bounce buffers. That means you have to let the >> drivers allocate the buffers (or give you a suitable bus_dma tag since >> different devices have different addressing requirements, etc.). You >> could then use bus_dmamem_alloc() to allocate your buffers. > > certainly i don't want to use netmap with bounce buffers. > I am not sure about IOMMU (I basically don't need it but maybe > using a compatible API is always nice). Right now i am allocating > a huge chunk of memory with contigmalloc. > Ryan Stone suggested that a plain malloc may work as well (as long > as i make sure that each buffer is within a single page). > Eventually I may want to play with cache alignment (also suggested by Ryan) > so allocate smaller chunks of contigmalloc'ed memory (say each buffer > is 2K - 64 bytes, then a contiguous block of 64K fits exactly 33 buffers). Right, you should use bus_dmamem_alloc() instead. Internally it calls contigmalloc(). However, it will only allocate memory that your device can safely use (so if you are using a NIC that can only do 32-bit DMA addresses, it will allocate pages below 4GB avoiding bounce buffering). For the IOMMU case it will usually allocate memory from the region that is statically mapped into the IOMMU (at least some IOMMU's split the DVMA address space into two types: a mostly static region for things like descriptor rings, etc. and a dynamic region for transient I/O buffers like mbufs). If you want to design an interface that will work with a wide variety of hardware and not just ixgbe on Intel, then using bus_dma to manage DMA buffers is the correct approach. Also, back to IOMMU, if the device is doing DMA into this buffer, then you _must_ use the IOMMU on certain platforms (e.g. sparc64, probably some embedded platforms where netmap might be very nice to have). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 18:30:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDD47106564A; Thu, 8 Dec 2011 18:30:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 836EB8FC15; Thu, 8 Dec 2011 18:30:37 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 34EE346B23; Thu, 8 Dec 2011 13:30:37 -0500 (EST) Received: from John-Baldwins-MacBook-Air.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 99A0AB93E; Thu, 8 Dec 2011 13:30:36 -0500 (EST) Message-ID: <4EE1024C.6040800@FreeBSD.org> Date: Thu, 08 Dec 2011 13:30:36 -0500 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Mikolaj Golub References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <201111281330.11720.jhb@freebsd.org> <86liqt1ier.fsf@kopusha.home.net> In-Reply-To: <86liqt1ier.fsf@kopusha.home.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 08 Dec 2011 13:30:36 -0500 (EST) Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 18:30:37 -0000 On 12/3/11 3:58 PM, Mikolaj Golub wrote: > > On Mon, 28 Nov 2011 13:30:11 -0500 John Baldwin wrote: > > JB> On Thursday, November 24, 2011 3:54:06 pm Mikolaj Golub wrote: > >> Author: trociny > >> Date: Thu Nov 24 20:54:06 2011 > >> New Revision: 227956 > >> URL: http://svn.freebsd.org/changeset/base/227956 > >> > >> Log: > >> usr.bin/procstat > >> > >> Add -l flag to display resource limits. > >> > >> PR: bin/161257 > >> Reviewed by: kib > >> MFC after: 2 weeks > > JB> Thanks for doing this! Did you consider making the procstat -l output use > JB> "pretty" output similar to the output of /usr/bin/limits? For example, > JB> using "infinity" instead of -1 and using humanize_number() for finite limits > JB> that are in units of bytes? > > I tried several variants, from one where for rlimit names rlimit_ident > constants from sys/resource.h are used and units are printed as suffixes: > > PID COMM RLIMIT SOFT HARD > 46150 zsh cpu 100000S infinity > 46150 zsh fsize infinity infinity > 46150 zsh data 524288kB 524288kB > 46150 zsh stack 65536kB 65536kB > 46150 zsh core 9765625kB 9765625kB > 46150 zsh rss infinity infinity > 46150 zsh memlock infinity infinity > 46150 zsh nproc 5547 5547 > 46150 zsh nofile 11095 11095 > 46150 zsh sbsize infinity infinity > 46150 zsh vmem infinity infinity > 46150 zsh npts infinity infinity > 46150 zsh swap infinity infinity > > to one where rlimit names are the same as in limits(1) and units are printed > in separate column: > > PID COMM RLIMIT SOFT HARD UNIT > 48885 zsh cputime 100000 infinity secs > 48885 zsh filesize infinity infinity bytes > 48885 zsh datasize 524288k 524288k bytes > 48885 zsh stacksize 65536k 65536k bytes > 48885 zsh coredumpsize 95367M 95367M bytes > 48885 zsh memoryuse infinity infinity bytes > 48885 zsh memorylocked infinity infinity bytes > 48885 zsh maxprocesses 5547 5547 > 48885 zsh openfiles 11095 11095 > 48885 zsh sbsize infinity infinity bytes > 48885 zsh vmemoryuse infinity infinity bytes > 48885 zsh pseudo-terminals infinity infinity > 48885 zsh swapuse infinity infinity bytes > > Personally I like the first variant as the most compact and the easiest to > maintain but would be glad to learn what other think about this or may be have > other suggestions. > > A couple other variations: > > PID COMM RLIMIT SOFT HARD UNIT > 47062 zsh cpu 100000 infinity secs > 47062 zsh fsize infinity infinity bytes > 47062 zsh data 524288k 524288k bytes > 47062 zsh stack 67108864 67108864 bytes > 47062 zsh core 9765625k 9765625k bytes > 47062 zsh rss infinity infinity bytes > 47062 zsh memlock infinity infinity bytes > 47062 zsh nproc 5547 5547 > 47062 zsh nofile 11095 11095 > 47062 zsh sbsize infinity infinity bytes > 47062 zsh vmem infinity infinity bytes > 47062 zsh npts infinity infinity > 47062 zsh swap infinity infinity bytes > > PID COMM RLIMIT SOFT HARD UNIT > 48798 zsh cputime 100000 infinity secs > 48798 zsh filesize infinity infinity bytes > 48798 zsh datasize 524288k 524288k bytes > 48798 zsh stacksize 65536k 65536k bytes > 48798 zsh coredumpsize 95367M 95367M bytes > 48798 zsh memoryuse infinity infinity bytes > 48798 zsh memorylocked infinity infinity bytes > 48798 zsh maxprocesses 5547 5547 > 48798 zsh openfiles 11095 11095 > 48798 zsh sbsize infinity infinity bytes > 48798 zsh vmemoryuse infinity infinity bytes > 48798 zsh pseudo-terminals infinity infinity > 48798 zsh swapuse infinity infinity bytes Hmm, I would stick as close to limits output as possible. I would consider duplicating the unit field in each of soft and hard, so you end up with something like this: PID COMM RLIMIT SOFT HARD 48798 zsh cputime 100000 secs infinity secs 48798 zsh filesize infinity kb infinity kb 48798 zsh datasize 524288 kb 524288 kb etc. (Things like 'openfiles' is simply more intuitive than 'nofile' (no file?, huh? oh, num open files.. (except not all users will make the last step there). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 19:38:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 524FD106564A; Thu, 8 Dec 2011 19:38:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40BB08FC08; Thu, 8 Dec 2011 19:38:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8JchIX099992; Thu, 8 Dec 2011 19:38:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8Jch1l099990; Thu, 8 Dec 2011 19:38:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201112081938.pB8Jch1l099990@svn.freebsd.org> From: Martin Matuska Date: Thu, 8 Dec 2011 19:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228353 - head/cddl/contrib/opensolaris/cmd/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 19:38:43 -0000 Author: mm Date: Thu Dec 8 19:38:42 2011 New Revision: 228353 URL: http://svn.freebsd.org/changeset/base/228353 Log: Some mdoc(7) style and typo fixes to zfs(8). Submitted by: Nobuyuki Koganemaru MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Dec 8 15:28:36 2011 (r228352) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Dec 8 19:38:42 2011 (r228353) @@ -377,7 +377,7 @@ property. This directory is created as n automatically mounts the file system when the .Qq Nm Cm mount Fl a command is invoked (without editing -.Pa /etc/fstab Ns ). +.Pa /etc/fstab ) . The .Sy mountpoint property can be inherited, so if @@ -409,7 +409,7 @@ responsible for mounting and unmounting dataset can be attached to a jail by using the .Qq Nm Cm jail subcommand. You cannot attach a dataset to one jail and the children of the -same dataset to another jails. To allow managment of the dataset from within +same dataset to another jails. To allow management of the dataset from within a jail, the .Sy jailed property has to be set. The @@ -624,10 +624,10 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy userrefs This property is set to the number of user holds on this snapshot. User holds @@ -673,7 +673,7 @@ snapshot. The .Ar snapshot may be specified as a short snapshot name (just the part after the -.Sy @ Ns ), +.Sy @ ) , in which case it will be interpreted as a snapshot in the same filesystem as this dataset. The .Ar snapshot @@ -847,7 +847,7 @@ is an integer from 1 (fastest) to 9 (bes is equivalent to .Cm gzip-6 (which is also the default for -.Xr gzip 1 Ns ). +.Xr gzip 1 ) . The .Cm zle compression algorithm compresses runs of zeros. @@ -952,7 +952,7 @@ space calculation does not include space such as snapshots and clones. User space consumption is identified by the .Sy userspace@ Ns Ar user property. -.sp +.Pp Enforcement of user quotas may be delayed by several seconds. This delay means that a user might exceed their quota before the system notices that they are over quota and begins to refuse additional writes with the @@ -960,14 +960,14 @@ over quota and begins to refuse addition error message. See the .Cm userspace subcommand for more information. -.sp +.Pp Unprivileged users can only access their own groups' space usage. The root user, or a user who has been granted the .Sy userquota privilege with .Qq Nm Cm allow , can get and set everyone's quota. -.sp +.Pp This property is not available on volumes, on file systems before version 4, or on pools before version 15. The .Sy userquota@ Ns ... @@ -979,17 +979,17 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy groupquota@ Ns Ar group Ns = Ns Ar size | Cm none Limits the amount of space consumed by the specified group. Group space consumption is identified by the .Sy userquota@ Ns Ar user property. -.sp +.Pp Unprivileged users can access only their own groups' space usage. The root user, or a user who has been granted the .Sy groupquota @@ -1020,7 +1020,7 @@ than or equal to 128 Kbytes. Changing the file system's .Sy recordsize affects only files created afterward; existing files are unaffected. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy recsize . .It Sy refquota Ns = Ns Ar size | Cm none @@ -1036,13 +1036,13 @@ The .Sy refreservation reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations. -.sp +.Pp If .Sy refreservation is set, a snapshot is only allowed if there is enough free pool space outside of this reservation to accommodate the current number of "referenced" bytes in the dataset. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy refreserv . .It Sy reservation Ns = Ns Ar size | Cm none @@ -1161,7 +1161,7 @@ version number of 9 or higher, a is set instead. Any changes to .Sy volsize are reflected in an equivalent change to the reservation (or -.Sy refreservation Ns ). +.Sy refreservation ) . The .Sy volsize can only be set to a multiple of @@ -1174,7 +1174,7 @@ run out of space, resulting in undefined on how the volume is used. These effects can also occur when the volume size is changed while it is in use (particularly when shrinking the size). Extreme care should be used when adjusting the volume size. -.sp +.Pp Though not recommended, a "sparse volume" (also known as "thin provisioning") can be created by specifying the .Fl s @@ -1708,7 +1708,7 @@ Snapshots are displayed if the property is .Cm on (the default is -.Cm off Ns ). +.Cm off ) . The following fields are displayed, .Sy name , used , available , referenced , mountpoint . .Bl -tag -width indent @@ -2168,10 +2168,10 @@ Creates a stream representation of the l argument (not part of .Fl i or -.Fl I Ns ) +.Fl I ) which is written to standard output. The output can be redirected to a file or to a different system (for example, using -.Xr ssh 1 Ns ). +.Xr ssh 1 ) . By default, a full stream is generated. .Bl -tag -width indent .It Fl i Ar snapshot @@ -2180,10 +2180,10 @@ Generate an incremental stream from the to the last .Ar snapshot . The incremental source (the -.Fl i Ar snapshot Ns ) +.Fl i Ar snapshot ) can be specified as the last component of the snapshot name (for example, the part after the -.Sy @ Ns ), +.Sy @ ) , and it is assumed to be from the same file system as the last .Ar snapshot . .Pp @@ -2191,11 +2191,13 @@ If the destination is a clone, the sourc must be fully specified (for example, .Cm pool/fs@origin , not just -.Cm @origin Ns ). +.Cm @origin ) . .It Fl I Ar snapshot Generate a stream package that sends all intermediary snapshots from the -.Fl I Ar snapshot to the last -.Ar snapshot . For example, +.Fl I Ar snapshot +to the last +.Ar snapshot . +For example, .Ic -I @a fs@d is similar to .Ic -i @a fs@b; -i @b fs@c; -i @c fs@d . @@ -2223,12 +2225,12 @@ flag is specified when this stream is re .It Fl D Generate a deduplicated stream. Blocks which would have been sent multiple times in the send stream will only be sent once. The receiving system must -also support this feature to recieve a deduplicated stream. This flag can +also support this feature to receive a deduplicated stream. This flag can be used regardless of the dataset's .Sy dedup property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. -.Sy sha256 Ns ). +.Sy sha256 ) . .It Fl r Recursively send all descendant snapshots. This is similar to the .Fl R @@ -2323,14 +2325,14 @@ option is specified, all but the pool na appended (for example, .Sy b/c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ), +.Sy a/b/c@1 ) , and if the .Fl e option is specified, only the tail of the sent snapshot path is appended (for example, .Sy c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ). +.Sy a/b/c@1 ) . In the case of .Fl d , any file systems needed to replicate the path of the sent snapshot are created @@ -2349,13 +2351,13 @@ Print verbose information about the stre receive operation. .It Fl n Do not actually receive the stream. This can be useful in conjunction with the -.It Fl v +.Fl v option to verify the name the receive operation would use. .It Fl F Force a rollback of the file system to the most recent snapshot before performing the receive operation. If receiving an incremental replication stream (for example, one generated by -.Qq Nm Cm send Fl R Fi iI Ns ) , +.Qq Nm Cm send Fl R Fi iI ) , destroy snapshots and file systems that do not exist on the sending side. .El .It Xo @@ -2409,7 +2411,8 @@ option. .Op Fl e .Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... .Xc -Specifies that the permissions be delegated to "everyone." Multiple permissions +Specifies that the permissions be delegated to "everyone". +Multiple permissions may be specified as a comma-separated list. Permission names are the same as .Tn ZFS subcommand and property names. See the property list below. Property set names, @@ -2655,7 +2658,7 @@ Describes differences between a snapshot successor dataset can be a later snapshot or the current filesystem. .Pp The changed files are displayed including the change type. The change type -is displayed ussing a single character. If a file or directory was renamed, +is displayed useing a single character. If a file or directory was renamed, the old and the new names are displayed. .Pp The following change types can be displayed: @@ -2680,9 +2683,9 @@ The following file types can be displaye .It \&B Ta block device .It \&@ Ta symbolic link .It \&= Ta socket -.It \&> Ta door (not supported on Fx Ns ) -.It \&| Ta FIFO (not supported on Fx Ns ) -.It \&P Ta event portal (not supported on Fx Ns ) +.It \&> Ta door (not supported on Fx ) +.It \&| Ta FIFO (not supported on Fx ) +.It \&P Ta event portal (not supported on Fx ) .El .It Fl H Machine-parseable output, fields separated a tab character. From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 20:53:51 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE3A61065677; Thu, 8 Dec 2011 20:53:51 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4B6038FC18; Thu, 8 Dec 2011 20:53:49 +0000 (UTC) Received: by bkbzv15 with SMTP id zv15so2665600bkb.13 for ; Thu, 08 Dec 2011 12:53:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=NUhXvg0m57yhQlA1POZxvMzKEnOpq8D/TtN927xwBwo=; b=Jjn/Vwwd19MJMnECY6r2CFtpqpHkx/+C9B7qL3a0ifSk2UyNB3UCltneeAmUgFyvSK ImVWFFJZPAm0dovJDA20eHfmvKkwCImctCv62P0L3huD/MgCw8hKUiheg4P5RojXquAA bK2NF19e9xD+5hPh67OmKsQeKK0szslXkARIA= Received: by 10.205.130.146 with SMTP id hm18mr1934662bkc.19.1323377629047; Thu, 08 Dec 2011 12:53:49 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id e18sm5042095bkr.15.2011.12.08.12.53.45 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Dec 2011 12:53:46 -0800 (PST) From: Mikolaj Golub To: John Baldwin References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <201111281330.11720.jhb@freebsd.org> <86liqt1ier.fsf@kopusha.home.net> <4EE1024C.6040800@FreeBSD.org> X-Comment-To: John Baldwin Sender: Mikolaj Golub Date: Thu, 08 Dec 2011 22:53:44 +0200 In-Reply-To: <4EE1024C.6040800@FreeBSD.org> (John Baldwin's message of "Thu, 08 Dec 2011 13:30:36 -0500") Message-ID: <86k466aip3.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 20:53:51 -0000 On Thu, 08 Dec 2011 13:30:36 -0500 John Baldwin wrote: JB> On 12/3/11 3:58 PM, Mikolaj Golub wrote: >> >> On Mon, 28 Nov 2011 13:30:11 -0500 John Baldwin wrote: >> >> JB> On Thursday, November 24, 2011 3:54:06 pm Mikolaj Golub wrote: >> >> Author: trociny >> >> Date: Thu Nov 24 20:54:06 2011 >> >> New Revision: 227956 >> >> URL: http://svn.freebsd.org/changeset/base/227956 >> >> >> >> Log: >> >> usr.bin/procstat >> >> >> >> Add -l flag to display resource limits. >> >> >> >> PR: bin/161257 >> >> Reviewed by: kib >> >> MFC after: 2 weeks >> >> JB> Thanks for doing this! Did you consider making the procstat -l output use >> JB> "pretty" output similar to the output of /usr/bin/limits? For example, >> JB> using "infinity" instead of -1 and using humanize_number() for finite limits >> JB> that are in units of bytes? >> >> I tried several variants, from one where for rlimit names rlimit_ident >> constants from sys/resource.h are used and units are printed as suffixes: >> >> PID COMM RLIMIT SOFT HARD >> 46150 zsh cpu 100000S infinity >> 46150 zsh fsize infinity infinity >> 46150 zsh data 524288kB 524288kB >> 46150 zsh stack 65536kB 65536kB >> 46150 zsh core 9765625kB 9765625kB >> 46150 zsh rss infinity infinity >> 46150 zsh memlock infinity infinity >> 46150 zsh nproc 5547 5547 >> 46150 zsh nofile 11095 11095 >> 46150 zsh sbsize infinity infinity >> 46150 zsh vmem infinity infinity >> 46150 zsh npts infinity infinity >> 46150 zsh swap infinity infinity >> >> to one where rlimit names are the same as in limits(1) and units are printed >> in separate column: >> >> PID COMM RLIMIT SOFT HARD UNIT >> 48885 zsh cputime 100000 infinity secs >> 48885 zsh filesize infinity infinity bytes >> 48885 zsh datasize 524288k 524288k bytes >> 48885 zsh stacksize 65536k 65536k bytes >> 48885 zsh coredumpsize 95367M 95367M bytes >> 48885 zsh memoryuse infinity infinity bytes >> 48885 zsh memorylocked infinity infinity bytes >> 48885 zsh maxprocesses 5547 5547 >> 48885 zsh openfiles 11095 11095 >> 48885 zsh sbsize infinity infinity bytes >> 48885 zsh vmemoryuse infinity infinity bytes >> 48885 zsh pseudo-terminals infinity infinity >> 48885 zsh swapuse infinity infinity bytes >> >> Personally I like the first variant as the most compact and the easiest to >> maintain but would be glad to learn what other think about this or may be have >> other suggestions. >> >> A couple other variations: >> >> PID COMM RLIMIT SOFT HARD UNIT >> 47062 zsh cpu 100000 infinity secs >> 47062 zsh fsize infinity infinity bytes >> 47062 zsh data 524288k 524288k bytes >> 47062 zsh stack 67108864 67108864 bytes >> 47062 zsh core 9765625k 9765625k bytes >> 47062 zsh rss infinity infinity bytes >> 47062 zsh memlock infinity infinity bytes >> 47062 zsh nproc 5547 5547 >> 47062 zsh nofile 11095 11095 >> 47062 zsh sbsize infinity infinity bytes >> 47062 zsh vmem infinity infinity bytes >> 47062 zsh npts infinity infinity >> 47062 zsh swap infinity infinity bytes >> >> PID COMM RLIMIT SOFT HARD UNIT >> 48798 zsh cputime 100000 infinity secs >> 48798 zsh filesize infinity infinity bytes >> 48798 zsh datasize 524288k 524288k bytes >> 48798 zsh stacksize 65536k 65536k bytes >> 48798 zsh coredumpsize 95367M 95367M bytes >> 48798 zsh memoryuse infinity infinity bytes >> 48798 zsh memorylocked infinity infinity bytes >> 48798 zsh maxprocesses 5547 5547 >> 48798 zsh openfiles 11095 11095 >> 48798 zsh sbsize infinity infinity bytes >> 48798 zsh vmemoryuse infinity infinity bytes >> 48798 zsh pseudo-terminals infinity infinity >> 48798 zsh swapuse infinity infinity bytes JB> Hmm, I would stick as close to limits output as possible. I would JB> consider duplicating the unit field in each of soft and hard, so you JB> end up with something like this: JB> PID COMM RLIMIT SOFT HARD JB> 48798 zsh cputime 100000 secs infinity secs JB> 48798 zsh filesize infinity kb infinity kb JB> 48798 zsh datasize 524288 kb 524288 kb JB> etc. Ok. JB> (Things like 'openfiles' is simply more intuitive than 'nofile' (no JB> file?, huh? oh, num open files.. (except not all users will make the JB> last step there). Then why do we have so non-intuitive rlimit_ident names? It looks like they are used only in procfs_rlimit.c. Do procfs(5) users always make that last step with 'nofile'? :-) Is it possible to change rlimit_ident names? Just to ones that are used by limit(1) or (if they look too long) to something like below: cputime filesize datasize stacksize coresize rmemuse memlocked maxproc openfiles sbsize vmemuse openpts swapuse or any other names, just so I wouldn't need to hardcode the names in procstat? -- Mikolaj Golub From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 20:55:36 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E012106564A; Thu, 8 Dec 2011 20:55:36 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id C688D8FC14; Thu, 8 Dec 2011 20:55:35 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id pB8Kd764095164; Thu, 8 Dec 2011 21:39:08 +0100 (CET) (envelope-from andreast@FreeBSD.org) Message-ID: <4EE120D7.10903@FreeBSD.org> Date: Thu, 08 Dec 2011 21:40:55 +0100 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: David Chisnall References: <201112072117.pB7LHoaL055972@svn.freebsd.org> In-Reply-To: <201112072117.pB7LHoaL055972@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228330 - in head: include sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 20:55:36 -0000 On 07.12.11 22:17, David Chisnall wrote: > Author: theraven > Date: Wed Dec 7 21:17:50 2011 > New Revision: 228330 > URL: http://svn.freebsd.org/changeset/base/228330 > > Log: > As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an > identifier reserved for the implementation in C99 and earlier so there is > no sensible reason for introducing yet another reserved identifier when we > could just use the one C1x uses. > > Approved by: brooks (mentor) > Modified: head/sys/sys/cdefs.h > ============================================================================== > --- head/sys/sys/cdefs.h Wed Dec 7 21:02:35 2011 (r228329) > +++ head/sys/sys/cdefs.h Wed Dec 7 21:17:50 2011 (r228330) > @@ -220,13 +220,13 @@ > > > #if defined(__cplusplus)&& __cplusplus>= 201103L > -#define __noreturn [[noreturn]] > +#define _Noreturn [[noreturn]] > #elif defined(__STDC_VERSION__)&& __STDC_VERSION__> 201000L > -#define __noreturn _Noreturn > +/* Do nothing - _Noreturn is a keyword */ > #elif defined(__GNUC__) > -#define __noreturn __attribute__((__noreturn__)) > +#define _Noreturn __attribute__((__noreturn__)) This and the previous commit broke bootstrapping gcc. The problem is this: /export/devel/build/gcc/head/objdir/./gcc/include-fixed/stdlib.h:96:1: error: expected unqualified-id before '[' token Line in question is: _Noreturn void abort(void); Where _Noreturn gets expanded to [[noreturn]] I helped myself with adding the below. Well. No clue if it is correct. But at least I can continue building gcc trunk. Thanks, Andreas Index: cdefs.h =================================================================== --- cdefs.h (revision 228352) +++ cdefs.h (working copy) @@ -219,7 +219,7 @@ #endif -#if defined(__cplusplus) && __cplusplus >= 201103L +#if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__GNUC__) #define _Noreturn [[noreturn]] #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L /* Do nothing - _Noreturn is a keyword */ From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 21:32:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A649106566B; Thu, 8 Dec 2011 21:32:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id AB10D8FC08; Thu, 8 Dec 2011 21:32:17 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 5845146B0A; Thu, 8 Dec 2011 16:32:17 -0500 (EST) Received: from John-Baldwins-MacBook-Air.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AE89CB91E; Thu, 8 Dec 2011 16:32:16 -0500 (EST) Message-ID: <4EE12CE0.5070803@FreeBSD.org> Date: Thu, 08 Dec 2011 16:32:16 -0500 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Mikolaj Golub References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <201111281330.11720.jhb@freebsd.org> <86liqt1ier.fsf@kopusha.home.net> <4EE1024C.6040800@FreeBSD.org> <86k466aip3.fsf@kopusha.home.net> In-Reply-To: <86k466aip3.fsf@kopusha.home.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 08 Dec 2011 16:32:16 -0500 (EST) Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 21:32:18 -0000 On 12/8/11 3:53 PM, Mikolaj Golub wrote: > > On Thu, 08 Dec 2011 13:30:36 -0500 John Baldwin wrote: > > JB> On 12/3/11 3:58 PM, Mikolaj Golub wrote: > >> > >> On Mon, 28 Nov 2011 13:30:11 -0500 John Baldwin wrote: > >> > >> JB> On Thursday, November 24, 2011 3:54:06 pm Mikolaj Golub wrote: > >> >> Author: trociny > >> >> Date: Thu Nov 24 20:54:06 2011 > >> >> New Revision: 227956 > >> >> URL: http://svn.freebsd.org/changeset/base/227956 > >> >> > >> >> Log: > >> >> usr.bin/procstat > >> >> > >> >> Add -l flag to display resource limits. > >> >> > >> >> PR: bin/161257 > >> >> Reviewed by: kib > >> >> MFC after: 2 weeks > >> > >> JB> Thanks for doing this! Did you consider making the procstat -l output use > >> JB> "pretty" output similar to the output of /usr/bin/limits? For example, > >> JB> using "infinity" instead of -1 and using humanize_number() for finite limits > >> JB> that are in units of bytes? > >> > >> I tried several variants, from one where for rlimit names rlimit_ident > >> constants from sys/resource.h are used and units are printed as suffixes: > >> > >> PID COMM RLIMIT SOFT HARD > >> 46150 zsh cpu 100000S infinity > >> 46150 zsh fsize infinity infinity > >> 46150 zsh data 524288kB 524288kB > >> 46150 zsh stack 65536kB 65536kB > >> 46150 zsh core 9765625kB 9765625kB > >> 46150 zsh rss infinity infinity > >> 46150 zsh memlock infinity infinity > >> 46150 zsh nproc 5547 5547 > >> 46150 zsh nofile 11095 11095 > >> 46150 zsh sbsize infinity infinity > >> 46150 zsh vmem infinity infinity > >> 46150 zsh npts infinity infinity > >> 46150 zsh swap infinity infinity > >> > >> to one where rlimit names are the same as in limits(1) and units are printed > >> in separate column: > >> > >> PID COMM RLIMIT SOFT HARD UNIT > >> 48885 zsh cputime 100000 infinity secs > >> 48885 zsh filesize infinity infinity bytes > >> 48885 zsh datasize 524288k 524288k bytes > >> 48885 zsh stacksize 65536k 65536k bytes > >> 48885 zsh coredumpsize 95367M 95367M bytes > >> 48885 zsh memoryuse infinity infinity bytes > >> 48885 zsh memorylocked infinity infinity bytes > >> 48885 zsh maxprocesses 5547 5547 > >> 48885 zsh openfiles 11095 11095 > >> 48885 zsh sbsize infinity infinity bytes > >> 48885 zsh vmemoryuse infinity infinity bytes > >> 48885 zsh pseudo-terminals infinity infinity > >> 48885 zsh swapuse infinity infinity bytes > >> > >> Personally I like the first variant as the most compact and the easiest to > >> maintain but would be glad to learn what other think about this or may be have > >> other suggestions. > >> > >> A couple other variations: > >> > >> PID COMM RLIMIT SOFT HARD UNIT > >> 47062 zsh cpu 100000 infinity secs > >> 47062 zsh fsize infinity infinity bytes > >> 47062 zsh data 524288k 524288k bytes > >> 47062 zsh stack 67108864 67108864 bytes > >> 47062 zsh core 9765625k 9765625k bytes > >> 47062 zsh rss infinity infinity bytes > >> 47062 zsh memlock infinity infinity bytes > >> 47062 zsh nproc 5547 5547 > >> 47062 zsh nofile 11095 11095 > >> 47062 zsh sbsize infinity infinity bytes > >> 47062 zsh vmem infinity infinity bytes > >> 47062 zsh npts infinity infinity > >> 47062 zsh swap infinity infinity bytes > >> > >> PID COMM RLIMIT SOFT HARD UNIT > >> 48798 zsh cputime 100000 infinity secs > >> 48798 zsh filesize infinity infinity bytes > >> 48798 zsh datasize 524288k 524288k bytes > >> 48798 zsh stacksize 65536k 65536k bytes > >> 48798 zsh coredumpsize 95367M 95367M bytes > >> 48798 zsh memoryuse infinity infinity bytes > >> 48798 zsh memorylocked infinity infinity bytes > >> 48798 zsh maxprocesses 5547 5547 > >> 48798 zsh openfiles 11095 11095 > >> 48798 zsh sbsize infinity infinity bytes > >> 48798 zsh vmemoryuse infinity infinity bytes > >> 48798 zsh pseudo-terminals infinity infinity > >> 48798 zsh swapuse infinity infinity bytes > > JB> Hmm, I would stick as close to limits output as possible. I would > JB> consider duplicating the unit field in each of soft and hard, so you > JB> end up with something like this: > > JB> PID COMM RLIMIT SOFT HARD > JB> 48798 zsh cputime 100000 secs infinity secs > JB> 48798 zsh filesize infinity kb infinity kb > JB> 48798 zsh datasize 524288 kb 524288 kb > > JB> etc. > > Ok. > > JB> (Things like 'openfiles' is simply more intuitive than 'nofile' (no > JB> file?, huh? oh, num open files.. (except not all users will make the > JB> last step there). > > Then why do we have so non-intuitive rlimit_ident names? > > It looks like they are used only in procfs_rlimit.c. Do procfs(5) users always > make that last step with 'nofile'? :-) Well, I suspect it's best not to change the names in procfs in case there are existing binaries that parse the output of that file (unfortunately). > Is it possible to change rlimit_ident names? Just to ones that are used by > limit(1) or (if they look too long) to something like below: Hmm, I have no idea what other things might use rlimit_ident. Probably not many. (Also, for fun, note that the 'ulimit' and 'limit' built-in commands in sh and csh also have their own sets of names, fun!) I would maybe add a rlimit_names[] (just leave rlimit_ident alone), and give that the names from limits(1), and change both procstat and sh's 'ulimit' command to use those. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 22:33:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7046F1065670; Thu, 8 Dec 2011 22:33:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 606598FC08; Thu, 8 Dec 2011 22:33:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8MXb4r005461; Thu, 8 Dec 2011 22:33:37 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8MXbvi005459; Thu, 8 Dec 2011 22:33:37 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201112082233.pB8MXbvi005459@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 8 Dec 2011 22:33:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228354 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 22:33:37 -0000 Author: pfg Date: Thu Dec 8 22:33:37 2011 New Revision: 228354 URL: http://svn.freebsd.org/changeset/base/228354 Log: Add myself as new committer: add PGP key and announce.. Approved by: jhb (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Thu Dec 8 19:38:42 2011 (r228353) +++ head/share/misc/committers-src.dot Thu Dec 8 22:33:37 2011 (r228354) @@ -203,6 +203,7 @@ obrien [label="David E. O'Brien\nobrien@ olli [label="Oliver Fromme\nolli@FreeBSD.org\n2008/02/14"] peadar [label="Peter Edwards\npeadar@FreeBSD.org\n2004/03/08"] peter [label="Peter Wemm\npeter@FreeBSD.org\n????/??/??"] +pfg [label="Pedro Giffuni\npfg@FreeBSD.org\n2011/12/01"] philip [label="Philip Paeps\nphilip@FreBSD.org\n2004/01/21"] phk [label="Poul-Henning Kamp\nphk@FreeBSD.org\n1994/02/21"] pho [label="Peter Holm\npho@FreeBSD.org\n2008/11/16"] From owner-svn-src-head@FreeBSD.ORG Thu Dec 8 23:58:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED05B1065672; Thu, 8 Dec 2011 23:58:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD3748FC16; Thu, 8 Dec 2011 23:58:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8NwQhQ008123; Thu, 8 Dec 2011 23:58:26 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8NwQ3I008121; Thu, 8 Dec 2011 23:58:26 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201112082358.pB8NwQ3I008121@svn.freebsd.org> From: Glen Barber Date: Thu, 8 Dec 2011 23:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228355 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 23:58:27 -0000 Author: gjb (doc committer) Date: Thu Dec 8 23:58:26 2011 New Revision: 228355 URL: http://svn.freebsd.org/changeset/base/228355 Log: As of r226865, daily_scrub_zfs_default_threshold is 35 days; document accordingly. PR: 162890 Submitted by: Oliver Hartmann (ohartman ! mail.zedat.fu-berlin.de) Patch by: Niclas Zeising (niclas.zeising ! gmail.com) MFC after: 1 week X-Need-MFC: r226865 Modified: head/share/man/man5/periodic.conf.5 Modified: head/share/man/man5/periodic.conf.5 ============================================================================== --- head/share/man/man5/periodic.conf.5 Thu Dec 8 22:33:37 2011 (r228354) +++ head/share/man/man5/periodic.conf.5 Thu Dec 8 23:58:26 2011 (r228355) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 15, 2010 +.Dd December 8, 2011 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -631,7 +631,7 @@ If the list is empty or not set, all zfs .It Va daily_scrub_zfs_default_threshold .Pq Vt int Number of days between a scrub if no pool-specific threshold is set. -The default value if no value is set is 30. +If not set, the default value is 35, corresponding to 5 weeks. .It Va daily_scrub_zfs_ Ns Ao Ar poolname Ac Ns Va _threshold .Pq Vt int The same as From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 02:30:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F03C9106564A; Fri, 9 Dec 2011 02:30:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D60128FC13; Fri, 9 Dec 2011 02:30:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB92Uulw012804; Fri, 9 Dec 2011 02:30:56 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB92Uuug012801; Fri, 9 Dec 2011 02:30:56 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201112090230.pB92Uuug012801@svn.freebsd.org> From: Glen Barber Date: Fri, 9 Dec 2011 02:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228356 - head/usr.bin/du X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 02:30:57 -0000 Author: gjb (doc committer) Date: Fri Dec 9 02:30:56 2011 New Revision: 228356 URL: http://svn.freebsd.org/changeset/base/228356 Log: Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis [1] - Other miscellaneous improvements PR: 162438 Submitted by: arundel Reviewed by: Benjamin Kaduk (kaduk ! mit.edu), jhb[1] (original version) MFC after: 1 week Modified: head/usr.bin/du/du.1 head/usr.bin/du/du.c Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Thu Dec 8 23:58:26 2011 (r228355) +++ head/usr.bin/du/du.1 Fri Dec 9 02:30:56 2011 (r228356) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -36,15 +36,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P -.Op Fl a | s | d Ar depth | Fl t Ar threshold -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl h | k | m +.Op Fl a | s | d Ar depth +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -65,7 +63,9 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE and gives an estimate of how much space the examined file hierarchy would @@ -79,48 +79,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) -.It Fl t Ar threshold -Display only entries for which size exceeds -.Ar threshold . -If -.Ar threshold -is negative, display only entries for which size is less than the absolute -value of -.Ar threshold . +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -136,6 +119,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -152,25 +153,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Thu Dec 8 23:58:26 2011 (r228355) +++ head/usr.bin/du/du.c Fri Dec 9 02:30:56 2011 (r228356) @@ -499,9 +499,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 13:15:19 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A54551065677; Fri, 9 Dec 2011 13:15:19 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 954CF8FC1A; Fri, 9 Dec 2011 13:15:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9DFJmD034396; Fri, 9 Dec 2011 13:15:19 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9DFJKl034394; Fri, 9 Dec 2011 13:15:19 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201112091315.pB9DFJKl034394@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 9 Dec 2011 13:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228358 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 13:15:19 -0000 Author: jh Date: Fri Dec 9 13:15:19 2011 New Revision: 228358 URL: http://svn.freebsd.org/changeset/base/228358 Log: - Fix markup. - Remove trailing whitespace. Modified: head/share/man/man9/sbuf.9 Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Fri Dec 9 04:51:40 2011 (r228357) +++ head/share/man/man9/sbuf.9 Fri Dec 9 13:15:19 2011 (r228358) @@ -117,7 +117,7 @@ defined in .Pp Any errors encountered during the allocation or composition of the string will be latched in the data structure, -making a single error test at the end of the composition +making a single error test at the end of the composition sufficient to determine success or failure of the entire process. .Pp The @@ -391,7 +391,8 @@ function returns the actual string; only works on a finished .Fa sbuf . The -.Fn sbuf_len function returns the length of the string. +.Fn sbuf_len +function returns the length of the string. For an .Fa sbuf with an attached drain, @@ -482,7 +483,7 @@ being finished, or returns the error code from the drain if one is attached. .Pp The -.Fn sbuf_finish 3 +.Fn sbuf_finish 3 function (the userland version) will return zero for success and \-1 and set errno on error. .Sh EXAMPLES From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 13:28:41 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A3D21065672; Fri, 9 Dec 2011 13:28:41 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89ED48FC12; Fri, 9 Dec 2011 13:28:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9DSfTi034878; Fri, 9 Dec 2011 13:28:41 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9DSfYh034876; Fri, 9 Dec 2011 13:28:41 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201112091328.pB9DSfYh034876@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 9 Dec 2011 13:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228359 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 13:28:41 -0000 Author: jh Date: Fri Dec 9 13:28:41 2011 New Revision: 228359 URL: http://svn.freebsd.org/changeset/base/228359 Log: sbuf_data() hasn't returned NULL for overflowed buffers since r71721. Modified: head/share/man/man9/sbuf.9 Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Fri Dec 9 13:15:19 2011 (r228358) +++ head/share/man/man9/sbuf.9 Fri Dec 9 13:28:41 2011 (r228359) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 25, 2011 +.Dd December 9, 2011 .Dt SBUF 9 .Os .Sh NAME @@ -463,12 +463,8 @@ function returns a non-zero value if the drain error, and zero otherwise. .Pp The -.Fn sbuf_data -and .Fn sbuf_len -functions return -.Dv NULL -and \-1, respectively, if the buffer overflowed. +function returns \-1 if the buffer overflowed. .Pp The .Fn sbuf_copyin From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 17:19:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20E7D106564A; Fri, 9 Dec 2011 17:19:42 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10ED48FC16; Fri, 9 Dec 2011 17:19:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9HJfdm042115; Fri, 9 Dec 2011 17:19:41 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9HJflN042113; Fri, 9 Dec 2011 17:19:41 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201112091719.pB9HJflN042113@svn.freebsd.org> From: Peter Holm Date: Fri, 9 Dec 2011 17:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228360 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 17:19:42 -0000 Author: pho Date: Fri Dec 9 17:19:41 2011 New Revision: 228360 URL: http://svn.freebsd.org/changeset/base/228360 Log: Move cpu_set_upcall(newtd, td) up before the first call of thread_free(newtd). This to avoid a possible page fault in cpu_thread_clean() as seen on amd64 with syscall fuzzing. Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Fri Dec 9 13:28:41 2011 (r228359) +++ head/sys/kern/kern_thr.c Fri Dec 9 17:19:41 2011 (r228360) @@ -201,6 +201,8 @@ create_thread(struct thread *td, mcontex goto fail; } + cpu_set_upcall(newtd, td); + /* * Try the copyout as soon as we allocate the td so we don't * have to tear things down in a failure case below. @@ -226,8 +228,6 @@ create_thread(struct thread *td, mcontex newtd->td_proc = td->td_proc; newtd->td_ucred = crhold(td->td_ucred); - cpu_set_upcall(newtd, td); - if (ctx != NULL) { /* old way to set user context */ error = set_mcontext(newtd, ctx); if (error != 0) { From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 17:49:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F4161065672; Fri, 9 Dec 2011 17:49:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F4A28FC17; Fri, 9 Dec 2011 17:49:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9HnZiN043070; Fri, 9 Dec 2011 17:49:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9HnZvL043068; Fri, 9 Dec 2011 17:49:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112091749.pB9HnZvL043068@svn.freebsd.org> From: John Baldwin Date: Fri, 9 Dec 2011 17:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228361 - head/sys/fs/devfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 17:49:35 -0000 Author: jhb Date: Fri Dec 9 17:49:34 2011 New Revision: 228361 URL: http://svn.freebsd.org/changeset/base/228361 Log: Explicitly use curthread while manipulating td_fpop during last close of a devfs file descriptor in devfs_close_f(). The passed in td argument may be NULL if the close was invoked by garbage collection of open file descriptors in pending control messages in the socket buffer of a UNIX domain socket after it was closed. PR: kern/151758 Submitted by: Andrey Shidakov andrey shidakov ru Submitted by: Ruben van Staveren ruben verweg com Reviewed by: kib MFC after: 2 weeks Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Fri Dec 9 17:19:41 2011 (r228360) +++ head/sys/fs/devfs/devfs_vnops.c Fri Dec 9 17:49:34 2011 (r228361) @@ -602,10 +602,14 @@ devfs_close_f(struct file *fp, struct th int error; struct file *fpop; - fpop = td->td_fpop; - td->td_fpop = fp; + /* + * NB: td may be NULL if this descriptor is closed due to + * garbage collection from a closed UNIX domain socket. + */ + fpop = curthread->td_fpop; + curthread->td_fpop = fp; error = vnops.fo_close(fp, td); - td->td_fpop = fpop; + curthread->td_fpop = fpop; /* * The f_cdevpriv cannot be assigned non-NULL value while we From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 18:17:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78CF3106564A; Fri, 9 Dec 2011 18:17:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6867B8FC15; Fri, 9 Dec 2011 18:17:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IH2SG044028; Fri, 9 Dec 2011 18:17:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IH2wV044025; Fri, 9 Dec 2011 18:17:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112091817.pB9IH2wV044025@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 18:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228362 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:17:02 -0000 Author: yongari Date: Fri Dec 9 18:17:02 2011 New Revision: 228362 URL: http://svn.freebsd.org/changeset/base/228362 Log: Do not disable interrupt without knowing whether the raised interrupt is ours. Note, interrupts are automatically ACKed when the status register is read. Add RX/TX DMA error to interrupt handler and do full controller reset if driver happen to encounter these errors. There is no way to recover from these DMA errors without controller reset. Rename local variable name intrs with status to enhance readability. While I'm here, rename ET_INTR_TXEOF and ET_INTR_RXEOF to ET_INTR_TXDMA and ET_INTR_RXDMA respectively. These interrupts indicate that a frame is successfully DMAed to controller's internal FIFO and they have nothing to do with EOF(end of frame). Driver does not need to wait actual end of TX/RX of a frame(e.g. no need to wait the end signal of TX which is generated when a frame in TX FIFO is emptied by MAC). Previous names were somewhat confusing. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Fri Dec 9 17:49:34 2011 (r228361) +++ head/sys/dev/et/if_et.c Fri Dec 9 18:17:02 2011 (r228362) @@ -1158,34 +1158,40 @@ et_intr(void *xsc) { struct et_softc *sc = xsc; struct ifnet *ifp; - uint32_t intrs; + uint32_t status; ET_LOCK(sc); ifp = sc->ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - ET_UNLOCK(sc); - return; - } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto done; + + status = CSR_READ_4(sc, ET_INTR_STATUS); + if ((status & ET_INTRS) == 0) + goto done; /* Disable further interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); - intrs = CSR_READ_4(sc, ET_INTR_STATUS); - if ((intrs & ET_INTRS) == 0) - goto done; - - if (intrs & ET_INTR_RXEOF) + if (status & (ET_INTR_RXDMA_ERROR | ET_INTR_TXDMA_ERROR)) { + device_printf(sc->dev, "DMA error(0x%08x) -- resetting\n", + status); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + ET_UNLOCK(sc); + return; + } + if (status & ET_INTR_RXDMA) et_rxeof(sc); - if (intrs & (ET_INTR_TXEOF | ET_INTR_TIMER)) + if (status & (ET_INTR_TXDMA | ET_INTR_TIMER)) et_txeof(sc); - if (intrs & ET_INTR_TIMER) + if (status & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -done: if (ifp->if_drv_flags & IFF_DRV_RUNNING) { CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) et_start_locked(ifp); } +done: ET_UNLOCK(sc); } Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Fri Dec 9 17:49:34 2011 (r228361) +++ head/sys/dev/et/if_etreg.h Fri Dec 9 18:17:02 2011 (r228362) @@ -378,9 +378,9 @@ /* * Interrupts */ -#define ET_INTR_TXEOF 0x00000008 +#define ET_INTR_TXDMA 0x00000008 #define ET_INTR_TXDMA_ERROR 0x00000010 -#define ET_INTR_RXEOF 0x00000020 +#define ET_INTR_RXDMA 0x00000020 #define ET_INTR_RXRING0_LOW 0x00000040 #define ET_INTR_RXRING1_LOW 0x00000080 #define ET_INTR_RXSTAT_LOW 0x00000100 @@ -393,9 +393,9 @@ #define ET_INTR_MAC_STATS 0x00080000 #define ET_INTR_SLAVE_TO 0x00100000 -#define ET_INTRS (ET_INTR_TXEOF | \ - ET_INTR_RXEOF | \ - ET_INTR_TIMER) +#define ET_INTRS \ + (ET_INTR_TXDMA | ET_INTR_RXDMA | ET_INTR_TIMER | \ + ET_INTR_TXDMA_ERROR | ET_INTR_RXDMA_ERROR) /* * RX ring position uses same layout From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 18:22:57 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B349A1065672; Fri, 9 Dec 2011 18:22:57 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A29ED8FC0C; Fri, 9 Dec 2011 18:22:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IMvdQ044266; Fri, 9 Dec 2011 18:22:57 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IMv0g044264; Fri, 9 Dec 2011 18:22:57 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201112091822.pB9IMv0g044264@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 9 Dec 2011 18:22:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228363 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:22:57 -0000 Author: pjd Date: Fri Dec 9 18:22:57 2011 New Revision: 228363 URL: http://svn.freebsd.org/changeset/base/228363 Log: The vfs.zfs.txg.timeout sysctl can be safely modified at run time. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Dec 9 18:17:02 2011 (r228362) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Dec 9 18:22:57 2011 (r228363) @@ -43,7 +43,7 @@ int zfs_txg_timeout = 5; /* max seconds SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0, "ZFS TXG"); TUNABLE_INT("vfs.zfs.txg.timeout", &zfs_txg_timeout); -SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RDTUN, &zfs_txg_timeout, 0, +SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RW, &zfs_txg_timeout, 0, "Maximum seconds worth of delta per txg"); /* From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 18:34:45 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7D931065670; Fri, 9 Dec 2011 18:34:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B78C28FC18; Fri, 9 Dec 2011 18:34:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IYjQS044855; Fri, 9 Dec 2011 18:34:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IYjua044852; Fri, 9 Dec 2011 18:34:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112091834.pB9IYjua044852@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 18:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228368 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:34:45 -0000 Author: yongari Date: Fri Dec 9 18:34:45 2011 New Revision: 228368 URL: http://svn.freebsd.org/changeset/base/228368 Log: Remove unnecessary definition of ET_PCIR_BAR. Controller support I/O memory only. While here, use pci_set_max_read_req(9) rather than directly manipulating PCIe device control register. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Fri Dec 9 18:31:22 2011 (r228367) +++ head/sys/dev/et/if_et.c Fri Dec 9 18:34:45 2011 (r228368) @@ -250,9 +250,9 @@ et_attach(device_t dev) /* * Allocate IO memory */ - sc->sc_mem_rid = ET_PCIR_BAR; + sc->sc_mem_rid = PCIR_BAR(0); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->sc_mem_rid, RF_ACTIVE); + &sc->sc_mem_rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { device_printf(dev, "can't allocate IO memory\n"); return (ENXIO); @@ -722,12 +722,7 @@ et_bus_config(struct et_softc *sc) /* * Set max read request size to 2048 bytes */ - val = pci_read_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); - val &= ~PCIM_EXP_CTL_MAX_READ_REQUEST; - val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K; - pci_write_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, val, 2); + pci_set_max_read_req(sc->dev, 2048); return (0); } Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Fri Dec 9 18:31:22 2011 (r228367) +++ head/sys/dev/et/if_etreg.h Fri Dec 9 18:34:45 2011 (r228368) @@ -53,8 +53,6 @@ * ET_PCIV_REPLAY_TIMER_{128,256} are from * PCI EXPRESS BASE SPECIFICATION, REV. 1.0a, Table 3-4 */ -#define ET_PCIR_BAR PCIR_BAR(0) - #define ET_PCIR_DEVICE_CAPS 0x4C #define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ #define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 19:10:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A43C4106564A; Fri, 9 Dec 2011 19:10:38 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93C4D8FC0C; Fri, 9 Dec 2011 19:10:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9JAcG1045959; Fri, 9 Dec 2011 19:10:38 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9JAcHb045956; Fri, 9 Dec 2011 19:10:38 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112091910.pB9JAcHb045956@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 19:10:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228369 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 19:10:38 -0000 Author: yongari Date: Fri Dec 9 19:10:38 2011 New Revision: 228369 URL: http://svn.freebsd.org/changeset/base/228369 Log: Announce flow control ability to PHY driver and enable RX flow control. Controller does not automatically generate pause frames based on number of available RX buffers so it's very hard to know when driver should generate XON frame in time. The only mechanism driver can detect low number of RX buffer condition is ET_INTR_RXRING0_LOW or ET_INTR_RXRING1_LOW interrupt. This interrupt is generated whenever controller notices the number of available RX buffers are lower than pre-programmed value( ET_RX_RING0_MINCNT and ET_RX_RING1_MINCNT register). This scheme does not provide a way to detect when controller sees enough number of RX buffers again such that efficient generation of XON/XOFF frame is not easy. While here, add more flow control related register definition. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Fri Dec 9 18:34:45 2011 (r228368) +++ head/sys/dev/et/if_et.c Fri Dec 9 19:10:38 2011 (r228369) @@ -332,7 +332,8 @@ et_attach(device_t dev) et_chip_attach(sc); error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, - et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_DOPAUSE); if (error) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -548,12 +549,23 @@ et_miibus_statchg(device_t dev) if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { cfg2 |= ET_MAC_CFG2_FDX; + /* + * Controller lacks automatic TX pause frame + * generation so it should be handled by driver. + * Even though driver can send pause frame with + * arbitrary pause time, controller does not + * provide a way that tells how many free RX + * buffers are available in controller. This + * limitation makes it hard to generate XON frame + * in time on driver side so don't enable TX flow + * control. + */ #ifdef notyet if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) cfg1 |= ET_MAC_CFG1_TXFLOW; +#endif if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) cfg1 |= ET_MAC_CFG1_RXFLOW; -#endif } else ctrl |= ET_MAC_CTRL_GHDX; @@ -1949,8 +1961,12 @@ et_init_txmac(struct et_softc *sc) /* Disable TX MAC and FC(?) */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, ET_TXMAC_CTRL_FC_DISABLE); - /* No flow control yet */ - CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0); + /* + * Initialize pause time. + * This register should be set before XON/XOFF frame is + * sent by driver. + */ + CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0 << ET_TXMAC_FLOWCTRL_CFPT_SHIFT); /* Enable TX MAC but leave FC(?) diabled */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Fri Dec 9 18:34:45 2011 (r228368) +++ head/sys/dev/et/if_etreg.h Fri Dec 9 19:10:38 2011 (r228369) @@ -193,6 +193,13 @@ #define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 #define ET_TXMAC_FLOWCTRL 0x3010 +#define ET_TXMAC_FLOWCTRL_CFPT_MASK 0x0000FFFF +#define ET_TXMAC_FLOWCTRL_CFEP_MASK 0xFFFF0000 +#define ET_TXMAC_FLOWCTRL_CFPT_SHIFT 0 + +#define ET_TXMAC_BP_CTRL 0x3020 +#define ET_TXMAC_BP_CTRL_XONXOFF 0x00000001 +#define ET_TXMAC_BP_CTRL_REQ 0x00000002 #define ET_RXMAC_CTRL 0x4000 #define ET_RXMAC_CTRL_ENABLE 0x00000001 From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 19:17:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BC0B1065676; Fri, 9 Dec 2011 19:17:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B7688FC08; Fri, 9 Dec 2011 19:17:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9JHqnp046235; Fri, 9 Dec 2011 19:17:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9JHqNZ046232; Fri, 9 Dec 2011 19:17:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112091917.pB9JHqNZ046232@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 19:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228370 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 19:17:52 -0000 Author: yongari Date: Fri Dec 9 19:17:51 2011 New Revision: 228370 URL: http://svn.freebsd.org/changeset/base/228370 Log: After r228293, et(4) supports altq(4). Modified: head/share/man/man4/altq.4 head/share/man/man4/et.4 Modified: head/share/man/man4/altq.4 ============================================================================== --- head/share/man/man4/altq.4 Fri Dec 9 19:10:38 2011 (r228369) +++ head/share/man/man4/altq.4 Fri Dec 9 19:17:51 2011 (r228370) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2011 +.Dd December 9, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -134,6 +134,7 @@ They have been applied to the following .Xr em 4 , .Xr ep 4 , .Xr epair 4 , +.Xr et 4 , .Xr fxp 4 , .Xr gem 4 , .Xr hme 4 , Modified: head/share/man/man4/et.4 ============================================================================== --- head/share/man/man4/et.4 Fri Dec 9 19:10:38 2011 (r228369) +++ head/share/man/man4/et.4 Fri Dec 9 19:17:51 2011 (r228370) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2010 +.Dd December 9, 2011 .Dt ET 4 .Os .Sh NAME @@ -156,6 +156,7 @@ to achieve TX interrupt moderation. The default value is 1000000000 (nanoseconds). .El .Sh SEE ALSO +.Xr altq 4 , .Xr arp 4 , .Xr miibus 4 , .Xr netintro 4 , From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 19:24:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E5FE106564A; Fri, 9 Dec 2011 19:24:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D7668FC08; Fri, 9 Dec 2011 19:24:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9JOI7J046469; Fri, 9 Dec 2011 19:24:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9JOI5x046467; Fri, 9 Dec 2011 19:24:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112091924.pB9JOI5x046467@svn.freebsd.org> From: John Baldwin Date: Fri, 9 Dec 2011 19:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228371 - head/tools/regression/sockets/unix_passfd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 19:24:18 -0000 Author: jhb Date: Fri Dec 9 19:24:17 2011 New Revision: 228371 URL: http://svn.freebsd.org/changeset/base/228371 Log: - Add a test for PR 151758. - While here, make this compile and work on non-i386: - Use CMSG_SPACE(), CMSG_LEN(), and CMSG_FIRSTHDR() instead of ignoring padding between 'struct cmsghdr' and control message payloads. - Don't initialize the control message before calling recvmsg(). Instead, check that we get a valid control message on return from recvmsg(). - Use errx() instead of err() for some errors that don't report failures that set errno. Requested by: kib (1) Modified: head/tools/regression/sockets/unix_passfd/unix_passfd.c Modified: head/tools/regression/sockets/unix_passfd/unix_passfd.c ============================================================================== --- head/tools/regression/sockets/unix_passfd/unix_passfd.c Fri Dec 9 19:17:51 2011 (r228370) +++ head/tools/regression/sockets/unix_passfd/unix_passfd.c Fri Dec 9 19:24:17 2011 (r228371) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -62,6 +63,17 @@ closesocketpair(int *fdp) } static void +devnull(const char *test, int *fdp) +{ + int fd; + + fd = open("/dev/null", O_RDONLY); + if (fd < 0) + err(-1, "%s: open(/dev/null)", test); + *fdp = fd; +} + +static void tempfile(const char *test, int *fdp) { char path[PATH_MAX]; @@ -88,9 +100,9 @@ samefile(const char *test, struct stat * { if (sb1->st_dev != sb2->st_dev) - err(-1, "%s: samefile: different device", test); + errx(-1, "%s: samefile: different device", test); if (sb1->st_ino != sb2->st_ino) - err(-1, "%s: samefile: different inode", test); + errx(-1, "%s: samefile: different inode", test); } static void @@ -99,10 +111,8 @@ sendfd(const char *test, int sockfd, int struct iovec iovec; char ch; - struct { - struct cmsghdr cmsghdr; - int fd; - } message; + char message[CMSG_SPACE(sizeof(int))]; + struct cmsghdr *cmsghdr; struct msghdr msghdr; ssize_t len; @@ -110,7 +120,7 @@ sendfd(const char *test, int sockfd, int bzero(&message, sizeof(message)); ch = 0; - msghdr.msg_control = &message; + msghdr.msg_control = message; msghdr.msg_controllen = sizeof(message); iovec.iov_base = &ch; @@ -119,35 +129,33 @@ sendfd(const char *test, int sockfd, int msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - message.cmsghdr.cmsg_len = sizeof(message); - message.cmsghdr.cmsg_level = SOL_SOCKET; - message.cmsghdr.cmsg_type = SCM_RIGHTS; - message.fd = sendfd; + cmsghdr = (struct cmsghdr *)message; + cmsghdr->cmsg_len = CMSG_LEN(sizeof(int)); + cmsghdr->cmsg_level = SOL_SOCKET; + cmsghdr->cmsg_type = SCM_RIGHTS; + *(int *)CMSG_DATA(cmsghdr) = sendfd; len = sendmsg(sockfd, &msghdr, 0); if (len < 0) err(-1, "%s: sendmsg", test); if (len != sizeof(ch)) - errx(-1, "%s: sendmsg: %d bytes sent", test, len); + errx(-1, "%s: sendmsg: %zd bytes sent", test, len); } static void recvfd(const char *test, int sockfd, int *recvfd) { - struct { - struct cmsghdr cmsghdr; - int fd; - } message; + struct cmsghdr *cmsghdr; + char message[CMSG_SPACE(sizeof(int))]; struct msghdr msghdr; struct iovec iovec; ssize_t len; char ch; bzero(&msghdr, sizeof(msghdr)); - bzero(&message, sizeof(message)); ch = 0; - msghdr.msg_control = &message; + msghdr.msg_control = message; msghdr.msg_controllen = sizeof(message); iovec.iov_base = &ch; @@ -161,19 +169,22 @@ recvfd(const char *test, int sockfd, int msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - message.cmsghdr.cmsg_len = sizeof(message); - message.cmsghdr.cmsg_level = SOL_SOCKET; - message.cmsghdr.cmsg_type = SCM_RIGHTS; - message.fd = -1; - len = recvmsg(sockfd, &msghdr, 0); if (len < 0) err(-1, "%s: recvmsg", test); if (len != sizeof(ch)) - errx(-1, "%s: recvmsg: %d bytes received", test, len); - if (message.fd == -1) + errx(-1, "%s: recvmsg: %zd bytes received", test, len); + cmsghdr = CMSG_FIRSTHDR(&msghdr); + if (cmsghdr == NULL) + errx(-1, "%s: recvmsg: did not receive control message", test); + if (cmsghdr->cmsg_len != CMSG_LEN(sizeof(int)) || + cmsghdr->cmsg_level != SOL_SOCKET || + cmsghdr->cmsg_type != SCM_RIGHTS) + errx(-1, "%s: recvmsg: did not receive single-fd message", + test); + *recvfd = *(int *)CMSG_DATA(cmsghdr); + if (*recvfd == -1) errx(-1, "%s: recvmsg: received fd -1", test); - *recvfd = message.fd; } int @@ -303,5 +314,22 @@ main(int argc, char *argv[]) printf("%s passed\n", test); + /* + * Test for PR 151758: Send an character device over the UNIX + * domain socket and then close both sockets to orphan the + * device. + */ + + test = "test7-devfsorphan"; + printf("beginning %s\n", test); + + domainsocketpair(test, fd); + devnull(test, &putfd_1); + sendfd(test, fd[0], putfd_1); + close(putfd_1); + closesocketpair(fd); + + printf("%s passed\n", test); + return (0); } From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 20:23:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9C2E106564A; Fri, 9 Dec 2011 20:23:58 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D97ED8FC08; Fri, 9 Dec 2011 20:23:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9KNwbP048398; Fri, 9 Dec 2011 20:23:58 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9KNwQA048396; Fri, 9 Dec 2011 20:23:58 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201112092023.pB9KNwQA048396@svn.freebsd.org> From: Jim Harris Date: Fri, 9 Dec 2011 20:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228373 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 20:23:59 -0000 Author: jimharris Date: Fri Dec 9 20:23:58 2011 New Revision: 228373 URL: http://svn.freebsd.org/changeset/base/228373 Log: Added jimharris. Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Fri Dec 9 20:09:36 2011 (r228372) +++ head/share/misc/committers-src.dot Fri Dec 9 20:23:58 2011 (r228373) @@ -161,6 +161,7 @@ jh [label="Jaakko Heinonen\njh@FreeBSD.o jhb [label="John Baldwin\njhb@FreeBSD.org\n1999/08/23"] jhibbits [label="Justin Hibbits\njhibbits@FreeBSD.org\n2011/11/30"] jilles [label="Jilles Tjoelker\njilles@FreeBSD.org\n2009/05/22"] +jimharris [label="Jim Harris\njimharris@FreeBSD.org\n2011/12/09"] jinmei [label="JINMEI Tatuya\njinmei@FreeBSD.org\n2007/03/17"] jkim [label="Jung-uk Kim\njkim@FreeBSD.org\n2005/07/06"] jkoshy [label="A. Joseph Koshy\njkoshy@FreeBSD.org\n1998/05/13"] From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 20:40:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA159106564A; Fri, 9 Dec 2011 20:40:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A15B8FC12; Fri, 9 Dec 2011 20:40:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9KeOJO049000; Fri, 9 Dec 2011 20:40:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9KeOY9048998; Fri, 9 Dec 2011 20:40:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112092040.pB9KeOY9048998@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 9 Dec 2011 20:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228375 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 20:40:24 -0000 Author: kib Date: Fri Dec 9 20:40:24 2011 New Revision: 228375 URL: http://svn.freebsd.org/changeset/base/228375 Log: Typo. MFC after: 3 days Modified: head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Fri Dec 9 20:36:10 2011 (r228374) +++ head/libexec/rtld-elf/rtld.h Fri Dec 9 20:40:24 2011 (r228375) @@ -246,7 +246,7 @@ typedef struct Struct_Obj_Entry { /* Flags to be passed into symlook_ family of functions. */ #define SYMLOOK_IN_PLT 0x01 /* Lookup for PLT symbol */ -#define SYMLOOK_DLSYM 0x02 /* Return newes versioned symbol. Used by +#define SYMLOOK_DLSYM 0x02 /* Return newest versioned symbol. Used by dlsym. */ /* Flags for load_object(). */ From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 20:41:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53621106564A; Fri, 9 Dec 2011 20:41:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4355A8FC12; Fri, 9 Dec 2011 20:41:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9KftJL049077; Fri, 9 Dec 2011 20:41:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9KftCm049075; Fri, 9 Dec 2011 20:41:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112092041.pB9KftCm049075@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 9 Dec 2011 20:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228376 - head/sys/ddb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 20:41:55 -0000 Author: kib Date: Fri Dec 9 20:41:54 2011 New Revision: 228376 URL: http://svn.freebsd.org/changeset/base/228376 Log: Typo. MFC after: 3 days Modified: head/sys/ddb/db_thread.c Modified: head/sys/ddb/db_thread.c ============================================================================== --- head/sys/ddb/db_thread.c Fri Dec 9 20:40:24 2011 (r228375) +++ head/sys/ddb/db_thread.c Fri Dec 9 20:41:54 2011 (r228376) @@ -109,7 +109,7 @@ db_show_threads(db_expr_t addr, boolean_ * Lookup a thread based on a db expression address. We assume that the * address was parsed in hexadecimal. We reparse the address in decimal * first and try to treat it as a thread ID to find an associated thread. - * If that fails and check_pid is true, we terat the decimal value as a + * If that fails and check_pid is true, we treat the decimal value as a * PID. If that matches a process, we return the first thread in that * process. Otherwise, we treat the addr as a pointer to a thread. */ From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 22:23:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89D6B1065675; Fri, 9 Dec 2011 22:23:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75F8F8FC13; Fri, 9 Dec 2011 22:23:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9MNkdE052418; Fri, 9 Dec 2011 22:23:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9MNkAr052400; Fri, 9 Dec 2011 22:23:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112092223.pB9MNkAr052400@svn.freebsd.org> From: Dimitry Andric Date: Fri, 9 Dec 2011 22:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228379 - in head: contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/AsmPrinter contrib/llvm/lib/CodeGen/SelectionDAG contrib/llvm/lib/Target/ARM contrib/llvm/lib/Target/CppBackend cont... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 22:23:46 -0000 Author: dim Date: Fri Dec 9 22:23:45 2011 New Revision: 228379 URL: http://svn.freebsd.org/changeset/base/228379 Log: Upgrade our copy of llvm/clang to 3.0 release. Release notes can be found at: http://llvm.org/releases/3.0/docs/ReleaseNotes.html MFC after: 1 week Added: head/lib/clang/include/MipsGenCodeEmitter.inc (contents, props changed) Modified: head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp head/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td head/contrib/llvm/lib/Target/CppBackend/CPPBackend.cpp head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td head/contrib/llvm/lib/Target/Mips/MipsInstrFormats.td head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsJITInfo.cpp head/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp head/contrib/llvm/lib/Target/X86/X86CodeEmitter.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp head/contrib/llvm/tools/clang/include/clang/Driver/CC1Options.td head/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h head/contrib/llvm/tools/clang/include/clang/Frontend/HeaderSearchOptions.h head/contrib/llvm/tools/clang/lib/Basic/Version.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.h head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains.h head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp head/contrib/llvm/tools/clang/lib/Frontend/InitHeaderSearch.cpp head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/libllvmmipscodegen/Makefile Directory Properties: head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) Modified: head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -527,18 +527,20 @@ bool CompileUnit::addConstantValue(DIE * // Get the raw data form of the large APInt. const APInt Val = CI->getValue(); - const char *Ptr = (const char*)Val.getRawData(); + const uint64_t *Ptr64 = Val.getRawData(); int NumBytes = Val.getBitWidth() / 8; // 8 bits per byte. bool LittleEndian = Asm->getTargetData().isLittleEndian(); - int Incr = (LittleEndian ? 1 : -1); - int Start = (LittleEndian ? 0 : NumBytes - 1); - int Stop = (LittleEndian ? NumBytes : -1); // Output the constant to DWARF one byte at a time. - for (; Start != Stop; Start += Incr) - addUInt(Block, 0, dwarf::DW_FORM_data1, - (unsigned char)0xFF & Ptr[Start]); + for (int i = 0; i < NumBytes; i++) { + uint8_t c; + if (LittleEndian) + c = Ptr64[i / 8] >> (8 * (i & 7)); + else + c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7)); + addUInt(Block, 0, dwarf::DW_FORM_data1, c); + } addBlock(Die, dwarf::DW_AT_const_value, 0, Block); return true; Modified: head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -119,7 +119,8 @@ LLVMTargetMachine::LLVMTargetMachine(con // we'll crash later. // Provide the user with a useful error message about what's wrong. assert(AsmInfo && "MCAsmInfo not initialized." - "Make sure you include the correct TargetSelect.h!"); + "Make sure you include the correct TargetSelect.h" + "and that InitializeAllTargetMCs() is being invoked!"); } bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -2034,14 +2034,17 @@ bool SelectionDAGBuilder::handleJTSwitch return false; APInt Range = ComputeRange(First, Last); - double Density = TSize.roundToDouble() / Range.roundToDouble(); - if (Density < 0.4) + // The density is TSize / Range. Require at least 40%. + // It should not be possible for IntTSize to saturate for sane code, but make + // sure we handle Range saturation correctly. + uint64_t IntRange = Range.getLimitedValue(UINT64_MAX/10); + uint64_t IntTSize = TSize.getLimitedValue(UINT64_MAX/10); + if (IntTSize * 10 < IntRange * 4) return false; DEBUG(dbgs() << "Lowering jump table\n" << "First entry: " << First << ". Last entry: " << Last << '\n' - << "Range: " << Range - << ". Size: " << TSize << ". Density: " << Density << "\n\n"); + << "Range: " << Range << ". Size: " << TSize << ".\n\n"); // Get the MachineFunction which holds the current MBB. This is used when // inserting any additional MBBs necessary to represent the switch. Modified: head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -506,7 +506,9 @@ getExprForDwarfGlobalReference(const Glo // Add information about the stub reference to MachOMMI so that the stub // gets emitted by the asmprinter. MCSymbol *SSym = getContext().GetOrCreateSymbol(Name.str()); - MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym); + MachineModuleInfoImpl::StubValueTy &StubSym = + GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) : + MachOMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { MCSymbol *Sym = Mang->getSymbol(GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); @@ -534,7 +536,9 @@ getCFIPersonalitySymbol(const GlobalValu // Add information about the stub reference to MachOMMI so that the stub // gets emitted by the asmprinter. MCSymbol *SSym = getContext().GetOrCreateSymbol(Name.str()); - MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym); + MachineModuleInfoImpl::StubValueTy &StubSym = + GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) : + MachOMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { MCSymbol *Sym = Mang->getSymbol(GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); Modified: head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -63,6 +63,13 @@ ARMBaseRegisterInfo::ARMBaseRegisterInfo const unsigned* ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { + bool ghcCall = false; + + if (MF) { + const Function *F = MF->getFunction(); + ghcCall = (F ? F->getCallingConv() == CallingConv::GHC : false); + } + static const unsigned CalleeSavedRegs[] = { ARM::LR, ARM::R11, ARM::R10, ARM::R9, ARM::R8, ARM::R7, ARM::R6, ARM::R5, ARM::R4, @@ -82,7 +89,13 @@ ARMBaseRegisterInfo::getCalleeSavedRegs( ARM::D11, ARM::D10, ARM::D9, ARM::D8, 0 }; - return STI.isTargetDarwin() ? DarwinCalleeSavedRegs : CalleeSavedRegs; + + static const unsigned GhcCalleeSavedRegs[] = { + 0 + }; + + return ghcCall ? GhcCalleeSavedRegs : + STI.isTargetDarwin() ? DarwinCalleeSavedRegs : CalleeSavedRegs; } BitVector ARMBaseRegisterInfo:: Modified: head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td Fri Dec 9 22:23:45 2011 (r228379) @@ -82,6 +82,25 @@ def RetFastCC_ARM_APCS : CallingConv<[ CCDelegateTo ]>; +//===----------------------------------------------------------------------===// +// ARM APCS Calling Convention for GHC +//===----------------------------------------------------------------------===// + +def CC_ARM_APCS_GHC : CallingConv<[ + // Handle all vector types as either f64 or v2f64. + CCIfType<[v1i64, v2i32, v4i16, v8i8, v2f32], CCBitConvertToType>, + CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32], CCBitConvertToType>, + + CCIfType<[v2f64], CCAssignToReg<[Q4, Q5]>>, + CCIfType<[f64], CCAssignToReg<[D8, D9, D10, D11]>>, + CCIfType<[f32], CCAssignToReg<[S16, S17, S18, S19, S20, S21, S22, S23]>>, + + // Promote i8/i16 arguments to i32. + CCIfType<[i8, i16], CCPromoteToType>, + + // Pass in STG registers: Base, Sp, Hp, R1, R2, R3, R4, SpLim + CCIfType<[i32], CCAssignToReg<[R4, R5, R6, R7, R8, R9, R10, R11]>> +]>; //===----------------------------------------------------------------------===// // ARM AAPCS (EABI) Calling Convention, common parts Modified: head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -1548,6 +1548,11 @@ CCAssignFn *ARMFastISel::CCAssignFnForCa return (Return ? RetCC_ARM_AAPCS: CC_ARM_AAPCS); case CallingConv::ARM_APCS: return (Return ? RetCC_ARM_APCS: CC_ARM_APCS); + case CallingConv::GHC: + if (Return) + llvm_unreachable("Can't return in GHC call convention"); + else + return CC_ARM_APCS_GHC; } } Modified: head/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -15,6 +15,8 @@ #include "ARMBaseInstrInfo.h" #include "ARMBaseRegisterInfo.h" #include "ARMMachineFunctionInfo.h" +#include "llvm/CallingConv.h" +#include "llvm/Function.h" #include "MCTargetDesc/ARMAddressingModes.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" @@ -139,6 +141,10 @@ void ARMFrameLowering::emitPrologue(Mach unsigned GPRCS1Size = 0, GPRCS2Size = 0, DPRCSSize = 0; int FramePtrSpillFI = 0; + // All calls are tail calls in GHC calling conv, and functions have no prologue/epilogue. + if (MF.getFunction()->getCallingConv() == CallingConv::GHC) + return; + // Allocate the vararg register save area. This is not counted in NumBytes. if (VARegSaveSize) emitSPUpdate(isARM, MBB, MBBI, dl, TII, -VARegSaveSize, @@ -326,6 +332,10 @@ void ARMFrameLowering::emitEpilogue(Mach int NumBytes = (int)MFI->getStackSize(); unsigned FramePtr = RegInfo->getFrameRegister(MF); + // All calls are tail calls in GHC calling conv, and functions have no prologue/epilogue. + if (MF.getFunction()->getCallingConv() == CallingConv::GHC) + return; + if (!AFI->hasStackFrame()) { if (NumBytes != 0) emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); Modified: head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -1091,6 +1091,8 @@ CCAssignFn *ARMTargetLowering::CCAssignF return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS); case CallingConv::ARM_APCS: return (Return ? RetCC_ARM_APCS : CC_ARM_APCS); + case CallingConv::GHC: + return (Return ? RetCC_ARM_APCS : CC_ARM_APCS_GHC); } } Modified: head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td Fri Dec 9 22:23:45 2011 (r228379) @@ -1538,8 +1538,7 @@ multiclass thumb2_ld_multgetName()); Out << "\", " << (load->isVolatile() ? "true" : "false" ) << ", " << bbname << ");"; + if (load->getAlignment()) + nl(Out) << iName << "->setAlignment(" + << load->getAlignment() << ");"; + if (load->isAtomic()) { + StringRef Ordering = ConvertAtomicOrdering(load->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(load->getSynchScope()); + nl(Out) << iName << "->setAtomic(" + << Ordering << ", " << CrossThread << ");"; + } break; } case Instruction::Store: { const StoreInst* store = cast(I); - Out << " new StoreInst(" + Out << "StoreInst* " << iName << " = new StoreInst(" << opNames[0] << ", " << opNames[1] << ", " << (store->isVolatile() ? "true" : "false") << ", " << bbname << ");"; + if (store->getAlignment()) + nl(Out) << iName << "->setAlignment(" + << store->getAlignment() << ");"; + if (store->isAtomic()) { + StringRef Ordering = ConvertAtomicOrdering(store->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(store->getSynchScope()); + nl(Out) << iName << "->setAtomic(" + << Ordering << ", " << CrossThread << ");"; + } break; } case Instruction::GetElementPtr: { @@ -1447,6 +1486,60 @@ void CppWriter::printInstruction(const I Out << "\", " << bbname << ");"; break; } + case Instruction::Fence: { + const FenceInst *fi = cast(I); + StringRef Ordering = ConvertAtomicOrdering(fi->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(fi->getSynchScope()); + Out << "FenceInst* " << iName + << " = new FenceInst(mod->getContext(), " + << Ordering << ", " << CrossThread << ", " << bbname + << ");"; + break; + } + case Instruction::AtomicCmpXchg: { + const AtomicCmpXchgInst *cxi = cast(I); + StringRef Ordering = ConvertAtomicOrdering(cxi->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(cxi->getSynchScope()); + Out << "AtomicCmpXchgInst* " << iName + << " = new AtomicCmpXchgInst(" + << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", " + << Ordering << ", " << CrossThread << ", " << bbname + << ");"; + nl(Out) << iName << "->setName(\""; + printEscapedString(cxi->getName()); + Out << "\");"; + break; + } + case Instruction::AtomicRMW: { + const AtomicRMWInst *rmwi = cast(I); + StringRef Ordering = ConvertAtomicOrdering(rmwi->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(rmwi->getSynchScope()); + StringRef Operation; + switch (rmwi->getOperation()) { + case AtomicRMWInst::Xchg: Operation = "AtomicRMWInst::Xchg"; break; + case AtomicRMWInst::Add: Operation = "AtomicRMWInst::Add"; break; + case AtomicRMWInst::Sub: Operation = "AtomicRMWInst::Sub"; break; + case AtomicRMWInst::And: Operation = "AtomicRMWInst::And"; break; + case AtomicRMWInst::Nand: Operation = "AtomicRMWInst::Nand"; break; + case AtomicRMWInst::Or: Operation = "AtomicRMWInst::Or"; break; + case AtomicRMWInst::Xor: Operation = "AtomicRMWInst::Xor"; break; + case AtomicRMWInst::Max: Operation = "AtomicRMWInst::Max"; break; + case AtomicRMWInst::Min: Operation = "AtomicRMWInst::Min"; break; + case AtomicRMWInst::UMax: Operation = "AtomicRMWInst::UMax"; break; + case AtomicRMWInst::UMin: Operation = "AtomicRMWInst::UMin"; break; + case AtomicRMWInst::BAD_BINOP: llvm_unreachable("Bad atomic operation"); + } + Out << "AtomicRMWInst* " << iName + << " = new AtomicRMWInst(" + << Operation << ", " + << opNames[0] << ", " << opNames[1] << ", " + << Ordering << ", " << CrossThread << ", " << bbname + << ");"; + nl(Out) << iName << "->setName(\""; + printEscapedString(rmwi->getName()); + Out << "\");"; + break; + } } DefinedValues.insert(I); nl(Out); @@ -1623,7 +1716,9 @@ void CppWriter::printFunctionBody(const Out << "Value* " << getCppName(AI) << " = args++;"; nl(Out); if (AI->hasName()) { - Out << getCppName(AI) << "->setName(\"" << AI->getName() << "\");"; + Out << getCppName(AI) << "->setName(\""; + printEscapedString(AI->getName()); + Out << "\");"; nl(Out); } } Modified: head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td Fri Dec 9 22:23:45 2011 (r228379) @@ -39,51 +39,51 @@ def imm32_63 : ImmLeaf func, bits<5> _rs, string instr_asm, SDNode OpNode, PatFrag PF>: - FR<0x00, func, (outs CPU64Regs:$dst), (ins CPU64Regs:$b, shamt_64:$c), - !strconcat(instr_asm, "\t$dst, $b, $c"), - [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, (i64 PF:$c)))], + FR<0x00, func, (outs CPU64Regs:$rd), (ins CPU64Regs:$rt, shamt_64:$shamt), + !strconcat(instr_asm, "\t$rd, $rt, $shamt"), + [(set CPU64Regs:$rd, (OpNode CPU64Regs:$rt, (i64 PF:$shamt)))], IIAlu> { let rs = _rs; } class LogicR_shift_rotate_reg64 func, bits<5> _shamt, string instr_asm, SDNode OpNode>: - FR<0x00, func, (outs CPU64Regs:$dst), (ins CPU64Regs:$c, CPU64Regs:$b), - !strconcat(instr_asm, "\t$dst, $b, $c"), - [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, CPU64Regs:$c))], IIAlu> { + FR<0x00, func, (outs CPU64Regs:$rd), (ins CPU64Regs:$rs, CPU64Regs:$rt), + !strconcat(instr_asm, "\t$rd, $rt, $rs"), + [(set CPU64Regs:$rd, (OpNode CPU64Regs:$rt, CPU64Regs:$rs))], IIAlu> { let shamt = _shamt; } // Mul, Div -let Defs = [HI64, LO64] in { +let rd = 0, shamt = 0, Defs = [HI64, LO64] in { let isCommutable = 1 in class Mul64 func, string instr_asm, InstrItinClass itin>: - FR<0x00, func, (outs), (ins CPU64Regs:$a, CPU64Regs:$b), - !strconcat(instr_asm, "\t$a, $b"), [], itin>; + FR<0x00, func, (outs), (ins CPU64Regs:$rs, CPU64Regs:$rt), + !strconcat(instr_asm, "\t$rs, $rt"), [], itin>; class Div64 func, string instr_asm, InstrItinClass itin>: - FR<0x00, func, (outs), (ins CPU64Regs:$a, CPU64Regs:$b), - !strconcat(instr_asm, "\t$$zero, $a, $b"), - [(op CPU64Regs:$a, CPU64Regs:$b)], itin>; + FR<0x00, func, (outs), (ins CPU64Regs:$rs, CPU64Regs:$rt), + !strconcat(instr_asm, "\t$$zero, $rs, $rt"), + [(op CPU64Regs:$rs, CPU64Regs:$rt)], itin>; } // Move from Hi/Lo let shamt = 0 in { let rs = 0, rt = 0 in class MoveFromLOHI64 func, string instr_asm>: - FR<0x00, func, (outs CPU64Regs:$dst), (ins), - !strconcat(instr_asm, "\t$dst"), [], IIHiLo>; + FR<0x00, func, (outs CPU64Regs:$rd), (ins), + !strconcat(instr_asm, "\t$rd"), [], IIHiLo>; let rt = 0, rd = 0 in class MoveToLOHI64 func, string instr_asm>: - FR<0x00, func, (outs), (ins CPU64Regs:$src), - !strconcat(instr_asm, "\t$src"), [], IIHiLo>; + FR<0x00, func, (outs), (ins CPU64Regs:$rs), + !strconcat(instr_asm, "\t$rs"), [], IIHiLo>; } // Count Leading Ones/Zeros in Word class CountLeading64 func, string instr_asm, list pattern>: - FR<0x1c, func, (outs CPU64Regs:$dst), (ins CPU64Regs:$src), - !strconcat(instr_asm, "\t$dst, $src"), pattern, IIAlu>, + FR<0x1c, func, (outs CPU64Regs:$rd), (ins CPU64Regs:$rs), + !strconcat(instr_asm, "\t$rd, $rs"), pattern, IIAlu>, Requires<[HasBitCount]> { let shamt = 0; let rt = rd; @@ -180,9 +180,9 @@ let Uses = [LO64] in /// Count Leading def DCLZ : CountLeading64<0x24, "dclz", - [(set CPU64Regs:$dst, (ctlz CPU64Regs:$src))]>; + [(set CPU64Regs:$rd, (ctlz CPU64Regs:$rs))]>; def DCLO : CountLeading64<0x25, "dclo", - [(set CPU64Regs:$dst, (ctlz (not CPU64Regs:$src)))]>; + [(set CPU64Regs:$rd, (ctlz (not CPU64Regs:$rs)))]>; //===----------------------------------------------------------------------===// // Arbitrary patterns that map to one or more instructions Modified: head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -105,6 +105,9 @@ class MipsCodeEmitter : public MachineFu unsigned getRelocation(const MachineInstr &MI, const MachineOperand &MO) const; + unsigned getMemEncoding(const MachineInstr &MI, unsigned OpNo) const; + unsigned getSizeExtEncoding(const MachineInstr &MI, unsigned OpNo) const; + unsigned getSizeInsEncoding(const MachineInstr &MI, unsigned OpNo) const; }; } @@ -153,6 +156,28 @@ unsigned MipsCodeEmitter::getRelocation( return Mips::reloc_mips_lo; } +unsigned MipsCodeEmitter::getMemEncoding(const MachineInstr &MI, + unsigned OpNo) const { + // Base register is encoded in bits 20-16, offset is encoded in bits 15-0. + assert(MI.getOperand(OpNo).isReg()); + unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo)) << 16; + return + (getMachineOpValue(MI, MI.getOperand(OpNo+1)) & 0xFFFF) | RegBits; +} + +unsigned MipsCodeEmitter::getSizeExtEncoding(const MachineInstr &MI, + unsigned OpNo) const { + // size is encoded as size-1. + return getMachineOpValue(MI, MI.getOperand(OpNo)) - 1; +} + +unsigned MipsCodeEmitter::getSizeInsEncoding(const MachineInstr &MI, + unsigned OpNo) const { + // size is encoded as pos+size-1. + return getMachineOpValue(MI, MI.getOperand(OpNo-1)) + + getMachineOpValue(MI, MI.getOperand(OpNo)) - 1; +} + /// getMachineOpValue - Return binary encoding of operand. If the machine /// operand requires relocation, record the relocation and return zero. unsigned MipsCodeEmitter::getMachineOpValue(const MachineInstr &MI, @@ -238,8 +263,4 @@ FunctionPass *llvm::createMipsJITCodeEmi return new MipsCodeEmitter(TM, JCE); } -unsigned MipsCodeEmitter::getBinaryCodeForInstr(const MachineInstr &MI) const { - // this function will be automatically generated by the CodeEmitterGenerator - // using TableGen - return 0; -} +#include "MipsGenCodeEmitter.inc" Modified: head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td Fri Dec 9 22:23:45 2011 (r228379) @@ -76,14 +76,16 @@ def IsNotSingleFloat : Predicate<"!Subta // FP load. class FPLoad op, string opstr, PatFrag FOp, RegisterClass RC, Operand MemOpnd>: - FFI; + FMem; // FP store. class FPStore op, string opstr, PatFrag FOp, RegisterClass RC, Operand MemOpnd>: - FFI; + FMem; // Instructions that convert an FP value to 32-bit fixed point. multiclass FFR1_W_M funct, string opstr> { @@ -158,22 +160,28 @@ defm FSQRT : FFR1P_M<0x4, "sqrt", fsqr // stores, and moves between floating-point and integer registers. // When defining instructions, we reference all 32-bit registers, // regardless of register aliasing. -let fd = 0 in { - /// Move Control Registers From/To CPU Registers - def CFC1 : FFR<0x11, 0x0, 0x2, (outs CPURegs:$rt), (ins CCR:$fs), + +class FFRGPR _fmt, dag outs, dag ins, string asmstr, list pattern>: + FFR<0x11, 0x0, _fmt, outs, ins, asmstr, pattern> { + bits<5> rt; + let ft = rt; + let fd = 0; +} + +/// Move Control Registers From/To CPU Registers +def CFC1 : FFRGPR<0x2, (outs CPURegs:$rt), (ins CCR:$fs), "cfc1\t$rt, $fs", []>; - def CTC1 : FFR<0x11, 0x0, 0x6, (outs CCR:$rt), (ins CPURegs:$fs), - "ctc1\t$fs, $rt", []>; +def CTC1 : FFRGPR<0x6, (outs CCR:$fs), (ins CPURegs:$rt), + "ctc1\t$rt, $fs", []>; - def MFC1 : FFR<0x11, 0x00, 0x00, (outs CPURegs:$rt), (ins FGR32:$fs), +def MFC1 : FFRGPR<0x00, (outs CPURegs:$rt), (ins FGR32:$fs), "mfc1\t$rt, $fs", [(set CPURegs:$rt, (bitconvert FGR32:$fs))]>; - def MTC1 : FFR<0x11, 0x00, 0x04, (outs FGR32:$fs), (ins CPURegs:$rt), +def MTC1 : FFRGPR<0x04, (outs FGR32:$fs), (ins CPURegs:$rt), "mtc1\t$rt, $fs", [(set FGR32:$fs, (bitconvert CPURegs:$rt))]>; -} def FMOV_S : FFR1<0x6, 16, "mov", "s", FGR32, FGR32>; def FMOV_D32 : FFR1<0x6, 17, "mov", "d", AFGR64, AFGR64>, @@ -203,7 +211,7 @@ let Predicates = [NotN64] in { } /// Floating-point Aritmetic -defm FADD : FFR2P_M<0x10, "add", fadd, 1>; +defm FADD : FFR2P_M<0x00, "add", fadd, 1>; defm FDIV : FFR2P_M<0x03, "div", fdiv>; defm FMUL : FFR2P_M<0x02, "mul", fmul, 1>; defm FSUB : FFR2P_M<0x01, "sub", fsub>; @@ -218,12 +226,16 @@ def MIPS_BRANCH_T : PatLeaf<(i32 1)>; /// Floating Point Branch of False/True (Likely) let isBranch=1, isTerminator=1, hasDelaySlot=1, base=0x8, Uses=[FCR31] in - class FBRANCH : FFI<0x11, (outs), - (ins brtarget:$dst), !strconcat(asmstr, "\t$dst"), - [(MipsFPBrcond op, bb:$dst)]>; + class FBRANCH nd, bits<1> tf, PatLeaf op, string asmstr> : + FFI<0x11, (outs), (ins brtarget:$dst), !strconcat(asmstr, "\t$dst"), + [(MipsFPBrcond op, bb:$dst)]> { + let Inst{20-18} = 0; + let Inst{17} = nd; + let Inst{16} = tf; +} -def BC1F : FBRANCH; -def BC1T : FBRANCH; +def BC1F : FBRANCH<0, 0, MIPS_BRANCH_F, "bc1f">; +def BC1T : FBRANCH<0, 1, MIPS_BRANCH_T, "bc1t">; //===----------------------------------------------------------------------===// // Floating Point Flag Conditions @@ -249,11 +261,11 @@ def MIPS_FCOND_NGT : PatLeaf<(i32 15)>; /// Floating Point Compare let Defs=[FCR31] in { - def FCMP_S32 : FCC<0x0, (outs), (ins FGR32:$fs, FGR32:$ft, condcode:$cc), + def FCMP_S32 : FCC<0x10, (outs), (ins FGR32:$fs, FGR32:$ft, condcode:$cc), "c.$cc.s\t$fs, $ft", [(MipsFPCmp FGR32:$fs, FGR32:$ft, imm:$cc)]>; - def FCMP_D32 : FCC<0x1, (outs), (ins AFGR64:$fs, AFGR64:$ft, condcode:$cc), + def FCMP_D32 : FCC<0x11, (outs), (ins AFGR64:$fs, AFGR64:$ft, condcode:$cc), "c.$cc.d\t$fs, $ft", [(MipsFPCmp AFGR64:$fs, AFGR64:$ft, imm:$cc)]>, Requires<[NotFP64bit]>; @@ -287,7 +299,8 @@ let Predicates = [NotFP64bit] in { defm : MovnPats; } -let usesCustomInserter = 1, Uses = [FCR31], Constraints = "$F = $dst" in { +let cc = 0, usesCustomInserter = 1, Uses = [FCR31], + Constraints = "$F = $dst" in { // flag:float, data:int class CondMovFPInt tf, string instr_asm> : FCMOV [(set CPURegs:$dst, (cmov CPURegs:$T, CPURegs:$F))]>; // flag:float, data:float +let cc = 0 in class CondMovFPFP fmt, bits<1> tf, string instr_asm> : FFCMOV val> { + bits<4> Value = val; +} + +def Pseudo : Format<0>; +def FrmR : Format<1>; +def FrmI : Format<2>; +def FrmJ : Format<3>; +def FrmFR : Format<4>; +def FrmFI : Format<5>; +def FrmOther : Format<6>; // Instruction w/ a custom format + // Generic Mips Format class MipsInst pattern, - InstrItinClass itin>: Instruction + InstrItinClass itin, Format f>: Instruction { field bits<32> Inst; + Format Form = f; let Namespace = "Mips"; - bits<6> opcode; + bits<6> Opcode = 0; - // Top 5 bits are the 'opcode' field - let Inst{31-26} = opcode; + // Top 6 bits are the 'opcode' field + let Inst{31-26} = Opcode; - dag OutOperandList = outs; - dag InOperandList = ins; + let OutOperandList = outs; + let InOperandList = ins; let AsmString = asmstr; let Pattern = pattern; let Itinerary = itin; + + // + // Attributes specific to Mips instructions... + // + bits<4> FormBits = Form.Value; + + // TSFlags layout should be kept in sync with MipsInstrInfo.h. + let TSFlags{3-0} = FormBits; } // Mips Pseudo Instructions Format class MipsPseudo pattern>: - MipsInst { + MipsInst { + let isCodeGenOnly = 1; let isPseudo = 1; } @@ -54,7 +79,7 @@ class MipsPseudo op, bits<6> _funct, dag outs, dag ins, string asmstr, list pattern, InstrItinClass itin>: - MipsInst + MipsInst { bits<5> rd; bits<5> rs; @@ -62,7 +87,7 @@ class FR op, bits<6> _funct, dag bits<5> shamt; bits<6> funct; - let opcode = op; + let Opcode = op; let funct = _funct; let Inst{25-21} = rs; @@ -77,13 +102,13 @@ class FR op, bits<6> _funct, dag //===----------------------------------------------------------------------===// class FI op, dag outs, dag ins, string asmstr, list pattern, - InstrItinClass itin>: MipsInst + InstrItinClass itin>: MipsInst { bits<5> rt; bits<5> rs; bits<16> imm16; - let opcode = op; + let Opcode = op; let Inst{25-21} = rs; let Inst{20-16} = rt; @@ -92,13 +117,13 @@ class FI op, dag outs, dag ins, class CBranchBase op, dag outs, dag ins, string asmstr, list pattern, InstrItinClass itin>: - MipsInst + MipsInst { bits<5> rs; bits<5> rt; bits<16> imm16; - let opcode = op; + let Opcode = op; let Inst{25-21} = rs; let Inst{20-16} = rt; @@ -110,11 +135,11 @@ class CBranchBase op, dag outs, //===----------------------------------------------------------------------===// class FJ op, dag outs, dag ins, string asmstr, list pattern, - InstrItinClass itin>: MipsInst + InstrItinClass itin>: MipsInst { bits<26> addr; - let opcode = op; + let Opcode = op; let Inst{25-0} = addr; } @@ -138,7 +163,7 @@ class FJ op, dag outs, dag ins, class FFR op, bits<6> _funct, bits<5> _fmt, dag outs, dag ins, string asmstr, list pattern> : - MipsInst + MipsInst { bits<5> fd; bits<5> fs; @@ -146,7 +171,7 @@ class FFR op, bits<6> _funct, bi bits<5> fmt; bits<6> funct; - let opcode = op; + let Opcode = op; let funct = _funct; let fmt = _fmt; @@ -162,13 +187,13 @@ class FFR op, bits<6> _funct, bi //===----------------------------------------------------------------------===// class FFI op, dag outs, dag ins, string asmstr, list pattern>: - MipsInst + MipsInst { bits<5> ft; bits<5> base; bits<16> imm16; - let opcode = op; + let Opcode = op; let Inst{25-21} = base; let Inst{20-16} = ft; @@ -180,14 +205,14 @@ class FFI op, dag outs, dag ins, //===----------------------------------------------------------------------===// class FCC _fmt, dag outs, dag ins, string asmstr, list pattern> : - MipsInst + MipsInst { bits<5> fs; bits<5> ft; bits<4> cc; bits<5> fmt; - let opcode = 0x11; + let Opcode = 0x11; let fmt = _fmt; let Inst{25-21} = fmt; @@ -201,18 +226,18 @@ class FCC _fmt, dag outs, dag in class FCMOV _tf, dag outs, dag ins, string asmstr, list pattern> : - MipsInst + MipsInst { bits<5> rd; bits<5> rs; - bits<3> N; + bits<3> cc; bits<1> tf; - let opcode = 0; + let Opcode = 0; let tf = _tf; let Inst{25-21} = rs; - let Inst{20-18} = N; + let Inst{20-18} = cc; let Inst{17} = 0; let Inst{16} = tf; let Inst{15-11} = rd; @@ -222,20 +247,20 @@ class FCMOV _tf, dag outs, dag i class FFCMOV _fmt, bits<1> _tf, dag outs, dag ins, string asmstr, list pattern> : - MipsInst + MipsInst { bits<5> fd; bits<5> fs; - bits<3> N; + bits<3> cc; bits<5> fmt; bits<1> tf; - let opcode = 17; + let Opcode = 17; let fmt = _fmt; let tf = _tf; let Inst{25-21} = fmt; - let Inst{20-18} = N; + let Inst{20-18} = cc; let Inst{17} = 0; let Inst{16} = tf; let Inst{15-11} = fs; Modified: head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td Fri Dec 9 22:23:45 2011 (r228379) @@ -153,6 +153,7 @@ def uimm16 : Operand { def mem : Operand { let PrintMethod = "printMemOperand"; let MIOperandInfo = (ops CPURegs, simm16); + let EncoderMethod = "getMemEncoding"; } def mem64 : Operand { @@ -163,6 +164,17 @@ def mem64 : Operand { def mem_ea : Operand { let PrintMethod = "printMemOperandEA"; let MIOperandInfo = (ops CPURegs, simm16); + let EncoderMethod = "getMemEncoding"; +} + +// size operand of ext instruction +def size_ext : Operand { + let EncoderMethod = "getSizeExtEncoding"; +} + +// size operand of ins instruction +def size_ins : Operand { + let EncoderMethod = "getSizeInsEncoding"; } // Transformation Function - get the lower 16 bits. @@ -271,14 +283,14 @@ class ArithOverflowR op, bits<6> // Arithmetic and logical instructions with 2 register operands. class ArithLogicI op, string instr_asm, SDNode OpNode, Operand Od, PatLeaf imm_type, RegisterClass RC> : - FI; + FI; class ArithOverflowI op, string instr_asm, SDNode OpNode, Operand Od, PatLeaf imm_type, RegisterClass RC> : - FI; + FI; // Arithmetic Multiply ADD/SUB let rd = 0, shamt = 0, Defs = [HI, LO], Uses = [HI, LO] in @@ -319,16 +331,23 @@ class LogicR_shift_rotate_reg fu // Load Upper Imediate class LoadUpper op, string instr_asm>: - FI { + FI { let rs = 0; } +class FMem op, dag outs, dag ins, string asmstr, list pattern, + InstrItinClass itin>: FFI { + bits<21> addr; + let Inst{25-21} = addr{20-16}; + let Inst{15-0} = addr{15-0}; +} + // Memory Load/Store let canFoldAsLoad = 1 in class LoadM op, string instr_asm, PatFrag OpNode, RegisterClass RC, Operand MemOpnd, bit Pseudo>: - FI { let isPseudo = Pseudo; @@ -336,7 +355,7 @@ class LoadM op, string instr_asm class StoreM op, string instr_asm, PatFrag OpNode, RegisterClass RC, Operand MemOpnd, bit Pseudo>: - FI { let isPseudo = Pseudo; @@ -380,9 +399,9 @@ multiclass StoreM64 op, string i // Conditional Branch class CBranch op, string instr_asm, PatFrag cond_op, RegisterClass RC>: - CBranchBase { + CBranchBase { let isBranch = 1; let isTerminator = 1; let hasDelaySlot = 1; @@ -390,9 +409,9 @@ class CBranch op, string instr_a class CBranchZero op, bits<5> _rt, string instr_asm, PatFrag cond_op, RegisterClass RC>: - CBranchBase { + CBranchBase { let rt = _rt; let isBranch = 1; let isTerminator = 1; @@ -411,9 +430,9 @@ class SetCC_R op, bits<6> func, class SetCC_I op, string instr_asm, PatFrag cond_op, Operand Od, PatLeaf imm_type, RegisterClass RC>: - FI; // Unconditional branch @@ -450,10 +469,8 @@ let isCall=1, hasDelaySlot=1, } class BranchLink: - FI<0x1, (outs), (ins CPURegs:$rs, brtarget:$target, variable_ops), *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 23:26:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37093106564A; Fri, 9 Dec 2011 23:26:29 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D66C8FC17; Fri, 9 Dec 2011 23:26:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9NQS9X054316; Fri, 9 Dec 2011 23:26:28 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9NQSeT054313; Fri, 9 Dec 2011 23:26:28 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201112092326.pB9NQSeT054313@svn.freebsd.org> From: Brooks Davis Date: Fri, 9 Dec 2011 23:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228380 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 23:26:29 -0000 Author: brooks Date: Fri Dec 9 23:26:28 2011 New Revision: 228380 URL: http://svn.freebsd.org/changeset/base/228380 Log: Remove the unused if_free_type() function. X-MFC after: never Modified: head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Dec 9 22:23:45 2011 (r228379) +++ head/sys/net/if.c Fri Dec 9 23:26:28 2011 (r228380) @@ -494,19 +494,12 @@ if_free_internal(struct ifnet *ifp) } /* - * This version should only be called by intefaces that switch their type - * after calling if_alloc(). if_free_type() will go away again now that we - * have if_alloctype to cache the original allocation type. For now, assert - * that they match, since we require that in practice. + * Deregister an interface and free the associated storage. */ void -if_free_type(struct ifnet *ifp, u_char type) +if_free(struct ifnet *ifp) { - KASSERT(ifp->if_alloctype == type, - ("if_free_type: type (%d) != alloctype (%d)", type, - ifp->if_alloctype)); - ifp->if_flags |= IFF_DYING; /* XXX: Locking */ IFNET_WLOCK(); @@ -522,18 +515,6 @@ if_free_type(struct ifnet *ifp, u_char t } /* - * This is the normal version of if_free(), used by device drivers to free a - * detached network interface. The contents of if_free_type() will move into - * here when if_free_type() goes away. - */ -void -if_free(struct ifnet *ifp) -{ - - if_free_type(ifp, ifp->if_alloctype); -} - -/* * Interfaces to keep an ifnet type-stable despite the possibility of the * driver calling if_free(). If there are additional references, we defer * freeing the underlying data structure. Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Fri Dec 9 22:23:45 2011 (r228379) +++ head/sys/net/if_var.h Fri Dec 9 23:26:28 2011 (r228380) @@ -865,7 +865,6 @@ void if_down(struct ifnet *); struct ifmultiaddr * if_findmulti(struct ifnet *, struct sockaddr *); void if_free(struct ifnet *); -void if_free_type(struct ifnet *, u_char); void if_initname(struct ifnet *, const char *, int); void if_link_state_change(struct ifnet *, int); int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 23:26:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0618D1065777; Fri, 9 Dec 2011 23:26:35 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id E72DE8FC0A; Fri, 9 Dec 2011 23:26:31 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.4/8.14.4) with ESMTP id pB9NPON1068789; Fri, 9 Dec 2011 17:25:24 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.4/8.14.4/Submit) id pB9NPO8H068788; Fri, 9 Dec 2011 17:25:24 -0600 (CST) (envelope-from brooks) Date: Fri, 9 Dec 2011 17:25:24 -0600 From: Brooks Davis To: Ben Laurie Message-ID: <20111209232524.GD60242@lor.one-eyed-alien.net> References: <201111112257.pABMvqjl012442@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u65IjBhB3TIa72Vp" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r227459 - in head/sys: dev/lmc net netgraph netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 23:26:38 -0000 --u65IjBhB3TIa72Vp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 12, 2011 at 04:33:36PM -0800, Ben Laurie wrote: > On Fri, Nov 11, 2011 at 2:57 PM, Brooks Davis wrote: > > Author: brooks > > Date: Fri Nov 11 22:57:52 2011 > > New Revision: 227459 > > URL: http://svn.freebsd.org/changeset/base/227459 > > > > Log: > > ?In r191367 the need for if_free_type() was removed and a new member > > ?if_alloctype was used to store the origional interface type. ?Take > > ?advantage of this change by removing all existing uses of if_free_type= () > > ?in favor of if_free(). >=20 > Just an observation: this change removes an annotation that could be > useful for correctness checking. Do we care? Oops, I meant to respond to this earlier. I think in this case it's not a significant loss because we're only losing this annotation in 7 of the approximately 200 locations we free an interface. A better overall solution to this correctness issue would be a mechanism to assert that assignments to ifp->if_alloctype only occur if_alloc() and that similarly ifp->if_l2com isn't changed outside if_alloc/if_free(). -- Brooks >=20 > > > > ?MFC after: ? ?1 Month > > > > Modified: > > ?head/sys/dev/lmc/if_lmc.c > > ?head/sys/net/if_bridge.c > > ?head/sys/net/if_lagg.c > > ?head/sys/net/if_tap.c > > ?head/sys/net/if_vlan.c > > ?head/sys/netgraph/ng_fec.c > > ?head/sys/netinet/ip_carp.c > > > > Modified: head/sys/dev/lmc/if_lmc.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/dev/lmc/if_lmc.c ? Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/dev/lmc/if_lmc.c ? Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -4945,7 +4945,9 @@ lmc_ifnet_detach(softc_t *sc) > > ? /* Detach from the ifnet kernel interface. */ > > ? if_detach(sc->ifp); > > > > -# if (__FreeBSD_version >=3D 600000) > > +# if (defined(__FreeBSD__) && __FreeBSD_version >=3D 800082) > > + ?if_free(sc->ifp); > > +# elif (defined(__FreeBSD__) && __FreeBSD_version >=3D 600000) > > ? if_free_type(sc->ifp, NSPPP ? IFT_PPP : IFT_OTHER); > > ?# endif > > ? } > > > > Modified: head/sys/net/if_bridge.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/net/if_bridge.c ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/net/if_bridge.c ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -676,7 +676,7 @@ bridge_clone_destroy(struct ifnet *ifp) > > > > ? ? ? ?bstp_detach(&sc->sc_stp); > > ? ? ? ?ether_ifdetach(ifp); > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > > > ? ? ? ?/* Tear down the routing table. */ > > ? ? ? ?bridge_rtable_fini(sc); > > > > Modified: head/sys/net/if_lagg.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/net/if_lagg.c ? ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/net/if_lagg.c ? ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -275,7 +275,7 @@ lagg_clone_create(struct if_clone *ifc, > > ? ? ? ? ? ? ? ?if (lagg_protos[i].ti_proto =3D=3D LAGG_PROTO_DEFAULT) { > > ? ? ? ? ? ? ? ? ? ? ? ?sc->sc_proto =3D lagg_protos[i].ti_proto; > > ? ? ? ? ? ? ? ? ? ? ? ?if ((error =3D lagg_protos[i].ti_attach(sc)) != =3D 0) { > > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_free(ifp); > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?free(sc, M_DEVBUF); > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return (error); > > ? ? ? ? ? ? ? ? ? ? ? ?} > > @@ -293,7 +293,6 @@ lagg_clone_create(struct if_clone *ifc, > > ? ? ? ?ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); > > > > ? ? ? ?if_initname(ifp, ifc->ifc_name, unit); > > - ? ? ? ifp->if_type =3D IFT_ETHER; > > ? ? ? ?ifp->if_softc =3D sc; > > ? ? ? ?ifp->if_start =3D lagg_start; > > ? ? ? ?ifp->if_init =3D lagg_init; > > @@ -305,7 +304,7 @@ lagg_clone_create(struct if_clone *ifc, > > ? ? ? ?IFQ_SET_READY(&ifp->if_snd); > > > > ? ? ? ?/* > > - ? ? ? ?* Attach as an ordinary ethernet device, childs will be attach= ed > > + ? ? ? ?* Attach as an ordinary ethernet device, children will be atta= ched > > ? ? ? ? * as special device IFT_IEEE8023ADLAG. > > ? ? ? ? */ > > ? ? ? ?ether_ifattach(ifp, eaddr); > > @@ -352,7 +351,7 @@ lagg_clone_destroy(struct ifnet *ifp) > > > > ? ? ? ?ifmedia_removeall(&sc->sc_media); > > ? ? ? ?ether_ifdetach(ifp); > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > > > ? ? ? ?mtx_lock(&lagg_list_mtx); > > ? ? ? ?SLIST_REMOVE(&lagg_list, sc, lagg_softc, sc_entries); > > > > Modified: head/sys/net/if_tap.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/net/if_tap.c ? ? ? Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/net/if_tap.c ? ? ? Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -218,7 +218,7 @@ tap_destroy(struct tap_softc *tp) > > ? ? ? ?knlist_destroy(&tp->tap_rsel.si_note); > > ? ? ? ?destroy_dev(tp->tap_dev); > > ? ? ? ?ether_ifdetach(ifp); > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > > > ? ? ? ?mtx_destroy(&tp->tap_mtx); > > ? ? ? ?free(tp, M_TAP); > > > > Modified: head/sys/net/if_vlan.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/net/if_vlan.c ? ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/net/if_vlan.c ? ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -967,7 +967,7 @@ vlan_clone_create(struct if_clone *ifc, > > ? ? ? ? ? ? ? ? ? ? ? ? */ > > ? ? ? ? ? ? ? ? ? ? ? ?ether_ifdetach(ifp); > > ? ? ? ? ? ? ? ? ? ? ? ?vlan_unconfig(ifp); > > - ? ? ? ? ? ? ? ? ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? ? ? ? ? ? ? ? ? if_free(ifp); > > ? ? ? ? ? ? ? ? ? ? ? ?ifc_free_unit(ifc, unit); > > ? ? ? ? ? ? ? ? ? ? ? ?free(ifv, M_VLAN); > > > > @@ -989,7 +989,7 @@ vlan_clone_destroy(struct if_clone *ifc, > > > > ? ? ? ?ether_ifdetach(ifp); ? ?/* first, remove it from system-wide lis= ts */ > > ? ? ? ?vlan_unconfig(ifp); ? ? /* now it can be unconfigured and freed = */ > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > ? ? ? ?free(ifv, M_VLAN); > > ? ? ? ?ifc_free_unit(ifc, unit); > > > > > > Modified: head/sys/netgraph/ng_fec.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/netgraph/ng_fec.c ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/netgraph/ng_fec.c ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -1332,7 +1332,7 @@ ng_fec_shutdown(node_p node) > > ? ? ? ?} > > > > ? ? ? ?ether_ifdetach(priv->ifp); > > - ? ? ? if_free_type(priv->ifp, IFT_ETHER); > > + ? ? ? if_free(priv->ifp); > > ? ? ? ?ifmedia_removeall(&priv->ifmedia); > > ? ? ? ?ng_fec_free_unit(priv->unit); > > ? ? ? ?free(priv, M_NETGRAPH); > > > > Modified: head/sys/netinet/ip_carp.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/netinet/ip_carp.c ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/netinet/ip_carp.c ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -472,7 +472,7 @@ carp_clone_destroy(struct ifnet *ifp) > > ? ? ? ?mtx_unlock(&carp_mtx); > > ? ? ? ?bpfdetach(ifp); > > ? ? ? ?if_detach(ifp); > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > ?#ifdef INET > > ? ? ? ?free(sc->sc_imo.imo_membership, M_CARP); > > ?#endif > > >=20 --u65IjBhB3TIa72Vp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFO4pjjXY6L6fI4GtQRAgRhAKDDJ9KWqyWecmxR0FDnV4eNBGtjIACgsyaz +oWaHZHi/lAct3txgpia95Q= =t61w -----END PGP SIGNATURE----- --u65IjBhB3TIa72Vp-- From owner-svn-src-head@FreeBSD.ORG Fri Dec 9 23:37:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04467106566B; Fri, 9 Dec 2011 23:37:56 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E89A18FC08; Fri, 9 Dec 2011 23:37:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9Nbtio054695; Fri, 9 Dec 2011 23:37:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9Nbtx0054693; Fri, 9 Dec 2011 23:37:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112092337.pB9Nbtx0054693@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 23:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228381 - head/sys/dev/et X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 23:37:56 -0000 Author: yongari Date: Fri Dec 9 23:37:55 2011 New Revision: 228381 URL: http://svn.freebsd.org/changeset/base/228381 Log: FreeBSD driver does not require arpcom structure in softc. Modified: head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Fri Dec 9 23:26:28 2011 (r228380) +++ head/sys/dev/et/if_etvar.h Fri Dec 9 23:37:55 2011 (r228381) @@ -290,7 +290,6 @@ struct et_softc { struct resource *sc_irq_res; struct resource *sc_mem_res; - struct arpcom arpcom; int sc_if_flags; uint32_t sc_flags; /* ET_FLAG_ */ int sc_expcap; From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 01:01:45 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2236C106567F; Sat, 10 Dec 2011 01:01:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 125898FC1A; Sat, 10 Dec 2011 01:01:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBA11icp057324; Sat, 10 Dec 2011 01:01:44 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBA11inJ057322; Sat, 10 Dec 2011 01:01:44 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112100101.pBA11inJ057322@svn.freebsd.org> From: Dimitry Andric Date: Sat, 10 Dec 2011 01:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228383 - head/lib/clang/include/clang/Basic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 01:01:45 -0000 Author: dim Date: Sat Dec 10 01:01:44 2011 New Revision: 228383 URL: http://svn.freebsd.org/changeset/base/228383 Log: Use the correct upstream revision number for llvm/clang 3.0 release. The r145546 revision is from branches/release_30, the r145349 revision is from tags/RELEASE_30/final. MFC after: 1 week Modified: head/lib/clang/include/clang/Basic/Version.inc Modified: head/lib/clang/include/clang/Basic/Version.inc ============================================================================== --- head/lib/clang/include/clang/Basic/Version.inc Sat Dec 10 00:04:08 2011 (r228382) +++ head/lib/clang/include/clang/Basic/Version.inc Sat Dec 10 01:01:44 2011 (r228383) @@ -5,6 +5,6 @@ #define CLANG_VERSION_MINOR 0 #define CLANG_VENDOR "FreeBSD " -#define CLANG_VENDOR_SUFFIX " 20111209" +#define CLANG_VENDOR_SUFFIX " 20111210" -#define SVN_REVISION "145546" +#define SVN_REVISION "145349" From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 01:44:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 889551065708; Sat, 10 Dec 2011 01:44:24 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7879E8FC1B; Sat, 10 Dec 2011 01:44:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBA1iOWm058632; Sat, 10 Dec 2011 01:44:24 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBA1iOFS058630; Sat, 10 Dec 2011 01:44:24 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112100144.pBA1iOFS058630@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sat, 10 Dec 2011 01:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228384 - head/contrib/openpam/lib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 01:44:24 -0000 Author: des Date: Sat Dec 10 01:44:24 2011 New Revision: 228384 URL: http://svn.freebsd.org/changeset/base/228384 Log: Add minimal validation of the service name to fend off at least one attack vector against applications that allow the applicant to specify which policy to apply. Submitted by: Matthias Drochner MFC after: 1 week Modified: head/contrib/openpam/lib/openpam_configure.c Modified: head/contrib/openpam/lib/openpam_configure.c ============================================================================== --- head/contrib/openpam/lib/openpam_configure.c Sat Dec 10 01:01:44 2011 (r228383) +++ head/contrib/openpam/lib/openpam_configure.c Sat Dec 10 01:44:24 2011 (r228384) @@ -285,6 +285,13 @@ openpam_load_chain(pam_handle_t *pamh, size_t len; int r; + /* don't allow to escape from policy_path */ + if (strchr(service, '/')) { + openpam_log(PAM_LOG_ERROR, "invalid service name: %s", + service); + return (-PAM_SYSTEM_ERR); + } + for (path = openpam_policy_path; *path != NULL; ++path) { len = strlen(*path); if ((*path)[len - 1] == '/') { From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 06:55:03 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 701AC106564A; Sat, 10 Dec 2011 06:55:03 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 580CE8FC0A; Sat, 10 Dec 2011 06:55:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBA6t3sf070176; Sat, 10 Dec 2011 06:55:03 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBA6t37f070169; Sat, 10 Dec 2011 06:55:03 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201112100655.pBA6t37f070169@svn.freebsd.org> From: Jack F Vogel Date: Sat, 10 Dec 2011 06:55:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228386 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 06:55:03 -0000 Author: jfv Date: Sat Dec 10 06:55:02 2011 New Revision: 228386 URL: http://svn.freebsd.org/changeset/base/228386 Log: Part 1 of two parts, this is the shared code changes in support of new deltas for both em and igb drivers. Note that I am not able to track all the bugs fixed in this code, I am a consumer of it as a component of my core drivers. It is important to keep the FreeBSD drivers up to date with it however. One important note is there is a key fix for 82574 in this update. Also, there are lots of white space changes, I am not happy about them but have no control over it :) Modified: head/sys/dev/e1000/e1000_80003es2lan.c head/sys/dev/e1000/e1000_80003es2lan.h head/sys/dev/e1000/e1000_82540.c head/sys/dev/e1000/e1000_82541.c head/sys/dev/e1000/e1000_82543.c head/sys/dev/e1000/e1000_82571.c head/sys/dev/e1000/e1000_82575.c head/sys/dev/e1000/e1000_82575.h head/sys/dev/e1000/e1000_api.c head/sys/dev/e1000/e1000_api.h head/sys/dev/e1000/e1000_defines.h head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_ich8lan.c head/sys/dev/e1000/e1000_ich8lan.h head/sys/dev/e1000/e1000_mac.c head/sys/dev/e1000/e1000_nvm.c head/sys/dev/e1000/e1000_nvm.h head/sys/dev/e1000/e1000_phy.c head/sys/dev/e1000/e1000_phy.h head/sys/dev/e1000/e1000_regs.h head/sys/dev/e1000/e1000_vf.c Modified: head/sys/dev/e1000/e1000_80003es2lan.c ============================================================================== --- head/sys/dev/e1000/e1000_80003es2lan.c Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_80003es2lan.c Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -47,18 +47,18 @@ static void e1000_release_phy_80003es2la static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw); static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, - u16 *data); + u32 offset, + u16 *data); static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, - u16 data); + u32 offset, + u16 data); static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw); static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw); static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw); static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex); + u16 *duplex); static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); @@ -68,9 +68,9 @@ static s32 e1000_cfg_kmrn_10_100_80003e static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 *data); + u16 *data); static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 data); + u16 data); static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); @@ -85,8 +85,8 @@ static void e1000_power_down_phy_copper_ static const u16 e1000_gg82563_cable_length_table[] = { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; #define GG82563_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_gg82563_cable_length_table) / \ - sizeof(e1000_gg82563_cable_length_table[0])) + (sizeof(e1000_gg82563_cable_length_table) / \ + sizeof(e1000_gg82563_cable_length_table[0])) /** * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. @@ -100,34 +100,34 @@ static s32 e1000_init_phy_params_80003es DEBUGFUNC("e1000_init_phy_params_80003es2lan"); if (hw->phy.media_type != e1000_media_type_copper) { - phy->type = e1000_phy_none; + phy->type = e1000_phy_none; goto out; } else { phy->ops.power_up = e1000_power_up_phy_copper; phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan; } - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 100; - phy->type = e1000_phy_gg82563; - - phy->ops.acquire = e1000_acquire_phy_80003es2lan; - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.check_reset_block = e1000_check_reset_block_generic; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.release = e1000_release_phy_80003es2lan; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 100; + phy->type = e1000_phy_gg82563; + + phy->ops.acquire = e1000_acquire_phy_80003es2lan; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.check_reset_block = e1000_check_reset_block_generic; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.release = e1000_release_phy_80003es2lan; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan; - phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; - phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; - phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; + phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; + phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; + phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; - phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; + phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; /* This can only be done after all function pointers are setup. */ ret_val = e1000_get_phy_id(hw); @@ -154,19 +154,19 @@ static s32 e1000_init_nvm_params_80003es DEBUGFUNC("e1000_init_nvm_params_80003es2lan"); - nvm->opcode_bits = 8; - nvm->delay_usec = 1; + nvm->opcode_bits = 8; + nvm->delay_usec = 1; switch (nvm->override) { case e1000_nvm_override_spi_large: - nvm->page_size = 32; + nvm->page_size = 32; nvm->address_bits = 16; break; case e1000_nvm_override_spi_small: - nvm->page_size = 8; + nvm->page_size = 8; nvm->address_bits = 8; break; default: - nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; break; } @@ -174,7 +174,7 @@ static s32 e1000_init_nvm_params_80003es nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); + E1000_EECD_SIZE_EX_SHIFT); /* * Added to a constant, "size" becomes the left-shift value @@ -185,16 +185,16 @@ static s32 e1000_init_nvm_params_80003es /* EEPROM access above 16k is unsupported */ if (size > 14) size = 14; - nvm->word_size = 1 << size; + nvm->word_size = 1 << size; /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; - nvm->ops.read = e1000_read_nvm_eerd; - nvm->ops.release = e1000_release_nvm_80003es2lan; - nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; + nvm->ops.read = e1000_read_nvm_eerd; + nvm->ops.release = e1000_release_nvm_80003es2lan; + nvm->ops.update = e1000_update_nvm_checksum_generic; nvm->ops.valid_led_default = e1000_valid_led_default_generic; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.write = e1000_write_nvm_80003es2lan; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_80003es2lan; return E1000_SUCCESS; } @@ -215,13 +215,13 @@ static s32 e1000_init_mac_params_80003es hw->phy.media_type = e1000_media_type_internal_serdes; mac->ops.check_for_link = e1000_check_for_serdes_link_generic; mac->ops.setup_physical_interface = - e1000_setup_fiber_serdes_link_generic; + e1000_setup_fiber_serdes_link_generic; break; default: hw->phy.media_type = e1000_media_type_copper; mac->ops.check_for_link = e1000_check_for_copper_link_generic; mac->ops.setup_physical_interface = - e1000_setup_copper_link_80003es2lan; + e1000_setup_copper_link_80003es2lan; break; } @@ -234,9 +234,8 @@ static s32 e1000_init_mac_params_80003es /* FWSM register */ mac->has_fwsm = TRUE; /* ARC supported; valid only if manageability features are enabled. */ - mac->arc_subsystem_valid = - (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) - ? TRUE : FALSE; + mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) & + E1000_FWSM_MODE_MASK) ? TRUE : FALSE; /* Adaptive IFS not supported */ mac->adaptive_ifs = FALSE; @@ -330,7 +329,7 @@ static void e1000_release_phy_80003es2la } /** - * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register + * e1000_acquire_mac_csr_80003es2lan - Acquire right to access Kumeran register * @hw: pointer to the HW structure * * Acquire the semaphore to access the Kumeran interface. @@ -348,7 +347,7 @@ static s32 e1000_acquire_mac_csr_80003es } /** - * e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register + * e1000_release_mac_csr_80003es2lan - Release right to access Kumeran Register * @hw: pointer to the HW structure * * Release the semaphore used to access the Kumeran interface @@ -488,7 +487,7 @@ static void e1000_release_swfw_sync_8000 * Read the GG82563 PHY register. **/ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, u16 *data) + u32 offset, u16 *data) { s32 ret_val; u32 page_select; @@ -538,14 +537,14 @@ static s32 e1000_read_phy_reg_gg82563_80 usec_delay(200); ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); } else { ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); } e1000_release_phy_80003es2lan(hw); @@ -563,7 +562,7 @@ out: * Write to the GG82563 PHY register. **/ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, u16 data) + u32 offset, u16 data) { s32 ret_val; u32 page_select; @@ -613,14 +612,14 @@ static s32 e1000_write_phy_reg_gg82563_8 usec_delay(200); ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); } else { ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); } e1000_release_phy_80003es2lan(hw); @@ -639,7 +638,7 @@ out: * Write "words" of data to the ESB2 NVM. **/ static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data) + u16 words, u16 *data) { DEBUGFUNC("e1000_write_nvm_80003es2lan"); @@ -729,11 +728,10 @@ static s32 e1000_phy_force_speed_duplex_ usec_delay(1); if (hw->phy.autoneg_wait_to_complete) { - DEBUGOUT("Waiting for forced speed/duplex link " - "on GG82563 phy.\n"); + DEBUGOUT("Waiting for forced speed/duplex link on GG82563 phy.\n"); ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) goto out; @@ -749,12 +747,13 @@ static s32 e1000_phy_force_speed_duplex_ /* Try once more */ ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) goto out; } - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &phy_data); + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + &phy_data); if (ret_val) goto out; @@ -773,7 +772,8 @@ static s32 e1000_phy_force_speed_duplex_ * duplex. */ phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + phy_data); out: return ret_val; @@ -826,21 +826,20 @@ out: * Retrieve the current speed and duplex configuration. **/ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u16 *duplex) { s32 ret_val; DEBUGFUNC("e1000_get_link_up_info_80003es2lan"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, - speed, - duplex); + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, + duplex); hw->phy.ops.cfg_on_link_up(hw); } else { ret_val = e1000_get_speed_and_duplex_fiber_serdes_generic(hw, - speed, - duplex); + speed, + duplex); } return ret_val; @@ -939,21 +938,21 @@ static s32 e1000_init_hw_80003es2lan(str /* Disable IBIST slave mode (far-end loopback) */ e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, - &kum_reg_data); + &kum_reg_data); kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE; e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, - kum_reg_data); + kum_reg_data); /* Set the transmit descriptor write-back policy */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data); /* ...for both queues. */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data); /* Enable retransmit on late collisions */ @@ -981,9 +980,9 @@ static s32 e1000_init_hw_80003es2lan(str hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET >> - E1000_KMRNCTRLSTA_OFFSET_SHIFT, - &i); + E1000_KMRNCTRLSTA_OFFSET >> + E1000_KMRNCTRLSTA_OFFSET_SHIFT, + &i); if (!ret_val) { if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) == E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO) @@ -1056,11 +1055,7 @@ static s32 e1000_copper_link_setup_gg825 DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan"); - if (phy->reset_disable) - goto skip_reset; - - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - &data); + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &data); if (ret_val) goto out; @@ -1068,8 +1063,7 @@ static s32 e1000_copper_link_setup_gg825 /* Use 25MHz for both link down and 1000Base-T for Tx clock. */ data |= GG82563_MSCR_TX_CLK_1000MBPS_25; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, data); if (ret_val) goto out; @@ -1122,7 +1116,6 @@ static s32 e1000_copper_link_setup_gg825 goto out; } -skip_reset: /* Bypass Rx and Tx FIFO's */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, @@ -1132,14 +1125,12 @@ skip_reset: goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, - &data); + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, &data); if (ret_val) goto out; data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, - data); + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, data); if (ret_val) goto out; @@ -1169,18 +1160,18 @@ skip_reset: /* Enable Electrical Idle on the PHY */ data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, - data); + data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - &data); + &data); if (ret_val) goto out; data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - data); + data); if (ret_val) goto out; } @@ -1228,27 +1219,25 @@ static s32 e1000_setup_copper_link_80003 * polling the phy; this fixes erroneous timeouts at 10Mbps. */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4), - 0xFFFF); + 0xFFFF); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), - ®_data); + ®_data); if (ret_val) goto out; reg_data |= 0x3F; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), - reg_data); + reg_data); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, - ®_data); + E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, ®_data); if (ret_val) goto out; reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, reg_data); if (ret_val) goto out; @@ -1279,9 +1268,8 @@ static s32 e1000_cfg_on_link_up_80003es2 DEBUGFUNC("e1000_configure_on_link_up"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, - &speed, - &duplex); + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, &speed, + &duplex); if (ret_val) goto out; @@ -1314,8 +1302,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, + reg_data); if (ret_val) goto out; @@ -1327,12 +1315,12 @@ static s32 e1000_cfg_kmrn_10_100_80003es do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; @@ -1343,7 +1331,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es else reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + reg_data); out: return ret_val; @@ -1367,8 +1356,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2l reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, reg_data); if (ret_val) goto out; @@ -1380,19 +1368,20 @@ static s32 e1000_cfg_kmrn_1000_80003es2l do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + reg_data); out: return ret_val; @@ -1409,7 +1398,7 @@ out: * Release the semaphore before exiting. **/ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 *data) + u16 *data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1421,8 +1410,9 @@ static s32 e1000_read_kmrn_reg_80003es2l goto out; kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; + E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); @@ -1446,7 +1436,7 @@ out: * before exiting. **/ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 data) + u16 data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1458,8 +1448,9 @@ static s32 e1000_write_kmrn_reg_80003es2 goto out; kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | data; + E1000_KMRNCTRLSTA_OFFSET) | data; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); Modified: head/sys/dev/e1000/e1000_80003es2lan.h ============================================================================== --- head/sys/dev/e1000/e1000_80003es2lan.h Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_80003es2lan.h Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -35,48 +35,47 @@ #ifndef _E1000_80003ES2LAN_H_ #define _E1000_80003ES2LAN_H_ -#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 -#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 -#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 -#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F - -#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 -#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 -#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010 +#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 +#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 +#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 +#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F + +#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 +#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 +#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010 #define E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004 -#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 -#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 +#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 +#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 -#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C -#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 +#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C +#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */ -#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 +#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 -#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8 -#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9 +#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8 +#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9 /* GG82563 PHY Specific Status Register (Page 0, Register 16 */ -#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */ -#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060 -#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */ -#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */ -#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */ +#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */ +#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060 +#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */ +#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */ +#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */ /* PHY Specific Control Register 2 (Page 0, Register 26) */ -#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 - /* 1=Reverse Auto-Negotiation */ +#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 /* 1=Reverse Auto-Nego */ /* MAC Specific Control Register (Page 2, Register 21) */ /* Tx clock speed for Link Down and 1000BASE-T for the following speeds */ -#define GG82563_MSCR_TX_CLK_MASK 0x0007 -#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004 -#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005 -#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006 -#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007 +#define GG82563_MSCR_TX_CLK_MASK 0x0007 +#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004 +#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005 +#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006 +#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007 -#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */ +#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */ /* DSP Distance Register (Page 5, Register 26) */ /* @@ -86,19 +85,19 @@ * 3 = 110-140M * 4 = >140M */ -#define GG82563_DSPD_CABLE_LENGTH 0x0007 +#define GG82563_DSPD_CABLE_LENGTH 0x0007 /* Kumeran Mode Control Register (Page 193, Register 16) */ -#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 +#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 /* Max number of times Kumeran read/write should be validated */ -#define GG82563_MAX_KMRN_RETRY 0x5 +#define GG82563_MAX_KMRN_RETRY 0x5 /* Power Management Control Register (Page 193, Register 20) */ -#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 - /* 1=Enable SERDES Electrical Idle */ +/* 1=Enable SERDES Electrical Idle */ +#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 /* In-Band Control Register (Page 194, Register 18) */ -#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ +#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ #endif Modified: head/sys/dev/e1000/e1000_82540.c ============================================================================== --- head/sys/dev/e1000/e1000_82540.c Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_82540.c Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -68,23 +68,23 @@ static s32 e1000_init_phy_params_82540(s struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 10000; - phy->type = e1000_phy_m88; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 10000; + phy->type = e1000_phy_m88; /* Function Pointers */ - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - phy->ops.get_cable_length = e1000_get_cable_length_m88; - phy->ops.get_cfg_done = e1000_get_cfg_done_generic; - phy->ops.read_reg = e1000_read_phy_reg_m88; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.write_reg = e1000_write_phy_reg_m88; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82540; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.get_cfg_done = e1000_get_cfg_done_generic; + phy->ops.read_reg = e1000_read_phy_reg_m88; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.write_reg = e1000_write_phy_reg_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_82540; ret_val = e1000_get_phy_id(hw); if (ret_val) @@ -121,32 +121,32 @@ static s32 e1000_init_nvm_params_82540(s DEBUGFUNC("e1000_init_nvm_params_82540"); - nvm->type = e1000_nvm_eeprom_microwire; - nvm->delay_usec = 50; - nvm->opcode_bits = 3; + nvm->type = e1000_nvm_eeprom_microwire; + nvm->delay_usec = 50; + nvm->opcode_bits = 3; switch (nvm->override) { case e1000_nvm_override_microwire_large: - nvm->address_bits = 8; - nvm->word_size = 256; + nvm->address_bits = 8; + nvm->word_size = 256; break; case e1000_nvm_override_microwire_small: - nvm->address_bits = 6; - nvm->word_size = 64; + nvm->address_bits = 6; + nvm->word_size = 64; break; default: - nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; - nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; + nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; + nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; break; } /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_generic; - nvm->ops.read = e1000_read_nvm_microwire; - nvm->ops.release = e1000_release_nvm_generic; - nvm->ops.update = e1000_update_nvm_checksum_generic; - nvm->ops.valid_led_default = e1000_valid_led_default_generic; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.write = e1000_write_nvm_microwire; + nvm->ops.acquire = e1000_acquire_nvm_generic; + nvm->ops.read = e1000_read_nvm_microwire; + nvm->ops.release = e1000_release_nvm_generic; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_generic; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_microwire; return E1000_SUCCESS; } @@ -198,9 +198,9 @@ static s32 e1000_init_mac_params_82540(s mac->ops.setup_link = e1000_setup_link_generic; /* physical interface setup */ mac->ops.setup_physical_interface = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_setup_copper_link_82540 - : e1000_setup_fiber_serdes_link_82540; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_setup_copper_link_82540 + : e1000_setup_fiber_serdes_link_82540; /* check for link */ switch (hw->phy.media_type) { case e1000_media_type_copper: @@ -219,9 +219,9 @@ static s32 e1000_init_mac_params_82540(s } /* link info */ mac->ops.get_link_up_info = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_get_speed_and_duplex_copper_generic - : e1000_get_speed_and_duplex_fiber_serdes_generic; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_get_speed_and_duplex_copper_generic + : e1000_get_speed_and_duplex_fiber_serdes_generic; /* multicast address update */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; /* writing VFTA */ @@ -374,7 +374,7 @@ static s32 e1000_init_hw_82540(struct e1 txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0)); txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB; + E1000_TXDCTL_FULL_TX_DESC_WB; E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl); /* @@ -427,11 +427,13 @@ static s32 e1000_setup_copper_link_82540 if (hw->mac.type == e1000_82545_rev_3 || hw->mac.type == e1000_82546_rev_3) { - ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &data); + ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, + &data); if (ret_val) goto out; data |= 0x00000008; - ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, data); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, + data); if (ret_val) goto out; } @@ -508,9 +510,8 @@ static s32 e1000_adjust_serdes_amplitude if (nvm_data != NVM_RESERVED_WORD) { /* Adjust serdes output amplitude only. */ nvm_data &= NVM_SERDES_AMPLITUDE_MASK; - ret_val = hw->phy.ops.write_reg(hw, - M88E1000_PHY_EXT_CTRL, - nvm_data); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_EXT_CTRL, + nvm_data); if (ret_val) goto out; } @@ -535,9 +536,8 @@ static s32 e1000_set_vco_speed_82540(str /* Set PHY register 30, page 5, bit 8 to 0 */ - ret_val = hw->phy.ops.read_reg(hw, - M88E1000_PHY_PAGE_SELECT, - &default_page); + ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_PAGE_SELECT, + &default_page); if (ret_val) goto out; @@ -570,7 +570,7 @@ static s32 e1000_set_vco_speed_82540(str goto out; ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, - default_page); + default_page); out: return ret_val; @@ -587,7 +587,6 @@ out: **/ static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw) { - struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; u16 nvm_data; @@ -604,20 +603,18 @@ static s32 e1000_set_phy_mode_82540(stru if ((nvm_data != NVM_RESERVED_WORD) && (nvm_data & NVM_PHY_CLASS_A)) { ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, - 0x000B); + 0x000B); if (ret_val) { ret_val = -E1000_ERR_PHY; goto out; } - ret_val = hw->phy.ops.write_reg(hw, - M88E1000_PHY_GEN_CONTROL, - 0x8104); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, + 0x8104); if (ret_val) { ret_val = -E1000_ERR_PHY; goto out; } - phy->reset_disable = FALSE; } out: Modified: head/sys/dev/e1000/e1000_82541.c ============================================================================== --- head/sys/dev/e1000/e1000_82541.c Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_82541.c Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -300,7 +300,7 @@ void e1000_init_function_pointers_82541( **/ static s32 e1000_reset_hw_82541(struct e1000_hw *hw) { - u32 ledctl, ctrl, manc; + u32 ledctl, ctrl, icr, manc; DEBUGFUNC("e1000_reset_hw_82541"); @@ -364,7 +364,7 @@ static s32 e1000_reset_hw_82541(struct e E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF); /* Clear any pending interrupt events. */ - E1000_READ_REG(hw, E1000_ICR); + icr = E1000_READ_REG(hw, E1000_ICR); return E1000_SUCCESS; } @@ -390,7 +390,7 @@ static s32 e1000_init_hw_82541(struct e1 DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ } - + /* Storing the Speed Power Down value for later use */ ret_val = hw->phy.ops.read_reg(hw, IGP01E1000_GMII_FIFO, @@ -549,8 +549,6 @@ static s32 e1000_setup_copper_link_82541 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); - hw->phy.reset_disable = FALSE; - /* Earlier revs of the IGP phy require us to force MDI. */ if (hw->mac.type == e1000_82541 || hw->mac.type == e1000_82547) { dev_spec->dsp_config = e1000_dsp_config_disabled; Modified: head/sys/dev/e1000/e1000_82543.c ============================================================================== --- head/sys/dev/e1000/e1000_82543.c Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_82543.c Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -901,7 +901,7 @@ static s32 e1000_phy_hw_reset_82543(stru **/ static s32 e1000_reset_hw_82543(struct e1000_hw *hw) { - u32 ctrl; + u32 ctrl, icr; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 07:08:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD448106564A; Sat, 10 Dec 2011 07:08:52 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBC9F8FC0C; Sat, 10 Dec 2011 07:08:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBA78qrF070953; Sat, 10 Dec 2011 07:08:52 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBA78qSp070948; Sat, 10 Dec 2011 07:08:52 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201112100708.pBA78qSp070948@svn.freebsd.org> From: Jack F Vogel Date: Sat, 10 Dec 2011 07:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228387 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 07:08:52 -0000 Author: jfv Date: Sat Dec 10 07:08:52 2011 New Revision: 228387 URL: http://svn.freebsd.org/changeset/base/228387 Log: Part 2 of 2 New deltas for the 1G drivers. There have still been intermittent problems with apparent TX hangs for some customers. These have been problematic to reproduce but I believe these changes will address them. Testing on a number of fronts have been positive. EM: there is an important 'chicken bit' fix for 82574 in the shared code this is supported in the core here. - The TX path has been tightened up to improve performance. In particular UDP with jumbo frames was having problems, and the changes here have improved that. - OACTIVE has been used more carefully on the theory that some hangs may be due to a problem in this interaction - Problems with the RX init code, the "lazy" allocation and ring initialization has been found to cause problems in some newer client systems, and as it really is not that big a win (its not in a hot path) it seems best to remove it. - HWTSO was broken when VLAN HWTAGGING or HWFILTER is used, I found this was due to an error in setting up the descriptors in em_xmit. IGB: - TX is also improved here. With multiqueue I realized its very important to handle OACTIVE only under the CORE lock so there are no races between the queues. - Flow Control handling was broken in a couple ways, I have changed and I hope improved that in this delta. - UDP also had a problem in the TX path here, it was change to improve that. - On some hardware, with the driver static, a weird stray interrupt seems to sometimes fire and cause a panic in the RX mbuf refresh code. This is addressed by setting interrupts late in the init path, and also to set all interrupts bits off at the start of that. Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_igb.h head/sys/dev/e1000/if_lem.c head/sys/dev/e1000/if_lem.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sat Dec 10 06:55:02 2011 (r228386) +++ head/sys/dev/e1000/if_em.c Sat Dec 10 07:08:52 2011 (r228387) @@ -35,6 +35,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" #include "opt_inet.h" +#include "opt_inet6.h" #endif #include @@ -93,7 +94,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.2.3"; +char em_driver_version[] = "7.3.2"; /********************************************************************* * PCI Device ID Table @@ -286,6 +287,7 @@ static void em_handle_link(void *context static void em_set_sysctl_value(struct adapter *, const char *, const char *, int *, int); +static int em_set_flowcntl(SYSCTL_HANDLER_ARGS); static __inline void em_rx_discard(struct rx_ring *, int); @@ -382,13 +384,8 @@ static int em_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &em_rx_process_limit); SYSCTL_INT(_hw_em, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, &em_rx_process_limit, 0, - "Maximum number of received packets to process at a time, -1 means unlimited"); - -/* Flow control setting - default to FULL */ -static int em_fc_setting = e1000_fc_full; -TUNABLE_INT("hw.em.fc_setting", &em_fc_setting); -SYSCTL_INT(_hw_em, OID_AUTO, fc_setting, CTLFLAG_RDTUN, &em_fc_setting, 0, - "Flow control"); + "Maximum number of received packets to process " + "at a time, -1 means unlimited"); /* Energy efficient ethernet - default to OFF */ static int eee_setting = 0; @@ -473,6 +470,11 @@ em_attach(device_t dev) INIT_DEBUGOUT("em_attach: begin"); + if (resource_disabled("em", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } + adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; hw = &adapter->hw; @@ -489,6 +491,11 @@ em_attach(device_t dev) OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, em_sysctl_debug_info, "I", "Debug Information"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "fc", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + em_set_flowcntl, "I", "Flow Control"); + callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); /* Determine hardware and mac info */ @@ -560,11 +567,6 @@ em_attach(device_t dev) "max number of rx packets to process", &adapter->rx_process_limit, em_rx_process_limit); - /* Sysctl for setting the interface flow control */ - em_set_sysctl_value(adapter, "flow_control", - "configure flow control", - &adapter->fc_setting, em_fc_setting); - /* * Validate number of transmit and receive descriptors. It * must not exceed hardware maximum, and must be multiple @@ -714,7 +716,8 @@ em_attach(device_t dev) em_get_hw_control(adapter); /* Tell the stack that the interface is not active */ - adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + adapter->ifp->if_drv_flags |= IFF_DRV_OACTIVE; adapter->led_dev = led_create(em_led_func, adapter, device_get_nameunit(dev)); @@ -847,6 +850,8 @@ em_resume(device_t dev) struct ifnet *ifp = adapter->ifp; EM_CORE_LOCK(adapter); + if (adapter->hw.mac.type == e1000_pch2lan) + e1000_resume_workarounds_pchlan(&adapter->hw); em_init_locked(adapter); em_init_manageability(adapter); EM_CORE_UNLOCK(adapter); @@ -856,17 +861,15 @@ em_resume(device_t dev) } +#ifdef EM_MULTIQUEUE /********************************************************************* - * Transmit entry point + * Multiqueue Transmit routines * - * em_start is called by the stack to initiate a transmit. - * The driver will remain in this routine as long as there are - * packets to transmit and transmit resources are available. - * In case resources are not available stack is notified and - * the packet is requeued. + * em_mq_start is called by the stack to initiate a transmit. + * however, if busy the driver can queue the request rather + * than do an immediate send. It is this that is an advantage + * in this driver, rather than also having multiple tx queues. **********************************************************************/ - -#ifdef EM_MULTIQUEUE static int em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) { @@ -881,10 +884,6 @@ em_mq_start_locked(struct ifnet *ifp, st return (err); } - /* Call cleanup if number of TX descriptors low */ - if (txr->tx_avail <= EM_TX_CLEANUP_THRESHOLD) - em_txeof(txr); - enq = 0; if (m == NULL) { next = drbr_dequeue(ifp, txr->br); @@ -907,10 +906,6 @@ em_mq_start_locked(struct ifnet *ifp, st ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; - if (txr->tx_avail < EM_MAX_SCATTER) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - break; - } next = drbr_dequeue(ifp, txr->br); } @@ -919,6 +914,11 @@ em_mq_start_locked(struct ifnet *ifp, st txr->queue_status = EM_QUEUE_WORKING; txr->watchdog_time = ticks; } + + if (txr->tx_avail < EM_MAX_SCATTER) + em_txeof(txr); + if (txr->tx_avail < EM_MAX_SCATTER) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; return (err); } @@ -959,7 +959,6 @@ em_qflush(struct ifnet *ifp) } if_qflush(ifp); } - #endif /* EM_MULTIQUEUE */ static void @@ -995,7 +994,6 @@ em_start_locked(struct ifnet *ifp, struc if (em_xmit(txr, &m_head)) { if (m_head == NULL) break; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; IFQ_DRV_PREPEND(&ifp->if_snd, m_head); break; } @@ -1022,6 +1020,12 @@ em_start(struct ifnet *ifp) em_start_locked(ifp, txr); EM_TX_UNLOCK(txr); } + /* + ** If we went inactive schedule + ** a task to clean up. + */ + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) + taskqueue_enqueue(txr->tq, &txr->tx_task); return; } @@ -1038,11 +1042,12 @@ static int em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct adapter *adapter = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; -#ifdef INET - struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; +#if defined(INET) || defined(INET6) + struct ifaddr *ifa = (struct ifaddr *)data; #endif - int error = 0; + bool avoid_reset = FALSE; + int error = 0; if (adapter->in_detach) return (error); @@ -1050,23 +1055,22 @@ em_ioctl(struct ifnet *ifp, u_long comma switch (command) { case SIOCSIFADDR: #ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) { - /* - * XXX - * Since resetting hardware takes a very long time - * and results in link renegotiation we only - * initialize the hardware only when it is absolutely - * required. - */ + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; +#endif + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - EM_CORE_LOCK(adapter); - em_init_locked(adapter); - EM_CORE_UNLOCK(adapter); - } - arp_ifinit(ifp, ifa); - } else + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + em_init(adapter); +#ifdef INET + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); #endif + } else error = ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: @@ -1083,6 +1087,7 @@ em_ioctl(struct ifnet *ifp, u_long comma case e1000_ich10lan: case e1000_pch2lan: case e1000_82574: + case e1000_82583: case e1000_80003es2lan: /* 9K Jumbo Frame size */ max_frame_size = 9234; break; @@ -1090,7 +1095,6 @@ em_ioctl(struct ifnet *ifp, u_long comma max_frame_size = 4096; break; /* Adapters that do not support jumbo frames */ - case e1000_82583: case e1000_ich8lan: max_frame_size = ETHER_MAX_LEN; break; @@ -1145,11 +1149,6 @@ em_ioctl(struct ifnet *ifp, u_long comma } break; case SIOCSIFMEDIA: - /* - ** As the speed/duplex settings are being - ** changed, we need to reset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; /* Check SOL/IDER usage */ EM_CORE_LOCK(adapter); if (e1000_check_reset_block(&adapter->hw)) { @@ -1208,6 +1207,10 @@ em_ioctl(struct ifnet *ifp, u_long comma ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; reinit = 1; } + if (mask & IFCAP_VLAN_HWTSO) { + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + reinit = 1; + } if ((mask & IFCAP_WOL) && (ifp->if_capabilities & IFCAP_WOL) != 0) { if (mask & IFCAP_WOL_MCAST) @@ -1246,7 +1249,6 @@ em_init_locked(struct adapter *adapter) { struct ifnet *ifp = adapter->ifp; device_t dev = adapter->dev; - u32 pba; INIT_DEBUGOUT("em_init: begin"); @@ -1255,46 +1257,6 @@ em_init_locked(struct adapter *adapter) em_disable_intr(adapter); callout_stop(&adapter->timer); - /* - * Packet Buffer Allocation (PBA) - * Writing PBA sets the receive portion of the buffer - * the remainder is used for the transmit buffer. - */ - switch (adapter->hw.mac.type) { - /* Total Packet Buffer on these is 48K */ - case e1000_82571: - case e1000_82572: - case e1000_80003es2lan: - pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ - break; - case e1000_82573: /* 82573: Total Packet Buffer is 32K */ - pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ - break; - case e1000_82574: - case e1000_82583: - pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ - break; - case e1000_ich8lan: - pba = E1000_PBA_8K; - break; - case e1000_ich9lan: - case e1000_ich10lan: - pba = E1000_PBA_10K; - break; - case e1000_pchlan: - case e1000_pch2lan: - pba = E1000_PBA_26K; - break; - default: - if (adapter->max_frame_size > 8192) - pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ - else - pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ - } - - INIT_DEBUGOUT1("em_init: pba=%dK",pba); - E1000_WRITE_REG(&adapter->hw, E1000_PBA, pba); - /* Get the latest mac address, User can use a LAA */ bcopy(IF_LLADDR(adapter->ifp), adapter->hw.mac.addr, ETHER_ADDR_LEN); @@ -1373,6 +1335,7 @@ em_init_locked(struct adapter *adapter) /* Don't lose promiscuous settings */ em_set_promisc(adapter); + /* Set the interface as ACTIVE */ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1403,9 +1366,6 @@ em_init_locked(struct adapter *adapter) /* AMT based hardware can now take control from firmware */ if (adapter->has_manage && adapter->has_amt) em_get_hw_control(adapter); - - /* Don't reset the phy next time init gets called */ - adapter->hw.phy.reset_disable = TRUE; } static void @@ -1995,6 +1955,14 @@ retry: em_transmit_checksum_setup(txr, m_head, ip_off, ip, &txd_upper, &txd_lower); + if (m_head->m_flags & M_VLANTAG) { + /* Set the vlan id. */ + txd_upper |= + (htole16(m_head->m_pkthdr.ether_vtag) << 16); + /* Tell hardware to add tag */ + txd_lower |= htole32(E1000_TXD_CMD_VLE); + } + i = txr->next_avail_desc; /* Set up our transmit descriptors */ @@ -2052,15 +2020,13 @@ retry: if (tso_desc) /* TSO used an extra for sentinel */ txr->tx_avail -= txd_used; - if (m_head->m_flags & M_VLANTAG) { - /* Set the vlan id. */ - ctxd->upper.fields.special = - htole16(m_head->m_pkthdr.ether_vtag); - /* Tell hardware to add tag */ - ctxd->lower.data |= htole32(E1000_TXD_CMD_VLE); - } - tx_buffer->m_head = m_head; + /* + ** Here we swap the map so the last descriptor, + ** which gets the completion interrupt has the + ** real map, and the first descriptor gets the + ** unused map from this descriptor. + */ tx_buffer_mapped->map = tx_buffer->map; tx_buffer->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -2230,22 +2196,21 @@ em_local_timer(void *arg) else trigger = E1000_ICS_RXDMT0; - /* - ** Don't do TX watchdog check if we've been paused - */ - if (adapter->pause_frames) { - adapter->pause_frames = 0; - goto out; - } /* ** Check on the state of the TX queue(s), this ** can be done without the lock because its RO ** and the HUNG state will be static if set. */ - for (int i = 0; i < adapter->num_queues; i++, txr++) - if (txr->queue_status == EM_QUEUE_HUNG) + for (int i = 0; i < adapter->num_queues; i++, txr++) { + if ((txr->queue_status == EM_QUEUE_HUNG) && + (adapter->pause_frames == 0)) goto hung; -out: + /* Schedule a TX tasklet if needed */ + if (txr->tx_avail <= EM_MAX_SCATTER) + taskqueue_enqueue(txr->tq, &txr->tx_task); + } + + adapter->pause_frames = 0; callout_reset(&adapter->timer, hz, em_local_timer, adapter); #ifndef DEVICE_POLLING /* Trigger an RX interrupt to guarantee mbuf refresh */ @@ -2264,6 +2229,7 @@ hung: txr->me, txr->tx_avail, txr->next_to_clean); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; adapter->watchdog_events++; + adapter->pause_frames = 0; em_init_locked(adapter); } @@ -2362,7 +2328,8 @@ em_stop(void *arg) callout_stop(&adapter->timer); /* Tell the stack that the interface is no longer active */ - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; /* Unarm watchdog timer. */ for (int i = 0; i < adapter->num_queues; i++, txr++) { @@ -2458,6 +2425,7 @@ int em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; int error, rid = 0; /* Manually turn off all interrupts */ @@ -2479,11 +2447,17 @@ em_allocate_legacy(struct adapter *adapt * deferred processing contexts. */ TASK_INIT(&adapter->que_task, 0, em_handle_que, adapter); - TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); adapter->tq = taskqueue_create_fast("em_taskq", M_NOWAIT, taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", + taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s que", + device_get_nameunit(adapter->dev)); + /* Use a TX only tasklet for local timer */ + TASK_INIT(&txr->tx_task, 0, em_handle_tx, txr); + txr->tq = taskqueue_create_fast("em_txq", M_NOWAIT, + taskqueue_thread_enqueue, &txr->tq); + taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq", device_get_nameunit(adapter->dev)); + TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); if ((error = bus_setup_intr(dev, adapter->res, INTR_TYPE_NET, em_irq_fast, NULL, adapter, &adapter->tag)) != 0) { device_printf(dev, "Failed to register fast interrupt " @@ -2500,7 +2474,8 @@ em_allocate_legacy(struct adapter *adapt * * Setup the MSIX Interrupt handlers * This is not really Multiqueue, rather - * its just multiple interrupt vectors. + * its just seperate interrupt vectors + * for TX, RX, and Link. * **********************************************************************/ int @@ -2692,7 +2667,6 @@ em_setup_msix(struct adapter *adapter) device_t dev = adapter->dev; int val = 0; - /* ** Setup MSI/X for Hartwell: tests have shown ** use of two queues to be unstable, and to @@ -2712,16 +2686,18 @@ em_setup_msix(struct adapter *adapter) goto msi; } val = pci_msix_count(dev); - if (val < 3) { + /* We only need 3 vectors */ + if (val > 3) + val = 3; + if ((val != 3) && (val != 5)) { bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem); adapter->msix_mem = NULL; device_printf(adapter->dev, - "MSIX: insufficient vectors, using MSI\n"); + "MSIX: incorrect vectors, using MSI\n"); goto msi; } - val = 3; - adapter->num_queues = 1; + if (pci_alloc_msix(dev, &val) == 0) { device_printf(adapter->dev, "Using MSIX interrupts " @@ -2756,6 +2732,7 @@ em_reset(struct adapter *adapter) struct ifnet *ifp = adapter->ifp; struct e1000_hw *hw = &adapter->hw; u16 rx_buffer_size; + u32 pba; INIT_DEBUGOUT("em_reset: begin"); @@ -2771,6 +2748,48 @@ em_reset(struct adapter *adapter) } /* + * Packet Buffer Allocation (PBA) + * Writing PBA sets the receive portion of the buffer + * the remainder is used for the transmit buffer. + */ + switch (hw->mac.type) { + /* Total Packet Buffer on these is 48K */ + case e1000_82571: + case e1000_82572: + case e1000_80003es2lan: + pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ + break; + case e1000_82573: /* 82573: Total Packet Buffer is 32K */ + pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ + break; + case e1000_82574: + case e1000_82583: + pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ + break; + case e1000_ich8lan: + pba = E1000_PBA_8K; + break; + case e1000_ich9lan: + case e1000_ich10lan: + /* Boost Receive side for jumbo frames */ + if (adapter->max_frame_size > 4096) + pba = E1000_PBA_14K; + else + pba = E1000_PBA_10K; + break; + case e1000_pchlan: + case e1000_pch2lan: + pba = E1000_PBA_26K; + break; + default: + if (adapter->max_frame_size > 8192) + pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ + else + pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ + } + E1000_WRITE_REG(&adapter->hw, E1000_PBA, pba); + + /* * These parameters control the automatic generation (Tx) and * response (Rx) to Ethernet PAUSE frames. * - High water mark should allow for at least two frames to be @@ -2785,11 +2804,15 @@ em_reset(struct adapter *adapter) * - The pause time is fairly large at 1000 x 512ns = 512 usec. */ rx_buffer_size = ((E1000_READ_REG(hw, E1000_PBA) & 0xffff) << 10 ); - hw->fc.high_water = rx_buffer_size - roundup2(adapter->max_frame_size, 1024); hw->fc.low_water = hw->fc.high_water - 1500; + if (adapter->fc) /* locally set flow control value? */ + hw->fc.requested_mode = adapter->fc; + else + hw->fc.requested_mode = e1000_fc_full; + if (hw->mac.type == e1000_80003es2lan) hw->fc.pause_time = 0xFFFF; else @@ -2797,15 +2820,22 @@ em_reset(struct adapter *adapter) hw->fc.send_xon = TRUE; - /* Set Flow control, use the tunable location if sane */ - hw->fc.requested_mode = adapter->fc_setting; - - /* Workaround: no TX flow ctrl for PCH */ - if (hw->mac.type == e1000_pchlan) + /* Device specific overrides/settings */ + switch (hw->mac.type) { + case e1000_pchlan: + /* Workaround: no TX flow ctrl for PCH */ hw->fc.requested_mode = e1000_fc_rx_pause; - - /* Override - settings for PCH2LAN, ya its magic :) */ - if (hw->mac.type == e1000_pch2lan) { + hw->fc.pause_time = 0xFFFF; /* override */ + if (ifp->if_mtu > ETHERMTU) { + hw->fc.high_water = 0x3500; + hw->fc.low_water = 0x1500; + } else { + hw->fc.high_water = 0x5000; + hw->fc.low_water = 0x3000; + } + hw->fc.refresh_time = 0x1000; + break; + case e1000_pch2lan: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; @@ -2815,13 +2845,26 @@ em_reset(struct adapter *adapter) E1000_WRITE_REG(hw, E1000_PBA, 12); else E1000_WRITE_REG(hw, E1000_PBA, 26); + break; + case e1000_ich9lan: + case e1000_ich10lan: + if (ifp->if_mtu > ETHERMTU) { + hw->fc.high_water = 0x2800; + hw->fc.low_water = hw->fc.high_water - 8; + break; + } + /* else fall thru */ + default: + if (hw->mac.type == e1000_80003es2lan) + hw->fc.pause_time = 0xFFFF; + break; } /* Issue a global reset */ e1000_reset_hw(hw); E1000_WRITE_REG(hw, E1000_WUC, 0); em_disable_aspm(adapter); - + /* and a re-init */ if (e1000_init_hw(hw) < 0) { device_printf(dev, "Hardware Initialization Failed\n"); return; @@ -2866,28 +2909,25 @@ em_setup_interface(device_t dev, struct ifp->if_capabilities = ifp->if_capenable = 0; #ifdef EM_MULTIQUEUE - /* Multiqueue tx functions */ + /* Multiqueue stack interface */ ifp->if_transmit = em_mq_start; ifp->if_qflush = em_qflush; #endif ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; - ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; - - /* Enable TSO by default, can disable with ifconfig */ ifp->if_capabilities |= IFCAP_TSO4; - ifp->if_capenable |= IFCAP_TSO4; - /* * Tell the upper layer(s) we * support full VLAN capability */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_MTU; + ifp->if_capenable = ifp->if_capabilities; /* - ** Dont turn this on by default, if vlans are + ** Don't turn this on by default, if vlans are ** created on another pseudo device (eg. lagg) ** then vlan events are not passed thru, breaking ** operation, but with HW FILTER off it works. If @@ -3339,11 +3379,6 @@ em_initialize_transmit_unit(struct adapt /* Set the default values for the Tx Inter Packet Gap timer */ switch (adapter->hw.mac.type) { - case e1000_82542: - tipg = DEFAULT_82542_TIPG_IPGT; - tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; - tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; - break; case e1000_80003es2lan: tipg = DEFAULT_82543_TIPG_IPGR1; tipg |= DEFAULT_80003ES2LAN_TIPG_IPGR2 << @@ -3813,9 +3848,12 @@ em_txeof(struct tx_ring *txr) /* * If we have a minimum free, clear IFF_DRV_OACTIVE * to tell the stack that it is OK to send packets. + * Notice that all writes of OACTIVE happen under the + * TX lock which, with a single queue, guarantees + * sanity. */ - if (txr->tx_avail > EM_MAX_SCATTER) - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if (txr->tx_avail >= EM_MAX_SCATTER) + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* Disable watchdog if all clean */ if (txr->tx_avail == adapter->num_tx_desc) { @@ -3978,26 +4016,31 @@ em_setup_receive_ring(struct rx_ring *rx struct adapter *adapter = rxr->adapter; struct em_buffer *rxbuf; bus_dma_segment_t seg[1]; - int i, j, nsegs, error = 0; + int rsize, nsegs, error; /* Clear the ring contents */ EM_RX_LOCK(rxr); + rsize = roundup2(adapter->num_rx_desc * + sizeof(struct e1000_rx_desc), EM_DBA_ALIGN); + bzero((void *)rxr->rx_base, rsize); - /* Invalidate all descriptors */ - for (i = 0; i < adapter->num_rx_desc; i++) { - struct e1000_rx_desc* cur; - cur = &rxr->rx_base[i]; - cur->status = 0; + /* + ** Free current RX buffer structs and their mbufs + */ + for (int i = 0; i < adapter->num_rx_desc; i++) { + rxbuf = &rxr->rx_buffers[i]; + if (rxbuf->m_head != NULL) { + bus_dmamap_sync(rxr->rxtag, rxbuf->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->rxtag, rxbuf->map); + m_freem(rxbuf->m_head); + } } /* Now replenish the mbufs */ - i = j = rxr->next_to_refresh; - if (++j == adapter->num_rx_desc) - j = 0; - - while (j != rxr->next_to_check) { - rxbuf = &rxr->rx_buffers[i]; + for (int j = 0; j != adapter->num_rx_desc; ++j) { + rxbuf = &rxr->rx_buffers[j]; rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (rxbuf->m_head == NULL) { @@ -4021,11 +4064,13 @@ em_setup_receive_ring(struct rx_ring *rx rxbuf->map, BUS_DMASYNC_PREREAD); /* Update descriptor */ - rxr->rx_base[i].buffer_addr = htole64(seg[0].ds_addr); - i = j; - if (++j == adapter->num_rx_desc) - j = 0; + rxr->rx_base[j].buffer_addr = htole64(seg[0].ds_addr); } + rxr->next_to_check = 0; + rxr->next_to_refresh = 0; + bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + #ifdef DEV_NETMAP { /* @@ -4079,9 +4124,6 @@ em_setup_receive_ring(struct rx_ring *rx #endif /* DEV_NETMAP */ fail: - rxr->next_to_refresh = i; - bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); EM_RX_UNLOCK(rxr); return (error); } @@ -4108,10 +4150,9 @@ fail: * the rings that completed, the failing case will have * cleaned up for itself. 'q' failed, so its the terminus. */ - for (int i = 0, n = 0; i < q; ++i) { + for (int i = 0; i < q; ++i) { rxr = &adapter->rx_rings[i]; - n = rxr->next_to_check; - while(n != rxr->next_to_refresh) { + for (int n = 0; n < adapter->num_rx_desc; n++) { struct em_buffer *rxbuf; rxbuf = &rxr->rx_buffers[n]; if (rxbuf->m_head != NULL) { @@ -4121,8 +4162,6 @@ fail: m_freem(rxbuf->m_head); rxbuf->m_head = NULL; } - if (++n == adapter->num_rx_desc) - n = 0; } rxr->next_to_check = 0; rxr->next_to_refresh = 0; @@ -4166,8 +4205,7 @@ em_free_receive_buffers(struct rx_ring * INIT_DEBUGOUT("free_receive_buffers: begin"); if (rxr->rx_buffers != NULL) { - int i = rxr->next_to_check; - while(i != rxr->next_to_refresh) { + for (int i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->map != NULL) { bus_dmamap_sync(rxr->rxtag, rxbuf->map, @@ -4179,8 +4217,6 @@ em_free_receive_buffers(struct rx_ring * m_freem(rxbuf->m_head); rxbuf->m_head = NULL; } - if (++i == adapter->num_rx_desc) - i = 0; } free(rxr->rx_buffers, M_DEVBUF); rxr->rx_buffers = NULL; @@ -4221,7 +4257,9 @@ em_initialize_receive_unit(struct adapte * up the descriptor ring */ rctl = E1000_READ_REG(hw, E1000_RCTL); - E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + /* Do not disable if ever enabled on this hardware */ + if ((hw->mac.type != e1000_82574) && (hw->mac.type != e1000_82583)) + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); E1000_WRITE_REG(&adapter->hw, E1000_RADV, adapter->rx_abs_int_delay.value); @@ -4235,14 +4273,13 @@ em_initialize_receive_unit(struct adapte ** When using MSIX interrupts we need to throttle ** using the EITR register (82574 only) */ - if (hw->mac.type == e1000_82574) + if (hw->mac.type == e1000_82574) { for (int i = 0; i < 4; i++) E1000_WRITE_REG(hw, E1000_EITR_82574(i), DEFAULT_ITR); - - /* Disable accelerated ackknowledge */ - if (adapter->hw.mac.type == e1000_82574) + /* Disable accelerated acknowledge */ E1000_WRITE_REG(hw, E1000_RFCTL, E1000_RFCTL_ACK_DIS); + } if (ifp->if_capenable & IFCAP_RXCSUM) { rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); @@ -4268,7 +4305,8 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDBAH(i), (u32)(bus_addr >> 32)); E1000_WRITE_REG(hw, E1000_RDBAL(i), (u32)bus_addr); /* Setup the Head and Tail Descriptor Pointers */ - E1000_WRITE_REG(hw, E1000_RDH(i), rxr->next_to_check); + E1000_WRITE_REG(hw, E1000_RDH(i), 0); + E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); #ifdef DEV_NETMAP /* * an init() while a netmap client is active must @@ -4286,17 +4324,16 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDT(i), t); } else #endif /* DEV_NETMAP */ - E1000_WRITE_REG(hw, E1000_RDT(i), rxr->next_to_refresh); + E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); } - /* Set early receive threshold on appropriate hw */ + /* Set PTHRESH for improved jumbo performance */ if (((adapter->hw.mac.type == e1000_ich9lan) || (adapter->hw.mac.type == e1000_pch2lan) || (adapter->hw.mac.type == e1000_ich10lan)) && (ifp->if_mtu > ETHERMTU)) { u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); - E1000_WRITE_REG(hw, E1000_ERT, 0x100 | (1 << 13)); } if (adapter->hw.mac.type == e1000_pch2lan) { @@ -4443,10 +4480,6 @@ em_rxeof(struct rx_ring *rxr, int count, E1000_RXD_SPC_VLAN_MASK); sendmp->m_flags |= M_VLANTAG; } -#ifdef EM_MULTIQUEUE - sendmp->m_pkthdr.flowid = rxr->msix; - sendmp->m_flags |= M_FLOWID; -#endif #ifndef __NO_STRICT_ALIGNMENT skip: #endif @@ -4921,7 +4954,7 @@ em_enable_wakeup(device_t dev) (adapter->hw.mac.type == e1000_pchlan) || (adapter->hw.mac.type == e1000_ich9lan) || (adapter->hw.mac.type == e1000_ich10lan)) - e1000_disable_gig_wol_ich8lan(&adapter->hw); + e1000_suspend_workarounds_ich8lan(&adapter->hw); /* Keep the laser running on Fiber adapters */ if (adapter->hw.phy.media_type == e1000_media_type_fiber || @@ -5518,7 +5551,7 @@ em_add_hw_stats(struct adapter *adapter) static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter; + struct adapter *adapter = (struct adapter *)arg1; int error; int result; @@ -5533,10 +5566,8 @@ em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) * first 32 16-bit words of the EEPROM to * the screen. */ - if (result == 1) { - adapter = (struct adapter *)arg1; + if (result == 1) em_print_nvm_info(adapter); - } return (error); } @@ -5626,6 +5657,49 @@ em_set_sysctl_value(struct adapter *adap OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } + +/* +** Set flow control using sysctl: +** Flow control values: +** 0 - off +** 1 - rx pause +** 2 - tx pause +** 3 - full +*/ +static int +em_set_flowcntl(SYSCTL_HANDLER_ARGS) +{ + int error; + static int input = 3; /* default is full */ + struct adapter *adapter = (struct adapter *) arg1; + + error = sysctl_handle_int(oidp, &input, 0, req); + + if ((error) || (req->newptr == NULL)) + return (error); + + if (input == adapter->fc) /* no change? */ + return (error); + + switch (input) { + case e1000_fc_rx_pause: + case e1000_fc_tx_pause: + case e1000_fc_full: + case e1000_fc_none: + adapter->hw.fc.requested_mode = input; + adapter->fc = input; + break; + default: + /* Do nothing */ + return (error); + } + + adapter->hw.fc.current_mode = adapter->hw.fc.requested_mode; + e1000_force_mac_fc(&adapter->hw); + return (error); +} + + static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS) { @@ -5662,10 +5736,11 @@ em_print_debug_info(struct adapter *adap printf("Interface is RUNNING "); else printf("Interface is NOT RUNNING\n"); + if (adapter->ifp->if_drv_flags & IFF_DRV_OACTIVE) - printf("and ACTIVE\n"); - else printf("and INACTIVE\n"); + else + printf("and ACTIVE\n"); device_printf(dev, "hw tdh = %d, hw tdt = %d\n", E1000_READ_REG(&adapter->hw, E1000_TDH(0)), Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Sat Dec 10 06:55:02 2011 (r228386) +++ head/sys/dev/e1000/if_em.h Sat Dec 10 07:08:52 2011 (r228387) @@ -212,7 +212,8 @@ #define EM_BAR_MEM_TYPE_64BIT 0x00000004 #define EM_MSIX_BAR 3 /* On 82575 */ -#if !defined(SYSCTL_ADD_UQUAD) +/* More backward compatibility */ +#if __FreeBSD_version < 900000 #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #endif @@ -418,11 +419,11 @@ struct adapter { u32 shadow_vfta[EM_VFTA_SIZE]; /* Info about the interface */ - u8 link_active; + u16 link_active; + u16 fc; u16 link_speed; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 08:26:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B71FD1065670; Sat, 10 Dec 2011 08:26:53 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 56CFF8FC12; Sat, 10 Dec 2011 08:26:51 +0000 (UTC) Received: by bkbzv15 with SMTP id zv15so4853973bkb.13 for ; Sat, 10 Dec 2011 00:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=FVK8bYJ3T/B+hQEEn884hd+VdpkZXGYc7OB7/P8QSJo=; b=NqVBdssWUR4UNBW5pzEy6EjYdPDin53nUOacFe2NzjOIUNvsVIedZKpflwed6PrVyw BgKdf9b4VA/cNoxELT9/tKOCm/u/dj4Y8qJa+sDNzoYB8ZJqHnmD+hkYHX+483Si/EEy ZUnWGEO5vu8H5aUoWRiuM28JEIwcjT5DkvEmI= Received: by 10.205.81.141 with SMTP id zy13mr5534365bkb.50.1323505611159; Sat, 10 Dec 2011 00:26:51 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id d2sm15586371bky.11.2011.12.10.00.26.47 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 10 Dec 2011 00:26:49 -0800 (PST) From: Mikolaj Golub To: John Baldwin References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <201111281330.11720.jhb@freebsd.org> <86liqt1ier.fsf@kopusha.home.net> <4EE1024C.6040800@FreeBSD.org> <86k466aip3.fsf@kopusha.home.net> <4EE12CE0.5070803@FreeBSD.org> X-Comment-To: John Baldwin Sender: Mikolaj Golub Date: Sat, 10 Dec 2011 10:26:46 +0200 In-Reply-To: <4EE12CE0.5070803@FreeBSD.org> (John Baldwin's message of "Thu, 08 Dec 2011 16:32:16 -0500") Message-ID: <86y5ukvnll.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 08:26:53 -0000 --=-=-= On Thu, 08 Dec 2011 16:32:16 -0500 John Baldwin wrote: >> JB> Hmm, I would stick as close to limits output as possible. I would >> JB> consider duplicating the unit field in each of soft and hard, so you >> JB> end up with something like this: >> >> JB> PID COMM RLIMIT SOFT HARD >> JB> 48798 zsh cputime 100000 secs infinity secs >> JB> 48798 zsh filesize infinity kb infinity kb >> JB> 48798 zsh datasize 524288 kb 524288 kb >> >> JB> etc. >> >> Ok. >> >> JB> (Things like 'openfiles' is simply more intuitive than 'nofile' (no >> JB> file?, huh? oh, num open files.. (except not all users will make the >> JB> last step there). >> >> Then why do we have so non-intuitive rlimit_ident names? >> >> It looks like they are used only in procfs_rlimit.c. Do procfs(5) users always >> make that last step with 'nofile'? :-) JB> Well, I suspect it's best not to change the names in procfs in case JB> there are existing binaries that parse the output of that file JB> (unfortunately). >> Is it possible to change rlimit_ident names? Just to ones that are used by >> limit(1) or (if they look too long) to something like below: JB> Hmm, I have no idea what other things might use rlimit_ident. Probably JB> not many. (Also, for fun, note that the 'ulimit' and 'limit' built-in JB> commands in sh and csh also have their own sets of names, fun!) I would JB> maybe add a rlimit_names[] (just leave rlimit_ident alone), and give JB> that the names from limits(1), and change both procstat and sh's JB> ulimit' command to use those. Adding yet another rlimit names to the header file does not look so attractive for me as it was just using/reusing what we had :-). So I decided to hardcode the names in procstat_rlimit.c (see the attached patch). Output example: PID COMM RLIMIT SOFT HARD 11949 zsh cputime 10000 sec infinity 11949 zsh filesize infinity infinity 11949 zsh datasize 524288 kB 524288 kB 11949 zsh stacksize 65536 kB 65536 kB 11949 zsh coredumpsize 190734 MB 190734 MB 11949 zsh memoryuse infinity infinity 11949 zsh memorylocked infinity infinity 11949 zsh maxprocesses 5547 5547 11949 zsh openfiles 11095 11095 11949 zsh sbsize infinity infinity 11949 zsh vmemoryuse infinity infinity 11949 zsh pseudo-terminals infinity infinity 11949 zsh swapuse infinity infinity -- Mikolaj Golub --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=procstat_rlimit.c.patch Index: usr.bin/procstat/procstat_rlimit.c =================================================================== --- usr.bin/procstat/procstat_rlimit.c (revision 228285) +++ usr.bin/procstat/procstat_rlimit.c (working copy) @@ -28,7 +28,6 @@ #include #include -#define _RLIMIT_IDENT #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -43,17 +43,60 @@ #include "procstat.h" +static struct { + const char *name; + const char *suffix; +} rlimit_param[13] = { + {"cputime", "sec"}, + {"filesize", "B "}, + {"datasize", "B "}, + {"stacksize", "B "}, + {"coredumpsize", "B "}, + {"memoryuse", "B "}, + {"memorylocked", "B "}, + {"maxprocesses", " "}, + {"openfiles", " "}, + {"sbsize", "B "}, + {"vmemoryuse", "B "}, + {"pseudo-terminals", " "}, + {"swapuse", "B "}, +}; + +#if RLIM_NLIMITS > 13 +#error "Resource limits have grown. Add new entries to rlimit_param[]." +#endif + static struct rlimit rlimit[RLIM_NLIMITS]; +static +const char *humanize_rlimit(int indx, rlim_t limit) +{ + static char buf[14]; + int scale; + + if (limit == RLIM_INFINITY) + return "infinity "; + + scale = humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE | HN_GETSCALE, HN_DECIMAL); + (void)humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE, HN_DECIMAL); + /* Pad with one space if there is no suffix prefix. */ + if (scale == 0) + sprintf(buf + strlen(buf), " "); + return (buf); +} + void procstat_rlimit(struct kinfo_proc *kipp) { int error, i, name[4]; size_t len; - if (!hflag) - printf("%5s %-16s %-10s %12s %12s\n", "PID", "COMM", "RLIMIT", - "CURRENT", "MAX"); + if (!hflag) { + printf("%5s %-16s %-16s %16s %16s\n", + "PID", "COMM", "RLIMIT", "SOFT ", "HARD "); + } name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_RLIMIT; @@ -68,11 +111,9 @@ procstat_rlimit(struct kinfo_proc *kipp) return; for (i = 0; i < RLIM_NLIMITS; i++) { - printf("%5d %-16s %-10s %12jd %12jd\n", kipp->ki_pid, - kipp->ki_comm, rlimit_ident[i], - rlimit[i].rlim_cur == RLIM_INFINITY ? - -1 : rlimit[i].rlim_cur, - rlimit[i].rlim_max == RLIM_INFINITY ? - -1 : rlimit[i].rlim_max); + printf("%5d %-16s %-16s ", kipp->ki_pid, kipp->ki_comm, + rlimit_param[i].name); + printf("%16s ", humanize_rlimit(i, rlimit[i].rlim_cur)); + printf("%16s\n", humanize_rlimit(i, rlimit[i].rlim_max)); } } --=-=-=-- From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 10:52:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7D7D106564A; Sat, 10 Dec 2011 10:52:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A79AD8FC0A; Sat, 10 Dec 2011 10:52:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAAqsUO092533; Sat, 10 Dec 2011 10:52:54 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAAqsoV092530; Sat, 10 Dec 2011 10:52:54 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201112101052.pBAAqsoV092530@svn.freebsd.org> From: Michael Tuexen Date: Sat, 10 Dec 2011 10:52:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228391 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 10:52:54 -0000 Author: tuexen Date: Sat Dec 10 10:52:54 2011 New Revision: 228391 URL: http://svn.freebsd.org/changeset/base/228391 Log: Fix a bug reported by Irene Ruengeler which resulted in not sending out HEARTBEATs when requested by the user. The HEARTBEATs were only queued, but not actually sent out. MFC after: 2 months. Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sat Dec 10 09:34:39 2011 (r228390) +++ head/sys/netinet/sctp_constants.h Sat Dec 10 10:52:54 2011 (r228391) @@ -391,6 +391,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_OUTPUT_FROM_COOKIE_ACK 14 #define SCTP_OUTPUT_FROM_DRAIN 15 #define SCTP_OUTPUT_FROM_CLOSING 16 +#define SCTP_OUTPUT_FROM_SOCKOPT 17 + /* SCTP chunk types are moved sctp.h for application (NAT, FW) use */ /* align to 32-bit sizes */ Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Dec 10 09:34:39 2011 (r228390) +++ head/sys/netinet/sctp_usrreq.c Sat Dec 10 10:52:54 2011 (r228391) @@ -4727,6 +4727,7 @@ sctp_setopt(struct socket *so, int optna if (paddrp->spp_flags & SPP_HB_DEMAND) { /* on demand HB */ sctp_send_hb(stcb, net, SCTP_SO_LOCKED); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); } if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) { From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 13:02:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E7D6106564A; Sat, 10 Dec 2011 13:02:53 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DE848FC08; Sat, 10 Dec 2011 13:02:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAD2rEH006200; Sat, 10 Dec 2011 13:02:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAD2r5n006197; Sat, 10 Dec 2011 13:02:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201112101302.pBAD2r5n006197@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 10 Dec 2011 13:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228392 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 13:02:53 -0000 Author: pjd Date: Sat Dec 10 13:02:52 2011 New Revision: 228392 URL: http://svn.freebsd.org/changeset/base/228392 Log: Move ru_inblock increment into arc_read_nolock() so we don't account for cached reads. Discussed with: gibbs No objections from: avg Tested by: Marcus Reid MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Dec 10 10:52:54 2011 (r228391) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Dec 10 13:02:52 2011 (r228392) @@ -3105,6 +3105,9 @@ top: ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), demand, prefetch, hdr->b_type != ARC_BUFC_METADATA, data, metadata, misses); +#ifdef _KERNEL + curthread->td_ru.ru_inblock++; +#endif if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) { /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Dec 10 10:52:54 2011 (r228391) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Dec 10 13:02:52 2011 (r228392) @@ -627,10 +627,6 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio } else if (db->db_state == DB_UNCACHED) { spa_t *spa = dn->dn_objset->os_spa; -#ifdef _KERNEL - curthread->td_ru.ru_inblock++; -#endif - if (zio == NULL) zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); dbuf_read_impl(db, zio, &flags); From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 18:00:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A3BE106566B; Sat, 10 Dec 2011 18:00:53 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A7078FC16; Sat, 10 Dec 2011 18:00:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAI0r6Z016110; Sat, 10 Dec 2011 18:00:53 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAI0rMI016108; Sat, 10 Dec 2011 18:00:53 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201112101800.pBAI0rMI016108@svn.freebsd.org> From: Jack F Vogel Date: Sat, 10 Dec 2011 18:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228393 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:00:53 -0000 Author: jfv Date: Sat Dec 10 18:00:53 2011 New Revision: 228393 URL: http://svn.freebsd.org/changeset/base/228393 Log: Fix NETMAP code problem in the build. Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sat Dec 10 13:02:52 2011 (r228392) +++ head/sys/dev/e1000/if_em.c Sat Dec 10 18:00:53 2011 (r228393) @@ -4100,7 +4100,7 @@ em_setup_receive_ring(struct rx_ring *rx if (sj < 0) sj += adapter->num_rx_desc; - for (j = 0; j != adapter->num_rx_desc; j++, sj++) { + for (int j = 0; j != adapter->num_rx_desc; j++, sj++) { void *addr; int sz; From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 18:11:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D1271065672; Sat, 10 Dec 2011 18:11:06 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C9388FC08; Sat, 10 Dec 2011 18:11:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIB6e5016476; Sat, 10 Dec 2011 18:11:06 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIB6fb016472; Sat, 10 Dec 2011 18:11:06 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112101811.pBAIB6fb016472@svn.freebsd.org> From: Ed Schouten Date: Sat, 10 Dec 2011 18:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228394 - in head: usr.bin/find usr.bin/lex usr.sbin/mount_portalfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:11:06 -0000 Author: ed Date: Sat Dec 10 18:11:06 2011 New Revision: 228394 URL: http://svn.freebsd.org/changeset/base/228394 Log: Replace char copyright[] by static const char copyright[]. It seems the latter is used throughout the tree. Modified: head/usr.bin/find/main.c head/usr.bin/lex/main.c head/usr.sbin/mount_portalfs/mount_portalfs.c Modified: head/usr.bin/find/main.c ============================================================================== --- head/usr.bin/find/main.c Sat Dec 10 18:00:53 2011 (r228393) +++ head/usr.bin/find/main.c Sat Dec 10 18:11:06 2011 (r228394) @@ -31,7 +31,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1990, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ Modified: head/usr.bin/lex/main.c ============================================================================== --- head/usr.bin/lex/main.c Sat Dec 10 18:00:53 2011 (r228393) +++ head/usr.bin/lex/main.c Sat Dec 10 18:11:06 2011 (r228394) @@ -27,7 +27,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1990 The Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ Modified: head/usr.sbin/mount_portalfs/mount_portalfs.c ============================================================================== --- head/usr.sbin/mount_portalfs/mount_portalfs.c Sat Dec 10 18:00:53 2011 (r228393) +++ head/usr.sbin/mount_portalfs/mount_portalfs.c Sat Dec 10 18:11:06 2011 (r228394) @@ -31,7 +31,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1992, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 18:21:04 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1852A106566B; Sat, 10 Dec 2011 18:21:04 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 088F58FC08; Sat, 10 Dec 2011 18:21:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIL3Qb016817; Sat, 10 Dec 2011 18:21:03 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIL3B1016815; Sat, 10 Dec 2011 18:21:03 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112101821.pBAIL3B1016815@svn.freebsd.org> From: Ed Schouten Date: Sat, 10 Dec 2011 18:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228395 - head/usr.bin/grep X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:21:04 -0000 Author: ed Date: Sat Dec 10 18:21:03 2011 New Revision: 228395 URL: http://svn.freebsd.org/changeset/base/228395 Log: Add missing "static const" to long options table. This table is only used in this C file and passed to getopt_long(), so we can safely add static and const to it. Modified: head/usr.bin/grep/grep.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Sat Dec 10 18:11:06 2011 (r228394) +++ head/usr.bin/grep/grep.c Sat Dec 10 18:21:03 2011 (r228395) @@ -166,7 +166,7 @@ usage(void) static const char *optstr = "0123456789A:B:C:D:EFGHIJMLOPSRUVZabcd:e:f:hilm:nopqrsuvwxXy"; -struct option long_options[] = +static const struct option long_options[] = { {"binary-files", required_argument, NULL, BIN_OPT}, {"help", no_argument, NULL, HELP_OPT}, From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 18:27:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF0DA1065672; Sat, 10 Dec 2011 18:27:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D52EF8FC12; Sat, 10 Dec 2011 18:27:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIRtMa017056; Sat, 10 Dec 2011 18:27:55 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIRtg3017051; Sat, 10 Dec 2011 18:27:55 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112101827.pBAIRtg3017051@svn.freebsd.org> From: Ed Schouten Date: Sat, 10 Dec 2011 18:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228396 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:27:56 -0000 Author: ed Date: Sat Dec 10 18:27:55 2011 New Revision: 228396 URL: http://svn.freebsd.org/changeset/base/228396 Log: Add more static keywords to truss(1) source code. There are some tables in the source code that are only used by the individual source files themselves. Therefore there is no need to export them. Modified: head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/main.c head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/amd64-linux32.c ============================================================================== --- head/usr.bin/truss/amd64-linux32.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/amd64-linux32.c Sat Dec 10 18:27:55 2011 (r228396) @@ -228,7 +228,7 @@ amd64_linux32_syscall_entry(struct truss /* * Linux syscalls return negative errno's, we do positive and map them */ -const int bsd_to_linux_errno[] = { +static const int bsd_to_linux_errno[] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, Modified: head/usr.bin/truss/i386-linux.c ============================================================================== --- head/usr.bin/truss/i386-linux.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/i386-linux.c Sat Dec 10 18:27:55 2011 (r228396) @@ -228,7 +228,7 @@ i386_linux_syscall_entry(struct trussinf /* * Linux syscalls return negative errno's, we do positive and map them */ -const int bsd_to_linux_errno[] = { +static const int bsd_to_linux_errno[] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, Modified: head/usr.bin/truss/main.c ============================================================================== --- head/usr.bin/truss/main.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/main.c Sat Dec 10 18:27:55 2011 (r228396) @@ -74,7 +74,7 @@ usage(void) * WARNING! "FreeBSD a.out" must be first, or set_etype will not * work correctly. */ -struct ex_types { +static struct ex_types { const char *type; void (*enter_syscall)(struct trussinfo *, int); long (*exit_syscall)(struct trussinfo *, int); Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/syscalls.c Sat Dec 10 18:27:55 2011 (r228396) @@ -89,7 +89,7 @@ static const char rcsid[] = /* * This should probably be in its own file, sorted alphabetically. */ -struct syscall syscalls[] = { +static struct syscall syscalls[] = { { .name = "fcntl", .ret_type = 1, .nargs = 3, .args = { { Int, 0 } , { Fcntl, 1 }, { Fcntlflag | OUT, 2 } } }, { .name = "fork", .ret_type = 1, .nargs = 0 }, @@ -283,7 +283,7 @@ static struct xlat kevent_flags[] = { X(EV_CLEAR) X(EV_FLAG1) X(EV_ERROR) X(EV_EOF) XEND }; -struct xlat poll_flags[] = { +static struct xlat poll_flags[] = { X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR) X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND) X(POLLWRBAND) X(POLLINIGNEOF) XEND From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 18:35:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8261C106564A; Sat, 10 Dec 2011 18:35:26 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 725D18FC08; Sat, 10 Dec 2011 18:35:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIZQTv017320; Sat, 10 Dec 2011 18:35:26 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIZQpc017318; Sat, 10 Dec 2011 18:35:26 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112101835.pBAIZQpc017318@svn.freebsd.org> From: Ed Schouten Date: Sat, 10 Dec 2011 18:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228397 - head/libexec/comsat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:35:26 -0000 Author: ed Date: Sat Dec 10 18:35:26 2011 New Revision: 228397 URL: http://svn.freebsd.org/changeset/base/228397 Log: Make comsat(8) approximately 15% smaller. This program only consists of a single C file, so simply mark everything except main() static. Modified: head/libexec/comsat/comsat.c Modified: head/libexec/comsat/comsat.c ============================================================================== --- head/libexec/comsat/comsat.c Sat Dec 10 18:27:55 2011 (r228396) +++ head/libexec/comsat/comsat.c Sat Dec 10 18:35:26 2011 (r228397) @@ -68,17 +68,17 @@ static const char rcsid[] = #include #include -int debug = 0; +static int debug = 0; #define dsyslog if (debug) syslog #define MAXIDLE 120 -char hostname[MAXHOSTNAMELEN]; +static char hostname[MAXHOSTNAMELEN]; -void jkfprintf(FILE *, char[], char[], off_t); -void mailfor(char *); -void notify(struct utmpx *, char[], off_t, int); -void reapchildren(int); +static void jkfprintf(FILE *, char[], char[], off_t); +static void mailfor(char *); +static void notify(struct utmpx *, char[], off_t, int); +static void reapchildren(int); int main(int argc __unused, char *argv[] __unused) @@ -115,13 +115,13 @@ main(int argc __unused, char *argv[] __u } } -void +static void reapchildren(int signo __unused) { while (wait3(NULL, WNOHANG, NULL) > 0); } -void +static void mailfor(char *name) { struct utmpx *utp; @@ -157,7 +157,7 @@ mailfor(char *name) static const char *cr; -void +static void notify(struct utmpx *utp, char file[], off_t offset, int folder) { FILE *tp; @@ -219,7 +219,7 @@ notify(struct utmpx *utp, char file[], o _exit(0); } -void +static void jkfprintf(FILE *tp, char user[], char file[], off_t offset) { unsigned char *cp, ch; From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 18:42:00 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D626B1065670; Sat, 10 Dec 2011 18:42:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C65CF8FC0A; Sat, 10 Dec 2011 18:42:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIg0Jm017535; Sat, 10 Dec 2011 18:42:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIg01W017533; Sat, 10 Dec 2011 18:42:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112101842.pBAIg01W017533@svn.freebsd.org> From: Alan Cox Date: Sat, 10 Dec 2011 18:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228398 - head/sys/i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:42:00 -0000 Author: alc Date: Sat Dec 10 18:42:00 2011 New Revision: 228398 URL: http://svn.freebsd.org/changeset/base/228398 Log: Avoid the possibility of integer overflow in the calculation of VM_KMEM_SIZE_MAX. Specifically, if the user/kernel address space split was changed such that the kernel address space was greater than or equal to 2 GB, then overflow would occur. PR: 161721 MFC after: 3 weeks Modified: head/sys/i386/include/vmparam.h Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Sat Dec 10 18:35:26 2011 (r228397) +++ head/sys/i386/include/vmparam.h Sat Dec 10 18:42:00 2011 (r228398) @@ -186,11 +186,12 @@ #endif /* - * Ceiling on amount of kmem_map kva space. + * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space + * rounded to the nearest multiple of the superpage size. */ #ifndef VM_KMEM_SIZE_MAX -#define VM_KMEM_SIZE_MAX ((VM_MAX_KERNEL_ADDRESS - \ - VM_MIN_KERNEL_ADDRESS) * 2 / 5) +#define VM_KMEM_SIZE_MAX (((((VM_MAX_KERNEL_ADDRESS - \ + VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT) #endif /* initial pagein size of beginning of executable file */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 10 21:05:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AADF7106564A; Sat, 10 Dec 2011 21:05:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9329D8FC17; Sat, 10 Dec 2011 21:05:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAL563H022004; Sat, 10 Dec 2011 21:05:06 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAL563t022002; Sat, 10 Dec 2011 21:05:06 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112102105.pBAL563t022002@svn.freebsd.org> From: Eitan Adler Date: Sat, 10 Dec 2011 21:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228399 - head/sys/dev/bwn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 21:05:06 -0000 Author: eadler (ports committer) Date: Sat Dec 10 21:05:06 2011 New Revision: 228399 URL: http://svn.freebsd.org/changeset/base/228399 Log: - fix typo Approved by: kib@ Modified: head/sys/dev/bwn/if_bwnvar.h Modified: head/sys/dev/bwn/if_bwnvar.h ============================================================================== --- head/sys/dev/bwn/if_bwnvar.h Sat Dec 10 18:42:00 2011 (r228398) +++ head/sys/dev/bwn/if_bwnvar.h Sat Dec 10 21:05:06 2011 (r228399) @@ -714,7 +714,7 @@ struct bwn_txhdr { uint16_t tx_status; struct bwn_plcp6 rts_plcp; uint8_t rts_frame[16]; - uint8_t pad1[2];; + uint8_t pad1[2]; struct bwn_plcp6 plcp; } __packed old; /* format > r410 */