Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gPTP gptp_priority_vector struct field ordering is wrong #28177

Closed
jukkar opened this issue Sep 8, 2020 · 1 comment
Closed

gPTP gptp_priority_vector struct field ordering is wrong #28177

jukkar opened this issue Sep 8, 2020 · 1 comment
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Milestone

Comments

@jukkar
Copy link
Member

jukkar commented Sep 8, 2020

Describe the bug
The field ordering of gptp_priority_vector is wrong. This affects how BMCA (Best Master Clock selection Algorithm) will choose the best clock.
Specifically the steps_removed field must be placed right after root_system_id in the gptp_priority_vector struct.
The struct should look like this:

struct gptp_priority_vector {
	/** Identity of the source clock. */
	struct gptp_root_system_identity root_system_id;

	/** Steps removed from the announce message transmitter and the
	 * master clock. Note that this field must be right after
	 * root_system_id as we are comparing root system id and steps
	 * removed in one memcmp()
	 */
	u16_t steps_removed;

	/** Port identity of the transmitting time-aware system. */
	struct gptp_port_identity src_port_id;

	/** Port number of the receiving port. */
	u16_t port_number;
} __packed;

This issue is already fixed in master but needs to be backported to 1.14.

@jukkar jukkar added bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug area: Networking labels Sep 8, 2020
@jukkar jukkar added this to the v1.14.3 milestone Sep 8, 2020
@jukkar jukkar self-assigned this Sep 8, 2020
jukkar added a commit to jukkar/zephyr that referenced this issue Sep 8, 2020
The steps_removed field must be placed right after root_system_id
so that priority vector comparision can be done in one memcmp()
call. This fixes the best master clock selection algorithm (BMCA).

Fixes zephyrproject-rtos#28177

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
@jukkar jukkar added this to To do in Backports Sep 22, 2020
@MaureenHelm MaureenHelm removed this from To do in Backports Sep 22, 2020
nashif pushed a commit that referenced this issue Sep 23, 2020
The steps_removed field must be placed right after root_system_id
so that priority vector comparision can be done in one memcmp()
call. This fixes the best master clock selection algorithm (BMCA).

Fixes #28177

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
@jukkar
Copy link
Member Author

jukkar commented Sep 29, 2020

Already merged.

@jukkar jukkar closed this as completed Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

1 participant