Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
PPSi
Commits
a3328e8b
Commit
a3328e8b
authored
Jul 21, 2017
by
Sven Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default dataset: fixed MAC calculation since only available when port is up.
parent
b93c9fba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
29 deletions
+32
-29
state-initializing.c
proto-standard/state-initializing.c
+32
-29
No files found.
proto-standard/state-initializing.c
View file @
a3328e8b
...
...
@@ -38,47 +38,50 @@ static void init_parent_ds(struct pp_instance *ppi)
int
pp_initializing
(
struct
pp_instance
*
ppi
,
void
*
buf
,
int
len
)
{
unsigned
char
*
id
,
*
mac
;
unsigned
char
*
mac
;
unsigned
char
mac_port1
[
6
];
struct
DSPort
*
port
=
DSPOR
(
ppi
);
struct
pp_runtime_opts
*
opt
=
OPTS
(
ppi
);
struct
pp_globals
*
ppg
=
GLBS
(
ppi
);
int
init_dspar
=
1
;
int
ret
=
0
;
int
i
;
int
i
,
j
;
unsigned
int
portidx
;
unsigned
int
remainder
;
if
(
ppi
->
n_ops
->
init
(
ppi
)
<
0
)
/* it must handle being called twice */
goto
failure
;
/* only fill in the
parent
data set when initializing */
/* only fill in the data set when initializing */
if
(
DSDEF
(
ppi
)
->
numberPorts
>
1
)
{
for
(
i
=
0
;
i
<
ppg
->
defaultDS
->
numberPorts
;
i
++
)
{
if
(
INST
(
ppg
,
i
)
->
state
!=
PPS_INITIALIZING
)
init_dspar
=
0
;
}
}
if
(
init_dspar
)
init_parent_ds
(
ppi
);
/* Clock identity comes from mac address with 0xff:0xfe intermixed */
id
=
(
unsigned
char
*
)
&
DSDEF
(
ppi
)
->
clockIdentity
;
/* we always take the one from the first port */
mac
=
INST
(
ppg
,
0
)
->
ch
[
PP_NP_GEN
].
addr
;
id
[
0
]
=
mac
[
0
];
id
[
1
]
=
mac
[
1
];
id
[
2
]
=
mac
[
2
];
id
[
3
]
=
0xff
;
id
[
4
]
=
0xfe
;
id
[
5
]
=
mac
[
3
];
id
[
6
]
=
mac
[
4
];
id
[
7
]
=
mac
[
5
];
if
(
INST
(
ppg
,
i
)
->
state
!=
PPS_INITIALIZING
)
{
/* Clock identity comes from mac address with 0xff:0xfe intermixed */
mac
=
ppi
->
ch
[
PP_NP_GEN
].
addr
;
/* calculate MAC of Port 0 */
portidx
=
ppi
-
ppi
->
glbs
->
pp_instances
;
remainder
=
portidx
;
for
(
j
=
5
;
j
>=
0
;
j
--
)
{
mac_port1
[
j
]
=
mac
[
j
]
-
remainder
;
if
(
mac
[
j
]
>=
remainder
)
remainder
=
0
;
else
remainder
=
1
;
}
/*
* Initialize parent data set
*/
if
(
init_dspar
)
init_parent_ds
(
ppi
);
DSDEF
(
ppi
)
->
clockIdentity
.
id
[
0
]
=
mac_port1
[
0
];
DSDEF
(
ppi
)
->
clockIdentity
.
id
[
1
]
=
mac_port1
[
1
];
DSDEF
(
ppi
)
->
clockIdentity
.
id
[
2
]
=
mac_port1
[
2
];
DSDEF
(
ppi
)
->
clockIdentity
.
id
[
3
]
=
0xff
;
DSDEF
(
ppi
)
->
clockIdentity
.
id
[
4
]
=
0xfe
;
DSDEF
(
ppi
)
->
clockIdentity
.
id
[
5
]
=
mac_port1
[
3
];
DSDEF
(
ppi
)
->
clockIdentity
.
id
[
6
]
=
mac_port1
[
4
];
DSDEF
(
ppi
)
->
clockIdentity
.
id
[
7
]
=
mac_port1
[
5
];
init_parent_ds
(
ppi
);
}
}
}
/*
* Initialize port data set
*/
...
...
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