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
71b0ff55
Commit
71b0ff55
authored
Feb 08, 2019
by
Adam Wujek
💬
Committed by
Grzegorz Daniluk
Jan 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/snmp: add wrsPtpInstancePortName
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
8ced101b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
28 deletions
+44
-28
WR-SWITCH-MIB.txt
userspace/snmpd/WR-SWITCH-MIB.txt
+17
-9
wrsPtpInstanceTable.c
userspace/snmpd/wrsPtpInstanceTable.c
+25
-17
wrsPtpInstanceTable.h
userspace/snmpd/wrsPtpInstanceTable.h
+2
-2
No files found.
userspace/snmpd/WR-SWITCH-MIB.txt
View file @
71b0ff55
...
...
@@ -2658,7 +2658,7 @@ wrsPtpInstancePort OBJECT-TYPE
"Port number on which an instance is running"
::= { wrsPtpInstanceEntry 2 }
wrsPtpInstanceName OBJECT-TYPE
wrsPtpInstance
Port
Name OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..12))
MAX-ACCESS read-only
STATUS current
...
...
@@ -2666,6 +2666,14 @@ wrsPtpInstanceName OBJECT-TYPE
"Port name of port"
::= { wrsPtpInstanceEntry 3 }
wrsPtpInstanceName OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..12))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Name of an instance"
::= { wrsPtpInstanceEntry 4 }
wrsPtpInstanceState OBJECT-TYPE
SYNTAX INTEGER {
na(0),
...
...
@@ -2701,7 +2709,7 @@ wrsPtpInstanceState OBJECT-TYPE
STATUS current
DESCRIPTION
"Name of instance"
::= { wrsPtpInstanceEntry
4
}
::= { wrsPtpInstanceEntry
5
}
wrsPtpInstanceStateNext OBJECT-TYPE
SYNTAX INTEGER {
...
...
@@ -2738,7 +2746,7 @@ wrsPtpInstanceStateNext OBJECT-TYPE
STATUS current
DESCRIPTION
"Name of instance"
::= { wrsPtpInstanceEntry
5
}
::= { wrsPtpInstanceEntry
6
}
wrsPtpInstanceRole OBJECT-TYPE
SYNTAX INTEGER {
...
...
@@ -2751,7 +2759,7 @@ wrsPtpInstanceRole OBJECT-TYPE
STATUS current
DESCRIPTION
"Role of instance"
::= { wrsPtpInstanceEntry
6
}
::= { wrsPtpInstanceEntry
7
}
wrsPtpInstanceMechanism OBJECT-TYPE
SYNTAX INTEGER {
...
...
@@ -2763,7 +2771,7 @@ wrsPtpInstanceMechanism OBJECT-TYPE
STATUS current
DESCRIPTION
"Mechanism used by an instance"
::= { wrsPtpInstanceEntry
7
}
::= { wrsPtpInstanceEntry
8
}
wrsPtpInstanceProto OBJECT-TYPE
SYNTAX INTEGER {
...
...
@@ -2776,7 +2784,7 @@ wrsPtpInstanceProto OBJECT-TYPE
STATUS current
DESCRIPTION
"Protocol used by an instance"
::= { wrsPtpInstanceEntry
8
}
::= { wrsPtpInstanceEntry
9
}
wrsPtpInstanceExt OBJECT-TYPE
SYNTAX INTEGER {
...
...
@@ -2788,7 +2796,7 @@ wrsPtpInstanceExt OBJECT-TYPE
STATUS current
DESCRIPTION
"Extension used by an instance"
::= { wrsPtpInstanceEntry
9
}
::= { wrsPtpInstanceEntry
10
}
wrsPtpInstancePeerMac OBJECT-TYPE
SYNTAX PhysAddress
...
...
@@ -2796,7 +2804,7 @@ wrsPtpInstancePeerMac OBJECT-TYPE
STATUS current
DESCRIPTION
"VID used by an instance"
::= { wrsPtpInstanceEntry 1
0
}
::= { wrsPtpInstanceEntry 1
1
}
wrsPtpInstancePeerVid OBJECT-TYPE
SYNTAX Integer
...
...
@@ -2804,7 +2812,7 @@ wrsPtpInstancePeerVid OBJECT-TYPE
STATUS current
DESCRIPTION
"VID used by an instance"
::= { wrsPtpInstanceEntry 1
1
}
::= { wrsPtpInstanceEntry 1
2
}
--wrsNetworking
--Configuration
...
...
userspace/snmpd/wrsPtpInstanceTable.c
View file @
71b0ff55
...
...
@@ -8,6 +8,7 @@ static struct pickinfo wrsPtpInstanceTable_pickinfo[] = {
/* Warning: strings are a special case for snmp format */
FIELD
(
wrsPtpInstanceTable_s
,
ASN_UNSIGNED
,
wrsPtpInstanceIndex
),
/* not reported */
FIELD
(
wrsPtpInstanceTable_s
,
ASN_INTEGER
,
wrsPtpInstancePort
),
FIELD
(
wrsPtpInstanceTable_s
,
ASN_OCTET_STR
,
wrsPtpInstancePortName
),
FIELD
(
wrsPtpInstanceTable_s
,
ASN_OCTET_STR
,
wrsPtpInstanceName
),
FIELD
(
wrsPtpInstanceTable_s
,
ASN_INTEGER
,
wrsPtpInstanceState
),
FIELD
(
wrsPtpInstanceTable_s
,
ASN_INTEGER
,
wrsPtpInstanceStateNext
),
...
...
@@ -19,14 +20,14 @@ static struct pickinfo wrsPtpInstanceTable_pickinfo[] = {
FIELD
(
wrsPtpInstanceTable_s
,
ASN_INTEGER
,
wrsPtpInstancePeerVid
),
};
static
in
t32_t
int_saturate
(
int64_t
valu
e
)
static
in
line
struct
hal_port_state
*
pp_wrs_lookup_port
(
char
*
nam
e
)
{
if
(
value
>=
INT32_MAX
)
return
INT32_MAX
;
else
if
(
value
<=
INT32_MIN
)
return
INT32_MIN
;
int
i
;
return
value
;
for
(
i
=
0
;
i
<
hal_nports_local
;
i
++
)
if
(
hal_ports
[
i
].
in_use
&&!
strcmp
(
name
,
hal_ports
[
i
].
name
))
return
hal_ports
+
i
;
return
NULL
;
}
time_t
wrsPtpInstanceTable_data_fill
(
unsigned
int
*
n_rows
)
...
...
@@ -38,7 +39,8 @@ time_t wrsPtpInstanceTable_data_fill(unsigned int *n_rows)
static
int
n_rows_local
=
0
;
struct
wrsPtpInstanceTable_s
*
i_a
;
struct
pp_instance
*
ppsi_i
;
char
*
ppsi_iface_name
;
char
*
tmp_name
;
struct
hal_port_state
*
p
;
/* number of rows does not change for wrsPortStatusTable */
if
(
n_rows
)
...
...
@@ -71,30 +73,36 @@ time_t wrsPtpInstanceTable_data_fill(unsigned int *n_rows)
while
(
1
)
{
ii
=
wrs_shm_seqbegin
(
ppsi_head
);
/* Match port name with interface name of ppsi instance.
* More than one ppsi_iface_name can match to
* wrsPortStatusTable_array[i].wrsPortStatusPortName, but only one can
* match way round */
for
(
i
=
0
;
i
<
*
ppsi_ppi_nlinks
;
i
++
)
{
ppsi_i
=
ppsi_ppi
+
i
;
/* (ppsi_ppi + i)->iface_name is a pointer in
* shmem, so we have to follow it
* NOTE: ppi->cfg.port_name cannot be used instead,
* NOTE: pp
si_
i->cfg.port_name cannot be used instead,
* because it is not used when ppsi is configured from
* cmdline */
i_a
[
i
].
wrsPtpInstancePort
=
ppsi_i
->
port_idx
+
1
;
ppsi_iface
_name
=
(
char
*
)
wrs_shm_follow
(
ppsi_head
,
tmp
_name
=
(
char
*
)
wrs_shm_follow
(
ppsi_head
,
ppsi_i
->
port_name
);
strncpy
(
i_a
[
i
].
wrsPtpInstanceName
,
ppsi_iface
_name
,
12
);
strncpy
(
i_a
[
i
].
wrsPtpInstanceName
,
tmp
_name
,
12
);
i_a
[
i
].
wrsPtpInstanceName
[
11
]
=
'\0'
;
tmp_name
=
(
char
*
)
wrs_shm_follow
(
ppsi_head
,
ppsi_i
->
iface_name
);
strncpy
(
i_a
[
i
].
wrsPtpInstancePortName
,
tmp_name
,
12
);
i_a
[
i
].
wrsPtpInstancePortName
[
11
]
=
'\0'
;
p
=
pp_wrs_lookup_port
(
tmp_name
);
if
(
p
)
i_a
[
i
].
wrsPtpInstancePort
=
p
->
hw_index
+
1
;
i_a
[
i
].
wrsPtpInstanceState
=
ppsi_i
->
state
;
i_a
[
i
].
wrsPtpInstanceStateNext
=
ppsi_i
->
next_state
;
i_a
[
i
].
wrsPtpInstanceRole
=
ppsi_i
->
role
+
1
;
i_a
[
i
].
wrsPtpInstanceMechanism
=
ppsi_i
->
mech
+
1
;
i_a
[
i
].
wrsPtpInstanceProto
=
ppsi_i
->
proto
+
1
;
i_a
[
i
].
wrsPtpInstanceExt
=
ppsi_i
->
cfg
.
ext
+
1
;
memcpy
(
i_a
[
i
].
wrsPtpInstancePeerMac
,
ppsi_i
->
peer
,
ETH_ALEN
);
i_a
[
i
].
wrsPtpInstancePeerVid
=
ppsi_i
->
peer_vid
;
}
...
...
userspace/snmpd/wrsPtpInstanceTable.h
View file @
71b0ff55
...
...
@@ -9,8 +9,8 @@ struct wrsPtpInstanceTable_s {
uint32_t
wrsPtpInstanceIndex
;
/* not reported, index fields has t o be marked
* as not-accessible in MIB */
int
wrsPtpInstancePort
;
/* port on which ptp instance is running (index+1) */
char
wrsPtpInstance
Name
[
12
];
/* port name on which ptp instance is
* running
*/
char
wrsPtpInstance
PortName
[
12
];
/* port name on which ptp instance is running (wriX) */
char
wrsPtpInstanceName
[
12
];
/* Instance name
*/
int
wrsPtpInstanceState
;
int
wrsPtpInstanceStateNext
;
int
wrsPtpInstanceRole
;
...
...
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