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
cd8d8197
Commit
cd8d8197
authored
Jul 09, 2012
by
Tomasz Wlostowski
Committed by
Alessandro Rubini
Jul 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/wrsw_rtud: initial version with up to 32 ports support (untested)
parent
e8ab979f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
89 deletions
+31
-89
rtu_drv.c
userspace/wrsw_rtud/rtu_drv.c
+27
-86
rtu_drv.h
userspace/wrsw_rtud/rtu_drv.h
+2
-2
rtud.c
userspace/wrsw_rtud/rtud.c
+2
-1
No files found.
userspace/wrsw_rtud/rtu_drv.c
View file @
cd8d8197
...
...
@@ -64,14 +64,6 @@ static uint32_t mac_entry_word2_w(struct filtering_entry *ent);
static
uint32_t
mac_entry_word3_w
(
struct
filtering_entry
*
ent
);
static
uint32_t
mac_entry_word4_w
(
struct
filtering_entry
*
ent
);
static
void
mac_entry_word0_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
);
static
void
mac_entry_word1_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
);
static
void
mac_entry_word2_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
);
static
void
mac_entry_word3_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
);
static
void
mac_entry_word4_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
);
static
uint32_t
vlan_entry_word0_w
(
struct
vlan_table_entry
*
ent
);
/*
* Used to communicate to RTU UFIFO IRQ handler device at kernel space
*/
...
...
@@ -286,7 +278,7 @@ void rtu_write_htab_entry(uint16_t zbt_addr, struct filtering_entry *ent)
write_mfifo_data
(
mac_entry_word2_w
(
ent
));
write_mfifo_data
(
mac_entry_word3_w
(
ent
));
write_mfifo_data
(
mac_entry_word4_w
(
ent
));
flush_mfifo
();
flush_mfifo
();
TRACE_DBG
(
TRACE_INFO
,
...
...
@@ -358,27 +350,36 @@ void rtu_clean_agr_htab(void)
* VLAN table size: 4096 32-bit words.
* @param addr entry memory address
*/
void
rtu_write_vlan_entry
(
uint32_t
addr
,
struct
vlan_table_entry
*
ent
)
void
rtu_write_vlan_entry
(
int
vid
,
struct
vlan_table_entry
*
ent
)
{
uint32_t
vtr1
,
vtr2
;
// printf("write_VLAN_ent: addr %x val %x\n", + RTU_VLAN_TAB + 4*addr, vlan_entry_word0_w(ent));
_fpga_writel
(
FPGA_BASE_RTU
+
RTU_VLAN_TAB_BASE
+
4
*
addr
,
vlan_entry_word0_w
(
ent
));
TRACE_DBG
(
TRACE_INFO
,
"write vlan entry: addr %x ent %08x %08x %08x %08x %08x"
,
addr
,
vlan_entry_word0_w
(
ent
)
);
vtr2
=
ent
->
port_mask
;
vtr1
=
RTU_VTR1_UPDATE
|
RTU_VTR1_VID_W
(
vid
)
|
(
ent
->
drop
?
RTU_VTR1_DROP
:
0
)
|
(
ent
->
prio_override
?
RTU_VTR1_PRIO_OVERRIDE
:
0
)
|
(
ent
->
has_prio
?
RTU_VTR1_HAS_PRIO
:
0
)
|
RTU_VTR1_PRIO_W
(
ent
->
prio
)
|
RTU_VTR1_FID_W
(
ent
->
fid
);
rtu_wr
(
VTR2
,
vtr2
);
rtu_wr
(
VTR1
,
vtr1
);
}
/**
* \brief Cleans VLAN entry in VLAN table
* @param addr memory address which shoud be cleaned.
*/
void
rtu_clean_vlan_entry
(
uint32_t
addr
)
void
rtu_clean_vlan_entry
(
int
vid
)
{
// Value 0x80000000 sets drop field to 1 (VLAN entry not registered)
_fpga_writel
(
FPGA_BASE_RTU
+
RTU_VLAN_TAB_BASE
+
4
*
addr
,
0x80000000
);
uint32_t
vtr1
,
vtr2
;
vtr2
=
0
;
vtr1
=
RTU_VTR1_UPDATE
|
RTU_VTR1_VID_W
(
vid
);
rtu_wr
(
VTR2
,
vtr2
);
rtu_wr
(
VTR1
,
vtr1
);
}
/**
...
...
@@ -387,9 +388,8 @@ void rtu_clean_vlan_entry( uint32_t addr )
void
rtu_clean_vlan
(
void
)
{
int
addr
;
for
(
addr
=
0
;
addr
<
NUM_VLANS
;
addr
++
)
{
_fpga_writel
(
FPGA_BASE_RTU
+
RTU_VLAN_TAB_BASE
+
4
*
addr
,
0x80000000
);
}
for
(
addr
=
0
;
addr
<
NUM_VLANS
;
addr
++
)
rtu_clean_vlan_entry
(
addr
);
}
...
...
@@ -624,68 +624,9 @@ static uint32_t mac_entry_word3_w(struct filtering_entry *ent)
static
uint32_t
mac_entry_word4_w
(
struct
filtering_entry
*
ent
)
{
return
(
ent
->
last_access_t
);
}
// to unmarshall MAC entries
static
void
mac_entry_word0_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
)
{
ent
->
mac
[
0
]
=
0xFF
&
(
word
>>
24
);
ent
->
mac
[
1
]
=
0xFF
&
(
word
>>
16
);
ent
->
fid
=
0xFF
&
(
word
>>
4
);
ent
->
go_to_cam
=
0x1
&
(
word
>>
3
);
ent
->
is_bpdu
=
0x1
&
(
word
>>
2
);
ent
->
end_of_bucket
=
0x1
&
(
word
>>
1
);
ent
->
valid
=
0x1
&
(
word
);
}
static
void
mac_entry_word1_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
)
{
ent
->
mac
[
2
]
=
0xFF
&
(
word
>>
24
);
ent
->
mac
[
3
]
=
0xFF
&
(
word
>>
16
);
ent
->
mac
[
4
]
=
0xFF
&
(
word
>>
8
);
ent
->
mac
[
5
]
=
0xFF
&
(
word
);
}
static
void
mac_entry_word2_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
)
{
ent
->
drop_when_dest
=
0x1
&
(
word
>>
28
);
ent
->
prio_override_dst
=
0x1
&
(
word
>>
27
);
ent
->
prio_dst
=
0x7
&
(
word
>>
24
);
ent
->
has_prio_dst
=
0x1
&
(
word
>>
23
);
ent
->
drop_unmatched_src_ports
=
0x1
&
(
word
>>
22
);
ent
->
drop_when_source
=
0x1
&
(
word
>>
21
);
ent
->
prio_override_src
=
0x1
&
(
word
>>
20
);
ent
->
prio_src
=
0x7
&
(
word
>>
17
);
ent
->
has_prio_src
=
0x1
&
(
word
>>
16
);
ent
->
cam_addr
=
0x1FF
&
(
word
);
}
static
void
mac_entry_word3_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
)
{
ent
->
port_mask_dst
=
0xFFFF
&
(
word
>>
16
);
ent
->
port_mask_src
=
0xFFFF
&
(
word
);
}
static
void
mac_entry_word4_r
(
uint32_t
word
,
struct
filtering_entry
*
ent
)
{
ent
->
last_access_t
=
word
;
return
((
0xFFFF
&
(
ent
->
port_mask_dst
>>
16
))
<<
16
)
|
((
0xFFFF
&
(
ent
->
port_mask_src
>>
16
))
)
;
}
// to marshall VLAN entries
static
uint32_t
vlan_entry_word0_w
(
struct
vlan_table_entry
*
ent
)
{
return
((
0x1
&
ent
->
drop
)
<<
31
)
|
((
0x1
&
ent
->
prio_override
)
<<
30
)
|
((
0x7
&
ent
->
prio
)
<<
27
)
|
((
0x1
&
ent
->
has_prio
)
<<
26
)
|
((
0xFF
&
ent
->
fid
)
<<
16
)
|
((
0xFFFF
&
ent
->
port_mask
)
)
;
}
userspace/wrsw_rtud/rtu_drv.h
View file @
cd8d8197
...
...
@@ -77,8 +77,8 @@ void rtu_clean_agr_hcam(void);
// VLAN TABLE
void
rtu_write_vlan_entry
(
uint32_t
addr
,
struct
vlan_table_entry
*
ent
);
void
rtu_clean_vlan_entry
(
uint32_t
addr
);
void
rtu_write_vlan_entry
(
int
vid
,
struct
vlan_table_entry
*
ent
);
void
rtu_clean_vlan_entry
(
int
vid
);
void
rtu_clean_vlan
(
void
);
// GLOBAL CONTROL REGISTER
...
...
userspace/wrsw_rtud/rtud.c
View file @
cd8d8197
...
...
@@ -90,7 +90,8 @@ static int rtu_create_static_entries()
pstate
.
hw_index
,
mac_to_string
(
pstate
.
hw_addr
)
);
err
=
rtu_fd_create_entry
(
pstate
.
hw_addr
,
0
,
(
1
<<
plist
.
num_physical_ports
),
STATIC
);
err
=
rtu_fd_create_entry
(
pstate
.
hw_addr
,
0
,
(
1
<<
plist
.
num_physical_ports
),
STATIC
);
if
(
err
)
return
err
;
}
...
...
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