svn commit: r207084 - user/jmallett/octeon/sys/mips/cavium/octe
Juli Mallett
jmallett at FreeBSD.org
Fri Apr 23 00:11:39 UTC 2010
Author: jmallett
Date: Fri Apr 23 00:11:38 2010
New Revision: 207084
URL: http://svn.freebsd.org/changeset/base/207084
Log:
Fix some SMP stuff.
Modified:
user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Thu Apr 22 23:58:07 2010 (r207083)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Fri Apr 23 00:11:38 2010 (r207084)
@@ -34,6 +34,7 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS
#include <sys/kernel.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
+#include <sys/smp.h>
#include <net/ethernet.h>
#include <net/if.h>
@@ -53,7 +54,7 @@ struct cvm_tasklet_wrapper
* throughput even though in theory it would reduce contantion on the
* cache lines containing the locks. */
-static struct cvm_tasklet_wrapper cvm_oct_tasklet[NR_CPUS]; // __cacheline_aligned_in_smp;
+static struct cvm_tasklet_wrapper cvm_oct_tasklet[MAXCPU]; // __cacheline_aligned_in_smp;
#endif
/**
@@ -442,7 +443,7 @@ void cvm_oct_rx_initialize(void)
#if 0
int i;
/* Initialize all of the tasklets */
- for (i = 0; i < NR_CPUS; i++)
+ for (i = 0; i < min(mp_ncpus, MAXCPU); i++)
tasklet_init(&cvm_oct_tasklet[i].t, cvm_oct_tasklet_rx, 0);
#endif
}
@@ -452,7 +453,7 @@ void cvm_oct_rx_shutdown(void)
#if 0
int i;
/* Shutdown all of the tasklets */
- for (i = 0; i < NR_CPUS; i++)
+ for (i = 0; i < min(mp_ncpus, MAXCPU); i++)
tasklet_kill(&cvm_oct_tasklet[i].t);
#endif
}
Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c Thu Apr 22 23:58:07 2010 (r207083)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c Fri Apr 23 00:11:38 2010 (r207084)
@@ -35,6 +35,7 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/module.h>
+#include <sys/smp.h>
#include <net/ethernet.h>
#include <net/if.h>
@@ -241,24 +242,20 @@ static void cvm_oct_configure_common_hw(
#ifdef SMP
if (USE_MULTICORE_RECEIVE) {
-#if 0
- preempt_disable();
+ critical_enter();
{
int cpu;
- for (cpu = 0; cpu < NR_CPUS; cpu++) {
- if (cpu_online(cpu) &&
- (cpu != smp_processor_id())) {
+ for (cpu = 0; cpu < mp_maxid; cpu++) {
+ if (!CPU_ABSENT(cpu) &&
+ (cpu != PCPU_GET(cpuid))) {
cvmx_ciu_intx0_t en;
- en.u64 = cvmx_read_csr(CVMX_CIU_INTX_EN0(cpu_logical_map(cpu)*2));
+ en.u64 = cvmx_read_csr(CVMX_CIU_INTX_EN0(cpu*2));
en.s.workq |= (1<<pow_receive_group);
- cvmx_write_csr(CVMX_CIU_INTX_EN0(cpu_logical_map(cpu)*2), en.u64);
+ cvmx_write_csr(CVMX_CIU_INTX_EN0(cpu*2), en.u64);
}
}
}
- preempt_enable();
-#else
- panic("%s: need to implement CPU enumeration.", __func__);
-#endif
+ critical_exit();
}
#endif
}
More information about the svn-src-user
mailing list