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:
@@ -41,7 +41,6 @@ KernelStaticLibrary libfreebsd_network.a :
|
||||
mbuf.c
|
||||
mii.c
|
||||
mutex.c
|
||||
pcpu.cpp
|
||||
priv.cpp
|
||||
smp.c
|
||||
subr_autoconf.cpp
|
||||
|
||||
@@ -68,9 +68,6 @@
|
||||
#error Need definition of CACHE_LINE_SIZE for this arch!
|
||||
#endif
|
||||
|
||||
/* defined in platform_kernel_args.h as SMP_MAX_CPUS */
|
||||
#define MAXCPU 64 /* SMP_MAX_CPUS */
|
||||
|
||||
/* Macros for counting and rounding. */
|
||||
#ifndef howmany
|
||||
#define howmany(x, y) (((x)+((y)-1))/(y))
|
||||
|
||||
@@ -7,12 +7,11 @@
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <sys/smp.h>
|
||||
|
||||
|
||||
struct thread;
|
||||
int get_curcpu();
|
||||
|
||||
#define curcpu (get_curcpu())
|
||||
#define curthread ((struct thread*)NULL)
|
||||
/* NOTE: Dereferencing curthread will crash, which is intentional. There is
|
||||
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.
|
||||
*/
|
||||
#ifndef _FBSD_COMPAT_SYS_SMP_H_
|
||||
@@ -20,7 +20,7 @@ static inline int
|
||||
cpu_next(int i)
|
||||
{
|
||||
i++;
|
||||
if (i > mp_maxid)
|
||||
if (i > (int)mp_maxid)
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
@@ -28,5 +28,8 @@ cpu_next(int i)
|
||||
#define CPU_FIRST() cpu_first()
|
||||
#define CPU_NEXT(i) cpu_next((i))
|
||||
|
||||
#define MAXCPU 1
|
||||
#define curcpu 0
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user