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
d75f6132
Commit
d75f6132
authored
Mar 17, 2014
by
Maciej Lipinski
Committed by
Alessandro Rubini
May 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[rtud/tool] Added all parameters to rtu_stat vlan adding and cleaned the code
parent
dfe39cf4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
24 deletions
+36
-24
rtu_stat.c
userspace/tools/rtu_stat.c
+15
-9
rtu_fd.c
userspace/wrsw_rtud/rtu_fd.c
+3
-3
rtu_fd.h
userspace/wrsw_rtud/rtu_fd.h
+1
-1
rtud_exports.c
userspace/wrsw_rtud/rtud_exports.c
+10
-7
rtud_exports.h
userspace/wrsw_rtud/rtud_exports.h
+7
-4
No files found.
userspace/tools/rtu_stat.c
View file @
d75f6132
...
...
@@ -65,12 +65,14 @@ int rtudexp_add_entry(const char *eha, int port, int mode)
return
(
ret
<
0
)
?
ret
:
val
;
}
int
rtudexp_vlan_entry
(
int
vid
,
int
fid
,
const
char
*
ch_mask
,
int
drop
)
int
rtudexp_vlan_entry
(
int
vid
,
int
fid
,
const
char
*
ch_mask
,
int
drop
,
int
prio
,
int
has_prio
,
int
prio_override
)
{
int
val
,
ret
;
int
mask
;
sscanf
(
ch_mask
,
"%x"
,
&
mask
);
ret
=
minipc_call
(
rtud_ch
,
MINIPC_TIMEOUT
,
&
rtud_export_vlan_entry
,
&
val
,
vid
,
fid
,
mask
,
drop
);
ret
=
minipc_call
(
rtud_ch
,
MINIPC_TIMEOUT
,
&
rtud_export_vlan_entry
,
&
val
,
vid
,
fid
,
mask
,
drop
,
prio
,
has_prio
,
prio_override
);
return
(
ret
<
0
)
?
ret
:
val
;
}
...
...
@@ -164,9 +166,12 @@ 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
"
" add <mac (XX:XX:XX:XX:XX)> <ifnum> [<mode>]: Add entry for a specific MAC address
\n
"
" vlan <vid> <fid> <hex mask> [<drop>]: Add VLAN entry with vid, fid, mask and drop flag
\n
"
);
" remove <ifnum> [<force>]: 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
"
" Add VLAN entry with vid, fid, mask and drop flag (Write mask=0x0
\n
"
" and drop=1 to remove the VLAN)
\n
"
);
exit
(
1
);
}
...
...
@@ -211,7 +216,9 @@ int main(int argc, char **argv)
}
else
if
(
strcmp
(
argv
[
1
],
"vlan"
)
==
0
)
{
if
((
argc
>
3
)
&&
(
rtudexp_vlan_entry
(
atoi
(
argv
[
2
]),
atoi
(
argv
[
3
]),
argv
[
4
],
atoidef
(
argv
[
5
],
0
))
==
0
))
isok
=
1
;
if
((
argc
>
3
)
&&
(
rtudexp_vlan_entry
(
atoi
(
argv
[
2
]),
atoi
(
argv
[
3
]),
argv
[
4
],
atoidef
(
argv
[
5
],
0
),
atoidef
(
argv
[
6
],
0
),
atoidef
(
argv
[
7
],
0
),
atoidef
(
argv
[
8
],
0
))
==
0
))
isok
=
1
;
else
printf
(
"Could not %s entry for %s
\n
"
,
argv
[
2
],
argv
[
3
]);
exit
(
1
);
}
...
...
@@ -267,9 +274,8 @@ int main(int argc, char **argv)
else
printf
(
" %1d "
,
vd_list
[
i
].
prio
);
if
(
vd_list
[
i
].
prio_override
==
0
)
printf
(
" NO "
);
else
printf
(
" YES "
);
else
printf
(
" YES "
);
printf
(
"
\n
"
);
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
userspace/wrsw_rtud/rtu_fd.c
View file @
d75f6132
...
...
@@ -635,12 +635,12 @@ void rtu_fd_create_vlan_entry(int vid, uint32_t port_mask, uint8_t fid, uint8_t
/**
* \brief Creates or updates a filtering entry in the VLAN table.
* @param vid VLAN ID
* @return entry of VLAN table at given VID-address
* @return entry of VLAN table at given VID-address
*/
struct
rtu_fd_
vlan_table_entry
*
rtu_vlan_entry_get
(
int
vid
)
struct
vlan_table_entry
*
rtu_vlan_entry_get
(
int
vid
)
{
// First entry reserved for untagged packets.
if
(
vid
>
NUM_VLANS
)
return
NULL
;
if
(
vid
>
NUM_VLANS
)
return
NULL
;
return
&
vlan_tab
[
vid
];
}
userspace/wrsw_rtud/rtu_fd.h
View file @
d75f6132
...
...
@@ -70,7 +70,7 @@ struct filtering_entry *rtu_fd_lookup_htab_entry(int index);
void
rtu_fd_create_vlan_entry
(
int
vid
,
uint32_t
port_mask
,
uint8_t
fid
,
uint8_t
prio
,
int
has_prio
,
int
prio_override
,
int
drop
);
struct
rtu_fd_
vlan_table_entry
*
rtu_vlan_entry_get
(
int
vid
);
struct
vlan_table_entry
*
rtu_vlan_entry_get
(
int
vid
);
#endif
/*__WHITERABBIT_RTU_FD_H*/
userspace/wrsw_rtud/rtud_exports.c
View file @
d75f6132
...
...
@@ -100,7 +100,7 @@ int rtudexp_get_vd_list(const struct minipc_pd *pd,
struct
vlan_table_entry
*
ent
=
rtu_vlan_entry_get
(
current
);
if
(
!
ent
)
break
;
if
(
ent
->
drop
==
0
)
if
(
ent
->
drop
==
0
||
ent
->
port_mask
!=
0x0
)
{
list
->
list
[
i
].
vid
=
current
;
list
->
list
[
i
].
port_mask
=
ent
->
port_mask
;
...
...
@@ -173,15 +173,18 @@ int rtudexp_add_entry(const struct minipc_pd *pd,
int
rtudexp_vlan_entry
(
const
struct
minipc_pd
*
pd
,
uint32_t
*
args
,
void
*
ret
)
{
int
vid
,
fid
,
mask
,
drop
;
int
vid
,
fid
,
mask
,
drop
,
prio
,
has_prio
,
prio_override
;
int
*
p_ret
=
(
int
*
)
ret
;
//force pointed to int type
*
p_ret
=
0
;
vid
=
(
int
)
args
[
0
];
fid
=
(
int
)
args
[
1
];
mask
=
(
int
)
args
[
2
];
drop
=
(
int
)
args
[
3
];
rtu_fd_create_vlan_entry
(
vid
,
(
uint32_t
)
mask
,
(
uint8_t
)
fid
,
0
/*prio*/
,
0
/*has_prio*/
,
0
/*prio_override*/
,
drop
/*drop */
);
vid
=
(
int
)
args
[
0
];
fid
=
(
int
)
args
[
1
];
mask
=
(
int
)
args
[
2
];
drop
=
(
int
)
args
[
3
];
prio
=
(
int
)
args
[
4
];
has_prio
=
(
int
)
args
[
5
];
prio_override
=
(
int
)
args
[
6
];
rtu_fd_create_vlan_entry
(
vid
,
(
uint32_t
)
mask
,
(
uint8_t
)
fid
,
(
uint8_t
)
prio
,
has_prio
,
prio_override
,
drop
);
return
*
p_ret
;
}
...
...
userspace/wrsw_rtud/rtud_exports.h
View file @
d75f6132
...
...
@@ -122,10 +122,13 @@ struct minipc_pd rtud_export_vlan_entry = {
.
name
=
"vlan_entry"
,
.
retval
=
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
.
args
=
{
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
// 0: vid
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
// 1: fid
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
// 2: mask
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
// 3: drop
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
// 4: prio
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
// 5: has_prio
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
// 6: prio_override
MINIPC_ARG_END
,
},
};
...
...
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