port: Add configurable option to set asCapable.

If set to 'true', this unconditionally sets the asCapable variable. The
usual checks will be applied to asCapable if it is set to 'auto'. The
default value is 'auto'.

This config option is needed by the Automotive Profile. The master will
be able to send out Sync Message as soon as the daemon is started.

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
master
Vedang Patel 2018-10-03 09:41:49 -07:00 committed by Richard Cochran
parent 386fc3ed89
commit 3f764aec6a
6 changed files with 75 additions and 5 deletions

45
as_capable.h 100644
View File

@ -0,0 +1,45 @@
/**
* @file as_capable.h
* @brief Enumerates the states for asCapable.
* @note Copyright (C) 2018 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef HAVE_AS_CAPABLE_H
#define HAVE_AS_CAPABLE_H
/* Enum used by the asCapable config option. */
enum as_capable_option {
AS_CAPABLE_TRUE,
AS_CAPABLE_AUTO,
};
/*
* Defines whether the device can interoperate with the device on other end via
* IEEE 802.1AS protocol.
*
* More information about this in Section 10.2.4.1 of IEEE 802.1AS standard.
*/
enum as_capable {
NOT_CAPABLE,
AS_CAPABLE,
/*
* Non-standard extension to support Automotive Profile. asCapable
* always set to true without checking the system at other end.
*/
ALWAYS_CAPABLE,
};
#endif

View File

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "as_capable.h"
#include "bmc.h" #include "bmc.h"
#include "clock.h" #include "clock.h"
#include "config.h" #include "config.h"
@ -195,8 +196,15 @@ static struct config_enum tsproc_enu[] = {
{ NULL, 0 }, { NULL, 0 },
}; };
static struct config_enum as_capable_enu[] = {
{ "true", AS_CAPABLE_TRUE },
{ "auto", AS_CAPABLE_AUTO },
{ NULL, 0 },
};
struct config_item config_tab[] = { struct config_item config_tab[] = {
PORT_ITEM_INT("announceReceiptTimeout", 3, 2, UINT8_MAX), PORT_ITEM_INT("announceReceiptTimeout", 3, 2, UINT8_MAX),
PORT_ITEM_ENU("asCapable", AS_CAPABLE_AUTO, as_capable_enu),
GLOB_ITEM_INT("assume_two_step", 0, 0, 1), GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
PORT_ITEM_INT("boundary_clock_jbod", 0, 0, 1), PORT_ITEM_INT("boundary_clock_jbod", 0, 0, 1),
GLOB_ITEM_INT("check_fup_sync", 0, 0, 1), GLOB_ITEM_INT("check_fup_sync", 0, 0, 1),

View File

@ -32,6 +32,7 @@ fault_reset_interval 4
neighborPropDelayThresh 20000000 neighborPropDelayThresh 20000000
masterOnly 0 masterOnly 0
G.8275.portDS.localPriority 128 G.8275.portDS.localPriority 128
asCapable auto
# #
# Run time options # Run time options
# #

17
port.c
View File

@ -644,15 +644,16 @@ static int port_capable(struct port *p)
} }
capable: capable:
if (!p->asCapable) if (p->asCapable == NOT_CAPABLE) {
pr_debug("port %hu: setting asCapable", portnum(p)); pr_debug("port %hu: setting asCapable", portnum(p));
p->asCapable = 1; p->asCapable = AS_CAPABLE;
}
return 1; return 1;
not_capable: not_capable:
if (p->asCapable) if (p->asCapable)
port_nrate_initialize(p); port_nrate_initialize(p);
p->asCapable = 0; p->asCapable = NOT_CAPABLE;
return 0; return 0;
} }
@ -742,6 +743,9 @@ static int port_sync_incapable(struct port *p)
static int port_is_ieee8021as(struct port *p) static int port_is_ieee8021as(struct port *p)
{ {
if (p->asCapable == ALWAYS_CAPABLE) {
return 0;
}
return p->follow_up_info ? 1 : 0; return p->follow_up_info ? 1 : 0;
} }
@ -1021,7 +1025,6 @@ static void port_nrate_initialize(struct port *p)
/* We start in the 'incapable' state. */ /* We start in the 'incapable' state. */
p->pdr_missing = ALLOWED_LOST_RESPONSES + 1; p->pdr_missing = ALLOWED_LOST_RESPONSES + 1;
p->asCapable = 0;
p->peer_portid_valid = 0; p->peer_portid_valid = 0;
@ -1600,6 +1603,12 @@ int port_initialize(struct port *p)
p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh"); p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh");
p->min_neighbor_prop_delay = config_get_int(cfg, p->name, "min_neighbor_prop_delay"); p->min_neighbor_prop_delay = config_get_int(cfg, p->name, "min_neighbor_prop_delay");
if (config_get_int(cfg, p->name, "asCapable") == AS_CAPABLE_TRUE) {
p->asCapable = ALWAYS_CAPABLE;
} else {
p->asCapable = NOT_CAPABLE;
}
for (i = 0; i < N_TIMER_FDS; i++) { for (i = 0; i < N_TIMER_FDS; i++) {
fd[i] = -1; fd[i] = -1;
} }

View File

@ -21,6 +21,7 @@
#include <sys/queue.h> #include <sys/queue.h>
#include "as_capable.h"
#include "clock.h" #include "clock.h"
#include "fsm.h" #include "fsm.h"
#include "msg.h" #include "msg.h"
@ -100,7 +101,7 @@ struct port {
struct PortIdentity portIdentity; struct PortIdentity portIdentity;
enum port_state state; /*portState*/ enum port_state state; /*portState*/
Integer64 asymmetry; Integer64 asymmetry;
int asCapable; enum as_capable asCapable;
Integer8 logMinDelayReqInterval; Integer8 logMinDelayReqInterval;
TimeInterval peerMeanPathDelay; TimeInterval peerMeanPathDelay;
Integer8 logAnnounceInterval; Integer8 logAnnounceInterval;

View File

@ -686,6 +686,12 @@ Check mode only check but do not set.
Full mode set the receive filter to mark all packets with hardware time stamp, Full mode set the receive filter to mark all packets with hardware time stamp,
so all applications can get them. so all applications can get them.
The default is normal. The default is normal.
.TP
.B asCapable
If set to 'true', all the checks which can unset asCapable variable (as
described in Section 10.2.4.1 of 802.1AS) are skipped. If set to 'auto',
asCapable is initialized to 'false' and will be set to 'true' after the
relevant checks have passed. The default value is 'auto'.
.SH UNICAST DISCOVERY OPTIONS .SH UNICAST DISCOVERY OPTIONS