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
f542031a
Commit
f542031a
authored
Jun 27, 2012
by
Juan Luis Manas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/wrsw_snmpd: fixed returned port number from ieee8021QBridgeTpFdbTable.
parent
1d2161e7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
88 deletions
+140
-88
rtu_fd.c
userspace/wrsw_rtud/rtu_fd.c
+10
-5
rtu_fd.h
userspace/wrsw_rtud/rtu_fd.h
+2
-0
rtu_fd_proxy.c
userspace/wrsw_rtud/rtu_fd_proxy.c
+62
-59
rtu_fd_proxy.h
userspace/wrsw_rtud/rtu_fd_proxy.h
+2
-0
rtu_fd_srv.c
userspace/wrsw_rtud/rtu_fd_srv.c
+2
-0
rtu_fd_structs.h
userspace/wrsw_rtud/rtu_fd_structs.h
+2
-0
ieee8021QBridgeTpFdbTable.c
...ce/wrsw_snmpd/ieee8021Qbridge/ieee8021QBridgeTpFdbTable.c
+48
-15
ieee8021QBridgeTpGroupTable.c
.../wrsw_snmpd/ieee8021Qbridge/ieee8021QBridgeTpGroupTable.c
+12
-9
No files found.
userspace/wrsw_rtud/rtu_fd.c
View file @
f542031a
...
...
@@ -607,11 +607,11 @@ static int fe_insert_static_entry(uint16_t vid,
// If an entry already exists in the fdb for the same mac and fid
// just register static entry in static_fdb list associated to it
// (if the static entry was only updated, it is already registered),
// and recalculate the forward vector combining static and dynamic info
// and recalculate the forward vector combining static and dynamic info
fe_register_static_entry
(
sfe
,
fe
);
calculate_forward_vector
(
fe
->
static_fdb
,
&
_port_map
,
&
_use_dynamic
);
ret
=
fe_update
(
fe
,
_port_map
,
ve
->
port_mask
,
_use_dynamic
,
STATIC
);
fe
->
is_bpdu
|=
sfe
->
is_bpdu
;
fe
->
is_bpdu
|=
sfe
->
is_bpdu
;
}
else
{
// Create pure static entry
calculate_forward_vector
(
sfe
,
&
_port_map
,
&
_use_dynamic
);
...
...
@@ -619,7 +619,7 @@ static int fe_insert_static_entry(uint16_t vid,
_use_dynamic
,
STATIC
);
if
(
ret
==
0
)
{
fe_register_static_entry
(
sfe
,
fe
);
fe
->
is_bpdu
|=
sfe
->
is_bpdu
;
fe
->
is_bpdu
|=
sfe
->
is_bpdu
;
}
}
return
ret
;
...
...
@@ -913,13 +913,15 @@ int rtu_fdb_create_dynamic_entry(uint8_t mac[ETH_ALEN],
int
rtu_fdb_read_entry
(
uint8_t
mac
[
ETH_ALEN
],
// in
uint8_t
fid
,
// in
uint32_t
*
port_map
,
// out
uint32_t
*
use_dynamic
,
// out
int
*
entry_type
)
// out
{
struct
filtering_entry
*
fe
;
lock
();
if
(
rtu_sw_find_entry
(
mac
,
fid
,
&
fe
))
{
*
port_map
=
fe
->
port_mask_dst
;
*
port_map
=
fe
->
port_mask_dst
;
*
use_dynamic
=
fe
->
use_dynamic
;
*
entry_type
=
fe
->
dynamic
;
return
unlock
(
0
);
}
...
...
@@ -934,6 +936,7 @@ int rtu_fdb_read_entry(uint8_t mac[ETH_ALEN], // in
int
rtu_fdb_read_next_entry
(
uint8_t
(
*
mac
)[
ETH_ALEN
],
// inout
uint8_t
*
fid
,
// inout
uint32_t
*
port_map
,
// out
uint32_t
*
use_dynamic
,
// out
int
*
entry_type
)
// out
{
struct
filtering_entry
*
fe
;
...
...
@@ -950,11 +953,13 @@ int rtu_fdb_read_next_entry(uint8_t (*mac)[ETH_ALEN], // inout
// htab/hcam should be always consistent
mac_copy
(
*
mac
,
fe
->
mac
);
*
fid
=
fe
->
fid
;
*
port_map
=
fe
->
port_mask_dst
;
*
port_map
=
fe
->
port_mask_dst
;
*
use_dynamic
=
fe
->
use_dynamic
;
*
entry_type
=
fe
->
dynamic
;
return
unlock
(
0
);
}
void
rtu_fdb_delete_dynamic_entries
(
int
port
,
uint16_t
vid
)
{
if
(
illegal
(
port
)
||
reserved
(
vid
))
...
...
userspace/wrsw_rtud/rtu_fd.h
View file @
f542031a
...
...
@@ -56,6 +56,7 @@ int rtu_fdb_read_entry(
uint8_t
mac
[
ETH_ALEN
],
uint8_t
fid
,
uint32_t
*
port_map
,
uint32_t
*
use_dynamic
,
int
*
entry_type
)
__attribute__
((
warn_unused_result
));
...
...
@@ -63,6 +64,7 @@ int rtu_fdb_read_next_entry(
uint8_t
(
*
mac
)[
ETH_ALEN
],
// inout
uint8_t
*
fid
,
// inout
uint32_t
*
port_map
,
// out
uint32_t
*
use_dynamic
,
// out
int
*
entry_type
// out
)
__attribute__
((
warn_unused_result
));
...
...
userspace/wrsw_rtud/rtu_fd_proxy.c
View file @
f542031a
This diff is collapsed.
Click to expand it.
userspace/wrsw_rtud/rtu_fd_proxy.h
View file @
f542031a
...
...
@@ -56,6 +56,7 @@ int rtu_fdb_proxy_read_entry(
uint8_t
mac
[
ETH_ALEN
],
uint8_t
fid
,
uint32_t
*
port_map
,
uint32_t
*
use_dynamic
,
int
*
entry_type
)
__attribute__
((
warn_unused_result
));
...
...
@@ -63,6 +64,7 @@ int rtu_fdb_proxy_read_next_entry(
uint8_t
(
*
mac
)[
ETH_ALEN
],
// inout
uint8_t
*
fid
,
// inout
uint32_t
*
port_map
,
// out
uint32_t
*
use_dynamic
,
// out
int
*
entry_type
// out
)
__attribute__
((
warn_unused_result
));
...
...
userspace/wrsw_rtud/rtu_fd_srv.c
View file @
f542031a
...
...
@@ -138,6 +138,7 @@ static int rtu_fdb_srv_read_entry(
in
->
mac
,
in
->
fid
,
&
out
->
port_map
,
&
out
->
use_dynamic
,
&
out
->
entry_type
);
...
...
@@ -157,6 +158,7 @@ static int rtu_fdb_srv_read_next_entry(
&
in
->
mac
,
&
in
->
fid
,
&
out
->
port_map
,
&
out
->
use_dynamic
,
&
out
->
entry_type
);
...
...
userspace/wrsw_rtud/rtu_fd_structs.h
View file @
f542031a
...
...
@@ -93,6 +93,7 @@ struct rtu_fdb_read_entry_argdata {
struct
rtu_fdb_read_entry_retdata
{
int
retval
;
uint32_t
port_map
;
uint32_t
use_dynamic
;
int
entry_type
;
};
...
...
@@ -107,6 +108,7 @@ struct rtu_fdb_read_next_entry_retdata {
uint8_t
mac
[
ETH_ALEN
];
uint8_t
fid
;
uint32_t
port_map
;
uint32_t
use_dynamic
;
int
entry_type
;
};
...
...
userspace/wrsw_snmpd/ieee8021Qbridge/ieee8021QBridgeTpFdbTable.c
View file @
f542031a
...
...
@@ -51,16 +51,50 @@ struct mib_fdb_table_entry {
// Columns
uint32_t
port_map
;
uint32_t
use_dynamic
;
int
type
;
};
static
int
_log2
(
uint32_t
val
)
{
int
ret
=
-
1
;
while
(
val
>>=
1
)
ret
++
;
return
ret
;
}
static
unsigned
int
port_no
(
struct
mib_fdb_table_entry
*
ent
)
{
int
ret
=
-
1
;
uint32_t
port_map_dyn
,
port_map_stc
,
port_map
;
switch
(
ent
->
type
)
{
case
STATIC
:
return
0
;
case
DYNAMIC
:
port_map
=
ent
->
port_map
;
break
;
case
STATIC_DYNAMIC
:
port_map_dyn
=
ent
->
port_map
&
ent
->
use_dynamic
;
port_map_stc
=
ent
->
port_map
&
~
ent
->
use_dynamic
;
port_map
=
port_map_dyn
?
port_map_dyn
:
port_map_stc
;
break
;
}
while
(
port_map
)
{
ret
++
;
port_map
>>=
1
;
}
// TODO fix. port number 0 is reserved but RTU hardware uses it.
return
(
ret
==
-
1
)
?
0
:
ret
;
}
static
unsigned
int
entry_type
(
struct
mib_fdb_table_entry
*
ent
)
{
switch
(
ent
->
type
)
{
case
STATIC
:
return
Mgmt
;
case
DYNAMIC
:
return
ent
->
port_map
?
Learned
:
other
;
case
STATIC_DYNAMIC
:
return
(
ent
->
port_map
&
ent
->
use_dynamic
)
?
Learned
:
Mgmt
;
}
}
/**
* Get indexes for an entry.
...
...
@@ -111,11 +145,10 @@ static int get_column(netsnmp_variable_list *vb,
{
switch
(
colnum
)
{
case
COLUMN_PORT
:
snmp_set_var_typed_integer
(
vb
,
ASN_UNSIGNED
,
_log2
(
ent
->
port_map
));
snmp_set_var_typed_integer
(
vb
,
ASN_UNSIGNED
,
port_no
(
ent
));
break
;
case
COLUMN_STATUS
:
snmp_set_var_typed_integer
(
vb
,
ASN_INTEGER
,
(
ent
->
type
==
STATIC
)
?
Mgmt
:
Learned
);
snmp_set_var_typed_integer
(
vb
,
ASN_INTEGER
,
entry_type
(
ent
));
break
;
default:
return
SNMP_NOSUCHOBJECT
;
...
...
@@ -142,13 +175,14 @@ static int get(netsnmp_request_info *req, netsnmp_handler_registration *reginfo)
return
SNMP_NOSUCHINSTANCE
;
// Read entry from FDB.
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
ent
.
fid
,
&
ent
.
port_map
,
&
ent
.
type
);
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
ent
.
fid
,
&
ent
.
port_map
,
&
ent
.
use_dynamic
,
&
ent
.
type
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
goto
entry_not_found
;
return
get_column
(
req
->
requestvb
,
tinfo
->
colnum
,
&
ent
);
return
get_column
(
req
->
requestvb
,
tinfo
->
colnum
,
&
ent
);
entry_not_found:
DEBUGMSGTL
((
MIBMOD
,
"entry fid=%d mac=%s not found in fdb
\n
"
,
...
...
@@ -190,9 +224,8 @@ static int get_next(netsnmp_request_info *req,
return
SNMP_ENDOFMIBVIEW
;
do
{
err
=
rtu_fdb_proxy_read_next_entry
(
&
ent
.
mac
,
&
ent
.
fid
,
&
ent
.
port_map
,
&
ent
.
type
);
err
=
rtu_fdb_proxy_read_next_entry
(
&
ent
.
mac
,
&
ent
.
fid
,
&
ent
.
port_map
,
&
ent
.
use_dynamic
,
&
ent
.
type
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
...
...
userspace/wrsw_snmpd/ieee8021Qbridge/ieee8021QBridgeTpGroupTable.c
View file @
f542031a
...
...
@@ -51,6 +51,7 @@ struct mib_group_table_entry {
// Columns
uint32_t
port_map
;
uint32_t
use_dynamic
;
};
/**
...
...
@@ -65,7 +66,7 @@ static int read_next_vid(uint16_t *vid)
uint32_t
pm
,
us
;
unsigned
long
ct
;
err
=
rtu_fdb_proxy_read_vlan_entry
(
*
vid
,
&
fid
,
&
t
,
&
pm
,
&
us
,
&
ct
);
if
(
errno
)
goto
minipc_err
;
...
...
@@ -110,7 +111,7 @@ static int read_next_entry(struct mib_group_table_entry *ent)
vid_a
=
ent
->
vid
;
mac_copy
(
mac_a
,
ent
->
mac
);
err
=
rtu_fdb_proxy_read_next_static_entry
(
&
mac_a
,
&
vid_a
,
&
ep
,
&
fp
,
&
t
,
&
s
);
if
(
errno
)
goto
minipc_err
;
...
...
@@ -131,7 +132,7 @@ static int read_next_entry(struct mib_group_table_entry *ent)
vid_b
=
WILDCARD_VID
;
mac_copy
(
mac_b
,
ent
->
mac
);
err
=
rtu_fdb_proxy_read_next_static_entry
(
&
mac_b
,
&
vid_b
,
&
ep
,
&
fp
,
&
t
,
&
s
);
if
(
errno
)
goto
minipc_err
;
...
...
@@ -274,15 +275,16 @@ static int get(netsnmp_request_info *req, netsnmp_handler_registration *reginfo)
// 802.1Q (12.7.7) When operating on a Dynamic Filtering Entry [...] the
// value used in the VID parameter can be any VID that has been allocated
// to the FID concerned)
err
=
rtu_fdb_proxy_read_vlan_entry
(
ent
.
vid
,
&
fid
,
&
t
,
&
port_mask
,
&
us
,
&
ct
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
goto
vlan_not_found
;
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
fid
,
&
ent
.
port_map
,
&
t
);
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
fid
,
&
ent
.
port_map
,
&
ent
.
use_dynamic
,
&
t
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
...
...
@@ -334,15 +336,16 @@ static int get_next(netsnmp_request_info *req,
if
(
err
)
return
err
;
// Obtain FID assigned to VID
err
=
rtu_fdb_proxy_read_vlan_entry
(
ent
.
vid
,
&
fid
,
&
t
,
&
port_mask
,
&
us
,
&
ct
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
goto
vlan_not_found
;
// Read entry from FDB
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
fid
,
&
ent
.
port_map
,
&
t
);
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
fid
,
&
ent
.
port_map
,
&
ent
.
use_dynamic
,
&
t
);
if
(
errno
)
goto
minipc_err
;
if
(
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