Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr-switch-sw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
wr-switch-sw
Commits
51b08025
Commit
51b08025
authored
Feb 17, 2014
by
Maciej Lipinski
Committed by
Alessandro Rubini
May 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[rtud] added possibility of adding MAC entry for multi-path (prepare for TRU)
parent
15fa9a48
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
9 deletions
+21
-9
rtu_fd.c
userspace/wrsw_rtud/rtu_fd.c
+5
-2
rtu_fd.h
userspace/wrsw_rtud/rtu_fd.h
+10
-1
rtud.c
userspace/wrsw_rtud/rtud.c
+5
-5
rtud_exports.c
userspace/wrsw_rtud/rtud_exports.c
+1
-1
No files found.
userspace/wrsw_rtud/rtu_fd.c
View file @
51b08025
...
...
@@ -194,7 +194,7 @@ static int htab_count_buckets(struct rtu_addr addr)
* @param dynamic it indicates whether it's a dynamic entry
* @return 0 if entry was created or updated. -ENOMEM if no space is available.
*/
int
rtu_fd_create_entry
(
uint8_t
mac
[
ETH_ALEN
],
uint16_t
vid
,
uint32_t
port_mask
,
int
dynamic
)
int
rtu_fd_create_entry
(
uint8_t
mac
[
ETH_ALEN
],
uint16_t
vid
,
uint32_t
port_mask
,
int
dynamic
,
int
at_existing_entry
)
{
struct
filtering_entry
*
ent
;
// pointer to scan hashtable
uint8_t
fid
;
// Filtering database identifier
...
...
@@ -214,7 +214,10 @@ int rtu_fd_create_entry(uint8_t mac[ETH_ALEN], uint16_t vid, uint32_t port_mask,
{
TRACE_DBG
(
TRACE_INFO
,
"Entry for mac %s already found."
,
mac_to_string
(
mac
));
mask_dst
=
port_mask
;
//ML: aging bugfix-> if we receive ureq for an existing entry,
if
(
at_existing_entry
==
ADD_TO_EXISTING
)
// enable multipath for redundancy
mask_dst
=
port_mask
|
ent
->
port_mask_dst
;
else
mask_dst
=
port_mask
;
//ML: aging bugfix-> if we receive ureq for an existing entry,
//it means that the port moved, so we override the existing mask...
mask_src
=
0xFFFFFFFF
;
//ML: filtering on ingress is optional according to 802.1Q-2012
//by default it should not happen. TODO: add optional config
...
...
userspace/wrsw_rtud/rtu_fd.h
View file @
51b08025
...
...
@@ -39,6 +39,14 @@
// Filtering entries may be static (permanent) or dynamic (learned)
#define STATIC 0
#define DYNAMIC 1
// Tells the rtu_fd_create_entry() function what to do if MAC entry is added
// and the same MAC is already known to be at some port (coud be the same or different).
// Most of the time we would like to override the entry because the device simply moved
// to different "location" (port) but if we want to have redundant connection, we need to
// actually add this port to the entry and risk having loop in the network (if the TRU is
// not ON)
#define OVERRIDE_EXISTING 0
#define ADD_TO_EXISTING 1
int
rtu_fd_init
(
uint16_t
poly
,
unsigned
long
aging
)
__attribute__
((
warn_unused_result
));
...
...
@@ -47,7 +55,8 @@ int rtu_fd_create_entry(
uint8_t
mac
[
ETH_ALEN
],
uint16_t
vid
,
uint32_t
port_map
,
int
dynamic
int
dynamic
,
int
at_existing_entry
)
__attribute__
((
warn_unused_result
));
int
rtu_fd_set_aging_time
(
unsigned
long
t
)
__attribute__
((
warn_unused_result
));
...
...
userspace/wrsw_rtud/rtud.c
View file @
51b08025
...
...
@@ -86,7 +86,7 @@ static int rtu_create_static_entries()
TRACE
(
TRACE_INFO
,
"adding static routes for slow protocols..."
);
for
(
i
=
0
;
i
<
NUM_RESERVED_ADDR
;
i
++
)
{
slow_proto_mac
[
5
]
=
i
;
err
=
rtu_fd_create_entry
(
slow_proto_mac
,
0
,
(
1
<<
ports
.
num_physical_ports
),
STATIC
);
err
=
rtu_fd_create_entry
(
slow_proto_mac
,
0
,
(
1
<<
ports
.
num_physical_ports
),
STATIC
,
OVERRIDE_EXISTING
);
if
(
err
)
return
err
;
}
...
...
@@ -110,15 +110,15 @@ static int rtu_create_static_entries()
mac_to_string
(
pstate
.
hw_addr
)
);
err
=
rtu_fd_create_entry
(
pstate
.
hw_addr
,
0
,
(
1
<<
ports
.
num_physical_ports
),
STATIC
);
err
=
rtu_fd_create_entry
(
pstate
.
hw_addr
,
0
,
(
1
<<
ports
.
num_physical_ports
),
STATIC
,
OVERRIDE_EXISTING
);
if
(
err
)
return
err
;
}
// Broadcast MAC
TRACE
(
TRACE_INFO
,
"adding static route for broadcast MAC..."
);
err
=
rtu_fd_create_entry
(
bcast_mac
,
0
,
enabled_port_mask
|
(
1
<<
ports
.
num_physical_ports
),
STATIC
);
err
=
rtu_fd_create_entry
(
ptp_mcast_mac
,
0
,
(
1
<<
ports
.
num_physical_ports
),
STATIC
);
err
=
rtu_fd_create_entry
(
bcast_mac
,
0
,
enabled_port_mask
|
(
1
<<
ports
.
num_physical_ports
),
STATIC
,
OVERRIDE_EXISTING
);
err
=
rtu_fd_create_entry
(
ptp_mcast_mac
,
0
,
(
1
<<
ports
.
num_physical_ports
),
STATIC
,
OVERRIDE_EXISTING
);
if
(
err
)
return
err
;
...
...
@@ -241,7 +241,7 @@ static int rtu_daemon_learning_process()
vid
=
req
.
has_vid
?
req
.
vid
:
0
;
port_map
=
(
1
<<
req
.
port_id
);
// create or update entry at filtering database
err
=
rtu_fd_create_entry
(
req
.
src
,
vid
,
port_map
,
DYNAMIC
);
err
=
rtu_fd_create_entry
(
req
.
src
,
vid
,
port_map
,
DYNAMIC
,
OVERRIDE_EXISTING
);
err
=
0
;
if
(
err
==
-
ENOMEM
)
{
// TODO remove oldest entries (802.1D says you MAY do it)
...
...
userspace/wrsw_rtud/rtud_exports.c
View file @
51b08025
...
...
@@ -128,7 +128,7 @@ int rtudexp_add_entry(const struct minipc_pd *pd,
TRACE
(
TRACE_INFO
,
"Create entry for (MAC=%s) port %x, mode:%s"
,
mac_to_string
(
mac_tmp
),
1
<<
port
,(
mode
)
?
"DYNAMIC"
:
"STATIC"
);
*
p_ret
=
rtu_fd_create_entry
(
mac_tmp
,
0
,
1
<<
port
,
mode
);
*
p_ret
=
rtu_fd_create_entry
(
mac_tmp
,
0
,
1
<<
port
,
mode
,
OVERRIDE_EXISTING
);
return
*
p_ret
;
}
...
...
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