From owner-svn-src-user@FreeBSD.ORG Mon Nov 26 13:10:33 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9F25A6A8 for ; Mon, 26 Nov 2012 13:10:33 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id F36F48FC13 for ; Mon, 26 Nov 2012 13:10:32 +0000 (UTC) Received: (qmail 84999 invoked from network); 26 Nov 2012 14:42:16 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 26 Nov 2012 14:42:16 -0000 Message-ID: <50B36A38.7040603@freebsd.org> Date: Mon, 26 Nov 2012 14:10:16 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: =?ISO-8859-1?Q?Ermal_Lu=E7i?= Subject: Re: svn commit: r243458 - in user/andre/tcp_workqueue/sys: net netinet References: <201211231453.qANErSKF034907@svn.freebsd.org> <20121123152741.GZ84121@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 13:10:33 -0000 On 23.11.2012 17:11, Ermal Luçi wrote: > On Fri, Nov 23, 2012 at 4:27 PM, Gleb Smirnoff > wrote: > > Frankly speaking, the fact that the list can't be set directly > in one sysctl oid: > > sysctl net.inet.pfil_in.hooks="pf,ipfw,ipfilter" > > , but can only be set via suppling pointless numeric values to N > oids looks very poor from perspective of an average user. He might > think something like "oh, FreeBSD developers were too lazy to parse > a string", or "they designed an interface not for people but for nerds". > > Interface must be easier! If you don't like parsing strings in kernel, > then /sbin/pfilctl can be introduced. The utility eventually may grow > more functionality. > > I already gave a link to already existing patch for this. > Not sure why andre@ decided the other way around. I wanted to have a pre-determined default order of pfil modules especially with the IPSec pfil hook I've started working on. That's the reason for the ordering value. This ordering value has to be carried along somehow. Also I'm no fan of kernel side parsing, even if there are instances where it can't be avoided. So the default pfil hook ordering should lessen the need to reorder pfil hooks at runtime. Would you mind having a pfilctl at Gleb suggested? That way we could abstract the whole thing away and also gain flexibility in the kernel implementation for the future. Another question: In your patch you have a pfil hook disable option directly in the hook mechanism. What is the reason for that versus having the pfil consumer unhook itself when not enabled or in use? -- Andre From owner-svn-src-user@FreeBSD.ORG Mon Nov 26 14:02:33 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EAE485F2; Mon, 26 Nov 2012 14:02:32 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 492768FC14; Mon, 26 Nov 2012 14:02:31 +0000 (UTC) Received: by mail-qa0-f54.google.com with SMTP id g24so3419116qab.13 for ; Mon, 26 Nov 2012 06:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=RIVvLodmB6QEaXqr2fGTY+gCiawOzZJ5abLfoJx1Wyw=; b=neIxgW1nKyPj3xvl+c9kNqvjSSmDuSAGlCjyS+rRADsMqhJ8uIixd5BGXTOJVRt9NC 65A4D9o5MSGXpi8ac7tp0bGPNMnuYyI1yKozgO+b9UUfmXAjmB5RS5Lb0sK8Rv98fegP u9HjbVzPLLXFlW9RL6adjPSpLbBgIH1GCbcBk+xMjnJPujnF/fbr67JazkhyQk3fBNXQ JQMgzqqpIadyV8J5RbIFvrB1H+x6vymgOPMxWJ2+BwQ1EqLVMcjypJhO9nSfrOGxyy/p ePSlmSC2Ck1fWXltXAbpp8UJE1qtRVV8BvDuF99SeWcSDfTm0VM7nxmUJkzo7WNvqrS8 FV7w== MIME-Version: 1.0 Received: by 10.224.215.131 with SMTP id he3mr12336740qab.41.1353938549587; Mon, 26 Nov 2012 06:02:29 -0800 (PST) Sender: ermal.luci@gmail.com Received: by 10.49.121.163 with HTTP; Mon, 26 Nov 2012 06:02:29 -0800 (PST) In-Reply-To: <50B36A38.7040603@freebsd.org> References: <201211231453.qANErSKF034907@svn.freebsd.org> <20121123152741.GZ84121@FreeBSD.org> <50B36A38.7040603@freebsd.org> Date: Mon, 26 Nov 2012 15:02:29 +0100 X-Google-Sender-Auth: dXSvu12YQ4GFr-uXsFs4K7mRq2g Message-ID: Subject: Re: svn commit: r243458 - in user/andre/tcp_workqueue/sys: net netinet From: =?ISO-8859-1?Q?Ermal_Lu=E7i?= To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 14:02:33 -0000 On Mon, Nov 26, 2012 at 2:10 PM, Andre Oppermann wrote: > On 23.11.2012 17:11, Ermal Lu=E7i wrote: > > On Fri, Nov 23, 2012 at 4:27 PM, Gleb Smirnoff > glebius@freebsd.org>> wrote: >> >> Frankly speaking, the fact that the list can't be set directly >> in one sysctl oid: >> >> sysctl net.inet.pfil_in.hooks=3D"pf,**ipfw,ipfilter" >> >> , but can only be set via suppling pointless numeric values to N >> oids looks very poor from perspective of an average user. He might >> think something like "oh, FreeBSD developers were too lazy to parse >> a string", or "they designed an interface not for people but for >> nerds". >> >> Interface must be easier! If you don't like parsing strings in >> kernel, >> then /sbin/pfilctl can be introduced. The utility eventually may gro= w >> more functionality. >> >> I already gave a link to already existing patch for this. >> Not sure why andre@ decided the other way around. >> > > I wanted to have a pre-determined default order of pfil modules > especially with the IPSec pfil hook I've started working on. > That's the reason for the ordering value. This ordering value > has to be carried along somehow. Also I'm no fan of kernel side > parsing, even if there are instances where it can't be avoided. > > So the default pfil hook ordering should lessen the need to reorder > pfil hooks at runtime. > > Would you mind having a pfilctl at Gleb suggested? That way we could > abstract the whole thing away and also gain flexibility in the kernel > implementation for the future. > > Its flexibility added but its just another step people will have to take care when configuring staff. Using sysctl people are familiar with and specifying just strings seems easier when the parsing is simple. With some good documentation that is easier, than having priorities and unsolved problem of what happens at the same priority level! Though the utility has some value if pfil hooks gain ability to be enabled disabled by interface. This can be taken as a micro-optimization to not send every packet over the hooks if people deem its not useful. For example people want ipsec usually only at specific interface(s) and being able to tune the hook at only where needed seems as a feature to me while retaining the default ability of a hook for all packets. In this case the policy tool is needed since the parsing is more complicated. As a scenario in pfSense ipfw is used for captive portal functionality and its needed active only on selected interface(s). I added a flag per interface to control this otherwise the rule sets become unmanageable and introduce measurable overhead. > Another question: In your patch you have a pfil hook disable option > directly in the hook mechanism. What is the reason for that versus > having the pfil consumer unhook itself when not enabled or in use? The use case of it is for disabling ipfw hook at ip level(layer3) while keeping it active for layer2. It seems more natural to control this policy as a pfil interface rather than having pfil consumers having to deal with this kind of policies. > > -- > Andre > > --=20 Ermal From owner-svn-src-user@FreeBSD.ORG Tue Nov 27 06:50:25 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 717D3603; Tue, 27 Nov 2012 06:50:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 575CE8FC12; Tue, 27 Nov 2012 06:50:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR6oPj5002403; Tue, 27 Nov 2012 06:50:25 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR6oPCb002402; Tue, 27 Nov 2012 06:50:25 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201211270650.qAR6oPCb002402@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 27 Nov 2012 06:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243604 - user/np/stable_9_toe/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 06:50:25 -0000 Author: np Date: Tue Nov 27 06:50:24 2012 New Revision: 243604 URL: http://svnweb.freebsd.org/changeset/base/243604 Log: Pull in r243603: Make sure that tcp_timer_activate() correctly sees TCP_OFFLOAD (or not). Modified: user/np/stable_9_toe/sys/netinet/tcp_timer.c Directory Properties: user/np/stable_9_toe/sys/ (props changed) Modified: user/np/stable_9_toe/sys/netinet/tcp_timer.c ============================================================================== --- user/np/stable_9_toe/sys/netinet/tcp_timer.c Tue Nov 27 06:42:44 2012 (r243603) +++ user/np/stable_9_toe/sys/netinet/tcp_timer.c Tue Nov 27 06:50:24 2012 (r243604) @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" #include "opt_inet6.h" #include "opt_tcpdebug.h" From owner-svn-src-user@FreeBSD.ORG Tue Nov 27 19:00:45 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A02F778F; Tue, 27 Nov 2012 19:00:45 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7DA038FC08; Tue, 27 Nov 2012 19:00:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARJ0j4X034561; Tue, 27 Nov 2012 19:00:45 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARJ0jE3034550; Tue, 27 Nov 2012 19:00:45 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211271900.qARJ0jE3034550@svn.freebsd.org> From: Andre Oppermann Date: Tue, 27 Nov 2012 19:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243620 - in user/andre/tcp_workqueue/sys: arm/arm arm/at91 arm/broadcom/bcm2835 arm/conf arm/include arm/mv arm/ti arm/ti/am335x boot/fdt/dts boot/uboot/lib cam/ata cddl/compat/opensol... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 19:00:45 -0000 Author: andre Date: Tue Nov 27 19:00:44 2012 New Revision: 243620 URL: http://svnweb.freebsd.org/changeset/base/243620 Log: Integrate from HEAD @243619. Added: user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/bcm2835_gpio.c - copied unchanged from r243613, head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c user/andre/tcp_workqueue/sys/arm/conf/Makefile - copied unchanged from r243613, head/sys/arm/conf/Makefile user/andre/tcp_workqueue/sys/arm/conf/NOTES - copied unchanged from r243613, head/sys/arm/conf/NOTES user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c - copied unchanged from r243613, head/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c user/andre/tcp_workqueue/sys/powerpc/wii/locore.S - copied unchanged from r243613, head/sys/powerpc/wii/locore.S Modified: user/andre/tcp_workqueue/sys/arm/arm/cpufunc.c user/andre/tcp_workqueue/sys/arm/arm/locore.S user/andre/tcp_workqueue/sys/arm/arm/machdep.c user/andre/tcp_workqueue/sys/arm/arm/mpcore_timer.c user/andre/tcp_workqueue/sys/arm/arm/pl310.c user/andre/tcp_workqueue/sys/arm/at91/files.at91 user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/bcm2835_fb.c user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/bcm2835_systimer.c user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/files.bcm2835 user/andre/tcp_workqueue/sys/arm/conf/RPI-B user/andre/tcp_workqueue/sys/arm/include/cpufunc.h user/andre/tcp_workqueue/sys/arm/mv/mvreg.h user/andre/tcp_workqueue/sys/arm/ti/am335x/am335x_dmtimer.c user/andre/tcp_workqueue/sys/arm/ti/ti_machdep.c user/andre/tcp_workqueue/sys/boot/fdt/dts/bcm2835-rpi-b.dts user/andre/tcp_workqueue/sys/boot/uboot/lib/elf_freebsd.c user/andre/tcp_workqueue/sys/cam/ata/ata_xpt.c user/andre/tcp_workqueue/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c user/andre/tcp_workqueue/sys/compat/linux/linux_ioctl.c user/andre/tcp_workqueue/sys/conf/Makefile.arm user/andre/tcp_workqueue/sys/conf/NOTES user/andre/tcp_workqueue/sys/conf/files user/andre/tcp_workqueue/sys/conf/options.mips user/andre/tcp_workqueue/sys/contrib/dev/acpica/changes.txt (contents, props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/common/adfile.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/common/adisasm.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/common/dmextern.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/common/dmrestag.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/aslcompile.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/aslcompiler.h user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/aslerror.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/aslfiles.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/aslglobal.h user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/asllisting.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/asllookup.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/aslmain.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/aslstartup.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/dttemplate.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/prutils.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/debugger/dbfileio.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/debugger/dbinput.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/debugger/dbmethod.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/disassembler/dmopcode.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/disassembler/dmresrc.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/executer/exregion.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/namespace/nsutils.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/namespace/nsxfname.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/resources/rscalc.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/resources/rscreate.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/resources/rsdump.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/resources/rslist.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/resources/rsmisc.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/resources/rsxface.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/utilities/utdelete.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/utilities/utresrc.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/utilities/utstate.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/utilities/uttrack.c user/andre/tcp_workqueue/sys/contrib/dev/acpica/include/acdisasm.h user/andre/tcp_workqueue/sys/contrib/dev/acpica/include/acmacros.h user/andre/tcp_workqueue/sys/contrib/dev/acpica/include/acpixf.h user/andre/tcp_workqueue/sys/contrib/dev/acpica/include/acrestyp.h user/andre/tcp_workqueue/sys/contrib/dev/acpica/include/acutils.h user/andre/tcp_workqueue/sys/contrib/octeon-sdk/cvmx-dma-engine.c user/andre/tcp_workqueue/sys/contrib/octeon-sdk/cvmx-pow.h user/andre/tcp_workqueue/sys/contrib/octeon-sdk/cvmx-spi.c user/andre/tcp_workqueue/sys/contrib/octeon-sdk/cvmx-utils.h user/andre/tcp_workqueue/sys/contrib/octeon-sdk/cvmx-warn.c user/andre/tcp_workqueue/sys/contrib/octeon-sdk/cvmx.h user/andre/tcp_workqueue/sys/contrib/octeon-sdk/octeon-model.c user/andre/tcp_workqueue/sys/contrib/octeon-sdk/octeon-model.h user/andre/tcp_workqueue/sys/dev/acpica/acpi_cpu.c user/andre/tcp_workqueue/sys/dev/ath/ath_hal/ah.h user/andre/tcp_workqueue/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c user/andre/tcp_workqueue/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c user/andre/tcp_workqueue/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c user/andre/tcp_workqueue/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c user/andre/tcp_workqueue/sys/dev/ath/if_ath_alq.h user/andre/tcp_workqueue/sys/dev/ath/if_ath_tdma.c user/andre/tcp_workqueue/sys/dev/ath/if_athvar.h user/andre/tcp_workqueue/sys/dev/e1000/if_igb.c user/andre/tcp_workqueue/sys/dev/gpio/gpiobus.c user/andre/tcp_workqueue/sys/dev/gxemul/cons/gxemul_cons.c user/andre/tcp_workqueue/sys/dev/md/md.c user/andre/tcp_workqueue/sys/dev/mmc/mmc.c user/andre/tcp_workqueue/sys/dev/sound/pci/hda/hdaa.c user/andre/tcp_workqueue/sys/dev/sound/pcm/buffer.c user/andre/tcp_workqueue/sys/dev/sound/pcm/sound.c user/andre/tcp_workqueue/sys/dev/usb/net/if_smsc.c user/andre/tcp_workqueue/sys/dev/usb/quirk/usb_quirk.c user/andre/tcp_workqueue/sys/dev/usb/quirk/usb_quirk.h user/andre/tcp_workqueue/sys/dev/usb/serial/uplcom.c user/andre/tcp_workqueue/sys/fs/smbfs/smbfs.h user/andre/tcp_workqueue/sys/fs/smbfs/smbfs_io.c user/andre/tcp_workqueue/sys/fs/smbfs/smbfs_node.c user/andre/tcp_workqueue/sys/fs/smbfs/smbfs_node.h user/andre/tcp_workqueue/sys/fs/smbfs/smbfs_subr.c user/andre/tcp_workqueue/sys/fs/smbfs/smbfs_vfsops.c user/andre/tcp_workqueue/sys/fs/smbfs/smbfs_vnops.c user/andre/tcp_workqueue/sys/kern/capabilities.conf user/andre/tcp_workqueue/sys/kern/init_sysent.c user/andre/tcp_workqueue/sys/kern/kern_proc.c user/andre/tcp_workqueue/sys/kern/kern_shutdown.c user/andre/tcp_workqueue/sys/kern/kern_sig.c user/andre/tcp_workqueue/sys/kern/vfs_lookup.c user/andre/tcp_workqueue/sys/kern/vfs_subr.c user/andre/tcp_workqueue/sys/kern/vfs_vnops.c user/andre/tcp_workqueue/sys/kern/vnode_if.src user/andre/tcp_workqueue/sys/mips/cavium/octeon_machdep.c user/andre/tcp_workqueue/sys/mips/conf/OCTEON1 user/andre/tcp_workqueue/sys/modules/acpi/acpi/Makefile user/andre/tcp_workqueue/sys/net/if_ethersubr.c user/andre/tcp_workqueue/sys/net80211/ieee80211_freebsd.h user/andre/tcp_workqueue/sys/netinet/sctp_pcb.c user/andre/tcp_workqueue/sys/netinet/sctp_peeloff.c user/andre/tcp_workqueue/sys/netinet/sctp_peeloff.h user/andre/tcp_workqueue/sys/netinet/sctp_usrreq.c user/andre/tcp_workqueue/sys/netinet/tcp_timer.c user/andre/tcp_workqueue/sys/powerpc/aim/locore32.S user/andre/tcp_workqueue/sys/powerpc/aim/mmu_oea.c user/andre/tcp_workqueue/sys/sys/namei.h user/andre/tcp_workqueue/sys/sys/param.h user/andre/tcp_workqueue/sys/sys/vnode.h user/andre/tcp_workqueue/sys/vm/vm_map.c user/andre/tcp_workqueue/sys/vm/vm_page.c Directory Properties: user/andre/tcp_workqueue/sys/ (props changed) user/andre/tcp_workqueue/sys/boot/ (props changed) user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/ (props changed) user/andre/tcp_workqueue/sys/conf/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/common/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/compiler/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/debugger/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/disassembler/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/dispatcher/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/executer/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/namespace/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/resources/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/components/utilities/ (props changed) user/andre/tcp_workqueue/sys/contrib/dev/acpica/include/ (props changed) user/andre/tcp_workqueue/sys/contrib/octeon-sdk/ (props changed) Modified: user/andre/tcp_workqueue/sys/arm/arm/cpufunc.c ============================================================================== --- user/andre/tcp_workqueue/sys/arm/arm/cpufunc.c Tue Nov 27 18:38:50 2012 (r243619) +++ user/andre/tcp_workqueue/sys/arm/arm/cpufunc.c Tue Nov 27 19:00:44 2012 (r243620) @@ -74,7 +74,13 @@ __FBSDID("$FreeBSD$"); #include #endif -#if defined(CPU_XSCALE_81342) +/* + * Some definitions in i81342reg.h clash with i80321reg.h. + * This only happens for the LINT kernel. As it happens, + * we don't need anything from i81342reg.h that we already + * got from somewhere else during a LINT compile. + */ +#if defined(CPU_XSCALE_81342) && !defined(COMPILING_LINT) #include #endif Modified: user/andre/tcp_workqueue/sys/arm/arm/locore.S ============================================================================== --- user/andre/tcp_workqueue/sys/arm/arm/locore.S Tue Nov 27 18:38:50 2012 (r243619) +++ user/andre/tcp_workqueue/sys/arm/arm/locore.S Tue Nov 27 19:00:44 2012 (r243620) @@ -181,7 +181,7 @@ Lunmapped: #if defined(CPU_ARM11) || defined(CPU_CORTEXA) || defined(CPU_MV_PJ4B) orr r0, r0, #CPU_CONTROL_V6_EXTPAGE #endif - orr r0, r0, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE) + orr r0, r0, #(CPU_CONTROL_MMU_ENABLE) mcr p15, 0, r0, c1, c0, 0 nop nop Modified: user/andre/tcp_workqueue/sys/arm/arm/machdep.c ============================================================================== --- user/andre/tcp_workqueue/sys/arm/arm/machdep.c Tue Nov 27 18:38:50 2012 (r243619) +++ user/andre/tcp_workqueue/sys/arm/arm/machdep.c Tue Nov 27 19:00:44 2012 (r243620) @@ -1038,18 +1038,6 @@ print_kenv(void) } static void -print_kernel_section_addr(void) -{ - - debugf("kernel image addresses:\n"); - debugf(" kernbase = 0x%08x\n", (uint32_t)kernbase); - debugf(" _etext (sdata) = 0x%08x\n", (uint32_t)_etext); - debugf(" _edata = 0x%08x\n", (uint32_t)_edata); - debugf(" __bss_start = 0x%08x\n", (uint32_t)__bss_start); - debugf(" _end = 0x%08x\n", (uint32_t)_end); -} - -static void physmap_init(struct mem_region *availmem_regions, int availmem_regions_sz) { int i, j, cnt; @@ -1344,7 +1332,6 @@ initarm(struct arm_boot_params *abp) debugf(" arg1 kmdp = 0x%08x\n", (uint32_t)kmdp); debugf(" boothowto = 0x%08x\n", boothowto); debugf(" dtbp = 0x%08x\n", (uint32_t)dtbp); - print_kernel_section_addr(); print_kenv(); env = getenv("kernelname"); Modified: user/andre/tcp_workqueue/sys/arm/arm/mpcore_timer.c ============================================================================== --- user/andre/tcp_workqueue/sys/arm/arm/mpcore_timer.c Tue Nov 27 18:38:50 2012 (r243619) +++ user/andre/tcp_workqueue/sys/arm/arm/mpcore_timer.c Tue Nov 27 19:00:44 2012 (r243620) @@ -128,7 +128,7 @@ static struct arm_tmr_softc *arm_tmr_sc static timecounter_get_t arm_tmr_get_timecount; static struct timecounter arm_tmr_timecount = { - .tc_name = "ARM MPCore Timecouter", + .tc_name = "ARM MPCore Timecounter", .tc_get_timecount = arm_tmr_get_timecount, .tc_poll_pps = NULL, .tc_counter_mask = ~0u, Modified: user/andre/tcp_workqueue/sys/arm/arm/pl310.c ============================================================================== --- user/andre/tcp_workqueue/sys/arm/arm/pl310.c Tue Nov 27 18:38:50 2012 (r243619) +++ user/andre/tcp_workqueue/sys/arm/arm/pl310.c Tue Nov 27 19:00:44 2012 (r243620) @@ -180,9 +180,13 @@ static void pl310_wbinv_range(vm_paddr_t start, vm_size_t size) { + if (start & g_l2cache_align_mask) { + size += start & g_l2cache_align_mask; + start &= ~g_l2cache_align_mask; + } if (size & g_l2cache_align_mask) { size &= ~g_l2cache_align_mask; - size += g_l2cache_line_size; + size += g_l2cache_line_size; } #if 1 @@ -217,6 +221,10 @@ static void pl310_wb_range(vm_paddr_t start, vm_size_t size) { + if (start & g_l2cache_align_mask) { + size += start & g_l2cache_align_mask; + start &= ~g_l2cache_align_mask; + } if (size & g_l2cache_align_mask) { size &= ~g_l2cache_align_mask; size += g_l2cache_line_size; @@ -235,6 +243,10 @@ static void pl310_inv_range(vm_paddr_t start, vm_size_t size) { + if (start & g_l2cache_align_mask) { + size += start & g_l2cache_align_mask; + start &= ~g_l2cache_align_mask; + } if (size & g_l2cache_align_mask) { size &= ~g_l2cache_align_mask; size += g_l2cache_line_size; Modified: user/andre/tcp_workqueue/sys/arm/at91/files.at91 ============================================================================== --- user/andre/tcp_workqueue/sys/arm/at91/files.at91 Tue Nov 27 18:38:50 2012 (r243619) +++ user/andre/tcp_workqueue/sys/arm/at91/files.at91 Tue Nov 27 19:00:44 2012 (r243620) @@ -55,4 +55,3 @@ arm/at91/board_tsc4370.c optional at91_b dev/usb/controller/at91dci.c optional at91_dci dev/usb/controller/at91dci_atmelarm.c optional at91_dci dev/usb/controller/ohci_atmelarm.c optional ohci -dev/usb/controller/ehci_atmelarm.c optional ehci Modified: user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/bcm2835_fb.c Tue Nov 27 18:38:50 2012 (r243619) +++ user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/bcm2835_fb.c Tue Nov 27 19:00:44 2012 (r243620) @@ -68,8 +68,35 @@ __FBSDID("$FreeBSD$"); #define BCMFB_FONT_HEIGHT 16 +struct argb { + uint8_t a; + uint8_t r; + uint8_t g; + uint8_t b; +}; + +static struct argb bcmfb_palette[16] = { + {0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0xaa}, + {0x00, 0x00, 0xaa, 0x00}, + {0x00, 0x00, 0xaa, 0xaa}, + {0x00, 0xaa, 0x00, 0x00}, + {0x00, 0xaa, 0x00, 0xaa}, + {0x00, 0xaa, 0x55, 0x00}, + {0x00, 0xaa, 0xaa, 0xaa}, + {0x00, 0x55, 0x55, 0x55}, + {0x00, 0x55, 0x55, 0xff}, + {0x00, 0x55, 0xff, 0x55}, + {0x00, 0x55, 0xff, 0xff}, + {0x00, 0xff, 0x55, 0x55}, + {0x00, 0xff, 0x55, 0xff}, + {0x00, 0xff, 0xff, 0x55}, + {0x00, 0xff, 0xff, 0xff} +}; + #define FB_WIDTH 640 #define FB_HEIGHT 480 +#define FB_DEPTH 24 struct bcm_fb_config { uint32_t xres; @@ -107,6 +134,7 @@ struct video_adapter_softc { unsigned int height; unsigned int width; + unsigned int depth; unsigned int stride; unsigned int xmargin; @@ -126,6 +154,8 @@ static struct video_adapter_softc va_sof static int bcm_fb_probe(device_t); static int bcm_fb_attach(device_t); static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err); +static void bcmfb_update_margins(video_adapter_t *adp); +static int bcmfb_configure(int); static void bcm_fb_init(void *arg) @@ -134,15 +164,34 @@ bcm_fb_init(void *arg) struct video_adapter_softc *va_sc = &va_softc; int err; volatile struct bcm_fb_config* fb_config = sc->fb_config; + phandle_t node; + pcell_t cell; + + node = ofw_bus_get_node(sc->dev); + + fb_config->xres = 0; + fb_config->yres = 0; + fb_config->bpp = 0; + + if ((OF_getprop(node, "broadcom,width", &cell, sizeof(cell))) > 0) + fb_config->xres = (int)fdt32_to_cpu(cell); + if (fb_config->xres == 0) + fb_config->xres = FB_WIDTH; + + if ((OF_getprop(node, "broadcom,height", &cell, sizeof(cell))) > 0) + fb_config->yres = (uint32_t)fdt32_to_cpu(cell); + if (fb_config->yres == 0) + fb_config->yres = FB_HEIGHT; + + if ((OF_getprop(node, "broadcom,depth", &cell, sizeof(cell))) > 0) + fb_config->bpp = (uint32_t)fdt32_to_cpu(cell); + if (fb_config->bpp == 0) + fb_config->bpp = FB_DEPTH; - /* TODO: replace it with FDT stuff */ - fb_config->xres = FB_WIDTH; - fb_config->yres = FB_HEIGHT; fb_config->vxres = 0; fb_config->vyres = 0; fb_config->xoffset = 0; fb_config->yoffset = 0; - fb_config->bpp = 24; fb_config->base = 0; fb_config->pitch = 0; fb_config->screen_size = 0; @@ -154,7 +203,7 @@ bcm_fb_init(void *arg) bus_dmamap_sync(sc->dma_tag, sc->dma_map, BUS_DMASYNC_POSTREAD); - if (err == 0) { + if (fb_config->base != 0) { device_printf(sc->dev, "%dx%d(%dx%d@%d,%d) %dbpp\n", fb_config->xres, fb_config->yres, fb_config->vxres, fb_config->vyres, @@ -166,14 +215,19 @@ bcm_fb_init(void *arg) fb_config->pitch, fb_config->base, fb_config->screen_size); - if (fb_config->base) { - va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size); - va_sc->fb_size = fb_config->screen_size; - va_sc->stride = fb_config->pitch; - } + va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size); + va_sc->fb_size = fb_config->screen_size; + va_sc->depth = fb_config->bpp; + va_sc->stride = fb_config->pitch; + + va_sc->width = fb_config->xres; + va_sc->height = fb_config->yres; + bcmfb_update_margins(&va_sc->va); } - else + else { device_printf(sc->dev, "Failed to set framebuffer info\n"); + return; + } config_intrhook_disestablish(&sc->init_hook); } @@ -181,7 +235,7 @@ bcm_fb_init(void *arg) static int bcm_fb_probe(device_t dev) { - int error; + int error = 0; if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb")) return (ENXIO); @@ -190,10 +244,10 @@ bcm_fb_probe(device_t dev) error = sc_probe_unit(device_get_unit(dev), device_get_flags(dev) | SC_AUTODETECT_KBD); - if (error != 0) return (error); + return (BUS_PROBE_DEFAULT); } @@ -293,12 +347,11 @@ static driver_t bcm_fb_driver = { sizeof(struct bcmsc_softc), }; -DRIVER_MODULE(bcm2835fb, simplebus, bcm_fb_driver, bcm_fb_devclass, 0, 0); +DRIVER_MODULE(bcm2835fb, fdtbus, bcm_fb_driver, bcm_fb_devclass, 0, 0); /* * Video driver routines and glue. */ -static int bcmfb_configure(int); static vi_probe_t bcmfb_probe; static vi_init_t bcmfb_init; static vi_get_info_t bcmfb_get_info; @@ -374,22 +427,62 @@ RENDERER_MODULE(bcmfb, gfb_set); static uint16_t bcmfb_static_window[ROW*COL]; extern u_char dflt_font_16[]; +/* + * Update videoadapter settings after changing resolution + */ +static void +bcmfb_update_margins(video_adapter_t *adp) +{ + struct video_adapter_softc *sc; + video_info_t *vi; + + sc = (struct video_adapter_softc *)adp; + vi = &adp->va_info; + + sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2; + sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2; +} + static int bcmfb_configure(int flags) { - struct video_adapter_softc *sc; + struct video_adapter_softc *va_sc; + + va_sc = &va_softc; + phandle_t display, root; + pcell_t cell; - sc = &va_softc; + if (va_sc->initialized) + return (0); - if (sc->initialized) - return 0; + va_sc->width = 0; + va_sc->height = 0; + + /* + * It seems there is no way to let syscons framework know + * that framebuffer resolution has changed. So just try + * to fetch data from FDT and go with defaults if failed + */ + root = OF_finddevice("/"); + if ((root != 0) && + (display = fdt_find_compatible(root, "broadcom,bcm2835-fb", 1))) { + if ((OF_getprop(display, "broadcom,width", + &cell, sizeof(cell))) > 0) + va_sc->width = (int)fdt32_to_cpu(cell); + + if ((OF_getprop(display, "broadcom,height", + &cell, sizeof(cell))) > 0) + va_sc->height = (int)fdt32_to_cpu(cell); + } - sc->height = FB_HEIGHT; - sc->width = FB_WIDTH; + if (va_sc->width == 0) + va_sc->width = FB_WIDTH; + if (va_sc->height == 0) + va_sc->height = FB_HEIGHT; - bcmfb_init(0, &sc->va, 0); + bcmfb_init(0, &va_sc->va, 0); - sc->initialized = 1; + va_sc->initialized = 1; return (0); } @@ -415,6 +508,7 @@ bcmfb_init(int unit, video_adapter_t *ad sc->font = dflt_font_16; vi->vi_cheight = BCMFB_FONT_HEIGHT; vi->vi_cwidth = 8; + vi->vi_width = sc->width/8; vi->vi_height = sc->height/vi->vi_cheight; @@ -429,6 +523,7 @@ bcmfb_init(int unit, video_adapter_t *ad sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2; sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2; + adp->va_window = (vm_offset_t) bcmfb_static_window; adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */; @@ -541,6 +636,12 @@ static int bcmfb_blank_display(video_adapter_t *adp, int mode) { + struct video_adapter_softc *sc; + + sc = (struct video_adapter_softc *)adp; + if (sc && sc->fb_addr) + memset((void*)sc->fb_addr, 0, sc->fb_size); + return (0); } @@ -638,6 +739,7 @@ bcmfb_putc(video_adapter_t *adp, vm_offs uint8_t *addr; u_char *p; uint8_t fg, bg, color; + uint16_t rgb; sc = (struct video_adapter_softc *)adp; @@ -651,11 +753,8 @@ bcmfb_putc(video_adapter_t *adp, vm_offs + (row + sc->ymargin)*(sc->stride) + 3 * (col + sc->xmargin); - /* - * FIXME: hardcoded - */ - bg = 0x00; - fg = 0x80; + fg = a & 0xf ; + bg = (a >> 8) & 0xf; for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { for (j = 0, k = 7; j < 8; j++, k--) { @@ -664,9 +763,28 @@ bcmfb_putc(video_adapter_t *adp, vm_offs else color = fg; - addr[3*j] = color; - addr[3*j+1] = color; - addr[3*j+2] = color; + switch (sc->depth) { + case 32: + addr[4*j+0] = bcmfb_palette[color].r; + addr[4*j+1] = bcmfb_palette[color].g; + addr[4*j+2] = bcmfb_palette[color].b; + addr[4*j+3] = bcmfb_palette[color].a; + break; + case 24: + addr[3*j] = bcmfb_palette[color].r; + addr[3*j+1] = bcmfb_palette[color].g; + addr[3*j+2] = bcmfb_palette[color].b; + break; + case 16: + rgb = (bcmfb_palette[color].r >> 3) << 10; + rgb |= (bcmfb_palette[color].g >> 3) << 5; + rgb |= (bcmfb_palette[color].b >> 3); + addr[2*j] = (rgb >> 8) & 0xff; + addr[2*j + 1] = rgb & 0xff; + default: + /* Not supported yet */ + break; + } } addr += (sc->stride); Copied: user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/bcm2835_gpio.c (from r243613, head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/tcp_workqueue/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Nov 27 19:00:44 2012 (r243620, copy of r243613, head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c) @@ -0,0 +1,656 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012 Luiz Otavio O Souza. + * 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. + * + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "gpio_if.h" + +#undef DEBUG + +#ifdef DEBUG +#define dprintf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define dprintf(fmt, args...) +#endif + +#define BCM_GPIO_PINS 54 +#define BCM_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ + GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN) + +struct bcm_gpio_softc { + device_t sc_dev; + struct mtx sc_mtx; + struct resource * sc_mem_res; + struct resource * sc_irq_res; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + void * sc_intrhand; + int sc_gpio_npins; + int sc_ro_npins; + int sc_ro_pins[BCM_GPIO_PINS]; + struct gpio_pin sc_gpio_pins[BCM_GPIO_PINS]; +}; + +enum bcm_gpio_fsel { + BCM_GPIO_INPUT, + BCM_GPIO_OUTPUT, + BCM_GPIO_ALT5, + BCM_GPIO_ALT4, + BCM_GPIO_ALT0, + BCM_GPIO_ALT1, + BCM_GPIO_ALT2, + BCM_GPIO_ALT3, +}; + +enum bcm_gpio_pud { + BCM_GPIO_NONE, + BCM_GPIO_PULLDOWN, + BCM_GPIO_PULLUP, +}; + +#define BCM_GPIO_LOCK(_sc) mtx_lock(&_sc->sc_mtx) +#define BCM_GPIO_UNLOCK(_sc) mtx_unlock(&_sc->sc_mtx) + +#define BCM_GPIO_GPFSEL(_bank) 0x00 + _bank * 4 +#define BCM_GPIO_GPSET(_bank) 0x1c + _bank * 4 +#define BCM_GPIO_GPCLR(_bank) 0x28 + _bank * 4 +#define BCM_GPIO_GPLEV(_bank) 0x34 + _bank * 4 +#define BCM_GPIO_GPPUD(_bank) 0x94 +#define BCM_GPIO_GPPUDCLK(_bank) 0x98 + _bank * 4 + +#define BCM_GPIO_WRITE(_sc, _off, _val) \ + bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val) +#define BCM_GPIO_READ(_sc, _off) \ + bus_space_read_4(_sc->sc_bst, _sc->sc_bsh, _off) + +static int +bcm_gpio_pin_is_ro(struct bcm_gpio_softc *sc, int pin) +{ + int i; + + for (i = 0; i < sc->sc_ro_npins; i++) + if (pin == sc->sc_ro_pins[i]) + return (1); + return (0); +} + +static uint32_t +bcm_gpio_get_function(struct bcm_gpio_softc *sc, uint32_t pin) +{ + uint32_t bank, data, offset; + + /* Five banks, 10 pins per bank, 3 bits per pin. */ + bank = pin / 10; + offset = (pin - bank * 10) * 3; + + BCM_GPIO_LOCK(sc); + data = (BCM_GPIO_READ(sc, BCM_GPIO_GPFSEL(bank)) >> offset) & 7; + BCM_GPIO_UNLOCK(sc); + +#ifdef DEBUG + device_printf(sc->sc_dev, "pin %d function: ", pin); + switch (data) { + case BCM_GPIO_INPUT: + printf("input\n"); + break; + case BCM_GPIO_OUTPUT: + printf("output\n"); + break; + case BCM_GPIO_ALT0: + printf("alt0\n"); + break; + case BCM_GPIO_ALT1: + printf("alt1\n"); + break; + case BCM_GPIO_ALT2: + printf("alt2\n"); + break; + case BCM_GPIO_ALT3: + printf("alt3\n"); + break; + case BCM_GPIO_ALT4: + printf("alt4\n"); + break; + case BCM_GPIO_ALT5: + printf("alt5\n"); + break; + } +#endif + + switch (data) { + case BCM_GPIO_INPUT: + return (GPIO_PIN_INPUT); + case BCM_GPIO_OUTPUT: + return (GPIO_PIN_OUTPUT); + } + + return (0); +} + +static void +bcm_gpio_set_function(struct bcm_gpio_softc *sc, uint32_t pin, uint32_t f) +{ + uint32_t bank, data, offset; + + /* Five banks, 10 pins per bank, 3 bits per pin. */ + bank = pin / 10; + offset = (pin - bank * 10) * 3; + + BCM_GPIO_LOCK(sc); + data = BCM_GPIO_READ(sc, BCM_GPIO_GPFSEL(bank)); + data &= ~(7 << offset); + data |= (f << offset); + BCM_GPIO_WRITE(sc, BCM_GPIO_GPFSEL(bank), data); + BCM_GPIO_UNLOCK(sc); +} + +static void +bcm_gpio_set_pud(struct bcm_gpio_softc *sc, uint32_t pin, uint32_t state) +{ + uint32_t bank, offset; + + bank = pin / 32; + offset = pin - 32 * bank; + + BCM_GPIO_LOCK(sc); + BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUD(0), state); + DELAY(10); + BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), (1 << offset)); + DELAY(10); + BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUD(0), 0); + BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), 0); + BCM_GPIO_UNLOCK(sc); +} + +static void +bcm_gpio_pin_configure(struct bcm_gpio_softc *sc, struct gpio_pin *pin, + unsigned int flags) +{ + + /* + * Manage input/output. + */ + if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { + pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); + if (flags & GPIO_PIN_OUTPUT) { + pin->gp_flags |= GPIO_PIN_OUTPUT; + bcm_gpio_set_function(sc, pin->gp_pin, + BCM_GPIO_OUTPUT); + } else { + pin->gp_flags |= GPIO_PIN_INPUT; + bcm_gpio_set_function(sc, pin->gp_pin, + BCM_GPIO_INPUT); + } + } + + /* Manage Pull-up/pull-down. */ + pin->gp_flags &= ~(GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN); + if (flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) { + if (flags & GPIO_PIN_PULLUP) { + pin->gp_flags |= GPIO_PIN_PULLUP; + bcm_gpio_set_pud(sc, pin->gp_pin, BCM_GPIO_PULLUP); + } else { + pin->gp_flags |= GPIO_PIN_PULLDOWN; + bcm_gpio_set_pud(sc, pin->gp_pin, BCM_GPIO_PULLDOWN); + } + } else + bcm_gpio_set_pud(sc, pin->gp_pin, BCM_GPIO_NONE); +} + +static int +bcm_gpio_pin_max(device_t dev, int *maxpin) +{ + + *maxpin = BCM_GPIO_PINS - 1; + return (0); +} + +static int +bcm_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + BCM_GPIO_LOCK(sc); + *caps = sc->sc_gpio_pins[i].gp_caps; + BCM_GPIO_UNLOCK(sc); + + return (0); +} + +static int +bcm_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + BCM_GPIO_LOCK(sc); + *flags = sc->sc_gpio_pins[i].gp_flags; + BCM_GPIO_UNLOCK(sc); + + return (0); +} + +static int +bcm_gpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + BCM_GPIO_LOCK(sc); + memcpy(name, sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME); + BCM_GPIO_UNLOCK(sc); + + return (0); +} + +static int +bcm_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + /* We never touch on read-only/reserved pins. */ + if (bcm_gpio_pin_is_ro(sc, pin)) + return (EINVAL); + + /* Filter out unwanted flags. */ + if ((flags &= sc->sc_gpio_pins[i].gp_caps) != flags) + return (EINVAL); + + /* Can't mix input/output together. */ + if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) + return (EINVAL); + + /* Can't mix pull-up/pull-down together. */ + if ((flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) == + (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) + return (EINVAL); + + bcm_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags); + + return (0); +} + +static int +bcm_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + uint32_t bank, offset; + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + /* We never write to read-only/reserved pins. */ + if (bcm_gpio_pin_is_ro(sc, pin)) + return (EINVAL); + + bank = pin / 32; + offset = pin - 32 * bank; + + BCM_GPIO_LOCK(sc); + if (value) + BCM_GPIO_WRITE(sc, BCM_GPIO_GPSET(bank), (1 << offset)); + else + BCM_GPIO_WRITE(sc, BCM_GPIO_GPCLR(bank), (1 << offset)); + BCM_GPIO_UNLOCK(sc); + + return (0); +} + +static int +bcm_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + uint32_t bank, offset, reg_data; + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + bank = pin / 32; + offset = pin - 32 * bank; + + BCM_GPIO_LOCK(sc); + reg_data = BCM_GPIO_READ(sc, BCM_GPIO_GPLEV(bank)); + BCM_GPIO_UNLOCK(sc); + *val = (reg_data & (1 << offset)) ? 1 : 0; + + return (0); +} + +static int +bcm_gpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + uint32_t bank, data, offset; + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + /* We never write to read-only/reserved pins. */ + if (bcm_gpio_pin_is_ro(sc, pin)) + return (EINVAL); + + bank = pin / 32; + offset = pin - 32 * bank; + + BCM_GPIO_LOCK(sc); + data = BCM_GPIO_READ(sc, BCM_GPIO_GPLEV(bank)); + if (data & (1 << offset)) + BCM_GPIO_WRITE(sc, BCM_GPIO_GPCLR(bank), (1 << offset)); + else + BCM_GPIO_WRITE(sc, BCM_GPIO_GPSET(bank), (1 << offset)); + BCM_GPIO_UNLOCK(sc); + + return (0); +} + +static int +bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc) +{ + int i, len; + pcell_t pins[BCM_GPIO_PINS]; + phandle_t gpio; + + /* Find the gpio node to start. */ + gpio = ofw_bus_get_node(sc->sc_dev); + + len = OF_getproplen(gpio, "broadcom,read-only"); + if (len < 0 || len > sizeof(pins)) + return (-1); + + if (OF_getprop(gpio, "broadcom,read-only", &pins, len) < 0) + return (-1); + + sc->sc_ro_npins = len / sizeof(pcell_t); + + device_printf(sc->sc_dev, "read-only pins: "); + for (i = 0; i < sc->sc_ro_npins; i++) { + sc->sc_ro_pins[i] = fdt32_to_cpu(pins[i]); + if (i > 0) + printf(","); + printf("%d", sc->sc_ro_pins[i]); + } + if (i > 0) + printf("."); + printf("\n"); + + return (0); +} + +static int +bcm_gpio_get_reserved_pins(struct bcm_gpio_softc *sc) +{ + int i, j, len, npins; + pcell_t pins[BCM_GPIO_PINS]; + phandle_t gpio, node, reserved; + char name[32]; + + /* Get read-only pins. */ + if (bcm_gpio_get_ro_pins(sc) != 0) + return (-1); + + /* Find the gpio/reserved pins node to start. */ + gpio = ofw_bus_get_node(sc->sc_dev); + node = OF_child(gpio); + + /* + * Find reserved node + */ + reserved = 0; + while ((node != 0) && (reserved == 0)) { + len = OF_getprop(node, "name", name, + sizeof(name) - 1); + name[len] = 0; + if (strcmp(name, "reserved") == 0) + reserved = node; + node = OF_peer(node); + } + + if (reserved == 0) + return (-1); + + /* Get the reserved pins. */ + len = OF_getproplen(reserved, "broadcom,pins"); + if (len < 0 || len > sizeof(pins)) + return (-1); + + if (OF_getprop(reserved, "broadcom,pins", &pins, len) < 0) + return (-1); + + npins = len / sizeof(pcell_t); + + j = 0; + device_printf(sc->sc_dev, "reserved pins: "); + for (i = 0; i < npins; i++) { + if (i > 0) + printf(","); + printf("%d", fdt32_to_cpu(pins[i])); + /* Some pins maybe already on the list of read-only pins. */ + if (bcm_gpio_pin_is_ro(sc, fdt32_to_cpu(pins[i]))) + continue; + sc->sc_ro_pins[j++ + sc->sc_ro_npins] = fdt32_to_cpu(pins[i]); + } + sc->sc_ro_npins += j; + if (i > 0) + printf("."); + printf("\n"); + + return (0); +} + +static int +bcm_gpio_probe(device_t dev) +{ + if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-gpio")) + return (ENXIO); + + device_set_desc(dev, "BCM2708/2835 GPIO controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +bcm_gpio_attach(device_t dev) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + int i, j, rid; + phandle_t gpio; + + sc->sc_dev = dev; + + mtx_init(&sc->sc_mtx, "bcm gpio", "gpio", MTX_DEF); + + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Nov 29 21:05:51 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 78263DB8; Thu, 29 Nov 2012 21:05:51 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 52BDB8FC0C; Thu, 29 Nov 2012 21:05:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qATL5pSw055472; Thu, 29 Nov 2012 21:05:51 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qATL5pp6055467; Thu, 29 Nov 2012 21:05:51 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201211292105.qATL5pp6055467@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 29 Nov 2012 21:05:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243682 - user/np/stable_9_toe/sys/dev/cxgbe/tom X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 21:05:51 -0000 Author: np Date: Thu Nov 29 21:05:50 2012 New Revision: 243682 URL: http://svnweb.freebsd.org/changeset/base/243682 Log: Pull in r243680 and r243681 from head. Modified: user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_cpl_io.c user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_ddp.c user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_listen.c user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_tom.h Directory Properties: user/np/stable_9_toe/sys/ (props changed) user/np/stable_9_toe/sys/dev/ (props changed) Modified: user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Nov 29 19:39:27 2012 (r243681) +++ user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Nov 29 21:05:50 2012 (r243682) @@ -786,6 +786,29 @@ do_peer_close(struct sge_iq *iq, const s KASSERT(opcode == CPL_PEER_CLOSE, ("%s: unexpected opcode 0x%x", __func__, opcode)); KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__)); + + if (__predict_false(toep->flags & TPF_SYNQE)) { +#ifdef INVARIANTS + struct synq_entry *synqe = (void *)toep; + + INP_WLOCK(synqe->lctx->inp); + if (synqe->flags & TPF_SYNQE_HAS_L2TE) { + KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, + ("%s: listen socket closed but tid %u not aborted.", + __func__, tid)); + } else { + /* + * do_pass_accept_req is still running and will + * eventually take care of this tid. + */ + } + INP_WUNLOCK(synqe->lctx->inp); +#endif + CTR4(KTR_CXGBE, "%s: tid %u, synqe %p (0x%x)", __func__, tid, + toep, toep->flags); + return (0); + } + KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__)); INP_INFO_WLOCK(&V_tcbinfo); @@ -1090,15 +1113,27 @@ do_rx_data(struct sge_iq *iq, const stru struct socket *so; struct sockbuf *sb; int len; + uint32_t ddp_placed = 0; if (__predict_false(toep->flags & TPF_SYNQE)) { - /* - * do_pass_establish failed and must be attempting to abort the - * synqe's tid. Meanwhile, the T4 has sent us data for such a - * connection. - */ - KASSERT(toep->flags & TPF_ABORT_SHUTDOWN, - ("%s: synqe and tid isn't being aborted.", __func__)); +#ifdef INVARIANTS + struct synq_entry *synqe = (void *)toep; + + INP_WLOCK(synqe->lctx->inp); + if (synqe->flags & TPF_SYNQE_HAS_L2TE) { + KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, + ("%s: listen socket closed but tid %u not aborted.", + __func__, tid)); + } else { + /* + * do_pass_accept_req is still running and will + * eventually take care of this tid. + */ + } + INP_WUNLOCK(synqe->lctx->inp); +#endif + CTR4(KTR_CXGBE, "%s: tid %u, synqe %p (0x%x)", __func__, tid, + toep, toep->flags); m_freem(m); return (0); } @@ -1120,13 +1155,8 @@ do_rx_data(struct sge_iq *iq, const stru tp = intotcpcb(inp); -#ifdef INVARIANTS - if (__predict_false(tp->rcv_nxt != be32toh(cpl->seq))) { - log(LOG_ERR, - "%s: unexpected seq# %x for TID %u, rcv_nxt %x\n", - __func__, be32toh(cpl->seq), toep->tid, tp->rcv_nxt); - } -#endif + if (__predict_false(tp->rcv_nxt != be32toh(cpl->seq))) + ddp_placed = be32toh(cpl->seq) - tp->rcv_nxt; tp->rcv_nxt += len; KASSERT(tp->rcv_wnd >= len, ("%s: negative window size", __func__)); @@ -1173,12 +1203,20 @@ do_rx_data(struct sge_iq *iq, const stru int changed = !(toep->ddp_flags & DDP_ON) ^ cpl->ddp_off; if (changed) { - if (__predict_false(!(toep->ddp_flags & DDP_SC_REQ))) { - /* XXX: handle this if legitimate */ - panic("%s: unexpected DDP state change %d", - __func__, cpl->ddp_off); + if (toep->ddp_flags & DDP_SC_REQ) + toep->ddp_flags ^= DDP_ON | DDP_SC_REQ; + else { + KASSERT(cpl->ddp_off == 1, + ("%s: DDP switched on by itself.", + __func__)); + + /* Fell out of DDP mode */ + toep->ddp_flags &= ~(DDP_ON | DDP_BUF0_ACTIVE | + DDP_BUF1_ACTIVE); + + if (ddp_placed) + insert_ddp_data(toep, ddp_placed); } - toep->ddp_flags ^= DDP_ON | DDP_SC_REQ; } if ((toep->ddp_flags & DDP_OK) == 0 && Modified: user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_ddp.c Thu Nov 29 19:39:27 2012 (r243681) +++ user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_ddp.c Thu Nov 29 21:05:50 2012 (r243682) @@ -205,6 +205,42 @@ release_ddp_resources(struct toepcb *toe } } +/* XXX: handle_ddp_data code duplication */ +void +insert_ddp_data(struct toepcb *toep, uint32_t n) +{ + struct inpcb *inp = toep->inp; + struct tcpcb *tp = intotcpcb(inp); + struct sockbuf *sb = &inp->inp_socket->so_rcv; + struct mbuf *m; + + INP_WLOCK_ASSERT(inp); + SOCKBUF_LOCK_ASSERT(sb); + + m = m_get(M_NOWAIT, MT_DATA); + if (m == NULL) + CXGBE_UNIMPLEMENTED("mbuf alloc failure"); + m->m_len = n; + m->m_flags |= M_DDP; /* Data is already where it should be */ + m->m_data = "nothing to see here"; + + tp->rcv_nxt += n; +#ifndef USE_DDP_RX_FLOW_CONTROL + KASSERT(tp->rcv_wnd >= n, ("%s: negative window size", __func__)); + tp->rcv_wnd -= n; +#endif + + KASSERT(toep->sb_cc >= sb->sb_cc, + ("%s: sb %p has more data (%d) than last time (%d).", + __func__, sb, sb->sb_cc, toep->sb_cc)); + toep->rx_credits += toep->sb_cc - sb->sb_cc; +#ifdef USE_DDP_RX_FLOW_CONTROL + toep->rx_credits -= n; /* adjust for F_RX_FC_DDP */ +#endif + sbappendstream_locked(sb, m); + toep->sb_cc = sb->sb_cc; +} + /* SET_TCB_FIELD sent as a ULP command looks like this */ #define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \ sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core)) Modified: user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 29 19:39:27 2012 (r243681) +++ user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 29 21:05:50 2012 (r243682) @@ -282,8 +282,8 @@ send_reset_synqe(struct toedev *tod, str INP_WLOCK_ASSERT(synqe->lctx->inp); - CTR4(KTR_CXGBE, "%s: synqe %p, tid %d%s", - __func__, synqe, synqe->tid, + CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s", + __func__, synqe, synqe->flags, synqe->tid, synqe->flags & TPF_ABORT_SHUTDOWN ? " (abort already in progress)" : ""); if (synqe->flags & TPF_ABORT_SHUTDOWN) @@ -501,8 +501,10 @@ t4_listen_stop(struct toedev *tod, struc * socket's so_comp. It doesn't know about the connections on the synq * so we need to take care of those. */ - TAILQ_FOREACH(synqe, &lctx->synq, link) - send_reset_synqe(tod, synqe); + TAILQ_FOREACH(synqe, &lctx->synq, link) { + if (synqe->flags & TPF_SYNQE_HAS_L2TE) + send_reset_synqe(tod, synqe); + } destroy_server(sc, lctx); return (0); @@ -1131,8 +1133,7 @@ do_pass_accept_req(struct sge_iq *iq, co synqe->lctx = lctx; synqe->syn = m; m = NULL; - refcount_init(&synqe->refcnt, 1); /* 1 so that it is held for the - duration of this function */ + refcount_init(&synqe->refcnt, 0); synqe->l2e_idx = e->idx; synqe->rcv_bufsize = rx_credits; atomic_store_rel_ptr(&synqe->wr, (uintptr_t)wr); @@ -1155,46 +1156,9 @@ do_pass_accept_req(struct sge_iq *iq, co * If we replied during syncache_add (synqe->wr has been consumed), * good. Otherwise, set it to 0 so that further syncache_respond * attempts by the kernel will be ignored. - * - * The extra hold on the synqe makes sure that it is still around, even - * if the listener has been dropped and the synqe was aborted and the - * reply to the abort has removed and released the synqe from the synq - * list. */ if (atomic_cmpset_ptr(&synqe->wr, (uintptr_t)wr, 0)) { - INP_WLOCK(inp); - if (__predict_false(inp->inp_flags & INP_DROPPED)) { - /* listener closed. synqe must have been aborted. */ - KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, - ("%s: listener %p closed but synqe %p not aborted", - __func__, inp, synqe)); - - CTR5(KTR_CXGBE, - "%s: stid %u, tid %u, lctx %p, synqe %p, ABORTED", - __func__, stid, tid, lctx, synqe); - INP_WUNLOCK(inp); - free(wr, M_CXGBE); - release_synqe(synqe); /* about to exit function */ - return (__LINE__); - } - - /* - * synqe aborted before TOM replied to PASS_ACCEPT_REQ. But - * that can only happen if the listener was closed and we just - * checked for that. - */ - KASSERT(!(synqe->flags & TPF_ABORT_SHUTDOWN), - ("%s: synqe %p aborted, but listener %p not dropped.", - __func__, synqe, inp)); - - /* Yank the synqe out of the lctx synq. */ - TAILQ_REMOVE(&lctx->synq, synqe, link); - release_synqe(synqe); /* removed from synq list */ - inp = release_lctx(sc, lctx); - if (inp) - INP_WUNLOCK(inp); - /* * syncache may or may not have a hold on the synqe, which may * or may not be stashed in the original SYN mbuf passed to us. @@ -1205,13 +1169,39 @@ do_pass_accept_req(struct sge_iq *iq, co m->m_pkthdr.rcvif = ifp; remove_tid(sc, synqe->tid); - release_synqe(synqe); /* about to exit function */ free(wr, M_CXGBE); + + /* Yank the synqe out of the lctx synq. */ + INP_WLOCK(inp); + TAILQ_REMOVE(&lctx->synq, synqe, link); + release_synqe(synqe); /* removed from synq list */ + inp = release_lctx(sc, lctx); + if (inp) + INP_WUNLOCK(inp); + REJECT_PASS_ACCEPT(); } - release_synqe(synqe); /* about to exit function */ + CTR5(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p, synqe %p, SYNACK", __func__, stid, tid, lctx, synqe); + + INP_WLOCK(inp); + synqe->flags |= TPF_SYNQE_HAS_L2TE; + if (__predict_false(inp->inp_flags & INP_DROPPED)) { + /* + * Listening socket closed but tod_listen_stop did not abort + * this tid because there was no L2T entry for the tid at that + * time. Abort it now. The reply to the abort will clean up. + */ + CTR5(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p, synqe %p, ABORT", + __func__, stid, tid, lctx, synqe); + send_reset_synqe(tod, synqe); + INP_WUNLOCK(inp); + + return (__LINE__); + } + INP_WUNLOCK(inp); + return (0); reject: CTR4(KTR_CXGBE, "%s: stid %u, tid %u, REJECT (%d)", __func__, stid, tid, @@ -1293,15 +1283,12 @@ do_pass_establish(struct sge_iq *iq, con __func__, stid, tid, synqe, synqe->flags, inp->inp_flags); if (__predict_false(inp->inp_flags & INP_DROPPED)) { - /* - * The listening socket has closed. The TOM must have aborted - * all the embryonic connections (including this one) that were - * on the lctx's synq. do_abort_rpl for the tid is responsible - * for cleaning up. - */ - KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, - ("%s: listen socket dropped but tid %u not aborted.", - __func__, tid)); + + if (synqe->flags & TPF_SYNQE_HAS_L2TE) { + KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, + ("%s: listen socket closed but tid %u not aborted.", + __func__, tid)); + } INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_tcbinfo); @@ -1321,7 +1308,12 @@ do_pass_establish(struct sge_iq *iq, con toep = alloc_toepcb(pi, txqid, rxqid, M_NOWAIT); if (toep == NULL) { reset: - /* The reply to this abort will perform final cleanup */ + /* + * The reply to this abort will perform final cleanup. There is + * no need to check for HAS_L2TE here. We can be here only if + * we responded to the PASS_ACCEPT_REQ, and our response had the + * L2T idx. + */ send_reset_synqe(TOEDEV(ifp), synqe); INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_tcbinfo); Modified: user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_tom.h Thu Nov 29 19:39:27 2012 (r243681) +++ user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_tom.h Thu Nov 29 21:05:50 2012 (r243682) @@ -67,6 +67,7 @@ enum { TPF_SYNQE_NEEDFREE = (1 << 9), /* synq_entry was malloc'd separately */ TPF_SYNQE_TCPDDP = (1 << 10), /* ulp_mode TCPDDP in toepcb */ TPF_SYNQE_EXPANDED = (1 << 11), /* toepcb ready, tid context updated */ + TPF_SYNQE_HAS_L2TE = (1 << 12), /* we've replied to PASS_ACCEPT_REQ */ }; enum { @@ -272,4 +273,5 @@ int t4_soreceive_ddp(struct socket *, st struct mbuf **, struct mbuf **, int *); void enable_ddp(struct adapter *, struct toepcb *toep); void release_ddp_resources(struct toepcb *toep); +void insert_ddp_data(struct toepcb *, uint32_t); #endif