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
3332a33a
Commit
3332a33a
authored
Mar 14, 2014
by
Maciej Lipinski
Committed by
Alessandro Rubini
May 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[rtud] added functions to access (write/read) entries in VLAN table
parent
51b08025
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
rtu_fd.c
userspace/wrsw_rtud/rtu_fd.c
+51
-0
rtu_fd.h
userspace/wrsw_rtud/rtu_fd.h
+4
-0
No files found.
userspace/wrsw_rtud/rtu_fd.c
View file @
3332a33a
...
...
@@ -416,6 +416,7 @@ static void clean_vd(void)
rtu_clean_vlan
();
for
(
i
=
1
;
i
<
NUM_VLANS
;
i
++
)
{
vlan_tab
[
i
].
drop
=
1
;
vlan_tab
[
i
].
port_mask
=
0x0
;
}
// First entry reserved for untagged packets.
...
...
@@ -593,3 +594,53 @@ static void rtu_fd_commit(void)
hw_req_list
=
NULL
;
}
/**
* \brief Creates or updates a filtering entry in the VLAN table.
* @param vid VLAN ID
* @param port_mask mask of ports on which VLAN is registered
* @param fid Filtering Database ID
* @param prio Priority to override the VLAN-tagged receive frames(if prio_override true)
* @param has_prio Indicates there is valid PRIO
* @param prio_override Use the PRIO in the VLAN Table to override the frame's PRIO in the tag
* @param drop Drop frames with this VID
*/
//--------------------------------------------------------------------------------------------
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
)
{
/*****************************************************************************************
* this is obviously wrong - the number of ports needs to be passed here in some beautiful
* way using beautiful code. We need the number of ports to know where is CPU (always
* the n-th port) -> this is to add CPU to the VLAN so taht all the protocols can reach
* CPU. The alternative to that is set the HW forwarding which is less felxible. So, in
* principle we might not need it in the end, but it would be good if it was possible to
* say whether we want or not
*/
#include <stddef.h>
#define rtu_rd(reg) \
_fpga_readl(FPGA_BASE_RTU + offsetof(struct RTU_WB, reg))
int
port_num
=
RTU_PSR_N_PORTS_R
(
rtu_rd
(
PSR
));
/****************************************************************************************/
// First entry reserved for untagged packets.
vlan_tab
[
vid
].
port_mask
=
port_mask
|
(
0x1
<<
port_num
);
vlan_tab
[
vid
].
drop
=
drop
;
vlan_tab
[
vid
].
fid
=
fid
;
vlan_tab
[
vid
].
has_prio
=
has_prio
;
vlan_tab
[
vid
].
prio_override
=
prio_override
;
vlan_tab
[
vid
].
prio
=
prio
;
rtu_write_vlan_entry
(
vid
,
&
vlan_tab
[
vid
]);
}
/**
* \brief Creates or updates a filtering entry in the VLAN table.
* @param vid VLAN ID
* @return entry of VLAN table at given VID-address
*/
struct
rtu_fd_vlan_table_entry
*
rtu_vlan_entry_get
(
int
vid
)
{
// First entry reserved for untagged packets.
if
(
vid
>
NUM_VLANS
)
return
NULL
;
return
&
vlan_tab
[
vid
];
}
userspace/wrsw_rtud/rtu_fd.h
View file @
3332a33a
...
...
@@ -68,5 +68,9 @@ struct filtering_entry * rtu_fd_lookup_htab_entry(int index);
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
);
#endif
/*__WHITERABBIT_RTU_FD_H*/
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