Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F45553
smp_tune_scrubbed.c
All Users
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
alfred
Nov 12 2014, 4:54 PM
2014-11-12 16:54:00 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
smp_tune_scrubbed.c
View Options
#include
<sys/types.h>
#include
<sys/time.h>
#include
<sys/systm.h>
#include
<sys/param.h>
#include
<sys/kernel.h>
#include
<sys/module.h>
#include
<sys/smp.h>
static
const
char
*
g_tunable
=
"hw.mycompany.num_queues"
;
#ifndef MY_MOD_NAME
#define MY_MOD_NAME "smp_tune"
#endif
static
const
char
*
my_mod_name
=
MY_MOD_NAME
;
static
int
smp_tune
(
void
)
{
char
intbuf
[
128
];
int
x
,
y
;
x
=
mp_ncpus
/
4
;
y
=
imax
(
1
,
y
);
sprintf
(
intbuf
,
"%d"
,
y
);
printf
(
"%s: setenv(%s, %s)
\n
"
,
my_mod_name
,
g_tunable
,
intbuf
);
setenv
(
g_tunable
,
intbuf
);
setenv
(
"hw.ix.num_queues"
,
intbuf
);
setenv
(
"hw.igb.num_queues"
,
intbuf
);
printf
(
"%s: %s
\n
"
,
my_mod_name
,
getenv
(
g_tunable
));
return
0
;
}
static
int
smp_tune_modevent
(
module_t
mod
,
int
type
,
void
*
unused
)
{
switch
(
type
)
{
case
MOD_LOAD
:
smp_tune
();
return
0
;
case
MOD_UNLOAD
:
return
0
;
}
return
EINVAL
;
}
static
moduledata_t
smp_tune_mod
=
{
MY_MOD_NAME
,
smp_tune_modevent
,
0
};
DECLARE_MODULE
(
smp_tune
,
smp_tune_mod
,
SI_SUB_CPU
,
SI_ORDER_ANY
/* LAST */
);
MODULE_VERSION
(
smp_tune
,
1
);
File Metadata
Details
Attached
Mime Type
text/x-c
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
45445
Default Alt Text
smp_tune_scrubbed.c (1 KB)
Attached To
Mode
D1149: ixgbe and igb should check tunables at load time. Also support per-device queue count.
Attached
Detach File
Event Timeline
Log In to Comment