Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
65dbf340
Commit
65dbf340
authored
Mar 02, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'greg-time-fixes'
parents
8c50d5a3
3d734bd4
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
80 additions
and
90 deletions
+80
-90
fan.c
userspace/libwr/fan.c
+7
-8
fpga_io.c
userspace/libwr/fpga_io.c
+2
-2
i2c.c
userspace/libwr/i2c.c
+1
-1
i2c_bitbang.c
userspace/libwr/i2c_bitbang.c
+1
-1
i2c_io.c
userspace/libwr/i2c_io.c
+4
-6
i2c_sfp.c
userspace/libwr/i2c_sfp.c
+2
-1
wrs-msg.h
userspace/libwr/include/libwr/wrs-msg.h
+2
-2
init.c
userspace/libwr/init.c
+2
-2
pio.c
userspace/libwr/pio.c
+2
-2
shw_io.c
userspace/libwr/shw_io.c
+4
-4
rtu_stat.c
userspace/tools/rtu_stat.c
+1
-1
wrs_watchdog.c
userspace/wrs_watchdog/wrs_watchdog.c
+3
-3
hal_exports.c
userspace/wrsw_hal/hal_exports.c
+1
-1
hal_main.c
userspace/wrsw_hal/hal_main.c
+3
-4
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+2
-2
hal_timing.c
userspace/wrsw_hal/hal_timing.c
+5
-1
rtu_drv.c
userspace/wrsw_rtud/rtu_drv.c
+7
-10
rtu_fd.c
userspace/wrsw_rtud/rtu_fd.c
+14
-15
rtud.c
userspace/wrsw_rtud/rtud.c
+15
-16
rtud_exports.c
userspace/wrsw_rtud/rtud_exports.c
+2
-8
No files found.
userspace/libwr/fan.c
View file @
65dbf340
...
...
@@ -200,8 +200,7 @@ static float tmp100_read_temp(int dev_addr)
static
int
shw_init_i2c_sensors
(
void
)
{
if
(
i2c_init_bus
(
&
fpga_sensors_i2c
)
<
0
)
{
pr_error
(
"can't initialize temperature sensors I2C bus.
\n
"
);
pr_error
(
"Can't initialize temperature sensors I2C bus.
\n
"
);
return
-
1
;
}
return
0
;
...
...
@@ -266,7 +265,7 @@ int shw_init_fans(void)
config_item
=
libwr_cfg_get
(
"FAN_HYSTERESIS"
);
if
((
config_item
)
&&
!
strcmp
(
config_item
,
"y"
))
{
fan_hysteresis
=
1
;
pr_info
(
"
enable
fan hysteresis
\n
"
);
pr_info
(
"
Enabling
fan hysteresis
\n
"
);
config_item
=
libwr_cfg_get
(
"FAN_HYSTERESIS_T_ENABLE"
);
if
(
config_item
)
{
fan_hysteresis_t_enable
=
atoi
(
config_item
);
...
...
@@ -290,11 +289,11 @@ int shw_init_fans(void)
fan_hysteresis_pwm_val
=
4
;
}
pr_info
(
"
set temp enable to %d for fan hysteresis
\n
"
,
fan_hysteresis_t_enable
);
pr_info
(
"
set temp disable to %d for fan hysteresis
\n
"
,
fan_hysteresis_t_disable
);
pr_info
(
"
set
pwm value to %d for fan hysteresis
\n
"
,
pr_info
(
"
Setting upper temperature threshold to %d for fan "
"hysteresis
\n
"
,
fan_hysteresis_t_enable
);
pr_info
(
"
Setting lower temperature threshold to %d for fan "
"hysteresis
\n
"
,
fan_hysteresis_t_disable
);
pr_info
(
"
Setting
pwm value to %d for fan hysteresis
\n
"
,
fan_hysteresis_pwm_val
);
}
...
...
userspace/libwr/fpga_io.c
View file @
65dbf340
...
...
@@ -25,7 +25,7 @@ int shw_fpga_mmap_init()
{
int
fd
;
pr_
info
(
"Initializing FPGA memory mapping.
\n
"
);
pr_
debug
(
"Initializing FPGA memory mapping.
\n
"
);
fd
=
open
(
"/dev/mem"
,
O_RDWR
|
O_SYNC
);
if
(
fd
<
0
)
{
...
...
@@ -42,7 +42,7 @@ int shw_fpga_mmap_init()
return
-
1
;
}
pr_
info
(
"FPGA virtual base = %p
\n
"
,
_fpga_base_virt
);
pr_
debug
(
"FPGA virtual base = %p
\n
"
,
_fpga_base_virt
);
return
0
;
...
...
userspace/libwr/i2c.c
View file @
65dbf340
...
...
@@ -70,6 +70,6 @@ int32_t i2c_scan(struct i2c_bus * bus, uint8_t * data)
found
++
;
}
}
pr_
info
(
"%s (%p): ndev=%d
\n
"
,
bus
->
name
,
bus
,
found
);
pr_
debug
(
"%s (%p): ndev=%d
\n
"
,
bus
->
name
,
bus
,
found
);
return
found
;
}
userspace/libwr/i2c_bitbang.c
View file @
65dbf340
...
...
@@ -24,7 +24,7 @@ int i2c_bitbang_init_bus(struct i2c_bus *bus)
priv
=
(
struct
i2c_bitbang
*
)
bus
->
type_specific
;
pr_
info
(
"init: %s (%p)
\n
"
,
bus
->
name
,
bus
);
pr_
debug
(
"init: %s (%p)
\n
"
,
bus
->
name
,
bus
);
shw_pio_configure
(
priv
->
scl
);
shw_pio_configure
(
priv
->
sda
);
shw_pio_setdir
(
priv
->
scl
,
0
);
...
...
userspace/libwr/i2c_io.c
View file @
65dbf340
...
...
@@ -68,13 +68,12 @@ struct i2c_bus i2c_io_bus = {
int
shw_i2c_io_init
(
void
)
{
pr_info
(
"Initializing IO I2C bus...%s
\n
"
,
__TIME__
);
if
(
i2c_init_bus
(
&
i2c_io_bus
)
<
0
)
{
pr_error
(
"
init failed:
%s
\n
"
,
i2c_io_bus
.
name
);
pr_error
(
"
I2C I/O init failed for bus
%s
\n
"
,
i2c_io_bus
.
name
);
return
-
1
;
}
pr_info
(
"
init: success:
%s
\n
"
,
i2c_io_bus
.
name
);
pr_info
(
"
I2C I/O init success for bus
%s
\n
"
,
i2c_io_bus
.
name
);
return
0
;
}
...
...
@@ -112,9 +111,8 @@ int shw_get_hw_ver(void)
case
2
:
return
341
;
default:
pr_error
(
"Unknown HW version (0x%x), check the DIP switch under the SCB
\n
"
,
(
ret
>>
1
)
&
0x7
);
pr_error
(
"Unknown HW version (0x%x), check the DIP "
"switch under the SCB
\n
"
,
(
ret
>>
1
)
&
0x7
);
return
-
1
;
}
...
...
userspace/libwr/i2c_sfp.c
View file @
65dbf340
...
...
@@ -194,7 +194,8 @@ int shw_sfp_buses_init(void)
pr_info
(
"Initializing SFP I2C busses...
\n
"
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
i2c_buses
);
i
++
)
{
if
(
i2c_init_bus
(
&
i2c_buses
[
i
])
<
0
)
{
pr_error
(
"init failed: %s
\n
"
,
i2c_buses
[
i
].
name
);
pr_error
(
"I2C SFP init failed for bus %s
\n
"
,
i2c_buses
[
i
].
name
);
return
-
1
;
}
// printf("init: success: %s\n", i2c_buses[i].name);
...
...
userspace/libwr/include/libwr/wrs-msg.h
View file @
65dbf340
...
...
@@ -33,10 +33,10 @@ extern void wrs_msg_init(int argc, char **argv);
#ifdef DEBUG
/* We had it, so let's keep this build-time thing */
# define WRS_MSG_DEFAULT_LEVEL LOG_DEBUG
#else
# define WRS_MSG_DEFAULT_LEVEL LOG_
WARNING
# define WRS_MSG_DEFAULT_LEVEL LOG_
INFO
#endif
#define WRS_MSG_DETAILS_AT LOG_
INFO
/* >= info (so, debug)
use __LINE__ */
#define WRS_MSG_DETAILS_AT LOG_
DEBUG
/* >= for debug
use __LINE__ */
/* This is the external function for it all */
extern
void
__wrs_msg
(
int
level
,
const
char
*
func
,
int
line
,
...
...
userspace/libwr/init.c
View file @
65dbf340
...
...
@@ -10,7 +10,7 @@
int
shw_init
()
{
pr_
info
(
"%s
\n
======================================================
\n
"
,
pr_
debug
(
"%s
\n
======================================================
\n
"
,
__TIME__
);
/* Init input/output (GPIO & CPU I2C) */
...
...
@@ -37,6 +37,6 @@ int shw_init()
int
shw_exit_fatal
(
void
)
{
pr_error
(
"
e
xiting due to fatal error.
\n
"
);
pr_error
(
"
E
xiting due to fatal error.
\n
"
);
exit
(
-
1
);
}
userspace/libwr/pio.c
View file @
65dbf340
...
...
@@ -48,12 +48,12 @@ int shw_pio_mmap_init()
AT91C_BASE_SYS_RAW
);
if
(
_sys_base
==
NULL
)
{
pr_error
(
"Can't mmap CPU GPIO regs
\n
"
);
pr_error
(
"Can't mmap CPU GPIO reg
ister
s
\n
"
);
close
(
fd
);
exit
(
-
1
);
}
pr_
info
(
"AT91_SYS virtual base = %p
\n
"
,
_sys_base
);
pr_
debug
(
"AT91_SYS virtual base = %p
\n
"
,
_sys_base
);
pmc_enable_clock
(
2
);
/* enable PIO clocks */
pmc_enable_clock
(
3
);
...
...
userspace/libwr/shw_io.c
View file @
65dbf340
...
...
@@ -112,7 +112,7 @@ int shw_io_init()
I2C_shw_io_led_state_o
);
}
pr_info
(
"
version=
%d (CPUPWN=%d)
\n
"
,
ver
,
ver
<
330
);
pr_info
(
"
Hardware version is
%d (CPUPWN=%d)
\n
"
,
ver
,
ver
<
330
);
return
0
;
}
...
...
@@ -140,7 +140,7 @@ int shw_io_configure_all()
//Do nothing for undefined type
break
;
default:
pr_
info
(
pr_
debug
(
"Config not implemented for type %d for io #%d
\n
"
,
io
->
type
,
i
);
break
;
...
...
@@ -192,7 +192,7 @@ uint32_t shw_io_read(shw_io_id_t id)
shift
);
}
case
SHW_UNDEF
:
pr_error
(
"IO #%d is undef
\n
"
,
id
);
pr_error
(
"IO #%d is undef
ined
\n
"
,
id
);
break
;
default:
pr_error
(
"Unknow type %d for io #%d
\n
"
,
...
...
@@ -232,7 +232,7 @@ int shw_io_write(shw_io_id_t id, uint32_t value)
i32data
);
}
case
SHW_UNDEF
:
pr_error
(
"Pin #%d is undef
\n
"
,
id
);
pr_error
(
"Pin #%d is undef
ined
\n
"
,
id
);
break
;
default:
pr_error
(
"Unknow type %d for io #%d
\n
"
,
...
...
userspace/tools/rtu_stat.c
View file @
65dbf340
...
...
@@ -118,7 +118,7 @@ void show_help(char *prgname)
fprintf
(
stderr
,
""
" help: Show this message
\n
"
" list: List the routing table (same as empty command)
\n
"
" remove <ifnum>
[<force>]:
Remove all dynamic entries for one interface
\n
"
" remove <ifnum>
:
Remove all dynamic entries for one interface
\n
"
" add <mac (XX:XX:XX:XX:XX)> <ifnum> [<mode>]: Add entry for a specific
\n
"
" MAC address (mode={1=dynamic,0=static}
\n
"
" vlan <vid> <fid> <hex mask> [<drop>, <prio>, <has_prio>, <prio_override>]:
\n
"
...
...
userspace/wrs_watchdog/wrs_watchdog.c
View file @
65dbf340
...
...
@@ -238,7 +238,7 @@ void endless_watchdog(void)
/* handle reset if needed */
if
(
rst
)
{
pr_warning
(
"S
WC
ore stuck... resetting
\n
"
);
pr_warning
(
"S
witching c
ore stuck... resetting
\n
"
);
force_rst
();
clear_stuck
(
stuck_cnt
);
}
...
...
@@ -297,7 +297,7 @@ int main(int argc, char *argv[])
pr_info
(
"Read %d ports from cmdline
\n
"
,
port_num
);
break
;
case
'p'
:
pr_
info
(
"use pidfile %s"
,
optarg
);
pr_
debug
(
"use pidfile %s"
,
optarg
);
write_pidfile
(
optarg
,
getpid
());
break
;
case
'q'
:
break
;
/* done in wrs_msg_init() */
...
...
@@ -320,7 +320,7 @@ int main(int argc, char *argv[])
}
if
(
daemon_mode
)
{
wrs_msg
(
LOG_ALERT
,
"wrs_watchdog. Commit %s, built on "
pr_info
(
"wrs_watchdog. Commit %s, built on "
__DATE__
"
\n
"
,
__GIT_VER__
);
pr_info
(
"Demonize
\n
"
);
...
...
userspace/wrsw_hal/hal_exports.c
View file @
65dbf340
...
...
@@ -229,7 +229,7 @@ int hal_check_running()
struct
wrs_shm_head
*
hal_head
;
hal_head
=
wrs_shm_get
(
wrs_shm_hal
,
""
,
WRS_SHM_READ
);
if
(
!
hal_head
)
{
pr_
info
(
"Unable to open shm for HAL! Unable to check if there "
pr_
error
(
"Unable to open shm for HAL! Unable to check if there "
"is another HAL instance running. Error: %s
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
...
...
userspace/wrsw_hal/hal_main.c
View file @
65dbf340
...
...
@@ -50,7 +50,7 @@ static void call_cleanup_cbs(void)
{
int
i
;
pr_
info
(
"Cleaning up...
\n
"
);
pr_
debug
(
"Cleaning up...
\n
"
);
for
(
i
=
0
;
i
<
MAX_CLEANUP_CALLBACKS
;
i
++
)
if
(
cleanup_cb
[
i
])
cleanup_cb
[
i
]
();
...
...
@@ -82,7 +82,7 @@ static int hal_init(void)
//trace_log_stderr();
int
line
;
pr_
info
(
"initializing...
\n
"
);
pr_
debug
(
"initializing...
\n
"
);
memset
(
cleanup_cb
,
0
,
sizeof
(
cleanup_cb
));
...
...
@@ -220,8 +220,7 @@ int main(int argc, char *argv[])
wrs_msg_init
(
argc
,
argv
);
/* Print HAL's version */
wrs_msg
(
LOG_ALERT
,
"wrsw_hal. Commit %s, built on "
__DATE__
"
\n
"
,
__GIT_VER__
);
pr_info
(
"wrsw_hal. Commit %s, built on "
__DATE__
"
\n
"
,
__GIT_VER__
);
/* Prevent from running HAL twice - it will likely freeze the system */
if
(
hal_check_running
())
{
...
...
userspace/wrsw_hal/hal_ports.c
View file @
65dbf340
...
...
@@ -161,7 +161,7 @@ static int hal_port_init(int index)
pr_error
(
"port index %i (%s): invalid role "
"
\"
%s
\"
specified
\n
"
,
index
,
name
,
s
);
pr_
info
(
"Port %s: mode %i
\n
"
,
p
->
name
,
val
);
pr_
debug
(
"Port %s: mode %i
\n
"
,
p
->
name
,
val
);
}
/* Get fiber type */
...
...
@@ -553,7 +553,7 @@ static void hal_port_poll_sfp(void)
if
(
ports
[
i
].
in_use
&&
(
mask
^
old_mask
)
&
(
1
<<
hw_index
))
{
int
insert
=
mask
&
(
1
<<
hw_index
);
pr_info
(
"Detected SFP %s "
pr_info
(
"
SFP Info:
Detected SFP %s "
"on port %s.
\n
"
,
insert
?
"insertion"
:
"removal"
,
ports
[
i
].
name
);
...
...
userspace/wrsw_hal/hal_timing.c
View file @
65dbf340
...
...
@@ -90,8 +90,12 @@ int hal_init_timing(char *filename)
continue
;
}
if
(
pstate
.
flags
&
RTS_DMTD_LOCKED
)
if
(
pstate
.
flags
&
RTS_DMTD_LOCKED
)
{
if
(
timing_mode
==
HAL_TIMING_MODE_GRAND_MASTER
)
pr_info
(
"GrandMaster locked to external "
"reference
\n
"
);
break
;
}
usleep
(
100000
);
}
...
...
userspace/wrsw_rtud/rtu_drv.c
View file @
65dbf340
...
...
@@ -114,8 +114,7 @@ void init_shm(void)
/* check hal's shm version */
if
(
hal_head
->
version
!=
HAL_SHMEM_VERSION
)
{
pr_error
(
"unknown hal's shm version %i "
"(known is %i)
\n
"
,
pr_error
(
"Unknown hal's shm version %i (known is %i)
\n
"
,
hal_head
->
version
,
HAL_SHMEM_VERSION
);
exit
(
-
1
);
}
...
...
@@ -124,8 +123,7 @@ void init_shm(void)
* addresses. No need to re-dereference pointer at each read. */
hal_ports
=
wrs_shm_follow
(
hal_head
,
h
->
ports
);
if
(
hal_nports_local
>
HAL_MAX_PORTS
)
{
pr_error
(
"Too many ports reported by HAL. "
"%d vs %d supported
\n
"
,
pr_error
(
"Too many ports reported by HAL. %d vs %d supported
\n
"
,
hal_nports_local
,
HAL_MAX_PORTS
);
exit
(
-
1
);
}
...
...
@@ -143,8 +141,7 @@ int rtu_init(void)
// Used to 'get' RTU IRQs from kernel
fd
=
open
(
RTU_DEVNAME
,
O_RDWR
);
if
(
fd
<
0
)
{
pr_error
(
"Can't open %s: is the RTU kernel driver loaded?
\n
"
,
pr_error
(
"Can't open %s: is the RTU kernel driver loaded?
\n
"
,
RTU_DEVNAME
);
return
errno
;
}
...
...
@@ -153,7 +150,7 @@ int rtu_init(void)
if
(
err
)
return
err
;
pr_
info
(
"module initialized
\n
"
);
pr_
debug
(
"module initialized
\n
"
);
return
0
;
}
...
...
@@ -163,7 +160,7 @@ void rtu_exit(void)
if
(
fd
>=
0
)
close
(
fd
);
pr_
info
(
"module cleanup
\n
"
);
pr_
debug
(
"module cleanup
\n
"
);
}
#define rtu_rd(reg) \
...
...
@@ -398,9 +395,9 @@ void rtu_write_vlan_entry(int vid, struct rtu_vlan_table_entry *ent)
rtu_wr
(
VTR1
,
vtr1
);
if
(
ent
->
drop
>
0
&&
ent
->
port_mask
==
0x0
)
{
pr_info
(
"Remov
eVlan
: vid %d (fid %d)
\n
"
,
vid
,
ent
->
fid
);
pr_info
(
"Remov
ing VLAN
: vid %d (fid %d)
\n
"
,
vid
,
ent
->
fid
);
}
else
{
pr_info
(
"Add
Vlan
: vid %d (fid %d) port_mask 0x%x
\n
"
,
pr_info
(
"Add
ing VLAN
: vid %d (fid %d) port_mask 0x%x
\n
"
,
vid
,
ent
->
fid
,
ent
->
port_mask
);
}
...
...
userspace/wrsw_rtud/rtu_fd.c
View file @
65dbf340
...
...
@@ -127,7 +127,7 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
uint32_t
bitmap
[
RTU_ENTRIES
/
32
];
int
err
;
struct
rtu_shmem_header
*
rtu_hdr
;
pr_
info
(
"Open rtu shmem.
\n
"
);
pr_
debug
(
"Open rtu shmem.
\n
"
);
rtu_port_shmem
=
wrs_shm_get
(
wrs_shm_rtu
,
"wrsw_rtud"
,
WRS_SHM_WRITE
|
WRS_SHM_LOCKED
);
if
(
!
rtu_port_shmem
)
{
...
...
@@ -138,7 +138,7 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
if
(
rtu_port_shmem
->
pidsequence
==
1
)
{
/* for first RTUd run */
pr_
info
(
"Alloc rtu_hdr
\n
"
);
pr_
debug
(
"Alloc rtu_hdr
\n
"
);
rtu_hdr
=
wrs_shm_alloc
(
rtu_port_shmem
,
sizeof
(
*
rtu_hdr
));
}
else
{
/* rtu_hdr was created at header->offset */
...
...
@@ -156,13 +156,13 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
if
(
!
rtu_hdr
->
filters
)
{
/* for first RTUd run */
pr_info
(
"Alloc
rtu_htab
\n
"
);
pr_info
(
"Alloc
ating a new, clean hash table
\n
"
);
rtu_htab
=
wrs_shm_alloc
(
rtu_port_shmem
,
sizeof
(
*
rtu_htab
)
*
HTAB_ENTRIES
);
rtu_hdr
->
filters
=
(
struct
rtu_filtering_entry
*
)
rtu_htab
;
rtu_hdr
->
filters_offset
=
(
void
*
)
rtu_htab
-
(
void
*
)
rtu_port_shmem
;
pr_
info
(
"Clean filtering database.
\n
"
);
pr_
debug
(
"Clean filtering database.
\n
"
);
clean_fd
();
/* clean filtering database */
}
else
{
pr_info
(
"Use existing filtering table.
\n
"
);
...
...
@@ -179,16 +179,16 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
if
(
!
rtu_hdr
->
vlans
)
{
/* for first RTUd run */
pr_info
(
"Alloc
vlan_tab
\n
"
);
pr_info
(
"Alloc
ating a new, clean vlan table
\n
"
);
vlan_tab
=
wrs_shm_alloc
(
rtu_port_shmem
,
sizeof
(
*
vlan_tab
)
*
NUM_VLANS
);
rtu_hdr
->
vlans
=
vlan_tab
;
rtu_hdr
->
vlans_offset
=
(
void
*
)
vlan_tab
-
(
void
*
)
rtu_port_shmem
;
pr_
info
(
"Clean vlan database.
\n
"
);
pr_
debug
(
"Clean vlan database.
\n
"
);
clean_vd
();
/* clean VLAN database */
}
else
{
pr_info
(
"Us
e
existing vlan table.
\n
"
);
pr_info
(
"Us
ing
existing vlan table.
\n
"
);
/* next RTUd runs */
rtu_hdr
->
vlans
=
(
void
*
)
rtu_port_shmem
+
rtu_hdr
->
vlans_offset
;
...
...
@@ -207,16 +207,16 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
/* add version info */
rtu_port_shmem
->
version
=
RTU_SHMEM_VERSION
;
pr_
info
(
"clean aging map.
\n
"
);
pr_
debug
(
"clean aging map.
\n
"
);
rtu_read_aging_bitmap
(
bitmap
);
// clean aging registers
pr_
info
(
"set aging time [%ld].
\n
"
,
aging
);
pr_
debug
(
"set aging time [%ld].
\n
"
,
aging
);
aging_time
=
aging
;
err
=
pthread_mutex_init
(
&
fd_mutex
,
NULL
);
if
(
err
)
return
err
;
pr_
info
(
"set hash poly.
\n
"
);
pr_
debug
(
"set hash poly.
\n
"
);
rtu_fd_set_hash_poly
(
poly
);
/* release process waiting on rtud's shm
...
...
@@ -312,8 +312,7 @@ int rtu_fd_create_entry(uint8_t mac[ETH_ALEN], uint16_t vid, uint32_t port_mask,
n_buckets
=
htab_count_buckets
(
eaddr
);
if
(
n_buckets
==
RTU_BUCKETS
)
{
pr_error
(
"Hash %03x has no buckets left.
\n
"
,
pr_error
(
"Hash %03x has no buckets left.
\n
"
,
eaddr
.
hash
);
wrs_shm_write
(
rtu_port_shmem
,
WRS_SHM_WRITE_END
);
...
...
@@ -533,7 +532,7 @@ static void rtu_fd_age_update(void)
continue
;
if
(
0
)
pr_
info
(
pr_
debug
(
"Updated htab entry age: mac = %s, hash = %03x:%d, delta_t = %ld
\n
"
,
mac_to_string
(
rtu_htab
[
hash
]
[
bucket
].
mac
),
hash
,
...
...
@@ -605,8 +604,8 @@ static void rtu_fd_age_out(void)
if
(
ent
->
valid
&&
ent
->
dynamic
&&
(
time_after
(
t
,
ent
->
last_access_t
)
||
ent
->
force_remove
))
{
pr_
info
(
"
Deleting htab entry: mac = %s, hash =
0x%x, bucket = %d, forced=%d
\n
"
,
pr_
debug
(
"Deleting htab entry: mac = %s, hash ="
" 0x%x, bucket = %d, forced=%d
\n
"
,
mac_to_string
(
ent
->
mac
),
i
,
j
,
ent
->
force_remove
);
hw_request
(
HW_REMOVE_REQ
,
ent
->
addr
,
ent
);
...
...
userspace/wrsw_rtud/rtud.c
View file @
65dbf340
...
...
@@ -103,7 +103,7 @@ static int rtu_create_static_entries(void)
hal_nports_local
);
// VLAN-aware Bridge reserved addresses (802.1Q-2005 Table 8.1)
pr_info
(
"
a
dding static routes for slow protocols...
\n
"
);
pr_info
(
"
A
dding static routes for slow protocols...
\n
"
);
for
(
i
=
0
;
i
<
NUM_RESERVED_ADDR
;
i
++
)
{
slow_proto_mac
[
5
]
=
i
;
err
=
...
...
@@ -121,7 +121,7 @@ static int rtu_create_static_entries(void)
}
/* PTP over UDP */
pr_info
(
"
a
dding entry for PTP over UDP
\n
"
);
pr_info
(
"
A
dding entry for PTP over UDP
\n
"
);
err
=
rtu_fd_create_entry
(
udp_ptp_mac
,
0
,
(
1
<<
hal_nports_local
),
STATIC
,
OVERRIDE_EXISTING
);
...
...
@@ -129,7 +129,7 @@ static int rtu_create_static_entries(void)
return
err
;
// Broadcast MAC
pr_info
(
"
a
dding static route for broadcast MAC...
\n
"
);
pr_info
(
"
A
dding static route for broadcast MAC...
\n
"
);
err
=
rtu_fd_create_entry
(
bcast_mac
,
0
,
enabled_port_mask
|
(
1
<<
hal_nports_local
),
...
...
@@ -144,7 +144,7 @@ static int rtu_create_static_entries(void)
if
(
err
)
return
err
;
pr_info
(
"
d
one creating static entries.
\n
"
);
pr_info
(
"
D
one creating static entries.
\n
"
);
return
0
;
}
...
...
@@ -221,7 +221,7 @@ static int rtu_daemon_learning_process(void)
// Serve pending unrecognised request
err
=
rtu_read_learning_queue
(
&
req
);
if
(
!
err
)
{
pr_
info
(
pr_
debug
(
"ureq: port %d src %s VID %d priority %d
\n
"
,
req
.
port_id
,
mac_to_string
(
req
.
src
),
...
...
@@ -233,7 +233,7 @@ static int rtu_daemon_learning_process(void)
if
(
p
->
in_use
&&
p
->
hw_index
==
req
.
port_id
&&
!
state_up
(
p
->
state
))
{
port_down
=
1
;
pr_
info
(
"port down %d
\n
"
,
i
);
pr_
debug
(
"port down %d
\n
"
,
i
);
break
;
}
}
...
...
@@ -251,14 +251,14 @@ static int rtu_daemon_learning_process(void)
err
=
0
;
if
(
err
==
-
ENOMEM
)
{
// TODO remove oldest entries (802.1D says you MAY do it)
pr_info
(
"
f
iltering database full
\n
"
);
pr_info
(
"
F
iltering database full
\n
"
);
}
else
if
(
err
)
{
pr_
info
(
"create entry: er
r %d
\n
"
,
pr_
error
(
"Create entry: erro
r %d
\n
"
,
err
);
break
;
}
}
else
{
pr_
info
(
"read learning queue: er
r %d
\n
"
,
err
);
pr_
error
(
"Read learning queue: erro
r %d
\n
"
,
err
);
}
}
return
err
;
...
...
@@ -276,7 +276,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
int
i
,
err
;
// init RTU HW
pr_
info
(
"init rtu hard
ware.
\n
"
);
pr_
debug
(
"Initializing RTU gate
ware.
\n
"
);
err
=
rtu_init
();
if
(
err
)
return
err
;
...
...
@@ -285,11 +285,11 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
return
err
;
// disable RTU
pr_
info
(
"disable rtu
.
\n
"
);
pr_
debug
(
"Disabling RTU
.
\n
"
);
rtu_disable
();
// init configuration for ports
pr_info
(
"
init port config
.
\n
"
);
pr_info
(
"
Initial configuration for all ports
.
\n
"
);
for
(
i
=
MIN_PORT
;
i
<=
MAX_PORT
;
i
++
)
{
// MIN_PORT <= port <= MAX_PORT, thus no err returned
...
...
@@ -301,7 +301,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
}
// init filtering database
pr_info
(
"
init fd
.
\n
"
);
pr_info
(
"
Initializing filtering database
.
\n
"
);
err
=
rtu_fd_init
(
poly
,
aging_time
);
if
(
err
)
return
err
;
...
...
@@ -312,7 +312,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
return
err
;
// turn on RTU
pr_
info
(
"enable rtu
.
\n
"
);
pr_
debug
(
"Enabling RTU
.
\n
"
);
rtu_enable
();
rtud_init_exports
();
...
...
@@ -355,8 +355,7 @@ int main(int argc, char **argv)
wrs_msg_init
(
argc
,
argv
);
/* Print RTUd's version */
wrs_msg
(
LOG_ALERT
,
"wrsw_rtud. Commit %s, built on "
__DATE__
"
\n
"
,
__GIT_VER__
);
pr_info
(
"wrsw_rtud. Commit %s, built on "
__DATE__
"
\n
"
,
__GIT_VER__
);
if
(
argc
>
1
)
{
// Strip out path from argv[0] if exists, and extract command name
...
...
userspace/wrsw_rtud/rtud_exports.c
View file @
65dbf340
...
...
@@ -51,15 +51,9 @@ int rtudexp_clear_entries(const struct minipc_pd *pd,
uint32_t
*
args
,
void
*
ret
)
{
int
iface_num
=
(
int
)
args
[
0
];
int
force
=
(
int
)
args
[
1
];
int
*
p_ret
=
(
int
*
)
ret
;
//force pointed to int type
pr_info
(
"iface=%d, force=%d
\n
"
,
iface_num
,
force
);
//Do nothing
if
(
force
)
pr_info
(
"wr%d > force %d is not implemented
\n
"
,
iface_num
,
force
);
pr_debug
(
"Removing dynamic entries on interface %d
\n
"
,
iface_num
);
rtu_fd_clear_entries_for_port
(
iface_num
);
*
p_ret
=
0
;
...
...
@@ -118,7 +112,7 @@ int rtud_init_exports()
if
(
!
rtud_ch
<
0
)
return
-
1
;
pr_
info
(
"wripc server created [fd %d]
\n
"
,
pr_
debug
(
"wripc server created [fd %d]
\n
"
,
minipc_fileno
(
rtud_ch
));
if
(
getenv
(
"RTUD_MINIPC_DEBUG"
))
minipc_set_logfile
(
rtud_ch
,
stderr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment