net: gptp: Fix field ordering in gptp_priority_vector struct

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>
This commit is contained in:
Jukka Rissanen 2020-08-12 14:10:57 +03:00 committed by Anas Nashif
parent d9dad9859d
commit b22c95b746
1 changed files with 8 additions and 6 deletions

View File

@ -159,16 +159,18 @@ struct gptp_priority_vector {
/** Identity of the source clock. */
struct gptp_root_system_identity root_system_id;
/** portNumber of the receiving port. */
u16_t port_number;
/** 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;
/** Steps removed from the announce message transmitter and the
* master clock.
*/
u16_t steps_removed;
/** Port number of the receiving port. */
u16_t port_number;
} __packed;
/* Pdelay Request state machine variables. */