Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PPSi
Manage
Activity
Members
Labels
Plan
Issues
55
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
PPSi
Commits
3436fdc8
Commit
3436fdc8
authored
5 years ago
by
Jean-Claude BAU
Browse files
Options
Downloads
Patches
Plain Diff
Fix Clock identity calculation from mac address
parent
b2195fc0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
proto-standard/state-initializing.c
+12
-15
12 additions, 15 deletions
proto-standard/state-initializing.c
with
12 additions
and
15 deletions
proto-standard/state-initializing.c
+
12
−
15
View file @
3436fdc8
...
...
@@ -45,7 +45,6 @@ int pp_initializing(struct pp_instance *ppi, void *buf, int len)
int
i
;
int
initds
=
1
;
if
(
ppg
->
rt_opts
->
clock_quality_clockClass
==
PP_PTP_CLASS_GM_LOCKED
&&
DSDEF
(
ppi
)
->
clockQuality
.
clockClass
!=
PP_PTP_CLASS_GM_LOCKED
)
{
// GM not locked
...
...
@@ -70,22 +69,20 @@ int pp_initializing(struct pp_instance *ppi, void *buf, int len)
unsigned
char
mac_port1
[
PP_MAC_ADRESS_SIZE
];
unsigned
char
*
mac
;
unsigned
char
*
pci
;
unsigned
char
portIdx
=
ppi
-
ppi
->
glbs
->
pp_instances
;
if
(
get_numberPorts
(
GDSDEF
(
ppg
))
>
1
)
{
if
(
get_numberPorts
(
GDSDEF
(
ppg
))
>
1
&&
portIdx
!=
0
)
{
/* Clock identity comes from mac address with 0xff:0xfe intermixed */
/* calculate MAC of Port 0 */
unsigned
char
portIdx
;
if
(
(
portIdx
=
ppi
-
ppi
->
glbs
->
pp_instances
)
>
0
)
{
unsigned
char
*
mac
=
ppi
->
ch
[
PP_NP_GEN
].
addr
;
unsigned
char
remainder
=
portIdx
;
for
(
i
=
sizeof
(
mac_port1
)
-
1
;
i
>=
0
;
i
--
)
{
mac_port1
[
i
]
=
mac
[
i
]
-
remainder
;
if
(
mac
[
i
]
>=
remainder
)
remainder
=
0
;
else
remainder
=
1
;
}
unsigned
char
*
mac
=
ppi
->
ch
[
PP_NP_GEN
].
addr
;
unsigned
char
remainder
=
portIdx
;
for
(
i
=
sizeof
(
mac_port1
)
-
1
;
i
>=
0
;
i
--
)
{
mac_port1
[
i
]
=
mac
[
i
]
-
remainder
;
if
(
mac
[
i
]
>=
remainder
)
remainder
=
0
;
else
remainder
=
1
;
}
}
else
{
memcpy
(
mac_port1
,
ppi
->
ch
[
PP_NP_GEN
].
addr
,
sizeof
(
mac_port1
));
...
...
@@ -97,7 +94,7 @@ int pp_initializing(struct pp_instance *ppi, void *buf, int len)
*
(
pci
++
)
=
0xfe
;
*
(
pci
++
)
=*
(
mac
++
);
*
(
pci
++
)
=*
(
mac
++
);
*
pci
=*
mac
;
init_parent_ds
(
ppi
);
init_parent_ds
(
ppi
);
}
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment