From owner-svn-src-user@FreeBSD.ORG Fri Apr 23 10:10:27 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BD581065673; Fri, 23 Apr 2010 10:10:27 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51C298FC17; Fri, 23 Apr 2010 10:10:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NAAR80066856; Fri, 23 Apr 2010 10:10:27 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NAARIG066849; Fri, 23 Apr 2010 10:10:27 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004231010.o3NAARIG066849@svn.freebsd.org> From: Juli Mallett Date: Fri, 23 Apr 2010 10:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207109 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 23 Apr 2010 10:10:27 -0000 Author: jmallett Date: Fri Apr 23 10:10:26 2010 New Revision: 207109 URL: http://svn.freebsd.org/changeset/base/207109 Log: Connect up the receive interrupt. Added: user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c user/jmallett/octeon/sys/mips/cavium/octe/octebus.c user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Fri Apr 23 09:44:30 2010 (r207108) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Fri Apr 23 10:10:26 2010 (r207109) @@ -35,6 +35,7 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include #include #include +#include #include #include @@ -44,18 +45,9 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS extern int pow_receive_group; extern struct ifnet *cvm_oct_device[]; -#if 0 -struct cvm_tasklet_wrapper -{ - struct tasklet_struct t; -};// ____cacheline_aligned_in_smp; -/* Aligning the tasklet_struct on cachline boundries seems to decrease - * throughput even though in theory it would reduce contantion on the - * cache lines containing the locks. */ - -static struct cvm_tasklet_wrapper cvm_oct_tasklet[MAXCPU]; // __cacheline_aligned_in_smp; -#endif +static struct task cvm_oct_task; +static struct taskqueue *cvm_oct_taskq; /** * Interrupt handler. The interrupt occurs whenever the POW @@ -66,20 +58,15 @@ static struct cvm_tasklet_wrapper cvm_oc * @param regs * @return */ -int cvm_oct_do_interrupt(int cpl, void *dev_id) +int cvm_oct_do_interrupt(void *dev_id) { -#if 0 /* Acknowledge the interrupt */ if (INTERRUPT_LIMIT) cvmx_write_csr(CVMX_POW_WQ_INT, 1< #include #include +#include #include #include #include @@ -44,6 +45,8 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include "wrapper-cvmx-includes.h" #include "ethernet-headers.h" +#include "octebusvar.h" + /* * XXX/juli * Convert 0444 to tunables, 0644 to sysctls. @@ -204,11 +207,14 @@ static void cvm_do_timer(unsigned long a /** * Configure common hardware for all interfaces */ -static void cvm_oct_configure_common_hw(void) +static void cvm_oct_configure_common_hw(device_t bus) { -#if 0 - int r; -#endif + struct octebus_softc *sc; + int error; + int rid; + + sc = device_get_softc(bus); + /* Setup the FPA */ cvmx_fpa_enable(); cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE, num_packet_buffers); @@ -223,10 +229,25 @@ static void cvm_oct_configure_common_hw( if (!octeon_is_simulation()) cvmx_write_csr(CVMX_SMI_EN, 1); -#if 0 /* Register an IRQ hander for to receive POW interrupts */ - r = request_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group, cvm_oct_do_interrupt, IRQF_SHARED, "Ethernet", cvm_oct_device); -#endif + rid = 0; + sc->sc_rx_irq = bus_alloc_resource(bus, SYS_RES_IRQ, &rid, + CVMX_IRQ_WORKQ0 + pow_receive_group, + CVMX_IRQ_WORKQ0 + pow_receive_group, + 1, RF_ACTIVE); + if (sc->sc_rx_irq == NULL) { + device_printf(bus, "could not allocate workq irq"); + return; + } + + error = bus_setup_intr(bus, sc->sc_rx_irq, INTR_TYPE_NET, + cvm_oct_do_interrupt, NULL, cvm_oct_device, + NULL); + if (error != 0) { + device_printf(bus, "could not setup workq irq"); + return; + } + #ifdef SMP if (USE_MULTICORE_RECEIVE) { @@ -330,7 +351,7 @@ int cvm_oct_init_module(device_t bus) cvm_oct_proc_initialize(); #endif cvm_oct_rx_initialize(); - cvm_oct_configure_common_hw(); + cvm_oct_configure_common_hw(bus); cvmx_helper_initialize_packet_io_global(); Modified: user/jmallett/octeon/sys/mips/cavium/octe/octebus.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/octebus.c Fri Apr 23 09:44:30 2010 (r207108) +++ user/jmallett/octeon/sys/mips/cavium/octe/octebus.c Fri Apr 23 10:10:26 2010 (r207109) @@ -46,6 +46,8 @@ #include "ethernet-common.h" +#include "octebusvar.h" + static void octebus_identify(driver_t *drv, device_t parent); static int octebus_probe(device_t dev); static int octebus_attach(device_t dev); @@ -69,7 +71,7 @@ static device_method_t octebus_methods[] static driver_t octebus_driver = { "octebus", octebus_methods, - 1, + sizeof (struct octebus_softc), }; static devclass_t octebus_devclass; Added: user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h Fri Apr 23 10:10:26 2010 (r207109) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2010 Juli Mallett + * 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$ + */ + +#ifndef _CAVIUM_OCTE_OCTEBUSVAR_H_ +#define _CAVIUM_OCTE_OCTEBUSVAR_H_ + +struct octebus_softc { + struct resource *sc_rx_irq; +}; + +#endif /* !_CAVIUM_OCTE_OCTEBUSVAR_H_ */ Modified: user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h Fri Apr 23 09:44:30 2010 (r207108) +++ user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h Fri Apr 23 10:10:26 2010 (r207109) @@ -43,5 +43,6 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include #include #include +#include #endif