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
02a7c84a
Commit
02a7c84a
authored
Jun 12, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/wrsw_vlans: remove duplication in IPC calls
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
d9188908
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
50 deletions
+33
-50
wrsw_vlans.c
userspace/tools/wrsw_vlans.c
+33
-50
No files found.
userspace/tools/wrsw_vlans.c
View file @
02a7c84a
...
...
@@ -331,62 +331,45 @@ int config_rtud(void)
void
list_rtu_vlans
(
void
)
{
rtudexp_vd_list_t
vlist
;
rtudexp_vd_entry_t
*
ventry
;
int
idx
=
0
,
i
;
struct
rtu_vlans_t
*
p
=
rtu_retrieve_config
();
printf
(
" VID FID MASK DROP PRIO PRIO_OVERRIDE
\n
"
);
printf
(
"-----------------------------------------------------------
\n
"
);
do
{
if
(
minipc_call
(
rtud_ch
,
MINIPC_TIMEOUT
,
&
rtud_export_get_vd_list
,
&
vlist
,
idx
)
<
0
)
{
fprintf
(
stderr
,
"%s: minipc_call: %s (%s)
\n
"
,
prgname
,
strerror
(
errno
),
strerror
(
*
(
int
*
)
&
vlist
));
return
;
}
for
(
i
=
0
;
i
<
vlist
.
num_entries
;
++
i
)
{
ventry
=
&
vlist
.
list
[
i
];
printf
(
"%4d %4d 0x%08x "
,
ventry
->
vid
,
ventry
->
fid
,
ventry
->
port_mask
);
if
(
ventry
->
drop
==
0
)
printf
(
"NO "
);
else
printf
(
"YES"
);
if
(
ventry
->
has_prio
==
0
)
printf
(
" -- "
);
else
printf
(
" %1d "
,
ventry
->
prio
);
if
(
ventry
->
prio_override
==
0
)
printf
(
" NO "
);
else
printf
(
" YES "
);
printf
(
"
\n
"
);
}
idx
=
vlist
.
next
;
}
while
(
idx
>
0
);
if
(
!
p
)
return
;
printf
(
"# VID FID MASK DROP PRIO PRIO_OVERRIDE
\n
"
);
printf
(
"#----------------------------------------------------------
\n
"
);
while
(
p
)
{
printf
(
"%4d %4d 0x%08x "
,
p
->
vid
,
p
->
fid
,
p
->
pmask
);
if
(
p
->
drop
==
0
)
printf
(
"NO "
);
else
printf
(
"YES"
);
if
(
p
->
has_prio
==
0
)
printf
(
" -- "
);
else
printf
(
" %1d "
,
p
->
prio
);
if
(
p
->
prio_override
==
0
)
printf
(
" NO "
);
else
printf
(
" YES "
);
printf
(
"
\n
"
);
p
=
p
->
next
;
}
printf
(
"
\n
"
);
}
int
clear_all
()
{
rtudexp_vd_list_t
vlist
;
rtudexp_vd_entry_t
*
ventry
;
int
idx
=
0
,
i
,
val
;
do
{
if
(
minipc_call
(
rtud_ch
,
MINIPC_TIMEOUT
,
&
rtud_export_get_vd_list
,
&
vlist
,
idx
)
<
0
)
{
/* Duplicated from above */
fprintf
(
stderr
,
"%s: minipc_call: %s
\n
"
,
prgname
,
strerror
(
errno
));
fprintf
(
stderr
,
"%s: minipc_call: %s (%s)
\n
"
,
prgname
,
strerror
(
errno
),
strerror
(
*
(
int
*
)
&
vlist
));
return
-
1
;
}
/*remove vlans from the list*/
for
(
i
=
0
;
i
<
vlist
.
num_entries
;
++
i
)
{
ventry
=
&
vlist
.
list
[
i
];
if
(
ventry
->
vid
!=
0
)
minipc_call
(
rtud_ch
,
MINIPC_TIMEOUT
,
&
rtud_export_vlan_entry
,
&
val
,
ventry
->
vid
,
ventry
->
fid
,
0
,
1
,
0
,
0
,
0
);
else
minipc_call
(
rtud_ch
,
MINIPC_TIMEOUT
,
&
rtud_export_vlan_entry
,
&
val
,
0
,
0
,
0xffffffff
,
0
,
0
,
0
,
0
);
}
idx
=
vlist
.
next
;
}
while
(
idx
>
0
);
struct
rtu_vlans_t
*
p
=
rtu_retrieve_config
();
int
val
;
while
(
p
)
{
if
(
p
->
vid
!=
0
)
minipc_call
(
rtud_ch
,
MINIPC_TIMEOUT
,
&
rtud_export_vlan_entry
,
&
val
,
p
->
vid
,
p
->
fid
,
0
,
1
,
0
,
0
,
0
);
else
minipc_call
(
rtud_ch
,
MINIPC_TIMEOUT
,
&
rtud_export_vlan_entry
,
&
val
,
0
,
0
,
0xffffffff
,
0
,
0
,
0
,
0
);
p
=
p
->
next
;
}
/*TODO: cancel tagging/untagging in all endpoints*/
...
...
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