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
85
Issues
85
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
b0e47d8a
Commit
b0e47d8a
authored
Mar 01, 2016
by
Grzegorz Daniluk
Committed by
Adam Wujek
Mar 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrsw_rtud: cleanup in log messages - levels and content
parent
ee3fd196
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
44 deletions
+39
-44
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
+3
-3
No files found.
userspace/wrsw_rtud/rtu_drv.c
View file @
b0e47d8a
...
...
@@ -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 @
b0e47d8a
...
...
@@ -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 @
b0e47d8a
...
...
@@ -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 @
b0e47d8a
...
...
@@ -54,11 +54,11 @@ int rtudexp_clear_entries(const struct minipc_pd *pd,
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
);
pr_
debug
(
"Removing dynamic entries on interface
%d, force=%d
\n
"
,
iface_num
,
force
);
//Do nothing
if
(
force
)
pr_
info
(
"wr%d > force %d is not implemented
\n
"
,
pr_
debug
(
"wr%d > force %d is not implemented
\n
"
,
iface_num
,
force
);
rtu_fd_clear_entries_for_port
(
iface_num
);
...
...
@@ -118,7 +118,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