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
84
Issues
84
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
50eaccbd
Commit
50eaccbd
authored
May 20, 2019
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RTU: add mirroring cfg dump to rtu_stat
parent
684a4ad8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
rtu_stat.c
userspace/tools/rtu_stat.c
+61
-0
No files found.
userspace/tools/rtu_stat.c
View file @
50eaccbd
...
...
@@ -43,6 +43,7 @@ static struct minipc_ch *rtud_ch;
struct
wrs_shm_head
*
rtu_port_shmem
;
static
struct
rtu_vlan_table_entry
vlan_tab_local
[
NUM_VLANS
];
static
struct
rtu_filtering_entry
rtu_htab_local
[
RTU_BUCKETS
*
HTAB_ENTRIES
];
static
struct
rtu_mirror_info
mirror_local
;
int
rtudexp_clear_entries
(
int
port
,
int
type
)
{
...
...
@@ -337,6 +338,32 @@ int read_htab(int *read_entries)
return
0
;
}
int
read_mirror
(
void
)
{
unsigned
int
ii
;
unsigned
int
retries
=
0
;
struct
rtu_mirror_info
*
mirror_shm
;
struct
rtu_shmem_header
*
rtu_hdr
;
rtu_hdr
=
(
void
*
)
rtu_port_shmem
+
rtu_port_shmem
->
data_off
;
mirror_shm
=
wrs_shm_follow
(
rtu_port_shmem
,
rtu_hdr
->
mirror
);
if
(
!
mirror_shm
)
return
-
2
;
/* read data, with the sequential lock to have all data consistent */
while
(
1
)
{
ii
=
wrs_shm_seqbegin
(
rtu_port_shmem
);
memcpy
(
&
mirror_local
,
mirror_shm
,
sizeof
(
*
mirror_shm
));
retries
++
;
if
(
retries
>
100
)
return
-
1
;
if
(
!
wrs_shm_seqretry
(
rtu_port_shmem
,
ii
))
break
;
/* consistent read */
usleep
(
1000
);
}
return
0
;
}
int
open_rtu_shm
(
void
)
{
int
n_wait
=
0
;
...
...
@@ -1001,5 +1028,39 @@ int main(int argc, char **argv)
printf
(
"%d active VIDs defined
\n
"
,
vid_active
);
printf
(
"
\n
"
);
if
(
read_mirror
())
{
printf
(
"Too many retries while reading mirroring config from "
"RTUd shmem
\n
"
);
return
-
1
;
}
printf
(
"RTU Port Mirroring Config Dump:
\n
"
);
printf
(
" Status: %s
\n
"
,
mirror_local
.
en
?
"Enabled"
:
"Disabled"
);
if
(
mirror_local
.
imask
!=
0
)
{
printf
(
" Ingress: port "
);
for
(
i
=
0
;
i
<
nports
;
++
i
)
{
if
((
mirror_local
.
imask
&
(
1
<<
i
))
!=
0
)
printf
(
"%d "
,
i
+
1
);
}
printf
(
"-> port "
);
for
(
i
=
0
;
i
<
nports
;
++
i
)
{
if
((
mirror_local
.
dmask
&
(
1
<<
i
))
!=
0
)
printf
(
"%d "
,
i
+
1
);
}
printf
(
"
\n
"
);
}
if
(
mirror_local
.
emask
!=
0
)
{
printf
(
" Egress: port "
);
for
(
i
=
0
;
i
<
nports
;
++
i
)
{
if
((
mirror_local
.
emask
&
(
1
<<
i
))
!=
0
)
printf
(
"%d "
,
i
+
1
);
}
printf
(
"-> port "
);
for
(
i
=
0
;
i
<
nports
;
++
i
)
{
if
((
mirror_local
.
dmask
&
(
1
<<
i
))
!=
0
)
printf
(
"%d "
,
i
+
1
);
}
printf
(
"
\n
"
);
}
return
0
;
}
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