freebsd_network: Consolidate and unify SMP-related definitions.

Previously I implemented "curcpu" as ipro1000 used it, independent
of all the other SMP functions, as an optimization. Now, iflib
wants to use these functions all together, so they have to produce
consistent results.
This commit is contained in:
Augustin Cavalier
2019-01-03 21:20:35 -05:00
parent 8582775421
commit 6ef670c379
5 changed files with 6 additions and 26 deletions
-1
View File
@@ -41,7 +41,6 @@ KernelStaticLibrary libfreebsd_network.a :
mbuf.c mbuf.c
mii.c mii.c
mutex.c mutex.c
pcpu.cpp
priv.cpp priv.cpp
smp.c smp.c
subr_autoconf.cpp subr_autoconf.cpp
@@ -68,9 +68,6 @@
#error Need definition of CACHE_LINE_SIZE for this arch! #error Need definition of CACHE_LINE_SIZE for this arch!
#endif #endif
/* defined in platform_kernel_args.h as SMP_MAX_CPUS */
#define MAXCPU 64 /* SMP_MAX_CPUS */
/* Macros for counting and rounding. */ /* Macros for counting and rounding. */
#ifndef howmany #ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y)) #define howmany(x, y) (((x)+((y)-1))/(y))
@@ -7,12 +7,11 @@
#include <OS.h> #include <OS.h>
#include <sys/smp.h>
struct thread; struct thread;
int get_curcpu();
#define curcpu (get_curcpu())
#define curthread ((struct thread*)NULL) #define curthread ((struct thread*)NULL)
/* NOTE: Dereferencing curthread will crash, which is intentional. There is /* NOTE: Dereferencing curthread will crash, which is intentional. There is
no FreeBSD compatible struct thread and Haiku's should not be used as it no FreeBSD compatible struct thread and Haiku's should not be used as it
@@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Haiku Inc. All rights reserved. * Copyright 2014-2019, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _FBSD_COMPAT_SYS_SMP_H_ #ifndef _FBSD_COMPAT_SYS_SMP_H_
@@ -20,7 +20,7 @@ static inline int
cpu_next(int i) cpu_next(int i)
{ {
i++; i++;
if (i > mp_maxid) if (i > (int)mp_maxid)
i = 0; i = 0;
return i; return i;
} }
@@ -28,5 +28,8 @@ cpu_next(int i)
#define CPU_FIRST() cpu_first() #define CPU_FIRST() cpu_first()
#define CPU_NEXT(i) cpu_next((i)) #define CPU_NEXT(i) cpu_next((i))
#define MAXCPU 1
#define curcpu 0
#endif #endif
-18
View File
@@ -1,18 +0,0 @@
/*
* Copyright 2018, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <OS.h>
#include <smp.h>
extern "C" {
#include <compat/sys/pcpu.h>
};
int32_t
get_curcpu()
{
return smp_get_current_cpu();
}